Requires real test/verification evidence before /claim-done is allowed.

Requires real test/verification evidence before /claim-done is allowed.
claude plugin marketplace add kenhuangus/claude-code-mods-pack
claude plugin install proof-of-done@kenhuang-modshooks/proof-of-done.mjs 42 lines1const EV = { plugin: "proof-of-done", key: "evidence" };
2const TEST_RE = /\b(npm test|npm run test|pnpm test|yarn test|pytest|cargo test|go test|vitest|jest)\b/i;
3export function register(on) {
4 on("session.start", async ($, e, next) => {
5 const r = await next(e);
6 await $.state.set(EV, { testsRun: false });
7 await $.command.register({ name: "claim-done", description: "Mark work done only if verification evidence exists" });
8 return r;
9 });
10 on("tool.call", { tool: "Bash" }, async ($, e, next) => {
11 const cmd = String(e.command ?? "");
12 const result = await next(e);
13 if (TEST_RE.test(cmd)) {
14 const exit =
15 typeof result?.exitCode === "number"
16 ? result.exitCode
17 : typeof result?.result?.exitCode === "number"
18 ? result.result.exitCode
19 : 0;
20 await $.state.set(EV, { testsRun: exit === 0, lastCmd: cmd, lastExit: exit });
21 }
22 return result;
23 });
24 on("command.run", { command: "claim-done" }, async ($) => {
25 const { value: ev } = await $.state.get(EV);
26 if (!ev?.testsRun) {
27 return { text: "PROOF REQUIRED: run a local test command (npm test / pytest / etc.) successfully before claiming done." };
28 }
29 return { text: `PROOF OK: verified via \`${ev.lastCmd}\` (exit ${ev.lastExit ?? 0}).` };
30 });
31 on("ui.render", { component: "AbovePrompt" }, async ($, e, next) => {
32 if (e.props?.hasSurvey) return next(e);
33 const { value: ev } = await $.state.get(EV);
34 const { Box, Text } = $.ui.resolve(e);
35 const ok = !!ev?.testsRun;
36 return Box({
37 paddingX: 1,
38 children: [Text({ color: ok ? "green" : "yellow", bold: true, children: ok ? "PROOF ready" : "PROOF missing" })],
39 });
40 });
41}
42types/index.d.ts 8 lines1declare module "claude-code" {
2 interface PluginState {
3 "proof-of-done": {
4 evidence: { testsRun: boolean; lastCmd?: string; lastExit?: number };
5 };
6 }
7}
8