/** * Line-buffered, prefixed writer for task-level parallel execution. * * When multiple tasks run concurrently (takt run --concurrency N), each task's * output must be identifiable and line-aligned to prevent mid-line interleaving. * This class wraps process.stdout.write with line buffering and a colored * `[taskName]` prefix on every non-empty line. * * Design mirrors ParallelLogger (step-level) but targets task-level output: * - Regular log lines (info, header, status) get the prefix * - Stream output gets line-buffered then prefixed * - Empty lines are passed through without prefix */ export interface TaskPrefixWriterOptions { /** Task name used in the prefix */ taskName: string; /** Optional pre-computed label used in the prefix (overrides taskName truncation). */ displayLabel?: string; /** Optional issue number used in the prefix (overrides taskName and display label). */ issue?: number; /** Color index for the prefix (cycled mod 4) */ colorIndex: number; /** Override process.stdout.write for testing */ writeFn?: (text: string) => void; } export interface StepPrefixContext { stepName: string; iteration: number; maxSteps: number | 'infinite'; stepIteration: number; } /** * Prefixed line writer for a single parallel task. * * All output goes through `writeLine` (complete lines) or `writeChunk` * (buffered partial lines). The prefix `[taskName]` is prepended to every * non-empty output line. */ export declare class TaskPrefixWriter { private readonly taskPrefix; private readonly writeFn; private stepContext; private lineBuffer; constructor(options: TaskPrefixWriterOptions); setStepContext(context: StepPrefixContext): void; private buildPrefix; /** * Write a complete line with prefix. * Multi-line text is split and each non-empty line gets the prefix. * Optional style function is applied after ANSI stripping. */ writeLine(text: string, style?: (cleaned: string) => string): void; /** * Write a chunk of streaming text with line buffering. * Partial lines are buffered until a newline arrives, then output with prefix. * Optional style function is applied after ANSI stripping. */ writeChunk(text: string, style?: (cleaned: string) => string): void; /** * Flush any remaining buffered content. */ flush(): void; } //# sourceMappingURL=TaskPrefixWriter.d.ts.map