create-pmos 0.414.0 → 0.416.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 (86) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/bin/pmos.js +1 -1
  8. package/workspace/briefing-premium-adddoc-test.js +3 -3
  9. package/workspace/briefing-premium-board-test.js +72 -43
  10. package/workspace/briefing-premium-doc-edit-test.js +2 -2
  11. package/workspace/briefing-premium-initiative-test.js +19 -22
  12. package/workspace/briefing-premium-insights-test.js +28 -17
  13. package/workspace/changelog.json +24 -0
  14. package/workspace/core-docs-workflow-test.js +1 -1
  15. package/workspace/guide/workflows.md +6 -2
  16. package/workspace/ini-workflow-test.js +11 -11
  17. package/workspace/lib/board-premium.js +13 -0
  18. package/workspace/lib/board-trail.js +6 -1
  19. package/workspace/lib/engine/boards.js +12 -4
  20. package/workspace/lib/goal-chat.js +46 -15
  21. package/workspace/lib/initiative-chat.js +7 -5
  22. package/workspace/lib/initiative-premium.js +4 -2
  23. package/workspace/lib/insights-premium.js +9 -1
  24. package/workspace/lib/item-cli.js +2 -1
  25. package/workspace/lib/pmos-verbs.js +1 -1
  26. package/workspace/lib/route-modules.js +1 -0
  27. package/workspace/lib/routes-boards.js +149 -18
  28. package/workspace/lib/routes-briefing-premium.js +14 -1
  29. package/workspace/lib/routes-live.js +53 -0
  30. package/workspace/lib/task-cli.js +137 -25
  31. package/workspace/lib/task-items.js +88 -0
  32. package/workspace/lib/workflow-cli.js +1 -1
  33. package/workspace/milestone-suggest-test.js +2 -1
  34. package/workspace/package-lock.json +2 -2
  35. package/workspace/package.json +1 -1
  36. package/workspace/premium-board-actions-test.js +3 -3
  37. package/workspace/premium-chat-report-tab-test.js +13 -5
  38. package/workspace/premium-core-doc-issue-test.js +1 -1
  39. package/workspace/premium-report-read-test.js +66 -51
  40. package/workspace/premium-vw-backlog-test.js +3 -3
  41. package/workspace/premium-vw-doc-test.js +3 -3
  42. package/workspace/premium-vw-item-test.js +4 -4
  43. package/workspace/premium-vw-jira-test.js +14 -13
  44. package/workspace/premium-vw-slides-test.js +7 -5
  45. package/workspace/program-panel-test.js +1 -1
  46. package/workspace/public/pm/bd-ini-panel.js +68 -210
  47. package/workspace/public/pm/cozy-insights.css +15 -0
  48. package/workspace/public/pm/cozy-live-pill.css +48 -0
  49. package/workspace/public/pm/cozy-live-pill.js +141 -0
  50. package/workspace/public/pm/cozy-viewer.js +4 -3
  51. package/workspace/public/pm/cozy-vw-rp.css +48 -0
  52. package/workspace/public/pm/home-app.js +45 -8
  53. package/workspace/public/pm/home-chat.js +5 -2
  54. package/workspace/public/pm/home-ini.js +57 -22
  55. package/workspace/public/pm/home-stage-card.js +3 -2
  56. package/workspace/public/pm/home-task.js +16 -5
  57. package/workspace/public/pm/ini-view-model.js +277 -0
  58. package/workspace/public/pm/ini-view.css +122 -0
  59. package/workspace/public/pm/ini-view.js +180 -0
  60. package/workspace/public/pm/live-model.js +104 -0
  61. package/workspace/public/pm/ov-view.css +44 -0
  62. package/workspace/public/pm/premium-board.js +23 -15
  63. package/workspace/public/pm/premium-initiative-head.js +12 -2
  64. package/workspace/public/pm/premium-insights.js +61 -35
  65. package/workspace/public/pm/premium-report-read.js +74 -50
  66. package/workspace/public/pm/premium-report-tab.js +36 -15
  67. package/workspace/public/pm/premium-shell.js +1 -1
  68. package/workspace/public/pm/premium-vw-item-model.js +6 -3
  69. package/workspace/public/pm/premium-vw-item.js +25 -6
  70. package/workspace/public/pm/premium-vw-jira.js +17 -15
  71. package/workspace/public/pm/rp-parts.js +75 -12
  72. package/workspace/public/pm/task-card.css +24 -49
  73. package/workspace/public/pm/task-card.js +90 -64
  74. package/workspace/public/pm/tk-view.css +21 -0
  75. package/workspace/public/pm/tk-view.js +216 -0
  76. package/workspace/public/pm/wf-page.js +2 -0
  77. package/workspace/server.js +24 -1
  78. package/workspace/stage-card-test.js +49 -41
  79. package/workspace/task-card-test.js +83 -38
  80. package/workspace/test-files.json +3 -1
  81. package/workspace/test-lists/bd-ini-panel.json +3 -3
  82. package/workspace/test-lists/one-task-list.json +5 -0
  83. package/workspace/tk-tasks-test.js +3 -3
  84. package/workspace/public/pm/bd-ini-model.js +0 -81
  85. package/workspace/public/pm/cozy-rec-pill.css +0 -12
  86. package/workspace/public/pm/cozy-rec-pill.js +0 -46
@@ -22,6 +22,16 @@ const F = require('./fixtures/insights-premium-facts.js');
22
22
 
23
23
  const BASE = T.BASE;
24
24
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
25
+ /* SHOTS_1B=<dir>: the Viewer as it is now, light and dark, at 1440 and 390 wide (batch 6 item 1b's screenshots); the page is put back after. */
26
+ const four = async (p, name) => {
27
+ const dir = process.env.SHOTS_1B; if (!dir) return;
28
+ const vp = p.viewportSize();
29
+ for (const [w, h, tag] of [[1440, 900, 'desktop'], [390, 844, 'phone']]) for (const sch of ['light', 'dark']) {
30
+ await p.setViewportSize({ width: w, height: h }); await p.emulateMedia({ colorScheme: sch }); await new Promise((r) => setTimeout(r, 350));
31
+ await p.screenshot({ path: require('path').join(dir, `${name}-${tag}-${sch}.png`) });
32
+ }
33
+ await p.setViewportSize(vp); await p.emulateMedia({ colorScheme: null }); await new Promise((r) => setTimeout(r, 250));
34
+ };
25
35
  const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
26
36
  const results = [];
27
37
  const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
@@ -66,6 +76,7 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
66
76
  };
67
77
  /* the Viewer card (pm/cozy-viewer.js): its title, and the feature its "Waiting for design" card names */
68
78
  const vw = (pg) => pg.evaluate(() => { const v = document.querySelector('#czViewer'); if (!v || v.hidden) return null; const ph = v.querySelector('[data-cz-placeholder]'); return { title: (v.querySelector('.cz-vw-title') || {}).textContent || '', wait: ph ? ph.dataset.czPlaceholder : null, text: v.querySelector('.cz-vw-body').textContent }; });
79
+ const vwMoreItem = async (pg, label) => { await pg.click('#czViewer [data-cz-vw="more"]'); await sleep(80); await pg.click(`.cz-vw-menu [role="menuitem"]:has(> span:first-child:text-is("${label}"))`); await sleep(80); };
69
80
  const vwClose = async (pg) => { await pg.evaluate(() => window.czViewer && window.czViewer.close()); await until(() => pg.evaluate(() => { const v = document.querySelector('#czViewer'); return !v || v.hidden; })); };
70
81
 
71
82
  const A = await open();
@@ -166,33 +177,33 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
166
177
  await q.route('**/api/premium-dashboards/save', (r) => { saved.push(JSON.parse(r.request().postData() || '{}')); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
167
178
  await q.click('#goalTbl [data-goal="krm-act"] .nm');
168
179
  const v = await until(() => vw(q));
169
- /* re-pointed (viewer-shell-a, XvAInsight): the goal is the shell's summary card, the chart, then the folding rows Readings, Moved by and
170
- * On your dashboards; Edit chart is under ⋯; Readings opens on a press */
180
+ /* re-pointed (batch 6 item 1b, canvas OvViewers "Goal"): the summary (on course or not, the source and how fresh, the words), the big
181
+ * number and its target over the chart (the target line, the milestones that move it), Moved by shown open, then the folds Readings and
182
+ * On dashboards. No primary: Add a reading and Edit chart are under ⋯. Readings opens on a press */
171
183
  await q.click('#czViewer [data-czs-fold="read"]'); await sleep(80);
172
- const d = await q.evaluate(() => ({ kind: (document.querySelector('#czViewer .cz-vw-kind') || {}).textContent, tabs: [...document.querySelectorAll('#czViewer .czs-row b')].map((t) => t.textContent).join(), more: !!document.querySelector('#czViewer [data-cz-vw="more"]'), sub: document.querySelector('#czViewer .czs-line').textContent, pri: (document.querySelector('#czViewer .czs-pri') || {}).textContent, tg: (document.querySelector('#czViewer .ins-gch .tgl') || {}).textContent, ship: (document.querySelector('#czViewer .ins-gch .shipl') || {}).textContent, pts: document.querySelectorAll('#czViewer .ins-gch .pt').length, rows: document.querySelectorAll('#czViewer .ins-rd3').length, all: (document.querySelector('#czViewer [data-gx="all"]') || {}).textContent, moved: (document.querySelector('#czViewer [data-czs-fold="moved"] .czs-n') || {}).textContent, sw: [...document.querySelectorAll('#czViewer [data-gx="dash"]')].map((b) => b.getAttribute('aria-label') + ':' + b.getAttribute('aria-checked')).join(), dlg: !!document.querySelector('#dlg') }));
173
- ok('G1 on All goals a goal press opens its detail: the now and target line, Add a reading as the one primary, the rows Readings, Moved by and On your dashboards, and ⋯; no "Waiting for design" (XvAInsight)', v && v.title === 'KR 1.1 · Partner activation' && !v.wait && d.kind === 'Goal' && d.tabs === 'Readings,Moved by,On your dashboards' && d.more && d.sub === '28% now · target 50% by Dec 31' && d.pri === 'Add a reading' && /Down 2% since Oct 1\./.test(v.text) && !d.dlg, JSON.stringify([v, d]));
174
- ok('G1 the chart draws each reading, the target with its value and the ship date of the work that moves it', d.tg === 'Target 50%' && d.ship === 'SSO for partners shipped' && d.pts === 4, JSON.stringify(d));
175
- ok('G1 the newest three readings show with their source, then All 4 readings; Moved by counts the work', d.rows === 3 && d.all === 'All 4 readings' && d.moved === '2', JSON.stringify(d));
184
+ const d = await q.evaluate(() => ({ kind: (document.querySelector('#czViewer .cz-vw-kind') || {}).textContent, tabs: [...document.querySelectorAll('#czViewer .czs-row b')].map((t) => t.textContent).join(), more: !!document.querySelector('#czViewer [data-cz-vw="more"]'), line: (document.querySelector('#czViewer .czs-line > span:not(.czs-dot):not(.czs-r)') || {}).textContent, right: (document.querySelector('#czViewer .czs-line .czs-r') || {}).textContent, sumText: (document.querySelector('#czViewer .czs-p') || {}).textContent, big: (document.querySelector('#czViewer .ins-gnum') || {}).textContent, pri: (document.querySelector('#czViewer .czs-pri') || {}).textContent, tg: (document.querySelector('#czViewer .ins-gch .tgl') || {}).textContent, ship: (document.querySelector('#czViewer .ins-gch .shipl') || {}).textContent, ms: [...document.querySelectorAll('#czViewer .ins-gch .msl')].map((x) => x.textContent).join('|'), now: document.querySelectorAll('#czViewer .ins-gch .pt.now').length, rows: document.querySelectorAll('#czViewer .ins-rd3').length, all: (document.querySelector('#czViewer [data-gx="all"]') || {}).textContent, moved: (document.querySelector('#czViewer .ins-mvh span') || {}).textContent, mv: [...document.querySelectorAll('#czViewer .ins-mvr')].map((a) => a.textContent.replace(/\s+/g, ' ').trim()), sw: [...document.querySelectorAll('#czViewer [data-gx="dash"]')].map((b) => b.getAttribute('aria-label') + ':' + b.getAttribute('aria-checked')).join(), dlg: !!document.querySelector('#dlg') }));
185
+ ok('G1 on All goals a goal press opens its detail: the state line with where the reading comes from and how fresh, the words, the folds Readings and On dashboards, and ⋯; no primary; no "Waiting for design" (OvViewers "Goal")', v && v.title === 'KR 1.1 · Partner activation' && !v.wait && d.kind === 'Goal' && d.tabs === 'Readings,On dashboards' && d.more && d.line === 'Off course' && /^Insights · read /.test(d.right || '') && /^28% now, 50% by Dec 31\. Up 8 points since July\. ≈34% by Dec 31, 16 pts short at this pace\.$/.test(d.sumText || '') && !d.pri && !d.dlg, JSON.stringify([v, d]));
186
+ ok('G1 the big number and its target sit over the chart; the chart draws the target with its value, the ship date of the work that moves it and the latest reading', d.big === '28%target 50% by Dec 31' && d.tg === 'Target 50%' && d.ship === 'SSO for partners shipped' && d.now === 1 && d.ms === 'Evaluate, Oct 23|Deliver, Oct 10', JSON.stringify(d));
187
+ ok('G1 the newest three readings show with their source, then All 4 readings; Moved by is open and counts the work, each with its milestone or stage and plan date', d.rows === 3 && d.all === 'All 4 readings' && d.moved === '2' && d.mv.join('|') === 'SSO for partnersEvaluate, plan Oct 23|Self-serve onboarding v2Deliver, plan Oct 10', JSON.stringify(d));
188
+ await four(q, 'goal');
176
189
  await q.click('#czViewer [data-czs-fold="dash"]'); await sleep(80);
177
190
  const sw = await q.evaluate(() => [...document.querySelectorAll('#czViewer [data-gx="dash"]')].map((b) => b.getAttribute('aria-label') + ':' + b.getAttribute('aria-checked')).join());
178
191
  ok('G1 On your dashboards has a switch for each saved dashboard, on where the goal is', sw === 'On Weekly partner review:true', sw);
179
192
  await q.click('#czViewer [data-cz-vw="more"]'); await sleep(80);
180
193
  const mi = await q.evaluate(() => [...document.querySelectorAll('.cz-vw-menu [role="menuitem"]')].map((b) => b.textContent.trim()).join('|'));
181
- ok('G1 ⋯ holds Edit chart, then Copy link and Copy as text (xvMore order)', /^Edit chart\|Copy link\|Copy as text/.test(mi), mi);
194
+ ok('G1 ⋯ holds Add a reading and Edit chart, then Copy link and Copy as text (xvMore order)', /^Add a reading\|Edit chart\|Copy link\|Copy as text/.test(mi), mi);
182
195
  await q.click('#czViewer .cz-vw-title'); await sleep(80); // a press outside the menu closes it
183
196
  await q.click('#czViewer [data-gx="all"]'); ok('G1 All readings shows every reading', (await q.evaluate(() => document.querySelectorAll('#czViewer .ins-rd3').length)) === 4);
184
- await q.click('#czViewer [data-czs-act="add"]'); await q.fill('#czViewer [data-rdf] [name="v"]', '31'); await q.click('#czViewer [data-rdf] button[type="submit"]'); await until(() => sent.length > 0, 4000);
197
+ await vwMoreItem(q, 'Add a reading'); await q.fill('#czViewer [data-rdf] [name="v"]', '31'); await q.click('#czViewer [data-rdf] button[type="submit"]'); await until(() => sent.length > 0, 4000);
185
198
  ok('G1 Add a reading posts the date and the number to the KR metric reading route', sent.length === 1 && sent[0].rid === 'krm-act' && sent[0].value === 31 && sent[0].at === '2026-10-18' && sent[0].ws === 'w1', JSON.stringify(sent));
186
199
  await until(() => q.evaluate(() => !!document.querySelector('#czViewer [data-gx="dash"]')), 4000);
187
200
  await q.click('#czViewer [data-gx="dash"]'); await until(() => saved.length > 0, 4000);
188
201
  ok('G1 the dashboard switch saves that dashboard without the goal', saved[0] && saved[0].id === 'pd-1' && saved[0].charts.join() === 'krm-ttfc,krm-gone' && saved[0].ws === 'w1', JSON.stringify(saved));
189
- if (!(await q.evaluate(() => { const b = document.querySelector('#czViewer [data-czs-fold="moved"]'); return b && b.getAttribute('aria-expanded') === 'true'; }))) await q.click('#czViewer [data-czs-fold="moved"]');
190
- await sleep(100);
191
- ok('G1 Moved by lists the initiatives on their lifecycle track', (await q.evaluate(() => document.querySelectorAll('#czViewer [data-czs-id="moved"] .ins-ini').length)) === 2);
202
+ ok('G1 Moved by lists the initiatives, each a link to it', (await q.evaluate(() => [...document.querySelectorAll('#czViewer .ins-mvb a.ins-mvr')].filter((a) => /premium-initiative\.html/.test(a.href)).length)) === 2);
192
203
  await vwClose(q);
193
204
  await q.click('#goalTbl [data-goal="krm-nps"] .nm'); await until(() => vw(q));
194
- const e1 = await txt('#czViewer .ins-etr', q), p1 = await txt('#czViewer .czs-pri', q);
195
- /* re-pointed (viewer-shell-a): Add a reading is the summary card's one primary, so the empty trend does not repeat it */
205
+ const e1 = await txt('#czViewer .ins-etr', q), p1 = await txt('#czViewer .ins-etr [data-gx="add"]', q);
206
+ /* re-pointed (batch 6 item 1b): the goal Viewer has no primary, so the empty trend carries Add a reading, its next action */
196
207
  ok('G1 a goal with one reading says a trend needs 2 readings and where the next comes from, with Add a reading (IsMenus)', /A trend needs 2 readings\./.test(e1) && p1 === 'Add a reading', e1 + ' | ' + p1);
197
208
  await R.ctx.close();
198
209
  }
@@ -379,7 +390,7 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
379
390
  ok('L3 a dashboard card opens Goals on that view', (await txt('#viewName', q)) === 'Reliability' && (await q.evaluate(() => document.querySelector('#tabGoals').getAttribute('aria-selected'))) === 'true' && (await q.evaluate(() => [...document.querySelectorAll('#goalTbl [data-goal]')].map((r) => r.dataset.goal).join())) === 'krm-up,krm-churn');
380
391
  await q.click('#tabLibrary'); await q.locator('#listRows [data-rpt]').first().click(); // a report file with no setup opens straight in the reader
381
392
  ok('L4 a report opens in the page\'s reader, not the console (premium-report-read R1; re-pointed by premium-agreed-design: the reader is the report panel in the Viewer card)', await until(() => q.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) .vz-rp0')), 5000) && /premium-insights\.html/.test(q.url()), q.url());
382
- ok('L4 a draft report has Issue in the reader, so nothing sends you to the console to issue it', await until(() => q.evaluate(() => !!document.querySelector('#czViewer .vz-rp0 .czs-sum [data-czs-act="issue"]')), 8000) && await q.evaluate(() => !document.querySelector('#czViewer a[href*="console.html"]')));
393
+ ok('L4 a draft report has Issue it in the reader, so nothing sends you to the console to issue it', await until(() => q.evaluate(() => !!document.querySelector('#czViewer .vz-rp0 .rp-sum [data-r="issue"]')), 8000) && await q.evaluate(() => !document.querySelector('#czViewer a[href*="console.html"]')));
383
394
  await R.ctx.close();
384
395
  const lead = { 'planning/reports/biweekly/2026-10-14.md': 'Activation slipped to 28% this fortnight.' };
385
396
  const R2 = await open({ model: mk({ leads: lead }) });
@@ -537,9 +548,9 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
537
548
  {
538
549
  const R = await open({ w: 390, h: 844 }), q = R.page;
539
550
  await q.click('#goalCards [data-goal="krm-act"]'); await until(() => vw(q));
540
- /* re-pointed (viewer-shell-a, XvAInsight): on a phone it is the same shell, full screen: the summary with Add a reading, the chart, the rows */
541
- const ph = await q.evaluate(() => { const v = document.querySelector('#czViewer').getBoundingClientRect(), b = document.querySelector('#czViewer .cz-vw-body'); return { w: Math.round(v.width), tabs: [...document.querySelectorAll('#czViewer .czs-row b')].map((t) => t.textContent).join(), first: b.firstElementChild.className, add: (document.querySelector('#czViewer .czs-pri') || {}).textContent, over: document.documentElement.scrollWidth > innerWidth }; });
542
- ok('P1 on a phone the goal detail covers the screen: the summary with Add a reading first, then Readings, Moved by and On your dashboards', ph.w === 390 && ph.tabs === 'Readings,Moved by,On your dashboards' && ph.first === 'czs-sum' && ph.add === 'Add a reading' && !ph.over, JSON.stringify(ph));
551
+ /* re-pointed (batch 6 item 1b, OvViewers phone): the same Viewer, full screen: the summary first, the big number and chart, Moved by, the folds */
552
+ const ph = await q.evaluate(() => { const v = document.querySelector('#czViewer').getBoundingClientRect(), b = document.querySelector('#czViewer .cz-vw-body'); return { w: Math.round(v.width), tabs: [...document.querySelectorAll('#czViewer .czs-row b')].map((t) => t.textContent).join(), first: b.firstElementChild.className, order: [...b.children].map((x) => x.className.split(' ')[0]).join(), over: document.documentElement.scrollWidth > innerWidth }; });
553
+ ok('P1 on a phone the goal detail covers the screen: the summary first, the big number and chart, Moved by, then Readings and On dashboards', ph.w === 390 && ph.tabs === 'Readings,On dashboards' && ph.first === 'czs-sum' && /^czs-sum,ins-gbig,ins-mvb,czs-secs/.test(ph.order) && !ph.over, JSON.stringify(ph));
543
554
  await q.click('#czViewer [data-czs-fold="dash"]'); await sleep(80);
544
555
  ok('P1 the On your dashboards row holds the switches', (await q.evaluate(() => document.querySelectorAll('#czViewer [data-czs-id="dash"] [data-gx="dash"]').length)) === 1);
545
556
  await vwClose(q);
@@ -1,4 +1,28 @@
1
1
  [
2
+ {
3
+ "v": "0.416.0",
4
+ "at": "2026-10-26T00:23:58.708Z",
5
+ "f": 2,
6
+ "prs": [
7
+ {
8
+ "n": 1050,
9
+ "t": "Sixth testing feedback batch (items 1–5)",
10
+ "s": "Sixth testing feedback batch (items 1–5)"
11
+ }
12
+ ]
13
+ },
14
+ {
15
+ "v": "0.415.0",
16
+ "at": "2026-10-25T15:54:44.873Z",
17
+ "f": 2,
18
+ "prs": [
19
+ {
20
+ "n": 1048,
21
+ "t": "Fifth testing feedback batch",
22
+ "s": "Fifth testing feedback batch"
23
+ }
24
+ ]
25
+ },
2
26
  {
3
27
  "v": "0.414.0",
4
28
  "at": "2026-10-25T12:55:58.684Z",
@@ -102,7 +102,7 @@ const OLD = new Map([['initiative:' + ID + '|risks', { drafts: [], issued: { at:
102
102
  await page.goto(BASE + '/premium.html?ini=' + ID + '&ws=w1&board=w1&theme=' + theme);
103
103
  let up = await until(() => page.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) [data-hi-v]')), 30000);
104
104
  if (up) {
105
- if (await page.$('#czViewer [data-hi-v="page"] [data-hi-open="docs"]')) await page.click('#czViewer [data-hi-open="docs"]');
105
+ if (await page.$('#czViewer [data-hi-v="page"] [data-iv-docs]')) await page.click('#czViewer [data-iv-docs]');
106
106
  else { await page.click('#czViewer [data-cz-vw="more"]'); await until(() => page.evaluate(() => !!document.querySelector('#czViewer .cz-vw-menu'))); await page.click('#czViewer .cz-vw-menu [role="menuitem"]:has(> span:first-child:text-is("Documents"))'); }
107
107
  up = await until(() => page.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) [data-hi-v="docs"] .czs-secs')), 15000);
108
108
  }
@@ -66,7 +66,11 @@ An initiative's **workflow stage** is the stage on its stage card and on the Boa
66
66
 
67
67
  ### The pmos task commands
68
68
 
69
- An agent changes a Board task's state when you ask, so you do not have to find the task on the Board yourself.
69
+ An agent adds and closes tasks when you ask, so you do not have to find the task on the Board yourself. There is one kind of task: the tasks in the initiative's Tasks section. The older breakdown items (`pmos item`) and the To finish entries of the current stage are tasks too, and these commands list and close them.
70
70
 
71
+ - `pmos task add <initiative> "<title>"` adds a task. `--stage` puts it under a stage, `--due` and `--start` set its days, `--owner` its owner and `--notes` its notes. The task is the same as one added with Add a task on the page, under the agent's name.
71
72
  - `pmos task list <initiative>` lists the initiative's open tasks (To do and In progress) with their ids. `--all` adds the Done, Won't do and Archived tasks.
72
- - `pmos task state <task> [<task> …] --to <state>` sets the state of one or more tasks: To do, In progress, Done, Won't do or Archived. `--why` adds the reason. Each change writes the same line as the Board's press, under the agent's name.
73
+ - `pmos task state <task> [<task> …] --to <state>` sets the state of one or more tasks: To do, In progress, Done, Won't do or Archived. `--why` adds the reason, and for Done it is the evidence you read. Each change writes the same line as the page's press, under the agent's name. Won't do on a breakdown item withdraws it, and it cannot come back.
74
+ - `pmos task set <task> [<task> …] --stage <stage>` puts one or more tasks under a stage of the initiative's workflow, by the stage's key or name. `--stage none` takes them out of every stage. The Tasks section groups the tasks by these stages. A task's stage is its place in the plan: it does not change the task's state, and it does not move the initiative. `set` also takes `--due`, `--start`, `--owner` and `--notes`; `--due none` and `--start none` clear a day.
75
+
76
+ When an initiative reaches a stage, each entry of that stage's To finish list becomes one task, once. Closing that task, on the stage card, in the Tasks section or with `pmos task state`, marks the entry done on the stage card.
@@ -86,7 +86,7 @@ const BRIEF = BRP.build(BRF.facts());
86
86
  for (const p of ['ini-wf', 'wontdo', 'archive', 'ini-auto', 'move']) await page.route('**/api/boards/' + p, (r) => json(r, { ok: true, row: {} }));
87
87
  if (!fresh) await page.addInitScript(() => { try { localStorage.setItem('pmos.wf.seen', JSON.stringify({ 'self-serve-v2|tender': 1 })); } catch { /* none */ } });
88
88
  await page.goto(BASE + '/premium.html?ini=' + ID + '&ws=w1&board=w1&theme=' + theme);
89
- const up = await until(() => page.evaluate(() => /Tender/.test((document.querySelector('#czViewer:not([hidden]) .cz-vw-kind') || {}).textContent || '') && !!document.querySelector('#czViewer [data-hi-v="page"] .hm-card [data-hm-wf]')), 30000);
89
+ const up = await until(() => page.evaluate(() => /Tender/.test((document.querySelector('#czViewer:not([hidden]) .cz-vw-kind') || {}).textContent || '') && !!document.querySelector('#czViewer [data-hi-v="page"] .iv-meta [data-iv-wf]')), 30000);
90
90
  return { ctx, page, errors, posts, up, S };
91
91
  };
92
92
  const V = '#czViewer:not([hidden])';
@@ -95,19 +95,19 @@ const BRIEF = BRP.build(BRF.facts());
95
95
  const pickMore = async (p, label) => { await p.click('#czViewer [data-cz-vw="more"]'); await until(() => p.evaluate(() => !!document.querySelector('#czViewer .cz-vw-menu'))); await p.click(`#czViewer .cz-vw-menu [role="menuitem"]:has(> span:first-child:text-is("${label}"))`); };
96
96
 
97
97
  const A = await open(), p = A.page;
98
- ok('W1 the page opens on the initiative with the workflow\'s icon on its card', A.up, await txt(p, V + ' .cz-vw-kind'));
98
+ ok('W1 the page opens on the initiative with the workflow on its meta line', A.up, await txt(p, V + ' .cz-vw-kind'));
99
99
  ok('W1 the kind line names the workflow and the anchor: "Tender · KR 1.1" (Kind becomes Workflow)', /^Tender · KR 1\.1$/.test(await txt(p, V + ' .cz-vw-kind')), await txt(p, V + ' .cz-vw-kind'));
100
- ok('W1 the card names the stage of that workflow: Triage', (await txt(p, V + ' .hm-card .hm-sch > b')) === 'Triage', await txt(p, V + ' .hm-card .hm-sch'));
101
- ok('W1 the ladder draws the ten stages of Tender, three of them milestones', await p.evaluate((v) => document.querySelectorAll(v + ' .hm-card .hm-bars i').length === 10, V));
102
- ok('W1 the next stage is Tender\'s own: the card\'s last node is Requirements', /^Requirements/.test(await txt(p, V + ' .hm-card .cz-sli.tail')), await txt(p, V + ' .hm-card .cz-sli.tail'));
103
- ok('W1 the icon names the workflow for a screen reader', await p.evaluate((v) => /Workflow: Tender/.test(document.querySelector(v + ' [data-hm-wf]').getAttribute('aria-label')), V));
100
+ ok('W1 the card names the stage of that workflow: Triage', (await txt(p, V + ' .iv-sch > b')) === 'Triage', await txt(p, V + ' .iv-sch'));
101
+ ok('W1 the ladder draws the ten stages of Tender, three of them milestones', await p.evaluate((v) => document.querySelectorAll(v + ' .iv-lad i').length === 10 && document.querySelectorAll(v + ' .iv-lad i.ms').length === 3, V));
102
+ ok('W1 the next stage is Tender\'s own: the card\'s last line is Requirements', /^Requirements/.test(await txt(p, V + ' .iv-nx')), await txt(p, V + ' .iv-nx'));
103
+ ok('W1 the icon names the workflow for a screen reader', await p.evaluate((v) => /Workflow: Tender/.test(document.querySelector(v + ' [data-iv-wf]').getAttribute('aria-label')), V));
104
104
  ok('W2 PMOS set it from the BRD: the toast says so, with Undo (WfTriage)', await until(() => p.evaluate(() => { const t = document.getElementById('hiToast'); return !!t && !t.hidden && /Set to Tender from the BRD/.test(t.textContent) && !!t.querySelector('[data-hi-undo]'); })));
105
105
  await shot(p, 'triage-1440');
106
106
  await p.click('#hiToast [data-hi-undo]');
107
107
  ok('W2 Undo puts it back on the workflow it ran before', await until(() => A.posts.some((x) => x.path === '/api/boards/ini-wf' && x.body.wf === 'product-feature' && x.body.id === ID)), JSON.stringify(A.posts));
108
108
 
109
109
  // W3 the Change picker
110
- await p.click(V + ' [data-hm-wf]');
110
+ await p.click(V + ' [data-iv-wf]');
111
111
  const pick = await until(() => p.evaluate(() => { const el = document.querySelector('.hi-pop[role="listbox"]'); if (!el) return null; return { opts: [...el.querySelectorAll('[role="option"]')].map((o) => o.textContent.replace(/\s+/g, ' ').trim() + (o.getAttribute('aria-selected') === 'true' ? '*' : '')), text: el.textContent }; }));
112
112
  ok('W3 the picker lists every workflow with its stage count, Tender picked', pick && JSON.stringify(pick.opts) === JSON.stringify(['Product feature8', 'Tender10*']), JSON.stringify(pick));
113
113
  ok('W3 it offers New workflow…, shows Tender\'s stage chain and why PMOS picked it', pick && /New workflow…/.test(pick.text) && /Triage → Requirements → ◆\sRFP out/.test(pick.text) && /Why: “choose a vendor/.test(pick.text), pick && pick.text);
@@ -139,7 +139,7 @@ const BRIEF = BRP.build(BRF.facts());
139
139
  await p.reload();
140
140
  await until(() => p.evaluate((v) => !!document.querySelector(v + ' .hi-end'), V), 30000);
141
141
  ok('W7 the page of a Won’t do says why, and offers Back to Triage', /Won't do · No budget: Moved to next year’s budget\./.test(await txt(p, V + ' .hi-end')), await txt(p, V + ' .hi-end'));
142
- ok('W7 its stage does not move: the card says how to bring it back', /bring it back to Triage/.test(await txt(p, V + ' .hm-card .cz-sli.tail')) && !(await p.evaluate((v) => !!document.querySelector(v + ' .hm-card [data-hi-next], ' + v + ' .hm-card [data-hi-move]'), V)), await txt(p, V + ' .hm-card .cz-sli.tail'));
142
+ ok('W7 its stage does not move: the card has no next stage to move to', !(await p.evaluate((v) => !!document.querySelector(v + ' .iv-sc .iv-nx, ' + v + ' [data-iv-next]'), V)), await txt(p, V + ' .iv-sc'));
143
143
  ok('W7 ⋯ has Back to Triage in place of Won’t do', await moreLabels(p).then((l) => l.includes('Back to Triage') && !l.includes('Won’t do')));
144
144
  await shot(p, 'wontdo-page-1440');
145
145
  await p.click(V + ' .hi-end [data-wf-back]');
@@ -149,10 +149,10 @@ const BRIEF = BRP.build(BRF.facts());
149
149
 
150
150
  // W8 the phone, and dark
151
151
  const P = await open({ w: 390, h: 844, fresh: false, B: board('requirements') });
152
- ok('W8 the phone opens the page with the workflow at Requirements, the second of its ten bars', P.up && (await txt(P.page, V + ' .hm-card .hm-sch > b')) === 'Requirements' && await P.page.evaluate((v) => { const b = [...document.querySelectorAll(v + ' .hm-card .hm-bars i')]; return b.length === 10 && b[1].classList.contains('now'); }, V));
152
+ ok('W8 the phone opens the page with the workflow at Requirements, the second of its ten bars', P.up && (await txt(P.page, V + ' .iv-sch > b')) === 'Requirements' && await P.page.evaluate((v) => { const b = [...document.querySelectorAll(v + ' .iv-lad i')]; return b.length === 10 && b[1].classList.contains('now'); }, V));
153
153
  ok('W8 the toast shows once only: seen before, not again', !(await P.page.evaluate(() => { const t = document.getElementById('hiToast'); return !!t && !t.hidden; })));
154
154
  await shot(P.page, 'page-390');
155
- await P.page.click(V + ' [data-hm-wf]');
155
+ await P.page.click(V + ' [data-iv-wf]');
156
156
  await until(() => P.page.evaluate(() => !!document.querySelector('.hi-pop[role="listbox"]')));
157
157
  await shot(P.page, 'picker-390');
158
158
  await P.page.click('.hi-pop [data-wf-pick="product-feature"]');
@@ -166,7 +166,7 @@ const BRIEF = BRP.build(BRF.facts());
166
166
  ok('W8 no page error on the phone', !P.errors.length, P.errors.join(' | '));
167
167
  await P.ctx.close();
168
168
  const D = await open({ theme: 'dark', fresh: false });
169
- await D.page.click(V + ' [data-hm-wf]');
169
+ await D.page.click(V + ' [data-iv-wf]');
170
170
  await until(() => D.page.evaluate(() => !!document.querySelector('.hi-pop[role="listbox"]')));
171
171
  await shot(D.page, 'picker-1440-dark');
172
172
  ok('W8 dark: the picker draws, no page error', D.up && !D.errors.length, D.errors.join(' | '));
@@ -270,6 +270,8 @@ function rowOf(r, wf, today) {
270
270
  };
271
271
  }
272
272
 
273
+ const TASK_MAX = 400; // the tasks one initiative's view reads (a WBS of a few hundred lines)
274
+
273
275
  function build(f) {
274
276
  const now = f.now || Date.now();
275
277
  const today = new Date(now); const todayIso = today.getFullYear() + '-' + pad(today.getMonth() + 1) + '-' + pad(today.getDate());
@@ -291,6 +293,17 @@ function build(f) {
291
293
  const relAt = f.nextRelease && f.nextRelease.at ? String(f.nextRelease.at).slice(0, 10) : null;
292
294
  // the Jira epic of each initiative, from the board's work items (Linked: Epic <key>)
293
295
  const epicBy = new Map(); for (const w of f.items || []) if (w && w.kind === 'Epic' && w.key && w.ini && !epicBy.has(w.ini)) epicBy.set(w.ini, w.key);
296
+ // each initiative's PMOS tasks (feedback batch 5, one list): its Board tasks, its breakdown items and its stage's To finish tasks, for the panel
297
+ const taskBy = new Map();
298
+ for (const w of f.items || []) {
299
+ if (!w || w.src !== 'pmos' || w.kind === 'Epic' || !w.ini || !w.uid || w.status === 'Archived') continue;
300
+ if (!taskBy.has(w.ini)) taskBy.set(w.ini, []);
301
+ taskBy.get(w.ini).push({ uid: w.uid, title: clip(w.title || '', 160), status: w.status || 'To do', owner: w.owner || '', end: w.end || '', ...(w.from ? { from: { stage: w.from.stage, finish: w.from.finish } } : {}),
302
+ // one view (feedback batch 6 item 1): its place in the breakdown, and a breakdown item's own stage and order
303
+ ...(typeof w.section === 'string' ? { section: w.section } : {}), ...(w.itemStage ? { itemStage: w.itemStage } : {}), ...(Number.isFinite(w.order) ? { order: w.order } : {}), ...(w.store === 'item' ? { item: true } : {}) });
304
+ }
305
+ // every task, not the first 60: the Board's panel and Home count the same tasks (feedback batch 6 item 1: Board said 56 done, Home 61)
306
+ for (const r of rows.concat(stageRows, gone.cancelled, gone.archived)) if (!r.tasks) r.tasks = (taskBy.get(r.id) || []).slice(0, TASK_MAX);
294
307
  for (const r of rows.concat(stageRows, gone.cancelled, gone.archived)) if (!r.track) {
295
308
  r.track = trackOf(r, tkBy.get(r.id), todayIso, relOfIni.get(r.id)); r.theme = themeOf(r.anchor);
296
309
  if (epicBy.has(r.id) && !r.epics.includes(epicBy.get(r.id))) r.epics.unshift(epicBy.get(r.id));
@@ -5,6 +5,7 @@
5
5
  * trail({ root, ids, rows, moves, now, io }) → { ok, at, usual, themes, items: { [id]: item } }
6
6
  *
7
7
  * Everything is DERIVED from what the repository already holds. Nothing here writes:
8
+ * · the stages it ran its board moves of the current workflow, oldest first ({ to, at }), for the one view's stage dates
8
9
  * · days in the current stage the last board move into the stage (the board ledger), else the first appearance in git of
9
10
  * the newest artifact on the initiative's ladder (record, PRD, rubric, evaluation)
10
11
  * · "usually N days" per stage the median days past initiatives spent in that stage, from the same dates (record → PRD is
@@ -223,8 +224,12 @@ function trail({ root, ids, rows = [], moves = [], now = Date.now(), io } = {})
223
224
  const tickets = {};
224
225
  for (const t of tks) if (t.key && t.jira) tickets[t.key] = { subtasks: t.jira.subtasks || null, reason: t.jira.reason || null, flagged: !!t.jira.flagged };
225
226
 
227
+ // the moves of its current workflow, oldest first: the one view dates each stage it ran (feedback batch 6 item 1)
228
+ const mvAll = (byIni.get(id) || []).slice().sort((a, b) => String(a.at).localeCompare(String(b.at)));
229
+ let mvFrom = 0; if (wk) for (let i = 0; i < mvAll.length; i++) if (mvAll[i].via === 'ini-wf') mvFrom = i;
230
+ const ran = mvAll.slice(mvFrom).filter((m) => m.to && m.at).slice(-40).map((m) => ({ to: String(m.to), at: dayIso(Date.parse(m.at)) }));
226
231
  items[id] = {
227
- since: since ? dayIso(since) : null, sinceFrom, days: since ? Math.max(0, Math.floor((now - since) / DAY)) : null,
232
+ since: since ? dayIso(since) : null, sinceFrom, days: since ? Math.max(0, Math.floor((now - since) / DAY)) : null, moves: ran,
228
233
  skipped, parts, next: parts ? (parts.find((p) => !p.done) || {}).name || null : null, you,
229
234
  links: { prd: prdRel, prdVersion: prdRel && (typeof prdFm.version === 'string' || typeof prdFm.version === 'number') && String(prdFm.version).trim() ? String(prdFm.version).trim().slice(0, 12) : null,
230
235
  rubric: rubRel, evaluation: evals[0] || null, epic: jv && jv.ok && jv.epic && jv.epic.key ? jv.epic.key : null },
@@ -38,6 +38,9 @@
38
38
  * task { task, type: Task|Epic, initiative, title, epic, owner, state, start, due } a PMOS task (or PMOS epic) on the board
39
39
  * task-update { task, state?, start?, due?, title?, owner?, notes?, initiative?, why } a status move, a reschedule, a rename or an edit in the Viewer
40
40
  * ticket-note { ref, notes } the PM's own notes on a Jira ticket (Jira keeps its fields)
41
+ * task-section { task, section } a task's place in the breakdown (one view, feedback batch 6 item 1): the key
42
+ * of a stage of its initiative's workflow, '' for "Not in a stage". It is the task's place, never its state, and moving a task
43
+ * never moves the initiative. `task` is a Board task or a breakdown item; the last line wins.
41
44
  * Nothing is deleted. A line that is not an object with a known kind is skipped.
42
45
  *
43
46
  * STAGE OF AN INITIATIVE on a team board: the last move recorded for it on that board (a workflow edit's `moved` and an
@@ -158,7 +161,7 @@ function foundOf(f) {
158
161
  const sources = Array.isArray(f.sources) ? f.sources.filter((x) => x && typeof x.ref === 'string').slice(0, 8).map((x) => ({ label: String(x.label || ''), ref: x.ref })) : [];
159
162
  return { why: typeof f.why === 'string' ? f.why : '', sources, match: typeof f.match === 'string' && f.match ? f.match : null, scan: typeof f.scan === 'string' ? f.scan : null, run: typeof f.run === 'string' ? f.run : null };
160
163
  }
161
- const KINDS = new Set(['board', 'workflow', 'move', 'assign', 'ask', 'ask-accept', 'ask-decline', 'ask-more', 'ini-workflow', 'task', 'task-update', 'task-remove', 'ticket-note', 'ini-epics', 'ini-archive', 'ini-notdup', 'ini-wf', 'ini-end', 'stage-judge', 'ini-auto']);
164
+ const KINDS = new Set(['board', 'workflow', 'move', 'assign', 'ask', 'ask-accept', 'ask-decline', 'ask-more', 'ini-workflow', 'task', 'task-update', 'task-remove', 'ticket-note', 'ini-epics', 'ini-archive', 'ini-notdup', 'ini-wf', 'ini-end', 'stage-judge', 'ini-auto', 'task-section']);
162
165
  // A task's state is its only stage (Wawan, 2026-10-25): the same five every workflow ends in. An old 'In review' reads as In progress (taskState).
163
166
  const TASK_STATES = Object.freeze(['To do', 'In progress', 'Done', "Won't do", 'Archived']);
164
167
  const taskState = (s) => (s === 'In review' ? 'In progress' : TASK_STATES.includes(s) ? s : null);
@@ -187,6 +190,7 @@ function fold(events) {
187
190
  const stages = new Map(); // key(board, id) → stage name (the last move)
188
191
  const iniWorkflows = new Map(); // key(board, id) → { template, stages } (the initiative's own workflow)
189
192
  const tasks = new Map(); // task id → { id, board, initiative, title, epic, owner, state, start, due, at, by, history }
193
+ const sections = new Map(); // task id → the stage key its breakdown section is ('' = Not in a stage); the last task-section line wins
190
194
  const ticketNotes = new Map(); // key(board, Jira key) → the PM's notes on that ticket (the last ticket-note line wins)
191
195
  const epics = new Map(); // initiative id → the Jira epic keys the PM linked to it (the last ini-epics line wins)
192
196
  const archives = new Map(); // initiative id → { at, by, reason, into, moved } while archived (an `archived: false` line restores it)
@@ -255,7 +259,9 @@ function fold(events) {
255
259
  } else if (e.kind === 'task' && b && typeof e.task === 'string' && typeof e.initiative === 'string' && !tasks.has(e.task)) {
256
260
  tasks.set(e.task, { id: e.task, board: b, initiative: e.initiative, kind: e.type === 'Epic' ? 'Epic' : 'Task', title: String(e.title || ''), epic: typeof e.epic === 'string' && e.epic ? e.epic : null,
257
261
  owner: typeof e.owner === 'string' && e.owner ? e.owner : null, notes: typeof e.notes === 'string' ? e.notes : '', state: taskState(e.state) || 'To do',
258
- start: typeof e.start === 'string' ? e.start : null, due: typeof e.due === 'string' ? e.due : null, at: e.at || null, by: e.by || null, history: [] });
262
+ start: typeof e.start === 'string' ? e.start : null, due: typeof e.due === 'string' ? e.due : null, at: e.at || null, by: e.by || null, history: [],
263
+ // a stage's To finish entry made a task (routes-boards stageTasks): the stage card counts it, and it is made once
264
+ from: isObj(e.from) && typeof e.from.stage === 'string' && typeof e.from.finish === 'string' ? { stage: e.from.stage, finish: e.from.finish } : null });
259
265
  } else if (e.kind === 'task-update' && typeof e.task === 'string' && tasks.has(e.task)) {
260
266
  const t = tasks.get(e.task);
261
267
  if (taskState(e.state)) t.state = taskState(e.state);
@@ -266,6 +272,8 @@ function fold(events) {
266
272
  if (typeof e.owner === 'string') t.owner = e.owner.trim() || null; // the Viewer's edits (canvas XetX1Rest); '' clears
267
273
  if (typeof e.notes === 'string') t.notes = e.notes;
268
274
  t.history.push({ at: e.at || null, by: e.by || null, state: e.state || null, start: e.start || null, due: e.due || null, why: e.why || '' });
275
+ } else if (e.kind === 'task-section' && typeof e.task === 'string' && e.task && typeof e.section === 'string') {
276
+ sections.set(e.task, e.section);
269
277
  } else if (e.kind === 'ticket-note' && b && typeof e.ref === 'string' && typeof e.notes === 'string') {
270
278
  if (e.notes) ticketNotes.set(key(b, e.ref), e.notes); else ticketNotes.delete(key(b, e.ref));
271
279
  } else if (e.kind === 'task-remove' && typeof e.task === 'string' && tasks.has(e.task)) {
@@ -308,7 +316,7 @@ function fold(events) {
308
316
  Object.assign(a, { state: 'declined', why: e.why || '', closedAt: e.at || null });
309
317
  }
310
318
  }
311
- return { boards, moves, assigns, asks, stages, iniWorkflows, tasks, ticketNotes, epics, archives, notDup, iniWf, ends, judged, autoOver, events: list };
319
+ return { boards, moves, assigns, asks, stages, iniWorkflows, tasks, sections, ticketNotes, epics, archives, notDup, iniWf, ends, judged, autoOver, events: list };
312
320
  }
313
321
 
314
322
  /** The stages an initiative runs on a board: its own workflow when one is recorded, else the board's. */
@@ -336,7 +344,7 @@ function itemStatus(status, category) {
336
344
  /** A PMOS task as a work item. */
337
345
  function taskItem(t) {
338
346
  return { uid: t.id, key: '', kind: t.kind === 'Epic' ? 'Epic' : 'Task', src: 'pmos', title: t.title, status: t.state, blocked: false, owner: t.owner || null, notes: t.notes || '',
339
- ini: t.initiative, epic: t.epic || null, start: t.start || null, end: t.due || null, ref: t.id, board: t.board };
347
+ ini: t.initiative, epic: t.epic || null, start: t.start || null, end: t.due || null, ref: t.id, board: t.board, ...(t.from ? { from: { ...t.from } } : {}) };
340
348
  }
341
349
  /** Progress per item, and an epic's status, progress, blocked flag and dates rolled up from its items. Mutates and returns items. */
342
350
  function rollupItems(items) {
@@ -68,10 +68,11 @@ const unskipMessage = (point) => MARK.unskip + ' The PM took the skip back: the
68
68
 
69
69
  function startMessage(draft) {
70
70
  return [
71
- MARK.start + ' The PM pressed Start. Work on this goal now, as you would in a terminal under the PM\'s Claude Code settings, until every done point is met:',
71
+ MARK.start + ' The PM pressed Start. Work on this goal now, on your own, until every done point is met:',
72
72
  JSON.stringify(draft),
73
- 'Merging follows the PM\'s standing rule (merge once required CI is green). Ask before anything that is sent to other people. Stop and ask when you need the PM.',
74
- 'At the end of each message about this goal, add a fenced pmos-goal block: {"step":"progress","state":"working|done|needs-you","met":["done points met"],"open":["done points still open"]}.',
73
+ 'Do whatever the goal needs, as the PM would. Do not stop to ask for approval, feedback or a choice: pick the sensible option yourself, say in one line what you chose, and go on. Merging follows the PM\'s standing rule (merge once required CI is green).',
74
+ 'Stop for the PM only when the work cannot go on without them: a sign-in or secret only they have, or a message that goes to other people. Then do every other open point first, and end with needs-you and exactly what you need.',
75
+ 'At the end of each message about this goal, add a fenced pmos-goal block: {"step":"progress","state":"working|done|needs-you","met":["done points met"],"open":["done points still open"]}. Copy each done point word for word. Report done only after you checked every point.',
75
76
  ].join('\n');
76
77
  }
77
78
  const cancelMessage = () => MARK.cancel + ' The PM cancelled this goal. Do no more work for it and say in one line what you stopped.';
@@ -141,6 +142,13 @@ function blockOf(text) {
141
142
  try { const b = JSON.parse(last[1]); return b && typeof b === 'object' ? b : null; } catch { return null; }
142
143
  }
143
144
  const strs = (a) => (Array.isArray(a) ? a.map((x) => clip(x, 200)).filter(Boolean).slice(0, 8) : null);
145
+ const norm = (x) => String(x == null ? '' : x).toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
146
+ /** The plan points Claude reports met. Claude rewords them (bug 2026-10-25: "Goal done" with 0 of 4 met), so a point counts when a
147
+ * reported string is the same after norm, or, both 12 characters or more, one holds the other. */
148
+ function matchPoints(reported, all) {
149
+ const got = (Array.isArray(reported) ? reported : []).map(norm).filter(Boolean);
150
+ return (all || []).filter((p) => { const n = norm(p); return n && got.some((r) => r === n || (r.length >= 12 && n.length >= 12 && (r.includes(n) || n.includes(r)))); });
151
+ }
144
152
  /** The chat key a session belongs to (premium-chat-sessions.jsonl, the last line that names it), or null. */
145
153
  function keyOfSession(runtimeDir, session, chatsFile) {
146
154
  let t; try { t = fs.readFileSync(path.join(runtimeDir, chatsFile), 'utf8'); } catch { return null; }
@@ -156,21 +164,33 @@ const roundsOf = (runtimeDir, id) => {
156
164
  function onStop({ runtimeDir, key, message, now = new Date() }) {
157
165
  const g = key && goalOf(runtimeDir, key);
158
166
  if (!g || g.state !== 'started' || !g.draft) return {};
159
- const d = g.draft, b = blockOf(message), all = requiredOf(g), skipped = g.skipped || [];
160
- const met = ((b && b.step === 'progress' && strs(b.met)) || g.met || []).filter((x) => !skipped.includes(x));
161
- const open = ((b && b.step === 'progress' && strs(b.open)) || all.filter((x) => !met.includes(x))).filter((x) => !skipped.includes(x));
167
+ const d = g.draft, b = blockOf(message), all = requiredOf(g);
168
+ const p = b && b.step === 'progress' ? b : null;
169
+ // the plan decides what is met and open: Claude's own open list and its "done" alone do not count
170
+ const met = p && Array.isArray(p.met) ? matchPoints(strs(p.met), all) : (g.met || []).filter((x) => all.includes(x));
171
+ const open = all.filter((x) => !met.includes(x));
162
172
  const base = { id: g.id, key, met, open, at: now.toISOString() };
163
- if (b && b.step === 'progress' && (b.state === 'done' || (open.length === 0 && met.length > 0))) { append(runtimeDir, { event: 'done', ...base }); return {}; }
164
- if (b && b.step === 'progress' && b.state === 'needs-you') { append(runtimeDir, { event: 'waiting', ...base }); return {}; }
173
+ if (all.length && !open.length) { append(runtimeDir, { event: 'done', ...base }); return {}; }
174
+ const prev = roundsOf(runtimeDir, g.id), last = prev[prev.length - 1];
175
+ const needs = !!(p && p.state === 'needs-you');
176
+ // the goal works on its own (feedback 2026-10-25): the first needs-you is sent back; a second one in a row waits on the PM
177
+ if (needs && last && last.asked && Date.parse(last.at) >= Date.parse(g.at || '')) { append(runtimeDir, { event: 'waiting', ...base }); return {}; }
165
178
  const due = Date.parse(d.by || '');
166
179
  const stop = (reason) => { append(runtimeDir, { event: 'stopped', reason, ...base }); return {}; };
167
180
  if (Number.isFinite(due) && now.getTime() > due) return stop('deadline');
168
181
  const n = (g.rounds || 0) + 1;
169
182
  if (n > (d.limit || LIMIT)) return stop('limit');
170
- const prev = roundsOf(runtimeDir, g.id);
183
+ const head = '[PMOS /goal round ' + n + '] ';
184
+ if (needs) {
185
+ append(runtimeDir, { event: 'round', n, asked: true, ...base });
186
+ return { decision: 'block', reason: head + 'Do not wait for the PM. Pick the sensible option yourself, say in one line what you chose, and go on. Only if the work truly cannot go on without the PM (a sign-in or secret only they have, or a message to other people), end again with needs-you and exactly what you need.' };
187
+ }
171
188
  if (prev.length >= NO_PROGRESS && prev.slice(-NO_PROGRESS).every((r) => (r.met || []).length >= met.length)) return stop('no-progress');
172
189
  append(runtimeDir, { event: 'round', n, ...base });
173
- return { decision: 'block', reason: '[PMOS /goal round ' + n + '] The goal is not done yet: ' + met.length + ' of ' + all.length + ' done points met. Keep working on: ' + (open.length ? open.join('; ') : 'the open points') + '. This is round ' + n + ' of ' + (d.limit || LIMIT) + '. If you need the PM, ask and end with a pmos-goal progress block whose state is needs-you. End each message with the progress block.' };
190
+ const said = p && p.state === 'done'
191
+ ? 'You reported done, but these points are not met yet: ' + open.join('; ') + '. Check each one, and work on the ones that are not true yet. Copy each point word for word in met.'
192
+ : 'The goal is not done yet: ' + met.length + ' of ' + all.length + ' done points met. Keep working on: ' + (open.length ? open.join('; ') : 'the open points') + '.';
193
+ return { decision: 'block', reason: head + said + ' This is round ' + n + ' of ' + (d.limit || LIMIT) + '. End each message with the progress block. Do not stop to ask for approval. Decide yourself and go on.' };
174
194
  }
175
195
  /** The PM wrote in the goal's conversation. A goal that waits on them is working again (U3); a finished or stopped goal is seen,
176
196
  * so its Briefing row goes (U7). A goal in any other state is left as it is. */
@@ -228,10 +248,10 @@ function withGoalRows(model, rows) {
228
248
  const count = (model.list.count || 0) + add.length;
229
249
  return { ...model, list: { ...model.list, rows: list, count }, dock: model.dock && model.dock.needs != null ? { ...model.dock, needs: count, label: count === 1 ? 'needs you' : 'need you', next: list[0].title } : model.dock };
230
250
  }
231
- /** The Claude Code --settings for a chat session: a Stop hook and an AskUserQuestion hook, each posting to this workspace with the session's token. */
251
+ /** The Claude Code --settings for a chat session: a Stop hook, an AskUserQuestion hook and a hook on every tool (goal-tool), each posting to this workspace with the session's token. */
232
252
  function hookSettings(port, host = '127.0.0.1') {
233
253
  const hook = (route) => ({ type: 'http', url: 'http://' + host + ':' + port + '/api/briefing-premium/' + route, headers: { 'x-pmos-session': '$PMOS_SESSION' }, allowedEnvVars: ['PMOS_SESSION'], timeout: 10 });
234
- return { hooks: { Stop: [{ hooks: [hook('goal-stop')] }], PreToolUse: [{ matcher: ASK_TOOL, hooks: [hook('ask-tool')] }] } };
254
+ return { hooks: { Stop: [{ hooks: [hook('goal-stop')] }], PreToolUse: [{ matcher: ASK_TOOL, hooks: [hook('ask-tool')] }, { matcher: '*', hooks: [hook('goal-tool')] }] } };
235
255
  }
236
256
  /* chat-ask-card (bug 2026-10-22): Claude Code's question tool draws a picker in the terminal, and the chat panel cannot show it. The panel
237
257
  * showed "Claude is working", the PM pressed Stop (Esc) and the question ended as "[Request interrupted by user for tool use]", again and
@@ -241,8 +261,19 @@ const ASK_TOOL = 'AskUserQuestion';
241
261
  const ASK_REASON = 'The PM is in the PMOS chat panel, not a terminal. The panel already shows these questions and their options as buttons, '
242
262
  + 'and the PM\'s answer comes as their next message. Do not ask again and do not guess the answer: end your turn now with one short line. '
243
263
  + 'If you are working on a /goal, end with a pmos-goal progress block whose state is needs-you.';
244
- function askToolReply() {
245
- return { hookSpecificOutput: { hookEventName: 'PreToolUse', permissionDecision: 'deny', permissionDecisionReason: ASK_REASON } };
264
+ const GOAL_ASK_REASON = 'You are working on a /goal the PM started, and the PM asked you to finish it on your own. Do not ask: pick the sensible option yourself, '
265
+ + 'say in one line what you chose, and go on. Only if the work truly cannot go on without the PM (a sign-in or secret only they have, or a message to other people), '
266
+ + 'end your turn with a pmos-goal progress block whose state is needs-you.';
267
+ /** goal: the chat key's goal, or null. A started goal does not ask at all; any other chat waits for the PM's answer in the panel. */
268
+ function askToolReply(goal) {
269
+ const reason = goal && goal.state === 'started' ? GOAL_ASK_REASON : ASK_REASON;
270
+ return { hookSpecificOutput: { hookEventName: 'PreToolUse', permissionDecision: 'deny', permissionDecisionReason: reason } };
271
+ }
272
+ /* A started goal works on its own (feedback 2026-10-25: it stopped for approval prompts): no permission prompt stops it. The PM's deny
273
+ * rules still apply. With no started goal the answer is {} and Claude Code asks as usual. */
274
+ function goalToolReply(goal, toolName) {
275
+ if (!goal || goal.state !== 'started' || toolName === ASK_TOOL) return {};
276
+ return { hookSpecificOutput: { hookEventName: 'PreToolUse', permissionDecision: 'allow', permissionDecisionReason: 'PMOS: the PM started a /goal and asked Claude to finish it on its own.' } };
246
277
  }
247
278
 
248
279
  /** chat() hands a `/goal` message here: { error } or { id, prompt } with the grilling line already on record. */
@@ -305,4 +336,4 @@ function decide({ runtimeDir, key, id, act, draft, point, session, sessions, now
305
336
  return { status: 200, body: { ok: true, id, state: act === 'start' ? 'started' : 'cancelled' } };
306
337
  }
307
338
 
308
- module.exports = { parseCommand, grillPrompt, methodMessage, planMessage, skipMessage, unskipMessage, METHODS, startMessage, cancelMessage, cleanDraft, goalOf, statesAt, begin, decide, onStop, resume, briefingRows, goalRowsAt, withGoalRows, blockOf, keyOfSession, hookSettings, askToolReply, ASK_TOOL, MARK, RUNS, LIMIT, NO_PROGRESS, REASON };
339
+ module.exports = { parseCommand, grillPrompt, methodMessage, planMessage, skipMessage, unskipMessage, METHODS, startMessage, cancelMessage, cleanDraft, goalOf, statesAt, begin, decide, onStop, resume, briefingRows, goalRowsAt, withGoalRows, blockOf, keyOfSession, hookSettings, askToolReply, goalToolReply, matchPoints, ASK_TOOL, MARK, RUNS, LIMIT, NO_PROGRESS, REASON };
@@ -4,20 +4,21 @@
4
4
  * names an initiative's workflow, said the initiative was "not attached" to it, read the task stages of `pmos item` (lib/plan-tree.js) as
5
5
  * the board's columns and moved 47 tasks. Two things are kept apart here, in the words the agent gets:
6
6
  * the WORKFLOW stage is on the initiative (the stage card, the Board; `pmos workflow of|move|switch`, lib/workflow-cli.js);
7
- * a task has no workflow stage: its only stage is its state (To do, In progress, Done, Won't do, Archived; Wawan, 2026-10-25).
7
+ * a task's state is To do, In progress, Done, Won't do or Archived (Wawan, 2026-10-25); its group in the Tasks section is a workflow stage
8
+ * (`pmos task set --stage`, feedback batch 6), never its state.
8
9
  * The chat's opening states the initiative's workflow and current stage (lib/briefing-premium-agent.js openingFor); in a live session, a
9
10
  * message about a stage, a workflow or a move reaches the session with this rule first, read fresh, as lib/program-chat.js does for programs.
10
11
  *
11
12
  * infoOf(answer) → { id, title, wf: { id, name }, stage: { key, name, n, of }, stages: [{ key, name, status }], ended } | null
12
13
  * from lib/routes-boards.js initiativeWorkflow's answer
13
14
  * rule(info, id) → the rule's lines, with the workflow and stage when info is known
14
- * isAsk(text) → whether a message is about a stage, a workflow or a move
15
+ * isAsk(text) → whether a message is about a stage, a workflow, a move or a task
15
16
  * wrap(text, info, id) → the message as PMOS types it into a live session */
16
17
 
17
18
  // The first line of every message PMOS wraps. The page reads it to show the PM's turn as typed (public/pm/goal-chat.js shownUser).
18
19
  const MARK = '[PMOS initiative]';
19
20
  const SAYS = 'The PM says: ';
20
- const ASK_RE = /\b(stages?|workflows?|move[sd]?|moving|phases?|advance|next step)\b/i;
21
+ const ASK_RE = /\b(stages?|workflows?|move[sd]?|moving|phases?|advance|next step|tasks?)\b/i; // a task ask gets the one-kind-of-task rule (feedback batch 5)
21
22
 
22
23
  const isAsk = (text) => ASK_RE.test(String(text == null ? '' : text)) && !String(text).trim().startsWith('/');
23
24
 
@@ -38,8 +39,9 @@ function rule(info, id) {
38
39
  } else out.push(`Run \`pmos workflow of ${ini}\` to see the workflow this initiative runs and its current stage.`);
39
40
  out.push(
40
41
  `The workflow stage is on the initiative: the stage card and the Board show it. \`pmos workflow of ${ini}\` reads it. When the PM asks to move the initiative, run \`pmos workflow move ${ini} --stage <key> --why "<reason>"\`. When the PM asks to change its workflow, run \`pmos workflow switch ${ini} --to <workflow id>\`. Both write what the page's press writes, under your name.`,
41
- 'A task has no workflow stage. Its only stage is its state: To do, In progress, Done, Won\'t do or Archived. When the PM asks to change a task, '
42
- + `do it yourself, never send the PM to the Board: \`pmos task list ${ini}\` names the initiative's Board tasks and \`pmos task state <task> [<task> …] --to "<state>"\` sets them (a breakdown item is \`pmos item move <item> todo|doing|done\`). Never set a task's stage, and never change tasks to move the initiative.`,
42
+ 'There is one kind of task: the ones the PM sees in the initiative\'s Tasks section. The stage card\'s To finish entries and the older breakdown items are tasks too. '
43
+ + 'A task\'s state is To do, In progress, Done, Won\'t do or Archived. The Tasks section groups the tasks under the stages of this initiative\'s workflow: a task\'s group is its place in the breakdown, never its state. When the PM asks to add, close, group or change a task, '
44
+ + `do it yourself, never send the PM to the Board: \`pmos task add ${ini} "<title>" [--stage <stage>] [--due YYYY-MM-DD]\` adds one, \`pmos task list ${ini}\` names them all, \`pmos task state <task> [<task> …] --to "<state>" --why "<what shows it>"\` sets their state and \`pmos task set <task> [<task> …] --stage <stage>|none\` groups them (it also takes --due, --start, --owner, --notes; none clears a date). Never use \`pmos item add\` for new work, and never change tasks to move the initiative.`,
43
45
  );
44
46
  return out;
45
47
  }
@@ -89,9 +89,11 @@ function build(f) {
89
89
  : ((sheet && sheet.stepper) || []).map((s) => ({ k: s.id, label: s.label || s.id, state: s.state === 'todo' ? 'pending' : s.state, stateLabel: STEP_STATE[s.state] || cap1(s.state), owed: s.owed ? clip(typeof s.owed === 'string' ? s.owed : s.owed.text || s.owed.what || '', 160) : '', cur: s.state === 'current' }));
90
90
  const allSteps = steps ? steps.map((s) => ({ label: s.label || s.key, stateLabel: LAD_STATE[s.status] || cap1(s.status), note: clip(s.evidence || (s.basis && s.basis.rule) || s.rule || '', 220) })) : [];
91
91
 
92
- // ── tasks: PRD requirements (no result per requirement) and the board's tracker items ──
92
+ // ── tasks: PRD requirements (no result per requirement) and the board's items: its Board tasks, the initiative's breakdown items and its
93
+ // stage's To finish tasks are one kind of task (feedback batch 5, lib/task-items.js), Jira rows are read-only ──
93
94
  const items = (f.items || []).filter((t) => t && t.ini === id).slice(0, MAX_TASKS);
94
- const tracker = items.map((t, n) => ({ key: 'task:' + (t.uid || t.key || n), uid: t.uid || '', pmos: t.src === 'pmos', ref: t.key || t.ref || '', title: clip(t.title, 160), state: t.status || 'To do', src: t.src === 'jira' ? 'Jira (read-only)' : 'PMOS task', owner: t.owner || '', start: t.start || '', end: t.end || '', blocked: !!t.blocked, kind: t.kind || 'Task', notes: t.notes || '', readAt: t.readAt || '' }));
95
+ const tracker = items.map((t, n) => ({ key: 'task:' + (t.uid || t.key || n), uid: t.uid || '', pmos: t.src === 'pmos', ref: t.key || t.ref || '', title: clip(t.title, 160), state: t.status || 'To do', src: t.src === 'jira' ? 'Jira (read-only)' : 'PMOS task', owner: t.owner || '', start: t.start || '', end: t.end || '', blocked: !!t.blocked, kind: t.kind || 'Task', notes: t.notes || '', readAt: t.readAt || '',
96
+ ...(t.from ? { from: { stage: t.from.stage, finish: t.from.finish } } : {}), ...(t.store === 'item' ? { store: 'item' } : {}) }));
95
97
  const dv = sheet && sheet.derived;
96
98
  const reqs = dv && Array.isArray(dv.items) ? dv.items.slice(0, MAX_TASKS).map((x) => ({ key: 'req:' + x.id, ref: x.ref || x.id, title: clip(x.title, 160), state: null, src: 'PRD requirement' })) : [];
97
99
  const prog = ini.progress || null;
@@ -288,7 +288,15 @@ function initOf(r) {
288
288
  const i = lifeIndex(r.stage);
289
289
  return { id: String(r.id), title: clip(r.title || r.id, 120), stage: r.stage || '', idx: i, stageLabel: i >= 0 ? LIFE_LABEL[i] : (r.stage || ''), status: r.status || '', lane: r.lane || '',
290
290
  owner: r.owner || '', end: r.end ? shortDate(r.end) : '', endAt: r.end ? String(r.end).slice(0, 10) : null, anchor: r.anchor || '',
291
- startAt: r.start ? String(r.start).slice(0, 10) : null, skipped: IG.skippedOf(r.warnings) };
291
+ startAt: r.start ? String(r.start).slice(0, 10) : null, skipped: IG.skippedOf(r.warnings), milestone: milestoneOf(r, i) };
292
+ }
293
+ /** The milestone an initiative works toward next, for the goal Viewer's "Moved by" (canvas OvViewers "Goal"): the first milestone stage of its
294
+ * own workflow that is not done or skipped (the board row's wfStages), else the lifecycle's next one (Deliver, then Evaluate). null when its
295
+ * milestones are all behind it. Its date is the initiative's planned finish, said as "plan Nov 4". */
296
+ function milestoneOf(r, i) {
297
+ const S = Array.isArray(r.wfStages) ? r.wfStages : null;
298
+ if (S && S.some((s) => s.milestone)) { const m = S.find((s) => s.milestone && s.status !== 'done' && s.status !== 'skipped'); return m ? { name: clip(m.name, 60) } : null; }
299
+ return i < 5 ? { name: LIFE_LABEL[5] } : i < 7 ? { name: LIFE_LABEL[7] } : null;
292
300
  }
293
301
  /** One goal per KR metric record, with or without a series. `today` is a day in ms (UTC midnight). */
294
302
  function goalsOf(outcomes, charts, inits, today, meta) {
@@ -27,7 +27,8 @@ const { parseArgs } = require('./schedule-cli');
27
27
 
28
28
  const COMMANDS = { item: ['add', 'set', 'move', 'withdraw', 'list'] };
29
29
  const USAGE = [
30
- 'usage: pmos item add|set|move|withdraw|list — an initiative\'s breakdown items',
30
+ 'usage: pmos item add|set|move|withdraw|list — an initiative\'s breakdown items, the older record of its tasks',
31
+ 'New tasks go through pmos task add, and pmos task list|state lists and closes breakdown items too. There is one kind of task.',
31
32
  ' pmos item add <initiative> "<title>" --stage <stage> [--due YYYY-MM-DD] [--start YYYY-MM-DD]',
32
33
  ' [--owner you|agent|person:<name>|tracker:<ref>] [--after <item>[,<item>]] [--milestone] [--note "<text>"]',
33
34
  ' pmos item set <item> [--title "<title>"] [--stage <stage>] [--due <date>|none] [--start <date>|none] [--owner <owner>]',