/** * Clarification file parser utility * * Provides functions to parse and format clarifications.md files. */ import { type ClarificationQuestion, type ClarificationBatch } from '../types/clarification.js'; /** * Parsed clarifications file structure. * * Internal representation with tracking for next IDs. */ export interface ParsedClarificationsFile { /** All question batches */ batches: ClarificationBatch[]; /** Next question number to assign */ nextQuestionNumber: number; /** Next batch number to assign */ nextBatchNumber: number; } /** * File header template for clarifications.md */ export declare const CLARIFICATIONS_FILE_HEADER = "# Clarifications\n\nQuestions and answers to clarify the feature specification.\n\n"; /** * Parse clarifications.md file into structured data. * * Extracts batches, questions, options, and answers from the markdown format. * * @param content - Raw markdown content * @returns Parsed clarifications file structure * * @example * ```typescript * const content = fs.readFileSync('clarifications.md', 'utf-8'); * const parsed = parseClarificationsFile(content); * console.log(`Found ${parsed.batches.length} batches`); * ``` */ export declare function parseClarificationsFile(content: string): ParsedClarificationsFile; /** * Format a single question as markdown. * * @param q - Question to format * @returns Formatted markdown string * * @example * ```typescript * const question: ClarificationQuestion = { ... }; * const md = formatQuestion(question); * ``` */ export declare function formatQuestion(q: ClarificationQuestion): string; /** * Format a batch of questions as markdown. * * @param batch - Batch to format * @returns Formatted markdown string * * @example * ```typescript * const batch: ClarificationBatch = { ... }; * const md = formatBatch(batch); * ``` */ export declare function formatBatch(batch: ClarificationBatch): string; /** * Generate a timestamp string for batch headers. * * @returns Formatted timestamp (e.g., "2024-01-15 10:30") * * @example * ```typescript * const timestamp = generateBatchTimestamp(); * // "2024-01-15 10:30" * ``` */ export declare function generateBatchTimestamp(): string; /** * Count pending and total questions across all batches. * * @param batches - Array of batches to count * @returns Object with pending_count and total_count * * @example * ```typescript * const { pending_count, total_count } = countQuestions(parsed.batches); * ``` */ export declare function countQuestions(batches: ClarificationBatch[]): { pending_count: number; total_count: number; }; /** * Find a question by number across all batches. * * @param batches - Array of batches to search * @param questionNumber - Question number to find * @returns Question if found, null otherwise * * @example * ```typescript * const question = findQuestion(parsed.batches, 3); * if (question) { * console.log(`Found: ${question.topic}`); * } * ``` */ export declare function findQuestion(batches: ClarificationBatch[], questionNumber: number): ClarificationQuestion | null; /** * Update the answer for a question in the file content. * * Uses regex replacement to update the answer in-place. * * @param content - Original file content * @param questionNumber - Question number to update * @param answer - New answer text * @returns Updated file content * * @example * ```typescript * const newContent = updateAnswerInContent(content, 1, 'Use OAuth 2.0'); * fs.writeFileSync('clarifications.md', newContent); * ``` */ export declare function updateAnswerInContent(content: string, questionNumber: number, answer: string): string; //# sourceMappingURL=clarification-parser.d.ts.map