"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("source-map-support/register");
const diff_1 = require("diff");
const utils_1 = require("../../utils");
const patch_1 = require("../../agents/tools/patch");
async function debugFailure() {
    const errors = [];
    for (const data of errors) {
        try {
            const { fileContent, fixedPatch, originalPatch } = data;
            const newFixedPatch = (0, patch_1.fixPatch)(fileContent, originalPatch);
            console.log({ originalPatch, newFixedPatch });
            const updatedContent = (0, diff_1.applyPatch)(fileContent, newFixedPatch);
            console.log("DID PATCH APPLY?", !!updatedContent);
            await (0, utils_1.ask)("See output? ");
            console.log(updatedContent);
            await (0, utils_1.ask)("Continue? ");
        }
        catch (e) {
            console.log(e);
        }
    }
}
if (require.main === module) {
    debugFailure();
}
//# sourceMappingURL=debug-errors.js.map