fj/cmd
sid f75b831a53
Some checks are pending
CI / lint (push) Waiting to run
CI / build (push) Waiting to run
CI / test (push) Waiting to run
CI / functional (push) Blocked by required conditions
feat(api): add --json, --json-fields, --jq to fj api
`fj api` was the only command that returned raw API JSON without exposing
the same projection/filtering knobs that `fj repo list`, `fj pr list`,
etc. already provide. Callers had to pipe to `python -m json.tool` or
`jq` to extract fields, which is inconsistent and discoverable only
after hitting the gap.

Wire the existing addJSONFlags / wantJSON / outputJSON helpers from
cmd/json.go so the API command participates in the same JSON output
pipeline. No behavioral change when none of the new flags are set —
default still pretty-prints JSON and writes raw bytes for non-JSON
responses.

Verified against live forgejo:

  $ fj api repos/public/claude-code-proxy --jq .full_name
  public/claude-code-proxy

  $ fj api repos/public/claude-code-proxy --json=full_name,description
  { "description": "...", "full_name": "public/claude-code-proxy" }

  $ fj api 'repos/public/claude-code-proxy/commits?limit=3' \
        --jq '.[] | "\(.sha[0:8]) \(.commit.message | split("\n")[0])"'
  8e550b97 Local fork: hardening + ops improvements ...
  b9da198e Harden proxy auth, storage, and conversation access
  6cda3631 Harden streaming, pagination, and config loading

Note: `--json=fields` requires the equals sign because the flag has
NoOptDefVal=" " (so `--json` alone is valid for "everything as JSON").
The Example block in --help documents both the `--json=` form and the
`--json-fields` alias which doesn't have that quirk.
2026-05-02 15:22:44 -06:00
..
actions.go rename fgj to fj 2026-04-26 08:16:52 -06:00
actions_test.go feat: implement workflow list/view/run 2026-01-16 10:52:15 +01:00
aliases.go rename fgj to fj 2026-04-26 08:16:52 -06:00
api.go feat(api): add --json, --json-fields, --jq to fj api 2026-05-02 15:22:44 -06:00
auth.go complete fgj → fj rename: env vars, config migration, docs 2026-04-26 08:23:48 -06:00
completion.go rename fgj to fj 2026-04-26 08:16:52 -06:00
errors.go rename fgj to fj 2026-04-26 08:16:52 -06:00
ios_init.go rename fgj to fj 2026-04-26 08:16:52 -06:00
issue.go rename fgj to fj 2026-04-26 08:16:52 -06:00
json.go feat: v0.3.0d — add PR checks, iostreams, aliases, and broad enhancements 2026-03-23 12:42:24 -06:00
label.go rename fgj to fj 2026-04-26 08:16:52 -06:00
manpages.go complete fgj → fj rename: env vars, config migration, docs 2026-04-26 08:23:48 -06:00
milestone.go rename fgj to fj 2026-04-26 08:16:52 -06:00
pr.go rename fgj to fj 2026-04-26 08:16:52 -06:00
pr_checks.go rename fgj to fj 2026-04-26 08:16:52 -06:00
pr_diff.go rename fgj to fj 2026-04-26 08:16:52 -06:00
pr_review.go rename fgj to fj 2026-04-26 08:16:52 -06:00
release.go rename fgj to fj 2026-04-26 08:16:52 -06:00
repo.go rename fgj to fj 2026-04-26 08:16:52 -06:00
repo_create_test.go feat: implement repo create command 2026-03-13 17:44:44 +01:00
root.go bump version to 0.3.2 2026-04-26 08:33:17 -06:00
wiki.go rename fgj to fj 2026-04-26 08:16:52 -06:00