feat(workflows): add JSON output for workflow run resume and status by doquanghuy · Pull Request #2814 · github/spec-kit (original) (raw)
Adds an opt-in --json flag to workflow run, workflow resume, and
workflow status that emits a single machine-readable object (run_id,
workflow_id, status, current step; status also reports per-step states
and a runs list) for automation and external orchestrators.
JSON is written via a small _emit_workflow_json helper using plain
stdout, so Rich markup, highlighting, and line-wrapping can never alter
the emitted object. Default human-readable output and exit codes are
unchanged when --json is omitted. Reference docs updated.
Closes github#2811.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
…json
Conflicts:
docs/reference/workflows.md
src/specify_cli/init.py
tests/test_workflows.py
Suppressing the banner and the step-start callback was not enough to guarantee a single parseable JSON object on stdout: individual steps still write there while the engine runs. The gate step prints its prompt, and the prompt step runs a CLI subprocess that inherits the process's stdout file descriptor — either can corrupt the JSON stream for interactive runs or integration-backed workflows.
Wrap engine.execute()/engine.resume() in a file-descriptor-level redirect (dup2) when --json is set, so both Python-level writes and inherited-fd subprocess output go to stderr while stdout carries only the emitted JSON. Step progress stays visible on stderr. status does not run the engine, so it is unaffected.
Tests cover both pollution channels (a Python print and a real subprocess) via fd-level capture, and the inactive no-op path. Docs note the stdout/stderr split.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
The redirect helper's docstring and its test comment wrote print\s,
which renders as "print\s" rather than "prints". Replace with plain
"prints".
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
…json
Conflicts:
docs/reference/workflows.md
kanfil added a commit to tikalk/agentic-sdlc-spec-kit that referenced this pull request
Merge upstream github/spec-kit (3 commits):
- rovodev Atlassian Rovo Dev integration (github#2539)
- workflow --json output for run/resume/status (github#2814)
- upversion to 0.9.5.dev0
Fork adjustments:
- Resolve pyproject.toml merge: keep fork identity, version 0.9.5+adlc1
- Resolve init.py merge: adopt upstream --json workflow plumbing, preserve fork theming (accent) in non-JSON print path
- Fix rovodev prompt/skill naming for fork: add _reconcile_rovodev_prompts in post_init so prompt wrappers and prompts.yml follow alias-aware skill names (spec-), not stale upstream speckit- names
- Update rovodev tests for fork alias-aware contract (spec-* + speckit-taskstoissues)
- Update FORK.md version history
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})