README documents --json as a global flag, but it is per-subcommand and errors on commands that lack it #94

Closed
opened 2026-06-10 21:20:08 +00:00 by stephen · 2 comments
Owner

Observation

The README lists --json as a global flag that works on every command (README.md:177-178):

**Global flags** (work on every command): `--host` / `FJ_HOST`, `--debug`,
`--json`, `--json-fields`, `--no-pager`, and `--web` on list/view commands.

It is not global. Only four flags carry global = true in the clap Cli struct (src/cli/mod.rs:82-99): --host, --debug, --no-pager, and --json-fields. --json is declared per-subcommand (in cli/pr.rs, cli/repo.rs, cli/issue.rs, etc.), so commands that don't opt in (e.g. fj auth ...) reject it.

The binary's own top-level help is correct and omits --json (src/cli/mod.rs:64):

flags --host, --debug, --no-pager, and --json-fields work on every command.

So the README and the in-binary help disagree. A user who trusts the README and runs, say, fj auth status --json gets error: unexpected argument '--json' found and has no way to know which commands actually accept it.

Why it matters

The README sells JSON output as a headline feature "so scripts and AI agents" can consume fj (README.md:41). Scripters and agents are precisely the audience that reads "global flag (works on every command)" literally and builds it into a wrapper. The contradiction turns a marquee selling point into a trust paper cut on first contact, and --json-fields (which IS global) reads from --json output, compounding the confusion about where the boundary is.

Possible directions (sketches)

  • (sketch) Fix the doc: move --json out of the "works on every command" list and state it applies to data-returning commands (list/view/etc.), matching the accurate in-binary help at mod.rs:64.
  • (sketch) Or make behavior match the doc: promote --json to a global = true flag and have commands that produce no structured output reject or ignore it explicitly, so the README claim becomes true.
  • (sketch) Add a tiny test asserting the README's "global flags" list matches the set of global = true args in Cli, so the two can't drift again.

Confidence

High. Both sides verified: README.md:177-178 (claim) vs src/cli/mod.rs:82-99 (only four global = true flags) and src/cli/mod.rs:64 (correct in-binary help). The remaining decision (fix docs vs. promote the flag) is a product call, not an open question of fact.

## Observation The README lists `--json` as a global flag that works on every command (`README.md:177-178`): ``` **Global flags** (work on every command): `--host` / `FJ_HOST`, `--debug`, `--json`, `--json-fields`, `--no-pager`, and `--web` on list/view commands. ``` It is not global. Only four flags carry `global = true` in the clap `Cli` struct (`src/cli/mod.rs:82-99`): `--host`, `--debug`, `--no-pager`, and `--json-fields`. `--json` is declared per-subcommand (in `cli/pr.rs`, `cli/repo.rs`, `cli/issue.rs`, etc.), so commands that don't opt in (e.g. `fj auth ...`) reject it. The binary's own top-level help is correct and omits `--json` (`src/cli/mod.rs:64`): ``` flags --host, --debug, --no-pager, and --json-fields work on every command. ``` So the README and the in-binary help disagree. A user who trusts the README and runs, say, `fj auth status --json` gets `error: unexpected argument '--json' found` and has no way to know which commands actually accept it. ## Why it matters The README sells JSON output as a headline feature "so scripts and AI agents" can consume `fj` (`README.md:41`). Scripters and agents are precisely the audience that reads "global flag (works on every command)" literally and builds it into a wrapper. The contradiction turns a marquee selling point into a trust paper cut on first contact, and `--json-fields` (which IS global) reads from `--json` output, compounding the confusion about where the boundary is. ## Possible directions (sketches) - *(sketch)* Fix the doc: move `--json` out of the "works on every command" list and state it applies to data-returning commands (list/view/etc.), matching the accurate in-binary help at `mod.rs:64`. - *(sketch)* Or make behavior match the doc: promote `--json` to a `global = true` flag and have commands that produce no structured output reject or ignore it explicitly, so the README claim becomes true. - *(sketch)* Add a tiny test asserting the README's "global flags" list matches the set of `global = true` args in `Cli`, so the two can't drift again. ## Confidence High. Both sides verified: `README.md:177-178` (claim) vs `src/cli/mod.rs:82-99` (only four `global = true` flags) and `src/cli/mod.rs:64` (correct in-binary help). The remaining decision (fix docs vs. promote the flag) is a product call, not an open question of fact.
Author
Owner

Converted (label converted). This opportunity became one backlog item:

  • rasterstate/fj#99 (backlog, p3): Correct the README --json global-flag claim and lock it against drift.

Kept open per the product-agent triage convention. Product call recorded: fix the doc to match current behavior (the smaller, accurate change) rather than promoting --json to a real global flag. The in-binary help (src/cli/mod.rs:64) is already correct, so this is a verified doc-vs-code contradiction that produces a real "unexpected argument '--json'" error on a headline feature. Priority is p3: a genuine first-contact trust paper cut, not a blocker-to-purchase. The item also adds a drift-guard test so README and clap cannot diverge again.

**Converted** (label `converted`). This opportunity became one backlog item: - rasterstate/fj#99 (`backlog`, `p3`): Correct the README `--json` global-flag claim and lock it against drift. Kept open per the product-agent triage convention. Product call recorded: fix the doc to match current behavior (the smaller, accurate change) rather than promoting `--json` to a real global flag. The in-binary help (`src/cli/mod.rs:64`) is already correct, so this is a verified doc-vs-code contradiction that produces a real "unexpected argument '--json'" error on a headline feature. Priority is p3: a genuine first-contact trust paper cut, not a blocker-to-purchase. The item also adds a drift-guard test so README and clap cannot diverge again.
Author
Owner

All derived backlog items are merged: rasterstate/fj#99 closed by PR #100. Closing this opportunity per the issue state machine (operator-approved).

All derived backlog items are merged: rasterstate/fj#99 closed by PR #100. Closing this opportunity per the issue state machine (operator-approved).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rasterstate/fj#94
No description provided.