commander-wizard 0.0.2 → 0.0.3

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/README.md CHANGED
@@ -126,8 +126,9 @@ a numeric default alone does not perform that conversion.
126
126
 
127
127
  ## Compatibility limits
128
128
 
129
- Use root-only or nested leaf actions with global scalar options, short flags,
130
- positive/negative boolean pairs, positional arguments, choices, and leaf variadics.
129
+ Use global scalar options, short flags, positive/negative boolean pairs,
130
+ positional arguments, choices, and leaf variadics. Actions are optional:
131
+ commands that read `.opts()` after parsing work unchanged in wizard mode.
131
132
 
132
133
  In wizard mode, put the full command path before flags:
133
134
  `cli group command --wizard --flag=value`. Keep short flags separate; avoid `-abc` and
@@ -135,8 +136,8 @@ In wizard mode, put the full command path before flags:
135
136
 
136
137
  You cannot use these Commander features in wizard mode:
137
138
 
138
- - Executable subcommands, legacy command listeners, actions on commands with
139
- children, or implicit/default subcommands.
139
+ - Executable subcommands, implicit/default subcommands, or targeting commands
140
+ with children.
140
141
  - Ancestor positional arguments or variadic options, positional/pass-through
141
142
  option modes, or shadowed global option names/flags.
142
143
  - Environment-bound options, optional option values (`--color [value]`), presets,
package/dist/wizard.js CHANGED
@@ -169,8 +169,9 @@ function checkLayout(chain, wizardKey) {
169
169
  }
170
170
  }
171
171
  const leaf = chain.at(-1);
172
- if (leaf.commands.length || !Reflect.get(leaf, '_actionHandler'))
173
- fail('select an explicit in-process action command. Legacy listeners are unsupported.');
172
+ // No action requirement: parse-then-.opts() CLIs work unchanged — the re-parse validates and populates.
173
+ if (leaf.commands.length)
174
+ fail('select an explicit leaf command; commands with children are ambiguous in wizard mode.');
174
175
  }
175
176
  function defaults(owner, config) {
176
177
  if (owner.defaultValue === undefined)
@@ -323,7 +324,8 @@ async function collect(input, config, wizardKey) {
323
324
  summary.push(`${arg.name()}: ${inspect(arg.variadic ? values : values[0])}`);
324
325
  }
325
326
  positional.push(...input.positionals.slice(cursor)); // let Commander report excess arguments
326
- argv.push('--', ...positional);
327
+ if (positional.length)
328
+ argv.push('--', ...positional);
327
329
  const invocation = config.invocation ?? [process.execPath, ...process.execArgv, process.argv[1] ?? fail('provide invocation.')];
328
330
  const tokens = [...invocation, ...argv];
329
331
  if (tokens.some(token => token.includes('\0')))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commander-wizard",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Interactive wizard mode for commander CLIs — collect, review, and rerun command inputs",
5
5
  "keywords": [
6
6
  "commander",