Skip to content

Add a stable JSON CLI contract #166

Description

@owainlewis

Goal

Make Push commands reliable for automation and agent use without making human output worse.

Scope

  • Add one documented global JSON output mode.
  • Return JSON success payloads on stdout and structured JSON errors on stderr.
  • Define stable exit-code categories for invalid input, configuration, unavailable dependencies, transient transport failures, conflicts, and unexpected failures.
  • Add machine-readable output for doctor, status, resolved paths, job list, job show, job validate, and job runs.
  • Keep the current concise human-readable output as the default.
  • Ensure JSON mode never mixes logs, tables, or progress text into stdout.
  • Include retryability only where Push can state it honestly. Unknown mutation outcomes must never be reported as safe to retry.
  • Document schemas and shell examples suitable for jq.

Dependencies

Non-goals

  • Do not require agents to send ordinary chat replies through the CLI.
  • Do not add an HTTP server, daemon API, or UI.
  • Do not expose credentials or message content in diagnostic payloads.

Acceptance criteria

  • Every scoped command produces valid JSON with no unrelated stdout text when JSON mode is selected.
  • Errors contain a stable category, human-readable message, and process exit code.
  • Sensitive configuration values are redacted.
  • Human output remains compatible unless a change is explicitly documented.
  • Snapshot or integration tests cover success, validation failure, missing config, unavailable backend, and redaction.
  • CLI reference and examples document the contract.

Verify

  • cargo fmt --all -- --check
  • cargo clippy --locked --all-targets -- -D warnings
  • cargo build --locked
  • cargo test --locked

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyScoped enough for an agent to pick upenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions