import { fixTypeScriptFile } from './typescript-fixer.js';
const TS_JS_EXTENSIONS = new Set(['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs']);
function getExtension(filePath) {
    const lastDot = filePath.lastIndexOf('.');
    return lastDot >= 0 ? filePath.slice(lastDot) : '';
}
/**
 * Attempts to auto-fix crash risks in the given project files.
 * Only applies deterministic, safe fixes.
 * @param projectPath - root path (unused currently, files are absolute paths)
 * @param files - list of absolute file paths to attempt fixing
 * @param dryRun - if true, returns diffs without writing to disk
 */
export async function fixCrashRisks(_projectPath, files, dryRun) {
    const results = [];
    await Promise.all(files.map(async (file) => {
        const ext = getExtension(file);
        if (TS_JS_EXTENSIONS.has(ext)) {
            const result = await fixTypeScriptFile(file, dryRun);
            if (result !== null) {
                results.push(result);
            }
        }
    }));
    return results;
}
//# sourceMappingURL=index.js.map