Repository navigation
Conversation
Constraint: Keep the existing boolean-option semantics and Node runtime floor. Confidence: high Scope-risk: narrow Tested: Failing-first regression, all 177 assertions, ESLint, and public API CLI with an empty shell argument. AI-assistance: Implementation and tests prepared with OpenAI Codex.
|
This looks like a drive-by AI Pull Request. The account created 30 Pull Requests in a single day. That said, I think the current behaviour is not as intended. But fixing it might have to be semver major, because although an uncommon case, lots of historical usage! This is commentary, not a review. |
| t.deepEqual(parse(['-s', '', 'tail']), { s: '', _: ['tail'] }); | ||
| t.deepEqual(parse(['-s', '', 'tail'], { string: 's' }), { s: '', _: ['tail'] }); | ||
| t.deepEqual(parse(['-as', '', 'tail']), { a: true, s: '', _: ['tail'] }); | ||
| t.deepEqual(parse(['-s', ''], { alias: { s: 'string' } }), { s: '', string: '', _: [] }); |
There was a problem hiding this comment.
This test would be more appropriate with string long option name declared in opts.string, and s alias.
The current test is a somewhat unlikely looking edge case.
| t.deepEqual(parse(['-as', '', 'tail']), { a: true, s: '', _: ['tail'] }); | ||
| t.deepEqual(parse(['-s', ''], { alias: { s: 'string' } }), { s: '', string: '', _: [] }); | ||
| t.deepEqual(parse(['-b', ''], { boolean: 'b' }), { b: true, _: [''] }); | ||
| t.deepEqual(parse(['-s']), { s: true, _: [] }); |
There was a problem hiding this comment.
This test is of existing behaviour and does not look necessary.
|
For reference, I think this is the relevant line mentioned for the long option ( Line 176 in ecfdaea |
When an empty shell argument follows a short option (
-s ''), minimist currently setss: trueand leaves the empty string in positional arguments. The equivalent long option already consumes the empty value.Check whether the following argument is undefined, matching the long-option branch. The regression covers inferred and declared strings, short groups, aliases, and unchanged boolean/missing-value behavior.
Validation: failing-first regression; all 177 assertions pass with
npm run tests-only;npm run lintpasses (existing warnings); direct CLI invocation of this checkout returns{ _: ['tail'], s: '' }for-s '' tail. Tested on Node 26.4.0; historical runtime floor and posttest network audit not exercised.AI disclosure: OpenAI Codex assisted with investigation, implementation, tests, and this description.