Read-only commands (pr checks/files/commits/diff, secret/variable list) have no --json output #109
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Observation
Several read-only commands that an automation or agent would naturally script against have no
--jsonoutput at all. They emit only a human table or free text, with no structured escape hatch, even though sibling commands likepr viewandissue viewdo support--json.Reproduced (all reject the flag):
In each handler the data is already structured in memory and then flattened into a table or text, with no JSON branch:
pr checks(src/cli/pr_inspect.rs:73-119) fetchescombined_status(state, total_count, per-checkstatuses[]) and prints a table. This is the canonical CI-gating query.pr files(src/cli/pr_inspect.rs:47-71) hasstatus,filename,additions,deletionsper file and prints a table.pr commits(src/cli/pr_inspect.rs:19-45) has sha/subject/author and prints a table.pr diff(src/cli/pr_inspect.rs:11-17) prints raw unified-diff text.secret list(src/cli/workflow_secret.rs:30-34,SecretListArgshas nojsonfield) andvariable list(src/cli/workflow_variable.rs) print plain tables.Because the global
--json-fieldsprojection only takes effect on commands that callprint_json(src/output/mod.rs), advertising it as a global flag on these commands is meaningless: there is no JSON for it to project.Why it matters
These are not obscure corners; they are exactly the surfaces automation reaches for:
fj pr checks --json | jq '.state', not to scrape a colored table and re-derive state from pills.migrations/?") wantsfj pr files --json.fj secret list --json/fj variable list --jsonto diff against a desired set.ghreturns JSON for all of these (gh pr checks --json,gh pr view --json files,commits,gh secret listmachine output). The inconsistency is also internal:pr viewandissue viewalready accept--json(src/cli/pr.rs:99-101), so a scripter reasonably assumes the rest ofprdoes too, builds it into a wrapper, and hitserror: unexpected argument '--json'at runtime. For a tool whose headline is JSON for scripts and agents, the checks/files/secrets gaps are the ones most likely to be scripted first.Possible directions (sketches)
--jsonflag to each inspect command (pr diff,pr commits,pr files,pr checks) and route throughoutput::print_jsonover the already-fetched structs, exactly aspr viewdoes. The API responses are already typed; this is mostly surfacing them.--jsontosecret list/variable list(src/cli/workflow_secret.rs:30,src/cli/workflow_variable.rs); emit[{name, updated_at, ...}]so config can be diffed.pr diff, if a structured form is undesirable, at least support--jsonreturning{ "diff": "<text>" }or document that diff is intentionally text-only, so the boundary is explicit rather than a flag rejection.view/inspect/listsubcommand either accepts--jsonor is explicitly allow-listed as text-only, so coverage cannot silently regress.Confidence
High. All six rejections reproduced live, and each handler verified to build only a table/text with no JSON path (
src/cli/pr_inspect.rs:11-119,src/cli/workflow_secret.rs:30-34,src/cli/workflow_variable.rs). The contrast thatpr view/issue viewdo support--jsonis verified in source. Which commands deserve JSON first is a prioritization call; that the gaps exist is not.Converted to backlog item
rasterstate/fj#112(p1, size M).Tracked there with task / priority / reason / acceptance / dependencies. Keeping this open with the
convertedlabel as the originating opportunity.Derived backlog item rasterstate/fj#112 is merged. Closing this opportunity per the issue state machine.