// engine/shared/ac-extractor.ts — Shared acceptance criteria extraction utility
// Used by: spec-versioning/differ.ts, living-spec/auto-updater.ts, spec-decomposer/analyzer.ts
/**
 * Extract acceptance criteria text lines from spec markdown content.
 * Detects the "Acceptance Criteria" / "Criterios de Aceptación" section header
 * and collects checklist items (`- [ ] ...` or `- [x] ...`).
 *
 * Returns plain text strings (checkbox prefix stripped).
 */
export function extractAcceptanceCriteria(content) {
    const criteria = [];
    const lines = content.split('\n');
    let inAcSection = false;
    for (const line of lines) {
        const trimmed = line.trim();
        // Detect AC section header
        if (/^#+\s*(acceptance criteria|criterios de aceptaci[oó]n)/i.test(trimmed)) {
            inAcSection = true;
            continue;
        }
        // Exit AC section on next major header (that is not another AC header)
        if (inAcSection && /^#+\s/.test(trimmed) && !/^#+\s*(acceptance|criterio)/i.test(trimmed)) {
            inAcSection = false;
            continue;
        }
        // Collect checklist items in AC section
        if (inAcSection && /^-\s*\[[ xX]\]/.test(trimmed)) {
            const text = trimmed.replace(/^-\s*\[[ xX]\]\s*/, '').trim();
            if (text.length > 0) {
                criteria.push(text);
            }
        }
    }
    return criteria;
}
//# sourceMappingURL=ac-extractor.js.map