From c9f79eca98ba74f002c1cfdd9e98dfff8ffbb2a2 Mon Sep 17 00:00:00 2001 From: vgcman16 <155417613+vgcman16@users.noreply.github.com> Date: Thu, 5 Jun 2025 20:45:30 -0500 Subject: [PATCH] feat(diff): always produce minimal patch --- app/utils/diff.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/utils/diff.ts b/app/utils/diff.ts index 25cde26f..d5fc6378 100644 --- a/app/utils/diff.ts +++ b/app/utils/diff.ts @@ -35,13 +35,8 @@ export function computeFileModifications(files: FileMap, modifiedFiles: Map file.content.length) { - // if there are lots of changes we simply grab the current file content since it's smaller than the diff - modifications[filePath] = { type: 'file', content: file.content }; - } else { - // otherwise we use the diff since it's smaller - modifications[filePath] = { type: 'diff', content: unifiedDiff }; - } + // always send a diff so that only the changed lines are rewritten + modifications[filePath] = { type: 'diff', content: unifiedDiff }; } if (!hasModifiedFiles) { @@ -59,7 +54,8 @@ export function computeFileModifications(files: FileMap, modifiedFiles: Map