fix(core): Remove flawed safety check in getUserArgs and debug log

- Fixed bug where CLI with no args would return entire argv including node path
- Removed debug 'Wanted command: ...' log from startParse()
This commit is contained in:
2026-01-12 01:21:49 +00:00
parent 40c0dfb3df
commit e3f5616320
3 changed files with 2 additions and 8 deletions

View File

@@ -63,14 +63,9 @@ export function getUserArgs(argv?: string[]): string[] {
offset = Math.min(2, a.length);
}
// Safety: if offset would skip all elements and array is not empty, don't skip anything
// This handles edge cases like test environments with unusual argv setups
if (offset >= a.length && a.length > 0) {
offset = 0;
}
// Note: we intentionally avoid path/URL heuristics on argv[1] so we don't
// accidentally drop the first user arg when it's a path-like value in compiled mode.
// When offset >= a.length, this correctly returns an empty array (no user args).
return a.slice(offset);
}