diff --git a/README.md b/README.md index 7fcc1fe..c80b831 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ If you want to ensure a specific version is always used or update your version, ```json { "plugin": [ - "@tarquinen/opencode-dcp@0.3.12" + "@tarquinen/opencode-dcp@0.3.13" ] } ``` diff --git a/index.ts b/index.ts index fc2e772..d3e5ab1 100644 --- a/index.ts +++ b/index.ts @@ -147,7 +147,7 @@ const plugin: Plugin = (async (ctx) => { }) // Check for updates on launch (fire and forget) - checkForUpdates(ctx.client).catch(() => {}) + checkForUpdates(ctx.client, logger).catch(() => {}) return { /** diff --git a/lib/version-checker.ts b/lib/version-checker.ts index fcc0c97..ab20e77 100644 --- a/lib/version-checker.ts +++ b/lib/version-checker.ts @@ -65,15 +65,23 @@ export function isOutdated(local: string, remote: string): boolean { * Checks for updates and shows a toast if outdated. * Fire-and-forget: does not throw, logs errors silently. */ -export async function checkForUpdates(client: any): Promise { +export async function checkForUpdates(client: any, logger?: { info: (component: string, message: string, data?: any) => void }): Promise { try { const local = getLocalVersion() const npm = await getNpmVersion() - if (!npm || !isOutdated(local, npm)) { - return // Up to date or couldn't fetch + if (!npm) { + logger?.info("version", "Version check skipped", { reason: "npm fetch failed" }) + return } + if (!isOutdated(local, npm)) { + logger?.info("version", "Up to date", { local, npm }) + return + } + + logger?.info("version", "Update available", { local, npm }) + await client.tui.showToast({ body: { title: "DCP: Update available", diff --git a/package-lock.json b/package-lock.json index b2abf5f..c1053a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@tarquinen/opencode-dcp", - "version": "0.3.12", + "version": "0.3.13", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@tarquinen/opencode-dcp", - "version": "0.3.12", + "version": "0.3.13", "license": "MIT", "dependencies": { "@ai-sdk/openai-compatible": "^1.0.27", diff --git a/package.json b/package.json index 47bfe92..6a3c5c6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@tarquinen/opencode-dcp", - "version": "0.3.12", + "version": "0.3.13", "type": "module", "description": "OpenCode plugin that optimizes token usage by pruning obsolete tool outputs from conversation context", "main": "./dist/index.js",