- Package name/Dependencies:
package.jsoncontains a circular dependency on@traisetech/autopilotand has an oddbinmapping. - JSON Output: Commands like
status,doctor, andconfig listdo not support the--jsonflag, making them hard for the VS Code extension to consume systemically. - Exit Codes: Currently, explicit failure modes don't use standardized exit codes (many just log an error or
process.exit(1)). - State File (
.autopilot-state.json): Written bycore/state.jsandcore/watcher.js(and maybe others), but it lacks a versioned structure and fields likerepoName,branchBlocked, etc. Non-atomic reads/writes can cause parsing errors. - Doctor: Functional, but
doctor.jschecks gemini vs grok key incorrectly based on process env and cannot output JSON format. It needs to check if the watcher is consistent. - Init: Doesn't effectively verify existing files, duplication can occur in
.gitignoreif not handled rigorously, and it doesn't always exit nicely with standard codes.
- Remove the self-referential
@traisetech/autopilotdependency.
- Define a dictionary of exit codes (SUCCESS=0, GENERL_ERROR=1, NOT_GIT_REPO=2, NOT_INITIALIZED=3, BLOCKED_BRANCH=4, INVALID_CONFIG=5, WATCHER_ALREADY_RUNNING=6, WATCHER_NOT_RUNNING=7).
- Update
program.command('status'),doctor, andconfigto specify.option('--json', 'Output JSON format').
- Accept
options. Ifoptions.jsonis true, collect all status data into an object andconsole.log(JSON.stringify(data, null, 2)). - Update state reading logic to use the unified state fields.
- Accept
options. Perform the checks, gather results in adiagnosticsarray, and output JSON if--jsonis found. - Map the explicit exit codes for issues if necessary, or just exit 0 with issues detailed.
- Check options. If
options.jsonis true, log the config object as pure JSON when usinglistorget.
- Update
StateManagerclass or export functions to support writing a versioned state schema atomicly. - Ensure fields:
version,repoRoot,repoName,running,paused,branch,branchBlocked,health,lastCommit,lastPush,queueDepth,conflictDetected,watcherPid,updatedAt,teamMode,aiMode.
- Restructure file creation (like
.autopilotrc.jsonand.gitignore) to ensure idempotency. Use standard exit codes.
- Update it to use the new
state.jsstructure when writing its state file.
- Document
--jsonflags, Exit Codes, and.autopilot-state.jsonAPI.