create-pmos 0.610.0 → 0.612.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 (164) hide show
  1. package/package.json +135 -27
  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/board-columns-test.js +2 -1
  8. package/workspace/board-deliveries-test.js +2 -1
  9. package/workspace/board-programs-test.js +7 -3
  10. package/workspace/board-publish-ui-test.js +2 -1
  11. package/workspace/board-shared-ui-test.js +2 -1
  12. package/workspace/board-workflows-test.js +2 -1
  13. package/workspace/briefing-premium-board-test.js +3 -2
  14. package/workspace/briefing-premium-calendar-2-test.js +3 -2
  15. package/workspace/briefing-premium-calendar-3-test.js +1 -1
  16. package/workspace/briefing-premium-calendar-test.js +1 -1
  17. package/workspace/briefing-premium-doc-edit-test.js +2 -1
  18. package/workspace/briefing-premium-insights-test.js +4 -3
  19. package/workspace/briefing-premium-test.js +3 -2
  20. package/workspace/calm-timeline-test.js +2 -1
  21. package/workspace/changelog.json +134 -0
  22. package/workspace/core-docs-workflow-test.js +2 -1
  23. package/workspace/ev-everywhere-test.js +3 -2
  24. package/workspace/guide/home.md +2 -2
  25. package/workspace/guide/index.md +4 -0
  26. package/workspace/guide/layout.md +97 -3
  27. package/workspace/guide/programs.md +16 -2
  28. package/workspace/guide/routine.md +65 -0
  29. package/workspace/guide/scheduled-tasks-and-cli.md +1 -1
  30. package/workspace/guide/settings-and-switches.md +2 -2
  31. package/workspace/impact-screens-test.js +3 -1
  32. package/workspace/ini-workflow-test.js +2 -1
  33. package/workspace/lib/board-premium.js +12 -4
  34. package/workspace/lib/classic-board.js +15 -0
  35. package/workspace/lib/cos-chat.js +1 -0
  36. package/workspace/lib/doc-library.js +43 -12
  37. package/workspace/lib/doc-path.js +30 -0
  38. package/workspace/lib/engine/boards.js +4 -2
  39. package/workspace/lib/events-place.js +368 -0
  40. package/workspace/lib/events-stated.js +129 -0
  41. package/workspace/lib/initiative-chat.js +1 -0
  42. package/workspace/lib/insights-premium.js +13 -1
  43. package/workspace/lib/library-find.js +162 -0
  44. package/workspace/lib/library-items.js +250 -0
  45. package/workspace/lib/notes.js +9 -1
  46. package/workspace/lib/plan-items.js +17 -3
  47. package/workspace/lib/route-modules.js +4 -0
  48. package/workspace/lib/routes-artefacts.js +5 -2
  49. package/workspace/lib/routes-boards.js +6 -2
  50. package/workspace/lib/routes-doc-sheet.js +1 -0
  51. package/workspace/lib/routes-events-place.js +203 -0
  52. package/workspace/lib/routes-library.js +155 -0
  53. package/workspace/lib/routes-pop-work.js +39 -0
  54. package/workspace/lib/routes-report-setups.js +32 -1
  55. package/workspace/lib/routes-today-log.js +48 -0
  56. package/workspace/lib/routine-reports.js +84 -0
  57. package/workspace/lib/status-when.js +36 -0
  58. package/workspace/lib/task-items.js +5 -3
  59. package/workspace/lib/today-log.js +131 -0
  60. package/workspace/live-pill-round-test.js +10 -7
  61. package/workspace/metric-drafts-ui-test.js +3 -1
  62. package/workspace/milestone-pins-test.js +2 -1
  63. package/workspace/milestone-suggest-test.js +3 -1
  64. package/workspace/package-lock.json +2 -2
  65. package/workspace/package.json +1 -1
  66. package/workspace/panels-test.js +2 -1
  67. package/workspace/premium-board-actions-test.js +3 -1
  68. package/workspace/premium-rec-tab-test.js +2 -1
  69. package/workspace/premium-vw-backlog-test.js +3 -1
  70. package/workspace/premium-vw-item-test.js +3 -1
  71. package/workspace/premium-vw-jira-test.js +3 -1
  72. package/workspace/premium-vw-meet-test.js +2 -1
  73. package/workspace/premium-vw-notes-test.js +3 -2
  74. package/workspace/product-lane-test.js +2 -1
  75. package/workspace/program-charter-test.js +3 -1
  76. package/workspace/program-leave-test.js +2 -1
  77. package/workspace/program-order-test.js +2 -1
  78. package/workspace/program-panel-test.js +3 -1
  79. package/workspace/public/pm/artefact-kind.js +87 -0
  80. package/workspace/public/pm/bd-ini-panel.js +77 -12
  81. package/workspace/public/pm/bd-prog-panel.js +55 -8
  82. package/workspace/public/pm/bd-span.js +5 -0
  83. package/workspace/public/pm/bd-work.css +192 -0
  84. package/workspace/public/pm/bd-work.js +483 -0
  85. package/workspace/public/pm/cozy-bar.css +11 -0
  86. package/workspace/public/pm/cozy-bar.js +99 -0
  87. package/workspace/public/pm/cozy-day-pick.css +27 -0
  88. package/workspace/public/pm/cozy-day-pick.js +97 -0
  89. package/workspace/public/pm/cozy-ev.css +2 -5
  90. package/workspace/public/pm/cozy-events-view.js +274 -0
  91. package/workspace/public/pm/cozy-events.css +179 -0
  92. package/workspace/public/pm/cozy-events.js +278 -0
  93. package/workspace/public/pm/cozy-evmodel.js +1 -1
  94. package/workspace/public/pm/cozy-goals.css +172 -0
  95. package/workspace/public/pm/cozy-library.css +125 -0
  96. package/workspace/public/pm/cozy-live-pill.js +1 -0
  97. package/workspace/public/pm/cozy-nav.js +6 -7
  98. package/workspace/public/pm/cozy-pick.css +3 -0
  99. package/workspace/public/pm/cozy-pop-work.css +224 -0
  100. package/workspace/public/pm/cozy-pop-work.js +668 -0
  101. package/workspace/public/pm/cozy-popup.css +11 -2
  102. package/workspace/public/pm/cozy-popup.js +67 -9
  103. package/workspace/public/pm/cozy-routine-job.js +203 -0
  104. package/workspace/public/pm/cozy-routine-model.js +219 -0
  105. package/workspace/public/pm/cozy-routine-pop.js +318 -0
  106. package/workspace/public/pm/cozy-routine.css +155 -0
  107. package/workspace/public/pm/cozy-routine.js +335 -0
  108. package/workspace/public/pm/cozy-schedwork.js +6 -5
  109. package/workspace/public/pm/cozy-settings.js +1 -5
  110. package/workspace/public/pm/cozy-status-when.js +48 -0
  111. package/workspace/public/pm/cozy-today-app.js +236 -0
  112. package/workspace/public/pm/cozy-today-model.js +176 -0
  113. package/workspace/public/pm/cozy-today-page.css +100 -0
  114. package/workspace/public/pm/cozy-today-view.js +76 -0
  115. package/workspace/public/pm/cozy-viewer.js +19 -8
  116. package/workspace/public/pm/cozy-vw-mtg.css +39 -0
  117. package/workspace/public/pm/goals-model.js +205 -0
  118. package/workspace/public/pm/goals-open.js +124 -0
  119. package/workspace/public/pm/home-app.js +18 -3
  120. package/workspace/public/pm/home-chat.js +4 -2
  121. package/workspace/public/pm/home-ini.js +43 -10
  122. package/workspace/public/pm/ini-edit.js +3 -1
  123. package/workspace/public/pm/ini-view-model.js +1 -1
  124. package/workspace/public/pm/library-model.js +197 -0
  125. package/workspace/public/pm/library-open.js +37 -0
  126. package/workspace/public/pm/page-chat.js +12 -2
  127. package/workspace/public/pm/pop-work-model.js +493 -0
  128. package/workspace/public/pm/premium-board.js +204 -17
  129. package/workspace/public/pm/premium-goals.js +213 -0
  130. package/workspace/public/pm/premium-library.js +436 -0
  131. package/workspace/public/pm/premium-shell.js +1 -1
  132. package/workspace/public/pm/premium-vw-mtg.js +79 -1
  133. package/workspace/public/pm/scope-chip.js +204 -0
  134. package/workspace/public/premium-board.html +1 -0
  135. package/workspace/public/premium-events.html +44 -0
  136. package/workspace/public/premium-goals.html +37 -0
  137. package/workspace/public/premium-library.html +39 -0
  138. package/workspace/public/premium-routine.html +33 -0
  139. package/workspace/public/today.html +50 -0
  140. package/workspace/ready-dash-ui-test.js +3 -1
  141. package/workspace/rename-test.js +2 -1
  142. package/workspace/run-tests.js +4 -1
  143. package/workspace/server.js +4 -2
  144. package/workspace/sort-order-test.js +2 -1
  145. package/workspace/split-merge-ui-test.js +3 -1
  146. package/workspace/stage-card-tasks-test.js +3 -1
  147. package/workspace/stage-card-test.js +2 -1
  148. package/workspace/task-delete-test.js +2 -1
  149. package/workspace/task-links-test.js +2 -1
  150. package/workspace/task-milestones-test.js +4 -2
  151. package/workspace/task-plans-test.js +3 -1
  152. package/workspace/task-press-test.js +3 -1
  153. package/workspace/task-views-test.js +3 -1
  154. package/workspace/test-lists/doc-path.json +9 -0
  155. package/workspace/test-lists/events-place.json +11 -0
  156. package/workspace/test-lists/goals-place.json +9 -0
  157. package/workspace/test-lists/library-place.json +9 -0
  158. package/workspace/test-lists/pop-work.json +9 -0
  159. package/workspace/test-lists/routine-place.json +9 -0
  160. package/workspace/test-lists/status-when.json +9 -0
  161. package/workspace/test-lists/today-log.json +9 -0
  162. package/workspace/test-lists/work-view.json +9 -0
  163. package/workspace/timeline-holds-test.js +3 -1
  164. package/workspace/tk-tasks-test.js +2 -1
@@ -5,6 +5,8 @@
5
5
  * viewer still offers it: the sprint view's "Open the backlog", with the sprint view opened through its module over a task dialog of the
6
6
  * initiative page. GET /api/boards/sprints and the page models are stand-ins. The Board is checked to carry none of it. Every wait polls the page; no fixed sleep stands in for a state. */
7
7
  const path = require('path');
8
+ const { besidePage } = require('./lib/beside-page'); // these checks read the full page beside the page; in the popup work shows its three parts (nav slice 3)
9
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
8
10
  const { spawn } = require('child_process');
9
11
  const { findBrowser } = require('./lib/find-browser');
10
12
  const { openMission } = require('./lib/open-mission');
@@ -44,7 +46,7 @@ const SPRINTS = { ok: true, source: 'jira', readAt: '2026-10-19T09:00:00Z', velo
44
46
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
45
47
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
46
48
  await T.waitForServer(BASE);
47
- browser = await chromium.launch({ executablePath: exe });
49
+ browser = besidePage(classicBoard(await chromium.launch({ executablePath: exe })));
48
50
 
49
51
  const open = async ({ w = 1280, h = 900, theme = 'light', sprints = SPRINTS } = {}) => {
50
52
  const ctx = await openMission(await browser.newContext({ viewport: { width: w, height: h } }));
@@ -6,6 +6,8 @@
6
6
  * Overview offers Open the full record and opens each task; inside the record a task opens in its place, and the task's initiative link brings the record back.
7
7
  * Every wait polls the page; no fixed sleep stands in for a state. */
8
8
  const path = require('path');
9
+ const { besidePage } = require('./lib/beside-page'); // these checks read the full page beside the page; in the popup work shows its three parts (nav slice 3)
10
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
9
11
  const { spawn } = require('child_process');
10
12
  const { findBrowser } = require('./lib/find-browser');
11
13
  const { openMission } = require('./lib/open-mission');
@@ -38,7 +40,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
38
40
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
39
41
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
40
42
  await T.waitForServer(BASE);
41
- browser = await chromium.launch({ executablePath: exe });
43
+ browser = besidePage(classicBoard(await chromium.launch({ executablePath: exe })));
42
44
  const MODEL = IP.build(F.facts());
43
45
 
44
46
  const open = async ({ w = 1280, h = 900, theme = 'light', answer = null } = {}) => {
@@ -8,6 +8,8 @@
8
8
  * so the sprint view is opened through its module (openSprint) over a task dialog of the initiative page, which loads the same view.
9
9
  * F floors: 390 px with no sideways scroll, 44 px targets, light and dark, no write */
10
10
  const path = require('path');
11
+ const { besidePage } = require('./lib/beside-page'); // these checks read the full page beside the page; in the popup work shows its three parts (nav slice 3)
12
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
11
13
  const { spawn } = require('child_process');
12
14
  const { findBrowser } = require('./lib/find-browser');
13
15
  const { openMission } = require('./lib/open-mission');
@@ -67,7 +69,7 @@ const TICKETS = {
67
69
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
68
70
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT), PMOS_NO_OPEN: '1' }) });
69
71
  await T.waitForServer(BASE);
70
- browser = await chromium.launch({ executablePath: exe });
72
+ browser = besidePage(classicBoard(await chromium.launch({ executablePath: exe })));
71
73
 
72
74
  const model = (sprints) => BP.build(F.facts({ sprints }));
73
75
  const IMODEL = IP.build(IF.facts());
@@ -52,7 +52,8 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
52
52
  /* an ended meeting with notes and a recording */
53
53
  const A = await open('/premium-viewer.html?open=meeting&note=n1');
54
54
  const p = A.page;
55
- const up = await until(() => p.evaluate(() => !!document.querySelector('#czViewer .vz-mtg[data-mk="notes"]') && !!document.querySelector('#czViewer .czs-sum')), 15000);
55
+ // a held meeting opens in its notes view (board 34); its full card, which this suite reads, is one press away
56
+ const up = await until(() => p.evaluate(() => { const f = document.querySelector('#czViewer [data-a="h-full"]'); if (f) f.click(); return !!document.querySelector('#czViewer .vz-mtg[data-mk="notes"]') && !!document.querySelector('#czViewer .czs-sum'); }), 15000);
56
57
  ok('0 the meeting opens in the Viewer on its own page', up);
57
58
  if (!up) return finish(1);
58
59
 
@@ -77,13 +77,14 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
77
77
  /* N5 a note opens in the card */
78
78
  await tap(p, '[data-c="note"][data-id="n3"]');
79
79
  ok('N5 a note opens as the meeting card in place of the list', await until(() => p.evaluate(() => !!document.querySelector('#czViewer .vz-mtg') && /Compare meeting note apps/.test(document.querySelector('#czViewer .cz-vw-title').textContent))), (await text(p)).slice(0, 300));
80
- ok('N5 a note that is not linked offers What it is about', await until(async () => /What it is about/.test(await text(p)) && !!(await p.$('#czViewer [data-a="m-about"]'))), (await text(p)).slice(0, 400));
80
+ const full = (pg) => pg.evaluate(() => { const f = document.querySelector('#czViewer [data-a="h-full"]'); if (f) f.click(); }); // a held note opens in its notes view (board 34); the full card is one press away
81
+ ok('N5 a note that is not linked offers What it is about', await until(async () => (await full(p), true) && /What it is about/.test(await text(p)) && !!(await p.$('#czViewer [data-a="m-about"]'))), (await text(p)).slice(0, 400));
81
82
  await p.evaluate(() => window.czViews.openNotes({}));
82
83
  await until(() => p.evaluate(() => !!document.querySelector('#czViewer [data-c="ser"][data-k="viewer-sync"]')));
83
84
  await tap(p, '[data-c="ser"][data-k="viewer-sync"]');
84
85
  ok('N3 pressing the series card unfolds its notes, newest first', await until(async () => (await ids(p)).slice(0, 2).join() === 'n1,n0'), JSON.stringify(await ids(p)));
85
86
  await tap(p, '[data-c="note"][data-id="n1"]');
86
- ok('N5 a note of the series opens and its summary says 4 of 4 in the series', await until(async () => /4 of 4/.test(await text(p))) && A.S.gets.some((x) => /notes\/one\?id=n1/.test(x)), (await text(p)).slice(0, 300));
87
+ ok('N5 a note of the series opens and its summary says 4 of 4 in the series', await until(async () => (await full(p), true) && /4 of 4/.test(await text(p))) && A.S.gets.some((x) => /notes\/one\?id=n1/.test(x)), (await text(p)).slice(0, 300));
87
88
  ok('N5 ⋯ holds the meeting before, and no meeting after the last one', await until(async () => { const r = await F.more(p); return r && r.some((x) => /^The meeting before/.test(x)) && !r.some((x) => /^The meeting after/.test(x)); }));
88
89
  await F.more(p, 'The meeting before');
89
90
  ok('N5 paging (⋯ The meeting before) reads the meeting before into the same card', await until(() => A.S.gets.some((x) => /notes\/one\?id=n0/.test(x))) && await p.evaluate(() => document.querySelectorAll('#czViewer .vz-mtg').length === 1));
@@ -15,6 +15,7 @@
15
15
  * Q the phone: ◇ only; a tap on the folded lane opens a sheet with the product's milestones in date order
16
16
  * SHOTS_17=<dir>: the Board, the counted ◇'s list, folded and the phone sheet, into <dir>. */
17
17
  const path = require('path');
18
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
18
19
  const { spawn } = require('child_process');
19
20
  const { findBrowser } = require('./lib/find-browser');
20
21
  const T = require('./test-run').configure({ name: 'product-lane' });
@@ -69,7 +70,7 @@ function model() {
69
70
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
70
71
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
71
72
  await T.waitForServer(BASE);
72
- browser = await chromium.launch({ executablePath: exe });
73
+ browser = classicBoard(await chromium.launch({ executablePath: exe }));
73
74
 
74
75
  /** The Board on the timeline, All products. o: { w, h, span, phone, fold } */
75
76
  const open = async (o = {}) => {
@@ -9,6 +9,8 @@
9
9
  * P the picker by product with each ◆ Deliver day; an earlier milestone date warns · X what stops a save · D the drafts · N the name ·
10
10
  * O "Open again" on a done check · H on a phone. PMOS_SHOTS=<dir> also saves the screenshots the frames are compared with. */
11
11
  const path = require('path');
12
+ const { besidePage } = require('./lib/beside-page'); // these checks read the full page beside the page; in the popup work shows its three parts (nav slice 3)
13
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
12
14
  const fs = require('fs');
13
15
  const { spawn } = require('child_process');
14
16
  const { findBrowser } = require('./lib/find-browser');
@@ -41,7 +43,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
41
43
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
42
44
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
43
45
  await T.waitForServer(BASE);
44
- browser = await chromium.launch({ executablePath: exe });
46
+ browser = besidePage(classicBoard(await chromium.launch({ executablePath: exe })));
45
47
  if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
46
48
  const shot = async (p, name) => { if (SHOTS) await p.screenshot({ path: path.join(SHOTS, name + '.png') }); };
47
49
 
@@ -9,6 +9,7 @@
9
9
  * its place; Move to another program lists the other program with its count; a phone's ⋯ holds the same items
10
10
  * H Home: the initiative page's ⋯ holds the same two items; an initiative in no program keeps Turn into a program and has neither */
11
11
  const fs = require('fs');
12
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
12
13
  const os = require('os');
13
14
  const path = require('path');
14
15
  const { Readable } = require('stream');
@@ -78,7 +79,7 @@ const waitsOf = (id) => ((R.all(rctx).find((p) => p.id === 'project-ascent') ||
78
79
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
79
80
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
80
81
  await T.waitForServer(BASE);
81
- browser = besidePage(await chromium.launch({ executablePath: exe }));
82
+ browser = classicBoard(besidePage(await chromium.launch({ executablePath: exe })));
82
83
 
83
84
  const board = async (o = {}) => {
84
85
  seed();
@@ -8,6 +8,7 @@
8
8
  * (the programs, products and a product's initiatives are Home's and the Board's own lists, [data-po-list^="@"]: sort-order-test.js)
9
9
  * H Home: the program group lists the same order; the grip moves a row there too; a phone holds the row, then drags it */
10
10
  const path = require('path');
11
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
11
12
  const { spawn } = require('child_process');
12
13
  const { findBrowser } = require('./lib/find-browser');
13
14
  const T = require('./test-run').configure({ name: 'program-order' });
@@ -53,7 +54,7 @@ const routePrograms = async (page) => {
53
54
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
54
55
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
55
56
  await T.waitForServer(BASE);
56
- browser = await chromium.launch({ executablePath: exe });
57
+ browser = classicBoard(await chromium.launch({ executablePath: exe }));
57
58
 
58
59
  const board = async (o = {}) => {
59
60
  const ctx = await browser.newContext({ viewport: { width: o.w || 1440, height: o.h || 900 }, hasTouch: !!o.touch });
@@ -13,6 +13,8 @@
13
13
  * KRs (GET /api/boards/anchors), the Insights goals (GET /api/insights-premium) and the PMOS tasks (GET /api/boards/items) answer from
14
14
  * fixtures/program-ascent.js. */
15
15
  const path = require('path');
16
+ const { besidePage } = require('./lib/beside-page'); // these checks read the full page beside the page; in the popup work shows its three parts (nav slice 3)
17
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
16
18
  const { spawn } = require('child_process');
17
19
  const { findBrowser } = require('./lib/find-browser');
18
20
  const { openMission } = require('./lib/open-mission');
@@ -44,7 +46,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
44
46
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
45
47
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
46
48
  await T.waitForServer(BASE);
47
- browser = await chromium.launch({ executablePath: exe });
49
+ browser = besidePage(classicBoard(await chromium.launch({ executablePath: exe })));
48
50
 
49
51
  const open = async ({ w = 1440, h = 900, qs = '?ws=idpf&program=project-ascent', ctx = null, programs = F.programs() } = {}) => {
50
52
  const c = ctx || await openMission(await browser.newContext({ viewport: { width: w, height: h } }));
@@ -0,0 +1,87 @@
1
+ /* pm/artefact-kind.js — what kind of artefact a file is, and one row per kind (popup round 3 point 16: "Make the Kind specific such as
2
+ * prototype or PRD. And each type ideally should have 1 artefact only, with version shows if necessary. If there are multiple artefact for the
3
+ * same kind, then propose to merge"). Pure: no DOM, no reads. The popup's Artefacts table (pm/cozy-pop-work.js) and the Library share it.
4
+ *
5
+ * kindOf({ type, title, path, kind }) → 'PRD' | 'Prototype brief' | 'Design brief' | 'Eval rubric' | 'User stories' | 'Grilling critique' |
6
+ * 'Minutes' | 'Pre-read' | 'Update note' | 'API spec' | 'Guideline' | 'Anchor' | 'Report' | 'Brief' | 'Spec' | 'Done test' | 'Research' |
7
+ * 'Prototype' | 'Link' | 'Note' the frontmatter or Library type first, then the title, then the path; "Note" last, never "Document"
8
+ * versionOf(title) → 3 for "PRD v3", else 0
9
+ * group(rows, { at(row) → ms, current?(row) → bool, dropped: Set }) → { groups: [{ kind, cur, earlier, files, versions, series }], merge }
10
+ * one group per kind, in lifecycle order. cur: the record's own file when current() names one, else the newest. versions: the files
11
+ * are versions of one document (the same name but for a version mark or a date); files: different documents of one kind. merge:
12
+ * { id, say, kinds, ask } — one ✦ line that proposes to merge the kinds with several different files (never a series kind,
13
+ * Minutes, Update note, Report, nor a Note, Link or Research: separate things by nature), or null. dropped: the merge ids the PM said No to.
14
+ */
15
+ const RULES = [
16
+ [/\bprd\b|product requirements/i, 'PRD'],
17
+ [/prototype brief|proto(type)?[ -]brief/i, 'Prototype brief'],
18
+ [/design brief/i, 'Design brief'],
19
+ [/\brubric\b|\beval(uation)?\b/i, 'Eval rubric'],
20
+ [/user stor/i, 'User stories'],
21
+ [/\bgrill|critique/i, 'Grilling critique'],
22
+ [/minutes|meeting notes|\bmom\b/i, 'Minutes'],
23
+ [/pre-?read/i, 'Pre-read'],
24
+ [/update note|weekly update|status update/i, 'Update note'],
25
+ [/api spec|openapi|swagger/i, 'API spec'],
26
+ [/guideline|style guide|playbook/i, 'Guideline'],
27
+ [/\banchor\b/i, 'Anchor'],
28
+ [/\breport\b/i, 'Report'],
29
+ [/done test/i, 'Done test'],
30
+ [/\bresearch\b|interview/i, 'Research'],
31
+ [/\bbrief\b/i, 'Brief'],
32
+ [/\bspec(ification)?\b/i, 'Spec'],
33
+ ];
34
+ const TYPES = { prd: 'PRD', spec: 'Spec', 'done test': 'Done test', rubric: 'Eval rubric', 'eval rubric': 'Eval rubric', 'prototype brief': 'Prototype brief', 'design brief': 'Design brief',
35
+ research: 'Research', brief: 'Brief', report: 'Report', minutes: 'Minutes', 'meeting notes': 'Minutes', 'user stories': 'User stories', guideline: 'Guideline', guide: 'Guideline', 'api spec': 'API spec' };
36
+ export const SERIES = new Set(['Minutes', 'Update note', 'Report']);
37
+ const NOMERGE = new Set(['Minutes', 'Update note', 'Report', 'Note', 'Link', 'Research']); // separate things by nature: counted, never merged
38
+ export const ORDER = ['Anchor', 'Brief', 'Prototype brief', 'Prototype', 'Design brief', 'PRD', 'User stories', 'Eval rubric', 'Done test', 'Spec', 'API spec', 'Grilling critique', 'Guideline', 'Research', 'Pre-read', 'Minutes', 'Update note', 'Report', 'Link', 'Note'];
39
+
40
+ export function kindOf(x = {}) {
41
+ const t = String(x.type || '').trim().toLowerCase();
42
+ if (TYPES[t]) return TYPES[t];
43
+ if (x.kind === 'meeting') return 'Minutes';
44
+ if (x.kind === 'proto') return 'Prototype';
45
+ const words = String(x.title || '');
46
+ for (const [re, k] of RULES) if (re.test(words)) return k;
47
+ const p = String(x.path || '').split('/').pop().replace(/[-_.]+/g, ' ');
48
+ for (const [re, k] of RULES) if (re.test(p)) return k;
49
+ return x.kind === 'link' ? 'Link' : 'Note';
50
+ }
51
+ export function versionOf(title) { const m = /\bv(\d{1,3})\b/i.exec(String(title || '')); return m ? +m[1] : 0; }
52
+ /* the name without a version mark, a date or a "copy": two files with the same base are versions of one document */
53
+ const baseOf = (s) => String(s || '').toLowerCase().replace(/\bv\d{1,3}\b/g, '').replace(/\b\d{4}-\d{2}-\d{2}\b|\b\d{1,2} [a-z]{3}( \d{4})?\b/g, '').replace(/\b(copy|draft|final|old|new)\b/g, '').replace(/[^a-z0-9]+/g, ' ').trim();
54
+ const ACR = /^(PRD|API spec)$/;
55
+ const many = (k, n) => n + ' ' + (ACR.test(k) ? k + 's' : (k.toLowerCase().endsWith('s') ? k.toLowerCase() : k.toLowerCase() + 's')).replace(/^api specs$/, 'API specs');
56
+ const andList = (a) => (a.length <= 1 ? a.join('') : a.slice(0, -1).join(', ') + ' and ' + a[a.length - 1]);
57
+
58
+ export function group(rows, o = {}) {
59
+ const at = o.at || (() => 0), cur = o.current || (() => false), drop = o.dropped || new Set();
60
+ const by = new Map();
61
+ for (const r of rows || []) { const k = r.kindName || kindOf({ type: r.type, title: r.title, path: r.path, kind: r.akind || r.kind }); if (!by.has(k)) by.set(k, []); by.get(k).push(r); }
62
+ const rank = (k) => { const i = ORDER.indexOf(k); return i < 0 ? ORDER.length : i; };
63
+ const groups = [...by.entries()].sort((a, b) => rank(a[0]) - rank(b[0]) || a[0].localeCompare(b[0])).map(([kind, L]) => {
64
+ const real = L.filter((r) => !r.missing), miss = L.filter((r) => r.missing);
65
+ const sorted = real.slice().sort((a, b) => at(b) - at(a) || versionOf(b.title) - versionOf(a.title));
66
+ const named = sorted.find((r) => cur(r));
67
+ const c = named || sorted[0] || miss[0];
68
+ const rest = (sorted.length ? sorted : miss).filter((r) => r !== c);
69
+ const bases = new Set(sorted.map((r) => baseOf(r.title)));
70
+ const series = SERIES.has(kind);
71
+ const versions = sorted.length > 1 && bases.size === 1 && !series;
72
+ return { kind, cur: c, earlier: rest, n: sorted.length, versions, files: sorted.length > 1 && !versions ? sorted.length : 0, series, v: versionOf(c && c.title) };
73
+ });
74
+ const mergeable = groups.filter((g) => g.files > 1 && !NOMERGE.has(g.kind));
75
+ const id = 'merge:' + mergeable.map((g) => g.kind).join('+');
76
+ const merge = mergeable.length && !drop.has(id) ? { id, kinds: mergeable.map((g) => g.kind),
77
+ say: andList(mergeable.map((g) => many(g.kind, g.files))) + ' can each be one artefact. Merge them?',
78
+ ask: 'Merge the ' + andList(mergeable.map((g) => many(g.kind, g.files))) + ' of this initiative into one artefact per kind: the newest is the base, add the parts only the others have, name the sources at the end, and keep the old files as earlier versions. Delete nothing. Tell me what you merged.' } : null;
79
+ return { groups, merge };
80
+ }
81
+ /** The Version cell: "v3 · 2 earlier" when there is more than one; "v2" for one file that says its version; '' otherwise (zero is silence). */
82
+ export function versionText(g) {
83
+ if (g.series) return g.n > 1 ? g.n + (g.kind === 'Minutes' ? ' meetings' : ' in all') : '';
84
+ if (g.versions) return (g.v ? 'v' + g.v : 'v' + g.n) + ' · ' + g.earlier.length + ' earlier';
85
+ if (g.files) return g.files + ' files';
86
+ return g.v ? 'v' + g.v : '';
87
+ }
@@ -38,6 +38,9 @@ import * as MD from './home-ini-model.js'; // the stage move's rules, as Home
38
38
  import * as WF from './ini-wf.js'; // D99: Change workflow, Won't do, Back to Triage, Archive, the same popovers as Home's
39
39
  import { openPop, closePop, undoToast, ensureCss as ensurePopCss } from './hi-pop.js';
40
40
  import { readyOf } from './bd-acts.js'; // how much of the step is ready, beside the next stage in the stage picker
41
+ import * as PW from './cozy-pop-work.js'; // what the popup shows for work (slice 3 of the six-place navigation): in the popup, in place of the old page
42
+ import * as PP from './ini-props.js'; // everything PMOS suggests, as a drill-in (the popup's ⋯)
43
+ import { stageName } from './stage-chip.js';
41
44
  import { iniMore as iniMoreOf, iniText, stagePick, deleteSaid, DELETE_MS } from './ini-more.js'; // the one initiative ⋯ menu and stage picker (batch 14 item 5, batch 16 item 5c)
42
45
 
43
46
  let O = null;
@@ -74,7 +77,7 @@ async function readPage(r, force) {
74
77
  /** Documents, as a drill-in of the view (Home's page opens its Documents view): each core document with its state; a press opens it. */
75
78
  function openDocs(r) {
76
79
  const L = ((PAGE.get(r.id) || {}).docs) || [];
77
- const rows = L.map((d) => `<button type="button" class="czs-it"${d.path ? ` data-doc="${esc(d.path)}"` : ' disabled'} aria-label="${d.path ? 'Open ' : ''}${esc(d.title)}"><span class="w">${esc(d.title)}<span>${esc([d.when, d.by, MD.docPill(d)[0]].filter(Boolean).join(' · '))}</span></span>${d.look ? '<span class="czs-amb" role="img" aria-label="Needs a look"></span>' : ''}</button>`).join('');
80
+ const rows = L.map((d) => `<button type="button" class="czs-it"${d.path ? ` data-doc="${esc(d.path)}"${r.ws ? ` data-doc-ws="${esc(r.ws)}"` : ''}` : ' disabled'} aria-label="${d.path ? 'Open ' : ''}${esc(d.title)}"><span class="w">${esc(d.title)}<span>${esc([d.when, d.by, MD.docPill(d)[0]].filter(Boolean).join(' · '))}</span></span>${d.look ? '<span class="czs-amb" role="img" aria-label="Needs a look"></span>' : ''}</button>`).join('');
78
81
  VW.drill();
79
82
  VW.open({ kind: 'Documents', title: r.title, icon: 'doc', back: true, id: 'docs:' + vidOf(r), html: `<div class="hi-v">${rows || '<p class="hi-small">No document is on record yet.</p>'}</div>` });
80
83
  }
@@ -181,9 +184,10 @@ function dashFor(r) {
181
184
  }
182
185
  return DASH.get(r.key);
183
186
  }
184
- function iniBody(r) {
187
+ function iniBody(r, body) {
185
188
  const h = dashFor(r);
186
189
  if (h && h.shows()) return h.html(() => '');
190
+ if (PW.on(body)) return PW.html(r, viewOf(r), popOpts(r));
187
191
  const md = (v) => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+v.slice(5, 7) - 1] + ' ' + +v.slice(8, 10) + (+v.slice(0, 4) !== new Date().getFullYear() ? ' ’' + v.slice(2, 4) : '');
188
192
  const self = !!((O.M() || {}).board || {}).self, M = O.M() || {};
189
193
  // what left the ⋯ for the thing it changes (batch 16 item 5c): the workflow chip, the dashed +, the stage chip, the dates chip, Jira's ↻
@@ -193,17 +197,72 @@ function iniBody(r) {
193
197
  next: !!(r.id && v.stage.next && O.moreAct && !self), docs: docs.length ? { n: docs.length } : null, tail: TL.tailHtml(r, { VW, today: M.today }),
194
198
  wf: !!r.id && !self && !r.ended, person: !!r.id, stagePick: !!r.id, planDates: !!r.id, jira: !!M.jira });
195
199
  }
200
+ /** What pm/cozy-pop-work.js reads for the row: the Board's steps and day, the core documents, the product and the program. */
201
+ function popOpts(r) {
202
+ const M = O.M() || {}, B = M.board || {}, p = O.programOf ? O.programOf(r) : null;
203
+ return { steps: M.steps || [], today: M.today, docs: ((r.id && PAGE.get(r.id)) || {}).docs || [], product: r.wsName || (r.ws && r.ws !== B.ws ? r.ws : (M.product && M.product.name) || B.name || B.ws) || '', program: p ? { id: p.id, title: p.title } : null, canProduct: true, ws: r.ws || B.ws || '', board: r.boardId || B.id || '', id: r.id || '' };
204
+ }
205
+ /** The popup's own presses for the row: every part of the old page as a drill-in (so nothing is lost), and everything PMOS suggests. */
206
+ function popExtra(r) {
207
+ if (!r) return {};
208
+ const H = { where: () => where(O.rowOf(r.key) || r), reload: () => (O.reload ? O.reload() : null), toast: (m, u) => (O.toast ? O.toast(m, u) : null) };
209
+ return {
210
+ allParts: () => {
211
+ const x = O.rowOf(r.key) || r;
212
+ VW.drill();
213
+ VW.open({ kind: 'Initiative', title: x.title, icon: 'goal', id: 'all:' + vidOf(x), back: true,
214
+ render: (b) => { b.dataset.pwAll = '1'; const y = O.rowOf(r.key) || x; b.innerHTML = iniBody(y, b); wire(b, y.key); } });
215
+ },
216
+ props: r.id ? () => { const x = O.rowOf(r.key) || r; VW.drill(); PP.open(viewOf(x), H); } : null,
217
+ product: () => openProduct(O.rowOf(r.key) || r),
218
+ };
219
+ }
220
+ /** The product one level up, in the same popup (board 27): its programs, then the initiatives in no program, with the timeline. A row goes one
221
+ * level down. Read from the Board's own model, so nothing new is fetched. */
222
+ function productOf(ws) {
223
+ const M = O.M() || {}, B = M.board || {}, today = M.today;
224
+ const all = (M.rows || []).filter((x) => x.id && !x.archived && (x.ws || B.ws || '') === ws); // the board's own row (no id) is not work
225
+ const progs = new Map(), loose = [];
226
+ for (const x of all) { const p = O.programOf ? O.programOf(x) : null; if (p) { if (!progs.has(p.id)) progs.set(p.id, { p, rows: [] }); progs.get(p.id).rows.push(x); } else loose.push(x); }
227
+ const lo = (rs) => rs.map((x) => String(x.start || '').slice(0, 10)).filter(Boolean).sort()[0] || '';
228
+ const hi = (rs) => rs.map((x) => String(x.end || '').slice(0, 10)).filter(Boolean).sort().pop() || '';
229
+ const done = (x) => x.status === 'done' || !!x.closed;
230
+ const rows = [];
231
+ for (const { p, rows: rs } of progs.values()) rows.push({ id: p.id, kind: 'program', title: p.title, stage: '', count: rs.length + (rs.length === 1 ? ' initiative' : ' initiatives'), start: lo(rs), end: hi(rs), done: rs.every(done) });
232
+ for (const x of loose) rows.push({ id: x.key, kind: 'ini', title: x.title, stage: stageName(x) || (x.track && x.track.label) || '', start: String(x.start || '').slice(0, 10), end: String(x.end || '').slice(0, 10), done: done(x) });
233
+ const name = (all[0] && all[0].wsName) || (ws === B.ws ? (M.product && M.product.name) || B.name : '') || ws;
234
+ const late = rows.filter((x) => x.end && !x.done && today && x.end < today).length;
235
+ const facts = [{ k: 'Programs', v: String(progs.size) }, { k: 'Initiatives', v: String(all.length), note: late ? late + ' late' : '', warn: late > 0 }];
236
+ const mo = (d) => (d ? new Date(d + 'T12:00:00Z').toLocaleDateString('en-GB', { month: 'short', year: 'numeric', timeZone: 'UTC' }) : '');
237
+ if (lo(all) || hi(all)) facts.push({ k: 'Dates', v: [mo(lo(all)), mo(hi(all))].filter(Boolean).join(' to ') });
238
+ const said = all.length ? all.length + (all.length === 1 ? ' initiative' : ' initiatives') + (progs.size ? ' in ' + progs.size + (progs.size === 1 ? ' program' : ' programs') + (loose.length ? ' and ' + loose.length + ' on their own' : '') : '') + (late ? ', ' + late + ' late.' : ', none late.') : 'No initiative is in it yet.';
239
+ return { kind: 'product', title: name, summary: said, facts, rows, docs: [], today };
240
+ }
241
+ function openProduct(r) {
242
+ const M = O.M() || {}, ws = r.ws || (M.board || {}).ws || '';
243
+ const L0 = productOf(ws);
244
+ VW.drill();
245
+ VW.open({ kind: 'Product', title: L0.title, icon: 'goal', id: 'product:' + ws, back: true,
246
+ render: (body) => {
247
+ const L = productOf(ws);
248
+ body.innerHTML = PW.levelHtml(L, { today: L.today, add: false });
249
+ PW.wireLevel(body, {
250
+ redraw: () => { const t = body.scrollTop, L2 = productOf(ws); body.innerHTML = PW.levelHtml(L2, { today: L2.today, add: false }); body.scrollTop = t; },
251
+ go: (kind, id, b) => { if (kind === 'program' && O.openProgram) { VW.drill(); O.openProgram(id, b); } else if (kind === 'ini' && O.openIniId) { const x = O.rowOf(id); VW.drill(); if (x && x.id) O.openIniId(x.id); } },
252
+ }, () => productOf(ws));
253
+ } });
254
+ }
196
255
  /** Presses inside the shown item: the view's own (pm/ini-view.js), a ticket's drill-in, the PRD-change question. A [data-doc] goes to the page's handler. */
197
256
  function wire(body, key) {
198
- const redraw = () => { const r = O.rowOf(key); if (!r || (cur && cur.tk)) return; const top = body.scrollTop; body.innerHTML = iniBody(r); body.scrollTop = top; };
199
- wireView(body, {
257
+ const redraw = () => { const r = O.rowOf(key); if (!r || (cur && cur.tk && !body.dataset.pwAll)) return; const top = body.scrollTop; body.innerHTML = iniBody(r, body); body.scrollTop = top; };
258
+ const H = {
200
259
  // planned versus actual (batch 11 item 8, pm/ini-versions.js): where a draft's writes go, the read after Make live, the toast with Undo
201
260
  where: () => { const r = O.rowOf(key), M = O.M() || {}; return { ws: (r && r.ws) || (M.board && M.board.ws), board: (r && r.boardId) || (M.board && M.board.id) }; },
202
261
  reload: () => (O.reload ? O.reload() : null),
203
262
  toast: (m, undo) => (O.toast ? O.toast(m, undo) : null),
204
263
  check: (uid, b) => { const r = O.rowOf(key), k = r && (r.tasks || []).find((x) => x.uid === uid); if (r && O.setTask) O.setTask(r, uid, k && k.status === 'Done' ? 'To do' : 'Done'); },
205
264
  // the quick changes (batch 9 item 5b): the status caret, the date press and a Timeline or Kanban drag, each with Undo in the toast
206
- status: (uid, state) => { const r = O.rowOf(key); if (r && O.setTask) O.setTask(r, uid, state); },
265
+ status: (uid, state, w) => { const r = O.rowOf(key); if (r && O.setTask) O.setTask(r, uid, state, w); },
207
266
  dates: (uid, patch) => { const r = O.rowOf(key); if (r && O.setDates) O.setDates(r, uid, patch); },
208
267
  // the ◇ in the status picker (batch 11 item 3): a task made a milestone, or made a plain task again, with Undo
209
268
  milestone: (uid, on) => { const r = O.rowOf(key); if (r && O.setDates) O.setDates(r, uid, { milestone: !!on }); },
@@ -222,7 +281,7 @@ function wire(body, key) {
222
281
  const r = O.rowOf(key); if (!r) return;
223
282
  if (act === 'grill') O.grillOpen(r, b);
224
283
  else if (act === 'commit') O.send(r); // the Commit of drafted tickets opens the Send sheet (tk-send.js), the one path to Jira
225
- else if (act.startsWith('doc:')) O.viewDoc(act.slice(4));
284
+ else if (act.startsWith('doc:')) O.viewDoc(act.slice(4), (O.rowOf(key) || {}).ws);
226
285
  else if (act === 'page' && r.id) location.assign(O.pageHref(r));
227
286
  },
228
287
  program: (id, b) => { if (O.openProgram) O.openProgram(id, b); },
@@ -237,16 +296,22 @@ function wire(body, key) {
237
296
  // Claude's split or merge card (batch 11 item 14): ✕ Not now, ✎ Change it first, ✓ as suggested; the merged summary's link opens the one that stays
238
297
  sm: (act, b) => { const r = O.rowOf(key); if (r && O.smPress) O.smPress(r, act, b); },
239
298
  openIni: (id) => { if (O.openIniId) O.openIniId(id); },
240
- doc: (path) => O.viewDoc(path),
299
+ doc: (path) => O.viewDoc(path, (O.rowOf(key) || {}).ws), // the initiative's own workspace, not the board's (round 3 point 17)
241
300
  redraw,
242
- });
301
+ };
302
+ // in the popup: what the popup shows for work (pm/cozy-pop-work.js), with the same handlers; else the old page
303
+ if (PW.on(body)) {
304
+ PW.wire(body, { ...H, ...popExtra(O.rowOf(key)) }, { r: () => O.rowOf(key), v: () => { const r = O.rowOf(key); return r ? viewOf(r) : null; }, o: () => { const r = O.rowOf(key); return r ? popOpts(r) : {}; } });
305
+ return;
306
+ }
307
+ wireView(body, H);
243
308
  body.onclick = (e) => {
244
309
  const r = O.rowOf(key); if (!r) return;
245
310
  const tk = e.target.closest('[data-tk]'); if (tk) { const k = ((r.track && r.track.tickets) || []).find((x) => x.key === tk.dataset.tk); if (k) openTicket(r, k); return; }
246
311
  const a = e.target.closest('[data-czs-act], [data-xb]'); if (!a) return;
247
312
  const act = a.dataset.czsAct || a.dataset.xb;
248
313
  if (act === 'drift') location.assign(O.askHref(r, a.dataset.q || ''));
249
- else if (act.startsWith('doc:')) O.viewDoc(act.slice(4));
314
+ else if (act.startsWith('doc:')) O.viewDoc(act.slice(4), (O.rowOf(key) || {}).ws);
250
315
  };
251
316
  }
252
317
  /** The shell's id of an initiative: its record id, so Discuss in chat names it (?about=init:<id>&vid=<id>) and Home reopens it beside the chat. */
@@ -262,7 +327,7 @@ export function openIni(r, from, o = {}) {
262
327
  // on a desk it opens in the one popup with Ask PMOS about it beside it (slice 2 of the six-place navigation); a phone keeps its sheet
263
328
  const B = (O.M() || {}).board || {};
264
329
  VW.open({ kind: 'Initiative', title: r.title, icon: 'goal', wrap: true, id: vidOf(r), pop: { id: r.id || '', kind: 'initiative', title: r.title, ws: r.ws || B.ws || undefined },
265
- discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: () => iniMore(O.rowOf(r.key) || r), rename: O.rename ? O.rename(r) : null,
330
+ discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: () => { const x = O.rowOf(r.key) || r, b = VW.bodyOf(vidOf(x)); return (PW.on(b) ? PW.moreItems(null, popExtra(x)) : []).concat(iniMore(x)); }, rename: O.rename ? O.rename(r) : null,
266
331
  // the kind of work (batch 29 item 11, KdV1-3): its glyph stands before Discuss; a tap opens the three kinds. A published copy
267
332
  // (pm/readonly.js) cannot change it, so it has no press: the Board's icon still names the kind
268
333
  presses: (window.PMOS_READONLY ? [] : [WK.pressOf(r.kind)]).concat(dashFor(r) ? dashFor(r).presses() : []), onPress: (a, b) => {
@@ -273,7 +338,7 @@ export function openIni(r, from, o = {}) {
273
338
  apply: (k) => { const y = O.rowOf(r.key) || x; y.kind = k; VW.setPresses(vidOf(y), [WK.pressOf(k)].concat(dashFor(y) ? dashFor(y).presses() : [])); if (O.redraw) O.redraw(); refresh(true); },
274
339
  reload: async () => { if (O.reload) await O.reload(); } }), !!((O.M() || {}).board || {}).factory);
275
340
  },
276
- render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null, vid: vidOf(x) }; O.onShow(x.key, from); body.innerHTML = iniBody(x); wire(body, x.key); { const h = dashFor(x); if (h) h.wire(body); } if (adding === x.key) { const f = body.querySelector('#ivAddTask'); if (f && document.activeElement !== f) f.focus(); } },
341
+ render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null, vid: vidOf(x) }; O.onShow(x.key, from); body.innerHTML = iniBody(x, body); wire(body, x.key); { const h = dashFor(x); if (h) h.wire(body); } if (adding === x.key) { const f = body.querySelector('#ivAddTask'); if (f && document.activeElement !== f) f.focus(); } },
277
342
  onClose: () => { if (cur && cur.key === r.key && !cur.tk) { cur = null; O.onHide(); } } });
278
343
  }
279
344
 
@@ -307,7 +372,7 @@ export function refresh(force) {
307
372
  const b = VW.bodyOf(vidOf(r)); if (!b || (!force && document.activeElement && b.contains(document.activeElement))) return;
308
373
  if (cur.tk) return; // the ticket Viewer reads its own records (tk-view.js); Read Jira again opens it fresh
309
374
  const top = b.scrollTop;
310
- b.innerHTML = iniBody(r);
375
+ b.innerHTML = iniBody(r, b);
311
376
  b.scrollTop = top;
312
377
  }
313
378
  /** Close the initiative's own Viewer (never the chat beside it). A ticket drilled in shows under its own id: the Viewer used last, as before. */
@@ -40,7 +40,8 @@ import * as MSG from './ms-suggest.js';
40
40
  import * as MD from './metric-drafts.js'; // the goal Claude drafts when the charter has none (batch 15 item 1, canvas Iq9Program)
41
41
  import * as DB from './dash-view.js'; // the page model's parts: the reports and the proposals (batch 17 item 1)
42
42
  import { stageName } from './stage-chip.js'; // W1: the one stage
43
- import * as PV from './prog-page.js'; // the one program page: the top and four tabs (batch 21 item 2, canvas RdProgL–RdProgP)
43
+ import * as PV from './prog-page.js';
44
+ import * as PW from './cozy-pop-work.js'; // in the popup: the program one level up, the same three parts as an initiative (slice 3, board 26) // the one program page: the top and four tabs (batch 21 item 2, canvas RdProgL–RdProgP)
44
45
 
45
46
  const SV = (d, w) => `<svg viewBox="0 0 24 24" width="${w || 18}" height="${w || 18}" aria-hidden="true"><path d="${d}"/></svg>`;
46
47
  const I = {
@@ -413,6 +414,7 @@ function draw(keepFocus) {
413
414
  const p = progOf(cur.id); if (!p) { VW.close(); return; }
414
415
  readAway(p); readMore(p); readDrafts(p);
415
416
  const b = VW.body(); if (!b) return;
417
+ if (PW.on(b)) { const t = b.scrollTop, L = levelOf(cur.id); if (L) { b.innerHTML = PW.levelHtml(L, { today: L.today, add: false }); b.scrollTop = t; } return; } // the program in the popup (board 26)
416
418
  const f = keepFocus && document.activeElement && b.contains(document.activeElement) ? document.activeElement : null;
417
419
  const sel = f ? (f.dataset.pp ? `[data-pp="${f.dataset.pp}"]` + (f.dataset.fold ? `[data-fold="${CSS.escape(f.dataset.fold)}"]` : '') + (f.dataset.key ? `[data-key="${CSS.escape(f.dataset.key)}"]` : '') + (f.dataset.ms ? `[data-ms="${CSS.escape(f.dataset.ms)}"]` : '') : f.dataset.czsFold ? `[data-czs-fold="${CSS.escape(f.dataset.czsFold)}"]` : null) : null;
418
420
  const top = b.scrollTop;
@@ -474,9 +476,59 @@ function openPanel(id, from, via) {
474
476
  rename.save = ((save) => async (title, x) => { const r = await save(title, x); if (!r.ok) return r; p.title = r.title; rename.value = r.title; return { ...r, title: titleOf(p) }; })(rename.save);
475
477
  rename.value = p.title;
476
478
  VW.open({ kind: 'Program', title: titleOf(p), icon: I.prog, id: 'program:' + id,
477
- discuss: true, more: moreOf(p), rename,
479
+ // on a desk the program opens in the one popup, the chat about it beside it (slice 3 of the six-place navigation, board 26)
480
+ pop: RO ? undefined : { id: p.id, kind: 'program', title: p.title, ws: p.home || board().ws || undefined },
481
+ discuss: true, more: () => (PW.on(VW.bodyOf('program:' + id)) ? [{ label: 'Every part', on: () => allParts(id) }, { sep: true }] : []).concat(moreOf(progOf(id) || p)), rename,
478
482
  render: (body) => {
479
483
  { const q = progOf(id); if (q && VW.current() && VW.current().title !== titleOf(q)) VW.retitle('program:' + id, titleOf(q)); } // a rename in the charter, on ←
484
+ if (PW.on(body)) { levelDraw(body, id, from); return; }
485
+ oldDraw(body, id, from);
486
+ },
487
+ onClose: () => {
488
+ document.querySelectorAll('#ibBody [data-prow].sel').forEach((x) => x.classList.remove('sel'));
489
+ cur = null;
490
+ } });
491
+ return true;
492
+ }
493
+ /** The program in the popup (board 26): Overview, its initiatives with the timeline, its artefacts. A row opens the initiative in the same popup. */
494
+ function levelOf(id) {
495
+ const p = progOf(id); if (!p) return null;
496
+ const st = programState(p, rowsOf);
497
+ const rows = st.inis.map((i) => ({ id: i.id, kind: 'ini', ws: i.ws, title: i.title, stage: stageName(i.row) || (i.row.track && i.row.track.label) || i.stage || '', start: i.row.start || '', end: i.row.end || '', done: i.row.status === 'done' || !!i.row.closed }));
498
+ const today = (O.M() || {}).today;
499
+ const late = rows.filter((x) => x.end && !x.done && today && x.end < today).length;
500
+ const nx = st.next;
501
+ const facts = [];
502
+ if (p.goal) facts.push({ k: 'Outcome', v: p.goal });
503
+ if (st.products && st.products.length) facts.push({ k: st.products.length > 1 ? 'Products' : 'Product', v: st.products.map((x) => x.name || x).join(', ') });
504
+ if (st.span && st.span.label) facts.push({ k: 'Dates', v: st.span.label });
505
+ if (nx) facts.push({ k: 'Next milestone', v: nx.name, note: nx.day || '', warn: !!nx.late });
506
+ if (rows.length) facts.push({ k: 'Initiatives', v: String(rows.length), note: late ? late + ' late' : '', warn: late > 0 });
507
+ if (p.owner) facts.push({ k: 'Owner', v: p.owner });
508
+ const said = [p.goal ? p.goal.replace(/\.?$/, '.') : '', rows.length ? (late ? late + ' of ' + rows.length + (rows.length === 1 ? ' initiative is' : ' initiatives are') + ' late.' : rows.length + (rows.length === 1 ? ' initiative' : ' initiatives') + ', none late.') : 'No initiative is in it yet.', nx ? 'Next: ' + nx.name + (nx.day ? ', ' + nx.day : '') + '.' : ''].filter(Boolean).join(' ');
509
+ const docs = [{ title: 'Charter', kind: 'Document', when: '', charter: true }].concat(docsOf(st).map((d) => ({ title: d.name, kind: 'Document · ' + d.ini, when: '', path: d.path })));
510
+ return { kind: 'program', title: p.title, summary: said, facts, rows, docs, today };
511
+ }
512
+ function levelDraw(body, id, from) {
513
+ cur = { id, from: from || (cur && cur.id === id && cur.from) || null };
514
+ const L = levelOf(id); if (!L) { body.innerHTML = ''; return; }
515
+ body.innerHTML = PW.levelHtml(L, { today: L.today, add: false });
516
+ PW.wireLevel(body, {
517
+ redraw: () => { const t = body.scrollTop; const L2 = levelOf(id); if (L2) { body.innerHTML = PW.levelHtml(L2, { today: L2.today, add: false }); body.scrollTop = t; } },
518
+ go: (kind, iid) => { if (kind === 'ini') { VW.drill(); O.openIni(iid, null); } },
519
+ doc: (path) => { const a = document.createElement('button'); a.dataset.doc = path; a.hidden = true; document.body.appendChild(a); a.click(); a.remove(); },
520
+ art: (a) => { if (!a || !a.charter) return false; const q = progOf(id); if (q) openCharter(q); return true; },
521
+ }, () => levelOf(id));
522
+ }
523
+ /** Every part of the old program page, as a drill-in of the popup (so nothing is lost). */
524
+ function allParts(id) {
525
+ const p = progOf(id); if (!p) return;
526
+ VW.drill();
527
+ VW.open({ kind: 'Program', title: titleOf(p), icon: I.prog, id: 'program-all:' + id, back: true, more: moreOf(p),
528
+ render: (body) => { body.dataset.pwAll = '1'; oldDraw(body, id, null); } });
529
+ }
530
+ function oldDraw(body, id, from) {
531
+ {
480
532
  cur = { id, from: from && !(VW.body() && VW.body().contains(from)) ? from : (cur && cur.id === id && cur.from) || null };
481
533
  body.classList.add('pp-vw');
482
534
  const q = progOf(id); if (q) { readAway(q); readMore(q); readDrafts(q); body.innerHTML = viewHtml(q); }
@@ -491,12 +543,7 @@ function openPanel(id, from, via) {
491
543
  body.onclick = (e) => { if (e.target.closest('[data-db], [data-pv]')) return; const d = e.target.closest('[data-md]'); if (d && body.contains(d) && !d.disabled) { MD.press(d, { redraw: () => draw(), toast: (t) => O.say(t) }); return; } const m = e.target.closest('[data-ms-act]'); if (m && body.contains(m) && !m.disabled) { suggestPress(m); return; } const b = e.target.closest('[data-pp]'); if (b && body.contains(b)) press(b); };
492
544
  body.onsubmit = submit;
493
545
  document.querySelectorAll('#ibBody [data-prow]').forEach((x) => x.classList.toggle('sel', x.dataset.prow === id));
494
- },
495
- onClose: () => {
496
- document.querySelectorAll('#ibBody [data-prow].sel').forEach((x) => x.classList.remove('sel'));
497
- cur = null;
498
- } });
499
- return true;
546
+ }
500
547
  }
501
548
  function setFold(k) { if (fold.has(k)) fold.delete(k); else fold.add(k); keepFold(); draw(true); }
502
549
  /** Opens one folding row (the track's clusters open Milestones, "N more tasks" opens On its initiatives) and scrolls to it. */
@@ -217,6 +217,11 @@ const slipWords = (r, e) => { const p = r.plan, b = p && day(p.end), n = p && p.
217
217
 
218
218
  /** One initiative's marks: the plan cut by its gaps and holds, the forecast past the plan, the shown milestones, the end ◇ and one label after the
219
219
  * furthest mark. */
220
+ /** One initiative's bar as the Board draws it, for another page's own timeline: Work's list (pm/bd-work.js) and the popup's Work breakdown
221
+ * (pm/cozy-pop-work.js), so the bar has one design everywhere (Wawan, 2026-11-19). X: a date → its percent of the box; the markup sits in a
222
+ * position:relative box of the row's height. o: { pxPct: px per 1 % of the box, reach: days in which ◇s merge, mode: 'all' | 'pinned',
223
+ * label: false drops the end label, phone } → html */
224
+ export const rowBar = (r, X, now, o = {}) => qBar(r, X, now, !!o.phone, md, o.pxPct || 0, { reach: o.reach || 7, mode: o.mode || 'all', noLabel: o.label === false });
220
225
  function qBar(r, X, now, phone, fmt, pxPct, ms = {}) {
221
226
  const s = day(r.start), e = day(r.end), fr = fcRange(r), fc = r.forecast ? null : r.track && day(r.track.forecast), tone = toneOf(r);
222
227
  const tm = taskMarks(r, X, now, phone, pxPct, ms), et = tm.end, note = markWords(r, now);