/** * @file Standard error stream utilities. Provides utilities for writing to * stderr with formatting and control. */ declare const stderr: NodeJS.WriteStream; /** * Clear the current line on stderr. Only works in TTY environments. * * @example * ;```ts * writeError('Processing...') * clearStderrLine() * writeError('Done!') * ``` */ export declare function clearStderrLine(): void; /** * Move cursor to specific position on stderr. Only works in TTY environments. * * @example * ;```ts * cursorToStderr(0) // Move to start of line * cursorToStderr(10, 5) // Move to column 10, row 5 * ``` * * @param x - Column position (0-based) * @param y - Row position (0-based, optional) */ export declare function cursorToStderr(x: number, y?: number | undefined): void; /** * Get the number of columns (width) in the terminal. * * @example * ```ts * const width = getStderrColumns() * console.error(`Terminal is ${width} characters wide`) * ``` * * @default 80 * * @returns Terminal width in characters */ export declare function getStderrColumns(): number; /** * Get the number of rows (height) in the terminal. * * @example * ```ts * const height = getStderrRows() * console.error(`Terminal is ${height} lines tall`) * ``` * * @default 24 * * @returns Terminal height in lines */ export declare function getStderrRows(): number; /** * Check if stderr is connected to a TTY (terminal). * * @example * ;```ts * if (isStderrTTY()) { * // Show colored error messages * } else { * // Use plain text * } * ``` * * @returns `true` if stderr is a TTY, `false` if piped/redirected */ export declare function isStderrTTY(): boolean; /** * Write text to stderr without adding a newline. * * @example * ;```ts * writeError('Downloading...') * // Later update progress * ``` * * @param text - Text to write. */ export declare function writeError(text: string): void; /** * Write a formatted error message to stderr. * * @example * ;```ts * writeErrorFormatted('File not found') * // Output: 'Error: File not found' * * writeErrorFormatted('Connection failed', 'Network') * // Output: 'Network: Connection failed' * ``` * * @default prefix 'Error' * * @param message - Error message text. * @param prefix - Prefix label for the error. */ export declare function writeErrorFormatted(message: string, prefix?: string): void; /** * Write a line to stderr with trailing newline. Used for error messages, * warnings, and diagnostic output. Passing no argument writes an empty line. * * @example * ;```ts * writeErrorLine('Error: File not found') * writeErrorLine() // Write empty line * ``` * * @default text '' * * @param text - Text to write. Defaults to the empty string. */ export declare function writeErrorLine(text?: string): void; /** * Write an error's stack trace to stderr. Falls back to formatted error message * if no stack is available. * * @example * ;```ts * try { * throw new ErrorCtor('Something went wrong') * } catch (e) { * writeStackTrace(e as Error) * } * ``` * * @param error - Error object to write. */ export declare function writeStackTrace(error: Error): void; /** * Write a formatted warning message to stderr. * * @example * ;```ts * writeWarning('Deprecated API usage') * // Output: 'Warning: Deprecated API usage' * * writeWarning('Invalid config', 'Config') * // Output: 'Config: Invalid config' * ``` * * @default prefix 'Warning' * * @param message - Warning message text. * @param prefix - Prefix label for the warning. */ export declare function writeWarning(message: string, prefix?: string): void; export { stderr };