forge issue view, pr view: --json and --jq #200
No reviewers
Labels
No labels
blocked
bug
decision
duplicate
enhancement
help wanted
invalid
landed?
question
ready-to-merge
stale
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools!200
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/forge-view-json"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
forge issue viewandforge pr viewgain--json <fields>and--jq <expression>, copyinggh. With--json, the command makes one request and prints exactly the requested fields as a JSON object, so an issue or PR body can be pulled down as it actually is on the forge and edited from there instead of retyped from the rendered view. Without the flags, output is byte-identical to today, and the existing tests pin that.--jqis deliberately a small subset: a dotted field path such as.body, printed raw the wayjq -rdoes; anything else is refused before any request. Nothing changes for callers that never pass the flags. If this is wrong, revert the two commits; no other tool depends on the new flags yet.Closes allod/tools#190
Risk
R1. Additive read-side flags on two commands; the existing rendering paths are untouched and their tests unchanged. Rollback is a revert.
Known limits, stated in the docs:
--jq .bodyprints the body plus one newline (jq's convention), so aview --jq .body > f; edit --body-file fcycle adds one trailing newline per round trip; the JSON object form is the exact one. A null body renders as the empty string.--body-filestill replaces the whole body, so this does not merge concurrent edits.Validation
nix build .#checks.x86_64-linux.go-checkspasses on the final commit (gofmt, vet,go testacross all tag sets).cmd/forge/view_json_test.gopin: the body round-trips through--json body --jq .bodyfor a body ending in two newlines, one with CRLF line endings, and one equal to-n; exactly one request in JSON mode; comma-separated and repeated--jsonproduce the same object; object-shapedauthor,labels,milestone; PR-onlyheadRefName/baseRefNamerejected on issues; every validation error (unknown field, empty value, first-line-empty value,--jqwithout--json, unsupported expression, field not requested) exits non-zero with zero requests.--json body --jq .body.--jsonvalue whose first line was empty selected no fields and printed{}; two documentation overclaims (byte-for-byte via--jq, and preventing a concurrent writer's edit from being replaced). Discarded as design decisions: full jq expression support, and null body asnullrather than the empty string.allod-agent referenced this pull request2026-09-11 04:23:36 +01:00
63484394eeto68ac34def3