feat(status): add --all for batch status of every active change#1301
feat(status): add --all for batch status of every active change#1301m-tanner wants to merge 4 commits into
Conversation
`openspec status --all --json` reports every active change in one
process instead of one CLI spawn (~500ms module-load) per change,
mirroring the existing `validate --all`. Emits a single
`{ changes: [ChangeStatus, ...], root }` envelope sorted by change
name; a change that fails to load contributes a per-change error entry
instead of failing the sweep. `--all` and `--change` are mutually
exclusive, honoring the --json null-shape on failure.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Validate --schema before the no-changes early return so a bogus schema fails consistently whether or not any change exists. - Text mode now exits 1 when any change fails to load (mirrors validate --all); JSON mode still exits 0 with per-change diagnostics. - Add tests for the --all --schema interaction (unknown schema null-shape, override propagation, broken-metadata precedence) and text-mode failure rendering. - Changeset heading to "### New Features" per repo convention; add status --all to the agent quick-reference table in docs/cli.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ort with validate
Code-review findings on --all:
- Pass failurePayload: { changes: [] } to resolveRootForCommand so a
root-selection failure under --all --json still emits the documented
batch null-shape (siblings like list/doctor/context already do this).
- Sort with localeCompare to match validate --all's ordering for
mixed-case change names.
- Extract a shared loadStatus helper so the batch and single-change
payloads cannot drift apart.
- Changeset no longer claims exact validate --all parity (JSON exit
semantics deliberately differ).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Simplify pass on the --all diff: hoist the { changes: [] } batch
null-shape into an exported BATCH_STATUS_FAILURE_PAYLOAD constant so
the root-resolution and CLI-wrapper failure paths cannot drift, replace
the conditional spread with the plain ternary the sibling call site
already uses, drop a redundant array copy before sort, and narrow the
text-mode failure counter to the boolean it actually is.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds a Changesstatus --all implementation
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant statusCommand
participant loadStatus
participant loadChangeContext
CLI->>statusCommand: status --all --json
statusCommand->>statusCommand: sort change names
loop each change
statusCommand->>loadStatus: loadStatus(changeName)
loadStatus->>loadChangeContext: load change context
loadChangeContext-->>loadStatus: context or error
loadStatus-->>statusCommand: status entry (success or diagnostic)
end
statusCommand-->>CLI: JSON envelope {changes, root} or text output with exit code
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/commands/workflow/status.ts (1)
162-167: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider mentioning
--allin the missing---changeerror.Now that
--allexists as an alternative, the error message could hint at it (e.g., "...or use --all to see status for every change") to improve discoverability.💡 Optional wording tweak
throw new Error( - `Missing required option --change. Available changes:\n ${available.join('\n ')}` + `Missing required option --change (or use --all). Available changes:\n ${available.join('\n ')}` );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/commands/workflow/status.ts` around lines 162 - 167, The missing-`--change` error in `status.ts` should mention the new `--all` alternative to improve discoverability. Update the `throw new Error(...)` message in the status command flow so it still lists `available` changes, but also hints that users can use `--all` to see status for every change; keep the wording tied to the existing `spinner?.stop()` / missing option branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/commands/workflow/status.ts`:
- Around line 162-167: The missing-`--change` error in `status.ts` should
mention the new `--all` alternative to improve discoverability. Update the
`throw new Error(...)` message in the status command flow so it still lists
`available` changes, but also hints that users can use `--all` to see status for
every change; keep the wording tied to the existing `spinner?.stop()` / missing
option branch.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0e186a55-4360-4d19-bb6e-4bc7689b690e
📒 Files selected for processing (8)
.changeset/status-all-flag.mddocs/agent-contract.mddocs/cli.mdsrc/cli/index.tssrc/commands/workflow/index.tssrc/commands/workflow/status.tssrc/core/completions/command-registry.tstest/commands/status-all.test.ts
What
Adds
openspec status --allto report the status of every active change in a single process, modeled directly on the existingvalidate --all.openspec status --all --jsonemits a single envelope:{ changes: [ChangeStatus, ...], root }, sorted by change name.{ changeName, status: [diagnostic] }) instead of aborting the whole sweep.1(same behavior asvalidate --all).--allis mutually exclusive with--change.Note the JSON sweep exits
0with per-change diagnostics, unlikevalidate's JSON mode — called out here since it's the one intentional divergence.Why
statuspreviously only worked one change at a time. Batch status makes it usable for dashboards/CI and brings it to parity withvalidate --all.Changes
src/commands/workflow/status.ts— batch sweep, per-change null-shape handling, sorting, root resolutionsrc/cli/index.ts,src/commands/workflow/index.ts—--allflag wiring + mutual exclusion with--changesrc/core/completions/command-registry.ts— completion entry for--alldocs/cli.md,docs/agent-contract.md— docstest/commands/status-all.test.ts— 13 tests covering JSON envelope, sort order, per-change failure shape, text-mode exit codes, and--schemainteraction.changeset/status-all-flag.md—minorrelease noteTesting
pnpm run build✅pnpm test— full suite green except one pre-existing failure intest/commands/artifact-workflow.test.ts("creates skills for Cursor tool"), which also fails onmainand is unrelated to this change.status-allsuite: 13/13 passing.Proposal note
This is a feature (
minorbump), so per CONTRIBUTING I want to flag it: it's a close parity addition mirroringvalidate --allrather than a net-new surface. Happy to write up an OpenSpec change proposal first if you'd prefer that before review.Attribution
Generated with Claude Code using claude-fable-5 & claude-opus-4-8, tested and verified as above.
Summary by CodeRabbit
New Features
openspec status --allto show the status of all active changes at once.changeslist and root details.Bug Fixes
--allsweep; other changes still report normally.--allcannot be combined with--change.Documentation