Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ If you want to ensure a specific version is always used or update your version,
```json
{
"plugin": [
"@tarquinen/[email protected].12"
"@tarquinen/[email protected].13"
]
}
```
Expand Down
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
/**
Expand Down
14 changes: 11 additions & 3 deletions lib/version-checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
export async function checkForUpdates(client: any, logger?: { info: (component: string, message: string, data?: any) => void }): Promise<void> {
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",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down