Skip to content

Commit b73d8e1

Browse files
lippdevclaude
andcommitted
Test savvy-progress and make check.mjs require tests for every mod
savvy-progress was the one mod without tests, and CI skipped it in silence. Three tests now cover the progress tool's labels, the reset on a new flow title and the /agents-info toggle. check.mjs fails when a plugin with hooks has no tests/*.test.ts. savvy-progress 1.2.0-lipp.2. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 8c71219 commit b73d8e1

5 files changed

Lines changed: 65 additions & 3 deletions

File tree

‎.claude-plugin/marketplace.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"name": "savvy-progress",
1313
"source": "./plugins/savvy-progress",
1414
"description": "Mod: live agents panel with plan quota, tokens and time per subagent; one pixel Clawd costume per tier.",
15-
"version": "1.2.0-lipp.1",
15+
"version": "1.2.0-lipp.2",
1616
"category": "mod"
1717
},
1818
{

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ scripts/check.mjs consistency checks CI runs
2121
- **Versions move together.** Any change under `plugins/<name>/` bumps its `version` in both `plugins/<name>/.claude-plugin/plugin.json` and `.claude-plugin/marketplace.json`. Patch for wording and fixes, minor for new skills or behaviour.
2222
- **A new plugin** goes in `marketplace.json`, `setup.sh` (`LIPPSTACK_PLUGINS`), `setup.ps1` (`$lippPlugins`), and the README: its table and the "Or by hand" block. `scripts/check.mjs` fails if one is missing.
2323
- **Skills stay agent-neutral.** `SKILL.md` needs `name` (equal to its folder; lowercase, digits, hyphens; ≤ 64) and `description` (≤ 1024 chars). Don't depend on one agent's tools without a fallback: subagents → "or do it yourself in a fresh pass"; ponytail → "if installed"; Jira → "an Atlassian MCP server". `disable-model-invocation: true` only works in Claude Code, so also say in the `description` that the skill runs only when explicitly asked.
24-
- **Mods** are Claude Code only (TypeScript against the `claude-code` hooks API). Every mod has tests.
24+
- **Mods** are Claude Code only (TypeScript against the `claude-code` hooks API). Every mod has tests in `plugins/<mod>/tests/`; `scripts/check.mjs` fails without them.
2525
- **Vendored skills** (`plugins/design-skills/skills/*`) are refreshed by `scripts/sync-vendor.sh`, which overwrites local edits. A weekly workflow opens a PR when upstream changes.
2626
- **Installers** must keep working on macOS (bash 3.2), Linux and Windows PowerShell 5.1+. In `setup.ps1`, run native commands through `Invoke-Native`/`Invoke-Claude` so a failure stops the script.
2727
- Write README and skill prose in plain English, short sentences, no marketing.

‎plugins/savvy-progress/.claude-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "savvy-progress",
3-
"version": "1.2.0-lipp.1",
3+
"version": "1.2.0-lipp.2",
44
"description": "Agents panel (/agents-info): running, finished and planned subagents with model, context, tokens and time, plus the account plan quota (5h and weekly). Fork of johnnyvizz/claude-kit savvy-progress with new Clawd costumes.",
55
"author": {
66
"name": "johnnyvizz",
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { expect, mock, test } from 'claude-code/testing'
2+
import type { On } from 'claude-code'
3+
4+
const PROGRESS = 'mcp__savvy-progress__progress'
5+
const start = { cwd: '/repo', surface: 'terminal', isInteractive: true } as const
6+
7+
// Stands in for the engine beneath the plugin and keeps the list of open panes.
8+
const engine = (on: On) => {
9+
const panes: { id: string; title?: string }[] = []
10+
mock.clock(on)
11+
on('session.start', ($, e) => ({ cwd: e.cwd }))
12+
on('command.run', () => ({}))
13+
on('env.get', () => ({ value: undefined }))
14+
on('settings.read', () => ({ value: {} }))
15+
on('tool.register', () => ({ value: undefined }))
16+
on('command.register', () => ({ value: undefined }))
17+
on('session.usage', () => ({ value: { rateLimits: [] } }))
18+
on('ui.panes', () => ({ value: panes }))
19+
on('ui.open', ($, e) => {
20+
panes.push({ id: e.id, title: e.title })
21+
return { value: { isPlaced: true } }
22+
})
23+
on('ui.close', ($, e) => {
24+
panes.splice(0, panes.length, ...panes.filter(p => p.id !== e.id))
25+
return { value: undefined }
26+
})
27+
return panes
28+
}
29+
30+
test('the progress tool labels the flow by phase and count', async ($, on) => {
31+
engine(on)
32+
await $.session.start(start)
33+
expect(String((await $.tool.call({ tool: PROGRESS, title: 'Add login' })).result)).toBe('ok: Plan')
34+
expect(String((await $.tool.call({ tool: PROGRESS, total: 4, done: 1, phase: 'delegate' })).result)).toBe('ok: Tasks 1/4')
35+
expect(String((await $.tool.call({ tool: PROGRESS, done: 3, phase: 'review' })).result)).toBe('ok: Review 3/4')
36+
expect(String((await $.tool.call({ tool: PROGRESS, finished: true })).result)).toBe('ok: Done')
37+
})
38+
39+
test('a new title starts a clean flow and done never exceeds total', async ($, on) => {
40+
engine(on)
41+
await $.session.start(start)
42+
await $.tool.call({ tool: PROGRESS, title: 'First', total: 5, done: 5, phase: 'delegate' })
43+
expect(String((await $.tool.call({ tool: PROGRESS, title: 'Second', phase: 'delegate' })).result)).toBe('ok: Tasks 0 running')
44+
expect(String((await $.tool.call({ tool: PROGRESS, total: 2, done: 9 })).result)).toBe('ok: Tasks 2/2')
45+
})
46+
47+
test('/agents-info opens the panel and closes it again', async ($, on) => {
48+
const panes = engine(on)
49+
await $.session.start(start)
50+
expect((await $.command.run({ command: 'agents-info' })).text).toBe('Agents panel opened.')
51+
expect(panes.map(p => p.id)).toEqual(['savvy-agents'])
52+
expect((await $.command.run({ command: 'agents-info' })).text).toBe('Agents panel closed.')
53+
expect(panes.length).toBe(0)
54+
})

‎scripts/check.mjs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ for (const f of skills) {
8080
}
8181

8282
// 4. Every local plugin is installed by both setup scripts and the README's manual steps.
83+
// Mods (plugins with hooks) are Claude Code only and every one of them has tests.
84+
for (const p of local) {
85+
const dir = p.source.replace(/^\.\//, '')
86+
if (!existsSync(join(root, dir, 'hooks'))) continue
87+
const tests = files.filter(f => rel(f).startsWith(dir + '/tests/') && /\.test\.tsx?$/.test(f))
88+
if (!tests.length) errors.push(`${p.name}: a mod with no tests; add plugins/${p.name}/tests/*.test.ts (claude plugin test)`)
89+
}
90+
8391
const setupSh = read('setup.sh')
8492
const setupPs1 = read('setup.ps1')
8593
const byHand = /### Or by hand[\s\S]*?```bash\n([\s\S]*?)```/.exec(read('README.md'))?.[1] ?? ''

0 commit comments

Comments
 (0)