`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.
Restores installability via 'go install @latest'. Prior letter-suffix
tags (v0.3.0a..v0.3.0f) aren't valid semver and were ignored by Go's
module resolver, leaving @latest pointing at v0.3.0 which predates
the module-path migration.
Add match_dirs field to host config entries for directory-based host
resolution. When no --hostname flag, FGJ_HOST env var, or git remote is
detected, the longest matching directory prefix determines the host.
Symlinks are resolved on both sides for macOS compatibility (/tmp →
/private/tmp). Also adds --limit/-L flag to repo list.
- Add `fgj repo edit` for changing visibility, description, homepage,
and default branch on existing repositories
- Fix `repo create --public` flag which was defined but never read
New commands:
- fgj api: raw REST API passthrough with field inference and path interpolation
- fgj pr diff: view PR diffs with color, --name-only, --stat
- fgj pr comment: add comments to pull requests
- fgj pr review: approve, request changes, or comment on PRs
Agentic enhancements:
- --json-errors flag for structured JSON error output on stderr
- APIError type wrapping HTTP status codes for machine consumption
- Error codes: auth_required, not_found, api_error, invalid_input, etc.
Docs updated for forgejo.zerova.net/sid/fgj-sid fork.