repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

pulse: cover timer trigger

73121dc1c36fbecf27b442f116767e418e185486

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (2)

+62 / −2 text lines

Diff layout

pi/agent/extensions/pulse/README.md

Modified

+28 / −2 text lines

33Living documentation sync for Pi.
5Tracks docs and applies validated model-proposed updates when project files change.
5Tracks docs and applies validated model-proposed updates after workspace changes or periodic checks.
7Apply modes: `auto` (default), `confirm`, `review` in `.pi/pulse.json`.
7## Setup
8
9Load extension, then run:
11- `/pulse init`
12- `/pulse add <file> [note]`
13- `/pulse add-dir <dir> <glob> [note]`
14- `/pulse add-glob <glob> [note]`
16## Config
18`.pi/pulse.json`:
20```json
21{
22 "documents": [{ "path": "README.md" }],
23 "interval": 10,
24 "apply": "auto"
25}
26```
28`apply`: `auto` (default), `confirm`, `review`.
930## Commands
32- `/pulse list`
33- `/pulse status`
34- `/pulse force`
35- `/pulse pause` / `/pulse resume`
36- `/pulse config`
1137- `/pulse help`
1339## Demo

pi/agent/extensions/pulse/__tests__/harness.test.ts

Modified

+34 / −0 text lines

145145 await t.session.extensionRunner.emit({ type: "session_shutdown", reason: "quit" });
146146 });
148 it("runs periodic idle checks from the timer", async () => {
149 const realSetInterval = globalThis.setInterval;
150 const realClearInterval = globalThis.clearInterval;
151 const realNow = Date.now;
152 let tick: (() => void) | undefined;
153 let now = 0;
154 globalThis.setInterval = ((fn: () => void) => {
155 tick = fn;
156 return 1 as never;
157 }) as never;
158 globalThis.clearInterval = (() => {}) as never;
159 Date.now = () => now;
161 try {
162 t = await createTestSession({ extensions: [pulsePath()] });
163 writeFileSync(path.join(t.cwd, "README.md"), "old", "utf8");
164 writeConfig({ interval: 1, documents: [{ path: "README.md" }] });
166 await t.session.extensionRunner.emit({ type: "session_start", reason: "startup" });
167 expect(tick).toBeDefined();
169 now = 6 * 60 * 1000;
170 tick!();
171 await new Promise((resolve) => realSetInterval(resolve, 10));
173 expect(notifyText().some((m) => m.startsWith("Pulse: missing auth"))).toBe(true);
174 await t.session.extensionRunner.emit({ type: "session_shutdown", reason: "quit" });
175 } finally {
176 globalThis.setInterval = realSetInterval;
177 globalThis.clearInterval = realClearInterval;
178 Date.now = realNow;
179 }
180 });
147181});