From fafcea42e64a240628fbecf7892e5d8b7a34c9fe Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Thu, 27 Aug 2026 12:51:58 -0400 Subject: [PATCH] refactor(core): share patch write path (#45588) Share the identical file write, error mapping, and result recording path used by additions and non-moving updates. Keep deletion and moving-update behavior explicit. --- packages/core/src/tool/plugin/patch.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/packages/core/src/tool/plugin/patch.ts b/packages/core/src/tool/plugin/patch.ts index 59239948dab..eaccf3a8a9a 100644 --- a/packages/core/src/tool/plugin/patch.ts +++ b/packages/core/src/tool/plugin/patch.ts @@ -215,17 +215,6 @@ export const Plugin = { prepared, (change) => Effect.gen(function* () { - if (change.type === "add") { - yield* environment.files - .write(change.target.absolute, new TextEncoder().encode(change.content)) - .pipe(Effect.mapError((error) => fail(`Failed to write ${change.target.resource}`, error))) - applied.push({ - type: change.type, - resource: change.target.resource, - target: change.target.absolute, - }) - return - } if (change.type === "delete") { yield* environment.files .remove(change.target.absolute) @@ -237,7 +226,7 @@ export const Plugin = { }) return } - if (change.moveTarget) { + if (change.type === "update" && change.moveTarget) { const moveTarget = change.moveTarget yield* environment.files .write(moveTarget.absolute, new TextEncoder().encode(change.content))