create-pmos 0.784.0 → 0.786.0

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 (78) hide show
  1. package/package.json +90 -59
  2. package/payload/AGENTS.md +160 -0
  3. package/payload/KIT-VERSION +1 -1
  4. package/payload/design-system/ui/components/Badge/README.md +2 -2
  5. package/payload/design-system/ui/components/Glyph/README.md +28 -0
  6. package/payload/design-system/ui/components/bundle.css +3 -0
  7. package/payload/planning/evals/eval-calibration.md +1 -1
  8. package/payload/planning/okrs/health-budgets.md +1 -1
  9. package/payload/state/discoveries.md +1 -1
  10. package/workspace/bin/card-catalog-gen.js +22 -0
  11. package/workspace/board-columns-test.js +2 -2
  12. package/workspace/briefing-premium-insights-test.js +5 -4
  13. package/workspace/calm-timeline-test.js +4 -3
  14. package/workspace/changelog.json +89 -0
  15. package/workspace/design-system/ui/components/Badge/README.md +2 -2
  16. package/workspace/design-system/ui/components/Glyph/README.md +28 -0
  17. package/workspace/design-system/ui/components/bundle.css +3 -0
  18. package/workspace/guide/cli.md +19 -0
  19. package/workspace/guide/home.md +5 -3
  20. package/workspace/guide/index.md +2 -2
  21. package/workspace/guide/jira.md +8 -0
  22. package/workspace/guide/layout.md +16 -2
  23. package/workspace/lib/briefing-premium-agent.js +3 -0
  24. package/workspace/lib/card-catalog-gen.js +123 -0
  25. package/workspace/lib/cos-chat.js +1 -0
  26. package/workspace/lib/declined-asks.js +177 -0
  27. package/workspace/lib/declined-cli.js +87 -0
  28. package/workspace/lib/goal-chat.js +1 -0
  29. package/workspace/lib/initiative-chat.js +1 -0
  30. package/workspace/lib/jira-status.js +11 -2
  31. package/workspace/lib/live-events.js +99 -0
  32. package/workspace/lib/pmos-verbs.js +6 -0
  33. package/workspace/lib/program-chat.js +1 -0
  34. package/workspace/lib/quiet-cli.js +81 -0
  35. package/workspace/lib/quiet-sweep.js +228 -0
  36. package/workspace/lib/report-chat.js +1 -0
  37. package/workspace/lib/route-modules.js +1 -0
  38. package/workspace/lib/routes-backlog.js +21 -1
  39. package/workspace/lib/routes-live-rows.js +30 -0
  40. package/workspace/lib/routes-slash.js +142 -2
  41. package/workspace/lib/routes-your-move.js +39 -3
  42. package/workspace/lib/task-cli.js +5 -3
  43. package/workspace/lib/workflow-chat.js +1 -0
  44. package/workspace/okr-goals-ui-test.js +3 -2
  45. package/workspace/package-lock.json +2 -2
  46. package/workspace/package.json +1 -1
  47. package/workspace/public/pm/bd-cols.js +3 -1
  48. package/workspace/public/pm/bd-span.js +13 -7
  49. package/workspace/public/pm/bd-sprint.js +29 -1
  50. package/workspace/public/pm/bd-views.js +6 -3
  51. package/workspace/public/pm/bd-work-ds.css +1 -0
  52. package/workspace/public/pm/bd-work.js +15 -2
  53. package/workspace/public/pm/cozy-board.css +3 -0
  54. package/workspace/public/pm/cozy-insights.css +3 -4
  55. package/workspace/public/pm/ds-bridge.css +12 -0
  56. package/workspace/public/pm/goal-forecast.js +7 -4
  57. package/workspace/public/pm/home-app.js +14 -4
  58. package/workspace/public/pm/komorebi.css +1 -0
  59. package/workspace/public/pm/live-edit.js +34 -3
  60. package/workspace/public/pm/live-feed.js +43 -0
  61. package/workspace/public/pm/okr-list.js +5 -2
  62. package/workspace/public/pm/premium-board.js +2 -0
  63. package/workspace/public/pm/premium-insights.js +10 -4
  64. package/workspace/public/pm/premium-vw-doc.css +5 -0
  65. package/workspace/public/pm/premium-vw-doc.js +11 -31
  66. package/workspace/public/pm/premium-vw-file.js +13 -8
  67. package/workspace/public/pm/premium-vw-guide.css +9 -0
  68. package/workspace/public/pm/premium-vw-guide.js +20 -17
  69. package/workspace/public/pm/quiet-view.js +107 -0
  70. package/workspace/public/pm/reading-view.js +44 -0
  71. package/workspace/public/pm/state-glyph.js +135 -0
  72. package/workspace/skills/jira-sync.skill +4 -3
  73. package/workspace/task-milestones-test.js +2 -2
  74. package/workspace/test-lists/a2ui-chat-rules.json +9 -0
  75. package/workspace/test-lists/a2ui-live-rows.json +9 -0
  76. package/workspace/test-lists/declined-asks.json +9 -0
  77. package/workspace/test-lists/quiet-sweep.json +9 -0
  78. package/workspace/test-lists/state-glyph.json +5 -0
@@ -0,0 +1,228 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* quiet-sweep.js — the weekly sweep of quiet work (bet A503, initiative quiet-work-sweep).
4
+ *
5
+ * Work nobody touched for a month still reads as open, so the real work hides behind it (PMOS itself: 467 of 749 live initiatives had
6
+ * no dated change in 30 days on 2026-11-24). Once a week Today's Your move shows one row, "N initiatives quiet 30 days or more", and the
7
+ * list gives each one three presses: Keep (still on), Park (with a reason) or Close, each with Undo. Zero quiet initiatives is no row.
8
+ * Works on any product built with PMOS, in either layout (planning/initiatives or pmos/state/initiatives).
9
+ *
10
+ * QUIET_DAYS = 30 · KEEP_DAYS = 30 · SHOW = 20
11
+ * quietOf(rows, { kept, stopped, now }) PURE → { total, items: [{ id, title, quietDays, station, workflow, suggest, why }] }
12
+ * rows: lib/line.js lineOf rows (GET /api/line's cached rows). Quiet = live, not ended, a dated last change QUIET_DAYS or more
13
+ * ago, and not waiting on another live initiative (that wait is expected). "Can't tell" with no dated change is left out (a guess
14
+ * never makes a row). kept: Map id → ISO time of the newest Keep; a Keep hides the row for KEEP_DAYS. stopped: Set of ids whose
15
+ * latest lifecycle line is not active (parked or closed since the line was read). Most quiet first.
16
+ * suggest: 'close' when it sits on its workflow's last stage (its work is done, only the close is missing), else 'park'.
17
+ * weekOf(now) → 'YYYY-MM-DD', the Monday of that week (local time): the row's key, so it shows once a week
18
+ * rowOf(sweep, { looked, week }) PURE → the Your move row { key, go: 'quiet', week, title, sub } or null (none quiet, or looked)
19
+ * keptOf(root) · stoppedOf(root) read the ledgers (quiet-sweep.jsonl, lifecycle.jsonl)
20
+ * keep(root, { id, undo }, { now, by, via }) → { ok, file, line } one `keep` (or `unkeep`) line in quiet-sweep.jsonl
21
+ * park(root, { id, why }, opts) → lib/parked-reasons.js hold, with a default reason that says how long it was quiet
22
+ * close(root, { id, why }, opts) → { ok, file, line } one `closed` lifecycle line (D70), the same shape POST /api/lifecycle writes
23
+ * reopen(root, { id }, opts) → { ok, file, line } the Undo of park and close: one `active` lifecycle line
24
+ * lastAnswer(root, id) → { act: 'keep' | 'park' | 'close', at } | null the newest sweep answer still standing (for Undo)
25
+ * undo(root, { id }, opts) → unkeep a Keep, or reopen a park or close the sweep made
26
+ * answered(root, { days, now }) → how many sweep answers (keep, park, close) in the last `days` days: the kill number
27
+ * CLI: node lib/quiet-sweep.js count [root] the health number (quiet initiatives) on its last line
28
+ * node lib/quiet-sweep.js answered [root] [--days N] sweep answers in the last N days (default 14) on its last line
29
+ *
30
+ * The page parks and closes through POST /api/lifecycle (the PM's press) and keeps through POST /api/quiet/keep; `pmos quiet` is the
31
+ * chat's way (lib/quiet-cli.js). Every line this module writes or prints carries `[quiet-sweep]` in the log. Nothing is sent. */
32
+ const fs = require('fs');
33
+ const path = require('path');
34
+
35
+ const TAG = '[quiet-sweep]';
36
+ const FILE = 'quiet-sweep.jsonl';
37
+ const LIFE = 'lifecycle.jsonl';
38
+ const QUIET_DAYS = 30;
39
+ const KEEP_DAYS = 30;
40
+ const SHOW = 20;
41
+ const DAY = 864e5;
42
+ const ID_RE = /^[a-z0-9][a-z0-9._-]*$/i;
43
+
44
+ const P = () => require('./parked-reasons.js');
45
+ const rel = (root, f) => path.relative(root, f).split(path.sep).join('/');
46
+ const clip = (s, n) => { const t = String(s || '').replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).replace(/\s+\S*$/, '') + '…' : t; };
47
+ const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
48
+
49
+ function jsonl(file) {
50
+ let text = '';
51
+ try { text = fs.readFileSync(file, 'utf8'); } catch { return []; }
52
+ const out = [];
53
+ for (const l of text.split('\n')) { if (!l.trim()) continue; try { const r = JSON.parse(l); if (r && typeof r === 'object') out.push(r); } catch { /* a torn line */ } }
54
+ return out;
55
+ }
56
+
57
+ /** The quiet initiatives of a product's line, most quiet first. */
58
+ function quietOf(rows, { kept = new Map(), stopped = new Set(), now = Date.now() } = {}) {
59
+ const items = [];
60
+ for (const r of Array.isArray(rows) ? rows : []) {
61
+ if (!r || !r.id || !r.live || r.ended) continue;
62
+ if (r.flag === 'waiting') continue;
63
+ const q = Number(r.quietDays);
64
+ if (!Number.isFinite(q) || q < QUIET_DAYS) continue;
65
+ if (stopped.has(r.id)) continue;
66
+ const k = Date.parse(kept.get(r.id) || '');
67
+ if (Number.isFinite(k) && now - k < KEEP_DAYS * DAY) continue;
68
+ const st = r.station || null;
69
+ const last = !!(st && st.n && st.of && st.n === st.of);
70
+ items.push({ id: r.id, title: r.title || r.id, quietDays: q, station: st ? st.name : null, workflow: r.workflow || null, ws: r.ws || '',
71
+ suggest: last ? 'close' : 'park',
72
+ why: last ? `On its last stage (${st.name}) and quiet ${q} days: only the close is missing.` : `Quiet ${q} days${st ? ' on ' + st.name : ''}.` });
73
+ }
74
+ items.sort((a, b) => b.quietDays - a.quietDays || a.id.localeCompare(b.id));
75
+ return { total: items.length, items };
76
+ }
77
+
78
+ /** The Monday of `now`'s week, local time. */
79
+ function weekOf(now = Date.now()) {
80
+ const d = new Date(now);
81
+ d.setHours(12, 0, 0, 0);
82
+ d.setDate(d.getDate() - ((d.getDay() + 6) % 7));
83
+ return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0');
84
+ }
85
+
86
+ /** Today's Your move row, or null: none quiet (zero is silence), or the PM opened this week's list. */
87
+ function rowOf(sweep, { looked = '', week = weekOf() } = {}) {
88
+ const n = sweep && sweep.total ? sweep.total : 0;
89
+ if (!n || looked === week) return null;
90
+ return { key: 'quiet:' + week, go: 'quiet', week,
91
+ title: plural(n, 'initiative', 'initiatives') + ' quiet ' + QUIET_DAYS + ' days or more',
92
+ sub: 'Keep, park or close each one. Undo stays open.' };
93
+ }
94
+
95
+ function ledgerDir(root) { const L = P().layoutOf(root); return L ? L.runs : null; }
96
+
97
+ /** id → ISO time of the newest Keep (an `unkeep` after it takes it back). */
98
+ function keptOf(root) {
99
+ const dir = ledgerDir(root); const out = new Map();
100
+ if (!dir) return out;
101
+ for (const r of jsonl(path.join(dir, FILE))) {
102
+ if (typeof r.initiative_id !== 'string') continue;
103
+ if (r.act === 'keep') out.set(r.initiative_id, r.at);
104
+ else if (r.act === 'unkeep') out.delete(r.initiative_id);
105
+ }
106
+ return out;
107
+ }
108
+
109
+ /** The ids whose latest lifecycle line is not `active`: parked, closed or cancelled since the line was read. */
110
+ function stoppedOf(root) {
111
+ const dir = ledgerDir(root); const latest = new Map();
112
+ if (!dir) return new Set();
113
+ for (const r of jsonl(path.join(dir, LIFE))) if (typeof r.initiative_id === 'string' && typeof r.state === 'string') latest.set(r.initiative_id, r.state);
114
+ return new Set([...latest].filter(([, s]) => s !== 'active').map(([id]) => id));
115
+ }
116
+
117
+ function pmSlug() { try { return require('./actor.js').PM_SLUG || 'pm'; } catch { return 'pm'; } }
118
+ function append(root, file, line) {
119
+ try {
120
+ fs.mkdirSync(path.dirname(file), { recursive: true });
121
+ const st = (() => { try { return fs.lstatSync(file); } catch { return null; } })();
122
+ if (st && !st.isFile()) return { ok: false, error: path.basename(file) + ' is not a plain file — nothing was saved' };
123
+ fs.appendFileSync(file, JSON.stringify(line) + '\n');
124
+ console.info(`${TAG} ${line.act || line.state} ${line.initiative_id}`);
125
+ return { ok: true, file: rel(root, file), line };
126
+ } catch (e) { return { ok: false, error: path.basename(file) + ' could not be written: ' + String((e && e.message) || e).slice(0, 160) }; }
127
+ }
128
+ function check(root, id) {
129
+ const L = P().layoutOf(root);
130
+ if (!L) return { error: 'this folder has no initiatives (planning/initiatives or pmos/state/initiatives)' };
131
+ if (!ID_RE.test(String(id || ''))) return { error: 'name the initiative by its id' };
132
+ if (fs.existsSync(path.join(L.initiatives, id + '.md'))) return { L };
133
+ // the file name is the id in both layouts, unless the record's frontmatter says another `id:`
134
+ let files = []; try { files = fs.readdirSync(L.initiatives).filter((f) => f.endsWith('.md')); } catch { files = []; }
135
+ const re = new RegExp('^id:\\s*["\']?' + id.replace(/[.]/g, '\\.') + '["\']?\\s*$', 'm');
136
+ for (const f of files) {
137
+ let head = ''; try { head = fs.readFileSync(path.join(L.initiatives, f), 'utf8').slice(0, 2000); } catch { continue; }
138
+ const fm = /^---\n([\s\S]*?)\n---/.exec(head);
139
+ if (fm && re.test(fm[1])) return { L };
140
+ }
141
+ return { error: `no initiative ${id} here` };
142
+ }
143
+
144
+ /** Still on: one `keep` line; the row stays away for KEEP_DAYS. `undo` writes `unkeep`. */
145
+ function keep(root, { id, undo = false } = {}, { now = Date.now(), by, via } = {}) {
146
+ root = path.resolve(root);
147
+ const c = check(root, id); if (c.error) return { ok: false, error: c.error };
148
+ return append(root, path.join(c.L.runs, FILE), { initiative_id: id, act: undo ? 'unkeep' : 'keep', week: weekOf(now), pm: pmSlug(), by: by || 'agent:unknown', via: via || 'cli', at: new Date(now).toISOString() });
149
+ }
150
+
151
+ /** Park it: one on-hold line through lib/parked-reasons.js, with the reason given or one that says how long it was quiet. */
152
+ function park(root, { id, why, days } = {}, opts = {}) {
153
+ const reason = String(why || '').trim() || `Quiet${Number.isFinite(days) ? ' ' + days + ' days' : ''}; parked in the weekly sweep`;
154
+ const r = P().hold(path.resolve(root), { id, why: reason }, opts);
155
+ if (r && r.ok) console.info(`${TAG} park ${id}`);
156
+ return r;
157
+ }
158
+
159
+ function lifeLine(root, id, state, reason, { now = Date.now(), by, via } = {}) {
160
+ root = path.resolve(root);
161
+ const c = check(root, id); if (c.error) return { ok: false, error: c.error };
162
+ return append(root, path.join(c.L.runs, LIFE), { initiative_id: id, state, reason: clip(reason, 500), pm: pmSlug(), by: by || 'agent:unknown', via: via || 'cli', at: new Date(now).toISOString() });
163
+ }
164
+ /** Close it: one `closed` lifecycle line. */
165
+ function close(root, { id, why } = {}, opts = {}) { return lifeLine(root, id, 'closed', String(why || '').trim() || 'Closed in the weekly sweep of quiet work', opts); }
166
+ /** The Undo of park and close: one `active` lifecycle line. */
167
+ // reason 'undo': the decision journal takes the park's decision out again (lib/decision-journal.js onLifecycle), as the Board's Undo does
168
+ function reopen(root, { id } = {}, opts = {}) {
169
+ const r = lifeLine(root, id, 'active', 'undo', opts);
170
+ if (r.ok) { try { require('./decision-journal.js').onLifecycle(path.resolve(root), r.line, { now: opts.now }); } catch { /* the lifecycle line holds the undo */ } }
171
+ return r;
172
+ }
173
+
174
+ const SWEPT = /weekly sweep/i;
175
+ /** The newest sweep answer still standing for one initiative, or null. */
176
+ function lastAnswer(root, id) {
177
+ const dir = ledgerDir(path.resolve(root)); if (!dir) return null;
178
+ let best = null;
179
+ for (const r of jsonl(path.join(dir, FILE))) if (r.initiative_id === id) best = r.act === 'keep' ? { act: 'keep', at: r.at } : r.act === 'unkeep' ? null : best;
180
+ let life = null;
181
+ for (const r of jsonl(path.join(dir, LIFE))) if (r.initiative_id === id) life = r;
182
+ if (life && (life.state === 'on-hold' || life.state === 'closed') && SWEPT.test(String(life.reason || ''))) {
183
+ const a = { act: life.state === 'closed' ? 'close' : 'park', at: life.at };
184
+ if (!best || String(a.at || '') >= String(best.at || '')) best = a;
185
+ }
186
+ return best;
187
+ }
188
+ /** Undo the newest sweep answer of one initiative. */
189
+ function undo(root, { id } = {}, opts = {}) {
190
+ const a = lastAnswer(root, id);
191
+ if (!a) return { ok: false, error: `${id} has no answer from the weekly sweep to undo` };
192
+ return a.act === 'keep' ? keep(root, { id, undo: true }, opts) : reopen(root, { id }, opts);
193
+ }
194
+ /** Sweep answers in the last `days` days: keeps in quiet-sweep.jsonl, parks and closes in lifecycle.jsonl whose reason names the sweep. */
195
+ function answered(root, { days = 14, now = Date.now() } = {}) {
196
+ const dir = ledgerDir(path.resolve(root)); if (!dir) return 0;
197
+ const since = now - days * DAY, inside = (r) => Date.parse(r.at) >= since;
198
+ const keeps = jsonl(path.join(dir, FILE)).filter((r) => r.act === 'keep' && inside(r)).length;
199
+ const life = jsonl(path.join(dir, LIFE)).filter((r) => (r.state === 'on-hold' || r.state === 'closed') && SWEPT.test(String(r.reason || '')) && inside(r)).length;
200
+ return keeps + life;
201
+ }
202
+
203
+ /** The whole sweep of one repository from its own line (the CLI; the server uses its cached line rows instead). */
204
+ function sweepRoot(root, { now = Date.now() } = {}) {
205
+ root = path.resolve(root);
206
+ const L = require('./line.js').lineOf(root, { now });
207
+ if (!L.ok) return { ok: false, error: L.error || 'the line could not be read' };
208
+ const live = (L.rows || []).filter((r) => r.live && !r.ended).length;
209
+ return { ok: true, live, ...quietOf(L.rows, { kept: keptOf(root), stopped: stoppedOf(root), now }) };
210
+ }
211
+
212
+ module.exports = { TAG, FILE, QUIET_DAYS, KEEP_DAYS, SHOW, quietOf, weekOf, rowOf, keptOf, stoppedOf, keep, park, close, reopen, lastAnswer, undo, answered, sweepRoot };
213
+
214
+ if (require.main === module) {
215
+ const [cmd, rootArg, ...rest] = process.argv.slice(2);
216
+ if (cmd === 'answered') {
217
+ const i = rest.indexOf('--days');
218
+ const days = i >= 0 ? Math.max(1, parseInt(rest[i + 1], 10) || 14) : 14;
219
+ const n = answered(rootArg || '.', { days });
220
+ console.log(`${TAG} ${n} quiet initiatives answered (keep, park or close) in the last ${days} days`);
221
+ console.log(String(n));
222
+ } else if (cmd !== 'count') { console.log('usage: node lib/quiet-sweep.js count [root] | answered [root] [--days N]'); process.exitCode = 2; }
223
+ else {
224
+ const s = sweepRoot(rootArg || '.');
225
+ if (!s.ok) { console.log(`${TAG} ${s.error}`); process.exitCode = 1; }
226
+ else { console.log(`${TAG} ${s.total} of ${s.live} live initiatives quiet ${QUIET_DAYS} days or more`); console.log(String(s.total)); }
227
+ }
228
+ }
@@ -41,6 +41,7 @@ const RULE = [
41
41
  ' To change a saved dashboard, add its "id" (from premium-dashboards.jsonl in the state folder); {"kind":"dashboard","id":"…"} alone opens it.',
42
42
  ' You never save, change or delete a chart or a dashboard yourself either: the PM presses Save in the Chart tab.',
43
43
  'If the message is not about a report, a chart or a dashboard, answer it and add no block.',
44
+ /* card-catalog:begin, generated by bin/card-catalog-gen.js: edit lib/card-catalog.json, not this block */"The card buttons run these pmos commands (the card catalog; who acts: you = one press with Undo, agent = PMOS starts a run, waits = only after the PM says yes). Run the one that fits the PM's ask, and tell the PM the Undo line it prints: pmos report draft <cadence> <slot> (Draft; agent); pmos report check <id> (Check; you); pmos report rule <id> add voice|wording|off|keep (Add a rule; you); pmos report issue <cadence> <slot> (Send; waits); pmos schedule run <id> (Run now; you); pmos schedule disable|enable <id> (Pause / resume; you); pmos schedule edit <id> (Edit; you); pmos schedule rm <id> (Remove; you); pmos press-release <initiative> --again (Draft again; agent)."/* card-catalog:end */,
44
45
  ].join('\n');
45
46
 
46
47
  const REMIND = 'This chat is about a report. If it is set up (report-setups.jsonl, by name) every refinement is a change to its open draft: end with {"kind":"report","id":"<its id>","change":"the whole change, in the PM\'s words"} in a pmos-report block, the page passes it by itself, and say in one line what you passed and that the draft is updating. A look change (palette, tables, Gantt, a deck or screenshot to follow) is "design":"the look" with "sample":"<the attached file path>" instead of "change": the page starts the next look and the PM keeps it with ✓. Never say "the draft stays as it is" or "press Draft it" or "the proposal is unchanged" for a set-up report; ask anything unknown once and pass what is known. An issued report is frozen: pass nothing. Same rules as before.';
@@ -147,6 +147,7 @@ const MODULES = Object.freeze([
147
147
  'routes-strategy-card', // bet A458: a product's five-line strategy above its Board, and the gentle "doesn't fit" note on new work (records strategy-card.jsonl; page-press POST)
148
148
  'routes-principles', // bet A352: a product's principles drafted from its decisions, kept or dropped on the Board (records principles.jsonl; page-press POST)
149
149
  'routes-prefs', // bet A461: view preferences that follow the person to the phone and other browsers (runtime view-prefs.json; page-press POST)
150
+ 'routes-live-rows', // bet A458: chat-made task changes streamed to open pages (runtime live-events.jsonl; read-only event stream)
150
151
  ]);
151
152
  const PM_DIR = path.join(__dirname, '..', 'public', 'pm');
152
153
  const MODULE_NAME = /^[a-z0-9][a-z0-9-]*\.js$/;
@@ -19,6 +19,8 @@
19
19
  * lib/sprint-history.js detailOf. GET /api/backlog also carries sprintList (the picker, SpH1) and
20
20
  * sprintTrend (the carried-over line and bars), and sprintNow (This sprint: every task in the
21
21
  * active sprint's dates, Jira and not, done ones too; lib/sprint-now.js).
22
+ * POST /api/backlog/sprint-retro { ws, board, sprint, ev: pick|drop|undo, reason? } the PM's override of a closed sprint's one tracked
23
+ * change (lib/sprint-retro.js; GET /api/backlog/sprint carries the retro as sprint.retro)
22
24
  * POST /api/backlog/rank { ws, board, order: [id] } the Backlog's one rank across initiatives (a backlog-rank line on the board
23
25
  * ledger; D105). GET /api/backlog carries it as backlogRank, each task's inSprint and touched (its last
24
26
  * change), and sprintNext (the earliest future sprint, as Jira holds it).
@@ -42,6 +44,7 @@ const SO = require('./sprint-overview.js');
42
44
  const SH = require('./sprint-history.js');
43
45
  const RR = require('./rollover-reasons.js');
44
46
  const SN = require('./sprint-now.js');
47
+ const SR = require('./sprint-retro.js');
45
48
  /** The PM's own name for Who (PMOS_PM_NAME, else git's user.name: the name Home greets them by); '' when neither is set. */
46
49
  const pmNameOf = () => { try { return require('./routes-board-publish.js').sharedBy() || ''; } catch { return ''; } };
47
50
 
@@ -224,9 +227,14 @@ async function handle(req, res, url, ctx) {
224
227
  const name = text(url.searchParams.get('sprint')).slice(0, 120);
225
228
  const d = name ? SH.detailOf(name, L._sin) : null;
226
229
  if (!d) return send(bad(404, 'PMOS knows no sprint of that name on this board'));
230
+ // the retro and its one tracked change (initiative sprint-retro-one-change), in the board's own sprint order
231
+ if (d.state === 'closed') {
232
+ const order = (L.sprintList || []).filter((x) => x.state === 'closed').map((x) => x.name);
233
+ try { d.retro = SR.retroOf(L._sin.lines, name, { order, overrides: SR.readOverrides(L._w.root) }); } catch { d.retro = null; }
234
+ }
227
235
  return send({ status: 200, body: { ok: true, ws: L.ws, board: L.board, sprint: d } });
228
236
  }
229
- if (!['give', 'stop', 'decide', 'undo', 'decline', 'place', 'rank', 'sprint-draft', 'sprint-note', 'sprint-reason'].includes(sub)) return send(bad(404, 'no such route'));
237
+ if (!['give', 'stop', 'decide', 'undo', 'decline', 'place', 'rank', 'sprint-draft', 'sprint-note', 'sprint-retro', 'sprint-reason'].includes(sub)) return send(bad(404, 'no such route'));
230
238
  if (req.method !== 'POST') return send(bad(405, 'POST only'));
231
239
  const read = await ctx.readJson(req);
232
240
  if (!read.ok || !read.body || typeof read.body !== 'object') return send(bad(400, 'the body must be a JSON object'));
@@ -272,6 +280,18 @@ async function handle(req, res, url, ctx) {
272
280
  return send({ status: 200, body: { ok: true, was } });
273
281
  }
274
282
 
283
+ // the PM's override of a closed sprint's tracked change (initiative sprint-retro-one-change): ✕ drops it, Undo takes the ✕ back
284
+ if (sub === 'sprint-retro') {
285
+ const sprint = text(body.sprint).slice(0, 120), ev = text(body.ev);
286
+ const closed = (L.sprintList || []).filter((x) => x.state === 'closed').map((x) => x.name);
287
+ if (!sprint || !closed.includes(sprint)) return send(bad(404, 'no closed sprint of that name on this board'));
288
+ if (!['pick', 'drop', 'undo'].includes(ev)) return send(bad(400, 'ev is pick, drop or undo'));
289
+ const r = SR.appendOverride(L._w.root, { sprint, ev, reason: ev === 'pick' ? text(body.reason) : null, by: g.actor.by });
290
+ if (!r.ok) return send(bad(400, r.error));
291
+ let retro = null; try { retro = SR.retroOf(L._sin.lines, sprint, { order: closed, overrides: SR.readOverrides(L._w.root) }); } catch { retro = null; }
292
+ return send({ status: 200, body: { ok: true, retro } });
293
+ }
294
+
275
295
  if (sub === 'place') {
276
296
  const key = text(body.key).toUpperCase(), to = text(body.to);
277
297
  if (!/^[A-Z][A-Z0-9_]*-\d+$/.test(key)) return send(bad(400, 'key is a Jira key like IDPF-3340'));
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+ /* routes-live-rows.js — the live changes stream (bet A458, path-level live updates; job #1750).
3
+ *
4
+ * GET /api/live-rows → text/event-stream; one `data: {at, kind, id, field, value, undo}` message per change that `pmos task …` made from
5
+ * the chat, in any workspace this server holds (lib/live-events.js). A comment line every 25 s keeps it open.
6
+ *
7
+ * Read only: the stream writes nothing, and an open page draws each change on the rows it already holds (public/pm/live-feed.js). */
8
+ const LE = require('./live-events.js');
9
+
10
+ let HUB = null;
11
+ const hubOf = (ctx) => HUB || (HUB = LE.hub(() => (ctx.workspaceList ? ctx.workspaceList() : []).map((w) => { try { return ctx.stateDirFor(w); } catch { return null; } })));
12
+
13
+ module.exports = {
14
+ prefixes: ['/api/live-rows'],
15
+ handle: async (req, res, url, ctx) => {
16
+ if (url.pathname !== '/api/live-rows') return false;
17
+ if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
18
+ res.writeHead(200, { 'Content-Type': 'text/event-stream; charset=utf-8', 'Cache-Control': 'no-cache', Connection: 'keep-alive' });
19
+ res.write(': live\n\n');
20
+ const off = hubOf(ctx).on((e) => res.write('data: ' + JSON.stringify(e) + '\n\n'));
21
+ const beat = setInterval(() => res.write(': beat\n\n'), 25000);
22
+ if (beat.unref) beat.unref();
23
+ const end = () => { off(); clearInterval(beat); };
24
+ req.on('close', end);
25
+ res.on('error', end);
26
+ return true;
27
+ },
28
+ // tests: forget the shared watcher
29
+ _reset: () => { HUB = null; },
30
+ };
@@ -13,7 +13,137 @@ const fs = require('fs');
13
13
  const os = require('os');
14
14
  const path = require('path');
15
15
 
16
- const PMOS = [{ cmd: '/goal', name: 'Give PMOS a goal', say: 'It asks a few questions to make the goal SMART, then works on it after you press Start.' }];
16
+ // /goal, then one entry per command a card button runs (the card catalog, A455)
17
+ const PMOS = [{ cmd: '/goal', name: 'Give PMOS a goal', say: 'It asks a few questions to make the goal SMART, then works on it after you press Start.' },
18
+ /* card-catalog:begin, generated by bin/card-catalog-gen.js: edit lib/card-catalog.json, not this block */
19
+ {"cmd":"/pmos:task-set","run":"pmos task set","name":"Move the date and 7 more","say":"pmos task set <id> --due <date> [--start <date>] [--owner <who>] [--notes <text>] [--milestone] [--pin] [--no-milestone]"},
20
+ {"cmd":"/pmos:task-state","run":"pmos task state","name":"Change status and 1 more","say":"pmos task state <id> --to <state> --why <text>"},
21
+ {"cmd":"/pmos:task-comment","run":"pmos task comment","name":"Comment","say":"pmos task comment <id> <text>"},
22
+ {"cmd":"/pmos:task-describe","run":"pmos task describe","name":"Write the description","say":"pmos task describe <id>"},
23
+ {"cmd":"/pmos:task-remove","run":"pmos task remove","name":"Remove","say":"pmos task remove <id> --why <text>"},
24
+ {"cmd":"/pmos:task-add","run":"pmos task add","name":"Add a subtask and 1 more","say":"pmos task add <initiative> \"<title>\" --parent <task> [--due <date>] [--owner <who>]"},
25
+ {"cmd":"/pmos:rehearse-move","run":"pmos rehearse move","name":"What slips if it moves and 1 more","say":"pmos rehearse move <id> --due <date> [--by <days>]"},
26
+ {"cmd":"/pmos:task-link","run":"pmos task link","name":"Link two tasks","say":"pmos task link <from> <to> --type fs|ss|ff|sf --lag <days>"},
27
+ {"cmd":"/pmos:task-unlink","run":"pmos task unlink","name":"Unlink","say":"pmos task unlink <from> <to>"},
28
+ {"cmd":"/pmos:item-move","run":"pmos item move","name":"Move on the board","say":"pmos item move <item> <todo|doing|review|done> --evidence <ref>"},
29
+ {"cmd":"/pmos:item-set","run":"pmos item set","name":"Change date or owner","say":"pmos item set <item> --due <date> --owner <who>"},
30
+ {"cmd":"/pmos:item-withdraw","run":"pmos item withdraw","name":"Withdraw","say":"pmos item withdraw <item>"},
31
+ {"cmd":"/pmos:my-work-show","run":"pmos my-work show","name":"Open the context card","say":"pmos my-work show <item>"},
32
+ {"cmd":"/pmos:initiative-up","run":"pmos initiative up","name":"Move up / down","say":"pmos initiative up <id>"},
33
+ {"cmd":"/pmos:initiative-down","run":"pmos initiative down","name":"Move up / down","say":"pmos initiative down <id>"},
34
+ {"cmd":"/pmos:initiative-top","run":"pmos initiative top","name":"Move to top / bottom","say":"pmos initiative top <id>"},
35
+ {"cmd":"/pmos:initiative-bottom","run":"pmos initiative bottom","name":"Move to top / bottom","say":"pmos initiative bottom <id>"},
36
+ {"cmd":"/pmos:initiative-after","run":"pmos initiative after","name":"Rank after another","say":"pmos initiative after <id> <other>"},
37
+ {"cmd":"/pmos:initiative-check-by","run":"pmos initiative check-by","name":"Set check date","say":"pmos initiative check-by <id> <date>"},
38
+ {"cmd":"/pmos:initiative-kind","run":"pmos initiative kind","name":"Change kind","say":"pmos initiative kind <id> product|project|sdlc"},
39
+ {"cmd":"/pmos:workflow-switch","run":"pmos workflow switch","name":"Change workflow and 1 more","say":"pmos workflow switch <id> --to <workflow> --stage <stage> --why <text>"},
40
+ {"cmd":"/pmos:workflow-move","run":"pmos workflow move","name":"Move to stage","say":"pmos workflow move <id> --stage <stage> --why <text>"},
41
+ {"cmd":"/pmos:initiative-describe","run":"pmos initiative describe","name":"Write the description","say":"pmos initiative describe <id>"},
42
+ {"cmd":"/pmos:parked-hold","run":"pmos parked hold","name":"Park it and 1 more","say":"pmos parked hold <id> --why <text>"},
43
+ {"cmd":"/pmos:initiative-export","run":"pmos initiative export","name":"Export the breakdown","say":"pmos initiative export <id>"},
44
+ {"cmd":"/pmos:initiative-adopt","run":"pmos initiative adopt","name":"Keep","say":"pmos initiative adopt <proposal>"},
45
+ {"cmd":"/pmos:initiative-drop","run":"pmos initiative drop","name":"Drop","say":"pmos initiative drop <proposal>"},
46
+ {"cmd":"/pmos:parked-back","run":"pmos parked back","name":"Bring back","say":"pmos parked back <id>"},
47
+ {"cmd":"/pmos:program-check","run":"pmos program check","name":"Check a milestone","say":"pmos program check <id> <milestone>"},
48
+ {"cmd":"/pmos:program-milestone","run":"pmos program milestone","name":"Move a milestone and 3 more","say":"pmos program milestone <id> move <m> --date <date>"},
49
+ {"cmd":"/pmos:program-join","run":"pmos program join","name":"Add an initiative","say":"pmos program join <id> <initiative>"},
50
+ {"cmd":"/pmos:program-leave","run":"pmos program leave","name":"Take one out","say":"pmos program leave <id> <initiative>"},
51
+ {"cmd":"/pmos:program-charter","run":"pmos program charter","name":"Set goal and why","say":"pmos program charter <id> --goal <text> --why <text>"},
52
+ {"cmd":"/pmos:program-capacity","run":"pmos program capacity","name":"Set team capacity","say":"pmos program capacity <team> <n>"},
53
+ {"cmd":"/pmos:program-decide","run":"pmos program decide","name":"Decide what goes first","say":"pmos program decide --team <team> --first <initiative>"},
54
+ {"cmd":"/pmos:program-order","run":"pmos program order","name":"Order its initiatives","say":"pmos program order <id> <id,id,…>"},
55
+ {"cmd":"/pmos:program-archive","run":"pmos program archive","name":"Archive","say":"pmos program archive <id>"},
56
+ {"cmd":"/pmos:program-task","run":"pmos program task","name":"Add","say":"pmos program task <id> \"<title>\" --key <key>"},
57
+ {"cmd":"/pmos:program-task-done","run":"pmos program task-done","name":"Done","say":"pmos program task-done <id> <key>"},
58
+ {"cmd":"/pmos:units-show","run":"pmos units show","name":"Open","say":"pmos units show <unit>"},
59
+ {"cmd":"/pmos:launch-check","run":"pmos launch check","name":"Check what is not ready","say":"pmos launch check <initiative> --date <date>"},
60
+ {"cmd":"/pmos:launch-tier","run":"pmos launch tier","name":"Set the launch tier","say":"pmos launch tier <initiative>"},
61
+ {"cmd":"/pmos:ready-check","run":"pmos ready check","name":"Run the check","say":"pmos ready check <initiative>"},
62
+ {"cmd":"/pmos:strategy-set","run":"pmos strategy set","name":"Write it","say":"pmos strategy set --line <key> --text <text>"},
63
+ {"cmd":"/pmos:strategy-draft","run":"pmos strategy draft","name":"Let PMOS draft","say":"pmos strategy draft"},
64
+ {"cmd":"/pmos:strategy-undo","run":"pmos strategy undo","name":"Undo PMOS’s draft","say":"pmos strategy undo --line <key>"},
65
+ {"cmd":"/pmos:positioning-keep","run":"pmos positioning keep","name":"Keep","say":"pmos positioning keep --text <text> --cites <source>"},
66
+ {"cmd":"/pmos:positioning-drop","run":"pmos positioning drop","name":"Drop","say":"pmos positioning drop <id>"},
67
+ {"cmd":"/pmos:principles-keep","run":"pmos principles keep","name":"Keep","say":"pmos principles keep <id>"},
68
+ {"cmd":"/pmos:principles-drop","run":"pmos principles drop","name":"Drop","say":"pmos principles drop <id>"},
69
+ {"cmd":"/pmos:principles-undo","run":"pmos principles undo","name":"Undo","say":"pmos principles undo <id>"},
70
+ {"cmd":"/pmos:principles-add","run":"pmos principles add","name":"Add one","say":"pmos principles add --text <text>"},
71
+ {"cmd":"/pmos:artefacts-set","run":"pmos artefacts set","name":"Write it","say":"pmos artefacts set <scope> <artefact> --text <text>"},
72
+ {"cmd":"/pmos:artefacts-undo","run":"pmos artefacts undo","name":"Undo","say":"pmos artefacts undo <a-id>"},
73
+ {"cmd":"/pmos:proactive-goals","run":"pmos proactive goals","name":"Add and 3 more","say":"pmos proactive goals add <text> --initiative <id>"},
74
+ {"cmd":"/pmos:measure-add","run":"pmos measure add","name":"Add a reading","say":"pmos measure add <anchor> <value> --source <source>"},
75
+ {"cmd":"/pmos:outcomes-declare","run":"pmos outcomes declare","name":"Declare the metric","say":"pmos outcomes declare <id> --metric <text>"},
76
+ {"cmd":"/pmos:outcomes-test","run":"pmos outcomes test","name":"Set the smallest test","say":"pmos outcomes test <id> --test <text>"},
77
+ {"cmd":"/pmos:outcomes-record","run":"pmos outcomes record","name":"Record the result","say":"pmos outcomes record <id> worked|didnt-work|cant-tell --evidence <text>"},
78
+ {"cmd":"/pmos:decisions-add","run":"pmos decisions add","name":"Record a decision","say":"pmos decisions add"},
79
+ {"cmd":"/pmos:decisions-check","run":"pmos decisions check","name":"Check it","say":"pmos decisions check <id> worked|didnt-work|cant-tell --evidence <text>"},
80
+ {"cmd":"/pmos:decisions-undo","run":"pmos decisions undo","name":"Take it out","say":"pmos decisions undo <id>"},
81
+ {"cmd":"/pmos:glossary-set","run":"pmos glossary set","name":"Set meaning","say":"pmos glossary set <term> <meaning>"},
82
+ {"cmd":"/pmos:glossary-remove","run":"pmos glossary remove","name":"Remove","say":"pmos glossary remove <term>"},
83
+ {"cmd":"/pmos:signal-add","run":"pmos signal add","name":"Add","say":"pmos signal add <initiative> --who <who>"},
84
+ {"cmd":"/pmos:signal-remove","run":"pmos signal remove","name":"Remove","say":"pmos signal remove <sid>"},
85
+ {"cmd":"/pmos:forecast-baseline","run":"pmos forecast baseline","name":"Set baseline","say":"pmos forecast baseline"},
86
+ {"cmd":"/pmos:forecast-baseline-off","run":"pmos forecast baseline-off","name":"Clear baseline","say":"pmos forecast baseline-off"},
87
+ {"cmd":"/pmos:people-record","run":"pmos people record","name":"Record who a session met","say":"pmos people record --file <sightings.json>"},
88
+ {"cmd":"/pmos:mention-draft","run":"pmos mention draft","name":"Draft a reply","say":"pmos mention draft <id> --text <text>"},
89
+ {"cmd":"/pmos:mention-answered","run":"pmos mention answered","name":"Mark answered","say":"pmos mention answered <id> --who <who>"},
90
+ {"cmd":"/pmos:mention-watch","run":"pmos mention watch","name":"Watch for","say":"pmos mention watch <id> --what <text>"},
91
+ {"cmd":"/pmos:mention-stands","run":"pmos mention stands","name":"Settled","say":"pmos mention stands <id> --settled"},
92
+ {"cmd":"/pmos:signoff-ask","run":"pmos signoff ask","name":"Ask","say":"pmos signoff ask <initiative> --who <who>"},
93
+ {"cmd":"/pmos:signoff-answer","run":"pmos signoff answer","name":"Record the answer","say":"pmos signoff answer <id> --answer <text>"},
94
+ {"cmd":"/pmos:signoff-drop","run":"pmos signoff drop","name":"Drop","say":"pmos signoff drop <id> --why <text>"},
95
+ {"cmd":"/pmos:jira-answer","run":"pmos jira answer","name":"Answer a ticket question","say":"pmos jira answer <initiative> <ticket> <n> --text <text>"},
96
+ {"cmd":"/pmos:driver-keep","run":"pmos driver keep","name":"Keep","say":"pmos driver keep <proposal>"},
97
+ {"cmd":"/pmos:driver-return","run":"pmos driver return","name":"Send back with a note","say":"pmos driver return <proposal> --note <text>"},
98
+ {"cmd":"/pmos:driver-drop","run":"pmos driver drop","name":"Drop","say":"pmos driver drop <proposal> --note <text>"},
99
+ {"cmd":"/pmos:driver-undo","run":"pmos driver undo","name":"Undo","say":"pmos driver undo <proposal>"},
100
+ {"cmd":"/pmos:driver-pause","run":"pmos driver pause","name":"Pause PMOS on this","say":"pmos driver pause initiative <id>"},
101
+ {"cmd":"/pmos:proactive-feedback","run":"pmos proactive feedback","name":"Useful and 3 more","say":"pmos proactive feedback <id> useful"},
102
+ {"cmd":"/pmos:rules-edit","run":"pmos rules edit","name":"Edit","say":"pmos rules edit <n> --text <text>"},
103
+ {"cmd":"/pmos:rules-retire","run":"pmos rules retire","name":"Retire","say":"pmos rules retire <n>"},
104
+ {"cmd":"/pmos:rules-restore","run":"pmos rules restore","name":"Bring back","say":"pmos rules restore <n>"},
105
+ {"cmd":"/pmos:autonomy-restore","run":"pmos autonomy restore","name":"Undo the job","say":"pmos autonomy restore <job>"},
106
+ {"cmd":"/pmos:autonomy-check","run":"pmos autonomy check","name":"Check it","say":"pmos autonomy check <ref> --verdict PASS|FAIL --why <text>"},
107
+ {"cmd":"/pmos:ai-off","run":"pmos ai off","name":"Turn off","say":"pmos ai off <job>"},
108
+ {"cmd":"/pmos:ai-on","run":"pmos ai on","name":"Turn on","say":"pmos ai on <job>"},
109
+ {"cmd":"/pmos:team-pause","run":"pmos team pause","name":"Pause / resume","say":"pmos team pause <role>"},
110
+ {"cmd":"/pmos:team-resume","run":"pmos team resume","name":"Pause / resume","say":"pmos team resume <role>"},
111
+ {"cmd":"/pmos:team-dispatch","run":"pmos team dispatch","name":"Dispatch on an initiative","say":"pmos team dispatch <initiative> --roles <roles>"},
112
+ {"cmd":"/pmos:scan-match","run":"pmos scan match","name":"Match to an initiative","say":"pmos scan match <finding> <initiative> --scan <id>"},
113
+ {"cmd":"/pmos:critic-label","run":"pmos critic label","name":"Real and 1 more","say":"pmos critic label <run> <n> real"},
114
+ {"cmd":"/pmos:jira-pin","run":"pmos jira pin","name":"Keep live","say":"pmos jira pin <initiative>"},
115
+ {"cmd":"/pmos:jira-approve","run":"pmos jira approve","name":"Approve to push","say":"pmos jira approve <initiative> <ID>"},
116
+ {"cmd":"/pmos:jira-criteria-propose","run":"pmos jira criteria-propose","name":"Draft done-criteria","say":"pmos jira criteria-propose <initiative>"},
117
+ {"cmd":"/pmos:jira-epic","run":"pmos jira epic","name":"Use an epic","say":"pmos jira epic <initiative> new|<KEY>"},
118
+ {"cmd":"/pmos:docs-link","run":"pmos docs link","name":"Link a copy","say":"pmos docs link <file> <link>"},
119
+ {"cmd":"/pmos:docs-unlink","run":"pmos docs unlink","name":"Unlink","say":"pmos docs unlink <file> <kind>"},
120
+ {"cmd":"/pmos:docs-sync-start","run":"pmos docs sync-start","name":"Sync","say":"pmos docs sync-start <file> <kind> --use pmos|copy"},
121
+ {"cmd":"/pmos:refresh-since","run":"pmos refresh since","name":"Read now if changed","say":"pmos refresh since <source>"},
122
+ {"cmd":"/pmos:calendar-import","run":"pmos calendar import","name":"Import calendar","say":"pmos calendar import"},
123
+ {"cmd":"/pmos:report-draft","run":"pmos report draft","name":"Draft","say":"pmos report draft <cadence> <slot>"},
124
+ {"cmd":"/pmos:report-check","run":"pmos report check","name":"Check","say":"pmos report check <id>"},
125
+ {"cmd":"/pmos:report-rule","run":"pmos report rule","name":"Add a rule","say":"pmos report rule <id> add voice|wording|off|keep"},
126
+ {"cmd":"/pmos:report-issue","run":"pmos report issue","name":"Send","say":"pmos report issue <cadence> <slot>"},
127
+ {"cmd":"/pmos:schedule-run","run":"pmos schedule run","name":"Run now","say":"pmos schedule run <id>"},
128
+ {"cmd":"/pmos:schedule-disable","run":"pmos schedule disable","name":"Pause / resume","say":"pmos schedule disable <id>"},
129
+ {"cmd":"/pmos:schedule-enable","run":"pmos schedule enable","name":"Pause / resume","say":"pmos schedule enable <id>"},
130
+ {"cmd":"/pmos:schedule-edit","run":"pmos schedule edit","name":"Edit","say":"pmos schedule edit <id>"},
131
+ {"cmd":"/pmos:schedule-rm","run":"pmos schedule rm","name":"Remove","say":"pmos schedule rm <id>"},
132
+ {"cmd":"/pmos:rehearse-end","run":"pmos rehearse end","name":"Move the end","say":"pmos rehearse end <initiative> --to <date>"},
133
+ {"cmd":"/pmos:rehearse-cut","run":"pmos rehearse cut","name":"Cut it","say":"pmos rehearse cut <task|initiative>"},
134
+ {"cmd":"/pmos:press-release","run":"pmos press-release","name":"Draft again","say":"pmos press-release <initiative> --again"},
135
+ {"cmd":"/pmos:skill-copy","run":"pmos skill copy","name":"Copy to edit","say":"pmos skill copy <name>"},
136
+ {"cmd":"/pmos:skill-edit","run":"pmos skill edit","name":"Edit","say":"pmos skill edit <name> --file <f>"},
137
+ {"cmd":"/pmos:build-rollout","run":"pmos build rollout","name":"Roll out","say":"pmos build rollout <item> --to <percent>"},
138
+ {"cmd":"/pmos:build-rollback","run":"pmos build rollback","name":"Roll back","say":"pmos build rollback <item>"},
139
+ {"cmd":"/pmos:build-review","run":"pmos build review","name":"Review","say":"pmos build review <item>"},
140
+ {"cmd":"/pmos:loop-stop","run":"pmos loop stop","name":"Stop","say":"pmos loop stop <id> --note <text>"},
141
+ {"cmd":"/pmos:loop-resume","run":"pmos loop resume","name":"Resume","say":"pmos loop resume <id>"},
142
+ {"cmd":"/pmos:lab-delete","run":"pmos lab delete","name":"Delete version","say":"pmos lab delete <ini> --version <n>"},
143
+ {"cmd":"/pmos:lab-undo","run":"pmos lab undo","name":"Undo","say":"pmos lab undo <batch>"},
144
+ {"cmd":"/pmos:grill-mode","run":"pmos grill mode","name":"Change mode","say":"pmos grill mode full|exits|off"},
145
+ {"cmd":"/pmos:grill-cap","run":"pmos grill cap","name":"Set the cap","say":"pmos grill cap <dollars>"},
146
+ /* card-catalog:end */];
17
147
  const CLAUDE = [
18
148
  ['/compact', 'Compact the conversation', 'Claude Code summarises the conversation so far to free room.'],
19
149
  ['/clear', 'Clear the conversation', 'Claude Code starts again with an empty context in the same session.'],
@@ -80,12 +210,22 @@ function list(deps = {}) {
80
210
  return { status: 200, body: { ok: true, commands: out } };
81
211
  }
82
212
 
213
+ /** A pick from the PMOS group of the / menu: "/pmos:task-set LEN-1 --due 2026-12-01". Claude Code takes no /pmos command, so the
214
+ * chat turns it into words naming the pmos command before it reaches the session; anything else answers null. */
215
+ function pmosAsk(q) {
216
+ const m = /^(\/pmos:[a-z0-9-]+)(?:\s+([\s\S]*))?$/i.exec(String(q == null ? '' : q).trim());
217
+ const e = m && PMOS.find((x) => x.cmd === m[1] && x.run);
218
+ if (!e) return null;
219
+ const run = e.run + (m[2] ? ' ' + m[2].trim() : '');
220
+ return 'The PM picked `' + run + '` from the / menu (its form: `' + e.say + '`). Run it with the ids and values the PM gave; when one is missing, ask for it in one question. Then tell the PM the Undo line it prints.';
221
+ }
222
+
83
223
  // The commands a card's buttons run live beside the chat's commands (star-buttons-act-directly): GET /api/card-catalog
84
224
  // (lib/card-catalog-route.js) and the ✦ drafts' background job, POST/GET /api/star-drafts (lib/star-drafts-route.js). They ride on this
85
225
  // module's entry, so route-modules.js keeps its list.
86
226
  const BESIDE = [require('./card-catalog-route.js'), require('./star-drafts-route.js')];
87
227
 
88
- module.exports = {
228
+ module.exports = { pmosAsk,
89
229
  prefixes: ['/api/slash-commands', '/api/card-catalog', '/api/star-drafts'],
90
230
  list, sayOf, CLAUDE,
91
231
  handle: async (req, res, url, ctx) => {
@@ -28,7 +28,11 @@
28
28
  * GET /api/digest?ws=<id> → { ok, ws, rows, did, lapsed } | { ok, ws, off: true } (quiet-rows slice C: the weekly digest, built on the
29
29
  * page by pm/digest-view.js). rows: the cached line; did: the autonomy ledger's applied changes of the last
30
30
  * 14 days ({ title, ini, at, undone, checked: PASS | FAIL | null, src }); lapsed: the queued or blocked
31
- * drafts waiting to send for this product, older than 7 days (lib/digest-parts.js). With the setting digest.on false it reads nothing. */
31
+ * drafts waiting to send for this product, older than 7 days (lib/digest-parts.js). With the setting digest.on false it reads nothing.
32
+ * GET /api/quiet?ws=<id> → { ok, ws, name, week, total, shown, items: [lib/quiet-sweep.js quietOf item], row } (quiet-work-sweep, bet A503:
33
+ * the initiatives quiet 30 days or more, from the cached line; most quiet first, at most SHOW of them)
34
+ * POST /api/quiet/keep { ws, id, undo? } → { ok, line } still on: one keep (or unkeep) line in quiet-sweep.jsonl, the page's press.
35
+ * Park and close go through POST /api/lifecycle, the PM's press. */
32
36
  const YM = require('./your-move.js');
33
37
 
34
38
  const localDay = (ms = Date.now()) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
@@ -156,12 +160,44 @@ function youOf(ctx, w, today) {
156
160
  return [...out];
157
161
  }
158
162
 
163
+ /** quiet-work-sweep (bet A503): the weekly sweep of quiet work, read from the cached line; Keep is the one write here. */
164
+ async function quietRoute(req, res, url, ctx) {
165
+ const QS = require('./quiet-sweep.js');
166
+ const keepIt = url.pathname === '/api/quiet/keep';
167
+ if (req.method !== (keepIt ? 'POST' : 'GET')) { ctx.json(res, { ok: false, error: keepIt ? 'POST only' : 'GET only' }, 405); return true; }
168
+ let body = {};
169
+ if (keepIt) {
170
+ const got = await ctx.readJson(req);
171
+ if (!got.ok) { ctx.json(res, { ok: false, error: 'invalid JSON body' }, 400); return true; }
172
+ body = got.body || {};
173
+ }
174
+ let w = null;
175
+ try { w = ctx.getWs((keepIt ? body.ws : url.searchParams.get('ws')) || null); } catch { w = null; }
176
+ if (!w || !w.root) { ctx.json(res, { ok: false, error: 'no such workspace' }, 404); return true; }
177
+ if (keepIt) {
178
+ const g = require('./pm-guard.js').requirePagePress(req, body);
179
+ if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
180
+ const r = QS.keep(w.root, { id: String(body.id || ''), undo: body.undo === true }, { by: g.actor && g.actor.by, via: (g.actor && g.actor.via) || 'page' });
181
+ ctx.json(res, r, r.ok ? 200 : 400);
182
+ return true;
183
+ }
184
+ let rows = [];
185
+ // ctx.quietLine: a test's line rows instead of the cached child-process read
186
+ try { rows = await (ctx.quietLine || lineRows)(w); } catch (e) { ctx.json(res, { ok: false, error: 'the line could not be read: ' + (e && e.message) }, 500); return true; }
187
+ const S = QS.quietOf(rows, { kept: QS.keptOf(w.root), stopped: QS.stoppedOf(w.root) });
188
+ const week = QS.weekOf();
189
+ console.info(QS.TAG + ' read ws=' + w.id + ' quiet=' + S.total);
190
+ ctx.json(res, { ok: true, ws: w.id, name: w.name || w.id, week, total: S.total, shown: Math.min(S.total, QS.SHOW), items: S.items.slice(0, QS.SHOW), row: QS.rowOf(S, { week }) });
191
+ return true;
192
+ }
193
+
159
194
  const digestParts = (ctx, w, now) => require('./digest-parts.js').partsOf(ctx, w, lineRows, now); // quiet-rows-digest (reads only)
160
195
 
161
196
  module.exports = {
162
- expire, questions, asksOf, lineRows, digestParts,
163
- prefixes: ['/api/your-move', '/api/line', '/api/digest'],
197
+ expire, questions, asksOf, lineRows, digestParts, quietRoute,
198
+ prefixes: ['/api/your-move', '/api/line', '/api/digest', '/api/quiet'],
164
199
  handle: async (req, res, url, ctx) => {
200
+ if (url.pathname === '/api/quiet' || url.pathname === '/api/quiet/keep') return quietRoute(req, res, url, ctx);
165
201
  if (url.pathname === '/api/digest') {
166
202
  if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
167
203
  let w = null;