ref:main

Add --json output flag to all list/view commands #10

closed Opened by cole.christensen@gmail.com

Links

No links yet.

Problem

Every `list` / `view` subcommand renders a human-readable table. There’s no way to get structured output for scripting. The server already returns JSON; the CLI re-formats it for humans only.

`gh pr list –json title,state` is the bar: pick fields, get newline-delimited JSON or a JSON array.

Proposal

  • Add `–json` flag to every ` list` and ` view` command. When passed, print the underlying JSON response from the server (pretty-printed by default; flag to be terse).
  • Optional: `–json ` to project specific fields.

Touches: pr, issue, epic, ci, runner, repo, branch, commit, release, requirement, deploy, agent, label, ssh-key, board, milestone — every command with list/view.

Acceptance criteria

  • `anvil pr list –json` prints valid JSON (parseable by `jq`)
  • `anvil pr view –json` same
  • Same flag works on every list/view subcommand
  • Tests assert valid JSON output

Origin

CLI gap audit after fangorn/anvil#206 landed.