Skip to content

Commit fac6ee5

Browse files
feat: set prune tool as a primary tool
1 parent c2a05b5 commit fac6ee5

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ const plugin: Plugin = (async (ctx) => {
7575
}
7676

7777
return {
78+
config: async (opencodeConfig) => {
79+
// Add prune to primary_tools by mutating the opencode config
80+
// This works because config is cached and passed by reference
81+
if (config.strategies.onTool.length > 0) {
82+
const existingPrimaryTools = opencodeConfig.experimental?.primary_tools ?? []
83+
opencodeConfig.experimental = {
84+
...opencodeConfig.experimental,
85+
primary_tools: [...existingPrimaryTools, "prune"],
86+
}
87+
logger.info("plugin", "Added 'prune' to experimental.primary_tools via config mutation")
88+
}
89+
},
7890
event: createEventHandler(ctx.client, janitorCtx, logger, config, toolTracker),
7991
"chat.params": createChatParamsHandler(ctx.client, state, logger, toolTracker),
8092
tool: config.strategies.onTool.length > 0 ? {

package-lock.json

Lines changed: 8 additions & 8 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
@@ -47,7 +47,7 @@
4747
"zod": "^4.1.13"
4848
},
4949
"devDependencies": {
50-
"@opencode-ai/plugin": ">=0.13.7",
50+
"@opencode-ai/plugin": "^1.0.143",
5151
"@types/node": "^24.10.1",
5252
"tsx": "^4.21.0",
5353
"typescript": "^5.9.3"

0 commit comments

Comments
 (0)