The open source coding agent.
TypeScript
fix: preserve cache dir on cleanup (#2126)
Denys Pavlov2ff4cd2c2b30
diff --git a/packages/opencode/src/global/index.ts b/packages/opencode/src/global/index.tsindex 4fb1a5ade20..5fdbf78cea5 100644--- a/packages/opencode/src/global/index.ts+++ b/packages/opencode/src/global/index.ts@@ -35,6 +35,9 @@ const version = await Bun.file(path.join(Global.Path.cache, "version")).catch(() => "0")if (version !== CACHE_VERSION) {- await fs.rm(Global.Path.cache, { recursive: true, force: true })+ const contents = await fs.readdir(Global.Path.cache)+ await Promise.all(+ contents.map((item) => fs.rm(path.join(Global.Path.cache, item), { recursive: true, force: true })),+ )await Bun.file(path.join(Global.Path.cache, "version")).write(CACHE_VERSION)}