summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2026-01-20 22:55:50 -0600
committerAiden Cline <[email protected]>2026-01-20 22:55:50 -0600
commit74bd52e8a7454864cc7edf36c87c9dadd68b2998 (patch)
tree2705be34d4ea6eda2f6c91acc501742a0424f4ee
parent9dc95c4c698006772f12ecec03635023bf3d74d8 (diff)
downloadopencode-74bd52e8a7454864cc7edf36c87c9dadd68b2998.tar.gz
opencode-74bd52e8a7454864cc7edf36c87c9dadd68b2998.zip
fix: ensure apply patch tool emits edited events
-rw-r--r--packages/opencode/src/tool/apply_patch.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/opencode/src/tool/apply_patch.ts b/packages/opencode/src/tool/apply_patch.ts
index cccf2d1cf..5ad3cf69d 100644
--- a/packages/opencode/src/tool/apply_patch.ts
+++ b/packages/opencode/src/tool/apply_patch.ts
@@ -12,6 +12,7 @@ import { trimDiff } from "./edit"
import { LSP } from "../lsp"
import { Filesystem } from "../util/filesystem"
import DESCRIPTION from "./apply_patch.txt"
+import { File } from "../file"
const PatchParams = z.object({
patchText: z.string().describe("The full patch text that describes all changes to be made"),
@@ -171,6 +172,7 @@ export const ApplyPatchTool = Tool.define("apply_patch", {
const changedFiles: string[] = []
for (const change of fileChanges) {
+ const edited = change.type === "delete" ? undefined : change.movePath ?? change.filePath
switch (change.type) {
case "add":
// Create parent directories (recursive: true is safe on existing/root dirs)
@@ -199,6 +201,12 @@ export const ApplyPatchTool = Tool.define("apply_patch", {
changedFiles.push(change.filePath)
break
}
+
+ if (edited) {
+ await Bus.publish(File.Event.Edited, {
+ file: edited,
+ })
+ }
}
// Publish file change events