export const IMPLEMENTATION_CONTRACT_SECTION = 'Implementation Contract';
export const IMPLEMENTATION_CONTRACT_SUBSECTIONS = [
    'User Outcome',
    'Behavior Contract',
    'File-Level Work Plan',
    'Acceptance-To-Verification Map',
    'Edge Cases And Failure Modes',
    'Non-Goals And Forbidden Approaches',
    'Verification Commands',
];
export function hasImplementationContract(specBody) {
    return extractTopLevelSection(specBody, IMPLEMENTATION_CONTRACT_SECTION).trim().length > 0;
}
export function extractTopLevelSection(body, sectionName) {
    const normalized = body.replace(/\r\n/g, '\n');
    const headingRe = new RegExp(`^##\\s+${escapeRegex(sectionName)}[ \\t]*$`, 'm');
    const match = headingRe.exec(normalized);
    if (!match) {
        return '';
    }
    const start = match.index + match[0].length;
    const nextRe = /^##\s+\S/gm;
    nextRe.lastIndex = start;
    const next = nextRe.exec(normalized);
    return normalized.slice(start, next ? next.index : normalized.length).trim();
}
function escapeRegex(input) {
    return input.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
//# sourceMappingURL=common.js.map