Skip to content

[Feature]: Machine-readable output for workflow run, resume, and status #2811

@doquanghuy

Description

@doquanghuy

Problem Statement

specify workflow run, workflow resume, and workflow status emit only human-formatted (Rich) output. Terminal states — completed, paused, failed, aborted — and the run id are not available in any machine-readable form. External tooling and automation that drive workflows non-interactively currently have to scrape prose (e.g. parse a Status: line) or read the internal .specify/workflows/runs/<id>/state.json files, neither of which is a stable public contract.

Proposed Solution

Add an additive, opt-in --json flag to workflow run, workflow resume, and workflow status that prints a single machine-readable object to stdout, for example:

{ "run_id": "bb05423f", "workflow_id": "probe-clar", "status": "paused", "current_step_id": "ask" }

Design intent:

  • General-purpose workflow reporting — not specific to any agent, orchestrator, or use case.
  • Default human output is unchanged; JSON is emitted only when --json is passed.
  • No change to semantic exit codes.
  • Does not expose internal state-file layout as a public contract; the JSON is a defined output surface.

This adds a new CLI argument, so per CONTRIBUTING.md ("introducing new ... arguments ... make sure that it was discussed and agreed upon by the project maintainers") I'm opening this as a discussion issue first and intentionally not attaching a PR until there's agreement on whether this is wanted and on the exact shape.

Alternatives Considered

  • Parsing the human Status: line from stdout — fragile and unversioned.
  • Reading .specify/workflows/runs/<id>/state.json directly — couples callers to internal layout.

Component

Specify CLI (initialization, commands)

AI Agent (if applicable)

None — engine/CLI feature, agent-independent.

Use Cases

  • A non-interactive runner needs to detect that a run paused vs. completed vs. failed and react accordingly.
  • CI capturing a run id for later workflow resume/status without scraping prose.

Acceptance Criteria

  • --json on run/resume/status prints one parseable object including at least run_id, workflow_id, and status.
  • Without --json, output is byte-identical to today.
  • Exit codes unchanged.

Additional Context

AI disclosure: this issue was drafted with AI assistance (Claude); the current output behaviour was verified against main before filing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions