Repository navigation
fix(cli): reject unknown words and flags with a usage error (lr-cb8f8d) - #483
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
BOBBIE — clean (0 finding(s), 1 dropped) Dropped candidates (1):
|
|
PEACHES — blocking (1 finding(s), 1 dropped) Verdict reasons (1):
Blocking findings (1):
Dropped candidates (1):
|
…ument guard (lr-cb8f8d) Takes argv from the unit template, package.json, the updater re-exec builder, the verify-installed-build call and the --help text. Exports reExecArgs from lib/updater.js without changing behaviour. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
BOBBIE — clean (0 finding(s)) |
|
PEACHES — clean (1 finding(s), 2 dropped) Advisory findings (1):
Dropped candidates (2):
|
…ap exit (lr-cb8f8d) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
PEACHES — clean (0 finding(s)) |
|
BOBBIE — clean (0 finding(s)) |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
BOBBIE — clean (0 finding(s)) |
|
PEACHES — clean (1 finding(s), 2 dropped) Advisory findings (1):
Dropped candidates (2):
|
…-cb8f8d) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
PEACHES — clean (0 finding(s), 1 dropped) Dropped candidates (1):
|
|
BOBBIE — clean (0 finding(s)) |
|
Merged via clagentic-loadout v0.2.0
|
|
This issue has been resolved in version 1.11.0-beta.2. To update, run: |
|
This issue has been resolved in version 1.11.0. To update, run: |
What
The CLI now rejects unknown words and flags with a usage error (exit 1) before any action runs, instead of silently starting or acting. Task: lr-cb8f8d.
Why
A stray word such as bogus --shutdown previously fell through and ran the flag. The guard (lib/cli/arg-validation.js, called from bin/cli.js after the daemon, release, session-verb and schedule-input routes) stops that.
Behaviour change: --flag=value forms (e.g. --port=2633) were silently ignored before and now error; no caller uses them.
lib/updater.js now exports reExecArgs (the existing re-exec argv expression, behaviour unchanged), so the test can feed the real updater argv to the guard.
Caller audit (all pass only recognised tokens): deploy/clagentic-console.service (daemon, routed before the loop), lib/cli/daemon-launch.js (spawns lib/daemon.js directly, no CLI args), lib/updater.js re-exec (original argv + --no-update, recognised), scripts/verify-installed-build.js (--process-build-status), scripts/postinstall.js and install-local-test.js (no CLI invocation with args), package.json dev script (--dev), clagentic-console-dev entry (--dev by name), docs/guides (--activity-diagnostics, --process-build-status). No unrecognised token found.
Class sweep: loop-fallthrough sites in bin/cli.js, 1 hit (the single flag loop).
Fold round 2 (PEACHES advisory, amos.code-craft.4)
Shape 1 (the systemd unit) is now proven by behaviour. The new test takes the captured ExecStart argv from deploy/clagentic-console.service (daemon) and runs it, and daemon --bogus-cb8f8d, through the real bin/cli.js. The CLI is invoked through a temp bin/cli.js symlink with a symlink at lib/node_modules/clagentic-console under the same temp prefix, so the existing daemon-branch link-trap refusal fires: exit 78 with the link trap message, never the guard unrecognised argument error. No daemon starts, no port 2633/2635 is bound, and the live socket and ~/.clagentic/console are untouched (CLAGENTIC_CONSOLE_HOME points at a temp dir). The source-order assertion is kept as a secondary check. No product code changed in this round.
CREW_SOP section 6 caller shapes (bin/cli.js guard)
lr-cb8f8d note: clagentic-console bogus --shutdown against the live daemon is NOT run by any agent. It is verified by the isolated-home spawn tests only.
Tests
Round 0 (head bcc7e53, before the fold rounds): npm test was run: 3566 tests, 3566 pass, 0 fail.
Round 1 full npm test at cfc4a2b: the failing set held only the tracked flakes: prompt-invariants random interleavings timeout (lr-248bff) in both runs and, in the second run only, ENOTEMPTY teardown in claude: a loop iteration is recorded as the loop and web-UI shutdown_server reaches the announcer (lr-c3e80a).
Round 2 (head 4618dd9): the repo profile declares no test block (clagentic-loadout test run exits 72), and npm test runs the whole suite regardless of arguments, so the impacted files were run directly: both lr-cb8f8d test files (test/cli-caller-shapes-lr-cb8f8d.test.js, test/cli-unknown-arg-lr-cb8f8d.test.js), 24 tests, 24 pass, 0 fail. Known local flakes (lr-248bff, lr-c3e80a) were not re-run; CI runs the full suite.
TASK: lr-cb8f8d
🤖 Generated with Claude Code
CI re-run via an empty commit at 0b482e7: the 4618dd9 failure was the identity flake lr-7da984 (MILLER, lr-cb8f8d seq 2), outside this PR.
Fold round 3 (lr-cb8f8d)
Positional routes must not ignore extra tokens (PEACHES nit on the shape 1 test).
Task: lr-cb8f8d
🤖 Generated with Claude Code