/** * @file Progress bar utilities for CLI applications. Provides various progress * indicators including bars, percentages, and spinners. */ export interface ProgressBarOptions { /** * Width of the progress bar in characters. * * @default 40 */ width?: number | undefined; /** * Format template for progress bar display. Available tokens: `:bar`, * `:percent`, `:current`, `:total`, `:elapsed`, `:eta`. Custom tokens can be * passed via the `tokens` parameter in `update()` or `tick()`. * * @example * ;```ts * format: ':bar :percent :current/:total :eta' * ``` * * @default ':bar :percent :current/:total' */ format?: string | undefined; /** * Character(s) to use for completed portion of bar. * * @default '█' */ complete?: string | undefined; /** * Character(s) to use for incomplete portion of bar. * * @default '░' */ incomplete?: string | undefined; /** * Character(s) to use for the head of the progress bar. * * @default '' */ head?: string | undefined; /** * Clear the progress bar when complete. * * @default false */ clear?: boolean | undefined; /** * Minimum time between renders in milliseconds. ~60fps = 16ms throttle. * * @default 16 */ renderThrottle?: number | undefined; /** * Stream to write progress bar output to. * * @default process.stderr */ stream?: NodeJS.WriteStream | undefined; /** * Color to apply to the completed portion of the bar. * * @default 'cyan' */ color?: 'cyan' | 'green' | 'yellow' | 'blue' | 'magenta' | undefined; } export declare class ProgressBar { private current; private total; private startTime; private lastRender; private stream; private options; private terminated; private lastDrawnWidth; /** * Create a new progress bar instance. * * @example * ;```ts * const bar = new ProgressBar(100, { * width: 50, * format: ':bar :percent :current/:total :eta', * color: 'green', * }) * ``` * * @param total - Total number of units for the progress bar. * @param options - Configuration options for the progress bar. */ constructor(total: number, options?: ProgressBarOptions | undefined); /** * Update progress to a specific value and redraw the bar. Updates are * throttled to prevent excessive rendering (default ~60fps). * * @example * ;```ts * bar.update(50) * bar.update(75, { status: 'Processing...' }) * ``` * * @param current - Current progress value, clamped to total. * @param tokens - Optional custom tokens to replace in format string. */ update(current: number, tokens?: Record | undefined): void; /** * Increment progress by a specified amount. Convenience method for * `update(current + amount)`. * * @example * ;```ts * bar.tick() // Increment by 1 * bar.tick(5) // Increment by 5 * bar.tick(1, { file: 'data.json' }) * ``` * * @default amount 1 * * @param amount - Amount to increment by. * @param tokens - Optional custom tokens to replace in format string. */ tick(amount?: number, tokens?: Record | undefined): void; /** * Render the progress bar. */ private render; /** * Clear the current line. */ private clearLine; /** * Format time in seconds to human readable. */ private formatTime; /** * Terminate the progress bar and optionally clear it. Called automatically * when progress reaches 100%. If `clear` option is true, removes the bar from * terminal. Otherwise, moves to next line to preserve the final state. */ terminate(): void; } /** * Create a simple progress indicator without a graphical bar. Returns a * formatted string showing progress as percentage and fraction. * * @example * ;```ts * createProgressIndicator(50, 100) * // Returns: '[50%] 50/100' * * createProgressIndicator(3, 10, 'Files') * // Returns: 'Files: [30%] 3/10' * ``` * * @param current - Current progress value. * @param total - Total progress value. * @param label - Optional label prefix. * * @returns Formatted progress indicator string */ export declare function createProgressIndicator(current: number, total: number, label?: string | undefined): string;