Przeglądaj źródła

initialize config in worktree

Dax Raad 3 miesięcy temu
rodzic
commit
2d074f0472

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

@@ -161,9 +161,7 @@ export namespace Config {
     }
     }
   })
   })
 
 
-  async function installDependencies(dir: string) {
-    // if (Installation.isLocal()) return
-
+  export async function installDependencies(dir: string) {
     const pkg = path.join(dir, "package.json")
     const pkg = path.join(dir, "package.json")
 
 
     if (!(await Bun.file(pkg).exists())) {
     if (!(await Bun.file(pkg).exists())) {

+ 6 - 0
packages/opencode/src/worktree/index.ts

@@ -7,6 +7,7 @@ import { Global } from "../global"
 import { Instance } from "../project/instance"
 import { Instance } from "../project/instance"
 import { Project } from "../project/project"
 import { Project } from "../project/project"
 import { fn } from "../util/fn"
 import { fn } from "../util/fn"
+import { Config } from "@/config/config"
 
 
 export namespace Worktree {
 export namespace Worktree {
   export const Info = z
   export const Info = z
@@ -211,6 +212,11 @@ export namespace Worktree {
       throw new StartCommandFailedError({ message: errorText(ran) || "Worktree start command failed" })
       throw new StartCommandFailedError({ message: errorText(ran) || "Worktree start command failed" })
     }
     }
 
 
+    const opencodeDir = path.join(info.directory, ".opencode")
+    if (await Bun.file(opencodeDir).exists()) {
+      await Config.installDependencies(info.directory)
+    }
+
     return info
     return info
   })
   })
 }
 }