Buckets:
| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| src | 4 items | ||
| tests | 6 items | ||
| CHANGELOG.md | 3.19 kB xet | d2a1c791 | |
| README.md | 9.5 kB xet | 082559b4 | |
| deno.json | 432 Bytes xet | 88c2977c | |
| mod.ts | 1.48 kB xet | 3a85ae75 |
@zuke/console
Task-shaped console output for Zuke
builds — so a build never reaches for console.log. A levelled logger, an
inline markup language with a semantic theme, and the primitives Zuke draws its
own output with (line, rule, box, table, and the target header /
summary).
import { ConsoleTasks as Log } from "@zuke/console";
Log.rule("Deploy");
Log.info("pushing [bold]core@1.2.0[/]");
Log.success("[green]✔[/] published 4 packages");
Log.warn("coverage [yellow]94.2%[/] — below gate");
Log.error("type-check failed", { error: err });
Logger
trace · debug · info · success · warn · error — an NUKE-style
severity ladder. The active level (from ZUKE_LOG_LEVEL, or
ConsoleTasks.configure({ level })) gates what prints; warn/error go to
stderr and become ::warning:: / ::error:: annotations under GitHub Actions.
Markup, not chalk-chaining
Styling lives inside the string as data — "[red bold]oops[/]" — so the API
stays declarative and there are no chainable style objects to thread around.
Tags nest and restore the surrounding style; a literal bracket is doubled
([[). Semantic theme tokens ([success], [warn], [muted]) resolve through
the active {@link Theme}, and NO_COLOR / a non-TTY / CI turn colour off
automatically.
To drop arbitrary or untrusted text into a message — a file path, a captured
error, user input — wrap it in ConsoleTasks.escape(...) so its [/] render
literally instead of being parsed as tags (like Spectre.Console's
Markup.Escape):
Log.info(`found ${Log.escape(userInput)} in ${Log.escape(path)}`);
Primitives — the same ones Zuke draws with
ConsoleTasks.line(), .rule("Title"), .box(text, { title }), and
.table(columns, rows) are width- and colour-aware. .header(name) and
.summary(reports, totalMs, ok) render the exact per-target banner and
end-of-build table Zuke prints, so a build can reuse them directly.
Restyle a build's own output
A build can route the executor's banners through this package — Zuke dogfoods this in its own build:
import { run } from "@zuke/core";
import { consoleRenderer } from "@zuke/console";
await run(MyBuild, { renderer: consoleRenderer });
createConsoleRenderer(theme) builds a renderer for a custom palette.
Inspiration & credits
@zuke/console stands on the shoulders of the console libraries that made build
output pleasant to read:
- Spectre.Console (.NET) — the inline
[style]…[/]markup language, the semantic theme, and therule/box/tablewidgets. - NUKE's
Logger(.NET) — the levelledInfo/Success/Warn/Error/TraceAPI and its CI-aware output. - chalk (Node) — the ergonomics of terminal styling that set the bar, reimagined here as markup rather than method chaining.
API
Full typed API — generated from deno doc
`@zuke/console` — task-shaped console output for Zuke builds, so a build never
reaches for `console.log`. A levelled logger (NUKE-style), Spectre.Console-style
markup and a semantic theme, and the primitives Zuke draws its own output with
(`line`, `rule`, `box`, `table`, target `header`/`summary`).
```ts
import { ConsoleTasks as Log } from "@zuke/console";
Log.rule("Deploy");
Log.info("pushing [bold]core@1.2.0[/]");
Log.success("published 4 packages");
```
A build can also route the executor's own banners through this package:
```ts
import { run } from "@zuke/core";
import { consoleRenderer } from "@zuke/console";
await run(MyBuild, { renderer: consoleRenderer });
```
@module
function createConsoleRenderer(theme: Theme): Renderer
Build a {@link Renderer} that draws target headers with `theme`'s palette.
function logoLines(color: boolean, options: LogoOptions): string[]
The logo as printable lines: the {@link ZUKE_LOGO} art painted two-tone when
`color` is on (letters bright, shadow dimmed), plus the optional tagline.
Pure — no I/O and no environment reads — so callers that manage their own
output (like the `zuke` CLI) can route the lines through any sink.
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`.
const ZUKE_LOGO: `███████╗██╗ ██╗██╗ ██╗███████╗
╚══███╔╝██║ ██║██║ ██╔╝██╔════╝
███╔╝ ██║ ██║█████╔╝ █████╗
███╔╝ ██║ ██║██╔═██╗ ██╔══╝
███████╗╚██████╔╝██║ ██╗███████╗
╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝`
The Zuke wordmark in FIGlet's ANSI-shadow style. Solid `█` blocks form the
letters; box-drawing characters draw the shadow.
const consoleRenderer: Renderer
The default console renderer, using {@link defaultTheme}.
const defaultTheme: Theme
The default palette — a conventional terminal colour scheme.
interface ConsoleOptions
Options accepted when reconfiguring {@link ConsoleTasks}.
level?: LogLevel
The minimum severity to print.
sink?: Sink
Where rendered lines go (default: stdout/stderr).
theme?: Theme
A custom colour palette.
color?: boolean
Force ANSI colour on or off (default: auto-detected).
width?: number
Force the rule/box width (default: the terminal width).
github?: boolean
Force GitHub Actions output formatting (default: auto-detected).
interface ConsoleTasksApi
The shape of {@link ConsoleTasks}.
info(message: string): void
Log an informational message (markup-aware).
log(message: string): void
Alias for {@link ConsoleTasksApi.info}.
success(message: string): void
Log a success/completion message.
warn(message: string): void
Log a warning (a `::warning::` annotation under GitHub Actions).
error(message: string, options?: ErrorOptions): void
Log an error, optionally appending a thrown value's message.
debug(message: string): void
Log a debug diagnostic (shown only at `debug`/`trace` level).
trace(message: string): void
Log the most verbose trace output (shown only at `trace` level).
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(options?: LineOptions): void
Print a horizontal rule spanning the width.
rule(title?: string, options?: RuleOptions): void
Print a rule, optionally with a centred title.
box(content: string | string[], options?: BoxOptions): void
Print a bordered panel around `content` (markup-aware).
table(columns: TableColumn[], rows: string[][], options?: TableOptions): void
Print an aligned table; header and cell text may contain markup.
header(name: string): void
Print the ruled banner Zuke opens a target's section with.
logo(options?: LogoOptions): void
Print the Zuke ASCII logo, two-tone when colour is on.
summary(reports: TargetReport[], totalMs: number, ok: boolean): void
Print the end-of-build summary table and closing verdict.
group(name: string): void
Open a collapsible group; close it with {@link ConsoleTasksApi.endGroup}.
endGroup(): void
Close the group opened by {@link ConsoleTasksApi.group}.
configure(options: ConsoleOptions): void
Reconfigure logging (level, sink, theme, colour, width, Actions mode).
level(): LogLevel
The active minimum severity.
reset(): void
Reset all configuration to defaults (level re-seeded from the env).
interface ErrorOptions
Options for {@link ConsoleTasks.error}.
error?: unknown
An error whose message is appended as a dimmed detail line.
interface LogoOptions
Options for {@link logoLines} and `ConsoleTasks.logo`.
tagline?: string
A line printed dimmed under the art (e.g. a version or strapline).
letterStyle?: readonly StyleName[]
Styles for the solid letter blocks. Defaults to `["cyan", "bold"]`.
shadowStyle?: readonly StyleName[]
Styles for the shadow characters. Defaults to `["dim"]`.
interface RuleOptions extends LineOptions
Options for {@link ConsoleTasks.rule}.
interface Sink
A destination for rendered lines. Overridable to capture output in tests.
out(line: string): void
Write a line to standard output.
err(line: string): void
Write a line to standard error.
interface Theme
The colour palette. Each semantic token maps to the ANSI styles applied to
text (or markup) tagged with that name.
info: StyleName[]
Informational messages.
success: StyleName[]
Success/completion messages.
warn: StyleName[]
Warnings.
error: StyleName[]
Errors and failures.
debug: StyleName[]
Debug diagnostics.
trace: StyleName[]
The most verbose trace output.
muted: StyleName[]
De-emphasised, secondary text.
type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "silent"
A severity threshold. Messages below the active level are suppressed.
- Total size
- 37 GB
- Files
- 4,042,753
- Last updated
- Oct 24
- Pre-warmed CDN
- US EU US EU