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.
- Import:
@kjanat/dreamcli - Export kind: interface
- Declared in:
src/core/schema/command.ts - Source link:
src/core/schema/command.ts:148
Signatures
interface Out {}Members
Properties
[outBrand]
Framework-construction seal. Obtain Out values from DreamCLI; do not implement this interface.
[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.
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.
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.
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.
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.
verbosity: "normal" | "quiet";Methods
error
error(message: string): void;info
info(message: string): void;json
json(value: unknown): void;log
log(message: string): void;progress
progress(options: ProgressOptions): ProgressHandle;setExitCode
setExitCode(code: number): void;spinner
spinner(text: string, options?: SpinnerOptions): SpinnerHandle;status
status(message: string): void;stopActive
stopActive(): void;table
table<T extends Record<string, unknown>>(rows: readonly T[], options: TableOptions): void;warn
warn(message: string): void;