// engine/freeze/freeze-checker.ts — SPEC-747: Freeze on done enforcement
import { readFileSync } from 'node:fs';
import { parseFrontmatter } from '../frontmatter-parser.js';
/**
 * Check if a path points to a spec.md file.
 */
export function isSpecMdPath(filePath) {
    return filePath.endsWith('spec.md') && filePath.includes('/specs/');
}
/**
 * Check if a spec is frozen by its file path.
 * Sync for use in atomicWriteFile guard.
 */
export function isSpecFrozenByPath(specPath) {
    try {
        const content = readFileSync(specPath, 'utf-8');
        const { metadata } = parseFrontmatter(content);
        return {
            frozen: metadata.status === 'done' || metadata.status === 'discarded',
            status: metadata.status,
            specVersion: metadata.spec_version,
        };
    }
    catch {
        return { frozen: false };
    }
}
//# sourceMappingURL=freeze-checker.js.map