Skip to content

Commit ac2f4cb

Browse files
authored
Merge pull request #96 from Tarquinen/fix/clear-bun-cache-on-update
Fix: Clear bun cache before auto-update
2 parents 80f3a75 + 4fc5eff commit ac2f4cb

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

lib/version-checker.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,20 @@ export function isOutdated(local: string, remote: string): boolean {
5454

5555
export async function performUpdate(targetVersion: string, logger?: { info: (component: string, message: string, data?: any) => void }): Promise<boolean> {
5656
const cacheDir = join(homedir(), '.cache', 'opencode')
57+
const bunCacheDir = join(homedir(), '.bun', 'install', 'cache', '@tarquinen')
5758
const packageSpec = `${PACKAGE_NAME}@${targetVersion}`
5859

5960
logger?.info("version", "Starting auto-update", { targetVersion, cacheDir })
6061

62+
// Clear bun's install cache for this package to prevent stale versions
63+
try {
64+
const { rmSync } = await import('fs')
65+
rmSync(bunCacheDir, { recursive: true, force: true })
66+
logger?.info("version", "Cleared bun cache", { bunCacheDir })
67+
} catch (err) {
68+
logger?.info("version", "Could not clear bun cache", { error: (err as Error).message })
69+
}
70+
6171
return new Promise((resolve) => {
6272
let resolved = false
6373

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://json.schemastore.org/package.json",
33
"name": "@tarquinen/opencode-dcp",
4-
"version": "0.4.6",
4+
"version": "0.4.7",
55
"type": "module",
66
"description": "OpenCode plugin that optimizes token usage by pruning obsolete tool outputs from conversation context",
77
"main": "./dist/index.js",

0 commit comments

Comments
 (0)