nanocoder
nanocoder copied to clipboard
[Bug] --vscode-port accepts invalid values silently, and "init" accepts unknown options
Summary
Invalid --vscode-port values are dropped without an error, and nanocoder init --bogus runs as if the flag was not there. The top-level options were fixed in #1736, but these were missed.
Steps to reproduce
nanocoder --bogusnanocoder init --bogus --preset rustin an empty folder.nanocoder review --bogus main- Read
source/cli.tsx:378-393, which handles--vscode-port abc,99999and8080abc.
Expected behaviour
Each prints a clear error such as Unknown option "--bogus" or Invalid --vscode-port value: "abc", and exits 1.
Actual behaviour
1) Unknown option "--bogus". Run "nanocoder --help" to see available options. (works)
2) Nanocoder project initialized successfully. Preset: rust ... exit 0 (flag ignored)
3) Error: Review accepts only one target (branch name or PR number). Extra arguments: main (misleading)
4) abc and 99999 are ignored (a random port is used); 8080abc becomes 8080
--context-max -5 also reports Unknown option "-5". Did you mean "-c"?, because the negative number is read as a flag.
Environment
Windows 11, Node v22.22.3, Nanocoder 1.31.0 (main at 948a4e74)
Suggested fix
source/cli.tsx:389: parse the port with a strict integer check (1 to 65535) and exit with an error otherwise.- Run the shared unknown-option scan from
source/cli-args.tsforinitandreviewas well. - Let flags that take a value accept a leading
-number.
i can look into this one @addyCooks