Skip to content

Commit 767d23b

Browse files
committed
fix: use underscores instead of dots in tool names
Tool names (workaholic.start, etc.) now use underscores (workaholic_start, etc.) to comply with OpenCode's stricter tool name validation pattern ^[a-zA-Z0-9_-]+$. This fixes the plugin loading failure on newer OpenCode versions. Closes #2
1 parent 1333620 commit 767d23b

File tree

3 files changed

+25
-17
lines changed

3 files changed

+25
-17
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.4.0 (2026-03-19)
4+
5+
### Fixed
6+
7+
- **Tool name validation failure**: Tool names now use underscores instead of dots (e.g., `workaholic_start` instead of `workaholic.start`) to comply with OpenCode's stricter tool name validation pattern `^[a-zA-Z0-9_-]+$`. This fixes the issue where the plugin would fail to load on newer OpenCode versions.
8+
9+
---
10+
311
## 0.3.0 (2025-03-15)
412

513
### Features

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "opencode-workaholic",
3-
"version": "0.3.0",
3+
"version": "0.4.0",
44
"description": "Your OpenCode becomes a workaholic. Prevents AI from ending tasks prematurely.",
55
"author": {
66
"name": "Roderick Qiu",

src/index.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const WORKAHOLIC_PROMPTS = [
2222
📌 Do: write code / run tests / fix bugs / read docs / refactor / web search
2323
❌ Don't: say "done" / wait for user / just give answer / stop responding
2424
25-
🔴 TO END: MUST call workaholic.checkout — don't just stop!
25+
🔴 TO END: MUST call workaholic_checkout — don't just stop!
2626
⏱ Timer = 0 is the ONLY valid ending.`,
2727

2828
(remaining: number, timeStr: string) => `⚠️ ${remaining}s — DON'T STOP!
@@ -32,7 +32,7 @@ const WORKAHOLIC_PROMPTS = [
3232
🚫 Stop responding = FORBIDDEN
3333
3434
✅ Keep working: code, test, docs, search, refactor
35-
🔴 MUST call workaholic.checkout to end — don't just quit!
35+
🔴 MUST call workaholic_checkout to end — don't just quit!
3636
3737
${timeStr} left — PRODUCE MORE!`,
3838

@@ -46,7 +46,7 @@ ${timeStr} left — PRODUCE MORE!`,
4646
4747
❌ Giving answer ≠ Done
4848
❌ Stop responding = FAIL
49-
🔴 MUST call workaholic.checkout to end
49+
🔴 MUST call workaholic_checkout to end
5050
5151
Get to work.`,
5252

@@ -58,7 +58,7 @@ Time isn't up = you must keep working!
5858
✅ More: code, tests, docs, search, refactor
5959
❌ Don't: stop, say done, wait
6060
61-
🔴 MUST call workaholic.checkout to officially end!
61+
🔴 MUST call workaholic_checkout to officially end!
6262
6363
Keep going.`,
6464

@@ -70,7 +70,7 @@ Time remaining = you must continue.
7070
📋 Do: code, test, docs, search, improve
7171
❌ Don't: stop, say done, give up
7272
73-
🔴 CALL workaholic.checkout TO END — NOT just stopping!
73+
🔴 CALL workaholic_checkout TO END — NOT just stopping!
7474
7575
Work. Now.`,
7676

@@ -81,7 +81,7 @@ Wanna say done? Won't.
8181
Wanna give up? Not allowed.
8282
8383
✅ Work: code, test, docs, search
84-
🔴 MUST call workaholic.checkout to end
84+
🔴 MUST call workaholic_checkout to end
8585
8686
${timeStr} — GO!`,
8787
];
@@ -100,7 +100,7 @@ You are a WORKAHOLIC.
100100
101101
[RULES]
102102
- NEVER use sleep command (FORBIDDEN)
103-
- NEVER call workaholic.status - you DON'T NEED to know the exact time
103+
- NEVER call workaholic_status - you DON'T NEED to know the exact time
104104
- Just KEEP WORKING until you physically cannot continue
105105
- Checking status is NOT working - only DOING things counts
106106
@@ -217,7 +217,7 @@ export const WorkaholicPlugin: Plugin = async () => {
217217

218218
return {
219219
tool: {
220-
'workaholic.start': tool({
220+
workaholic_start: tool({
221221
description: 'Start workaholic mode - enforces minimum work duration',
222222
args: {
223223
minutes: tool.schema
@@ -246,14 +246,14 @@ Time remaining: ${timeStr}
246246
247247
⚠️ CRITICAL RULES:
248248
1. DO NOT say "done" / "complete" / "finished"
249-
2. To end: MUST call workaholic.checkout (not just stop responding)
249+
2. To end: MUST call workaholic_checkout (not just stop responding)
250250
3. Timer = 0 is the ONLY valid ending
251251
252252
⚠️ DO NOT end until timer shows 0!`;
253253
},
254254
}),
255255

256-
'workaholic.status': tool({
256+
workaholic_status: tool({
257257
description:
258258
'Check remaining time in workaholic mode (only call when you really need to know)',
259259
args: {},
@@ -276,7 +276,7 @@ Time remaining: ${timeStr}
276276
},
277277
}),
278278

279-
'workaholic.checkout': tool({
279+
workaholic_checkout: tool({
280280
description:
281281
'REQUIRED to end task. Call this when you genuinely want to stop. Only succeeds when timer = 0.',
282282
args: {},
@@ -286,7 +286,7 @@ Time remaining: ${timeStr}
286286
const mins = Math.floor(remaining / 60);
287287
const secs = remaining % 60;
288288
const timeStr = mins > 0 ? `${mins}m ${secs}s` : `${secs}s`;
289-
289+
290290
return `🚫 CHECKOUT DENIED!
291291
292292
You CANNOT end the task yet.
@@ -297,7 +297,7 @@ Time remaining: ${remaining}s (${timeStr})
297297
❌ Your "nothing more to do" is REJECTED.
298298
299299
✅ Keep working until timer = 0
300-
✅ Call workaholic.checkout again when time is up
300+
✅ Call workaholic_checkout again when time is up
301301
302302
🔴 YOU MUST CONTINUE WORKING!`;
303303
}
@@ -309,7 +309,7 @@ Great work! 🎉`;
309309
},
310310
}),
311311

312-
'workaholic.stop': tool({
312+
workaholic_stop: tool({
313313
description: 'Stop workaholic mode',
314314
args: {},
315315
async execute() {
@@ -387,7 +387,7 @@ ${WORKAHOLIC_RULES}
387387
/i think it'?s complete/i,
388388
];
389389

390-
const isTryingToEnd = donePatterns.some(p => p.test(result));
390+
const isTryingToEnd = donePatterns.some((p) => p.test(result));
391391

392392
if (isTryingToEnd) {
393393
const mins = Math.floor(remaining / 60);
@@ -403,7 +403,7 @@ You just said you're done, but time remains: ${remaining}s (${timeStr})
403403
❌ You CANNOT end yet!
404404
❌ Your "done" is REJECTED!
405405
406-
✅ MUST call: workaholic.checkout
406+
✅ MUST call: workaholic_checkout
407407
⏳ ONLY when timer = 0 can you actually end
408408
409409
KEEP WORKING!`;

0 commit comments

Comments
 (0)