Skip to content

Commit 97977f6

Browse files
committed
ensure @opencode-ai/plugin exists only on first run
1 parent 555a5cc commit 97977f6

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

packages/opencode/src/config/config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { LSPServer } from "../lsp/server"
1818
import { BunProc } from "@/bun"
1919
import { Installation } from "@/installation"
2020
import { ConfigMarkdown } from "./markdown"
21+
import { existsSync } from "fs"
2122

2223
export namespace Config {
2324
const log = Log.create({ service: "config" })
@@ -103,7 +104,10 @@ export namespace Config {
103104
}
104105
}
105106

106-
installDependencies(dir)
107+
const exists = existsSync(path.join(dir, "node_modules"))
108+
const installing = installDependencies(dir)
109+
if (!exists) await installing
110+
107111
result.command = mergeDeep(result.command ?? {}, await loadCommand(dir))
108112
result.agent = mergeDeep(result.agent, await loadAgent(dir))
109113
result.agent = mergeDeep(result.agent, await loadMode(dir))

packages/opencode/src/worktree/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,6 @@ export namespace Worktree {
212212
throw new StartCommandFailedError({ message: errorText(ran) || "Worktree start command failed" })
213213
}
214214

215-
const opencodeDir = path.join(info.directory, ".opencode")
216-
if (await Bun.file(opencodeDir).exists()) {
217-
await Config.installDependencies(info.directory)
218-
}
219-
220215
return info
221216
})
222217
}

0 commit comments

Comments
 (0)