Skip to content

InteractiveResolver

Interactive resolver function for command-level prompt control.

Called after CLI/env/config resolution but before per-flag prompts fire. Receives partially resolved values and returns a prompt schema for flags that should be prompted. Commands without .interactive() use per-flag prompt configs directly.

Signatures

ts
type InteractiveResolver<F extends Record<string, FlagBuilder<FlagConfig>>> = { (params: InteractiveParams<F>): InteractiveResult; };

Examples

ts
import { command, flag } from '@kjanat/dreamcli';

const deploy = command('deploy')
  .flag('region', flag.enum(['us', 'eu', 'ap']))
  .interactive(({ flags }) => ({
    region: !flags.region && {
      kind: 'select',
      message: 'Select region',
    },
  }))
  .action(({ flags, out }) => {
    out.log(`Deploying to ${flags.region}`);
  });

See Also

Released under the MIT License.