feat(spec): add rich choice metadata - #1038
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit afacea4. Configure here.
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. Shadow comparisonParsing
|

Summary
choicesblocks with per-value help, hidden values, and visible or hidden aliasesignore_caseand aliases in usage-lib while keeping hidden entries out of visible choice listsPossibleValuemetadata through the clap-to-spec bridgeFollow-up
Generated Rust and Go tables still flatten choice metadata. A follow-up PR will stack on this one to carry the model through those runtimes.
Test plan
cargo test -p usage-lib --all-featurescargo clippy -p usage-lib --all-features -- -D warningsReady for review.
Note
Medium Risk
Touches argv choice validation for all enumerated args and flags; behavior is backward compatible for simple lists but new alias/case rules change acceptance for rich specs.
Overview
Extends CLI choices beyond flat string lists so KDL and usage-lib can carry clap-style
PossibleValuemetadata:ignore_case, per-value help, hidden values, and visible or hidden aliases. Simplechoices "a" "b"specs stay valid; rich blocks use nestedchoice/aliasnodes as documented inarg.md.Parsing and validation now resolve choices through
SpecChoices::matches/matches_with_env, so argv accepts aliases and case-insensitive canonical names while visible choice lists omit hidden values and include non-hidden aliases. KDL round-trips the rich form whendetailsis present.The clap → spec path is centralized in
choices_from_clap(args and flags), preserving help, hide, aliases, andignore_caseinstead of flattening to strings.SpecChoiceandSpecChoiceAliasare exported from the crate.PLAN.mdnotes that generated Rust/Go tables still flatten choices; that codegen is explicitly out of scope here.Reviewed by Cursor Bugbot for commit cfc5038. Bugbot is set up for automated code reviews on this repo. Configure here.