/*! * briefing.js v0.0.5 * (c) 2026 chentao.arthur */ import { ChalkInstance } from "chalk"; //#region src/types.d.ts type LoggerLiveLine = { update(message: string): void; done(): void; clear(): void; }; type LoggerSink = { stdout(message: string): void; stderr(message: string): void; isTTY?: boolean; columns?: number; liveLine?: LoggerLiveLine; }; type LoggerOptions = { scope?: string; prefix?: string; colors?: boolean; silent?: boolean; verbose?: boolean; sink?: LoggerSink; }; type LoggerTokenType = | "package" | "path" | "command" | "version" | "value" | "url" | "duration" | "size" | "status"; type LoggerToken = { type: LoggerTokenType; value: unknown; }; type LogPrimitive = | string | number | boolean | bigint | symbol | null | undefined; type LogValue = unknown; type LogContent = LogValue | Array; type NoteBlock = { title?: LogContent; body: Array; }; type CommandBlockOption = { name: string; description: LogContent; }; type CommandBlockExample = { command: string; description?: LogContent; }; type CommandBlock = { title: LogContent; description?: LogContent; command: string; options?: Array; examples?: Array; indent?: number; width?: number; }; type CodeBlock = { title?: LogContent; language?: string; code: string | Array; indent?: number; }; type DiffLine = | { type: "add"; content: string; } | { type: "remove"; content: string; } | { type: "context"; content: string; }; type DiffHunk = { header?: string; oldStart: number; oldLines: number; newStart: number; newLines: number; lines: Array; }; type DiffFile = { path: string; oldPath?: string; hunks: Array; }; type DiffBlockBase = { title?: LogContent; indent?: number; }; type DiffBlock = | (DiffBlockBase & { diff: string | Array; files?: never; }) | (DiffBlockBase & { files: Array; diff?: never; }) | (DiffBlockBase & { diff?: never; files?: never; }); type RowsBlock = { title?: LogContent; columns?: Array; rows: Array>; indent?: number; gap?: number; empty?: LogContent; }; type SummaryBlock = { title?: LogContent; values: Record; indent?: number; width?: number; }; type TaskStatus = | "pending" | "running" | "success" | "warn" | "error" | "skipped"; type TaskItem = { title: LogContent; status: TaskStatus; }; type TasksBlock = { title?: LogContent; tasks: Array; indent?: number; }; type ResultStatus = Extract; type ResultBlock = { title: LogContent; status: ResultStatus; body?: Array; details?: Record; indent?: number; }; type GroupBlock = { title: LogContent; indent?: number; }; type DataBlock = { title?: LogContent; value: unknown; indent?: number; }; type TreeItem = | string | { name: string; children?: Array; }; type TreeBlock = { title?: LogContent; tree: Array; indent?: number; }; type UrlItem = | string | { label?: LogContent; url: string; }; type UrlsBlock = { title?: LogContent; urls: Array; indent?: number; }; type Spinner = { start(): void; text(content: LogContent): void; succeed(content?: LogContent): void; warn(content?: LogContent): void; fail(content?: LogContent): void; stop(): void; }; type Progress = { update(current: number, content?: LogContent): void; succeed(content?: LogContent): void; fail(content?: LogContent): void; stop(): void; }; type Timer = { elapsed(): number; }; type LogLevel = "log" | "info" | "success" | "warn" | "error" | "debug"; //#endregion //#region src/logger.d.ts type ColorPalette = ChalkInstance; declare class Logger { readonly colors: ColorPalette; private readonly rootScope; private readonly childScopes; private readonly options; private readonly warnedMessages; private readonly formatter; constructor(options?: LoggerOptions); child(scope: string): Logger; log(...content: Array): void; info(...content: Array): void; success(...content: Array): void; warn(...content: Array): void; error(...content: Array): void; debug(content: LogContent, meta?: unknown): void; raw(message: string, stream?: "stdout" | "stderr"): void; newline(count?: number): void; step(...content: Array): void; item(...content: Array): void; file(action: string, file: string | LoggerToken): void; empty(...content: Array): void; summary(valuesOrBlock: Record | SummaryBlock): void; rows(block: RowsBlock): void; commandBlock(block: CommandBlock): void; code(block: CodeBlock): void; diff(block: DiffBlock): void; result(block: ResultBlock): void; note(block: NoteBlock): void; tasks(tasksOrBlock: Array | TasksBlock): void; json(valueOrBlock: unknown | DataBlock): void; yaml(valueOrBlock: unknown | DataBlock): void; yml(valueOrBlock: unknown | DataBlock): void; tree(block: TreeBlock): void; urls(block: UrlsBlock): void; group( titleOrBlock: LogContent | GroupBlock, callback: () => Promise | T, ): T | Promise; spinner(content: LogContent): Spinner; withSpinner( content: LogContent, callback: (spinner: Spinner) => Promise | T, ): Promise; progress( content: LogContent, options: { total: number; }, ): Progress; timer(): { elapsed: () => number; }; time(content: LogContent, callback: () => Promise | T): Promise; warnOnce(...content: Array): void; package(value: string): { type: LoggerTokenType; value: unknown; }; path(value: string): { type: LoggerTokenType; value: unknown; }; command(value: string): { type: LoggerTokenType; value: unknown; }; version(value: string): { type: LoggerTokenType; value: unknown; }; value(value: unknown): { type: LoggerTokenType; value: unknown; }; url(value: string): { type: LoggerTokenType; value: unknown; }; duration(value: number): { type: LoggerTokenType; value: unknown; }; size(value: number): { type: LoggerTokenType; value: unknown; }; status(value: string): { type: LoggerTokenType; value: unknown; }; private write; private writeLines; private createFormatter; private createLiveLine; } //#endregion export { type CodeBlock, type ColorPalette, type CommandBlock, type CommandBlockExample, type CommandBlockOption, type DataBlock, type DiffBlock, type DiffFile, type DiffHunk, type DiffLine, type GroupBlock, type LogContent, type LogPrimitive, type LogValue, Logger, type LoggerOptions, type LoggerSink, type LoggerToken, type NoteBlock, type Progress, type ResultBlock, type ResultStatus, type RowsBlock, type Spinner, type SummaryBlock, type TaskItem, type TaskStatus, type TasksBlock, type Timer, type TreeBlock, type TreeItem, type UrlItem, type UrlsBlock, };