[Bug] Required-value CLI options consume following flags instead of reporting a missing value #1418
Lauritz-Timm
started this conversation in
Bug reports
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Affected area
Coding agent and CLI argument parsing
What happened?
CLI options that require a value can consume the next option token as that value instead of reporting that the value is missing.
For example,
--cwd --helptreats--helpas a directory name. The help flag is never processed, and Prime Agent attempts to change into a directory literally named--help.The same parser pattern affects other value-taking options such as
--provider,--model,--api-key,--daemon-socket, session options, and resource paths. A value-taking option at the end of the command can also be silently accepted as an extension flag without a diagnostic.Steps to reproduce
From any directory that does not contain a child directory named
--help, run:The command exits with an error similar to:
Another parser-level example on a source checkout is:
Current output shows
model: "--print",print: undefined, and no diagnostics.Expected behavior
Prime Agent should report a clear missing-value error such as
--cwd requires a value. A following option must remain a separate option rather than being consumed as data.Prime Agent version
0.7.2; also confirmed in current
mainat97b994c3d7c45ca1ae635190e91e9e58ddf2577cEnvironment
Fedora Linux x86_64, Node.js v22.23.1
Additional context
parseArgs()already uses a required-value guard for autonomous and goal options. Most older value-taking options only check that another token exists before consuming it, and trailing known options fall through to generic extension-flag handling.I can add focused parser regressions and a narrow fix if maintainers want this changed and invite the implementation.
All reactions