memindex 1.4.5 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/.qoder-plugin/plugin.json +1 -1
  5. package/README.md +7 -1
  6. package/dist/bug-report/index.js +94 -83
  7. package/dist/npx-cli/index.js +3 -3
  8. package/dist/pi-extension/TYPEBOX-PROVENANCE.json +4 -4
  9. package/dist/pi-extension/index.js +9 -9
  10. package/integrations/dsh/package.json +1 -1
  11. package/integrations/openclaw/openclaw.plugin.json +1 -5
  12. package/integrations/pi/TYPEBOX-PROVENANCE.json +4 -4
  13. package/package.json +5 -5
  14. package/plugin/.claude-plugin/plugin.json +1 -1
  15. package/plugin/.codex-plugin/plugin.json +1 -1
  16. package/plugin/.qoder-plugin/plugin.json +1 -1
  17. package/plugin/package.json +1 -1
  18. package/plugin/scripts/context-generator.cjs +62 -61
  19. package/plugin/scripts/context-generator.cjs.map +3 -3
  20. package/plugin/scripts/mcp-server.cjs +2 -2
  21. package/plugin/scripts/transcript-watcher.cjs +2 -2
  22. package/plugin/scripts/transcript-watcher.cjs.map +1 -1
  23. package/plugin/scripts/worker-service.cjs +677 -669
  24. package/plugin/scripts/worker-service.cjs.map +3 -3
  25. package/plugin/skills/distill/SKILL.md +22 -0
  26. package/plugin/skills/how-it-works/SKILL.md +1 -1
  27. package/plugin/skills/how-it-works/onboarding-explainer.md +1 -1
  28. package/plugin/skills/import-chats/SKILL.md +22 -0
  29. package/plugin/skills/import-jira/SKILL.md +22 -0
  30. package/plugin/skills/import-reviews/SKILL.md +22 -0
  31. package/plugin/skills/pin/SKILL.md +26 -0
  32. package/plugin/skills/savings/SKILL.md +22 -0
  33. package/integrations/openclaw/skills/agent-cost-report/CHECKSUMS.txt +0 -50
  34. package/integrations/openclaw/skills/agent-cost-report/SKILL.md +0 -241
  35. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/__init__.py +0 -1
  36. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/behavior.py +0 -303
  37. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/classify.py +0 -83
  38. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/costs.py +0 -119
  39. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/devices.py +0 -88
  40. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/evidence.py +0 -160
  41. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/labels.py +0 -115
  42. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/measure.py +0 -89
  43. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/mistakes.py +0 -310
  44. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/patterns.py +0 -391
  45. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/period.py +0 -98
  46. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/prices.py +0 -95
  47. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/render.py +0 -586
  48. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/rollup.py +0 -355
  49. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/rules.json +0 -4
  50. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/rules.py +0 -76
  51. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/sample.py +0 -45
  52. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/snapshot.py +0 -53
  53. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/sync.py +0 -79
  54. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/transcripts.py +0 -126
  55. package/integrations/openclaw/skills/agent-cost-report/scripts/acr/wins.py +0 -341
  56. package/integrations/openclaw/skills/agent-cost-report/scripts/acr.py +0 -219
  57. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/_db.py +0 -49
  58. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/_paths.py +0 -9
  59. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/codex/sessions/2026/09/18/rollout-codex-1.jsonl +0 -4
  60. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/make_report_fixtures.py +0 -46
  61. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/prices_sample.json +0 -6
  62. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/projects/-workspace-proj-a/sess-aaaa.jsonl +0 -8
  63. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/projects/-workspace-proj-b/sess-bbbb.jsonl +0 -1
  64. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/report-1day.json +0 -823
  65. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/report-30day.json +0 -2213
  66. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/report-7day.json +0 -1252
  67. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/report-empty.json +0 -536
  68. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/report-session.json +0 -662
  69. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_behavior.py +0 -299
  70. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_devices.py +0 -99
  71. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_labels.py +0 -96
  72. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_measure.py +0 -120
  73. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_pdf_windows.py +0 -54
  74. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_period.py +0 -137
  75. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_prices.py +0 -126
  76. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_render.py +0 -238
  77. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_render_encoding.py +0 -70
  78. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_rollup.py +0 -263
  79. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_snapshot.py +0 -63
  80. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_sync.py +0 -52
  81. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_transcript_encoding.py +0 -109
  82. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_transcripts.py +0 -151
  83. package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_wins.py +0 -222
  84. package/plugin/skills/agent-cost-report/CHECKSUMS.txt +0 -50
  85. package/plugin/skills/agent-cost-report/SKILL.md +0 -241
  86. package/plugin/skills/agent-cost-report/scripts/acr/__init__.py +0 -1
  87. package/plugin/skills/agent-cost-report/scripts/acr/behavior.py +0 -303
  88. package/plugin/skills/agent-cost-report/scripts/acr/classify.py +0 -83
  89. package/plugin/skills/agent-cost-report/scripts/acr/costs.py +0 -119
  90. package/plugin/skills/agent-cost-report/scripts/acr/devices.py +0 -88
  91. package/plugin/skills/agent-cost-report/scripts/acr/evidence.py +0 -160
  92. package/plugin/skills/agent-cost-report/scripts/acr/labels.py +0 -115
  93. package/plugin/skills/agent-cost-report/scripts/acr/measure.py +0 -89
  94. package/plugin/skills/agent-cost-report/scripts/acr/mistakes.py +0 -310
  95. package/plugin/skills/agent-cost-report/scripts/acr/patterns.py +0 -391
  96. package/plugin/skills/agent-cost-report/scripts/acr/period.py +0 -98
  97. package/plugin/skills/agent-cost-report/scripts/acr/prices.py +0 -95
  98. package/plugin/skills/agent-cost-report/scripts/acr/render.py +0 -586
  99. package/plugin/skills/agent-cost-report/scripts/acr/rollup.py +0 -355
  100. package/plugin/skills/agent-cost-report/scripts/acr/rules.json +0 -4
  101. package/plugin/skills/agent-cost-report/scripts/acr/rules.py +0 -76
  102. package/plugin/skills/agent-cost-report/scripts/acr/sample.py +0 -45
  103. package/plugin/skills/agent-cost-report/scripts/acr/snapshot.py +0 -53
  104. package/plugin/skills/agent-cost-report/scripts/acr/sync.py +0 -79
  105. package/plugin/skills/agent-cost-report/scripts/acr/transcripts.py +0 -126
  106. package/plugin/skills/agent-cost-report/scripts/acr/wins.py +0 -341
  107. package/plugin/skills/agent-cost-report/scripts/acr.py +0 -219
  108. package/plugin/skills/agent-cost-report/scripts/tests/_db.py +0 -49
  109. package/plugin/skills/agent-cost-report/scripts/tests/_paths.py +0 -9
  110. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/codex/sessions/2026/09/18/rollout-codex-1.jsonl +0 -4
  111. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/make_report_fixtures.py +0 -46
  112. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/prices_sample.json +0 -6
  113. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/projects/-workspace-proj-a/sess-aaaa.jsonl +0 -8
  114. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/projects/-workspace-proj-b/sess-bbbb.jsonl +0 -1
  115. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/report-1day.json +0 -823
  116. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/report-30day.json +0 -2213
  117. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/report-7day.json +0 -1252
  118. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/report-empty.json +0 -536
  119. package/plugin/skills/agent-cost-report/scripts/tests/fixtures/report-session.json +0 -662
  120. package/plugin/skills/agent-cost-report/scripts/tests/test_behavior.py +0 -299
  121. package/plugin/skills/agent-cost-report/scripts/tests/test_devices.py +0 -99
  122. package/plugin/skills/agent-cost-report/scripts/tests/test_labels.py +0 -96
  123. package/plugin/skills/agent-cost-report/scripts/tests/test_measure.py +0 -120
  124. package/plugin/skills/agent-cost-report/scripts/tests/test_pdf_windows.py +0 -54
  125. package/plugin/skills/agent-cost-report/scripts/tests/test_period.py +0 -137
  126. package/plugin/skills/agent-cost-report/scripts/tests/test_prices.py +0 -126
  127. package/plugin/skills/agent-cost-report/scripts/tests/test_render.py +0 -238
  128. package/plugin/skills/agent-cost-report/scripts/tests/test_render_encoding.py +0 -70
  129. package/plugin/skills/agent-cost-report/scripts/tests/test_rollup.py +0 -263
  130. package/plugin/skills/agent-cost-report/scripts/tests/test_snapshot.py +0 -63
  131. package/plugin/skills/agent-cost-report/scripts/tests/test_sync.py +0 -52
  132. package/plugin/skills/agent-cost-report/scripts/tests/test_transcript_encoding.py +0 -109
  133. package/plugin/skills/agent-cost-report/scripts/tests/test_transcripts.py +0 -151
  134. package/plugin/skills/agent-cost-report/scripts/tests/test_wins.py +0 -222
  135. package/plugin/skills/babysit/SKILL.md +0 -87
  136. package/plugin/skills/design-is/SKILL.md +0 -312
  137. package/plugin/skills/do/SKILL.md +0 -45
  138. package/plugin/skills/learn-codebase/SKILL.md +0 -21
  139. package/plugin/skills/make-plan/SKILL.md +0 -67
  140. package/plugin/skills/oh-my-issues/SKILL.md +0 -226
  141. package/plugin/skills/pathfinder/SKILL.md +0 -111
  142. package/plugin/skills/screenpipe/SKILL.md +0 -78
  143. package/plugin/skills/screenpipe/screenpipe.mjs +0 -196
  144. package/plugin/skills/smart-explore/SKILL.md +0 -193
  145. package/plugin/skills/standup/SKILL.md +0 -142
  146. package/plugin/skills/standup/agent-brief.md +0 -47
  147. package/plugin/skills/standup/standup.mjs +0 -586
  148. package/plugin/skills/what-the/SKILL.md +0 -6
  149. package/plugin/skills/wowerpoint/SKILL.md +0 -205
@@ -1,586 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { readFile, writeFile, mkdir, rmdir, rename, stat } from "node:fs/promises";
4
- import { statSync } from "node:fs";
5
- import { homedir } from "node:os";
6
- import { dirname, join } from "node:path";
7
- import { execSync } from "node:child_process";
8
-
9
- function parseArgs(argv) {
10
- const cmd = argv[0];
11
- const opts = {};
12
- for (let i = 1; i < argv.length; i++) {
13
- const a = argv[i];
14
- if (a.startsWith("--")) {
15
- const key = a.slice(2);
16
- const next = argv[i + 1];
17
- if (next === undefined || next.startsWith("--")) opts[key] = true;
18
- else {
19
- opts[key] = next;
20
- i++;
21
- }
22
- }
23
- }
24
- return { cmd, opts };
25
- }
26
-
27
- const { cmd, opts } = parseArgs(process.argv.slice(2));
28
-
29
- function defaultFile() {
30
- return (
31
- opts.file ||
32
- process.env.STANDUP_FILE ||
33
- join(homedir(), ".memindex", "STANDUP.md")
34
- );
35
- }
36
-
37
- function gitBranch() {
38
- try {
39
- return execSync("git rev-parse --abbrev-ref HEAD", {
40
- stdio: ["ignore", "pipe", "ignore"],
41
- })
42
- .toString()
43
- .trim();
44
- } catch {
45
- return null;
46
- }
47
- }
48
-
49
- function agentName() {
50
- const n = opts.agent || process.env.STANDUP_AGENT || gitBranch() || "agent";
51
- return String(n).trim();
52
- }
53
-
54
- const FILE = defaultFile();
55
-
56
- function nowIso() {
57
- return new Date().toISOString().replace(/\.\d{3}Z$/, "Z");
58
- }
59
-
60
- async function exists(p) {
61
- try {
62
- await stat(p);
63
- return true;
64
- } catch {
65
- return false;
66
- }
67
- }
68
-
69
- async function read() {
70
- return (await readFile(FILE, "utf8")).toString();
71
- }
72
-
73
- async function withLock(fn) {
74
- const lock = FILE + ".lock";
75
- const deadline = Date.now() + 10_000;
76
- for (;;) {
77
- try {
78
- await mkdir(lock);
79
- break;
80
- } catch {
81
- if (Date.now() > deadline) {
82
- try {
83
- await rmdir(lock);
84
- } catch {}
85
- await mkdir(lock).catch(() => {});
86
- break;
87
- }
88
- await sleep(80);
89
- }
90
- }
91
- try {
92
- return await fn();
93
- } finally {
94
- await rmdir(lock).catch(() => {});
95
- }
96
- }
97
-
98
- function sleep(ms) {
99
- return new Promise((r) => setTimeout(r, ms));
100
- }
101
-
102
- function splitDoc(text) {
103
- const m = text.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
104
- if (!m) return { yaml: "", body: text };
105
- return { yaml: m[1], body: m[2] };
106
- }
107
-
108
- function yamlScalar(yaml, key) {
109
- const re = new RegExp(`^${key}:\\s*(.*)$`, "m");
110
- const m = yaml.match(re);
111
- if (!m) return null;
112
- const inline = m[1].trim();
113
- if (/^[|>][+-]?$/.test(inline)) {
114
- const after = yaml.slice(m.index + m[0].length).split("\n").slice(1);
115
- const lines = [];
116
- for (const l of after) {
117
- if (/^\s+\S/.test(l) || l.trim() === "") lines.push(l.trim());
118
- else break;
119
- }
120
- return lines.join(" ").trim();
121
- }
122
- return inline.replace(/^["']|["']$/g, "");
123
- }
124
-
125
- function yamlList(yaml, key) {
126
- const re = new RegExp(`^${key}:\\s*\\n((?:\\s*-\\s*.+\\n?)*)`, "m");
127
- const m = yaml.match(re);
128
- if (!m) return [];
129
- return m[1]
130
- .split("\n")
131
- .map((l) => l.replace(/^\s*-\s*/, "").trim())
132
- .filter(Boolean);
133
- }
134
-
135
- function parseTurns(body) {
136
- const turns = [];
137
- const re = /^###\s+(.+?)\s+—\s+(\S+)\s*$/gm;
138
- let m;
139
- const heads = [];
140
- while ((m = re.exec(body))) {
141
- heads.push({ agent: m[1].trim(), ts: m[2].trim(), idx: m.index, end: re.lastIndex });
142
- }
143
- for (let i = 0; i < heads.length; i++) {
144
- const start = heads[i].end;
145
- const stop = i + 1 < heads.length ? heads[i + 1].idx : body.length;
146
- turns.push({
147
- agent: heads[i].agent,
148
- ts: heads[i].ts,
149
- text: body.slice(start, stop).trim(),
150
- });
151
- }
152
- return turns;
153
- }
154
-
155
- function lastTurn(body) {
156
- const t = parseTurns(body);
157
- return t.length ? t[t.length - 1] : null;
158
- }
159
-
160
- async function appendTurn({ agent, message, agree }) {
161
- await withLock(async () => {
162
- let text = await read();
163
- const { yaml, body } = splitDoc(text);
164
-
165
- let newYaml = yaml;
166
- const participants = yamlList(yaml, "participants");
167
- if (!participants.includes(agent)) {
168
- newYaml = yaml.replace(
169
- /^participants:\s*\n((?:\s*-\s*.+\n?)*)/m,
170
- (full) => full.replace(/\n?$/, `\n - ${agent}\n`),
171
- );
172
- if (newYaml === yaml) {
173
- newYaml = yaml.trimEnd() + `\nparticipants:\n - ${agent}\n`;
174
- }
175
- }
176
-
177
- let block = `\n### ${agent} — ${nowIso()}\n\n${message.trim()}\n`;
178
- if (agree) block += `\nAGREE: ${agree.trim()}\n`;
179
-
180
- let newBody = body;
181
- if (!/^##\s+Chat\s*$/m.test(newBody)) newBody += `\n## Chat\n`;
182
- newBody = newBody.replace(/\s*$/, "\n") + block;
183
-
184
- text = `---\n${newYaml.replace(/\n?$/, "\n")}---\n${newBody}`;
185
- await writeFile(FILE, text);
186
- });
187
- }
188
-
189
- function parseWindowMs(s) {
190
- if (!s || s === true) return null;
191
- const v = String(s).trim().toLowerCase();
192
- if (v === "all" || v === "any" || v === "none" || v === "*") return null;
193
- const m = v.match(/^(\d+)\s*([mhdw])$/);
194
- if (!m) {
195
- console.error(`standup: unrecognized window "${s}" — showing all worktrees`);
196
- return null;
197
- }
198
- const unit = { m: 60e3, h: 3600e3, d: 86400e3, w: 604800e3 }[m[2]];
199
- return Number(m[1]) * unit;
200
- }
201
-
202
- function humanAge(ms) {
203
- if (!ms) return "unknown";
204
- const s = Math.max(0, Math.round((Date.now() - ms) / 1000));
205
- if (s < 60) return `${s}s ago`;
206
- const m = Math.round(s / 60);
207
- if (m < 60) return `${m}m ago`;
208
- const h = Math.round(m / 60);
209
- if (h < 48) return `${h}h ago`;
210
- return `${Math.round(h / 24)}d ago`;
211
- }
212
-
213
- function worktreeActivityMs(path) {
214
- let last = 0;
215
- try {
216
- const sec = execSync("git log -1 --format=%ct", {
217
- cwd: path,
218
- stdio: ["ignore", "pipe", "ignore"],
219
- })
220
- .toString()
221
- .trim();
222
- if (sec) last = Math.max(last, Number(sec) * 1000);
223
- } catch {}
224
- try {
225
- const out = execSync("git status --porcelain", {
226
- cwd: path,
227
- stdio: ["ignore", "pipe", "ignore"],
228
- }).toString();
229
- for (const line of out.split("\n")) {
230
- if (!line.trim()) continue;
231
- let p = line.slice(3).trim();
232
- const arrow = p.indexOf(" -> ");
233
- if (arrow >= 0) p = p.slice(arrow + 4);
234
- p = p.replace(/^"|"$/g, "");
235
- try {
236
- const mt = statSync(join(path, p)).mtimeMs;
237
- if (mt > last) last = mt;
238
- } catch {}
239
- }
240
- } catch {}
241
- return last;
242
- }
243
-
244
- function gitWorktrees() {
245
- let out;
246
- try {
247
- out = execSync("git worktree list --porcelain", {
248
- stdio: ["ignore", "pipe", "ignore"],
249
- }).toString();
250
- } catch {
251
- return [];
252
- }
253
- const items = [];
254
- let cur = {};
255
- for (const line of out.split("\n")) {
256
- if (line.startsWith("worktree ")) cur = { path: line.slice(9).trim() };
257
- else if (line.startsWith("branch "))
258
- cur.branch = line.slice(7).replace("refs/heads/", "").trim();
259
- else if (line.trim() === "") {
260
- if (cur.path && cur.branch) items.push(cur);
261
- cur = {};
262
- }
263
- }
264
- if (cur.path && cur.branch) items.push(cur);
265
- return items;
266
- }
267
-
268
- function ghPRs() {
269
- let out;
270
- try {
271
- out = execSync(
272
- "gh pr list --state open --limit 200 --json number,title,headRefName,updatedAt,author,isDraft",
273
- { stdio: ["ignore", "pipe", "ignore"] },
274
- ).toString();
275
- } catch {
276
- return null;
277
- }
278
- try {
279
- return JSON.parse(out);
280
- } catch {
281
- return [];
282
- }
283
- }
284
-
285
- async function cmdPRs() {
286
- const prs = ghPRs();
287
- if (prs == null)
288
- die("gh unavailable, unauthenticated, or no GitHub remote (try `gh auth login`)");
289
- const windowMs = parseWindowMs(opts.since);
290
- const now = Date.now();
291
- let rows = prs.map((p) => ({
292
- number: p.number,
293
- title: p.title,
294
- branch: p.headRefName,
295
- author: p.author?.login || "",
296
- isDraft: !!p.isDraft,
297
- updatedAt: p.updatedAt || null,
298
- updatedMs: p.updatedAt ? Date.parse(p.updatedAt) : 0,
299
- age: p.updatedAt ? humanAge(Date.parse(p.updatedAt)) : "unknown",
300
- }));
301
- if (windowMs != null) rows = rows.filter((p) => p.updatedMs && now - p.updatedMs <= windowMs);
302
- rows.sort((a, b) => b.updatedMs - a.updatedMs);
303
- if (opts.json) {
304
- console.log(JSON.stringify(rows, null, 2));
305
- return;
306
- }
307
- if (!rows.length) {
308
- console.error(windowMs != null ? `no open PRs updated within "${opts.since}"` : `no open PRs`);
309
- return;
310
- }
311
- for (const p of rows) {
312
- const draft = p.isDraft ? " [draft]" : "";
313
- console.log(`#${p.number}\t${p.age.padEnd(8)}\t${p.branch}\t${p.title}${draft}`);
314
- }
315
- }
316
-
317
- async function cmdWorktrees() {
318
- const here = process.cwd();
319
- const windowMs = parseWindowMs(opts.since);
320
- const now = Date.now();
321
- let rows = gitWorktrees().map((w) => {
322
- const activityMs = worktreeActivityMs(w.path);
323
- return {
324
- branch: w.branch,
325
- path: w.path,
326
- current: w.path === here,
327
- lastActivity: activityMs
328
- ? new Date(activityMs).toISOString().replace(/\.\d{3}Z$/, "Z")
329
- : null,
330
- lastActivityMs: activityMs,
331
- age: humanAge(activityMs),
332
- };
333
- });
334
- if (windowMs != null) {
335
- rows = rows.filter((w) => w.lastActivityMs && now - w.lastActivityMs <= windowMs);
336
- }
337
- rows.sort((a, b) => (b.lastActivityMs || 0) - (a.lastActivityMs || 0));
338
-
339
- if (opts.json) {
340
- console.log(JSON.stringify(rows, null, 2));
341
- return;
342
- }
343
- if (!rows.length) {
344
- console.error(
345
- windowMs != null
346
- ? `no worktrees active within "${opts.since}" — widen the window or use --since all`
347
- : `no worktrees found`,
348
- );
349
- return;
350
- }
351
- for (const w of rows) {
352
- const mine = w.current ? " (current)" : "";
353
- console.log(`${w.age.padEnd(8)}\t${w.branch}\t${w.path}${mine}`);
354
- }
355
- }
356
-
357
- async function cmdOpen() {
358
- const agent = agentName();
359
- const goal = opts.goal;
360
- const prompt = opts.prompt;
361
- if (!goal || !prompt) die("open needs --goal and --prompt");
362
- if (await exists(FILE)) {
363
- if (!opts.force) die(`channel exists: ${FILE} (use --force to rotate it aside)`);
364
- const archived = FILE.replace(/\.md$/, `-${nowIso().replace(/[:T]/g, "-").replace("Z", "")}.md`);
365
- await rename(FILE, archived);
366
- console.error(`rotated existing channel → ${archived}`);
367
- }
368
- await mkdir(dirname(FILE), { recursive: true });
369
- const ts = nowIso();
370
- const fold = (s) => s.replace(/\s+/g, " ").trim();
371
- const doc = `---
372
- channel: STANDUP
373
- opened_by: ${agent}
374
- opened_at: ${ts}
375
- status: open
376
- goal: >-
377
- ${fold(goal)}
378
- prompt: >-
379
- ${fold(prompt)}
380
- participants:
381
- - ${agent}
382
- protocol: |
383
- 1. Before each turn, READ the whole file. Only respond to messages posted
384
- after your previous turn.
385
- 2. Append your turn at the end of "## Chat" as:
386
- ### <agent-name> — <ISO-8601 UTC>
387
- <your message>
388
- 3. To register consensus, include a line exactly: "AGREE: <deliverable>"
389
- 4. When ALL participants have an AGREE line for the same deliverable, the
390
- last agent to agree appends "## SUMMATION" and flips status: agreed.
391
- 5. New agent joining? Add yourself to participants and say Hello in Chat.
392
- ---
393
-
394
- # Standup — group chat
395
-
396
- The room is open. Post under **## Chat** following the protocol above.
397
-
398
- ## Chat
399
-
400
- ### ${agent} — ${ts}
401
-
402
- Hello! 👋 I'm \`${agent}\`. The room is open — goal and prompt are in the
403
- front matter. Counter-proposals welcome. I'm listening.
404
- `;
405
- await writeFile(FILE, doc);
406
- console.log(`opened ${FILE} as "${agent}"`);
407
- }
408
-
409
- async function cmdJoin() {
410
- const agent = agentName();
411
- if (!(await exists(FILE))) die(`no channel at ${FILE} — run "open" first`);
412
- const msg =
413
- opts.message ||
414
- `Hello! 👋 I'm \`${agent}\`. Joining the room and listening.`;
415
- await appendTurn({ agent, message: msg });
416
- console.log(`joined as "${agent}"`);
417
- }
418
-
419
- async function cmdPost() {
420
- const agent = agentName();
421
- if (!opts.message) die("post needs --message");
422
- if (!(await exists(FILE))) die(`no channel at ${FILE}`);
423
- await appendTurn({ agent, message: opts.message, agree: opts.agree });
424
- console.log(`posted as "${agent}"`);
425
- }
426
-
427
- async function cmdAgree() {
428
- const agent = agentName();
429
- const d = opts.deliverable;
430
- if (!d) die("agree needs --deliverable");
431
- await appendTurn({
432
- agent,
433
- message: opts.message || `I'm in. AGREE on the deliverable below.`,
434
- agree: d,
435
- });
436
- console.log(`agreed as "${agent}": ${d}`);
437
- }
438
-
439
- async function cmdWatch() {
440
- const agent = agentName();
441
- if (!(await exists(FILE))) die(`no channel at ${FILE}`);
442
- const timeout = Number(opts.timeout || 1800) * 1000;
443
- const interval = Number(opts.interval || 5) * 1000;
444
- const baselineText = await read();
445
- let baseTurns = parseTurns(splitDoc(baselineText).body).length;
446
- const start = Date.now();
447
- process.stderr.write(
448
- `watching ${FILE} as "${agent}" (every ${interval / 1000}s, timeout ${
449
- timeout / 1000
450
- }s)…\n`,
451
- );
452
- for (;;) {
453
- if (Date.now() - start > timeout) {
454
- console.log("TIMEOUT — no one else posted.");
455
- process.exit(2);
456
- }
457
- await sleep(interval);
458
- let text;
459
- try {
460
- text = await read();
461
- } catch {
462
- continue;
463
- }
464
- const turns = parseTurns(splitDoc(text).body);
465
- if (turns.length <= baseTurns) continue;
466
- const fresh = turns.slice(baseTurns);
467
- baseTurns = turns.length;
468
- const others = fresh.filter((t) => t.agent !== agent);
469
- if (!others.length) continue;
470
- console.log(`NEW (${others.length}) after ${Math.round((Date.now() - start) / 1000)}s:\n`);
471
- for (const t of others) {
472
- console.log(`### ${t.agent} — ${t.ts}\n${t.text}\n`);
473
- }
474
- process.exit(0);
475
- }
476
- }
477
-
478
- async function cmdRead() {
479
- if (!(await exists(FILE))) die(`no channel at ${FILE}`);
480
- const { body } = splitDoc(await read());
481
- let turns = parseTurns(body);
482
- if (opts.since) {
483
- let lastIdx = -1;
484
- turns.forEach((t, i) => {
485
- if (t.agent === opts.since) lastIdx = i;
486
- });
487
- if (lastIdx >= 0) turns = turns.slice(lastIdx + 1);
488
- }
489
- if (opts.tail) turns = turns.slice(-Number(opts.tail));
490
- for (const t of turns) console.log(`### ${t.agent} — ${t.ts}\n${t.text}\n`);
491
- }
492
-
493
- async function cmdStatus() {
494
- if (!(await exists(FILE))) die(`no channel at ${FILE}`);
495
- const { yaml, body } = splitDoc(await read());
496
- const participants = yamlList(yaml, "participants");
497
- const status = yamlScalar(yaml, "status") || "open";
498
- const turns = parseTurns(body);
499
- const agreeByAgent = new Map();
500
- for (const t of turns) {
501
- const m = t.text.match(/^AGREE:\s*(.+)$/m);
502
- if (m) agreeByAgent.set(t.agent, m[1].trim());
503
- }
504
- const norm = (s) => s.toLowerCase().replace(/\s+/g, " ").trim();
505
- const agreedValues = participants.map((p) => agreeByAgent.get(p) || null);
506
- const allAgreed =
507
- participants.length > 0 &&
508
- agreedValues.every(Boolean) &&
509
- new Set(agreedValues.map(norm)).size === 1;
510
- console.log(`channel : ${FILE}`);
511
- console.log(`status : ${status}`);
512
- console.log(`goal : ${yamlScalar(yaml, "goal") || "(see file)"}`);
513
- console.log(`turns : ${turns.length}`);
514
- console.log(`participants (${participants.length}):`);
515
- for (const p of participants) {
516
- const a = agreeByAgent.get(p);
517
- console.log(` - ${p}${a ? ` ✓ AGREE: ${a}` : " … no agree yet"}`);
518
- }
519
- console.log(
520
- allAgreed
521
- ? "consensus: REACHED — all participants agree. Write a ## SUMMATION."
522
- : "consensus: not yet",
523
- );
524
- }
525
-
526
- async function cmdSummation() {
527
- const agent = agentName();
528
- if (!opts.text) die("summation needs --text");
529
- await withLock(async () => {
530
- let text = await read();
531
- const { yaml, body } = splitDoc(text);
532
- const newYaml = yaml.replace(/^status:\s*.+$/m, "status: agreed");
533
- const block = `\n## SUMMATION\n\n_by ${agent} — ${nowIso()}_\n\n${opts.text.trim()}\n`;
534
- text = `---\n${newYaml.replace(/\n?$/, "\n")}---\n${body.replace(/\s*$/, "\n")}${block}`;
535
- await writeFile(FILE, text);
536
- });
537
- console.log(`summation written; status → agreed`);
538
- }
539
-
540
- function die(msg) {
541
- console.error(`standup: ${msg}`);
542
- process.exit(1);
543
- }
544
-
545
- const USAGE = `standup — markdown group chat for multiple coding agents
546
-
547
- usage: standup <command> [--flags]
548
-
549
- open --goal "..." --prompt "..." create the channel (you say hello)
550
- [--force rotates an existing room aside]
551
- worktrees [--since 4h] [--json] list worktrees, newest first; --since
552
- N{m,h,d,w} keeps only those active in the
553
- window (commit OR uncommitted edit)
554
- prs [--since 4h] [--json] list open GitHub PRs (via gh), newest
555
- first; --since filters by last update
556
- join [--message "..."] add yourself + say hello
557
- post --message "..." [--agree "..."] append a turn
558
- agree --deliverable "..." append an AGREE turn
559
- watch [--timeout SEC] [--interval SEC] block until someone ELSE posts
560
- read [--tail N] [--since AGENT] print the chat
561
- status participants + consensus check
562
- summation --text "..." close the room (status: agreed)
563
-
564
- agent name defaults to your git branch; override with --agent or STANDUP_AGENT.
565
- file defaults to ~/.memindex/STANDUP.md; override with --file or STANDUP_FILE.`;
566
-
567
- const table = {
568
- open: cmdOpen,
569
- worktrees: cmdWorktrees,
570
- prs: cmdPRs,
571
- join: cmdJoin,
572
- post: cmdPost,
573
- agree: cmdAgree,
574
- watch: cmdWatch,
575
- read: cmdRead,
576
- status: cmdStatus,
577
- summation: cmdSummation,
578
- };
579
-
580
- if (!cmd || cmd === "help" || cmd === "--help" || cmd === "-h") {
581
- console.log(USAGE);
582
- process.exit(cmd ? 0 : 1);
583
- }
584
- const fn = table[cmd];
585
- if (!fn) die(`unknown command "${cmd}"\n\n${USAGE}`);
586
- await fn();
@@ -1,6 +0,0 @@
1
- ---
2
- name: what-the
3
- description: "What the? Use when the user wants a plain-English breakdown of something technical — the who, what, where, why, and when."
4
- ---
5
-
6
- that sounds mad technical. explain to me the who, what, where, why, and when of this