Lines 34-74javascript
34 * typical case — a turn paused on a permission prompt)
35 * - stale-running>30min → idle (crashed-session GC)
36 * - interrupted>24h → idle (bounds 🔴 growth)
37 * - pending on a session downgraded to idle does NOT count (the
38 * "stale blue light false-stick" GC fix)
39 * §2 Notification hook → pending on disk → reader counts it → setContext
40 * full chain. Uses the REAL cc-status.js writer (subprocess, isolated
41 * HOME), then runs the aggregation replica over the same state dir.
42 * Also verifies pending is CLEARED by UserPromptSubmit / PreToolUse /
43 * Stop / StopFailure (the four user/turn-driven events) and PRESERVED
44 * by SubagentStart / SubagentStop (background events).
45 * §3 patchPackageJson splice — fixture-based, uses the REAL buildCcContribs
46 * output (via --check-pkg-contribs). Validates: 20+20+20 contribs,
47 * marker + hash stamped, JSON valid after splice, IDEMPOTENT (re-run
48 * detects marker+hash and skips — does NOT double-splice to 40).
49 * §4 End-to-end: the user's literal example — 3 done / 1 running / 2
50 * pending / 0 interrupted → ccDone=3 ccRunning=1 ccPending=2
51 * ccInterrupted=0. Plus the dim/colored light selection logic (which
52 * of the 5 variants per light is shown for each setContext value).
54 * Run: node hooks/test-smoke-v0.1.13.mjs (requires `npm run build` first;
55 * falls back to `npx tsx patch.ts` for the contribs dump if dist/ missing)
58import { spawnSync } from 'child_process';
59import crypto from 'crypto';
HighRuntime Package Install
Package source invokes a package manager install command at runtime.
hooks/test-smoke-v0.1.13.mjsView on unpkg · L54 62import path from 'path';
63import { fileURLToPath } from 'url';
65const __dirname = path.dirname(fileURLToPath(import.meta.url));
66const ROOT = path.resolve(__dirname, '..');
67const DIST_PATCH = path.join(ROOT, 'dist', 'patch.js');
68const CC_STATUS = path.join(__dirname, 'cc-status.js');
70// --- Constants: mirror patch.ts (single source of truth). These are the SAME
71// values the IIFE bakes (DONE_TO_IDLE_MS / SBI_RUNNING_STALE_MS /
72// INTERRUPTED_RETENTION_MS / cap()) and the writer enforces. Any change in
73// patch.ts MUST be mirrored here — same DRY caveat as test-iife.mjs /
74// test-pkg-contribs.mjs. test-iife.mjs's regex assertions catch IIFE-side