fix(cli): recognize about as root command help - #794
Conversation
📝 WalkthroughWalkthroughThe lint logic now accepts root-level ChangesRoot command help linting
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR updates CLI linting so a top-level
Confidence Score: 5/5The PR appears safe to merge with no actionable defects identified. The root-only help exemption matches the separation between Important Files Changed
Reviews (1): Last reviewed commit: "fix(cli): recognize about as root comman..." | Re-trigger Greptile |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cli/src/cli/lint.rs (1)
473-495: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a regression case for a root without
about.This test verifies root
aboutsuppression and subcommand validation. It does not verify that a root withoutaboutorcmd.helpstill reportsmissing-cmd-help. Add a fixture that asserts the root location iscmd test.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cli/src/cli/lint.rs` around lines 473 - 495, Extend test_lint_uses_about_as_root_command_help with a fixture whose root omits about and cmd.help, then assert lint_spec reports missing-cmd-help for the root location cmd test. Preserve the existing subcommand validation assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@cli/src/cli/lint.rs`:
- Around line 473-495: Extend test_lint_uses_about_as_root_command_help with a
fixture whose root omits about and cmd.help, then assert lint_spec reports
missing-cmd-help for the root location cmd test. Preserve the existing
subcommand validation assertion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 4b4fe441-b4eb-4c38-b36b-0525e4a68e62
📒 Files selected for processing (1)
cli/src/cli/lint.rs
Instruction countsNothing was compared, and so nothing was gated. No series appears on both sides: either the base has no measurements recorded, or the two were measured on different runner classes, which are deliberately not comparable — counts shift between machine types by more than a real regression does. New, nothing to compare against: Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run. Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.
|
Summary
aboutas the root command's help text during lintingRoot cause
KDL stores the root CLI description in
Spec.about, while the generic command linter only inspectedSpecCommand.help. As a result, the synthetic root command always reportedmissing-cmd-helpeven when the spec providedabout.Closes #790.
Validation
cargo fmt --all -- --checkcargo test -p usage-cli cli::lintcargo clippy -p usage-cli --all-features -- -D warningsAI-assisted — Tool: Codex; model: OpenAI/GPT-5; version: unavailable.
Note
Low Risk
Lint-only behavior change with regression tests; no runtime CLI or security impact.
Overview
Fixes false
missing-cmd-helpinfo on the root command when a spec defines top-levelaboutinstead of roothelp(KDL stores the CLI description inSpec.about).lint_commandnow takeshas_root_about: the root lint passesspec.about.is_some(), and the missing-help rule is skipped only for that synthetic root. Subcommands still require their ownhelp.Tests expect a clean spec with
aboutto lint with no issues, and assert only undocumented subcommands still getmissing-cmd-help.Reviewed by Cursor Bugbot for commit 2d2b01c. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Bug Fixes
Tests