Fix validateOptions rejecting valid subcommand-specific options#30
Merged
jancurn merged 2 commits intofeat/new-syntaxfrom Mar 7, 2026
Merged
Fix validateOptions rejecting valid subcommand-specific options#30jancurn merged 2 commits intofeat/new-syntaxfrom
jancurn merged 2 commits intofeat/new-syntaxfrom
Conversation
Co-authored-by: jancurn <10612996+jancurn@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] WIP address feedback on CLI syntax overhaul
Fix validateOptions rejecting valid subcommand-specific options
Mar 7, 2026
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.
validateOptions()scanned all CLI args against a global-onlyKNOWN_OPTIONSlist, causing subcommand-specific flags (--scope,--payment-required,--amount,--expiry,-o/--output,--max-size) to be rejected with "Unknown option" before Commander could handle them.Changes
src/cli/parser.ts— BothvalidateOptions()andvalidateArgValues()nowbreakat the first non-option argument (command token). Only options appearing before the command are validated; the rest is left to Commander.test/unit/cli/parser.test.ts— Added test suites for both functions covering: known global options pass, subcommand-specific options after a command token are not rejected, unknown pre-command options still throwClientError.Before:
After:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.