-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Description
When running codegate scan with a URL target, certain combinations of flags and stdout piping produce an intermittent error: too many arguments for 'scan'. Expected 1 argument but got 2. error from Commander.js.
Steps to Reproduce
# This works:
codegate scan "https://github.com/owner/repo" --deep --force --format json --no-tui --output /tmp/report.json
# This intermittently fails:
codegate scan "https://github.com/owner/repo" --deep --force --format json --no-tui | tee /tmp/report.jsonThe error does not reproduce when:
- Using
--output <file>instead of piping stdout - Running without
teeor other pipe consumers - Running with fewer flags (e.g.,
--deepalone or--forcealone works)
Investigation Notes
- Commander.js argument parsing is correct — a minimal reproduction with
createCli()and overridden action handler parses all arguments correctly (target,--deep,--force,--format json,--no-tui). - The error seems related to stdout piping changing
process.stdout.isTTYfromtruetofalse, which may affect code paths downstream of argument parsing. - The
--no-tuioption uses Commander's--no-*negation pattern, which creates an implicit--tuiboolean. This could interact unexpectedly with TTY detection.
Where to Look
src/cli.ts—addScanCommand()function (~line 383), specifically the.command("scan [target]")definition and howisNoTuiEnabled()interacts with the action handler- The interplay between
--no-tui,deps.isTTY(), and Commander's argument parsing when stdout is not a TTY
Workaround
Use the --output <path> flag to write reports to a file instead of piping stdout:
codegate scan "https://github.com/owner/repo" --deep --force --format json --no-tui --output /tmp/report.jsonReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels