Repository navigation
fix(cli): an unknown flag's error leaves out hidden rename shims - #7746
Merged
Merged
Conversation
The list pointed agents at init's --template, --video-legacy and --agent, which only print an error. It now shows the flags --help shows.
Contributor
There was a problem hiding this comment.
Verdict: REQUEST CHANGES · 1 blocker · 0 important · 0 nits · head b947c53d
The 'fails without the fix:' line is present. Hidden flags are still accepted, because knownFlags is unchanged. The blocker: the same hint still suggests the hidden shims through "Did you mean". ↓ inline
Scope
Read in full: reject-unknown-flags.ts at this head. I ran assertKnownFlags against the real init command for --templat, --agnet, --video-legac and --demo. CI was still running when I posted this.
— Genesis
Contributor
Edit accuracy: accurate 267 (base branch 267), smooth 94 of thoseThe gate passes. Quarantined, measured but not gated (8)
Unstable (1)
|
The did-you-mean search still used every spelling, so '--templat' on init was pointed at the hidden --template. It now uses the same visible flags the list shows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
An unknown flag's error now leaves hidden flags (the ones
--helpleaves out) out of both its flag list and its "Did you mean". Oninitthat is--template,--video-legacyand--agent.Why
#7740 made an unknown flag list the command's flags. On
initthe list included three rename shims that exist only to print "use the new flag" and are hidden from--help, so an agent reading the list could pick one and fail a second time.Related work
Follow-up to #7740.
How
visibleLongFlagsinpackages/cli/src/utils/reject-unknown-flags.tsskips args declaredhidden: true, the marker citty already uses to keep them out of--help. It is now the only input for the list, the synonym target and the closest-match search, so a typo like--templatis no longer pointed at the hidden--template. The shims are still accepted and still print their message.init(git grep "hidden: true" packages/cli/src/commands).Test plan
leaves hidden flags out of the list, as --help doesandnever suggests a hidden flag for a typo(--templat).init --demo x --jsonno longer lists--template,--video-legacyor--agent;init --templat x --jsonsaid "Did you mean --template?" before and no longer suggests a hidden flag.oxfmt --check,oxlinton both files,tsc --noEmitforpackages/cli: clean.