/** * @file Standard output stream utilities. Provides utilities for writing to * stdout with formatting and control. */ declare const stdout: NodeJS.WriteStream; /** * Clear the current line on stdout. Only works in TTY environments. * * @example * ;```ts * write('Processing...') * clearLine() * write('Done!') * ``` */ export declare function clearLine(): void; /** * Clear screen from cursor position down to bottom. Only works in TTY * environments. * * @example * ;```ts * cursorTo(0, 5) * clearScreenDown() // Clear from row 5 to bottom * ``` */ export declare function clearScreenDown(): void; /** * Move cursor to specific position on stdout. Only works in TTY environments. * * @example * ;```ts * cursorTo(0) // Move to start of line * cursorTo(10, 5) // Move to column 10, row 5 * ``` * * @param x - Column position (0-based) * @param y - Row position (0-based, optional) */ export declare function cursorTo(x: number, y?: number | undefined): void; /** * Register handlers to ensure cursor is shown on process exit. Prevents hidden * cursor after abnormal termination. Handles SIGINT (Ctrl+C) and SIGTERM * signals. * * @example * ;```ts * ensureCursorOnExit() * hideCursor() * // Even if process crashes, cursor will be restored * ``` */ export declare function ensureCursorOnExit(): void; /** * Get the number of columns (width) in the terminal. * * @example * ```ts * const width = getColumns() * console.log(`Terminal is ${width} characters wide`) * ``` * * @default 80 * * @returns Terminal width in characters */ export declare function getColumns(): number; /** * Get the number of rows (height) in the terminal. * * @example * ```ts * const height = getRows() * console.log(`Terminal is ${height} lines tall`) * ``` * * @default 24 * * @returns Terminal height in lines */ export declare function getRows(): number; /** * Hide the cursor on stdout. Useful for cleaner output during animations. * * @example * ;```ts * hideCursor() * // Show animation * showCursor() * ``` */ export declare function hideCursor(): void; /** * Check if stdout is connected to a TTY (terminal). * * @example * ;```ts * if (isTTY()) { * // Show interactive UI * } else { * // Use simple text output * } * ``` * * @returns `true` if stdout is a TTY, `false` if piped/redirected */ export declare function isTTY(): boolean; /** * Show the cursor on stdout. Should be called after `hideCursor()`. * * @example * ;```ts * hideCursor() * // Show animation * showCursor() * ``` */ export declare function showCursor(): void; /** * Write text to stdout without adding a newline. * * @example * ;```ts * write('Loading...') * // Later: clear and update * ``` * * @param text - Text to write. */ export declare function write(text: string): void; /** * Write a line to stdout with trailing newline. * * @example * ;```ts * writeLine('Hello, world!') * writeLine() // Write empty line * ``` * * @default text '' * * @param text - Text to write. */ export declare function writeLine(text?: string): void; export { stdout };