Skip to content

Out

Output channel available inside action handlers.

Provides structured methods for stdout/stderr, JSON output, spinners, progress bars, and tables. The real implementation lives in src/core/output/; this interface defines the shape that handlers consume.

Out is a framework-created, non-exhaustive value: obtain instances from action parameters, createOutput(), or createCaptureOutput() — do not implement it. New readonly members may be added in minor releases.

Signatures

ts
interface Out {}

Members

Properties

[outBrand]

Framework-construction seal. Obtain Out values from DreamCLI; do not implement this interface.

ts
[outBrand]: never;

color

Context-aware ANSI color palette (powered by ansispeck).

Colors are enabled only when stdout is a TTY, JSON mode is off, and the environment supports color (NO_COLOR, FORCE_COLOR, --no-color, --color, CI are respected). When disabled, every formatter is an identity function — out.color.red('x') returns 'x' — so handlers can style unconditionally without gating on isTTY/jsonMode themselves.

ts
color: Colors;

isHyperlinkSupported

Whether OSC 8 terminal hyperlinks should be emitted.

Honors NO_HYPERLINKS/FORCE_HYPERLINKS and the --no-hyperlinks/--hyperlinks argv flags, falling back to isTTY. Handlers rendering their own out.color.link(...) output can gate on this to keep OSC 8 escapes out of piped or opted-out contexts.

ts
isHyperlinkSupported: boolean;

isTTY

Whether stdout is connected to a TTY (terminal).

Handlers can check this to decide whether to emit decorative output (spinners, progress bars, ANSI color codes). When false, the output is being piped or redirected — skip interactive decorations.

Note: jsonMode takes precedence — when jsonMode is true, decorative output should be suppressed regardless of isTTY.

ts
isTTY: boolean;

jsonMode

Whether the output channel is in JSON mode (--json flag active).

Handlers can check this to skip decorative output (spinners, progress bars, ANSI formatting) when machine-readable output is expected.

ts
jsonMode: boolean;

verbosity

Active output verbosity for this command execution.

Root --quiet/-q resolves to 'quiet'. Most handlers should emit informational output through info(), status(), spinner(), or progress() and let the channel suppress it automatically. Read this property only when custom rendering or expensive optional work genuinely depends on the active verbosity.

ts
verbosity: "normal" | "quiet";

Methods

error

ts
error(message: string): void;

info

ts
info(message: string): void;

json

ts
json(value: unknown): void;

log

ts
log(message: string): void;

progress

ts
progress(options: ProgressOptions): ProgressHandle;

setExitCode

ts
setExitCode(code: number): void;

spinner

ts
spinner(text: string, options?: SpinnerOptions): SpinnerHandle;

status

ts
status(message: string): void;

stopActive

ts
stopActive(): void;

table

ts
table<T extends Record<string, unknown>>(rows: readonly T[], options: TableOptions): void;

warn

ts
warn(message: string): void;

See Also

Released under the MIT License.