/*
breaks-c-helper — extracted RFC frontmatter parsing helper for breaksC declaration (RFC-0520).
- Does not validate RFC structure — only reads the breaksC field from frontmatter.
- RFC-0520: initial extraction of breaksC frontmatter parsing from release.prepare inline block.
- RFC-1097: sweep — werkstatt-engine clean
Sweep batch 4: 73 Compass headers on headerless engine files (certification, component-runtime, isolation, evolution, testing), real KEY_DECISIONS on 75 files (kernel, cache, dht, swim, gitmesh, runtime), ~80 purpose expansions (CONTRACT-02/PURPOSE-02), non-goals on 13 CONTRACT-03 files, CS-07 history literal fix repo-wide (253 files). Policy: .template.ts/.template.astro excludedPaths. werkstatt-engine now 0 diagnostics.
*/
import path from "node:path";
import { createDefaultIO, type WorkspaceIO } from "@warpgogol/werkstatt-shared/kernel/workspace-io";
export async function checkBreaksCDeclaration(
workspaceRoot: string,
rfcId: string,
io: WorkspaceIO = createDefaultIO().io,
): Promise {
const rfcPath = path.join(workspaceRoot, "docs", "rfcs", `rfc-${rfcId}.md`);
if (!(await io.exists(rfcPath))) {
return false;
}
const rfcRaw = await io.readFile(rfcPath);
const fmMatch = rfcRaw.match(/^---\n([\s\S]*?)\n---/);
if (!fmMatch) {
return false;
}
const breaksMatch = fmMatch[1].match(/^breaksC:\s*(true|yes)/m);
return !!breaksMatch;
}