Skip to content

feat(status): add --all for batch status of every active change#1301

Open
m-tanner wants to merge 4 commits into
Fission-AI:mainfrom
m-tanner:feat/status-all
Open

feat(status): add --all for batch status of every active change#1301
m-tanner wants to merge 4 commits into
Fission-AI:mainfrom
m-tanner:feat/status-all

Conversation

@m-tanner

@m-tanner m-tanner commented Jul 3, 2026

Copy link
Copy Markdown

What

Adds openspec status --all to report the status of every active change in a single process, modeled directly on the existing validate --all.

  • openspec status --all --json emits a single envelope: { changes: [ChangeStatus, ...], root }, sorted by change name.
  • A change that fails to load contributes a per-change error entry ({ changeName, status: [diagnostic] }) instead of aborting the whole sweep.
  • In text mode, a failed change exits 1 (same behavior as validate --all).
  • --all is mutually exclusive with --change.

Note the JSON sweep exits 0 with per-change diagnostics, unlike validate's JSON mode — called out here since it's the one intentional divergence.

Why

status previously only worked one change at a time. Batch status makes it usable for dashboards/CI and brings it to parity with validate --all.

Changes

  • src/commands/workflow/status.ts — batch sweep, per-change null-shape handling, sorting, root resolution
  • src/cli/index.ts, src/commands/workflow/index.ts--all flag wiring + mutual exclusion with --change
  • src/core/completions/command-registry.ts — completion entry for --all
  • docs/cli.md, docs/agent-contract.md — docs
  • test/commands/status-all.test.ts — 13 tests covering JSON envelope, sort order, per-change failure shape, text-mode exit codes, and --schema interaction
  • .changeset/status-all-flag.mdminor release note

Testing

  • pnpm run build
  • pnpm test — full suite green except one pre-existing failure in test/commands/artifact-workflow.test.ts ("creates skills for Cursor tool"), which also fails on main and is unrelated to this change.
  • status-all suite: 13/13 passing.

Proposal note

This is a feature (minor bump), so per CONTRIBUTING I want to flag it: it's a close parity addition mirroring validate --all rather 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

    • Added openspec status --all to show the status of all active changes at once.
    • JSON output now returns a single envelope with a sorted changes list and root details.
  • Bug Fixes

    • Per-change load failures no longer stop the full --all sweep; other changes still report normally.
    • Improved failure handling and exit codes for text vs. JSON output.
    • Enforced that --all cannot be combined with --change.
  • Documentation

    • Updated CLI and agent-facing docs with the new bulk status behavior and examples.

m-tanner and others added 4 commits July 3, 2026 11:53
`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>
@m-tanner m-tanner requested a review from TabishB as a code owner July 3, 2026 20:15
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a --all flag to the status command enabling batch status reporting for all active changes, outputting a sorted JSON envelope or text listing, with per-change load failures recorded as diagnostics rather than aborting the sweep. Includes CLI wiring, documentation, and tests.

Changes

status --all implementation

Layer / File(s) Summary
Core batch status logic
src/commands/workflow/status.ts
Adds all?: boolean to StatusOptions, a BatchStatusEntry type, BATCH_STATUS_FAILURE_PAYLOAD constant, a shared loadStatus helper, and the --all execution path with sorted output, per-change error diagnostics, and text/JSON exit-code handling.
CLI flag and error wiring
src/cli/index.ts, src/commands/workflow/index.ts, src/core/completions/command-registry.ts
Adds --all option to the status CLI command and completions registry, wires BATCH_STATUS_FAILURE_PAYLOAD into failWithError, and re-exports the constant from the workflow module.
Documentation
.changeset/status-all-flag.md, docs/agent-contract.md, docs/cli.md
Documents the --all flag, JSON envelope shape (changes/root), sorting by name, mutual exclusion with --change, and text vs JSON exit-code behavior on failures.
Tests
test/commands/status-all.test.ts
Adds tests covering sorted output, empty envelope, entry structure, mutual-exclusion errors, per-change failure resilience, text-mode output, and --schema override interactions.

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
Loading

Possibly related PRs

  • Fission-AI/OpenSpec#443: Reworks loadChangeContext schema resolution used by the shared loadStatus helper introduced here.
  • Fission-AI/OpenSpec#759: Also modifies src/commands/workflow/status.ts to handle the "no active changes" case with a JSON envelope.
  • Fission-AI/OpenSpec#1089: Also updates JSON/text output of the statusCommand in src/commands/workflow/status.ts.

Suggested reviewers: TabishB, alfred-openspec

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding batch status --all for every active change.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/commands/workflow/status.ts (1)

162-167: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider mentioning --all in the missing---change error.

Now that --all exists 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

📥 Commits

Reviewing files that changed from the base of the PR and between 65a7233 and ba8107e.

📒 Files selected for processing (8)
  • .changeset/status-all-flag.md
  • docs/agent-contract.md
  • docs/cli.md
  • src/cli/index.ts
  • src/commands/workflow/index.ts
  • src/commands/workflow/status.ts
  • src/core/completions/command-registry.ts
  • test/commands/status-all.test.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant