/** * CLI Output Formatter * Advanced output formatting with tables, progress bars, and colors */ import { Progress } from './output-progress.js'; import { Spinner } from './output-spinner.js'; import type { ProgressOptions, SpinnerOptions, TableOptions } from './types.js'; export { Progress } from './output-progress.js'; export { Spinner } from './output-spinner.js'; declare const COLORS: { readonly reset: '\u001B[0m'; readonly bold: '\u001B[1m'; readonly dim: '\u001B[2m'; readonly italic: '\u001B[3m'; readonly underline: '\u001B[4m'; readonly black: '\u001B[30m'; readonly red: '\u001B[31m'; readonly green: '\u001B[32m'; readonly yellow: '\u001B[33m'; readonly blue: '\u001B[34m'; readonly magenta: '\u001B[35m'; readonly cyan: '\u001B[36m'; readonly white: '\u001B[37m'; readonly gray: '\u001B[90m'; readonly brightRed: '\u001B[91m'; readonly brightGreen: '\u001B[92m'; readonly brightYellow: '\u001B[93m'; readonly brightBlue: '\u001B[94m'; readonly brightMagenta: '\u001B[95m'; readonly brightCyan: '\u001B[96m'; readonly brightWhite: '\u001B[97m'; readonly bgBlack: '\u001B[40m'; readonly bgRed: '\u001B[41m'; readonly bgGreen: '\u001B[42m'; readonly bgYellow: '\u001B[43m'; readonly bgBlue: '\u001B[44m'; readonly bgMagenta: '\u001B[45m'; readonly bgCyan: '\u001B[46m'; readonly bgWhite: '\u001B[47m'; }; type ColorName = keyof typeof COLORS; export type VerbosityLevel = 'quiet' | 'normal' | 'verbose' | 'debug'; export declare class OutputFormatter { private colorEnabled; private outputStream; private errorStream; private verbosity; constructor(options?: { color?: boolean; verbosity?: VerbosityLevel; }); /** * Set verbosity level * - quiet: Only errors and direct results * - normal: Errors, warnings, info, and results * - verbose: All of normal + debug messages * - debug: All output including trace */ setVerbosity(level: VerbosityLevel): void; getVerbosity(): VerbosityLevel; isQuiet(): boolean; isVerbose(): boolean; isDebug(): boolean; private supportsColor; color(text: string, ...colors: ColorName[]): string; bold(text: string): string; dim(text: string): string; success(text: string): string; error(text: string): string; warning(text: string): string; info(text: string): string; highlight(text: string): string; /** * Point regular output at another stream (e.g. stderr while a command * reserves stdout for its JSON payload). Returns the previous stream so * the caller can restore it. */ setOutputStream(stream: NodeJS.WriteStream): NodeJS.WriteStream; private reserveDepth; private streamBeforeReserve; /** * Run `fn` with stdout reserved for a machine-readable document * (`-o json|sarif`, `--json`): regular output goes to stderr meanwhile, or * nowhere under --quiet. Print the document itself with printDocument(). * * The redirect is process-wide on this formatter (the exported `output` * singleton), so anything else writing through it while `fn` runs is * redirected too. Nested or overlapping calls are safe: a depth counter * keeps the first call's redirect and restores the original stream only * when the last one exits, even if `fn` throws. */ reserveStdout(reserve: boolean, fn: () => Promise): Promise; /** Print a machine-readable document on stdout, even inside reserveStdout(). */ printDocument(data: unknown): void; write(text: string): void; writeln(text?: string): void; writeError(text: string): void; writeErrorln(text?: string): void; printSuccess(message: string): void; printError(message: string, details?: string): void; printWarning(message: string): void; printInfo(message: string): void; printDebug(message: string): void; printTrace(message: string): void; table(options: TableOptions): string; printTable(options: TableOptions): void; createProgress(options: ProgressOptions): Progress; progressBar(current: number, total: number, width?: number): string; createSpinner(options: SpinnerOptions): Spinner; json(data: unknown, pretty?: boolean): string; printJson(data: unknown, pretty?: boolean): void; list(items: string[], bullet?: string): string; printList(items: string[], bullet?: string): void; numberedList(items: string[]): string; printNumberedList(items: string[]): void; box(content: string, title?: string): string; printBox(content: string, title?: string): void; setColorEnabled(enabled: boolean): void; isColorEnabled(): boolean; } export declare const output: OutputFormatter; //# sourceMappingURL=output.d.ts.map