Skip to content

Commit b0bfdfe

Browse files
committed
fix: use default export only and target bun for OpenCode compatibility
1 parent 78fa160 commit b0bfdfe

4 files changed

Lines changed: 34 additions & 19 deletions

File tree

‎.todo‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## opencode-debug-agent Fix Tasks
2+
3+
- [ ] Fix export format in src/index.ts - use named export like supermemory (SupermemoryPlugin)
4+
- [ ] Remove default export - supermemory only uses named export
5+
- [ ] Keep --target node in build (supermemory uses same)
6+
- [ ] Add opencode metadata to package.json
7+
- [ ] Build and test locally
8+
- [ ] Bump version and publish

‎package.json‎

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
"email": "anis00723@gmail.com"
88
},
99
"type": "module",
10+
"main": "dist/index.js",
11+
"types": "dist/index.d.ts",
1012
"exports": {
1113
".": {
1214
"types": "./dist/index.d.ts",
@@ -15,34 +17,35 @@
1517
},
1618
"repository": {
1719
"type": "git",
18-
"url": "https://github.com/anis-dr/opencode-debug-agent.git"
20+
"url": "git+https://github.com/anis-dr/opencode-debug-agent.git"
1921
},
2022
"publishConfig": {
2123
"access": "public"
2224
},
2325
"files": [
24-
"dist",
25-
"src"
26+
"dist"
2627
],
2728
"scripts": {
28-
"build": "bun build ./src/index.ts --outdir dist --target bun",
29+
"build": "bun build ./src/index.ts --outdir dist --target bun --format esm",
2930
"prepublishOnly": "bun run build"
3031
},
32+
"opencode": {
33+
"type": "plugin"
34+
},
35+
"keywords": [
36+
"opencode",
37+
"opencode-plugin",
38+
"debug",
39+
"debugging",
40+
"runtime"
41+
],
42+
"license": "MIT",
3143
"dependencies": {
32-
"@opencode-ai/plugin": "1.0.85",
44+
"@opencode-ai/plugin": "^1.0.162",
3345
"hono": "^4"
3446
},
3547
"devDependencies": {
36-
"@eslint/js": "^9.39.1",
37-
"@types/node": "^20.11.5",
38-
"@typescript-eslint/eslint-plugin": "8.47.0",
39-
"@typescript-eslint/parser": "8.47.0",
40-
"bun-types": "latest",
41-
"eslint": "^9.39.1",
42-
"eslint-config-prettier": "10.1.8",
43-
"eslint-plugin-prettier": "^5.1.3",
44-
"prettier": "^3.2.4",
45-
"typescript-eslint": "^8.47.0",
46-
"vitest": "^3.2.4"
48+
"@types/bun": "latest",
49+
"typescript": "^5"
4750
}
4851
}

‎src/index.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,12 @@ const DEBUG_SKILL = {
139139
// PLUGIN EXPORT
140140
// ============================================================
141141

142-
export const DebugAgentPlugin: Plugin = async () => {
142+
// NOTE: Do NOT export functions from main index.ts!
143+
// OpenCode treats ALL exports as plugin instances and calls them.
144+
// Use default export only.
145+
146+
const DebugAgentPlugin: Plugin = async (ctx) => {
147+
// ctx contains { directory, client } - we can use directory for paths
143148
return {
144149
// Register debug tools
145150
tool: {
@@ -170,5 +175,4 @@ export const DebugAgentPlugin: Plugin = async () => {
170175
};
171176
};
172177

173-
// Default export for compatibility
174178
export default DebugAgentPlugin;

‎src/server.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class DebugServer {
7979
};
8080
await this.appendLog(entry);
8181
return c.json({ success: true });
82-
} catch (error) {
82+
} catch {
8383
return c.json({ error: 'Invalid JSON' }, 400);
8484
}
8585
});

0 commit comments

Comments
 (0)