Skip to content

feat(wt): add --json to coven wt --doctor#397

Merged
BunsDev merged 1 commit into
mainfrom
fix/395-wt-doctor-json
Jul 15, 2026
Merged

feat(wt): add --json to coven wt --doctor#397
BunsDev merged 1 commit into
mainfrom
fix/395-wt-doctor-json

Conversation

@BunsDev

@BunsDev BunsDev commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

Closes #395. coven wt --json was clap-bound to --list, leaving wt --doctor the only doctor surface without machine-readable output (coven doctor --json and coven adapter doctor --json already emit the shared contract).

  • coven wt --doctor --json now emits {ok, blocking, repo, worktree_root, claims_dir, checks: [{id, status, message, hint?}]} with stable check ids hook:pre-commit, hook:pre-push, layout, reusing the existing DoctorCheck shape. Exit-1-on-blocking semantics identical to prose mode.
  • Human prose output is byte-for-byte unchanged.
  • --json without --list/--doctor now fails with --json requires --list or --doctor instead of being silently ignored.
  • wt_doctor split into gather (WtDoctorReport) + render, so the JSON contract is unit-tested without a live repo (pattern: render_wt_list_json).
  • docs/reference/cli-wt.md documents the new mode with an example payload.

Part of the usability goal: every read command has --json parity + reference doc. (adapter list/doctor --json were verified already shipped; the goal note was stale.)

Testing

  • cargo fmt --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace --locked ✓ (1195 passed, 0 failed; 4 new tests)
  • python scripts/check-secrets.py
  • Live-verified: wt --doctor --json (exit 1 + JSON on findings), prose unchanged, wt <branch> --json rejected

coven wt --json was clap-bound to --list, leaving the wt doctor as the
only doctor surface without machine-readable output. --json now works
with --doctor too, emitting the established doctor contract
{ok, blocking, checks: [{id, status, message, hint?}]} plus the repo,
worktree_root, and claims_dir context lines, with identical exit-1
semantics on blocking findings. Human prose output is unchanged.

wt_doctor is split into gather (WtDoctorReport) + render so the JSON
shape is unit-tested without a live repo; stable check ids are
hook:pre-commit, hook:pre-push, layout. --json without --list/--doctor
now fails with a clear error instead of being silently ignored.

Closes #395

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 15, 2026 19:39

Copilot AI 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.

Pull request overview

Adds --json support to coven wt --doctor, bringing machine-readable output parity with other doctor surfaces while keeping the existing human/prose output unchanged.

Changes:

  • Allow coven wt --doctor --json to emit a stable JSON envelope { ok, blocking, repo, worktree_root, claims_dir, checks } using the shared DoctorCheck shape and existing exit-1-on-blocking semantics.
  • Enforce --json usage so it errors unless paired with --list or --doctor (instead of being silently ignored).
  • Refactor wt_doctor into gather + render, and add unit tests for the JSON renderer; document the new mode.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
docs/reference/cli-wt.md Documents coven wt --doctor --json and provides an example payload + stable check IDs.
crates/coven-cli/src/parallel_protocol.rs Implements JSON-capable wt --doctor via WtDoctorReport gather/render split, adds --json flag validation, and unit tests.
crates/coven-cli/src/main.rs Updates wt --json help text to reflect support for both --list and --doctor (runtime-validated).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@BunsDev
BunsDev merged commit ec23f68 into main Jul 15, 2026
18 checks passed
@BunsDev
BunsDev deleted the fix/395-wt-doctor-json branch July 17, 2026 15:12
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.

coven wt --doctor ignores --json (no machine-readable output)

2 participants