Repository navigation
fix(hitl/cli): suggest the closest valid name for unknown HITL keys and CLI flags - #2208
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…nd CLI flags - HITL validateConfig appends 'Did you mean "<key>"?' when an unknown key is within 3 edits of one - planned HITL keys like requireApproval are near no supported key and get no hint - the CLI's unknown-argument error names the closest flag of the command that failed - CLI matching ignores hyphens and case, and reports a kebab-case typo once - both reuse suggestClosest from utils/stringDistance - hitl-documented-config covers typo, casing and planned keys; new offline cli-unknown-option suite
bf04e93 to
ca52bdc
Compare
murdore
left a comment
There was a problem hiding this comment.
Reviewed and verified locally against head ca52bdc (based on the current release tip).
- Built cleanly.
test:cli-unknown-optionpasses 4/4;continuous-test-suite-hitl-documented-configpasses 46/46. - ESLint, Prettier,
check:test-parse,check:ci-scriptsandcheck:docs-apipass. - Both changes only add a line to messages that were already printed, so nothing existing breaks. The runtime check for
getDescriptions()falls back to the old message if yargs ever drops it, and the length-scaled edit budget keeps junk flags quiet.
Approving. CI still has to run: the fork workflows are waiting for maintainer approval.
|
🎉 This PR is included in version 13.16.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
Two "did you mean?" hints for names that are silently wrong today, both built on the existing
suggestClosesthelper.HITL config keys. The unknown-key warning added in 09a24bd now names the closest supported key.
CLI flags. The parser runs with
strictOptions(), so a mistyped flag fails the command with only "Unknown argument" and a pointer to--help(over 100 flags forgenerate). The error now names the closest flag of the command that failed.Type of Change
Motivation and Context
A typo'd HITL key silently disables the approval gate it was meant to configure, and the warning left the reader to spot the near miss among 11 keys. A typo'd CLI flag left the user to search a long help page.
Changes Made
HITLManager.validateConfigappendsDid you mean "<key>"?when an unknown key is within 3 edits of a supported one (case-insensitive); planned keys likerequireApprovalget no hintsrc/cli/parser.ts: the unknown-argument branch of.fail()suggests flags from the yargs usage object'sgetDescriptions(), i.e. the failing command's visible options. The method is not in@types/yargs, so it is checked at runtime; if it is missing the message is unchanged--max-tokenzsuggests--maxTokens), scales the edit budget with the name's length so short junk gets no hint, and reports yargs' camelCase twin of a kebab-case typo oncecontinuous-test-suite-hitl-documented-config; a new offline suitecontinuous-test-suite-cli-unknown-option(pnpm run test:cli-unknown-option)Breaking Changes
New Provider Onboarding
Testing
continuous-test-suite-hitl-documented-config: 46/46 against a fresh buildcontinuous-test-suite-cli-unknown-option: 4/4; against a CLI built from the unchangedparser.ts, the three suggestion cases fail and the run exits 1tsc --noEmit --strict, build passDependencies
Security Considerations
Summary by CodeRabbit