Repository navigation
fix(spec): emit valid kdl choices from cobra - #1670
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
[Medium impact] The PR appears safe to merge. SummaryFixes Cobra-generated KDL by writing
Reviews (1) · Last reviewed commit: "fix(spec): emit valid kdl choices from c..." · Reviewed by Greptile |
Instruction counts
No instruction-count regression above 1%. 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
|
### 🐛 Bug Fixes - **(fish)** keep backslashes in run= commands of embedded completion specs by [@jdx](https://github.com/jdx) in [#1659](#1659) - **(powershell)** offer subcommands instead of files after a trailing space by [@jdx](https://github.com/jdx) in [#1672](#1672) - **(spec)** emit valid kdl choices from cobra by [@jdx](https://github.com/jdx) in [#1670](#1670) ### 🛡️ Security - **(deps)** update mise tools by [@renovate[bot]](https://github.com/renovate[bot]) in [#1663](#1663) ### 🔍 Other Changes - **(entire)** remove trail runners by [@jdx](https://github.com/jdx) in [a5dc9df](a5dc9df) - fix the clippy lints that fail lint on main by [@jdx](https://github.com/jdx) in [#1666](#1666) ### 📦️ Dependency Updates - lock file maintenance by [@renovate[bot]](https://github.com/renovate[bot]) in [#1665](#1665) - update dependency effect to v4.1.4 by [@renovate[bot]](https://github.com/renovate[bot]) in [#1661](#1661) - lock file maintenance by [@renovate[bot]](https://github.com/renovate[bot]) in [#1667](#1667) - update module github.com/spf13/pflag to v1.1.0 by [@renovate[bot]](https://github.com/renovate[bot]) in [#1664](#1664) - update github actions by [@renovate[bot]](https://github.com/renovate[bot]) in [#1662](#1662) - update jdx/mise-action action to v5.2.8 by [@renovate[bot]](https://github.com/renovate[bot]) in [#1668](#1668)
Cobra commands with
ValidArgsnow generate a Usage spec that passesusage lint, whether the choices belong to the root command or a subcommand. The generator writeschoice "dev"instead of a bare"dev"inside thechoicesblock. The same renderer handles choices on flag arguments when supplied.Verified the generated root, subcommand, and flag-argument specs with
usage lintv7.4.0 and ran the Cobra integration tests.Fixes #1669.
AI-assisted — Tool: ChatGPT; model: OpenAI/unavailable; version: unavailable.
Note
Low Risk
Scoped to KDL formatting for Cobra integration and test coverage; no runtime auth or data-path changes.
Overview
Cobra-derived Usage specs now render choices blocks with explicit
choice "..."entries instead of bare quoted values, so generated KDL matches whatusage lintexpects. A sharedrenderChoiceshelper centralizes this for positional args (including subcommands) and flag value args.Tests were tightened to assert full KDL for root/subcommand
ValidArgsand a directrenderKDLflag-choices case, and a newlintKDLhelper pipes the output through the Usage CLIlintcommand (withUSAGE_BIN/ build skip when unavailable).Reviewed by Cursor Bugbot for commit e1ec03d. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit