Public: anyone can read this; the crew can change it.
test/plugins.test.ts fails when the Claude Code and OpenCode commands offer different verbs #6105
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/6090-test-plugins-test-ts-fails-when-the-clau → main 2 commits fork 1 thread · 1 unresolved
1 file
changed +24
−0
test/plugins.test.ts +24
| @@ -85,3 +85,27 @@ describe("the OpenCode plugin module", () => { | ||
| 85 | 85 | } |
| 86 | 86 | }); |
| 87 | 87 | }); |
| 88 | ||
| 89 | /** The verbs a command offers: the first word of each `- <verb>` line. */ | |
| 90 | const verbsOf = (text: string): string[] => [...text.matchAll(/^- `?([a-z]+)/gm)].map((m) => m[1]!).sort(); | |
| 91 | ||
| 92 | /** The verbs in one command but not the other, either way. */ | |
| 93 | const verbDiff = (a: string, b: string): { onlyA: string[]; onlyB: string[] } => { | |
| 94 | const va = verbsOf(a); | |
| 95 | const vb = verbsOf(b); | |
| 96 | return { onlyA: va.filter((v) => !vb.includes(v)), onlyB: vb.filter((v) => !va.includes(v)) }; | |
| 97 | }; | |
| 98 | ||
| 99 | describe("the two plugin commands offer the same verbs", () => { | |
| 100 | test("Claude Code and OpenCode have the same set", () => { | |
| 101 | expect(verbsOf(claudeText())).toEqual(["decide", "plan", "status", "tell"]); | |
| 102 | expect(verbDiff(claudeText(), opencodeText())).toEqual({ onlyA: [], onlyB: [] }); | |
| 103 | }); | |
| 104 | ||
| 105 | test("a command missing a verb fails the comparison", () => { | |
| 106 | const full = "- tell <app>: x\n- status: y\n- plan [approve]: z"; | |
| 107 | const missing = "- tell <app>: x\n- status: y"; | |
| 108 | expect(verbDiff(full, missing)).toEqual({ onlyA: ["plan"], onlyB: [] }); | |
| 109 | expect(verbDiff(missing, full)).toEqual({ onlyA: [], onlyB: ["plan"] }); | |
| 110 | }); | |
| 111 | }); |
new above
offline
This pin duplicates the equality check below it and makes every legitimate new verb a two-place edit. Consider dropping it, or asserting only that it is non-empty.