feat(wt): add --json to coven wt --doctor#397
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
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 --jsonto emit a stable JSON envelope{ ok, blocking, repo, worktree_root, claims_dir, checks }using the sharedDoctorCheckshape and existing exit-1-on-blocking semantics. - Enforce
--jsonusage so it errors unless paired with--listor--doctor(instead of being silently ignored). - Refactor
wt_doctorinto 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.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #395.
coven wt --jsonwas clap-bound to--list, leavingwt --doctorthe only doctor surface without machine-readable output (coven doctor --jsonandcoven adapter doctor --jsonalready emit the shared contract).coven wt --doctor --jsonnow emits{ok, blocking, repo, worktree_root, claims_dir, checks: [{id, status, message, hint?}]}with stable check idshook:pre-commit,hook:pre-push,layout, reusing the existingDoctorCheckshape. Exit-1-on-blocking semantics identical to prose mode.--jsonwithout--list/--doctornow fails with--json requires --list or --doctorinstead of being silently ignored.wt_doctorsplit into gather (WtDoctorReport) + render, so the JSON contract is unit-tested without a live repo (pattern:render_wt_list_json).docs/reference/cli-wt.mddocuments the new mode with an example payload.Part of the usability goal: every read command has
--jsonparity + reference doc. (adapter list/doctor --jsonwere 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✓wt --doctor --json(exit 1 + JSON on findings), prose unchanged,wt <branch> --jsonrejected