summaryrefslogtreecommitdiffhomepage
path: root/packages
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-10-13 23:25:53 -0500
committerGitHub <[email protected]>2025-10-13 23:25:53 -0500
commitb91582d68aefe5f7e1e8bd85b56171c0eac07147 (patch)
treea278135dc96fdb375dab41a9da8a0c62ce71796e /packages
parent682d30bd12a92f475bb2ffce406be01c68e9b5d1 (diff)
downloadopencode-b91582d68aefe5f7e1e8bd85b56171c0eac07147.tar.gz
opencode-b91582d68aefe5f7e1e8bd85b56171c0eac07147.zip
fix: config dir overrides (#3160)
Diffstat (limited to 'packages')
-rw-r--r--packages/opencode/src/config/config.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts
index 05f85b6b2..64ab0300e 100644
--- a/packages/opencode/src/config/config.ts
+++ b/packages/opencode/src/config/config.ts
@@ -139,8 +139,17 @@ 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"))
+
+ const pkg = path.join(dir, "package.json")
+
+ if (!(await Bun.file(pkg).exists())) {
+ await Bun.write(pkg, "{}")
+ }
+
+ const gitignore = path.join(dir, ".gitignore")
+ const hasGitIgnore = await Bun.file(gitignore).exists()
+ if (!hasGitIgnore) await Bun.write(gitignore, ["node_modules", "package.json", "bun.lock", ".gitignore"].join("\n"))
+
await BunProc.run(
["add", "@opencode-ai/plugin@" + (Installation.isDev() ? "latest" : Installation.VERSION), "--exact"],
{