pulse: cover timer trigger
73121dc1c36fbecf27b442f116767e418e185486
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
- Parent 1: de058ec2c211
bugabingas dorkfiles
73121dc1c36fbecf27b442f116767e418e185486
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
+62 / −2 text lines
+28 / −2 text lines
Tracks docs and applies validated model-proposed updates when project files change.Tracks docs and applies validated model-proposed updates after workspace changes or periodic checks.Apply modes: `auto` (default), `confirm`, `review` in `.pi/pulse.json`.## SetupLoad extension, then run:- `/pulse init`- `/pulse add <file> [note]`- `/pulse add-dir <dir> <glob> [note]`- `/pulse add-glob <glob> [note]`## Config`.pi/pulse.json`:```json{ "documents": [{ "path": "README.md" }], "interval": 10, "apply": "auto"}````apply`: `auto` (default), `confirm`, `review`.+34 / −0 text lines
it("runs periodic idle checks from the timer", async () => { const realSetInterval = globalThis.setInterval; const realClearInterval = globalThis.clearInterval; const realNow = Date.now; let tick: (() => void) | undefined; let now = 0; globalThis.setInterval = ((fn: () => void) => { tick = fn; return 1 as never; }) as never; globalThis.clearInterval = (() => {}) as never; Date.now = () => now; try { t = await createTestSession({ extensions: [pulsePath()] }); writeFileSync(path.join(t.cwd, "README.md"), "old", "utf8"); writeConfig({ interval: 1, documents: [{ path: "README.md" }] }); await t.session.extensionRunner.emit({ type: "session_start", reason: "startup" }); expect(tick).toBeDefined(); now = 6 * 60 * 1000; tick!(); await new Promise((resolve) => realSetInterval(resolve, 10)); expect(notifyText().some((m) => m.startsWith("Pulse: missing auth"))).toBe(true); await t.session.extensionRunner.emit({ type: "session_shutdown", reason: "quit" }); } finally { globalThis.setInterval = realSetInterval; globalThis.clearInterval = realClearInterval; Date.now = realNow; } });