From ec39fa7845ffd4f7c47057fb0e0bd61b4f39545e Mon Sep 17 00:00:00 2001 From: Daniel Smolsky Date: Tue, 9 Dec 2025 01:06:21 -0500 Subject: [PATCH 1/2] Fix version detection to work from any execution path The getLocalVersion() function now walks up the directory tree to find the correct package.json instead of assuming a fixed relative path. This fixes version detection when running from dist/lib/, lib/, or when installed in node_modules. --- lib/version-checker.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/version-checker.ts b/lib/version-checker.ts index 92339298..642edef0 100644 --- a/lib/version-checker.ts +++ b/lib/version-checker.ts @@ -12,9 +12,22 @@ const __dirname = dirname(__filename) export function getLocalVersion(): string { try { - const pkgPath = join(__dirname, '../../package.json') - const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8')) - return pkg.version + // Walk up from the current module to find the project's package.json + // This works whether running from dist/lib/, lib/, or installed in node_modules + let dir = __dirname + for (let i = 0; i < 5; i++) { + const pkgPath = join(dir, 'package.json') + try { + const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8')) + if (pkg.name === '@tarquinen/opencode-dcp') { + return pkg.version + } + } catch { + // Not found at this level, go up + } + dir = join(dir, '..') + } + return '0.0.0' } catch { return '0.0.0' } From a10407a6b659d816fbc6eccf0757038afbbf5946 Mon Sep 17 00:00:00 2001 From: Daniel Smolsky Date: Tue, 9 Dec 2025 01:06:37 -0500 Subject: [PATCH 2/2] v0.4.8 - Bump version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8965d173..2341bd47 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@tarquinen/opencode-dcp", - "version": "0.4.7", + "version": "0.4.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@tarquinen/opencode-dcp", - "version": "0.4.7", + "version": "0.4.8", "license": "MIT", "dependencies": { "@ai-sdk/openai-compatible": "^1.0.28", diff --git a/package.json b/package.json index 9f6ae759..8cedf2f3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@tarquinen/opencode-dcp", - "version": "0.4.7", + "version": "0.4.8", "type": "module", "description": "OpenCode plugin that optimizes token usage by pruning obsolete tool outputs from conversation context", "main": "./dist/index.js",