INNER CODE UNIT · TypeScript
applyHunksWithMode
totec448-spec/chat-on-steroids · src/main/codex/apply-patch/index.ts:207
export async function applyHunksWithMode(
hunks: readonly Hunk[],
updateFileMode: ApplyPatchFileUpdateMode,
cwd: string,
stdout: Writer,
stderr: Writer,
resolvePath: PatchPathResolver = defaultPathResolver
): Promise<AppliedPatchDelta> {
const delta = emptyDelta();
try {
const affectedPaths = await applyHunksToFiles(hunks, updateFileMode, cwd, resolvePath, delta);
printSummary(affectedPaths, stdout);
return delta;
} catch (error) {
const message = messageOf(error);
writeLine(stderr, message);
const applyPatchError =
error instanceof ApplyPatchError ? error : ApplyPatchError.io('I/O error', error);