Summary
flag.enum([...]).prompt({ kind: 'multiselect' }) is currently accepted, but it fails at runtime with a ValidationError.
This is confusing because the prompt config is accepted up front, and the failure only appears later during resolution.
Minimal repro
import { command, flag } from '@kjanat/dreamcli';
import { runCommand } from '@kjanat/dreamcli/testkit';
const story = command('story')
.flag(
'mood',
flag
.enum(['calm', 'chaos', 'legendary'])
.prompt({ kind: 'multiselect', message: 'Set the mood!' }),
)
.action(({ flags, out }) => {
out.log(String(flags.mood));
});
const result = await runCommand(story, [], { answers: [['calm']] });
console.log(result);
Actual behavior
- Exit code:
2
- Error:
ValidationError
- Message:
Invalid value 'calm' from prompt for flag --mood. Allowed: calm, chaos, legendary
Suggestion: Select one of: calm, chaos, legendary
Expected behavior
One of these should happen instead:
- Type-level/config-time rejection for incompatible combinations (e.g.
multiselect on scalar flags like enum/string/number/boolean), or
- Clear runtime config error before prompting (e.g. "multiselect is only supported for array-valued flags").
Context
Docs already describe multiselect as array-oriented, so this looks like a prompt kind vs flag output-type compatibility gap in validation/typing.
Summary
flag.enum([...]).prompt({ kind: 'multiselect' })is currently accepted, but it fails at runtime with aValidationError.This is confusing because the prompt config is accepted up front, and the failure only appears later during resolution.
Minimal repro
Actual behavior
2ValidationErrorExpected behavior
One of these should happen instead:
multiselecton scalar flags like enum/string/number/boolean), orContext
Docs already describe
multiselectas array-oriented, so this looks like a prompt kind vs flag output-type compatibility gap in validation/typing.