Skip to content

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: src/core/schema/run.ts:29

Signatures ​

ts
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.

ts
answers?: readonly unknown[];

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.

ts
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).

ts
env?: Readonly<Record<string, string | undefined>>;

flags ​

Flag-parsing behavior settings.

caseParity accepts the kebab↔camel counterpart spelling of each flag name/alias (--doThis for do-this, and vice versa). The CLI layer threads cli(name, { flags }) settings here automatically.

ts
flags?: ParseOptions;

help ​

Help formatting options (width, binName). Used when --help is detected.

ts
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).

ts
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.

ts
jsonMode?: boolean;

mkdir ​

Recursive directory creation for flag.path() create checks.

CLIBuilder.run() supplies the runtime adapter's implementation automatically. When absent, missing paths are not created.

ts
mkdir?: { (path: string): Promise<void>; };

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.

ts
prompter?: PromptEngine;

stat ​

Filesystem probe for flag.path() checks: reports what exists at a path ('file', 'directory', or null for nothing).

CLIBuilder.run() supplies the runtime adapter's probe automatically. When absent (process-free .execute() / runCommand() without an override), path checks are skipped.

ts
stat?: { (path: string): Promise<"file" | "directory" | null>; };

stdinData ​

Full stdin contents for args configured with .stdin().

Lets tests inject piped input without a runtime adapter.

ts
stdinData?: string | null;

verbosity ​

Verbosity level for the output channel.

ts
verbosity?: "normal" | "quiet";

See Also ​

Released under the MIT License.