import type chalk from 'chalk'; /** * Word-wrap a string to a maximum visible width, preserving ANSI color. * * chalk emits self-closing color spans (e.g. `\x1b[36m…\x1b[39m`), so each * colored fragment is atomic: we tokenize the input into whole colored spans * and plain words, then greedily pack tokens into lines measured by their * VISIBLE width. Because every token carries its own open+close codes, color * never bleeds across a line break onto the border or padding. * * A single token wider than `maxWidth` (rare — only a very narrow terminal vs. * a long unbroken word) overflows its own line rather than being split mid-span. * Such an overflow can push the rendered box border past the terminal width; * acceptable at standard widths. Note that a colored command produced by * `formatWorkOSCommand` can be long (e.g. `npx workos@latest telemetry opt-out`) * and stays a single unbreakable token by design. * * Limitation: a colored span is grouped atomically only when it is a single SGR * layer (one open code + one close code, as `chalk.cyan('…')` emits). Stacked * styles such as bold+color (`\x1b[1m\x1b[36m…\x1b[39m\x1b[22m`) or two adjacent * spans with no separating space are not guaranteed to stay on one line and may * leave a reset code mid-line. All current callers use single-color spans only. */ export declare function wrapAnsiAware(input: string, maxWidth: number): string[]; /** * Render a bordered box to stderr, wrapping to the terminal width. * * When the content fits on one line it renders exactly as a single-line box * (the historical behavior). When it would overflow the terminal, the content * is word-wrapped (ANSI-aware) and the box grows to multiple lines so the * border never breaks on a narrow terminal. */ export declare function renderStderrBox(inner: string, color: typeof chalk.yellow | typeof chalk.green): void;