create-pmos 0.397.0 → 0.398.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 (145) hide show
  1. package/package.json +13 -13
  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/briefing-premium-adddoc-test.js +101 -52
  8. package/workspace/briefing-premium-board-test.js +252 -128
  9. package/workspace/briefing-premium-calendar-2-test.js +135 -198
  10. package/workspace/briefing-premium-calendar-3-test.js +143 -418
  11. package/workspace/briefing-premium-calendar-test.js +86 -196
  12. package/workspace/briefing-premium-doc-edit-test.js +95 -83
  13. package/workspace/briefing-premium-initiative-test.js +159 -296
  14. package/workspace/briefing-premium-insights-test.js +337 -219
  15. package/workspace/briefing-premium-metrics-test.js +53 -97
  16. package/workspace/briefing-premium-products-test.js +40 -27
  17. package/workspace/briefing-premium-sources-test.js +66 -48
  18. package/workspace/briefing-premium-test.js +150 -647
  19. package/workspace/briefing-premium-work-test.js +88 -283
  20. package/workspace/changelog.json +12 -0
  21. package/workspace/fixtures/board-premium-trail.js +32 -0
  22. package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
  23. package/workspace/guide/briefing-premium.md +3 -1
  24. package/workspace/guide/home.md +47 -0
  25. package/workspace/guide/index.md +1 -0
  26. package/workspace/lib/agent-roles.js +71 -0
  27. package/workspace/lib/board-premium.js +85 -19
  28. package/workspace/lib/board-trail.js +223 -0
  29. package/workspace/lib/home-work-item.js +58 -0
  30. package/workspace/lib/insights-goals.js +196 -0
  31. package/workspace/lib/insights-premium.js +62 -14
  32. package/workspace/lib/insights-records.js +101 -0
  33. package/workspace/lib/jira-tickets.js +1 -1
  34. package/workspace/lib/route-modules.js +4 -0
  35. package/workspace/lib/routes-board-trail.js +33 -0
  36. package/workspace/lib/routes-home-desk.js +176 -0
  37. package/workspace/lib/routes-insights-premium.js +12 -3
  38. package/workspace/lib/routes-insights-records.js +129 -0
  39. package/workspace/lib/routes-notes.js +1 -0
  40. package/workspace/lib/routes-viewer.js +108 -0
  41. package/workspace/lib/transcript-steps.js +123 -0
  42. package/workspace/lib/viewer-meeting.js +205 -0
  43. package/workspace/lib/viewer-report.js +89 -0
  44. package/workspace/package-lock.json +2 -2
  45. package/workspace/package.json +1 -1
  46. package/workspace/premium-board-actions-test.js +85 -75
  47. package/workspace/premium-briefing-depth-test.js +66 -53
  48. package/workspace/premium-chat-attach-test.js +54 -63
  49. package/workspace/premium-chat-chart-tab-test.js +35 -37
  50. package/workspace/premium-chat-context-test.js +19 -18
  51. package/workspace/premium-chat-goal-view-test.js +23 -23
  52. package/workspace/premium-chat-notes-test.js +26 -31
  53. package/workspace/premium-chat-report-tab-test.js +32 -28
  54. package/workspace/premium-chat-term-test.js +16 -16
  55. package/workspace/premium-chat-viewer-test.js +60 -59
  56. package/workspace/premium-core-doc-issue-test.js +50 -43
  57. package/workspace/premium-html-viewer-test.js +14 -17
  58. package/workspace/premium-phone-card-test.js +7 -2
  59. package/workspace/premium-phone-room-test.js +41 -35
  60. package/workspace/premium-report-read-test.js +115 -197
  61. package/workspace/premium-viewer-download-test.js +19 -22
  62. package/workspace/premium-viewer-flicker-test.js +11 -16
  63. package/workspace/premium-viewer-share-test.js +6 -9
  64. package/workspace/premium-viewer-test.js +41 -60
  65. package/workspace/premium-vw-backlog-test.js +53 -33
  66. package/workspace/premium-vw-cal-test.js +82 -128
  67. package/workspace/premium-vw-copy-test.js +17 -33
  68. package/workspace/premium-vw-doc-test.js +11 -10
  69. package/workspace/premium-vw-item-test.js +50 -49
  70. package/workspace/premium-vw-jira-test.js +53 -27
  71. package/workspace/premium-vw-meet-test.js +118 -187
  72. package/workspace/premium-vw-notes-test.js +85 -108
  73. package/workspace/premium-vw-rec-test.js +72 -194
  74. package/workspace/premium-vw-slides-test.js +46 -50
  75. package/workspace/premium-welcome-test.js +3 -2
  76. package/workspace/premium-work-depth-test.js +61 -53
  77. package/workspace/public/pm/bd-acts.js +305 -0
  78. package/workspace/public/pm/bd-span.js +186 -82
  79. package/workspace/public/pm/bd-stages.js +25 -11
  80. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  81. package/workspace/public/pm/c3-md.js +3 -395
  82. package/workspace/public/pm/c3-phone-detail.js +1 -1
  83. package/workspace/public/pm/c3-phone-model.js +3 -68
  84. package/workspace/public/pm/chat-term.js +3 -3
  85. package/workspace/public/pm/cozy-board.css +497 -230
  86. package/workspace/public/pm/cozy-home.css +570 -142
  87. package/workspace/public/pm/cozy-home.js +5 -3
  88. package/workspace/public/pm/cozy-insights.css +296 -167
  89. package/workspace/public/pm/cozy-md.js +396 -0
  90. package/workspace/public/pm/cozy-nav.js +17 -6
  91. package/workspace/public/pm/cozy-placeholder.js +26 -0
  92. package/workspace/public/pm/cozy-viewer.css +3 -3
  93. package/workspace/public/pm/cozy-viewer.js +144 -0
  94. package/workspace/public/pm/cozy-vw.css +485 -0
  95. package/workspace/public/pm/cozy.css +83 -1
  96. package/workspace/public/pm/home-adddoc.js +48 -0
  97. package/workspace/public/pm/home-app.js +905 -0
  98. package/workspace/public/pm/home-around.js +515 -0
  99. package/workspace/public/pm/home-chat.js +459 -0
  100. package/workspace/public/pm/home-data.js +312 -0
  101. package/workspace/public/pm/home-draft.js +68 -0
  102. package/workspace/public/pm/home-more.js +249 -0
  103. package/workspace/public/pm/home-phone-card.js +109 -0
  104. package/workspace/public/pm/home-work.js +519 -0
  105. package/workspace/public/pm/phone-moment.js +69 -0
  106. package/workspace/public/pm/pm-work-view.js +1 -1
  107. package/workspace/public/pm/premium-attach.js +4 -0
  108. package/workspace/public/pm/premium-board.js +423 -394
  109. package/workspace/public/pm/premium-chart-tab.js +110 -62
  110. package/workspace/public/pm/premium-deck.js +3 -3
  111. package/workspace/public/pm/premium-first.js +25 -21
  112. package/workspace/public/pm/premium-insights.js +792 -568
  113. package/workspace/public/pm/premium-meeting.js +61 -549
  114. package/workspace/public/pm/premium-notes.js +1 -1
  115. package/workspace/public/pm/premium-report-frame.css +20 -0
  116. package/workspace/public/pm/premium-report-read.js +509 -480
  117. package/workspace/public/pm/premium-report-tab.js +87 -63
  118. package/workspace/public/pm/premium-shell.js +72 -119
  119. package/workspace/public/pm/premium-viewer.js +22 -1
  120. package/workspace/public/pm/premium-vw-cal.js +187 -48
  121. package/workspace/public/pm/premium-vw-doc.css +6 -0
  122. package/workspace/public/pm/premium-vw-doc.js +40 -2
  123. package/workspace/public/pm/premium-vw-file.js +2 -2
  124. package/workspace/public/pm/premium-vw-meet.js +6 -83
  125. package/workspace/public/pm/premium-vw-mtg.js +731 -0
  126. package/workspace/public/pm/premium-vw-notes.js +56 -69
  127. package/workspace/public/pm/premium-vw-open.js +35 -0
  128. package/workspace/public/pm/premium-vw-page.js +16 -0
  129. package/workspace/public/pm/premium-vw-rec.js +11 -218
  130. package/workspace/public/pm/premium-vw-slides.css +5 -0
  131. package/workspace/public/pm/premium-vw-slides.js +44 -8
  132. package/workspace/public/pm/term-view.js +22 -0
  133. package/workspace/public/premium-board.html +28 -70
  134. package/workspace/public/premium-initiative.html +8 -48
  135. package/workspace/public/premium-insights.html +22 -60
  136. package/workspace/public/premium-viewer.html +20 -0
  137. package/workspace/public/premium.html +16 -107
  138. package/workspace/server.js +18 -3
  139. package/workspace/test-files.json +1 -0
  140. package/workspace/test-lists/home-libs.json +9 -0
  141. package/workspace/test-lists/premium-report-read.json +1 -1
  142. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  143. package/workspace/test-lists/premium-vw-notes.json +1 -1
  144. package/workspace/public/pm/premium-work.js +0 -729
  145. package/workspace/public/pm/premium.js +0 -1146
@@ -0,0 +1,89 @@
1
+ 'use strict';
2
+ /* viewer-report.js — the three checks the Viewer's report panel shows before Issue (initiative premium-agreed-design, area viewer;
3
+ * ReportPanel.dc.html AgRptIssue: "All 3 sources reached · data from Oct 19", "5 slides, every section filled", "The 81% figure is 2 days old.
4
+ * Refresh it first?").
5
+ *
6
+ * issueChecks(markdown, { now, slot }) → [{ id, ok, text }] pure: the report's own text, read as it is
7
+ *
8
+ * sources The draft's "Sources reached and not reached" section (lib/report-draft.js writes it): every source reached, or the ones that
9
+ * were not, by name. The data date is the newest "as of" date the text names, else the cycle's date (slot).
10
+ * sections Each "## " section holds words. An empty one ("—", "none", or nothing) is named.
11
+ * figures The oldest figure that carries its date ("as of 2026-10-19", "Data: 19 Oct 2026"): its age in days. A figure is a number with a
12
+ * unit or a percent sign on the same line. With no dated figure the check passes and says so.
13
+ * A check that passes has ok: true; ok: false is a warning the PM reads before pressing Issue it. Nothing blocks the press. */
14
+
15
+ const MON = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
16
+ const MONN = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
17
+ const body = (t) => String(t || '').replace(/\r/g, '').replace(/^---\n[\s\S]*?\n---\n?/, '');
18
+ const DAY = 86400000;
19
+ /** "Oct 19", from a date in ms. */
20
+ const short = (ms) => { const d = new Date(ms); return MONN[d.getUTCMonth()] + ' ' + d.getUTCDate(); };
21
+
22
+ /** Every date a line names, in ms (UTC midnight): 2026-10-19, 19 Oct 2026, 19 October 2026, Oct 19 2026. */
23
+ function datesIn(line) {
24
+ const out = [];
25
+ for (const m of String(line).matchAll(/\b(\d{4})-(\d{2})-(\d{2})\b/g)) out.push(Date.UTC(+m[1], +m[2] - 1, +m[3]));
26
+ for (const m of String(line).matchAll(/\b(\d{1,2})\s+([A-Za-z]{3,9})\.?\s+(\d{4})\b/g)) { const i = MON.indexOf(m[2].slice(0, 3).toLowerCase()); if (i >= 0) out.push(Date.UTC(+m[3], i, +m[1])); }
27
+ for (const m of String(line).matchAll(/\b([A-Za-z]{3,9})\.?\s+(\d{1,2}),?\s+(\d{4})\b/g)) { const i = MON.indexOf(m[1].slice(0, 3).toLowerCase()); if (i >= 0) out.push(Date.UTC(+m[3], i, +m[2])); }
28
+ return out.filter(Number.isFinite);
29
+ }
30
+ /** The sections of the text: [{ h, lines }]. The text before the first "## " is not a section. */
31
+ function sectionsOf(text) {
32
+ const out = []; let cur = null;
33
+ for (const l of body(text).split('\n')) {
34
+ const h = /^##\s+(.*)$/.exec(l);
35
+ if (h) { cur = { h: h[1].trim(), lines: [] }; out.push(cur); continue; }
36
+ if (cur) cur.lines.push(l);
37
+ }
38
+ return out;
39
+ }
40
+ const filled = (lines) => lines.some((l) => { const t = l.replace(/<!--.*?-->/g, '').replace(/^[\s>*\-–—|:]+$/, '').trim(); return t && !/^(none|n\/a|tbd|todo|—|-)\.?$/i.test(t.replace(/^[-*]\s+/, '')); });
41
+
42
+ function sourcesCheck(S, text, slot, now) {
43
+ const src = S.find((s) => /^sources\b/i.test(s.h));
44
+ const all = body(text).split('\n');
45
+ const asOf = all.filter((l) => /\bas of\b|\bdata\s*:/i.test(l)).flatMap(datesIn).filter((t) => t <= now + DAY);
46
+ const slotMs = /^\d{4}-\d{2}-\d{2}$/.test(String(slot || '')) ? Date.parse(slot + 'T00:00:00Z') : null;
47
+ const dataAt = asOf.length ? Math.max(...asOf) : slotMs;
48
+ const from = dataAt ? ' · data from ' + short(dataAt) : '';
49
+ if (!src) return { id: 'sources', ok: true, text: 'The report names no sources section' + from };
50
+ let part = '', reached = [], missed = [];
51
+ for (const l of src.lines) {
52
+ if (/^\*\*\s*reached\s*\*\*/i.test(l.trim())) { part = 'r'; continue; }
53
+ if (/^\*\*\s*not reached\s*\*\*/i.test(l.trim())) { part = 'n'; continue; }
54
+ const b = /^\s*[-*]\s+(.*)$/.exec(l); if (!b || /^none\.?$/i.test(b[1].trim())) continue;
55
+ if (part === 'n') missed.push(b[1].split(':')[0].trim()); else reached.push(b[1].trim());
56
+ }
57
+ const n = reached.length + missed.length;
58
+ if (!n) return { id: 'sources', ok: true, text: 'No sources are listed' + from };
59
+ if (!missed.length) return { id: 'sources', ok: true, text: (n === 1 ? 'The 1 source' : 'All ' + n + ' sources') + ' reached' + from };
60
+ return { id: 'sources', ok: false, text: missed.length + ' of ' + n + (n === 1 ? ' source' : ' sources') + ' not reached: ' + missed.slice(0, 3).join(', ') + from };
61
+ }
62
+ function sectionsCheck(S) {
63
+ if (!S.length) return { id: 'sections', ok: false, text: 'The report has no sections yet' };
64
+ const empty = S.filter((s) => !filled(s.lines)).map((s) => s.h);
65
+ const slides = S.length + 1; // a title slide, then one per section (premium-report-read.js slides)
66
+ if (!empty.length) return { id: 'sections', ok: true, text: slides + ' slides, every section filled' };
67
+ return { id: 'sections', ok: false, text: (empty.length === 1 ? '1 section is empty: ' : empty.length + ' sections are empty: ') + empty.slice(0, 3).join(', ') };
68
+ }
69
+ function figuresCheck(text, now) {
70
+ let oldest = null;
71
+ for (const l of body(text).split('\n')) {
72
+ if (!/\bas of\b|\bdata\s*:|\bmeasured\b/i.test(l)) continue;
73
+ const fig = /(\d+(?:[.,]\d+)?\s?%|\d+(?:[.,]\d+)?\s?(?:pp|ms|s|h|d|days|pts|points)\b)/i.exec(l.replace(/\b\d{4}-\d{2}-\d{2}\b/g, ' '));
74
+ const ds = datesIn(l).filter((t) => t <= now + DAY);
75
+ if (!fig || !ds.length) continue;
76
+ const at = Math.min(...ds);
77
+ if (!oldest || at < oldest.at) oldest = { at, fig: fig[1].replace(/\s+/g, '') };
78
+ }
79
+ if (!oldest) return { id: 'figures', ok: true, text: 'No figure carries an older date' };
80
+ const days = Math.floor((Date.UTC(new Date(now).getUTCFullYear(), new Date(now).getUTCMonth(), new Date(now).getUTCDate()) - oldest.at) / DAY);
81
+ if (days <= 1) return { id: 'figures', ok: true, text: 'The ' + oldest.fig + ' figure is from ' + (days <= 0 ? 'today' : 'yesterday') };
82
+ return { id: 'figures', ok: false, text: 'The ' + oldest.fig + ' figure is ' + days + ' days old. Refresh it first?' };
83
+ }
84
+ function issueChecks(markdown, { now = Date.now(), slot = '' } = {}) {
85
+ const S = sectionsOf(markdown);
86
+ return [sourcesCheck(S, markdown, slot, now), sectionsCheck(S), figuresCheck(markdown, now)];
87
+ }
88
+
89
+ module.exports = { issueChecks, sectionsOf, datesIn };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.397.0",
3
+ "version": "0.398.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.397.0",
9
+ "version": "0.398.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.397.0",
3
+ "version": "0.398.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  /* premium-board-actions-test.js — the board presses of the premium Board and initiative pages (initiative premium-board-actions; planning/prd/premium-board-actions-prd.md A1 to A12).
4
- * A real server on a scratch `team` repository (planning/initiatives, pmos/state), never the PMOS checkout. The real pages press the real routes:
4
+ * A real server on a scratch `team` repository (planning/initiatives, pmos/state), never the PMOS checkout. The real pages press the real routes.
5
+ * Re-pointed for the Agreed Board (premium-agreed-design): the Board's presses are the plain versions of pm/bd-acts.js in the side panel.
5
6
  * T triage (accept, decline) · N New initiative · M move and Undo · L hold, resume, cancel, reopen, archive, restore · I the initiative page's bar
6
7
  * S the PMOS-self board (a model answer, since only the embedded checkout is self) · P the POST allow-list and the refusals · F floors */
7
8
  const fs = require('fs');
@@ -74,104 +75,111 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
74
75
  };
75
76
  const P = await open('/premium-board.html');
76
77
  const p = P.page;
78
+ // re-pointed for the Agreed Board (premium-agreed-design): the presses live in plain versions in the side panel (pm/bd-acts.js), tagged
79
+ // "Waiting for design"; a row's actions open from the panel's ⋯; the toast is #bdToast with its Undo; the old dialog never opens.
77
80
  const listed = (id) => p.evaluate((x) => [...document.querySelectorAll('#ibBody .ini2')].some((b) => b.dataset.key === 'board:' + x), id);
78
- const toastIs = (re) => until(() => p.evaluate((s) => { const t = document.querySelector('#toast'); return t.classList.contains('on') && new RegExp(s).test(t.textContent) ? t.textContent : null; }, re.source));
79
- const dlgOn = async () => { const v = await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(800); return v; };
80
- const dlgOff = () => until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
81
- ok('A2 the New asks card lists both asks with Accept and Decline', await until(() => p.evaluate(() => document.querySelectorAll('#cAsks .baa').length === 2 && document.querySelectorAll('#cAsks [data-ask^="acc:"]').length === 2)), await p.evaluate(() => (document.querySelector('#asksHost') || {}).textContent));
82
- ok('A2 an ask shows its source, not an invented name', await p.evaluate(() => /Email from Rina/.test(document.querySelector('#cAsks').textContent) && !/demo/i.test(document.querySelector('#cAsks').textContent)));
81
+ const toastIs = (re) => until(() => p.evaluate((s) => { const t = document.querySelector('#bdToast'); return t && !t.hidden && new RegExp(s).test(t.textContent) ? t.textContent : null; }, re.source));
82
+ const peekOn = (title) => until(() => p.evaluate((t) => { const k = document.querySelector('#peek'); return k && !k.hidden && (document.querySelector('#pkTitle') || {}).textContent === t && !!k.querySelector('.bd-wtag'); }, title));
83
+ const noDlg = () => p.evaluate(() => !document.querySelector('#dlg.on'));
84
+ const acts = async (id) => { await until(() => listed(id), 30000); await p.click(`#ibBody .ini2[data-key="board:${id}"]`); await until(() => p.evaluate(() => !!document.querySelector('#peek [data-pk="acts"]'))); await p.click('#peek [data-pk="acts"]'); return peekOn('Initiative actions'); };
85
+ await until(() => p.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0), 30000);
86
+ await p.click('#chAsks');
87
+ ok('A2 the New asks panel lists both asks with Accept and Decline', await until(() => p.evaluate(() => document.querySelectorAll('#peek .bd-ask').length === 2 && document.querySelectorAll('#peek [data-act="accept"]').length === 2)), await p.evaluate(() => (document.querySelector('#peek') || {}).textContent));
88
+ ok('A2 an ask shows its source, not an invented name, and the panel is tagged "Waiting for design"', await p.evaluate(() => /Email from Rina/.test(document.querySelector('#peek').textContent) && !/demo/i.test(document.querySelector('#peek').textContent) && !!document.querySelector('#peek .bd-wtag')));
83
89
 
84
90
  /* T triage */
85
- if (await p.evaluate(() => document.querySelector('#popAsks').hidden)) await p.click('#chAsks'); // the Agreed design keeps the asks behind the New asks chip (premium-agreed-design)
86
- await p.click(`#cAsks [data-ask="acc:${a1.body.ask.id}"]`); await dlgOn();
87
- const anc = await until(() => p.evaluate(() => { const s = document.querySelector('#paNA'); return s && s.tagName === 'SELECT' && !s.disabled ? [...s.options].map((o) => o.value) : null; }));
91
+ await p.click(`#peek [data-act="accept"][data-id="${a1.body.ask.id}"]`); await peekOn('Accept ask');
92
+ const anc = await until(() => p.evaluate(() => { const s = document.querySelector('#peek select[name="anchor"]'); return s && !s.disabled ? [...s.options].map((o) => o.value) : null; }));
88
93
  ok('T1 Accept opens the form with the anchors the board declares', !!anc && anc.includes('health:tech'), JSON.stringify(anc));
89
- await p.fill('#paNT', ''); await p.click('#paNGo');
90
- ok('T2 an empty title is refused on the page, before any press', await p.evaluate(() => /Give it a title/.test(document.querySelector('#paNM').textContent)) && !P.posts.some((x) => x.path === '/api/boards/asks/accept'));
91
- await p.fill('#paNT', 'Daily CSV of failed payouts'); await p.selectOption('#paNA', 'health:tech'); await p.click('#paNGo');
94
+ await p.fill('#peek input[name="title"]', ''); await p.click('#peek form[data-form="new"] [type="submit"]');
95
+ ok('T2 an empty title is refused on the page, before any press', await p.evaluate(() => /Give it a title/.test(document.querySelector('#formM').textContent)) && !P.posts.some((x) => x.path === '/api/boards/asks/accept'));
96
+ await p.fill('#peek input[name="title"]', 'Daily CSV of failed payouts'); await p.selectOption('#peek select[name="anchor"]', 'health:tech'); await p.click('#peek form[data-form="new"] [type="submit"]');
92
97
  ok('T3 Accept records the accept line and a new initiative, and says so', !!(await toastIs(/accepted in/)) && lines('boards.jsonl').some((l) => l.kind === 'ask-accept' && l.ask === a1.body.ask.id), JSON.stringify(lines('boards.jsonl').map((l) => l.kind)));
93
- await dlgOff();
94
- ok('T4 the accepted ask leaves the card', await until(() => p.evaluate((id) => !document.querySelector(`#cAsks [data-ask="acc:${id}"]`) && document.querySelectorAll('#cAsks .baa').length === 1, a1.body.ask.id)));
95
- if (await p.evaluate(() => document.querySelector('#popAsks').hidden)) await p.click('#chAsks'); // the Agreed design keeps the asks behind the New asks chip (premium-agreed-design)
96
- await p.click(`#cAsks [data-ask="dec:${a2.body.ask.id}"]`); await dlgOn();
97
- ok('T5 Decline waits for a reason', await p.evaluate(() => document.querySelector('#paDGo').disabled));
98
- await p.fill('#paDW', 'Not tied to a goal this quarter'); await p.click('#paDGo');
98
+ await until(() => p.evaluate(() => document.querySelector('#chAsks') && /\b1\b/.test(document.querySelector('#chAsks').textContent)), 30000);
99
+ await p.click('#chAsks');
100
+ ok('T4 the accepted ask leaves the panel', await until(() => p.evaluate((id) => !document.querySelector(`#peek [data-act="accept"][data-id="${id}"]`) && document.querySelectorAll('#peek .bd-ask').length === 1, a1.body.ask.id)));
101
+ await p.click(`#peek [data-act="decline"][data-id="${a2.body.ask.id}"]`); await peekOn('Decline ask');
102
+ await p.click('#peek form[data-form="decline"] [type="submit"]');
103
+ ok('T5 Decline waits for a reason', await p.evaluate(() => document.querySelector('#peek textarea[name="why"]').validity.valueMissing) && !P.posts.some((x) => x.path === '/api/boards/asks/decline'));
104
+ await p.fill('#peek textarea[name="why"]', 'Not tied to a goal this quarter'); await p.click('#peek form[data-form="decline"] [type="submit"]');
99
105
  ok('T6 Decline records the reason in the board ledger', !!(await toastIs(/Ask declined/)) && lines('boards.jsonl').some((l) => l.kind === 'ask-decline' && l.why === 'Not tied to a goal this quarter'));
100
- ok('T7 the card says nothing is left to triage', await until(() => p.evaluate(() => /Nothing new to triage/.test(document.querySelector('#cAsks').textContent))));
106
+ await until(() => p.evaluate(() => /^No new asks|0 new asks/.test((document.querySelector('#chAsks') || {}).textContent.trim())), 30000);
107
+ await p.click('#chAsks');
108
+ ok('T7 the panel says nothing is left to triage', await until(() => p.evaluate(() => /No new ask waits for triage/.test(document.querySelector('#peek').textContent))));
109
+ await p.keyboard.press('Escape');
101
110
 
102
111
  /* N New initiative */
103
112
  ok('N1 New initiative is offered on a team board', await p.evaluate(() => !document.querySelector('#newIni').hidden));
104
- await p.click('#newIni'); await dlgOn();
105
- await until(() => p.evaluate(() => { const s = document.querySelector('#paNA'); return s && !s.disabled; }));
106
- await p.fill('#paNT', 'Partner usage per key'); await p.click('#paNGo');
107
- ok('N2 an unanchored create is refused on the page', await p.evaluate(() => /Choose an anchor/.test(document.querySelector('#paNM').textContent)));
108
- await p.selectOption('#paNA', 'health:tech'); await p.click('#paNGo');
113
+ await p.click('#newIni'); await peekOn('New initiative');
114
+ await until(() => p.evaluate(() => { const s = document.querySelector('#peek select[name="anchor"]'); return s && !s.disabled; }));
115
+ await p.fill('#peek input[name="title"]', 'Partner usage per key'); await p.click('#peek form[data-form="new"] [type="submit"]');
116
+ ok('N2 an unanchored create is refused on the page', await p.evaluate(() => /Choose an anchor/.test(document.querySelector('#formM').textContent)));
117
+ await p.selectOption('#peek select[name="anchor"]', 'health:tech'); await p.click('#peek form[data-form="new"] [type="submit"]');
109
118
  const made = await toastIs(/created in/);
110
119
  const recs = fs.readdirSync(path.join(team, 'planning', 'initiatives'));
111
120
  ok('N3 Create writes an ask, its accept and a new initiative record, as the console does', !!made && recs.some((f) => /partner-usage/.test(f)) && lines('boards.jsonl').some((l) => l.kind === 'ask' && l.line === 'Partner usage per key'), made + ' / ' + recs.join());
112
121
 
113
- /* M move and Undo, from the row's menu */
114
- await dlgOff();
115
- await until(() => listed('pa-one'));
116
- const menuBtn = '#ibBody .inim[data-im="board:pa-one"]';
117
- await p.click(menuBtn);
118
- const items = await until(() => p.evaluate(() => { const m = document.querySelector('.bam2'); return m ? [...m.querySelectorAll('[role="menuitem"] b')].map((b) => b.textContent) : null; }));
119
- ok('M1 the row menu offers the next stage, hold, cancel and archive', !!items && /^Move to /.test(items[0]) && items.includes('Put on hold') && items.includes('Cancel') && items.includes('Archive'), JSON.stringify(items));
120
- ok('M2 the menu takes the focus and the arrow keys move it; Escape closes it and gives the focus back', await (async () => {
121
- const f0 = await p.evaluate(() => document.activeElement.closest('.bam2') !== null);
122
- await p.keyboard.press('ArrowDown'); const f1 = await p.evaluate(() => [...document.querySelectorAll('.bam2 [role="menuitem"]')].indexOf(document.activeElement));
123
- await p.keyboard.press('Escape'); const gone = await p.evaluate(() => !document.querySelector('.bam2') && document.activeElement.matches('.inim'));
124
- return f0 && f1 === 1 && gone;
125
- })());
122
+ /* M move and Undo, from the panel's ⋯ */
123
+ ok('M1 the initiative actions offer the next stage, hold, cancel and archive', await acts('pa-one') && await p.evaluate(() => { const L = [...document.querySelectorAll('#peek .bd-ai b')].map((b) => b.textContent); return /^Move to /.test(L[0]) && L.includes('Put on hold') && L.includes('Cancel') && L.includes('Archive'); }), await p.evaluate(() => document.querySelector('#peek').textContent));
124
+ await p.keyboard.press('Escape');
125
+ ok('M2 Escape closes the actions and gives the focus back to the row', await until(() => p.evaluate(() => document.querySelector('#peek').hidden && !!document.activeElement.closest('#ibBody'))));
126
126
  const from = ready.model.initiatives.list.rows.find((r) => r.id === 'pa-one').acts.stage;
127
- await p.click(menuBtn); await p.click('.bam2 [data-pk^="mv:"]');
127
+ await acts('pa-one'); await p.click('#peek .bd-ai[data-k^="mv:"]');
128
128
  const mv = await toastIs(/^Moved to/);
129
129
  ok('M3 Move records one move line and says what it recorded', !!mv && lines('boards.jsonl').filter((l) => l.kind === 'move' && l.id === 'pa-one').length === 1, mv);
130
- await p.click('#paUndo');
130
+ await p.click('#bdToast .bd-undo');
131
131
  ok('M4 Undo writes the move back', !!(await toastIs(new RegExp('Back in ' + from))) && lines('boards.jsonl').filter((l) => l.kind === 'move' && l.id === 'pa-one').pop().to === from);
132
132
 
133
133
  /* L hold, resume, cancel, reopen, archive, restore */
134
- await until(() => listed('pa-one'));
135
- await p.click(menuBtn);
136
- await p.click('.bam2 [data-pk="hold"]'); await dlgOn();
137
- await p.fill('#paHR', 'Waiting for the Q1 budget'); await tap(p, '#paHB [data-v="two"]'); await p.click('#paHGo');
134
+ await acts('pa-one'); await p.click('#peek .bd-ai[data-k="hold"]'); await peekOn('Put on hold');
135
+ await p.fill('#peek textarea[name="why"]', 'Waiting for the Q1 budget'); await p.check('#peek input[name="back"][value="two"]'); await p.click('#peek form[data-form="hold"] [type="submit"]');
138
136
  const hl = await until(() => lines('lifecycle.jsonl').find((l) => l.initiative_id === 'pa-one' && l.state === 'on-hold'));
139
- ok('L1 Put on hold records one on-hold line with the reason and a check-back day', !!hl && hl.reason === 'Waiting for the Q1 budget' && /^\d{4}-\d{2}-\d{2}$/.test(hl.back || ''), JSON.stringify(hl) + ' ' + await p.evaluate(() => (document.querySelector('#paHM') || {}).textContent));
140
- ok('L2 the row then says On hold and its menu offers Resume', await until(async () => { const t = await p.evaluate(() => { const b = document.querySelector('#ibBody .ini2[data-key="board:pa-one"]'); return b ? b.textContent : ''; }); return /On hold/.test(t); }, 30000));
141
- await p.click(menuBtn);
142
- ok('L2 Resume is offered and the moves are not', await until(() => p.evaluate(() => { const m = document.querySelector('.bam2'); return m && !!m.querySelector('[data-pk="resume"]') && !m.querySelector('[data-pk^="mv:"]'); })));
143
- await p.click('.bam2 [data-pk="resume"]');
137
+ ok('L1 Put on hold records one on-hold line with the reason and a check-back day', !!hl && hl.reason === 'Waiting for the Q1 budget' && /^\d{4}-\d{2}-\d{2}$/.test(hl.back || ''), JSON.stringify(hl) + ' ' + await p.evaluate(() => (document.querySelector('#formM') || {}).textContent));
138
+ ok('L2 the row then says On hold', await until(async () => { const t = await p.evaluate(() => { const b = document.querySelector('#ibBody .ini2[data-key="board:pa-one"]'); return b ? b.textContent : ''; }); return /On hold/.test(t); }, 30000));
139
+ await acts('pa-one');
140
+ ok('L2 Resume is offered and the moves are not', await p.evaluate(() => !!document.querySelector('#peek .bd-ai[data-k="resume"]') && !document.querySelector('#peek .bd-ai[data-k^="mv:"]')));
141
+ await p.click('#peek .bd-ai[data-k="resume"]');
144
142
  ok('L3 Resume records an active line', await until(() => { const L = lines('lifecycle.jsonl').filter((l) => l.initiative_id === 'pa-one'); return L.length && L[L.length - 1].state === 'active'; }));
145
143
  await until(() => p.evaluate(() => { const b = document.querySelector('#ibBody .ini2[data-key="board:pa-one"]'); return b && !/On hold/.test(b.textContent); }), 30000);
146
- await p.click(menuBtn); await p.click('.bam2 [data-pk="cancel"]'); await dlgOn();
147
- ok('L4 Cancel waits for a reason', await p.evaluate(() => document.querySelector('#paCGo').disabled));
148
- await tap(p, '#paCW [data-v="worth"]'); await p.click('#paCGo');
144
+ await acts('pa-one'); await p.click('#peek .bd-ai[data-k="cancel"]'); await peekOn('Cancel the initiative');
145
+ await p.click('#peek form[data-form="cancel"] [type="submit"]');
146
+ ok('L4 Cancel waits for a reason', await p.evaluate(() => /Pick a reason/.test(document.querySelector('#formM').textContent)) && !lines('lifecycle.jsonl').some((l) => l.initiative_id === 'pa-one' && l.state === 'cancelled'));
147
+ await p.check('#peek input[name="why"][value="Not worth it now"]'); await p.click('#peek form[data-form="cancel"] [type="submit"]');
149
148
  ok('L4 Cancel records a cancelled line with the reason', await until(() => lines('lifecycle.jsonl').some((l) => l.initiative_id === 'pa-one' && l.state === 'cancelled' && l.reason === 'Not worth it now')));
150
- ok('L5 the row leaves the list and the fold counts it', await until(() => p.evaluate(() => !document.querySelector('#ibBody .inil .ini2[data-key="board:pa-one"]') && /1 cancelled/.test((document.querySelector('#goneT') || {}).textContent || '')), 30000));
151
- await p.click('#goneT'); await p.click('#ibBody .inim[data-im="board:pa-one"]');
152
- ok('L6 a cancelled row offers Reopen only', await until(() => p.evaluate(() => { const m = document.querySelector('.bam2'); return m && [...m.querySelectorAll('[data-pk]')].map((b) => b.dataset.pk).join() === 'reopen'; })));
153
- await p.click('.bam2 [data-pk="reopen"]');
149
+ // re-pointed for the Agreed design: the track's footer carries only the fold and the sort (AgBoard), so the count moved to the ⋯ menu's item
150
+ ok('L5 the row leaves the track and the ⋯ menu\'s Cancelled and archived item counts it', await until(() => p.evaluate(() => !document.querySelector('#ibBody .bt-l[data-row="board:pa-one"]') && /1 cancelled/.test((document.querySelector('#bdGone') || {}).textContent || '')), 30000));
151
+ await p.click('#moreBtn'); await p.click('#bdGone'); await peekOn('Cancelled and archived');
152
+ ok('L6 a cancelled initiative offers Reopen only', await p.evaluate(() => [...document.querySelectorAll('#peek .bd-ar [data-act]')].map((b) => b.dataset.act).join() === 'reopen'));
153
+ await p.click('#peek [data-act="reopen"]');
154
154
  ok('L6 Reopen records an active line', await until(() => { const L = lines('lifecycle.jsonl').filter((l) => l.initiative_id === 'pa-one'); return L[L.length - 1].state === 'active'; }));
155
155
  await until(() => listed('pa-one'), 30000);
156
- await p.click(menuBtn); await p.click('.bam2 [data-pk="archive"]'); await dlgOn();
157
- await tap(p, '#paAW [data-v="dup"]'); await p.fill('#paAN', 'Same as the CSV export'); await p.click('#paAGo');
156
+ await acts('pa-one'); await p.click('#peek .bd-ai[data-k="archive"]'); await peekOn('Archive the initiative');
157
+ await p.check('#peek input[name="why"][value="Duplicate"]'); await p.fill('#peek textarea[name="note"]', 'Same as the CSV export'); await p.click('#peek form[data-form="archive"] [type="submit"]');
158
158
  ok('L7 Archive records one archive line with the reason', await until(() => lines('boards.jsonl').some((l) => l.kind === 'ini-archive' && l.id === 'pa-one' && l.archived === true && l.reason === 'Duplicate: Same as the CSV export')));
159
- ok('L8 the fold counts it as archived', await until(() => p.evaluate(() => /1 archived/.test((document.querySelector('#goneT') || {}).textContent || '')), 30000));
160
- await p.click('#paUndo');
159
+ ok('L8 the ⋯ menu\'s item counts it as archived', await until(() => p.evaluate(() => /1 archived/.test((document.querySelector('#bdGone') || {}).textContent || '')), 30000));
160
+ await p.click('#bdToast .bd-undo');
161
161
  ok('L9 Undo restores it with a restore line', await until(() => lines('boards.jsonl').some((l) => l.kind === 'ini-archive' && l.id === 'pa-one' && l.archived === false)));
162
+ ok('L10 none of the presses opened the old dialog', await noDlg());
162
163
 
163
- /* I the initiative page's bar */
164
+ /* I the Board's expand link: the initiative is a layout inside Home (premium-agreed-design). Its stage moves and lifecycle presses are in the Overview */
164
165
  const I = await open('/premium-initiative.html?id=pa-one&ws=' + encodeURIComponent(B.ws) + '&board=' + encodeURIComponent(B.id));
165
166
  const ip = I.page;
166
- const bar = await until(() => ip.evaluate(() => { const b = document.querySelector('#iBar'); return b && b.querySelector('[data-pk^="mv:"]') ? [...b.querySelectorAll('button')].map((x) => x.textContent.trim()) : null; }), 60000);
167
- ok('I1 the bar offers the next stage and More', !!bar && bar.some((t) => /^Move to /.test(t)) && bar.includes('More'), JSON.stringify(bar));
167
+ const landed = await until(() => ip.evaluate(() => { const q = new URLSearchParams(location.search); return location.pathname === '/premium.html' && q.get('ini') === 'pa-one' && !!q.get('ws') && !!q.get('board') && !!document.querySelector('.hm-card [data-hm-ov]'); }), 60000);
168
+ ok('I0 the expand link lands on Home with the initiative selected, ws and board kept', !!landed, await ip.evaluate(() => location.href));
169
+ await ip.click('.hm-card [data-hm-ov]');
170
+ const bar = await until(() => ip.evaluate(() => { const v = document.querySelector('#czViewer:not([hidden])'); if (!v || !v.querySelector('[data-ov-move]')) return null; const cur = v.querySelector('[data-ov-move][aria-pressed="true"]'); return { moves: [...v.querySelectorAll('[data-ov-move]')].map((x) => x.dataset.ovMove), cur: cur ? cur.dataset.ovMove : '', life: [...v.querySelectorAll('[data-ov-life]')].map((x) => x.dataset.ovLife) }; }), 60000);
171
+ ok('I1 the Overview offers the stages, the current one pressed, and the lifecycle presses', !!bar && bar.moves.length > 1 && !!bar.cur && bar.moves.indexOf(bar.cur) < bar.moves.length - 1 && bar.life.join() === 'on-hold,cancelled', JSON.stringify(bar) + ' ' + (await ip.evaluate(() => (document.querySelector('#czViewer .cz-vw-body') || {}).innerText || 'no Viewer')).slice(0, 400));
168
172
  const n0 = lines('boards.jsonl').filter((l) => l.kind === 'move').length;
169
- await ip.click('#iBar [data-pk^="mv:"]');
170
- ok('I2 a press on the bar records one move line', await until(() => lines('boards.jsonl').filter((l) => l.kind === 'move').length === n0 + 1));
171
- await ip.click('#iBar [data-im="bar"]');
172
- ok('I3 More lists the lifecycle presses and no move', await until(() => ip.evaluate(() => { const m = document.querySelector('.bam2'); return m && [...m.querySelectorAll('[data-pk]')].map((b) => b.dataset.pk).join() === 'hold,cancel,archive'; })));
173
+ const next = bar ? bar.moves[bar.moves.indexOf(bar.cur) + 1] : '';
174
+ await ip.click(`#czViewer [data-ov-move="${next}"]`);
175
+ ok('I2 a stage press records one move line', await until(() => { const L = lines('boards.jsonl').filter((l) => l.kind === 'move'); return L.length === n0 + 1 && L[L.length - 1].id === 'pa-one' && L[L.length - 1].to === next; }), JSON.stringify(lines('boards.jsonl').filter((l) => l.kind === 'move').slice(-1)));
176
+ ok('I2 the Overview then shows the new stage pressed', await until(() => ip.evaluate((n) => !!document.querySelector(`#czViewer [data-ov-move="${n}"][aria-pressed="true"]`), next)));
177
+ const lif0 = lines('lifecycle.jsonl').length;
178
+ await ip.click('#czViewer [data-ov-life="on-hold"]');
179
+ ok('I3 a lifecycle press asks its reason inline, records nothing yet and opens no browser dialog', await until(() => ip.evaluate(() => !!document.querySelector('#czViewer #ovWhy'))) && lines('lifecycle.jsonl').length === lif0 && !(await ip.evaluate(() => { const d = document.querySelector('#dlg'); return !!(d && d.classList.contains('on')); })));
180
+ await ip.click('#czViewer [data-ov-life-no]');
181
+ ok('I3 Not now takes the question back', await until(() => ip.evaluate(() => !document.querySelector('#czViewer #ovWhy') && !!document.querySelector('#czViewer [data-ov-life="on-hold"]'))));
173
182
  await ip.keyboard.press('Escape');
174
- await ip.click('#paUndo').catch(() => {});
175
183
 
176
184
  /* S the PMOS-self board: the model says self, the page offers no move and no New initiative */
177
185
  {
@@ -180,9 +188,11 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
180
188
  await S.page.route('**/api/board-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: m, as_of: Date.now() }) }));
181
189
  await S.page.reload();
182
190
  await until(() => S.page.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0));
183
- ok('S1 the PMOS-self board names the router in its asks card and hides New initiative', await S.page.evaluate(() => /pmos-router/.test(document.querySelector('#cAsks').textContent) && document.querySelector('#newIni').hidden));
184
- await S.page.click('#ibBody .inim');
185
- ok('S2 its row menu has no move', await until(() => S.page.evaluate(() => { const x = document.querySelector('.bam2'); return x && !x.querySelector('[data-pk^="mv:"]') && !!x.querySelector('[data-pk="hold"]'); })));
191
+ await S.page.click('#chAsks');
192
+ ok('S1 the PMOS-self board names the router in its asks panel and hides New initiative', await until(() => S.page.evaluate(() => /pmos-router/.test(document.querySelector('#peek').textContent) && document.querySelector('#newIni').hidden)));
193
+ await S.page.keyboard.press('Escape');
194
+ await S.page.click('#ibBody .ini2'); await until(() => S.page.evaluate(() => !!document.querySelector('#peek [data-pk="acts"]'))); await S.page.click('#peek [data-pk="acts"]');
195
+ ok('S2 its actions have no move', await until(() => S.page.evaluate(() => { const x = document.querySelector('#peek .bd-alist'); return x && !x.querySelector('[data-k^="mv:"]') && !!x.querySelector('[data-k="hold"]'); })));
186
196
  await S.ctx.close();
187
197
  }
188
198
 
@@ -198,12 +208,12 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
198
208
  /* F floors */
199
209
  {
200
210
  const S = await open('/premium-board.html', { w: 390, h: 844 });
201
- await until(() => S.page.evaluate(() => document.querySelectorAll('#ibBody .inim').length > 0), 30000);
202
- const f = await S.page.evaluate(() => ({ wide: document.documentElement.scrollWidth > innerWidth + 1, small: [...document.querySelectorAll('#ibBody .inim, #cAsks button, #newIni')].filter((b) => b.offsetParent && (b.getBoundingClientRect().width < 44 || b.getBoundingClientRect().height < 44)).map((b) => b.className + ':' + Math.round(b.getBoundingClientRect().width) + 'x' + Math.round(b.getBoundingClientRect().height)) }));
211
+ await until(() => S.page.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0), 30000);
212
+ const f = await S.page.evaluate(() => ({ wide: document.documentElement.scrollWidth > innerWidth + 1, small: [...document.querySelectorAll('#ibBody .ini2, #chAsks, #newIni')].filter((b) => b.offsetParent && (b.getBoundingClientRect().width < 44 || b.getBoundingClientRect().height < 44)).map((b) => b.className + ':' + Math.round(b.getBoundingClientRect().width) + 'x' + Math.round(b.getBoundingClientRect().height)) }));
203
213
  ok('F1 at 390 px there is no sideways scroll and every new control is at least 44 px', !f.wide && !f.small.length, JSON.stringify(f));
204
- await S.page.click('#ibBody .inim');
205
- const mi = await until(() => S.page.evaluate(() => { const L = [...document.querySelectorAll('.bam2 [role="menuitem"]')]; return L.length ? L.every((b) => b.getBoundingClientRect().height >= 44) && document.documentElement.scrollWidth <= innerWidth + 1 : null; }));
206
- ok('F2 the menu items are 44 px tall and the open menu adds no sideways scroll', !!mi);
214
+ await S.page.click('#ibBody .ini2'); await until(() => S.page.evaluate(() => !!document.querySelector('#peek [data-pk="acts"]'))); await S.page.click('#peek [data-pk="acts"]');
215
+ const mi = await until(() => S.page.evaluate(() => { const L = [...document.querySelectorAll('#peek .bd-ai')]; return L.length ? L.every((b) => b.getBoundingClientRect().height >= 44) && document.documentElement.scrollWidth <= innerWidth + 1 : null; }));
216
+ ok('F2 the action rows are 44 px tall and the open sheet adds no sideways scroll', !!mi);
207
217
  await S.ctx.close();
208
218
  }
209
219
  await P.ctx.close(); await I.ctx.close();