When a user types -- model (with a space between the dashes) instead of --model,
the system silently ignores it and uses the default model instead of producing an error.
When a shell receives the command:
solve https://github.com/owner/repo/issues/1 -- model sonnetIt parses this as:
https://github.com/owner/repo/issues/1(positional arg)-- model(single string, NOT a flag)sonnet(positional arg)
The "-- model" string has a space in it, so it's not recognized as a flag by yargs.
Yargs .strict() mode only rejects:
- Unknown OPTIONS (flags that start with
-or--) - Unknown ARGUMENTS that look like flags
It does NOT reject:
- Positional arguments that look similar to flag names
- Strings like
"-- model"(which are treated as regular positional arguments)
So when yargs sees "-- model" as a positional argument, it:
- Doesn't match it to
--modeloption - Doesn't throw an error because it's not in strict "option" format
- Silently ignores it
- Uses the default model value
- User types:
solve <url> -- model sonnet - Shell parses as:
['<url>', '-- model', 'sonnet'] - Yargs receives:
{ _: ['<url>', '-- model', 'sonnet'] } - Yargs strict mode checks: Is this an unknown OPTION? No.
- Yargs silently accepts the positional arguments
- Model defaults to 'sonnet'
- User sees no error, but their
--modelflag was ignored
-
Detect spaced flag patterns: Check if any positional arguments match the pattern
-- <option-name>where option-name is a known flag -
Validate positional arguments: After parsing, check if the remaining positional arguments look like mistyped flags (start with -- or -)
-
Improve error message: When detecting such patterns, suggest the correct format
/src/solve.config.lib.mjs: Contains yargs configuration and argument parsing/src/option-suggestions.lib.mjs: Already has logic for suggesting similar options/src/model-validation.lib.mjs: Validates model names
The current .strict() mode in solve.config.lib.mjs (line 316) only catches malformed
OPTIONS, not these kinds of subtle positional argument errors.