feat(cli): --json flag, pr diff/checkout, commit view, milestone create #16
merged
cole.christensen@gmail.com wants to merge
feat/cli-gaps-tier1
into main
No CI
Summary
Closes 5 of the 8 tickets from the CLI gap audit. The other 3 (#14, #15, #16) are blocked on new server endpoints and stay open.
What’s in
| # | Feature | Notes |
|---|---|---|
| #10 | `–json` flag (global) | Applied to pr/issue/epic/ci/milestone/repo/branch/commit list+view. Process-global atomic so it threads without changing every fn sig. Other commands (label, ssh-key, requirement, release, deploy, agent, board, runner) remain table-only — follow-up. |
| #11 | `anvil pr diff ` | Resolves base/head via GET /pulls/:n, then `git fetch` + `git diff origin/base…origin/head`. `–name-only` and `–remote` flags. |
| #12 | `anvil pr checkout ` | Mirrors `gh pr checkout`: refuses if working tree dirty, fetches, `git checkout -B origin/`. |
| #13 | `anvil milestone create` | Server already has POST /milestones. Other CRUD verbs (edit/close/reopen/delete) need server endpoints — blocked. `issue milestones` and `issue create-milestone` now emit deprecation warnings + delegate. |
| #17 | `anvil commit view ` | Wraps `git show –stat –no-patch` (`–diff` to include patch). |
What’s blocked (still open)
- #14 `anvil pr rebase ` — needs `POST /pulls/:n/rebase` on server
- #15 `anvil branch` parity (create / delete / protect / unprotect) — needs branch CRUD + protection endpoints on server
- #16 `anvil status` / inbox — likely needs an aggregation endpoint
Test plan
- `cargo test` — 39/39 pass (11 new: 3 output + 4 pr + 2 commit + 2 milestone)
- `cargo clippy –all-targets – -D warnings` clean
- `cargo fmt` clean
- Live verification against prod:
- `anvil pr list fangorn/anvil-cli –json` returns valid JSON (parseable with jq)
- `anvil pr view 13 –repo fangorn/anvil-cli –json` returns valid JSON
- `anvil pr –help` shows `diff` and `checkout` verbs
- `anvil commit –help` shows `view`
- `anvil milestone –help` shows `create`
Notes
The `–json` flag is global and additive: existing scripts unaffected. The deprecated `issue milestones` / `issue create-milestone` aliases stay functional but emit a one-line warning to stderr.
Created May 09, 2026 at 03:52 UTC
| Merged May 09, 2026 at 06:55 UTC
by
cole.christensen@gmail.com