iterate-skill-installer 2.8.1 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/installer.js CHANGED
@@ -468,16 +468,16 @@ function parseArgs(argv) {
468
468
 
469
469
  switch (arg) {
470
470
  case '--ai':
471
- if (!next) {
472
- console.error('Error: --ai requires a value');
471
+ if (!next || next.startsWith('-')) {
472
+ console.error('Error: --ai requires a value (a flag was found instead)');
473
473
  process.exit(1);
474
474
  }
475
475
  options.ai = next;
476
476
  i++;
477
477
  break;
478
478
  case '--target':
479
- if (!next) {
480
- console.error('Error: --target requires a value');
479
+ if (!next || next.startsWith('-')) {
480
+ console.error('Error: --target requires a value (a flag was found instead)');
481
481
  process.exit(1);
482
482
  }
483
483
  options.target = next;
@@ -509,8 +509,8 @@ function parseArgs(argv) {
509
509
  options.mode = 'version';
510
510
  break;
511
511
  case '--token':
512
- if (!next) {
513
- console.error('Error: --token requires a value');
512
+ if (!next || next.startsWith('-')) {
513
+ console.error('Error: --token requires a value (a flag was found instead)');
514
514
  process.exit(1);
515
515
  }
516
516
  options.token = next;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iterate-skill-installer",
3
- "version": "2.8.1",
3
+ "version": "2.9.0",
4
4
  "description": "One-command installer for iterate-skill across AI coding assistants",
5
5
  "main": "lib/installer.js",
6
6
  "bin": {
package/test/mode.test.js CHANGED
@@ -119,6 +119,24 @@ async function run() {
119
119
  assert.strictEqual(parseArgs(['--help']).mode, 'help', '--help should set help mode');
120
120
  assert.strictEqual(parseArgs(['-h']).mode, 'help', '-h should set help mode');
121
121
 
122
+ // parseArgs: value-consuming flags must reject a following flag as their
123
+ // value instead of silently swallowing it (regression: `--ai --force`
124
+ // previously set ai='--force' and misled the Python side with an invalid
125
+ // choice). process.exit is stubbed so the error path is assertable.
126
+ const origExit = process.exit;
127
+ process.exit = (code) => {
128
+ throw new Error(`exit(${code})`);
129
+ };
130
+ try {
131
+ assert.throws(() => parseArgs(['--ai', '--force']), /exit\(1\)/, '--ai must reject a flag as its value');
132
+ assert.throws(() => parseArgs(['--target', '--global']), /exit\(1\)/, '--target must reject a flag as its value');
133
+ assert.throws(() => parseArgs(['--token', '--yes']), /exit\(1\)/, '--token must reject a flag as its value');
134
+ assert.throws(() => parseArgs(['--ai']), /exit\(1\)/, '--ai without a value must error');
135
+ assert.throws(() => parseArgs(['--token']), /exit\(1\)/, '--token without a value must error');
136
+ } finally {
137
+ process.exit = origExit;
138
+ }
139
+
122
140
  console.log('mode.test.js: all parseArgs tests passed');
123
141
  }
124
142