Repository navigation
fix: reject unknown help commands and shorten usage errors - #146
Conversation
commit: |
|
| mean | stddev | min | max | |
|---|---|---|---|---|
| PR | 278.4 ms | 3.3 ms | 274.3 ms | 287.0 ms |
| base | 278.4 ms | 2.8 ms | 272.8 ms | 283.4 ms |
Δ (PR vs base): — -0.1 ms (-0.0%)
Measured with hyperfine on ubuntu-latest (3 warmup runs, 20 timed runs). CI numbers carry ±a few ms of runner jitter; treat small deltas as noise.
|
Review: 1 findings. Posted 1 inline suggestion. |
|
No new concerns since the last review |
|
Review: 1 findings. Posted one actionable finding with three inline suggestions. Focused tests could not run because |
801f2a2 to
dd772c9
Compare
|
🤖 I've done a thorough review of your PR. Summary: Refines CLI usage-error output and help handling with regression coverage.
|
dd772c9 to
3fbd31c
Compare
|
No new concerns since the last review |
3fbd31c to
13a1477
Compare
|
No new concerns since the last review |
13a1477 to
8bde9e4
Compare
|
Review: 1 findings. Posted 1 actionable finding in 2 inline suggestions. |
|
LGTM |
There was a problem hiding this comment.
✅ Approved — No issues found in code quality, security, performance, documentation or the changeset. Handler-rendered help, lazy loading and resolution telemetry are preserved, and tests cover them.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🚀 Release: ✅ LGTM
Risk: Low. The patch changeset matches the scope of this fix.
🔒 Security: ✅ LGTM
No security concerns. Unknown command tokens are sanitized before they reach telemetry.
📖 AGENTS.md: ✅ LGTM
The change follows the repository's conventions: strict yargs still handles unknown-option validation, and a patch changeset is included.
📋 Code Quality: ✅ LGTM
- Root-flag check: Aliases and the built-in
help/versionflags are handled. Parsed camelCase keys are converted back to kebab-case before they are looked up in the global option names. - Handler-rendered help: The new unknown-command check only runs on the yargs-driven help path, so handlers that render their own help (
ai run,registrar registrations create) still work. Tests cover both. - Usage errors: Full help is no longer printed before usage errors; a short hint follows the error message. The tests assert this, so the change is deliberate.
- Telemetry: Tests check that unknown tokens are sanitized in failure details, on both the
--helpand-hpaths.
⚡ Performance: ✅ LGTM
The new work happens only on the help and error paths and is small and constant-time. Startup cost and lazy root loading are unchanged.
📝 Documentation: ✅ LGTM
No documentation issues.
Reviewed commit: 27daf396
Summary
Reject unknown top-level and nested commands even with
--helpor-h. Usage errors show the error followed by an italic hint to the nearest valid help command; unknown root flags also list visible global flags.Count declared required and optional positionals when validating automatic help, and allow variadic arguments. Preserve handler-rendered AI/registrar schema help, lazy command loading, and current command-resolution telemetry, including sanitized failure detail for invalid help requests.
Rebased onto main
a0eed39e2e506c3a55060060f0871460015434b0. The issue remains present on that base. Includes a patch changeset.Validation
265 focused tests passed: command recommendations, AI run, registrar create, and telemetry errors.
Exact root
pnpm checkpassed (generation, builds, workspace types, formatting, lint).Eight built CLI smoke checks passed, covering unknown commands with help, surplus positionals, unknown global/leaf flags, and valid help; invalid invocations exited 1 with empty stdout.
Generated artifacts have no diff;
git diff --checkpassed.CI passed on the latest head, including Linux, macOS, Windows, and Wrangler tests. Startup benchmark, prerelease, and CodeQL also passed.
AI review returned LGTM for
27daf3969e62733045859873e275390000e46d91. All six earlier inline threads are addressed and resolved; no scope deferrals.Fixes #100