/** * Document Output Processor * * Orchestrates the document output pipeline: * detection -> formatting -> approval -> writing */ import type { ConsoleOutput } from '../output/console-output.js'; import type { MarkdownRenderer } from '../output/markdown.js'; import type { DocumentDetectorService, DocumentTemplateService, DocumentWriterService } from '../services/index.js'; import type { DocumentOutputOptions } from '../types/document.types.js'; import type { DocumentApprovalWorkflow } from './document-approval.js'; /** * Result of document output processing */ export interface DocumentOutputResult { /** Whether a document was successfully created */ documentCreated: boolean; /** Path to the created document (if any) */ documentPath?: string; /** Reason why document was not created (if applicable) */ reason?: string; /** Whether the document was skipped intentionally */ skipped: boolean; } /** * Dependencies required by DocumentOutputProcessor */ export interface DocumentOutputProcessorDependencies { approval: DocumentApprovalWorkflow; consoleOutput: ConsoleOutput; detector: DocumentDetectorService; renderer: MarkdownRenderer; template: DocumentTemplateService; writer: DocumentWriterService; } export declare class DocumentOutputProcessor { private readonly approval; private readonly detector; private readonly logger; private readonly presenterRegistry; private readonly template; private readonly writer; constructor(deps: DocumentOutputProcessorDependencies); /** * Process command outputs for document generation */ process(commandName: string, outputs: Record, options?: DocumentOutputOptions): Promise; /** * Handle skipped command (not a document-creating command) */ private handleSkippedCommand; /** * Handle processing error */ private handleProcessingError; /** * Core document processing logic */ private processDocument; /** * Handle case when no document is detected */ private handleNoDocumentDetected; /** * Handle case when confidence is too low to even ask */ private handleConfidenceTooLow; /** * Handle low confidence scenarios with clarifying questions */ private handleLowConfidence; /** * Apply dynamic path for PLAN documents */ private applyPlanDocumentPath; /** * Handle approval flow */ private handleApproval; /** * Write document and report result */ private writeAndReport; /** * Build document definition from outputs and detection */ private buildDocument; /** * Extract content string from outputs object */ private extractContent; /** * Try to extract document content from the `result` field which contains raw LLM JSON response */ private extractFromResultJson; /** * Extract a string value from raw JSON using manual parsing * Handles large strings with escaped characters including backticks */ private extractStringFromJson; /** * Format outputs object as readable markdown */ private formatOutputsAsMarkdown; /** * Extract task ID from outputs for PLAN document naming * Looks for task_id in various output fields from the plan command pipeline */ private extractTaskId; /** * Format key name as readable title */ private formatKey; /** * Build document output options from CLI options */ static buildOptionsFromCli(cliOptions: { documentAutoApprove?: boolean; documentCategory?: 'backend' | 'frontend' | 'infrastructure' | 'root'; documentPath?: string; noDocumentOutput?: boolean; taskId?: string; }): DocumentOutputOptions; } //# sourceMappingURL=document-output-processor.d.ts.map