Dax Raad hace 4 meses
padre
commit
9d30bc692c

+ 1 - 0
packages/opencode/src/config/config.ts

@@ -138,6 +138,7 @@ export namespace Config {
   }
 
   async function installDependencies(dir: string) {
+    if (Installation.isDev()) return
     await Bun.write(path.join(dir, "package.json"), "{}")
     await Bun.write(path.join(dir, ".gitignore"), ["node_modules", "package.json", "bun.lock", ".gitignore"].join("\n"))
     await BunProc.run(

+ 1 - 0
packages/opencode/src/snapshot/index.ts

@@ -124,6 +124,7 @@ export namespace Snapshot {
 
   export async function diff(hash: string) {
     const git = gitdir()
+    await $`git --git-dir ${git} add .`.quiet().cwd(Instance.directory).nothrow()
     const result = await $`git --git-dir=${git} diff ${hash} -- .`.quiet().cwd(Instance.worktree).nothrow()
 
     if (result.exitCode !== 0) {

+ 3 - 3
packages/opencode/test/snapshot/snapshot.test.ts

@@ -502,9 +502,9 @@ test("diff function with various changes", async () => {
       await Bun.write(`${tmp.path}/b.txt`, "modified content")
 
       const diff = await Snapshot.diff(before!)
-      expect(diff).toContain("deleted")
-      expect(diff).toContain("modified")
-      // Note: git diff only shows changes to tracked files, not untracked files like new.txt
+      expect(diff).toContain("a.txt")
+      expect(diff).toContain("b.txt")
+      expect(diff).toContain("new.txt")
     },
   })
 })