@zuke/console

← API reference

`@zuke/console` — task-shaped console output for Zuke builds, so a build never

Symbols

# ConsoleOptions interface
interface ConsoleOptions

Options accepted when reconfiguring ConsoleTasks.

MemberSignatureDoc
level? level?: LogLevel The minimum severity to print.
sink? sink?: Sink Where rendered lines go (default: stdout/stderr).
theme? theme?: Theme A custom colour palette.
color? color?: boolean Force ANSI colour on or off (default: auto-detected).
width? width?: number Force the rule/box width (default: the terminal width).
github? github?: boolean Force GitHub Actions output formatting (default: auto-detected).
# consoleRenderer const
const consoleRenderer: Renderer

The default console renderer, using defaultTheme.

# ConsoleTasks const
const ConsoleTasks: ConsoleTasksApi

Task-shaped console output. A single namespaced object (like FileTasks) rather than loose helpers: logging methods, structural primitives, and configuration all hang off ConsoleTasks.

# ConsoleTasksApi interface
interface ConsoleTasksApi

The shape of ConsoleTasks.

MemberSignatureDoc
info info(message: string): void Log an informational message (markup-aware).
log log(message: string): void Alias for ConsoleTasksApi.info.
success success(message: string): void Log a success/completion message.
warn warn(message: string): void Log a warning (a ::warning:: annotation under GitHub Actions).
error error(message: string, options?: ErrorOptions): void Log an error, optionally appending a thrown value's message.
debug debug(message: string): void Log a debug diagnostic (shown only at debug/trace level).
trace trace(message: string): void Log the most verbose trace output (shown only at trace level).
escape escape(text: string): string Escape [/] in text so it renders literally rather than as markup — for embedding arbitrary or untrusted strings in a message.
line line(options?: LineOptions): void Print a horizontal rule spanning the width.
rule rule(title?: string, options?: RuleOptions): void Print a rule, optionally with a centred title.
box box(content: string | string[], options?: BoxOptions): void Print a bordered panel around content (markup-aware).
table table(columns: TableColumn[], rows: string[][], options?: TableOptions): void Print an aligned table; header and cell text may contain markup.
header header(name: string): void Print the ruled banner Zuke opens a target's section with.
summary summary(reports: TargetReport[], totalMs: number, ok: boolean): void Print the end-of-build summary table and closing verdict.
group group(name: string): void Open a collapsible group; close it with ConsoleTasksApi.endGroup.
endGroup endGroup(): void Close the group opened by ConsoleTasksApi.group.
configure configure(options: ConsoleOptions): void Reconfigure logging (level, sink, theme, colour, width, Actions mode).
level level(): LogLevel The active minimum severity.
reset reset(): void Reset all configuration to defaults (level re-seeded from the env).
# createConsoleRenderer function
function createConsoleRenderer(theme?: Theme): Renderer

Build a Renderer that draws target headers with theme's palette.

# defaultTheme const
const defaultTheme: Theme

The default palette — a conventional terminal colour scheme.

# ErrorOptions interface
interface ErrorOptions

Options for ConsoleTasks.error.

MemberSignatureDoc
error? error?: unknown An error whose message is appended as a dimmed detail line.
# LogLevel type
type LogLevel = trace | debug | info | warn | error | silent

A severity threshold. Messages below the active level are suppressed.

# RuleOptions interface
interface RuleOptions

Options for ConsoleTasks.rule.

# Sink interface
interface Sink

A destination for rendered lines. Overridable to capture output in tests.

MemberSignatureDoc
out out(line: string): void Write a line to standard output.
err err(line: string): void Write a line to standard error.
# Theme interface
interface Theme

The colour palette. Each semantic token maps to the ANSI styles applied to text (or markup) tagged with that name.

MemberSignatureDoc
info info: StyleName[] Informational messages.
success success: StyleName[] Success/completion messages.
warn warn: StyleName[] Warnings.
error error: StyleName[] Errors and failures.
debug debug: StyleName[] Debug diagnostics.
trace trace: StyleName[] The most verbose trace output.
muted muted: StyleName[] De-emphasised, secondary text.