Repository navigation
fix(cli): recognize --help/-h in subcommand position - #57
vernonstinebaker wants to merge 2 commits into
Conversation
'server --help' and 'serve --help' previously fell through to server startup: the flag was silently ignored, the DB opened, and the port bound — surprising interactively and harmful in scripts. Help is now honored in any argument position. Fixes #56
DonPrus
left a comment
There was a problem hiding this comment.
The original server --help / serve -h cases now work, and I also verified top-level help and validate-workflows --help. The PR merges cleanly with main.
Blocking: perform help detection before the early command handlers (src/main.zig:40-66). The new scan is below --from-json and --export-manifest, so it does not actually cover every command path. On 9ae80e9 I reproduced:
nullboiler --from-json --help
# exits 1: error: invalid JSON
nullboiler --from-json '{"home":"/tmp/isolated-help-check"}' --help
# exits 0: {"status":"ok"}; creates config.json instead of printing helpThe second case can overwrite an existing configuration even though help was explicitly requested. This is the same class of unexpected side effect that #56 is intended to eliminate. It would be great to move the help-flag scan ahead of all command dispatch, retain the standalone help alias, and add CLI regression coverage for both flag spellings across the server, validation, manifest and JSON-bootstrap paths. In particular, assert that help requests neither create nor alter config/database files. The current PR has no regression test for this behavior.
I built the branch and ran the cases above against an isolated temporary home. Withholding approval until this remaining side-effecting path is covered.
…ests The help scan sat below the --export-manifest/--from-json handlers, so '--from-json --help' still ran bootstrap: exit 1 with 'invalid JSON' and no usage, and '--from-json <payload> --help' created config.json while reporting success (DonPrus review of #57). Move help detection above every early exit and cover both flag spellings across the server, validation, manifest and JSON-bootstrap paths. Each case asserts exit 0, usage output, and that the working directory stays empty. Tests spawn the installed binary via NULLBOILER_TEST_EXE (build.zig now makes the test Run step depend on install). Refs #56
|
Blocking finding addressed in f3ecb63. 1. Help detection moved above the early command handlers. The scan now runs before
The standalone 2. Regression coverage added — two tests spawning the installed binary, covering both flag spellings across all four paths:
Tests locate the binary via Red/green verified: against the previous head ( Validation — merge result Refs #56. Ready for re-review. |
Fixes #56.
nullboiler server --helppreviously ignored the flag and started the real server (DB opened, port bound) — surprising interactively, harmful in scripts.--help/-hnow print usage and exit 0 from any argument position, while top-level behavior is unchanged. Includes verification on v2026.5.29 (released binary shows the bug; this build prints usage).