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.

Signatures ​

ts
interface Out {}

Members ​

Properties ​

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;

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;

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;

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.