Skip to main content

CLI contracts used by the extension

The extension treats the A2C CLI as the authoritative engine. These contracts are the first slice wired in v0.1.0; additional commands will gain explicit parsers and documentation before UI features depend on them.

Binary resolution

ModeSourceNotes
Production defaultresources/bin/<platform>/a2c[.exe]One binary per extension release
Developer overridea2c.cliPath settingAdvanced/local only
Developer overrideA2C_CLI_PATH env varTakes precedence over setting

C4 JSON envelope

When --json is passed, commands emit a single top-level object:

{
"ok": true,
"command": "repo.validate",
"version": "0.3.0",
"data": {},
"errors": [],
"warnings": []
}

Authoritative schema: a2c-workflow initial-contracts.md (C4).

Extension adapter: src/backend/parsers/envelopeParser.ts

a2c version (implemented)

Invocation:

a2c version

Working directory: optional A2C repository root (--path not passed in v0.1.0; version is global).

Expected stdout (single line):

a2c-core <semver>

Exit code: 0 on success.

Extension adapter: src/backend/parsers/versionParser.ts

a2c doctor --json (implemented)

FieldValue
commandrepo.doctor
data.rootRepository root path or null
data.healthytrue when all checks pass
data.checks{ name, ok, message }[]

Extension: BackendClient.runDoctor(), inspectRepository()

a2c validate --json (implemented)

FieldValue
commandrepo.validate
data.summaries{ kind, parsed, loader_errors }[] per artifact type
errors / warningsValidation issues with code, message, optional path

Extension: BackendClient.runValidate(), inspectRepository()

a2c list <kind> --json (implemented)

Commandcommand field
list epicsartifact.list.epics
list tasksartifact.list.tasks
list sprintsartifact.list.sprints
list adrsartifact.list.adrs

data.items contains planning artifact models (id, type, title, status, …) and relative_path to the Markdown source file. data.count is item length.

Extension: BackendClient.listEpics|listTasks|listSprints|listAdrs(), explorer tree categories, file open via relative_path.

a2c show <kind> <id> --json

Commandcommand field
show epicartifact.show.epic
show taskartifact.show.task
show sprintartifact.show.sprint

data.item is the full artifact model. The extension opens the file at relative_path from the list row and writes a show summary to the A2C output channel when a planning artifact is selected.

ADR rows come from list adrs --json; selecting an ADR opens relative_path via a2c.openRepositoryFile.

a2c config * --json (implemented — requires a2c-workflow with config commands)

Commandcommand fieldPurpose
config showconfig.showCurrent config JSON, path, recovery mode
config catalogconfig.catalogSchema-derived field metadata for explorer
config validateconfig.validateValidate on-disk .a2c/config.yaml
config validate --stdinconfig.validateValidate YAML draft before write
config save --stdinconfig.saveValidate and write JSON config to disk

Extension: BackendClient.configShow(), configCatalog(), configValidate(), inspectRepository(); commands a2c.openConfigFile, a2c.validateConfig; save hook on .a2c/config.yaml.

Until the bundled CLI is bumped to a workflow release that includes config commands, set A2C_CLI_PATH to a local a2c-workflow checkout.

a2c plan decompose-epic --json (implemented — M5 slice)

FieldValue
commandplan.decompose_epic
data.epic_idEpic that was decomposed
data.summaryProvider summary text
data.tasksTask draft objects (id, title, status, epic_id, body, optional rationale)
data.task_countLength of tasks

Invocation example:

a2c plan decompose-epic epic-onboarding --provider mock --json

Provider resolution matches the CLI: --provider > decomposition.provider in config > mock.

Extension: BackendClient.planDecomposeEpic(), command a2c.proposeTasksFromEpic (palette or epic context menu). Preview is written to the A2C output channel; apply is gated behind an explicit confirmation.

Requires a2c-workflow with plan/apply JSON support (set A2C_CLI_PATH until the bundled CLI is bumped).

a2c apply tasks-from-epic --json (implemented — M5 slice)

FieldValue
commandapply.tasks_from_epic
data.epic_idEpic whose cached proposal was applied
data.created_task_idsTask ids written under planning/tasks/
data.countLength of created_task_ids

Invocation example:

a2c apply tasks-from-epic epic-onboarding --json

Extension: BackendClient.applyTasksFromEpic(), invoked from the post-preview confirmation in a2c.proposeTasksFromEpic.

Error handling expectations

  • Non-zero exit code → envelope still emitted when --json is set; ok is false
  • Missing binary → explain bundled path and override options
  • Timeout → report timeout; do not retry silently
  • Unparseable stdout → report parse failure; do not infer version or status

Assumptions

  1. version requires no repository context.
  2. Repo-scoped commands use process cwd set to workspace.a2cRoot (or --path when invoked manually).
  3. JSON contracts are required for machine-readable workflows; human text output remains for terminal use.