// engine/spec-migrator/planu-root-cleaner.ts — SPEC-1017 strict wrapper
import { dirname } from 'node:path';
import { runStrictPlanuCleanup } from './strict-planu-cleanup.js';
/** Remove all non-canonical files from planu/ root and per-spec directories. */
export async function cleanPlanuRoot(planuDir, projectPath) {
    const root = projectPath ?? dirname(planuDir);
    const strict = await runStrictPlanuCleanup(root);
    const deletedRootFiles = [];
    const deletedSpecFiles = [];
    for (const path of [...strict.deleted, ...strict.merged]) {
        const normalized = path.replace(/^planu\//, '');
        if (normalized.startsWith('specs/')) {
            deletedSpecFiles.push(normalized.replace(/^specs\//, ''));
        }
        else {
            deletedRootFiles.push(normalized);
        }
    }
    return {
        deletedRootFiles,
        deletedSpecFiles,
        totalDeleted: strict.deleted.length + strict.merged.length,
    };
}
//# sourceMappingURL=planu-root-cleaner.js.map