const CODE_STUB_RE = /```typescript[\s\S]*?(?:export function|export async function|export interface)\s+\w/;
const SECTION_RE = /^#{2,3}\s+(Create|Modify|Test)/im;
export function parseTechnicalMd(content) {
    const createFiles = [];
    const modifyFiles = [];
    const testFiles = [];
    let currentSection = null;
    for (const line of content.split('\n')) {
        const sectionMatch = SECTION_RE.exec(line);
        if (sectionMatch) {
            const rawHeader = sectionMatch[1];
            if (!rawHeader) {
                continue;
            }
            const header = rawHeader.toLowerCase();
            currentSection = header === 'create' ? 'create' : header === 'modify' ? 'modify' : 'test';
            continue;
        }
        const fileMatch = /^-\s+`([^`]+\.ts)`/.exec(line);
        if (fileMatch && currentSection) {
            const relPath = fileMatch[1];
            if (!relPath) {
                continue;
            }
            if (currentSection === 'create') {
                createFiles.push(relPath);
            }
            else if (currentSection === 'modify') {
                modifyFiles.push(relPath);
            }
            else {
                testFiles.push(relPath);
            }
        }
    }
    return {
        createFiles,
        modifyFiles,
        testFiles,
        hasCodeStubs: CODE_STUB_RE.test(content),
    };
}
//# sourceMappingURL=parse-technical.js.map