Skip to content

feat(gfsctl): add a read-only CLI for the HTTP API - #56

Merged
mattmattox merged 9 commits into
mainfrom
claude/gfsctl-readonly
Nov 10, 2026
Merged

mattmattox merged 9 commits into
mainfrom
claude/gfsctl-readonly

Conversation

@mattmattox

@mattmattox mattmattox commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

First of the three PRs that replace draft #52: gfsctl, read-only, as the user decided. It reads status, health, stats (overview, cache, journal, trim, lock, sfb, cluster, all) and metrics, with watch mode and JSON output.

The first commit is the user's gfsctl exactly as they wrote it (5eb160f). The commits after it are the changes, so the diff of each one is easy to review:

  • Dropped snapshot, admin and cluster. The first two write; cluster called /api/v1/cluster/*, which main doesn't have. The client is GET-only.
  • Fixed bugs in the user's code:
    • Settings: a flag that was set, then GFSCTL_*, then the config file, then defaults. GFSCTL_PORT and GFSCTL_TIMEOUT were never read, and the config file loaded at package init.
    • Some errors exited 1 with no message, and watch mode printed errors twice.
    • An IPv6 --host built a broken URL.
    • Colors were written even when output wasn't a terminal.
    • Output went to os.Stdout instead of the command's writer.
  • Added gfsctl metrics and stats cluster.
  • A contract test serves JSON built from internal/api's own types, and each command's -o json must decode back to the same value. It found that stats dropped the server's io section.
  • make build, dist.sh (binary plus its dependency licenses) and the release workflow now include gfsctl. The release job checks that it reports the build commit.
  • Adds cobra v1.10.2, pflag v1.0.9 and yaml.v2 v2.4.0, the versions the user picked.

Stats answer 503 until api-stats wires the provider, and gfsctl prints that error.

Results: .68 at 8471696: lint 0 issues, parity, race unit tests for all 22 packages, and integration -short with 100 pass, 18 skip, 0 fail (including the new live-mount test). A test dist.sh run put gfsctl and the cobra, pflag and yaml.v2 licenses into the archive, and gfsctl version reported the commit. The last commit (e326409) only reclassifies pflag in go.mod, for the tidy check. GitHub CI is the gate for integration.

🤖 Generated with Claude Code

mattmattox and others added 9 commits November 10, 2026 16:03
The user's gfsctl from their uncommitted work, unchanged (5eb160f in
#52). The following commits make it read-only and fix it. Adds
spf13/cobra v1.10.2 and gopkg.in/yaml.v2 v2.4.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
snapshot and admin change the filesystem through endpoints the server
does not have yet; they come back with those endpoints. cluster called
/api/v1/cluster/*, which is not on main. The client keeps GET only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Settings resolve per field from a flag that was set, then GFSCTL_*,
  then the config file, then the default. GFSCTL_PORT and GFSCTL_TIMEOUT
  were checked but never read, and the config file loaded at package init.
- Bad GFSCTL_PORT, GFSCTL_TIMEOUT, output format or config file are
  errors, not silently ignored.
- Every error prints once. Some paths exited 1 with no message, and
  watch mode printed errors twice.
- Output goes to the command's writer, not os.Stdout, and is colored
  only on a terminal without NO_COLOR.
- An IPv6 --host gave http://::1:8080; the URL now uses JoinHostPort.
- version reads internal/version, like the other binaries.
- New: gfsctl metrics, and gfsctl stats cluster (/api/v1/stats/cluster).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A fake API answers with JSON built from internal/api's response types,
and each command's -o json output must decode back to the same value.
This found that stats overview dropped the server's io section; the
client now has IOStatsResponse. Also tests settings precedence, bad
settings, error output, metrics and the base URL for IPv6 hosts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dist.sh also collects gfsctl's dependency licenses, and the release
workflow checks that gfsctl reports the build commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gfsctl tests import it to reset flags between runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit c198db0 into main Nov 10, 2026
14 of 15 checks passed
mattmattox added a commit that referenced this pull request Nov 10, 2026
From the review of #56:
- config show printed the token's first and last 4 characters, most of a
  short token. It now prints "set (N chars)".
- The client read whole responses into memory; it now stops at 16 MB.
- The README says to tunnel over SSH or use a TLS proxy for a remote mount.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant