/** * cli-format.ts — ANSI color helpers, number/token formatting, and table rendering. * * This module is consumed by `cli-commands.ts` and provides every * presentation-layer utility the CLI needs. It has **zero** side-effects * (no I/O, no process manipulation) so it is safe to import anywhere. * * @module cli-format */ /** Whether colour output is globally suppressed via the `NO_COLOR` env var. */ export declare const NO_COLOR: boolean; /** ANSI SGR — bold text. */ export declare const BOLD = "\u001B[1m"; /** ANSI SGR — dim / faint text. */ export declare const DIM = "\u001B[2m"; /** ANSI SGR — reset all attributes. */ export declare const RESET = "\u001B[0m"; /** ANSI SGR — green foreground. */ export declare const GREEN = "\u001B[32m"; /** ANSI SGR — red foreground. */ export declare const RED = "\u001B[31m"; /** ANSI SGR — yellow foreground. */ export declare const YELLOW = "\u001B[33m"; /** ANSI SGR — cyan foreground. */ export declare const CYAN = "\u001B[36m"; /** ANSI SGR — magenta foreground (used for branding). */ export declare const MAGENTA = "\u001B[35m"; /** * Wrap `text` with the given ANSI `code` and a trailing RESET. * * When the `NO_COLOR` environment variable is set the original text is * returned unmodified, ensuring accessible output in minimal terminals. * * @param code An ANSI SGR escape sequence (e.g. `BOLD`, `GREEN`). * @param text The plain-text string to be coloured. * @returns The styled string, or the original string if colour is off. */ export declare function c(code: string, text: string): string; /** * Format a context-window token count into a human-readable short form. * * - Values >= 1 000 000 are rendered as e.g. `1M` or `1.5M`. * - Values >= 1 000 are rendered as e.g. `128K`. * - Zero or falsy values produce an em-dash (`—`). * * @param tokens The raw token count. * @returns A compact string representation. */ export declare function formatContextWindow(tokens: number): string; /** * Format a per-million-token price for display. * * - `undefined` / `null` → em-dash (`—`). * - `0` → the literal string `"free"`. * - Anything else → e.g. `"$3.00"`. * * @param price The dollar price per million tokens, or `undefined`. * @returns A display-ready string. */ export declare function formatPrice(price: number | undefined): string; /** Pricing shape accepted by tier/discount helpers (avoids importing the full type). */ interface PricingLike { inputPerMillion: number; outputPerMillion: number; batchInputPerMillion?: number; batchOutputPerMillion?: number; } /** * Classify a model's pricing into a display tier label. * * - `"free"` — both input and output prices are zero. * - `"batch"` — has batch pricing available (discounted async tier). * - `"standard"` — normal paid pricing. * - `undefined` — no pricing data at all. * * @param pricing The model's pricing object, or `undefined`. * @returns A short tier label for table display. */ export declare function formatPricingTier(pricing: PricingLike | undefined): string; /** * Compute the batch discount percentage relative to standard pricing. * * Compares the average of batch input+output against the average of standard * input+output. Returns `undefined` when either side is missing or when the * calculation would produce a nonsensical result (zero standard price, negative * discount, or no actual discount). * * @param pricing The model's pricing object. * @returns A string like `"(50% off)"`, or `undefined`. */ export declare function formatBatchDiscount(pricing: PricingLike | undefined): string | undefined; /** * Format an integer with locale-aware thousand separators. * * @param n The number to format. * @returns e.g. `"1,000,000"` for `1000000`. */ export declare function formatNumber(n: number): string; /** * Convert a Unix-epoch millisecond timestamp to an ISO-8601 string. * * @param ts Epoch timestamp in milliseconds. * @returns An ISO-8601 date-time string. */ export declare function formatTimestamp(ts: number): string; /** * Format `ts` as a short relative-time string anchored at `now`. * Returns things like `"just now"`, `"3m ago"`, `"2h ago"`, `"4d ago"`. * * @param ts Epoch timestamp in milliseconds. * @param now Reference point; defaults to `Date.now()`. */ export declare function formatRelativeTime(ts: number, now?: number): string; /** * Right-pad `str` to `len` visible characters. * * ANSI escape sequences are stripped before measuring so that styled * strings are padded to the correct *visual* width. * * @param str The (possibly ANSI-styled) string. * @param len Desired visible width. * @returns The padded string. */ export declare function padRight(str: string, len: number): string; /** * Repeat a single character `len` times to produce a horizontal rule. * * @param char The character to repeat (e.g. `"─"`). * @param len How many times to repeat it. * @returns A string of length `len`. */ export declare function line(char: string, len: number): string; /** * Describes a single column in a CLI table rendered by {@link renderTable}. */ export interface Column { /** Column heading text. */ header: string; /** Fixed visible width in characters. */ width: number; /** Text alignment — defaults to `"left"`. */ align?: "left" | "right"; } /** * Render a fixed-width ASCII table string from column definitions and row data. * * The table consists of three sections: * 1. A **bold header** row. * 2. A dim `─` separator line. * 3. Data rows with each cell padded / aligned according to its column spec. * * @param columns Ordered column definitions. * @param rows An array of rows, where each row is an array of cell strings * whose indices correspond to `columns`. * @returns The fully-rendered table as a single multi-line string. */ export declare function renderTable(columns: Column[], rows: string[][]): string; export {}; //# sourceMappingURL=cli-format.d.ts.map