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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.397.0",
3
+ "version": "0.398.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -32,6 +32,18 @@
32
32
  "audit"
33
33
  ],
34
34
  "pmosChanges": [
35
+ {
36
+ "v": "0.398.0",
37
+ "at": "2026-10-23T04:45:54.728Z",
38
+ "f": 2,
39
+ "prs": [
40
+ {
41
+ "n": 1012,
42
+ "t": "Rebuild Home, Viewer, Board and Insights to the Agreed design",
43
+ "s": "Rebuild Home, Viewer, Board and Insights to the Agreed design"
44
+ }
45
+ ]
46
+ },
35
47
  {
36
48
  "v": "0.397.0",
37
49
  "at": "2026-10-22T20:10:19.514Z",
@@ -279,18 +291,6 @@
279
291
  "s": "Notes replace the Scratchpad in the premium chat"
280
292
  }
281
293
  ]
282
- },
283
- {
284
- "v": "0.378.0",
285
- "at": "2026-10-21T07:48:19.057Z",
286
- "f": 2,
287
- "prs": [
288
- {
289
- "n": 987,
290
- "t": "Chips for what an answer worked with, main one opens by itself",
291
- "s": "Chips for what an answer worked with, main one opens by itself"
292
- }
293
- ]
294
294
  }
295
295
  ]
296
296
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@d45fce33
2
- assembled: 2026-10-22
1
+ kernel-source: pmos@dde8a9db
2
+ assembled: 2026-10-23
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-10-22T20:10:16Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-23T04:45:51Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-10-22T20:10:16Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-23T04:45:51Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-10-22T20:10:16Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-23T04:45:51Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  Newest first, ISO dates.
4
4
 
5
- ## 2026-10-22
5
+ ## 2026-10-23
6
6
 
7
7
  - Adopted OKF v0.2 (D73).
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
  /* briefing-premium-adddoc-test.js — Add a document on the premium Board and initiative page (initiative briefing-premium-adddoc; planning/prd/briefing-premium-adddoc-prd.md A1 to A8).
4
4
  * Serves the real pages from the real server. The model routes and the add route are answered from fixtures, so nothing is written to this repository; the real
5
- * route is checked only for its refusals. A1 dialog · A3 the press · A4 messages · A5 rows · A7 labels · A8 floors and fidelity */
5
+ * route is checked only for its refusals. The Board's Add a document is the plain side-panel form of the Agreed Board (premium-agreed-design). A1 dialog · A3 the press · A4 messages · A5 rows · A7 labels · A8 floors and fidelity */
6
6
  const path = require('path');
7
7
  const { spawn } = require('child_process');
8
8
  const { findBrowser } = require('./lib/find-browser');
@@ -34,7 +34,8 @@ const CUSTOM = [
34
34
  ];
35
35
  const PAGES = {
36
36
  board: { file: '/premium-board.html', api: '**/api/board-premium*', scope: 'board:w1', mk: (custom) => BP.build(BF.facts({ custom })), ready: '#ibBody .ini2', btn: '#addDoc', qs: '?theme=' },
37
- initiative: { file: '/premium-initiative.html', api: '**/api/initiative-premium*', scope: 'initiative:self-serve-v2', mk: (custom) => IP.build(IF.facts({ custom })), ready: '#cIniTk', btn: '[data-adddoc]', qs: '?id=self-serve-v2&ws=w1&board=w1&theme=' },
37
+ // the initiative is a layout inside Home (premium-agreed-design): Add a document is in its Overview, a minimal form in the Viewer (Waiting for design)
38
+ initiative: { file: '/premium.html', api: '**/api/initiative-premium*', scope: 'initiative:self-serve-v2', mk: (custom) => IP.build(IF.facts({ custom })), ready: '.hm-card [data-hm-ov]', btn: '#czViewer [data-ov-adddoc]', qs: '?ini=self-serve-v2&ws=w1&board=w1&theme=' },
38
39
  };
39
40
 
40
41
  (async () => {
@@ -57,58 +58,104 @@ const PAGES = {
57
58
  await page.route('**/api/custom-docs/**', (r) => { const rq = r.request(); posts.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}'), headers: rq.headers() }); r.fulfill({ status: reply.status, contentType: 'application/json', body: JSON.stringify(reply.body) }); });
58
59
  await page.route('**/api/briefing-premium/**', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, turns: [], working: false }) }));
59
60
  await page.goto(BASE + P.file + P.qs + theme);
60
- const up = await until(() => page.evaluate((s) => !!document.querySelector(s), P.ready), 20000);
61
- if (up && P.file === '/premium-board.html') await page.click('#tabDocs'); // the Agreed design shows the documents on the Documents tab (premium-agreed-design)
61
+ let up = await until(() => page.evaluate((s) => !!document.querySelector(s), P.ready), 20000);
62
+ if (up && kind === 'initiative') { if (!(await page.locator('.hm-card [data-hm-ov]').isVisible())) await page.click('#hmNeeds'); await page.click(P.ready); /* a phone: the initiative card is in the top bar's sheet */ up = await until(() => page.evaluate((s) => !!document.querySelector(s), P.btn), 20000); } // the Overview holds the button
63
+ if (up && P.file === '/premium-board.html') await page.click(w <= 720 ? '#chDocs' : '#tabDocs'); // a phone reaches the documents from its Docs chip // the Agreed design shows the documents on the Documents tab (premium-agreed-design)
62
64
  return { ctx, page, errors, posts, up, calls: () => calls, setCustom: (c) => { current = c; }, reply: (a) => { reply = a; } };
63
65
  };
64
66
  const txt = (p, s) => p.evaluate((q) => (document.querySelector(q) || {}).textContent || '', s);
65
67
 
66
- for (const kind of ['board', 'initiative']) {
68
+ /* the Board (premium-agreed-design): the Documents tab is a plain list with a plain Add a document form in the side panel, tagged
69
+ "Waiting for design"; the same route, the same fields, the same refusals */
70
+ {
71
+ const A = await open('board'), p = A.page, P = PAGES.board;
72
+ ok('board 0 the page draws', A.up);
73
+ if (!A.up) return finish(1);
74
+ ok('board A1 the Documents tab has an Add a document button', await p.evaluate(() => { const b = document.querySelector('#docBody #addDoc'); return !!b && b.textContent === 'Add a document'; }));
75
+ await p.click('#addDoc');
76
+ const form = await until(() => p.evaluate(() => { const f = document.querySelector('#peek form[data-form="adddoc"]'); return f ? { title: document.querySelector('#pkTitle').textContent, tag: (document.querySelector('#peek .bd-wtag') || {}).textContent, seg: [...f.querySelectorAll('.bd-rad span')].map((x) => x.textContent), kinds: [...f.kind.options].map((o) => o.textContent), uOff: f.url.disabled, note: f.querySelector('.bd-amut').textContent, dlg: !!document.querySelector('#dlg.on') } : null; }));
77
+ ok('board A1 the side panel has the dialog\'s fields, tagged "Waiting for design", and the old dialog stays shut', !!form && form.title === 'Add a document' && form.tag === 'Waiting for design' && form.seg.join() === 'PMOS drafts it,I write it' && form.kinds.join() === 'In PMOS,Confluence,Google Docs,Google Slides' && form.uOff && !form.dlg, JSON.stringify(form));
78
+ ok('board A7 it says the document is saved and the linked page is not read', !!form && /saved on the board's record/.test(form.note) && /does not read or sync/.test(form.note), form && form.note);
79
+ const go = '#peek form[data-form="adddoc"] [type="submit"]';
80
+ await p.click(go); await sleep(120);
81
+ ok('board A4 an empty title is refused in the panel and posts nothing', /Give the document a title/.test(await txt(p, '#formM')) && A.posts.length === 0);
82
+ await p.fill('#peek input[name="title"]', 'UAT plan'); await p.selectOption('#peek select[name="kind"]', 'Confluence');
83
+ ok('board A1 the address field opens for a link kind', await p.evaluate(() => !document.querySelector('#peek input[name="url"]').disabled));
84
+ await p.click(go); await sleep(120);
85
+ ok('board A4 a link kind with no address is refused in the panel and posts nothing', /Paste the address of the Confluence page/.test(await txt(p, '#formM')) && A.posts.length === 0);
86
+ A.reply({ status: 409, body: { ok: false, error: '“UAT plan” is already on this board.' } });
87
+ await p.fill('#peek input[name="url"]', 'https://example.atlassian.net/wiki/x'); await p.click(go); await sleep(300);
88
+ ok('board A4 a refusal from the route is shown in the panel, which stays open', /already on this/.test(await txt(p, '#formM')) && await p.evaluate((g) => !document.querySelector('#peek').hidden && !document.querySelector(g).disabled, go));
89
+ A.reply({ status: 200, body: { ok: true } }); const calls0 = A.calls();
90
+ await p.check('#peek input[name="writer"][value="you"]'); await p.click(go); await sleep(500);
91
+ const last = A.posts[A.posts.length - 1], mint = await T.nonce(BASE);
92
+ const want = { ws: 'w1', scope: P.scope, title: 'UAT plan', writer: 'you', kind: 'Confluence', url: 'https://example.atlassian.net/wiki/x' };
93
+ ok('board A3 the press posts the entered fields to the one route, with the launch nonce and no writer field', last && last.path === '/api/custom-docs/add' && JSON.stringify(Object.keys(last.body).sort()) === JSON.stringify(Object.keys(want).sort()) && Object.keys(want).every((k) => last.body[k] === want[k] || k === 'ws') && !!mint && last.headers['x-pmos-nonce'] === mint && !['by', 'via', 'at', 'actor', 'pm', 'nonce'].some((k) => k in last.body), JSON.stringify(last && last.body));
94
+ ok('board A3 nothing else was posted', A.posts.every((x) => x.path === '/api/custom-docs/add'));
95
+ ok('board A1 the panel closes, the page reads again and says it was added', A.calls() > calls0 && await p.evaluate(() => document.querySelector('#peek').hidden && /is added to the board's documents/.test(document.querySelector('#bdToast').textContent)));
96
+ A.setCustom(CUSTOM); await p.reload(); await until(() => p.evaluate((s) => !!document.querySelector(s), P.ready), 20000); await p.click('#tabDocs'); await sleep(300);
97
+ const rows = await p.evaluate(() => [...document.querySelectorAll('#docBody .bd-lr')].map((r) => ({ t: r.querySelector('b').textContent, s: r.querySelector('.st').textContent, small: r.querySelector('small').textContent, btn: r.querySelectorAll('button').length })));
98
+ const uat = rows.find((r) => r.t === 'UAT plan'), con = rows.find((r) => r.t === 'Contract');
99
+ ok('board A5 an unlinked document reads Not started with the date it was added and no press', uat && uat.s === 'Not started' && /added 18 Oct/.test(uat.small) && /You write it/.test(uat.small) && uat.btn === 0, JSON.stringify(uat));
100
+ ok('board A5 a linked document reads Linked, shows its address as text and has no press', con && con.s === 'Linked' && /Confluence: https:\/\/example\.atlassian\.net/.test(con.small) && con.btn === 0, JSON.stringify(con));
101
+ ok('board A5 the summary counts one linked', /1 linked/.test(await txt(p, '#docBody .bd-whead')), await txt(p, '#docBody .bd-whead'));
102
+ ok('board no page error', A.errors.length === 0, A.errors.join(' | '));
103
+ await A.ctx.close();
104
+ const N = await open('board', { w: 390, h: 844 }); await N.page.click('#addDoc'); await sleep(300);
105
+ const fl = await N.page.evaluate(() => ({ over: document.documentElement.scrollWidth > innerWidth + 1, add: Math.round(document.querySelector('#addDoc').getBoundingClientRect().height), go: Math.round(document.querySelector('#peek form[data-form="adddoc"] [type="submit"]').getBoundingClientRect().height) }));
106
+ ok('board A8 at 390 px no sideways scroll with the form open, and its buttons are 44 px', !fl.over && fl.add >= 44 && fl.go >= 44, JSON.stringify(fl));
107
+ await N.ctx.close();
108
+ }
109
+
110
+ for (const kind of ['initiative']) {
67
111
  const P = PAGES[kind], ini = kind === 'initiative';
68
112
  const A = await open(kind), p = A.page;
69
- ok(`${kind} 0 the page draws`, A.up);
113
+ const F = '#czViewer:not([hidden])';
114
+ const dlgShut = () => p.evaluate(() => { const d = document.querySelector('#dlg'); return !d || !d.classList.contains('on'); });
115
+ ok(`${kind} 0 the page draws (Home with the initiative, its Overview open)`, A.up);
70
116
  if (!A.up) return finish(1);
71
- ok(`${kind} A1 the Core documents card has an Add a document button`, await p.evaluate((s) => { const b = document.querySelector(s); return !!b && /Add a document/.test(b.textContent) && !b.hidden; }, P.btn));
72
- await p.click(P.btn); await sleep(250);
73
- const form = await p.evaluate(() => ({ open: document.querySelector('#dlg').classList.contains('on'), title: document.querySelector('#dTitle').textContent, t: !!document.querySelector('#adT'), phase: !!document.querySelector('#adC'), seg: [...document.querySelectorAll('#adW button')].map((b) => b.textContent), kinds: [...document.querySelectorAll('#adK option')].map((o) => o.textContent), uOff: document.querySelector('#adU').disabled, note: document.querySelector('.addf .note').textContent }));
74
- ok(`${kind} A1 the dialog has the mockup's fields`, form.open && form.title === 'Add a document' && form.t && form.phase === ini && form.seg.join() === 'PMOS drafts it,I write it' && form.kinds.join() === 'In PMOS,Confluence,Google Docs,Google Slides' && form.uOff, JSON.stringify(form));
75
- ok(`${kind} A7 the dialog says the document is saved and the linked page is not read`, /saved on the (board|initiative)'s record/.test(form.note) && /does not read or sync/.test(form.note), form.note);
76
- await p.click('#adGo'); await sleep(120);
77
- ok(`${kind} A4 an empty title is refused in the dialog and posts nothing`, /Give the document a title/.test(await txt(p, '#adM')) && A.posts.length === 0);
78
- await p.fill('#adT', 'UAT plan'); await p.selectOption('#adK', 'Confluence'); await sleep(100);
79
- ok(`${kind} A1 the address field opens for a link kind`, await p.evaluate(() => !document.querySelector('#adU').disabled));
80
- await p.click('#adGo'); await sleep(120);
81
- ok(`${kind} A4 a link kind with no address is refused in the dialog and posts nothing`, /Paste the address of the Confluence page/.test(await txt(p, '#adM')) && A.posts.length === 0);
117
+ ok(`${kind} A1 the Overview's Core documents has an Add a document button`, await p.evaluate((s) => { const b = document.querySelector(s); return !!b && /Add a document/.test(b.textContent) && !b.hidden; }, P.btn));
118
+ await p.click(P.btn); await until(() => p.evaluate(() => !!document.querySelector('#czViewer #adT')));
119
+ const form = await p.evaluate((V) => ({ open: !!document.querySelector(V + ' #adT'), title: (document.querySelector('#czVwTitle') || {}).textContent || '', wait: !!document.querySelector(V + ' .hx-wait'), phase: !!document.querySelector(V + ' #adPh'), seg: [...document.querySelectorAll(V + ' #adW button')].map((b) => b.textContent), kinds: [...document.querySelectorAll(V + ' #adK option')].map((o) => o.textContent), uOff: document.querySelector(V + ' #adU').disabled, note: (document.querySelector(V + ' [data-ad-note]') || {}).textContent || '' }), F);
120
+ ok(`${kind} A1 the form in the Viewer has the dialog's fields, tagged "Waiting for design", and the old dialog stays shut`, form.open && /^Add a document/.test(form.title) && form.wait && form.phase === ini && form.seg.join() === 'PMOS drafts it,I write it' && form.kinds.join() === 'In PMOS,Confluence,Google Docs,Google Slides' && form.uOff && await dlgShut(), JSON.stringify(form));
121
+ ok(`${kind} A7 the form says the document is saved and the linked page is not read`, /saved on the (board|initiative)'s record/.test(form.note) && /does not read or sync/.test(form.note), form.note);
122
+ await p.click('#czViewer #adGo'); await sleep(120);
123
+ ok(`${kind} A4 an empty title is refused in the form and posts nothing`, /Give the document a title/.test(await txt(p, '#czViewer #adM')) && A.posts.length === 0);
124
+ await p.fill('#czViewer #adT', 'UAT plan'); await p.selectOption('#czViewer #adK', 'Confluence'); await sleep(100);
125
+ ok(`${kind} A1 the address field opens for a link kind`, await p.evaluate(() => !document.querySelector('#czViewer #adU').disabled));
126
+ await p.click('#czViewer #adGo'); await sleep(120);
127
+ ok(`${kind} A4 a link kind with no address is refused in the form and posts nothing`, /Paste the address of the Confluence page/.test(await txt(p, '#czViewer #adM')) && A.posts.length === 0);
82
128
  A.reply({ status: 409, body: { ok: false, error: '“UAT plan” is already on this ' + (ini ? 'initiative' : 'board') + '.' } });
83
- await p.fill('#adU', 'https://example.atlassian.net/wiki/x'); await p.click('#adGo'); await sleep(250);
84
- ok(`${kind} A4 a refusal from the route is shown in the dialog, which stays open`, /already on this/.test(await txt(p, '#adM')) && await p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !document.querySelector('#adGo').disabled));
129
+ await p.fill('#czViewer #adU', 'https://example.atlassian.net/wiki/x'); await p.click('#czViewer #adGo'); await sleep(250);
130
+ ok(`${kind} A4 a refusal from the route is shown in the form, which stays open`, /already on this/.test(await txt(p, '#czViewer #adM')) && await p.evaluate(() => !!document.querySelector('#czViewer #adT') && !document.querySelector('#czViewer #adGo').disabled));
85
131
  A.reply({ status: 200, body: { ok: true } }); const calls0 = A.calls();
86
- await p.click('[data-w="you"]'); if (ini) await p.selectOption('#adC', 'Plan');
87
- await p.click('#adGo'); await sleep(500);
132
+ await p.click('#czViewer [data-w="you"]'); if (ini) await p.selectOption('#czViewer #adPh', 'Plan');
133
+ await p.click('#czViewer #adGo'); await sleep(500);
88
134
  const last = A.posts[A.posts.length - 1], mint = await T.nonce(BASE);
89
- const want = { ws: ini ? 'w1' : 'w1', scope: P.scope, title: 'UAT plan', writer: 'you', kind: 'Confluence', url: 'https://example.atlassian.net/wiki/x' };
135
+ const want = { ws: 'w1', scope: P.scope, title: 'UAT plan', writer: 'you', kind: 'Confluence', url: 'https://example.atlassian.net/wiki/x' };
90
136
  if (ini) want.phase = 'Plan';
91
137
  ok(`${kind} A3 the press posts the entered fields to the one route, with the launch nonce and no writer field`, last && last.path === '/api/custom-docs/add' && JSON.stringify(Object.keys(last.body).sort()) === JSON.stringify(Object.keys(want).sort()) && Object.keys(want).every((k) => last.body[k] === want[k] || k === 'ws') && !!mint && last.headers['x-pmos-nonce'] === mint && !['by', 'via', 'at', 'actor', 'pm', 'nonce'].some((k) => k in last.body), JSON.stringify(last && last.body));
92
138
  ok(`${kind} A3 nothing else was posted`, A.posts.every((x) => x.path === '/api/custom-docs/add'));
93
- ok(`${kind} A1 the dialog closes, the page reads again and focus returns to the button`, A.calls() > calls0 && await p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')) && await p.evaluate((s) => document.activeElement === document.querySelector(s), P.btn));
94
- A.setCustom(CUSTOM.map((d) => Object.assign({}, d, { scope: P.scope }))); await p.reload(); await until(() => p.evaluate((s) => !!document.querySelector(s), P.ready), 20000); if (!ini) await p.click('#tabDocs'); await sleep(400);
95
- const sel = ini ? '#cIniDoc' : '#cDocs';
96
- const rows = await p.evaluate((s) => [...document.querySelectorAll(s + ' .dmr')].map((r) => ({ t: r.querySelector('b').textContent, s: r.querySelector('.dmm .s').textContent.trim(), small: r.querySelector('.dmn>small').textContent, meta: r.querySelector('.dmm').textContent, btn: r.querySelectorAll('.dmq button').length })), sel);
139
+ ok(`${kind} A1 the form closes, the initiative is read again and its Overview comes back`, await until(() => A.calls() > calls0) && await until(() => p.evaluate(() => !document.querySelector('#czViewer #adT') && !!document.querySelector('#czViewer [data-ov-adddoc]'))));
140
+ A.setCustom(CUSTOM.map((d) => Object.assign({}, d, { scope: P.scope }))); await p.reload();
141
+ await until(() => p.evaluate((s) => !!document.querySelector(s), P.ready), 20000); await p.click(P.ready);
142
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer [data-ov-doc="custom:cd-2"]')), 20000);
143
+ const rows = await p.evaluate(() => [...document.querySelectorAll('#czViewer [data-ov-doc]')].map((r) => ({ t: r.querySelector('b').textContent, meta: r.querySelector('em').textContent, small: (r.querySelector('small') || {}).textContent || '', btn: r.querySelectorAll('button').length })));
97
144
  const uat = rows.find((r) => r.t === 'UAT plan'), con = rows.find((r) => r.t === 'Contract');
98
- ok(`${kind} A5 an unlinked document reads Not started with the date it was added and no press`, uat && uat.s === 'Not started' && /added 18 Oct/.test(uat.meta) && /You write it/.test(uat.meta) && uat.btn === 0, JSON.stringify(uat));
99
- ok(`${kind} A5 a linked document reads Linked, shows its address as text and has no press`, con && con.s === 'Linked' && /Confluence: https:\/\/example\.atlassian\.net/.test(con.small) && con.btn === 0 && !/Up to date/.test(con.s), JSON.stringify(con));
100
- const sum = await txt(p, sel + ' .dsum');
101
- ok(`${kind} A5 the summary counts one linked and the total counts both`, /1\s*linked/.test(sum) && /up to date/.test(sum), sum);
102
- ok(`${kind} A5 the filter chips keep their four and a linked document is under All only`, await p.evaluate((s) => { const b = [...document.querySelectorAll(s + ' #dmF button')]; return b.length === 4 && /Linked/.test(b.map((x) => x.textContent).join('')) === false; }, sel));
103
- await p.click(P.btn); await sleep(250);
104
- const floors = await p.evaluate((B) => { const h = (s) => Math.round(document.querySelector(s).getBoundingClientRect().height); return { go: h('#adGo'), no: h('#adNo'), t: h('#adT'), k: h('#adK'), w: Math.round(document.querySelector('#adW button').getBoundingClientRect().height), add: h(document.querySelector('.dmadd2') ? '.dmadd2' : B) }; }, P.btn); // the Board's Add a document is a chip in the Agreed design
105
- ok(`${kind} A8 the buttons are at least 44 px (the fields and the switch keep the mockup's own size)`, [floors.go, floors.no, floors.add].every((v) => v >= 44), JSON.stringify(floors));
145
+ ok(`${kind} A5 an unlinked document reads Not started with the date it was added and no press`, uat && /^Not started/.test(uat.meta) && /added 18 Oct/.test(uat.meta) && /You write it/.test(uat.meta) && uat.btn === 0, JSON.stringify(uat));
146
+ ok(`${kind} A5 a linked document reads Linked, shows its address as text and has no press`, con && /^Linked/.test(con.meta) && /Confluence: https:\/\/example\.atlassian\.net/.test(con.small) && con.btn === 0 && !/Up to date/.test(con.meta), JSON.stringify(con));
147
+ const sum = await txt(p, '#czViewer [data-ov-dsum]');
148
+ ok(`${kind} A5 the summary counts one linked and the up-to-date ones`, /1\s*linked/.test(sum) && /up to date/.test(sum), sum);
149
+ ok(`${kind} A5 a linked document is listed apart from the up-to-date ones (no Up to date on it, no Open press)`, !!con && !/Up to date/.test(con.meta) && con.btn === 0); // the old filter chips are not in the Agreed design
150
+ await p.click(P.btn); await until(() => p.evaluate(() => !!document.querySelector('#czViewer #adT')));
106
151
  await p.keyboard.press('Escape'); await sleep(250);
107
- ok(`${kind} A8 Escape closes the dialog`, await p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
152
+ ok(`${kind} A8 Escape closes the form`, await p.evaluate(() => !document.querySelector('#czViewer #adT')));
108
153
  ok(`${kind} no page error`, A.errors.length === 0, A.errors.join(' | '));
109
154
  await A.ctx.close();
110
- const N = await open(kind, { w: 390, h: 844 }); await N.page.click(P.btn); await sleep(300);
111
- ok(`${kind} A8 no sideways scroll at 390 px with the dialog open`, await N.page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1 && document.querySelector('#dlg').getBoundingClientRect().right <= innerWidth + 1));
155
+ const N = await open(kind, { w: 390, h: 844 }); await N.page.click(P.btn); await until(() => N.page.evaluate(() => !!document.querySelector('#czViewer #adT')));
156
+ const floors = await N.page.evaluate(() => { const h = (s) => Math.round(document.querySelector('#czViewer ' + s).getBoundingClientRect().height); return { go: h('#adGo'), no: h('#adNo'), t: h('#adT'), k: h('#adK'), w: h('#adW button'), fs: getComputedStyle(document.querySelector('#czViewer #adT')).fontSize }; });
157
+ ok(`${kind} A8 at 390 px the presses and fields are at least 44 px and the fields do not zoom the page`, [floors.go, floors.no, floors.t, floors.k, floors.w].every((v) => v >= 44) && parseFloat(floors.fs) >= 16, JSON.stringify(floors));
158
+ ok(`${kind} A8 no sideways scroll at 390 px with the form open`, await N.page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1 && document.querySelector('#czViewer').getBoundingClientRect().right <= innerWidth + 1));
112
159
  await N.ctx.close();
113
160
  }
114
161
 
@@ -132,22 +179,24 @@ const PAGES = {
132
179
  ok('A3 the add route takes POST only', wrong === 405);
133
180
  }
134
181
 
135
- /* A8 fidelity: the initiative page and its dialog follow the Agreed design (premium-agreed-design), which replaces the old mockup's look.
136
- * The dialog is one white cozy panel in Nunito: title 19 px at 800, the form's presses blue and white pills, the paper a soft rounded card. */
182
+ /* A8 fidelity: the form follows the Agreed design (premium-agreed-design): the Viewer is one cozy card in Nunito, its presses pills, the main one
183
+ * the solid colour. The colours are read from the page's own tokens, so a theme is checked against itself. */
137
184
  for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
138
- const R = await open('initiative', { w, h, theme: th }); await sleep(400);
139
- const btn = await R.page.evaluate(() => { const cs = getComputedStyle(document.querySelector('[data-adddoc]')); return { ff: cs.fontFamily, fw: cs.fontWeight, br: cs.borderRadius }; });
140
- await R.page.click('[data-adddoc]'); await sleep(500);
141
- const g = await R.page.evaluate(() => { const cs = (s) => getComputedStyle(document.querySelector(s)); return { dlg: cs('#dlg').backgroundColor, dlgR: cs('#dlg').borderTopLeftRadius, blur: cs('#dlg').backdropFilter, ttl: [cs('#dTitle').fontFamily, cs('#dTitle').fontWeight, cs('#dTitle').fontSize], go: [cs('#adGo').backgroundColor, cs('#adGo').fontWeight, cs('#adGo').borderTopLeftRadius], no: cs('#adNo').backgroundColor, paper: cs('#oMain .paper').borderTopLeftRadius, fab: getComputedStyle(document.querySelector('#czNav')).display }; });
142
- const dark = th === 'dark', d = [];
143
- if (!/^Nunito/.test(btn.ff) || btn.fw !== '800' || btn.br !== '999px') d.push('button ' + JSON.stringify(btn));
144
- if (g.dlg !== (dark ? 'rgb(36, 38, 43)' : 'rgb(255, 255, 255)') || g.dlgR !== '28px' || (g.blur && g.blur !== 'none')) d.push('dialog ' + [g.dlg, g.dlgR, g.blur].join(' '));
145
- if (!/^Nunito/.test(g.ttl[0]) || g.ttl[1] !== '800' || (w >= 1000 && g.ttl[2] !== '19px')) d.push('title ' + g.ttl.join(' '));
146
- if (g.go[0] !== (dark ? 'rgb(106, 170, 240)' : 'rgb(47, 95, 179)') || g.go[1] !== '800' || g.go[2] !== '999px') d.push('Add document ' + g.go.join(' '));
147
- if (g.no !== (dark ? 'rgb(36, 38, 43)' : 'rgb(255, 255, 255)')) d.push('Cancel ' + g.no);
148
- if (g.paper !== '16px' && w >= 1000) d.push('paper ' + g.paper);
149
- if (g.fab !== 'none') d.push('the floating menu shows over the modal dialog');
150
- ok(`A8 the button and the dialog follow the Agreed design at ${w} px, ${th}`, d.length === 0, d.join(' ; '));
185
+ const R = await open('initiative', { w, h, theme: th });
186
+ const btn = await R.page.evaluate(() => { const cs = getComputedStyle(document.querySelector('#czViewer [data-ov-adddoc]')); return { ff: cs.fontFamily, br: cs.borderRadius }; });
187
+ await R.page.click('#czViewer [data-ov-adddoc]'); await until(() => R.page.evaluate(() => !!document.querySelector('#czViewer #adT')));
188
+ const g = await R.page.evaluate(() => {
189
+ const tok = (v, prop) => { const x = document.createElement('i'); x.style.setProperty(prop, 'var(' + v + ')'); document.querySelector('#czViewer').appendChild(x); const c = getComputedStyle(x)[prop === 'color' ? 'color' : 'backgroundColor']; x.remove(); return c; };
190
+ const cs = (s) => getComputedStyle(document.querySelector(s));
191
+ return { vw: cs('#czViewer').backgroundColor, card: tok('--cz-card', 'background-color'), vwR: cs('#czViewer').borderTopLeftRadius, ff: cs('#czViewer').fontFamily, go: [cs('#czViewer #adGo').backgroundColor, cs('#czViewer #adGo').fontWeight, cs('#czViewer #adGo').borderTopLeftRadius], solid: tok('--cz-solid', 'background-color'), no: cs('#czViewer #adNo').backgroundColor, dlg: !!(document.querySelector('#dlg') && !!document.querySelector('#dlg.on')) };
192
+ });
193
+ const d = [];
194
+ if (!/^Nunito/.test(btn.ff) || btn.br !== '999px') d.push('button ' + JSON.stringify(btn));
195
+ if (g.vw !== g.card || !/^Nunito/.test(g.ff) || (w > 760 && parseFloat(g.vwR) < 20)) d.push('viewer ' + [g.vw, g.card, g.vwR, g.ff].join(' '));
196
+ if (g.go[0] !== g.solid || +g.go[1] < 700 || g.go[2] !== '999px') d.push('Add document ' + g.go.join(' ') + ' want ' + g.solid);
197
+ if (g.no !== g.card) d.push('Cancel ' + g.no);
198
+ if (g.dlg) d.push('the old dialog opened');
199
+ ok(`A8 the button and the form follow the Agreed design at ${w} px, ${th}`, d.length === 0, d.join(' ; '));
151
200
  await R.ctx.close();
152
201
  }
153
202
  return finish();