RunOptions
Options accepted by runCommand() and internal command execution paths.
Every field is optional — sensible defaults are applied. This is the primary process-free execution seam: inject env, config, prompt I/O, and dispatch-layer metadata without touching process state.
- Import:
@kjanat/dreamcli/testkit - Export kind: interface
- Declared in:
src/core/schema/run.ts - Source link:
packages/dreamcli/src/core/schema/run.ts:26
Signatures
interface RunOptions {}Members
Properties
answers
Pre-configured prompt answers for testing convenience.
When provided, a test prompter is created from these answers via createTestPrompter(answers). Each entry is consumed in order — use PROMPT_CANCEL to simulate cancellation.
Ignored when an explicit prompter is provided.
answers?: readonly unknown[];captured
Capture buffers override paired with out.
— when omitted, runCommand() creates empty buffers for the returned RunResult while writing directly to the provided out.
captured?: CapturedOutput;config
Configuration object for flag resolution.
Flags with .config('path') configured resolve from this record when no CLI or env value is provided (CLI → env → config → prompt → default). Config is plain JSON — file loading is the caller's responsibility.
config?: Readonly<Record<string, unknown>>;env
Environment variables for flag resolution.
Flags with .env('VAR') configured resolve from this record when no CLI value is provided (CLI → env → config → prompt → default).
env?: Readonly<Record<string, string | undefined>>;help
Help formatting options (width, binName). Used when --help is detected.
help?: HelpOptions;isTTY
Whether stdout is connected to a TTY.
Handlers can check out.isTTY to decide whether to emit decorative output (spinners, progress bars, ANSI codes). Defaults to false (safe default for tests — non-TTY until proven otherwise).
isTTY?: boolean;jsonMode
Enable JSON output mode.
When true, log and info messages are redirected to stderr so that stdout is reserved exclusively for structured json() output. Framework-rendered errors are emitted as structured JSON to stdout.
jsonMode?: boolean;mergedSchema
Command schema with propagated flags merged in.
When provided, used for parsing and resolution instead of cmd.schema. Set by the CLI dispatch layer after collecting propagated flags from the command ancestry path.
— set by dispatch layer, not for public use.
mergedSchema?: CommandSchema;meta
CLI program metadata passed to action handlers and middleware.
When provided (by CLI dispatch layer), handlers receive this as meta. When absent (standalone runCommand()), a minimal meta is constructed from the command's own schema.
— populated by CLI dispatch, not for public use.
meta?: CommandMeta;out
Output channel override used by live CLI execution.
— CLIBuilder.run() passes a real output channel so activity renders to the terminal instead of being captured.
out?: Out;plugins
CLI plugins registered on the parent CLIBuilder.
— threaded through from CLI dispatch.
plugins?: readonly CLIPlugin[];prompter
Prompt engine for interactive flag resolution.
When provided, flags with .prompt() configured that have no value after CLI/env/config resolution will be prompted interactively.
When absent (and answers is also absent), prompting is skipped and resolution falls through to default/required.
Takes precedence over answers when both are provided.
prompter?: PromptEngine;stdinData
Full stdin contents for args configured with .stdin().
Lets tests inject piped input without a runtime adapter.
stdinData?: string | null;verbosity
Verbosity level for the output channel.
verbosity?: "normal" | "quiet";