create-pmos 0.396.0 → 0.397.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 (98) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/scripts/nine-stages.js +49 -20
  6. package/payload/state/discoveries.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +20 -40
  8. package/workspace/briefing-premium-board-test.js +145 -107
  9. package/workspace/briefing-premium-calendar-2-test.js +5 -2
  10. package/workspace/briefing-premium-calendar-3-test.js +13 -8
  11. package/workspace/briefing-premium-calendar-test.js +16 -5
  12. package/workspace/briefing-premium-initiative-test.js +50 -41
  13. package/workspace/briefing-premium-insights-test.js +104 -85
  14. package/workspace/briefing-premium-metrics-test.js +11 -32
  15. package/workspace/briefing-premium-sources-test.js +42 -21
  16. package/workspace/briefing-premium-test.js +112 -98
  17. package/workspace/briefing-premium-work-test.js +78 -64
  18. package/workspace/changelog.json +12 -0
  19. package/workspace/fixtures/board-premium-facts.js +2 -1
  20. package/workspace/fixtures/board-premium-jira.js +28 -0
  21. package/workspace/fixtures/initiative-premium-facts.js +2 -1
  22. package/workspace/fixtures/initiatives-api/list.json +30 -42
  23. package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
  24. package/workspace/fixtures/initiatives-api/sheet.json +10 -14
  25. package/workspace/fixtures/insights-premium-facts.js +11 -2
  26. package/workspace/guide/index.md +1 -0
  27. package/workspace/guide/lifecycle.md +51 -0
  28. package/workspace/home-shot.js +38 -0
  29. package/workspace/lib/board-premium.js +92 -1
  30. package/workspace/lib/engine/boards.js +15 -14
  31. package/workspace/lib/engine/nine-stages.js +49 -20
  32. package/workspace/lib/engine/signals/detectors.js +13 -11
  33. package/workspace/lib/insights-premium.js +78 -1
  34. package/workspace/lib/routes-board-premium.js +3 -2
  35. package/workspace/lib/routes-initiatives.js +1 -1
  36. package/workspace/lib/routes-insights-premium.js +8 -1
  37. package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
  38. package/workspace/package-lock.json +2 -2
  39. package/workspace/package.json +1 -1
  40. package/workspace/premium-agreed-viewer-shots.js +76 -0
  41. package/workspace/premium-board-actions-test.js +2 -0
  42. package/workspace/premium-chat-chart-tab-test.js +6 -5
  43. package/workspace/premium-chat-context-test.js +8 -6
  44. package/workspace/premium-chat-goal-view-test.js +9 -7
  45. package/workspace/premium-chat-notes-test.js +3 -2
  46. package/workspace/premium-chat-report-tab-test.js +8 -2
  47. package/workspace/premium-chat-term-test.js +3 -1
  48. package/workspace/premium-chat-viewer-test.js +23 -17
  49. package/workspace/premium-core-doc-issue-test.js +2 -0
  50. package/workspace/premium-html-viewer-test.js +4 -2
  51. package/workspace/premium-phone-card-test.js +1 -0
  52. package/workspace/premium-phone-room-test.js +16 -11
  53. package/workspace/premium-report-read-test.js +1 -1
  54. package/workspace/premium-vw-backlog-test.js +2 -0
  55. package/workspace/premium-vw-cal-test.js +9 -4
  56. package/workspace/premium-vw-doc-test.js +1 -1
  57. package/workspace/premium-vw-item-test.js +1 -0
  58. package/workspace/premium-vw-jira-test.js +4 -1
  59. package/workspace/premium-vw-notes-test.js +2 -1
  60. package/workspace/premium-vw-rec-test.js +3 -2
  61. package/workspace/premium-vw-slides-test.js +2 -2
  62. package/workspace/premium-work-depth-test.js +7 -3
  63. package/workspace/public/pm/bd-span.js +120 -0
  64. package/workspace/public/pm/bd-stages.js +33 -0
  65. package/workspace/public/pm/cozy-board.css +373 -0
  66. package/workspace/public/pm/cozy-home.css +152 -0
  67. package/workspace/public/pm/cozy-home.js +170 -0
  68. package/workspace/public/pm/cozy-initiative.css +138 -0
  69. package/workspace/public/pm/cozy-insights.css +292 -0
  70. package/workspace/public/pm/cozy-nav.js +54 -0
  71. package/workspace/public/pm/cozy-viewer.css +143 -0
  72. package/workspace/public/pm/cozy.css +172 -0
  73. package/workspace/public/pm/lifecycle-lens-model.js +45 -27
  74. package/workspace/public/pm/lifecycle-lens.js +22 -11
  75. package/workspace/public/pm/premium-board.js +329 -67
  76. package/workspace/public/pm/premium-brief.js +1 -1
  77. package/workspace/public/pm/premium-chat.js +17 -10
  78. package/workspace/public/pm/premium-initiative-head.js +138 -0
  79. package/workspace/public/pm/premium-initiative.js +28 -4
  80. package/workspace/public/pm/premium-insights.js +530 -244
  81. package/workspace/public/pm/premium-shell.js +40 -10
  82. package/workspace/public/pm/premium-viewer.js +5 -0
  83. package/workspace/public/pm/premium-vw-jira-model.js +22 -5
  84. package/workspace/public/pm/premium-vw-jira.css +11 -0
  85. package/workspace/public/pm/premium-vw-jira.js +11 -4
  86. package/workspace/public/pm/premium-vw-rec.js +5 -2
  87. package/workspace/public/pm/premium-work.js +18 -8
  88. package/workspace/public/pm/premium.js +19 -6
  89. package/workspace/public/premium-board.html +82 -47
  90. package/workspace/public/premium-chat.html +7 -33
  91. package/workspace/public/premium-initiative.html +15 -8
  92. package/workspace/public/premium-insights.html +82 -43
  93. package/workspace/public/premium-work.html +6 -72
  94. package/workspace/public/premium.html +61 -15
  95. package/workspace/public/vendor/nunito-var.woff2 +0 -0
  96. package/workspace/server.js +7 -0
  97. package/workspace/test-lists/premium-agreed-viewer.json +9 -0
  98. package/workspace/third-party/README.md +1 -0
@@ -169,6 +169,7 @@ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'applicati
169
169
  return { over: document.documentElement.scrollWidth > innerWidth + 1, small: bs.filter((b) => b.getBoundingClientRect().height < 43.5).length, buttons: bs.length, colour: getComputedStyle(c.querySelector('.phbig')).color, bg: getComputedStyle(c).backgroundColor, edge: getComputedStyle(c).boxShadow };
170
170
  });
171
171
  ok(`L1 ${scheme}: no sideways scroll at 390 and every button is 44 px tall`, !f.over && f.small === 0 && f.buttons >= 1, JSON.stringify(f));
172
+ // premium-agreed-design: the accent edge is the cozy blue (--cz-blue, cozy-home.css) where the old design drew ember; the check reads the inset edge alone
172
173
  ok(`L2 ${scheme}: the card has the ember edge and readable text`, /inset/.test(f.edge) && f.colour !== f.bg, JSON.stringify(f));
173
174
  ok(`L3 ${scheme}: the page raised no error`, p.__errs.length === 0, p.__errs.join());
174
175
  if (p.__shot) await p.__shot(scheme);
@@ -3,9 +3,11 @@
3
3
  /* premium-phone-room-test.js — Focus on a phone (Wawan, 2026-10-21: the scroll area is too small; then "UI broken. Better to have manual CTA to
4
4
  * Focus" after the automatic hiding misdrew the page with the keyboard up). A real server on a scratch repository (c3-scan-fixture.js); the
5
5
  * conversation is filled in the page.
6
- * P1 the Chat page at rest (no Detail switch since premium-chat-viewer) · P2 scrolling and typing hide nothing · P3 Focus gives the dialog the screen and moves the rail away · P4 a second
7
- * press brings it all back · P5 a chat dialog on another page takes the screen, the rail class stays off · P6 a desktop has no Focus button
8
- * Set PHONE_ROOM_SHOTS=<dir> to save the Chat page at 390 wide, light and dark, at rest and in focus. */
6
+ * P1 the PM's chat on a phone at rest: since premium-agreed-design (H2, H3) /premium-chat.html opens Home, and on a phone Home's list is the
7
+ * page and the chat opens over it as a popup from the head's chat button · P2 scrolling and typing hide nothing · P3 Focus gives the dialog
8
+ * the whole screen · P4 a second press brings it all back · P5 a chat dialog opened from script takes the screen, the rail class stays off ·
9
+ * P6 a desktop shows no Focus button
10
+ * Set PHONE_ROOM_SHOTS=<dir> to save the chat at 390 wide, light and dark, at rest and in focus. */
9
11
  const { findBrowser } = require('./lib/find-browser');
10
12
  require('./test-run').configure({ name: 'premium-phone-room' });
11
13
  const Fx = require('./c3-scan-fixture.js');
@@ -27,7 +29,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
27
29
  /* the page's own state: the head, the rail and how much of the screen the conversation gets */
28
30
  const look = () => {
29
31
  const g = document.querySelector('#dlg'), rail = document.querySelector('.rail').getBoundingClientRect(), body = document.querySelector('#dBody').getBoundingClientRect(), ask = document.querySelector('#askF').getBoundingClientRect(), f = document.querySelector('#dFocus');
30
- return { focus: g.classList.contains('focus'), dfocus: document.body.classList.contains('dfocus'), btn: !!f && getComputedStyle(f).display !== 'none', pressed: f && f.getAttribute('aria-pressed'), tabs: getComputedStyle(document.querySelector('#dTabs')).display !== 'none', railTop: Math.round(rail.top), dlgTop: Math.round(g.getBoundingClientRect().top), dlgH: Math.round(g.getBoundingClientRect().height), room: Math.round(ask.top - body.top), vh: innerHeight };
32
+ return { on: g.classList.contains('on'), modal: g.getAttribute('aria-modal'), behind: ['.rail', 'main.stage'].every((s) => document.querySelector(s).inert), focus: g.classList.contains('focus'), dfocus: document.body.classList.contains('dfocus'), btn: !!f && getComputedStyle(f).display !== 'none', pressed: f && f.getAttribute('aria-pressed'), tabs: getComputedStyle(document.querySelector('#dTabs')).display !== 'none', railTop: Math.round(rail.top), dlgTop: Math.round(g.getBoundingClientRect().top), dlgH: Math.round(g.getBoundingClientRect().height), room: Math.round(ask.top - body.top), vh: innerHeight };
31
33
  };
32
34
  const fill = () => { const s = document.querySelector('#dBody .stream'); let h = ''; for (let i = 0; i < 14; i++) h += `<div class="turn"><p>${'A line of the conversation about the sign-up drop reasons and the counts. '.repeat(3)}</p></div>`; s.insertAdjacentHTML('beforeend', h); };
33
35
  const hand = (dy) => { const b = document.querySelector('#dBody'); b.dispatchEvent(new WheelEvent('wheel', { deltaY: dy })); b.scrollTop += dy; };
@@ -44,28 +46,31 @@ const hand = (dy) => { const b = document.querySelector('#dBody'); b.dispatchEve
44
46
  const open = async (width, scheme = 'light', height = 844) => {
45
47
  const ctx = await browser.newContext({ viewport: { width, height }, colorScheme: scheme, hasTouch: true });
46
48
  const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
47
- await p.goto(chat); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && document.querySelector('#dGrid').dataset.tab === 'chat'));
49
+ await p.goto(chat); await until(() => p.evaluate(() => !!document.querySelector('#rank, #hChat') && /\/premium\.html$/.test(location.pathname)));
50
+ if (width < 1000) { await p.click('#hChat'); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && document.querySelector('#dGrid').dataset.tab === 'chat')); }
51
+ else await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#dBody .stream'))); // a desktop Home docks the chat open
48
52
  await p.evaluate(fill); await sleep(200);
49
53
  return { p, ctx, errs };
50
54
  };
51
55
 
52
56
  { const { p, ctx, errs } = await open(390);
53
- await until(() => p.evaluate(() => document.querySelector('#dlg').getBoundingClientRect().top === 0)); // the dialog's entrance has finished
57
+ await until(() => p.evaluate(() => { const g = document.querySelector('#dlg'); return g.getBoundingClientRect().top < innerHeight && !g.getAnimations().some((a) => a.playState === 'running'); })); // the popup's entrance has finished
58
+ await sleep(300);
54
59
  const s0 = await p.evaluate(look);
55
- ok('P1 the Chat page at rest shows the rail and a Focus button, and no Detail switch (premium-chat-viewer V5: the viewer is a layer)', !s0.tabs && !s0.focus && s0.btn && s0.pressed === 'false' && s0.railTop < s0.vh, JSON.stringify(s0));
60
+ ok('P1 on a phone /premium-chat.html opens Home, and its chat button opens your chat over the list as a modal popup with a Focus button, out of focus', s0.on && s0.modal === 'true' && s0.behind && !s0.focus && !s0.dfocus && s0.btn && s0.pressed === 'false' && s0.dlgTop > 0 && s0.dlgH < s0.vh, JSON.stringify(s0));
56
61
  await p.evaluate(hand, 300); await sleep(400); await p.evaluate(hand, -100); await p.focus('#askIn'); await sleep(500);
57
62
  const s1 = await p.evaluate(look);
58
63
  ok('P2 scrolling and typing hide nothing by themselves', !s1.focus && s1.railTop < s1.vh && s1.dlgH === s0.dlgH, JSON.stringify(s1));
59
64
  await p.evaluate(() => document.querySelector('#askIn').blur());
60
65
  if (shots) await p.screenshot({ path: `${shots}/chat-rest-390-light.png` });
61
66
  await p.click('#dFocus');
62
- const s2 = await until(async () => { const v = await p.evaluate(look); return v.focus && v.dfocus && v.railTop >= v.vh && v.dlgH >= v.vh - 2 ? v : null; }) || await p.evaluate(look);
63
- ok('P3 Focus hides the switch, moves the rail off the screen and gives the dialog the whole screen', s2.focus && !s2.tabs && s2.dfocus && s2.pressed === 'true' && s2.railTop >= s2.vh && s2.dlgTop === 0 && s2.dlgH >= s2.vh - 2, JSON.stringify(s2));
67
+ const s2 = await until(async () => { const v = await p.evaluate(look); return v.focus && v.dlgTop === 0 && v.dlgH >= v.vh - 2 ? v : null; }) || await p.evaluate(look);
68
+ ok('P3 Focus hides the switch and gives the dialog the whole screen; a popup leaves the page\'s rail class alone', s2.focus && !s2.tabs && !s2.dfocus && s2.pressed === 'true' && s2.dlgTop === 0 && s2.dlgH >= s2.vh - 2, JSON.stringify(s2));
64
69
  ok('P3b in focus the conversation gets at least 680 px of the 844 px screen (516 px before)', s2.room >= 680, JSON.stringify(s2));
65
70
  if (shots) await p.screenshot({ path: `${shots}/chat-focus-390-light.png` });
66
71
  await p.click('#dFocus');
67
- const s3 = await until(async () => { const v = await p.evaluate(look); return !v.focus && !v.dfocus && v.railTop < v.vh ? v : null; }) || await p.evaluate(look);
68
- ok('P4 a second press brings the rail back', !s3.focus && !s3.dfocus && s3.railTop < s3.vh && s3.pressed === 'false', JSON.stringify(s3));
72
+ const s3 = await until(async () => { const v = await p.evaluate(look); return !v.focus && v.dlgTop === s0.dlgTop && v.dlgH === s0.dlgH ? v : null; }) || await p.evaluate(look);
73
+ ok('P4 a second press gives the screen back: the switch shows and the dialog has its popup size again', !s3.focus && !s3.dfocus && s3.tabs && s3.dlgH === s0.dlgH && s3.dlgTop === s0.dlgTop && s3.pressed === 'false', JSON.stringify(s3));
69
74
  ok('P4b no page error', errs.length === 0, errs.join(' | '));
70
75
  await ctx.close(); }
71
76
 
@@ -97,7 +97,7 @@ fs.writeFileSync(path.join(base, 'brand.png'), PNG);
97
97
  const counter = () => p.evaluate(() => (document.querySelector('#rdN') || {}).textContent || '');
98
98
  const bigTitle = () => p.evaluate(() => { const h = document.querySelector('#rdSlide h3'); return h ? h.textContent : (document.querySelector('#rdSlide iframe') ? 'frame' : ''); });
99
99
  const say = async (t) => { await p.fill('#rdIn', t); await p.press('#rdIn', 'Enter'); };
100
- await p.goto(BASE + '/premium-insights.html');
100
+ await p.goto(BASE + '/premium-insights.html?tab=library'); // Library holds the reports (premium-agreed-design G2)
101
101
  await until(() => p.evaluate(() => !!document.querySelector('#listSeg [data-f="rep"]')));
102
102
  await (async (pg, sel) => { if (await pg.locator('#listSeg').isHidden()) await pg.click('#listF'); await pg.click(sel); })(p, '#listSeg [data-f="rep"]'); // the one list (insights-one-list L5): the Reports filter holds the report files
103
103
  await until(() => p.evaluate(() => document.querySelectorAll('#listRows [data-rpt]').length === 1));
@@ -55,6 +55,7 @@ const SPRINTS = { ok: true, source: 'jira', readAt: '2026-10-19T09:00:00Z', velo
55
55
  return { page, ctx, S };
56
56
  };
57
57
  const openBacklog = async (page) => {
58
+ await page.evaluate(() => { if (document.querySelector('#popSpr').hidden) (document.querySelector('#chSprint') || document.querySelector('#miSpr')).click(); }); // the Agreed design keeps the sprint card behind the sprint chip (premium-agreed-design)
58
59
  await page.click('#cSpr [data-open="board:sprint"]');
59
60
  await until(() => page.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#openBacklog')), 5000);
60
61
  const btn = await page.$('#openBacklog');
@@ -100,6 +101,7 @@ const SPRINTS = { ok: true, source: 'jira', readAt: '2026-10-19T09:00:00Z', velo
100
101
  /* R10 no reading */
101
102
  {
102
103
  const { page, ctx, S } = await open({ sprints: { ok: true, source: 'none', readAt: null, sprints: [], velocity: [], backlog: { readAt: null, issues: [], points: null, links: {} } } });
104
+ await page.evaluate(() => { if (document.querySelector('#popSpr').hidden) (document.querySelector('#chSprint') || document.querySelector('#miSpr')).click(); }); // the Agreed design keeps the sprint card behind the sprint chip (premium-agreed-design)
103
105
  await page.click('#cSpr [data-open="board:sprint"]');
104
106
  await until(() => page.evaluate(() => !!document.querySelector('#openBacklog')), 5000);
105
107
  await page.evaluate(() => document.querySelector('#openBacklog').click());
@@ -76,7 +76,9 @@ const answer = (url, mode) => {
76
76
 
77
77
  /* R8 desktop */
78
78
  {
79
- const { page, ctx, S } = await open();
79
+ // re-pointed for premium-agreed-design: on Home the dialog is the docked chat and the Viewer column is at most 500 px, so the week grid
80
+ // (drawn when the Viewer is 560 px or wider, the agenda below that) needs a wide desktop; at 1600 px the Viewer column is about 650 px
81
+ const { page, ctx, S } = await open({ w: 1600 });
80
82
  ok('R8 the Briefing\'s Calendar card has a button that opens the calendar', S.up);
81
83
  await page.click('#calMore'); await page.click('#todayCard .vc-open');
82
84
  ok('R8 the button opens a dialog with the calendar as its detail', await until(() => page.evaluate(() => document.querySelector('#dlg').classList.contains('on') && document.querySelector('#dTitle').textContent === 'Calendar')) && await ready(page));
@@ -111,9 +113,12 @@ const answer = (url, mode) => {
111
113
  const tabs = await page.evaluate(() => ({ ...window.__premiumViewer.vwState(), main: !document.querySelector('#oMain').hidden }));
112
114
  ok('R8 the calendar stays as a tab beside the meeting, the meeting shown', JSON.stringify(tabs.ids) === '["cal"]' && tabs.on === 'main' && tabs.main, JSON.stringify(tabs));
113
115
  await page.click('#vTabs .vtab[data-vw="cal"]');
114
- await until(() => vis(page, '.obody.vw[data-vw="cal"] .vc-ev'));
115
- ok('R8 the Calendar tab shows the grid at the same view', (await vis(page, '.obody.vw[data-vw="cal"] .vc-ev')) === 3 && (await pressed(page)) === 'week');
116
- await page.evaluate(() => [...document.querySelectorAll('.obody.vw[data-vw="cal"] .vc-ev')].find((b) => /Customer call/.test(b.textContent)).click());
116
+ // re-pointed for premium-agreed-design: a row's dialog on Home docks its Viewer in a column of at most 500 px, where the same week view
117
+ // draws as its agenda (the grid needs 560 px), so today's three meetings count as blocks or as agenda rows, whichever the width draws
118
+ const calEv = '.obody.vw[data-vw="cal"] .vc-ev, .obody.vw[data-vw="cal"] .vc-ar';
119
+ await until(() => vis(page, calEv));
120
+ ok('R8 the Calendar tab shows the grid at the same view', (await vis(page, calEv)) === 3 && (await pressed(page)) === 'week');
121
+ await page.evaluate((q) => [...document.querySelectorAll(q)].find((b) => b.getClientRects().length && /Customer call/.test(b.textContent)).click(), calEv);
117
122
  ok('R8 a meeting from the tab opens that meeting, with the tab again', await until(() => page.evaluate(() => document.querySelector('#dTitle').textContent === 'Customer call' && JSON.stringify(window.__premiumViewer.vwState().ids) === '["cal"]')));
118
123
 
119
124
  /* R6 honesty */
@@ -213,7 +213,7 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
213
213
  }, [V, w < 600]);
214
214
  ok(`D8 at ${w} px ${theme}: no sideways scroll, no small target, nothing past the edge, console sizes only`, f.sx <= 0 && f.bad.length === 0 && f.out === 0 && f.fs.every((x) => ['11px', '12px', '14px', '16px', '20px', '28px'].includes(x)), JSON.stringify(f));
215
215
  const c = await R.page.evaluate((v) => { const e = document.querySelector(v + ' .cf'); return [getComputedStyle(e).backgroundColor, getComputedStyle(e).color]; }, V);
216
- ok(`D8 at ${w} px ${theme}: the page follows the theme`, theme === 'dark' ? c[0] === 'rgb(23, 26, 35)' : c[0] === 'rgb(253, 253, 252)', JSON.stringify(c));
216
+ ok(`D8 at ${w} px ${theme}: the page follows the theme`, theme === 'dark' ? c[0] === 'rgb(36, 38, 43)' && c[1] === 'rgb(236, 238, 241)' : c[0] === 'rgb(255, 255, 255)' && c[1] === 'rgb(42, 46, 53)', JSON.stringify(c)); // the initiative page is cozy (premium-agreed-design): the card is the cozy white or dark card
217
217
  await R.ctx.close();
218
218
  }
219
219
  finish();
@@ -108,6 +108,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
108
108
  const up = await until(() => page.evaluate(() => document.querySelectorAll('#ibBody [data-key]').length > 0), 20000);
109
109
  ok('R9 the Board loads', up);
110
110
  const opened = await page.evaluate(() => { const b = document.querySelector('#ibBody [data-key]'); if (b) b.click(); return !!b; });
111
+ await until(() => page.evaluate(() => !document.querySelector('#peek').hidden)); await page.click('#peek [data-pk="record"]'); // the Agreed design opens a side panel first; its Record opens the dialog (premium-agreed-design)
111
112
  await until(() => page.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
112
113
  ok('R9 an initiative row opens the Board dialog with Open the full record', opened && await until(() => page.evaluate(() => !!document.querySelector('#oMain [data-vwopen]')), 3000));
113
114
  await page.evaluate(() => document.querySelector('#oMain [data-vwopen]').click());
@@ -85,6 +85,7 @@ const TICKETS = {
85
85
  /* B the sprint */
86
86
  const A = await open();
87
87
  const p = A.page;
88
+ await p.evaluate(() => { if (document.querySelector('#popSpr').hidden) (document.querySelector('#chSprint') || document.querySelector('#miSpr')).click(); }); // the Agreed design keeps the sprint card behind the sprint chip (premium-agreed-design)
88
89
  await p.click('#cSpr [data-open="board:sprint"]');
89
90
  const board = await until(async () => { const t = await paneText(p, 'sprint:w1'); return t && /Migration check/.test(t) ? t : null; });
90
91
  ok('B1 the Sprint card opens the dialog with the sprint as a second tab', !!board && (await tabIds(p)).join() === 'main,sprint:w1', JSON.stringify(await tabIds(p)));
@@ -119,7 +120,8 @@ const TICKETS = {
119
120
  ok('K2 the ticket shows key, title, status, sprint, points and priority', /PMOS-142/.test(tk) && /Migration check for older workspaces/.test(tk) && /To Do/.test(tk) && /Sprint 14 · active/.test(tk) && /5 pt/.test(tk) && /High/.test(tk), tk);
120
121
  ok('K3 the description is the draft\'s sections, rendered as markdown with nothing run', /User Story/.test(tk) && await p.evaluate(() => !!document.querySelector('.jmd strong') && !document.querySelector('.jmd img[onerror]') && !window.__pwned));
121
122
  ok('K4 subtasks are the reading\'s count, and links come from the draft', /Subtasks · 1 of 3 done/.test(tk) && /blocks/.test(tk) && /PMOS-152/.test(tk) && /planning\/prd\/self-serve-v2-prd.md/.test(tk));
122
- ok('K5 no comments, history or fields panel: a line sends the rest to Jira with a real link', /Assignee, comments, history and the other fields stay in Jira/.test(tk) && !/Comments \(/.test(tk)
123
+ ok('K5 no comments, history or fields panel: a line sends the rest to Jira with a real link', /Comments, history and the other fields stay in Jira/.test(tk) && /Jira owns the status and the assignee/.test(tk)
124
+ && /Assignee\s*Not in the Jira read/.test(tk) && /Jira\s*Read (\d+ (min|hours?|days?) ago|just now)/.test(tk) && !/pull request|\bPR\b|builder/i.test(tk) && !/Comments \(/.test(tk)
123
125
  && await p.evaluate(() => [...document.querySelectorAll('#dOut .obody.vw:not([hidden]) a[href]')].every((a) => a.href === 'https://acme.atlassian.net/browse/PMOS-142' && a.target === '_blank' && /noopener/.test(a.rel))));
124
126
  await p.click('#dOut .obody.vw:not([hidden]) [data-jt="PMOS-152"]');
125
127
  ok('K6 a linked ticket opens in its own tab', !!(await until(async () => { const t = await paneText(p, 'jira:PMOS-152'); return t && /Release to existing workspaces/.test(t) && /No sprint/.test(t); })));
@@ -171,6 +173,7 @@ const TICKETS = {
171
173
  /* F floors */
172
174
  for (const theme of ['light', 'dark']) {
173
175
  const S = await open({ w: 390, h: 844, theme });
176
+ await S.page.evaluate(() => { if (document.querySelector('#popSpr').hidden) (document.querySelector('#chSprint') || document.querySelector('#miSpr')).click(); }); // the Agreed design keeps the sprint card behind the sprint chip (premium-agreed-design)
174
177
  await S.page.click('#cSpr [data-open="board:sprint"]');
175
178
  await until(() => S.page.$('.jcrd[data-k="PMOS-142"]'));
176
179
  await S.page.evaluate(() => { const d = document.querySelector('#dlg'); if (d) d.classList.add('vopen'); const b = document.querySelector('#dTabs button[data-t="out"]'); if (b) b.click(); });
@@ -147,7 +147,8 @@ const NOTE = { id: 'n3', title: 'Call with a partner', state: 'ended', meeting:
147
147
  return { scroll: document.documentElement.scrollWidth <= innerWidth + 1 && pane.scrollWidth <= pane.clientWidth + 1,
148
148
  btn: [...pane.querySelectorAll('.vn-o, .vn-x, .vn-q, .vm-sh, .vm-lk')].filter((b) => b.getClientRects().length).map((b) => Math.round(Math.min(b.getBoundingClientRect().width, b.getBoundingClientRect().height))) }; });
149
149
  const f0 = await fl();
150
- if (w === 390) ok(`N8 at 390 px (${th}) the Calendar card header keeps one line and Notes sits under the day`, await P.page.evaluate(() => { const h = document.querySelector('#todayCard .ch'), r = (e) => e.getBoundingClientRect(); const bs = [...h.querySelectorAll('button')].filter((b) => b.getClientRects().length); return !document.querySelector('#vnOpen').getClientRects().length && bs.every((b) => Math.abs(r(b).top - r(bs[0]).top) < 4) && r(document.querySelector('#vnOpenFoot')).height >= 44; }));
150
+ // re-pointed for premium-agreed-design: Home's card header mixes a small fold button with 44 px presses, so one line is read by centres, not tops
151
+ if (w === 390) ok(`N8 at 390 px (${th}) the Calendar card header keeps one line and Notes sits under the day`, await P.page.evaluate(() => { const h = document.querySelector('#todayCard .ch'), r = (e) => e.getBoundingClientRect(); const bs = [...h.querySelectorAll('button')].filter((b) => b.getClientRects().length); return !document.querySelector('#vnOpen').getClientRects().length && bs.every((b) => Math.abs(r(b).top + r(b).height / 2 - r(bs[0]).top - r(bs[0]).height / 2) < 4) && r(document.querySelector('#vnOpenFoot')).height >= 44; }));
151
152
  if (shotDir) await P.page.screenshot({ path: path.join(shotDir, `list-${w}-${th}.png`) });
152
153
  await P.page.click('[data-vn-note="n3"]');
153
154
  await until(() => P.page.evaluate(() => /Price SSO/.test((document.querySelector('#dOut .obody.vw[data-vw="meet-note"]') || {}).textContent || '')));
@@ -207,8 +207,9 @@ const RECORDER = () => {
207
207
 
208
208
  /* R2 another page */
209
209
  const live = { id: 'n1', title: 'Live review', state: 'recording', updated_at: new Date().toISOString(), meeting: { kind: 'event', event_id: 'ev-live', start: iso(START), title: 'Live review' } };
210
- const W = await open({ notes: [live], url: '/premium-work.html' });
211
- ok('R2 My work shows the chip with only Open and Stop, and no Record control', await until(async () => !!(await chip(W.page))) && await W.page.evaluate(() => [...document.querySelectorAll('#recChip button')].map((b) => b.dataset.r).join() === 'open,stop' && !document.querySelector('#recCtl')), String(await chip(W.page)));
210
+ // re-pointed for premium-agreed-design: My work now opens Home (the Briefing), so "another page" is Insights, a page that is not Home
211
+ const W = await open({ notes: [live], url: '/premium-insights.html' });
212
+ ok('R2 a page that is not Home (Insights) shows the chip with only Open and Stop, and no Record control', await until(async () => !!(await chip(W.page))) && await W.page.evaluate(() => [...document.querySelectorAll('#recChip button')].map((b) => b.dataset.r).join() === 'open,stop' && !document.querySelector('#recCtl')), String(await chip(W.page)));
212
213
  await W.ctx.close();
213
214
 
214
215
  /* R5 floors: 390 px, light and dark */
@@ -73,7 +73,7 @@ const disk = () => fs.readFileSync(path.join(dir, pNew), 'utf8');
73
73
  const V = '#oMain #rdEd'; // Edit draws the slide editor inside the report dialog (PM 2026-10-22: one place to edit a report)
74
74
  const st = () => p.evaluate((pth) => { const S = window.__premiumSlides && window.__premiumSlides.state(pth); return S ? { i: S.i, n: S.deck.slides.length, theme: S.deck.theme, dirty: S.dirty, ro: S.ro, sel: S.sel, msg: S.msg, slides: JSON.parse(JSON.stringify(S.deck.slides)) } : null; }, pNew);
75
75
  const openReader = async (slot) => {
76
- await p.goto(BASE + '/premium-insights.html');
76
+ await p.goto(BASE + '/premium-insights.html?tab=library'); // Library holds the reports (premium-agreed-design G2)
77
77
  await until(() => p.evaluate(() => !!document.querySelector('#listSeg [data-f="rep"]')));
78
78
  if (await p.locator('#listSeg').isHidden()) await tap('#listF'); await tap('#listSeg [data-f="rep"]'); // the one list (insights-one-list L5): the Reports filter holds the report files
79
79
  await until(() => p.evaluate(() => document.querySelectorAll('#listRows [data-rpt]').length === 1)); // one row per report (PM 2026-10-22); it opens the latest cycle
@@ -237,7 +237,7 @@ const disk = () => fs.readFileSync(path.join(dir, pNew), 'utf8');
237
237
  {
238
238
  const c2 = await browser.newContext({ viewport: { width: 390, height: 844 }, hasTouch: true, isMobile: true, colorScheme: 'dark' }), q = await c2.newPage(), e2 = [];
239
239
  q.on('pageerror', (e) => e2.push(String(e)));
240
- await q.goto(BASE + '/premium-insights.html?theme=dark');
240
+ await q.goto(BASE + '/premium-insights.html?theme=dark&tab=library');
241
241
  await until(() => q.evaluate(() => !!document.querySelector('#listSeg [data-f="rep"]')));
242
242
  await q.$eval('#listSeg [data-f="rep"]', (x) => x.click());
243
243
  await until(() => q.evaluate(() => document.querySelectorAll('#listRows [data-rpt]').length === 1));
@@ -67,8 +67,11 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
67
67
  const up = await until(() => page.evaluate(() => document.querySelectorAll('#qBody .wrow').length > 0), 20000);
68
68
  return { ctx, page, errors, posts, up, replies, setModel: (m) => { current = m; }, refuse: (f) => { fail = f; }, last: () => posts[posts.length - 1] };
69
69
  };
70
- const dlgOn = (p) => until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
71
- const dlgOff = (p) => until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
70
+ // re-pointed for premium-agreed-design: on a desktop Home the dialog is the docked chat and is always on, so a row's dialog is "on" when its
71
+ // Edit switch (#iTog) is drawn in it, and "off" when the dock is back on your own chat
72
+ const rowDlg = () => { const g = document.querySelector('#dlg'); return g.classList.contains('on') && (!document.body.classList.contains('cz-dock') || !!g.querySelector('#iTog')); };
73
+ const dlgOn = (p) => until(() => p.evaluate(rowDlg));
74
+ const dlgOff = (p) => until(() => p.evaluate(rowDlg).then((x) => !x));
72
75
  /* the Work queue shows one tab at a time: bring up the tab that holds a row before pressing it (each press redraws the tab row, so the button is found again) */
73
76
  const showKey = (p, key) => p.evaluate((key) => { const has = () => document.querySelector(`#qBody .wrow[data-key="${key}"], #waitBody .wrow[data-key="${key}"]`); if (has()) return true; for (const k of [...document.querySelectorAll('#qTabs .qtb, #qMenu .qtb')].map((b) => b.dataset.tab)) { document.querySelector(`#qTabs [data-tab="${k}"], #qMenu [data-tab="${k}"]`).click(); if (has()) return true; } return false; }, key);
74
77
  const qTab = async (p, k) => { if (!(await p.locator(`#qTabs [data-tab="${k}"]`).count())) await p.click('#qMore'); await p.click(`#qTabs [data-tab="${k}"], #qMenu [data-tab="${k}"]`); };
@@ -337,7 +340,8 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
337
340
  pg.on('pageerror', (e) => errs.push(String(e)));
338
341
  const get = (u) => fetch(BASE + u).then((r) => r.json());
339
342
  await pg.goto(BASE + '/premium-work.html');
340
- ok('E1 on an empty scratch state the page says the list is empty and Focus has nothing to suggest', await until(() => pg.evaluate(() => document.querySelector('#brief').textContent === 'Your list is empty.' && /Nothing to suggest/.test(document.querySelector('#xFocus .xfq').getAttribute('aria-label'))), 20000));
343
+ // re-pointed for premium-agreed-design: /premium-work.html opens Home, whose hero is the Briefing's; the empty list is said by the Work queue
344
+ ok('E1 on an empty scratch state the page says the list is empty and Focus has nothing to suggest', await until(() => pg.evaluate(() => /^Nothing needs you right now/.test(document.querySelector('#brief').textContent) && document.querySelector('#qBody').textContent === 'Nothing is placed for today.' && /Nothing to suggest/.test(document.querySelector('#xFocus .xfq').getAttribute('aria-label'))), 20000));
341
345
  await pg.fill('#capIn', 'Reply to Rina about SSO !p1'); await pg.press('#capIn', 'Enter');
342
346
  await dlgOn(pg); await sleep(700);
343
347
  await more(pg); await pg.click('[data-p="xt"][data-k="edit"]'); await pg.fill('#xeT', 'Reply to Rina about SSO beta'); await pg.fill('#xeD', '2026-10-30'); await pg.click('[data-p="xpri"][data-v="P2"]'); await pg.click('[data-p="xsave"]');
@@ -0,0 +1,120 @@
1
+ /* pm/bd-span.js — the premium Board's timeline (initiative premium-agreed-design, B2).
2
+ * PMOS plan dates against the Jira forecast, over six spans: Sprint (the tickets of the active sprint, by initiative), Quarter (one row per
3
+ * initiative), Half and Year (themes, with their initiatives as bars inside), 2 yr and 5 yr (themes only, as phases). A bar is drawn only from
4
+ * dates a record holds: the plan from the initiative's start and end, the forecast from the end of the latest sprint holding an open ticket.
5
+ * Pure: rows and the model in, markup out. */
6
+ import { esc } from './premium-shell.js';
7
+
8
+ const DAY = 86400000;
9
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
10
+ const day = (v) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
11
+ const short = (d) => d.getDate() + ' ' + MON[d.getMonth()];
12
+ const addDays = (d, n) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);
13
+ const addMonths = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
14
+ export const SPANS = [['sprint', 'Sprint'], ['quarter', 'Quarter'], ['half', 'Half'], ['year', 'Year'], ['y2', '2 yr'], ['y5', '5 yr']];
15
+ export const THEME_TONES = ['var(--cz-c-8c929b)', 'var(--cz-c-4894ea)', 'var(--cz-c-5e9c6a)', 'var(--cz-c-d4a13a)', 'var(--cz-c-b07cc6)', 'var(--cz-c-d9773f)'];
16
+
17
+ /** The window and the ticks of a span, around `now`. */
18
+ export function windowOf(span, now, sprint) {
19
+ const t = new Date(now.getFullYear(), now.getMonth(), now.getDate());
20
+ if (span === 'sprint') {
21
+ const a = sprint && day(sprint.start), b = sprint && day(sprint.end);
22
+ const from = a ? addDays(a, -1) : addDays(t, -7), to = b ? addDays(b, 2) : addDays(t, 8);
23
+ const ticks = []; for (let d = new Date(from); d <= to; d = addDays(d, 2)) ticks.push({ at: d, label: short(d) });
24
+ return { from, to, ticks };
25
+ }
26
+ if (span === 'quarter') {
27
+ const mon = addDays(t, -((t.getDay() + 6) % 7) - 14), to = addDays(mon, 7 * 13);
28
+ const ticks = []; for (let d = new Date(mon); d < to; d = addDays(d, 7)) ticks.push({ at: d, label: MON[d.getMonth()] + ' ' + d.getDate() });
29
+ return { from: mon, to, ticks };
30
+ }
31
+ if (span === 'half' || span === 'year') {
32
+ const n = span === 'half' ? 6 : 12, from = addMonths(t, span === 'half' ? -1 : -6), to = addMonths(from, n);
33
+ const ticks = []; for (let i = 0; i < n; i++) { const d = addMonths(from, i); ticks.push({ at: d, label: MON[d.getMonth()], sub: d.getMonth() % 3 === 0 ? 'Q' + (d.getMonth() / 3 + 1) + (d.getFullYear() !== t.getFullYear() ? ' ’' + String(d.getFullYear()).slice(2) : '') : '' }); }
34
+ return { from, to, ticks };
35
+ }
36
+ if (span === 'y2') {
37
+ const q0 = new Date(t.getFullYear(), Math.floor(t.getMonth() / 3) * 3 - 6, 1), to = addMonths(q0, 24);
38
+ const ticks = []; for (let i = 0; i < 8; i++) { const d = addMonths(q0, i * 3); ticks.push({ at: d, label: 'Q' + (d.getMonth() / 3 + 1), sub: String(d.getFullYear()) }); }
39
+ return { from: q0, to, ticks };
40
+ }
41
+ const from = new Date(t.getFullYear() - 1, 0, 1), to = new Date(t.getFullYear() + 4, 0, 1);
42
+ const ticks = []; for (let y = from.getFullYear(); y < to.getFullYear(); y++) ticks.push({ at: new Date(y, 0, 1), label: String(y), sub: 'H1 · H2' });
43
+ return { from, to, ticks };
44
+ }
45
+
46
+ const pctOf = (W) => (d) => Math.max(0, Math.min(100, ((d - W.from) / (W.to - W.from)) * 100));
47
+ const overlay = (W, X, now, sprint, rel) => {
48
+ const tl = W.ticks.map((k) => `<i class="tg-gl" style="left:${X(k.at).toFixed(2)}%"></i>`).join('');
49
+ const sa = sprint && day(sprint.start), sb = sprint && day(sprint.end);
50
+ const band = sa && sb && sb > W.from && sa < W.to ? `<i class="tg-sb" style="left:${X(sa).toFixed(2)}%;width:${(X(sb) - X(sa)).toFixed(2)}%"></i>` : '';
51
+ const ra = rel && day(rel.iso), rl = ra && ra > W.from && ra < W.to ? `<i class="tg-rl" style="left:${X(ra).toFixed(2)}%"></i>` : '';
52
+ const tn = now > W.from && now < W.to ? `<u class="tg-td" style="left:${X(now).toFixed(2)}%"></u>` : '';
53
+ return tl + band + rl + tn;
54
+ };
55
+ const toneOf = (r) => (r.track && r.track.blocked ? 'red' : r.late ? 'late' : r.status === 'at risk' ? 'risk' : r.status === 'on track' ? 'ok' : 'q');
56
+
57
+ /** One initiative's bar: the plan (start to end) with its done part, the forecast past the plan, and the days over. */
58
+ function barHtml(r, X, now, { label = false, tone = null } = {}) {
59
+ const s = day(r.start), e = day(r.end), fc = r.track && day(r.track.forecast);
60
+ if (!s && !e && !fc) return '';
61
+ let out = '';
62
+ if (s && e) {
63
+ const l = X(s), w = Math.max(0.8, X(e) - l), pr = r.track && r.track.prog ? Math.max(0, Math.min(100, (r.track.prog.done / Math.max(1, r.track.prog.total)) * 100)) : 0;
64
+ out += `<span class="tg-bar${r.track && r.track.ms ? ' ms' : ''}" style="left:${l.toFixed(2)}%;width:${w.toFixed(2)}%${tone ? ';--tone:' + tone : ''}" title="PMOS plan ${esc(short(s))} to ${esc(short(e))}"><b style="width:${pr.toFixed(1)}%"></b>${label ? `<em><i class="cz-dot ${toneOf(r)}"></i><strong>${esc(r.title)}</strong> ${esc(r.track ? r.track.label : '')}</em>` : ''}</span>`;
65
+ const over = r.over && now > e, late = fc && fc > e, words = [];
66
+ if (over) { out += `<span class="tg-over" style="left:${X(e).toFixed(2)}%;width:${Math.max(0.5, X(now) - X(e)).toFixed(2)}%"></span>`; words.push(r.overDays + ' ' + (r.overDays === 1 ? 'day' : 'days') + ' over'); }
67
+ if (late) { out += `<span class="tg-fc" style="left:${X(e).toFixed(2)}%;width:${(X(fc) - X(e)).toFixed(2)}%" title="Jira forecast ${esc(short(fc))}"></span>`; words.push('Jira forecast ' + short(fc)); }
68
+ // one label after the furthest mark, so the words never sit on each other; the theme spans name the bar inside it instead
69
+ if (words.length && !label) out += `<span class="tg-lab ${over ? 'late' : 'fc'}" style="left:${Math.max(over ? X(now) : 0, late ? X(fc) : 0).toFixed(2)}%">${esc(words.join(' · '))}</span>`;
70
+ } else if (fc) {
71
+ out += `<span class="tg-fc solo" style="left:${Math.max(0, X(fc) - 3).toFixed(2)}%;width:3%" title="Jira forecast ${esc(short(fc))}"></span>${label ? '' : `<span class="tg-lab fc" style="left:${X(fc).toFixed(2)}%">Jira forecast ${esc(short(fc))}</span>`}`;
72
+ } else {
73
+ const d = s || e; out += `<i class="tg-dm" style="left:${X(d).toFixed(2)}%" title="${s ? 'Starts' : 'Ends'} ${esc(short(d))}"></i>`;
74
+ }
75
+ return out;
76
+ }
77
+
78
+ /** The timeline's markup for the rows on screen. → { html, none: [titles of rows with no dates] } */
79
+ export function timelineHtml(rows, M, span, now = new Date()) {
80
+ const sprint = M.jira && M.jira.sprint, rel = M.jira && M.jira.release;
81
+ const W = windowOf(span, now, sprint), X = pctOf(W);
82
+ const dated = (r) => day(r.start) || day(r.end) || (r.track && day(r.track.forecast));
83
+ const none = rows.filter((r) => !dated(r));
84
+ const head = (first, sub) => `<div class="tg-r tg-h"><div class="tg-n">${first}${sub ? `<small>${sub}</small>` : ''}</div><div class="tg-p">${W.ticks.map((k) => `<span style="left:${X(k.at).toFixed(2)}%"><b>${esc(k.label)}</b>${k.sub ? `<small>${esc(k.sub)}</small>` : ''}</span>`).join('')}</div></div>`;
85
+ const ov = overlay(W, X, now, sprint, rel);
86
+ let body = '';
87
+ if (span === 'sprint') {
88
+ const by = rows.map((r) => ({ r, tk: ((r.track && r.track.tickets) || []).filter((t) => sprint && t.sprint === sprint.name) })).filter((x) => x.tk.length);
89
+ const sa = sprint && day(sprint.start), sb = sprint && day(sprint.end);
90
+ if (!sprint) body = '<p class="tg-empty">No sprint is on record. A sprint appears when an agent session has read Jira for this board.</p>';
91
+ else if (!by.length) body = `<p class="tg-empty">No ticket of the initiatives on screen is in ${esc(sprint.name)}.</p>`;
92
+ else body = by.map(({ r, tk }) => `<div class="tg-sec"><button type="button" class="tg-st" data-key="${esc(r.key)}"><b>${esc(r.title)}</b><span>${tk.length} ${tk.length === 1 ? 'ticket' : 'tickets'} in ${esc(sprint.name)}</span></button></div>`
93
+ + tk.map((t) => `<div class="tg-r"><button type="button" class="tg-n tg-tk" data-tk="${esc(t.key)}" data-ini="${esc(r.key)}"><b>${esc(t.key)}</b><small>${esc(t.title)}</small></button><div class="tg-p">${ov}${sa && sb ? `<span class="tg-bar tk ${esc(t.cls || 'td')}" style="left:${X(sa).toFixed(2)}%;width:${(X(sb) - X(sa)).toFixed(2)}%"><em><strong>${esc(t.status)}</strong>${t.blocked ? ' · blocked' : ''}</em></span>` : ''}</div></div>`).join('')).join('');
94
+ return { html: `<div class="tg" data-span="sprint">${head('Ticket', sprint ? esc(sprint.name) : '')}${body}</div>`, none: [] };
95
+ }
96
+ if (span === 'quarter') {
97
+ body = rows.filter(dated).map((r) => `<div class="tg-r"><button type="button" class="tg-n ini2" data-key="${esc(r.key)}"><b>${esc(r.title)}</b><small>${esc([r.owner, r.track ? r.track.label : r.stage].filter(Boolean).join(' · '))}</small></button><div class="tg-p">${ov}${barHtml(r, X, now)}</div></div>`).join('');
98
+ return { html: `<div class="tg" data-span="quarter">${head('Initiative', '')}${body || '<p class="tg-empty">No initiative on screen has a date on record.</p>'}<div class="tg-lg"><span><i class="k dn"></i>done (Jira or the record)</span><span><i class="k pl"></i>PMOS plan</span><span><i class="k fc"></i>Jira forecast</span>${sprint ? `<span><i class="k sb"></i>${esc(sprint.name)}</span>` : ''}${rel ? `<span><i class="k rl"></i>${esc(rel.name)} · ${esc(rel.at)}</span>` : ''}</div></div>`, none };
99
+ }
100
+ // the longer spans group by theme: the objective of each initiative's KR, or the health budgets
101
+ const themes = new Map();
102
+ for (const r of rows) { const t = r.theme || { key: 'none', label: 'No anchor' }; if (!themes.has(t.key)) themes.set(t.key, { ...t, rows: [] }); themes.get(t.key).rows.push(r); }
103
+ const T = [...themes.values()];
104
+ if (span === 'half' || span === 'year') {
105
+ body = T.map((t, i) => {
106
+ const tone = THEME_TONES[i % THEME_TONES.length], dr = t.rows.filter(dated), late = t.rows.filter((r) => r.late).length, risk = t.rows.filter((r) => r.status === 'at risk').length;
107
+ return `<div class="tg-r tg-th"><div class="tg-n"><b><i class="tg-sw" style="background:${tone}"></i>${esc(t.label)}</b><small>${t.rows.length} ${t.rows.length === 1 ? 'initiative' : 'initiatives'}${late ? ' · ' + late + ' late' : ''}${risk ? ' · ' + risk + ' at risk' : ''}</small></div><div class="tg-p tg-stack">${ov}${dr.map((r) => `<button type="button" class="tg-line" data-key="${esc(r.key)}" aria-label="${esc(r.title)}">${barHtml(r, X, now, { label: true, tone })}</button>`).join('') || '<span class="tg-nod">No dates on record</span>'}</div></div>`;
108
+ }).join('');
109
+ return { html: `<div class="tg" data-span="${span}">${head('Theme', T.length + ' ' + (T.length === 1 ? 'theme' : 'themes') + ' · ' + rows.length + ' initiatives')}${body}<div class="tg-ft">Bars show initiatives inside their theme. The darker part is done. Switch to Quarter to see one row per initiative.</div></div>`, none };
110
+ }
111
+ // 2 yr and 5 yr: themes only, as one phase from the earliest start to the latest end on record; past 18 months is directional
112
+ const far = addMonths(now, 18), fx = X(far);
113
+ body = T.map((t, i) => {
114
+ const tone = THEME_TONES[i % THEME_TONES.length], ds = t.rows.flatMap((r) => [day(r.start), day(r.end), r.track && day(r.track.forecast)]).filter(Boolean).sort((a, b) => a - b);
115
+ const done = t.rows.filter((r) => r.track && (r.track.key === 'monitor' || r.track.key === 'evaluate')).length;
116
+ const ph = ds.length ? `<button type="button" class="tg-phase" data-tgtheme="${esc(t.key)}" style="left:${X(ds[0]).toFixed(2)}%;width:${Math.max(1.5, X(ds[ds.length - 1]) - X(ds[0])).toFixed(2)}%;--tone:${tone}"><b>${esc(t.label)}</b><small>${t.rows.length - done} active · ${done} shipped</small></button>` : '<span class="tg-nod">No dates on record</span>';
117
+ return `<div class="tg-r tg-th"><div class="tg-n"><b><i class="tg-sw" style="background:${tone}"></i>${esc(t.label)}</b><small>${t.rows.length} ${t.rows.length === 1 ? 'initiative' : 'initiatives'}</small></div><div class="tg-p">${ov}${fx < 100 ? `<i class="tg-dir" style="left:${fx.toFixed(2)}%"></i>` : ''}${ph}</div></div>`;
118
+ }).join('');
119
+ return { html: `<div class="tg" data-span="${span}">${head('Theme', 'what each theme is for')}${body}<div class="tg-ft">Only themes and their span of dates at this zoom. Hatched means beyond 18 months: directional, not committed. Open a theme to see its initiatives at the Year span.</div></div>`, none };
120
+ }
@@ -0,0 +1,33 @@
1
+ /* pm/bd-stages.js — the Board's help on the lifecycle and the timeline (initiative premium-agreed-design, B1 B2).
2
+ * Six stages and two milestones (◆), what finishes each and where its count comes from, as the Agreed design's "What finishes each step"
3
+ * frame draws it; and the timeline's spans, as its "The longer the span, the higher the grouping" frame draws it. Pure markup; no reads. */
4
+ import { esc } from './premium-shell.js';
5
+
6
+ export const STEP_HELP = [
7
+ ['Triage', false, 'BRD', 'Business case, who asked, problem, success measure', 'PMOS'],
8
+ ['Discover', false, 'PRD', 'Problem, users, evidence, scope, success metric, risks', 'PMOS (the PRD)'],
9
+ ['Plan', false, 'Scope, timeline and work breakdown', 'Scope set, timeline set, tickets pushed to Jira (your Commit)', 'PMOS, then Jira'],
10
+ ['Prioritize', false, 'Ranked on the roadmap', 'A KR or health budget named, rank set', 'PMOS (OKRs)'],
11
+ ['Build', false, 'Features delivered', 'Story points or tickets done', 'Jira'],
12
+ ['Deliver', true, 'Release shipped, your sign-off', 'Release tickets done, release notes, your sign-off', 'Jira and PMOS'],
13
+ ['Monitor', false, 'Outcome report', 'Days of data against the target, then the report', 'Metrics sources'],
14
+ ['Evaluate', true, 'Keep, iterate or stop', 'The report reviewed, the evaluation, your verdict', 'PMOS'],
15
+ ];
16
+ export const SPAN_HELP = [
17
+ ['Sprint', '2 weeks', 'Jira tickets inside each initiative', 'Tickets, status, blockers'],
18
+ ['Quarter', '3 months', 'One row per initiative', 'Stage, output progress, plan against the Jira forecast'],
19
+ ['Half · Year', '6–12 months', 'Themes, with their initiatives as bars inside', 'Which initiatives carry each theme, milestones'],
20
+ ['2 yr · 5 yr', '2–5 years', 'Themes only, as phases', 'Where each theme is heading, from the dates on record'],
21
+ ];
22
+
23
+ /** The help popover: what finishes each step, and how the timeline groups by span. */
24
+ export function stepsHelpHtml() {
25
+ const row = (cells, cls = '') => `<div class="bd-tr${cls}" role="row">${cells.map((c) => `<span role="cell">${c}</span>`).join('')}</div>`;
26
+ return `<div class="bd-help"><div class="bd-help-h"><h2 id="hSteps">What finishes each step</h2><button type="button" class="cz-ib" data-pop-close aria-label="Close"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg></button></div>`
27
+ + '<p class="bd-help-p">Six stages and two milestones. Every initiative on the Board shows progress toward the output of the step it is in. A milestone is a checkpoint: the initiative waits there until its conditions are met.</p>'
28
+ + `<div class="bd-tbl" role="table" aria-label="What finishes each step">${row(['Step', 'Type', 'Output that finishes it', 'How progress is counted', 'Where the count comes from'], ' th')}`
29
+ + STEP_HELP.map(([n, ms, o, how, src]) => row([`<b>${ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(n)}</b>`, ms ? 'Milestone' : 'Stage', esc(o), esc(how), `<em>${esc(src)}</em>`])).join('') + '</div>'
30
+ + '<h3 class="bd-help-h3">The longer the span, the higher the grouping</h3><p class="bd-help-p">The timeline changes what a row is as you zoom out. An initiative belongs to the theme of its anchor: the objective of its KR, or the health budgets.</p>'
31
+ + `<div class="bd-tbl bd-tbl4" role="table" aria-label="Timeline spans">${row(['Span', 'Covers', 'Rows are', 'You see'], ' th')}`
32
+ + SPAN_HELP.map(([s, c, r, y]) => row([`<b>${esc(s)}</b>`, `<em>${esc(c)}</em>`, esc(r), esc(y)])).join('') + '</div></div>';
33
+ }