nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] --vscode-port accepts invalid values silently, and "init" accepts unknown options

Open addyCooks opened this issue 1 month ago • 1 comments

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

  1. nanocoder --bogus
  2. nanocoder init --bogus --preset rust in an empty folder.
  3. nanocoder review --bogus main
  4. Read source/cli.tsx:378-393, which handles --vscode-port abc, 99999 and 8080abc.

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.ts for init and review as well.
  • Let flags that take a value accept a leading - number.

addyCooks avatar Nov 02 '26 16:11 addyCooks

i can look into this one @addyCooks

Vishesh-Verma-07 avatar Nov 02 '26 18:11 Vishesh-Verma-07