Skip to content

Fix validateOptions rejecting valid subcommand-specific options#30

Merged
jancurn merged 2 commits intofeat/new-syntaxfrom
copilot/sub-pr-29
Mar 7, 2026
Merged

Fix validateOptions rejecting valid subcommand-specific options#30
jancurn merged 2 commits intofeat/new-syntaxfrom
copilot/sub-pr-29

Conversation

Copy link

Copilot AI commented Mar 7, 2026

validateOptions() scanned all CLI args against a global-only KNOWN_OPTIONS list, 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 — Both validateOptions() and validateArgValues() now break at 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 throw ClientError.

Before:

mcpc login mcp.apify.com --scope read
# → Error: Unknown option: --scope  ❌

After:

mcpc login mcp.apify.com --scope read
# → works, Commander handles --scope  ✓

💡 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.

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
@jancurn jancurn marked this pull request as ready for review March 7, 2026 01:28
@jancurn jancurn merged commit 7aaf0d4 into feat/new-syntax Mar 7, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants