import { GATE_CATALOG } from './gate-catalog.js';
export function evaluateGates(specMarkdown) {
    const autoGates = GATE_CATALOG.filter((g) => specMarkdown.includes(`[AUTO] ${g.title}`));
    const passed = autoGates.filter((g) => {
        // Look for checked version: [x] [AUTO] title
        const checkedPattern = new RegExp(`- \\[x\\] \\[AUTO\\] ${escapeRegex(g.title)}`, 'i');
        return checkedPattern.test(specMarkdown);
    });
    const failed = autoGates.filter((g) => !passed.includes(g));
    return {
        total: autoGates.length,
        passed: passed.length,
        failed: failed.length,
        failedGates: failed.map((g) => ({
            id: g.id,
            title: g.title,
            category: g.category,
        })),
        score: autoGates.length === 0 ? 100 : Math.round((passed.length / autoGates.length) * 100),
    };
}
function escapeRegex(str) {
    return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
//# sourceMappingURL=gate-evaluator.js.map