create-pmos 0.427.0 → 0.428.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 (63) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/board-programs-test.js +16 -2
  7. package/workspace/briefing-premium-board-test.js +25 -20
  8. package/workspace/briefing-premium-test.js +2 -1
  9. package/workspace/changelog.json +12 -0
  10. package/workspace/guide/briefing-premium.md +4 -2
  11. package/workspace/guide/home.md +32 -7
  12. package/workspace/guide/programs.md +1 -0
  13. package/workspace/home-other-product-test.js +12 -2
  14. package/workspace/lib/routes-meeting-material.js +22 -1
  15. package/workspace/lib/settings-store.js +14 -0
  16. package/workspace/milestone-pins-test.js +13 -0
  17. package/workspace/milestone-suggest-test.js +10 -4
  18. package/workspace/package-lock.json +2 -2
  19. package/workspace/package.json +1 -1
  20. package/workspace/premium-board-actions-test.js +40 -13
  21. package/workspace/premium-rec-tab-test.js +8 -0
  22. package/workspace/premium-vw-item-test.js +7 -3
  23. package/workspace/premium-vw-jira-test.js +2 -1
  24. package/workspace/program-charter-test.js +1 -1
  25. package/workspace/program-leave-test.js +2 -2
  26. package/workspace/program-order-test.js +3 -2
  27. package/workspace/program-panel-test.js +2 -1
  28. package/workspace/public/pm/bd-acts.js +20 -26
  29. package/workspace/public/pm/bd-ini-panel.js +90 -32
  30. package/workspace/public/pm/bd-pin-card.js +4 -1
  31. package/workspace/public/pm/bd-span.js +22 -12
  32. package/workspace/public/pm/cozy-rec-tab.js +12 -3
  33. package/workspace/public/pm/cozy-viewer.js +157 -23
  34. package/workspace/public/pm/cozy-vw-shell.css +13 -0
  35. package/workspace/public/pm/hi-pop.css +82 -0
  36. package/workspace/public/pm/hi-pop.js +65 -0
  37. package/workspace/public/pm/home-app.js +55 -26
  38. package/workspace/public/pm/home-ini.css +6 -76
  39. package/workspace/public/pm/home-ini.js +50 -68
  40. package/workspace/public/pm/home-list.js +29 -3
  41. package/workspace/public/pm/home-today.js +18 -7
  42. package/workspace/public/pm/ini-more.js +67 -0
  43. package/workspace/public/pm/ini-view-model.js +3 -2
  44. package/workspace/public/pm/ini-view.css +3 -1
  45. package/workspace/public/pm/ini-view.js +7 -5
  46. package/workspace/public/pm/order-model.js +85 -0
  47. package/workspace/public/pm/premium-board.js +57 -11
  48. package/workspace/public/pm/premium-insights.js +11 -1
  49. package/workspace/public/pm/premium-vw-item.js +3 -1
  50. package/workspace/public/pm/premium-vw-jira.js +2 -0
  51. package/workspace/public/pm/prog-order.js +15 -2
  52. package/workspace/public/pm/sort-order.css +17 -0
  53. package/workspace/public/pm/sort-order.js +108 -0
  54. package/workspace/public/pm/tk-view.js +3 -2
  55. package/workspace/public/pm/wf-page.js +1 -1
  56. package/workspace/public/premium-board.html +1 -0
  57. package/workspace/sort-order-test.js +201 -0
  58. package/workspace/stage-card-test.js +1 -0
  59. package/workspace/task-card-test.js +1 -1
  60. package/workspace/test-lists/sort-order.json +6 -0
  61. package/workspace/test-lists/viewer-trail.json +5 -0
  62. package/workspace/tk-tasks-test.js +5 -3
  63. package/workspace/viewer-trail-test.js +145 -0
@@ -6,7 +6,7 @@
6
6
  * F a program with no milestones: Claude's first suggestions take the place of "Add the first milestone", each with why and its source; ✓ ✎ ✕
7
7
  * are icon-only; keep all · W later changes lead Waits on you; ✓ keeps, ✕ drops · C the pencil opens the charter with the change filled in;
8
8
  * Save writes it and answers the suggestion; last checked and Check now · Z nothing to suggest, nothing shows · K the ◆ dates are reported once
9
- * · M Home's Your move has one line per program · H on a phone. PMOS_SHOTS=<dir> also saves the screenshots the frames are compared with. */
9
+ * · M Home's program card leads with its milestone changes · H on a phone. PMOS_SHOTS=<dir> also saves the screenshots the frames are compared with. */
10
10
  const path = require('path');
11
11
  const fs = require('fs');
12
12
  const { spawn } = require('child_process');
@@ -142,14 +142,20 @@ const withReview = (open, o = {}) => F.programs().map((p) => ({ ...p, ...(o.empt
142
142
 
143
143
  /* ── M: Home's Your move ── */
144
144
  const M = await open({ home: true });
145
- // Your move lives in Your day, which the greeting opens
146
- if (await until(() => M.page.$('[data-hm-day]'), 10000)) { await until(() => M.page.evaluate(() => !!document.querySelector('[data-hm-prog]')), 8000); await M.page.click('[data-hm-day]'); }
145
+ // the program's milestone changes lead its card on Home (batch 14 item 4: a desktop has no Your day; the greeting opens the calendar)
146
+ await until(() => M.page.evaluate(() => !!document.querySelector('[data-hm-prog]')), 10000);
147
147
  const hm = await until(() => M.page.evaluate(() => { const b = document.querySelector('[data-hm-sel="ms:project-ascent"]'); return b ? [...b.querySelectorAll('b, em')].map((x) => x.textContent.trim()).join(' · ') : null; }), 10000);
148
- ok('M Home\'s Your move has one line for the program: its name and the changes', hm === 'Project Ascent · 3 milestone changes · Pilot live to Dec 2', String(hm));
148
+ ok('M Home\'s program card has one line for its milestone changes, first', hm === '3 milestone changes · Pilot live to Dec 2', String(hm));
149
149
  if (hm) {
150
150
  await M.page.click('[data-hm-sel="ms:project-ascent"]');
151
151
  ok('M a tap opens the program, where the changes lead Waits on you', !!(await until(() => M.page.evaluate(() => !!document.querySelector('#czViewer [data-czs-id="needs"] .msg-r')), 8000)));
152
152
  }
153
+ // batch 14 item 4: on a desktop the greeting opens the calendar in the Viewer, not Your day
154
+ if (await M.page.$('[data-hm-day]')) {
155
+ await M.page.click('[data-hm-day]');
156
+ const vw = await until(() => M.page.evaluate(() => { const v = document.querySelector('#czViewer'); const t = v && !v.hidden ? v.textContent.replace(/\s+/g, ' ') : ''; return /Calendar|Your move/.test(t) ? t : null; }), 8000);
157
+ ok('D on a desktop the greeting opens the calendar in the Viewer; there is no Your day', vw && /Calendar/.test(vw) && !/Your move/.test(vw), String(vw).slice(0, 200));
158
+ }
153
159
  ok('0 no page error on Home', M.errors.length === 0, M.errors.join(' | '));
154
160
  await M.ctx.close();
155
161
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.427.0",
3
+ "version": "0.428.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.427.0",
9
+ "version": "0.428.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.427.0",
3
+ "version": "0.428.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -88,9 +88,11 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
88
88
  const peekOn = (title) => until(() => p.evaluate((t) => { const k = document.querySelector('#czViewer'); return k && !k.hidden && (document.querySelector('#czViewer .cz-vw-title') || {}).textContent === t && !k.querySelector('.bd-wtag'); }, title));
89
89
  const popOn = (re) => until(() => p.evaluate((s) => { const k = document.querySelector('#bdPop'); return k && !k.hidden && new RegExp(s).test(k.textContent) ? k.textContent : null; }, re.source));
90
90
  const noDlg = () => p.evaluate(() => !document.querySelector('#dlg.on'));
91
- /* re-pointed (viewer-shell-a, XvABoard): the initiative opens in the Viewer, and its ⋯ holds "Move, hold, cancel or archive" */
92
- const vwActs = async (pg) => { await until(() => pg.evaluate(() => { const v = document.querySelector('#czViewer'), c = window.czViewer && window.czViewer.current(); return !!v && !v.hidden && !!c && c.kind === 'Initiative' && !!v.querySelector('[data-cz-vw="more"]'); })); await pg.click('#czViewer [data-cz-vw="more"]'); await pg.waitForSelector('.cz-vw-menu [role="menuitem"]'); const i = await pg.evaluate(() => [...document.querySelectorAll('.cz-vw-menu [role="menuitem"]')].findIndex((b) => b.textContent.trim() === 'Move, hold, cancel or archive')); await pg.locator('.cz-vw-menu [role="menuitem"]').nth(i).click(); };
93
- const acts = async (id) => { await until(() => listed(id), 30000); await p.click(`#ibBody .ini2[data-key="board:${id}"]`); await vwActs(p); return until(() => p.evaluate(() => { const m = document.querySelector('#bdPop'); return !!m && !m.hidden && m.getAttribute('role') === 'menu'; })); };
91
+ /* re-pointed (batch 14 item 5): the initiative opens in the Viewer, and its ⋯ is the one initiative menu (pm/ini-more.js): the stage presses are its items */
92
+ const vwMenu = async (pg) => { await until(() => pg.evaluate(() => { const v = document.querySelector('#czViewer'), c = window.czViewer && window.czViewer.current(); return !!v && !v.hidden && !!c && c.kind === 'Initiative' && !!v.querySelector('[data-cz-vw="more"]'); })); await pg.click('#czViewer [data-cz-vw="more"]'); await pg.waitForSelector('.cz-vw-menu [role="menuitem"]'); return pg.evaluate(() => [...document.querySelectorAll('.cz-vw-menu [role="menuitem"]')].map((b) => b.querySelector('span').textContent)); };
93
+ const vwPick = async (pg, label) => { const L = await vwMenu(pg), i = L.indexOf(label); if (i < 0) { await pg.keyboard.press('Escape'); return false; } await pg.locator('.cz-vw-menu [role="menuitem"]').nth(i).click(); return true; };
94
+ const more = async (id, label) => { await until(() => listed(id), 30000); await p.click(`#ibBody .ini2[data-key="board:${id}"]`); return vwPick(p, label); };
95
+ const acts = async (id, label = 'Move to a stage') => (await more(id, label)) && until(() => p.evaluate(() => { const m = document.querySelector('#bdPop'); return !!m && !m.hidden; }));
94
96
  const closeAll = async () => { for (let i = 0; i < 4; i++) { if (await p.evaluate(() => (!document.querySelector('#czViewer') || document.querySelector('#czViewer').hidden) && (!document.querySelector('#bdPop') || document.querySelector('#bdPop').hidden))) return; await p.keyboard.press('Escape'); await sleep(100); } };
95
97
  await until(() => p.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0), 30000);
96
98
  await p.click('#chAsks');
@@ -143,7 +145,11 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
143
145
  ok('N4 closing the questions with the shell\'s Close keeps the open ones as the next step, as Later does', await until(() => lines('triage-answers.jsonl').filter((l) => l.kind === 'later').length > later0) && !!(await toastIs(/Kept as the next step of Partner usage per key/)));
144
146
 
145
147
  /* M move and Undo, from the panel's ⋯ (BdActions) */
146
- ok('M1 the row menu offers the next stage with how much is ready, hold, cancel and archive', await acts('pa-one') && await p.evaluate(() => { const L = [...document.querySelectorAll('#bdPop [data-rowact] span:first-of-type')].map((b) => b.textContent); return /^Move to /.test(L[0]) && L.includes('Hold') && L.includes('Cancel') && L.includes('Archive'); }), await p.evaluate(() => document.querySelector('#bdPop').textContent));
148
+ await until(() => listed('pa-one'), 30000); await p.click('#ibBody .ini2[data-key="board:pa-one"]');
149
+ const m1 = await vwMenu(p); await p.keyboard.press('Escape');
150
+ ok('M1 ⋯ offers Move to a stage, Put on hold, Archive and Cancel the initiative, red and last', ['Move to a stage', 'Put on hold', 'Archive'].every((l) => m1.includes(l)) && m1[m1.length - 1] === 'Cancel the initiative', JSON.stringify(m1));
151
+ await closeAll();
152
+ ok('M1 Move to a stage lists the later stages first to move to', await acts('pa-one') && await p.evaluate(() => !!document.querySelector('#bdPop [data-rowact^="mv:"]')), await p.evaluate(() => document.querySelector('#bdPop').textContent));
147
153
  await p.keyboard.press('Escape');
148
154
  ok('M2 Escape closes the menu and gives the focus back to the Viewer\'s ⋯ button', await until(() => p.evaluate(() => document.querySelector('#bdPop').hidden && document.activeElement.dataset.czVw === 'more')), await p.evaluate(() => document.activeElement.outerHTML.slice(0, 120)));
149
155
  await p.keyboard.press('Escape');
@@ -157,18 +163,19 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
157
163
  await closeAll();
158
164
 
159
165
  /* L hold, resume, cancel, reopen, archive, restore: each at once, with Undo */
160
- await acts('pa-one'); await p.click('#bdPop [data-rowact="hold"]');
166
+ await more('pa-one', 'Put on hold');
161
167
  const hl = await until(() => lines('lifecycle.jsonl').find((l) => l.initiative_id === 'pa-one' && l.state === 'on-hold'));
162
168
  ok('L1 Hold records one on-hold line at once, with a check-back day 30 days on, and Undo', !!hl && /^\d{4}-\d{2}-\d{2}$/.test(hl.back || '') && Math.round((Date.parse(hl.back) - Date.now()) / 86400000) >= 29 && !!(await toastIs(/On hold · .* check back/)), JSON.stringify(hl));
163
169
  await closeAll();
164
170
  ok('L2 the row then says On hold', await until(async () => { const t = await p.evaluate(() => { const b = document.querySelector('#ibBody .ini2[data-key="board:pa-one"]'); return b ? b.textContent : ''; }); return /On hold/.test(t); }, 30000));
165
- await acts('pa-one');
166
- ok('L2 Resume is offered and the moves are not', await p.evaluate(() => !!document.querySelector('#bdPop [data-rowact="resume"]') && !document.querySelector('#bdPop [data-rowact^="mv:"]')));
167
- await p.click('#bdPop [data-rowact="resume"]');
171
+ await p.click('#ibBody .ini2[data-key="board:pa-one"]');
172
+ const l2 = await vwMenu(p);
173
+ ok('L2 ⋯ offers Resume in place of Put on hold, and no stage moves', l2.includes('Resume') && !l2.includes('Put on hold') && !l2.includes('Move to a stage') && !l2.includes('Move back a stage'), JSON.stringify(l2));
174
+ await p.locator('.cz-vw-menu [role="menuitem"]').nth(l2.indexOf('Resume')).click();
168
175
  ok('L3 Resume records an active line', await until(() => { const L = lines('lifecycle.jsonl').filter((l) => l.initiative_id === 'pa-one'); return L.length && L[L.length - 1].state === 'active'; }));
169
176
  await closeAll();
170
177
  await until(() => p.evaluate(() => { const b = document.querySelector('#ibBody .ini2[data-key="board:pa-one"]'); return b && !/On hold/.test(b.textContent); }), 30000);
171
- await acts('pa-one'); await p.click('#bdPop [data-rowact="cancel"]');
178
+ await acts('pa-one', 'Cancel the initiative');
172
179
  ok('L4 Cancel asks why, with the same chips as Decline, and records nothing yet', !!(await popOn(/Why cancel .*Out of scope.*Already planned.*Not now.*Other/)) && !lines('lifecycle.jsonl').some((l) => l.initiative_id === 'pa-one' && l.state === 'cancelled'));
173
180
  await p.click('#bdPop [data-why="Not now"]'); await p.click('#bdPop [data-rowact="cancel-go"]');
174
181
  ok('L4 Cancel records a cancelled line with the reason', await until(() => lines('lifecycle.jsonl').some((l) => l.initiative_id === 'pa-one' && l.state === 'cancelled' && l.reason === 'Not now')));
@@ -180,7 +187,7 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
180
187
  ok('L6 Reopen records an active line', await until(() => { const L = lines('lifecycle.jsonl').filter((l) => l.initiative_id === 'pa-one'); return L[L.length - 1].state === 'active'; }));
181
188
  await closeAll();
182
189
  await until(() => listed('pa-one'), 30000);
183
- await acts('pa-one'); await p.click('#bdPop [data-rowact="archive"]');
190
+ await more('pa-one', 'Archive');
184
191
  ok('L7 Archive records one archive line at once, with no reason asked', await until(() => lines('boards.jsonl').some((l) => l.kind === 'ini-archive' && l.id === 'pa-one' && l.archived === true)));
185
192
  ok('L8 the ⋯ menu\'s item counts it as archived', await until(() => p.evaluate(() => /1 archived/.test((document.querySelector('#bdGone') || {}).textContent || '')), 30000));
186
193
  await p.click('#bdToast .bd-undo');
@@ -196,6 +203,26 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
196
203
  ok('I0 the expand link lands on Home with the initiative selected, ws and board kept', !!landed, await ip.evaluate(() => location.href));
197
204
  // the page holds the Tasks (batch 11 item 20)
198
205
  await until(() => ip.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) [data-hi-v]')), 60000);
206
+ /* X the one initiative ⋯ (batch 14 item 5, pm/ini-more.js): Home's page and the Board's panel list the same items in the same order; only
207
+ Home has Open on the Board (the Board is where the other one is) */
208
+ {
209
+ await ip.click('#czViewer:not([hidden]) [data-cz-vw="more"]'); await ip.waitForSelector('.cz-vw-menu [role="menuitem"]');
210
+ const homeM = await ip.evaluate(() => [...document.querySelectorAll('.cz-vw-menu [role="menuitem"]')].map((b) => b.querySelector('span').textContent));
211
+ if (process.env.PMOS_SHOTS) await ip.screenshot({ path: path.join(process.env.PMOS_SHOTS, 'ini-more-home.png') });
212
+ await ip.keyboard.press('Escape');
213
+ await closeAll(); await p.click('#ibBody .ini2[data-key="board:pa-one"]'); const boardM = await vwMenu(p);
214
+ if (process.env.PMOS_SHOTS) {
215
+ await p.screenshot({ path: path.join(process.env.PMOS_SHOTS, 'ini-more-board.png') }); await p.keyboard.press('Escape');
216
+ await vwPick(p, 'Change workflow'); await sleep(600); await p.screenshot({ path: path.join(process.env.PMOS_SHOTS, 'ini-more-board-wf.png') }); await p.keyboard.press('Escape');
217
+ await vwPick(p, 'Add a stakeholder'); await sleep(400); await p.screenshot({ path: path.join(process.env.PMOS_SHOTS, 'ini-more-board-person.png') }); await p.keyboard.press('Escape');
218
+ }
219
+ await p.keyboard.press('Escape'); await closeAll();
220
+ const { ORDER } = await import('./public/pm/ini-more.js');
221
+ const rank = (l) => ORDER.findIndex((o) => l === o || l.startsWith(o + ' '));
222
+ const inOrder = (L) => L.every((l, i) => rank(l) >= 0 && (i === 0 || rank(l) >= rank(L[i - 1])));
223
+ ok('X1 Home and the Board give the same ⋯ items in the same order (Home adds Open on the Board)', JSON.stringify(homeM.filter((l) => l !== 'Open on the Board')) === JSON.stringify(boardM) && homeM.includes('Open on the Board'), JSON.stringify({ homeM, boardM }));
224
+ ok('X2 the order is the one menu\'s: change it, its place, look at it, end it, then stop it, red and last', inOrder(homeM) && inOrder(boardM) && boardM[0] === 'Change workflow' && boardM[boardM.length - 1] === 'Cancel the initiative' && !boardM.includes('Open in full') && !boardM.includes('Move, hold, cancel or archive'), JSON.stringify(boardM));
225
+ }
199
226
  await (async (pg) => { if (await pg.$('#czViewer [data-hi-view="stage"]')) await pg.click('#czViewer [data-hi-view="stage"]'); else await viaMore(pg, 'Stage'); })(ip);
200
227
  const bar = await until(() => ip.evaluate(() => { const v = document.querySelector('#czViewer:not([hidden])'); if (!v || !v.querySelector('[data-ov-move]')) return null; const cur = v.querySelector('[data-ov-move][aria-pressed="true"]'); return { moves: [...v.querySelectorAll('[data-ov-move]')].map((x) => x.dataset.ovMove), cur: cur ? cur.dataset.ovMove : '', life: [...v.querySelectorAll('[data-ov-life]')].map((x) => x.dataset.ovLife) }; }), 60000);
201
228
  ok('I1 the Overview offers the stages, the current one pressed, and the lifecycle presses', !!bar && bar.moves.length > 1 && !!bar.cur && bar.moves.indexOf(bar.cur) < bar.moves.length - 1 && bar.life.join() === 'on-hold,cancelled', JSON.stringify(bar) + ' ' + (await ip.evaluate(() => (document.querySelector('#czViewer .cz-vw-body') || {}).innerText || 'no Viewer')).slice(0, 400));
@@ -239,8 +266,8 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
239
266
  await S.page.click('#chAsks');
240
267
  ok('S1 the PMOS-self board names the router in its asks popover and hides New initiative', await until(() => S.page.evaluate(() => /pmos-router/.test((document.querySelector('#bdPop') || {}).textContent || '') && document.querySelector('#newIni').hidden)));
241
268
  await S.page.keyboard.press('Escape');
242
- await S.page.click('#ibBody .ini2'); await vwActs(S.page);
243
- ok('S2 its actions have no move', await until(() => S.page.evaluate(() => { const x = document.querySelector('#bdPop'); return x && !x.hidden && !x.querySelector('[data-rowact^="mv:"]') && !!x.querySelector('[data-rowact="hold"]'); })));
269
+ await S.page.click('#ibBody .ini2'); const s2 = await vwMenu(S.page);
270
+ ok('S2 its ⋯ has no stage move and no workflow to change, and keeps Put on hold', !s2.includes('Move to a stage') && !s2.includes('Move back a stage') && !s2.includes('Moves on by itself') && !s2.includes('Change workflow') && s2.includes('Put on hold'), JSON.stringify(s2));
244
271
  await S.ctx.close();
245
272
  }
246
273
 
@@ -260,7 +287,7 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
260
287
  await until(() => S.page.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0), 30000);
261
288
  const f = await S.page.evaluate(() => ({ wide: document.documentElement.scrollWidth > innerWidth + 1, small: [...document.querySelectorAll('#ibBody .ini2, #chAsks, #newIni')].filter((b) => b.offsetParent && (b.getBoundingClientRect().width < 44 || b.getBoundingClientRect().height < 44)).map((b) => b.className + ':' + Math.round(b.getBoundingClientRect().width) + 'x' + Math.round(b.getBoundingClientRect().height)) }));
262
289
  ok('F1 at 390 px there is no sideways scroll and every new control is at least 44 px', !f.wide && !f.small.length, JSON.stringify(f));
263
- await S.page.click('#ibBody .ini2'); await vwActs(S.page);
290
+ await S.page.click('#ibBody .ini2'); await vwPick(S.page, 'Move to a stage');
264
291
  const mi = await until(() => S.page.evaluate(() => { const L = [...document.querySelectorAll('#bdPop.sheet:not([hidden]) .bd-mi')]; return L.length ? L.every((b) => b.getBoundingClientRect().height >= 44) && document.documentElement.scrollWidth <= innerWidth + 1 : null; }));
265
292
  ok('F2 the action rows are 44 px tall and the open sheet adds no sideways scroll', !!mi);
266
293
  await S.ctx.close();
@@ -134,6 +134,14 @@ async function context(o = {}) {
134
134
  await tab.$eval('#rtBar [data-a="hl"]', (b) => b.click());
135
135
  ok('T3 Highlight starts the recorder\'s highlight', await until(() => tab.evaluate(() => window.__premiumRecorder._hl === 1)));
136
136
 
137
+ /* T3b a press that gets no answer (Wawan, 2026-10-27: the clock stuck at 4:48 and the transcript stopped): the clock goes on */
138
+ await tab.evaluate(() => { const R = window.__premiumRecorder; window.__rtPause = R.pause; R.pause = () => new Promise(() => {}); window.__rtBusyMs = 2500; });
139
+ await tab.$eval('#rtBar [data-a="pause"]', (b) => b.click());
140
+ const c0 = await tab.evaluate(() => document.getElementById('rtClock').textContent);
141
+ ok('T3b while a press waits for its answer, the meeting clock still moves', await until(async () => (await tab.evaluate(() => document.getElementById('rtClock').textContent)) !== c0, 5000), c0);
142
+ ok('T3b the press gives up: the button comes back and the tab says to try again', await until(() => tab.evaluate(() => { const b = document.querySelector('#rtBar [data-a="pause"]'); return !!b && !b.disabled && /took too long/.test(document.getElementById('rtMsg').textContent); }), 8000));
143
+ await tab.evaluate(() => { window.__premiumRecorder.pause = window.__rtPause; delete window.__rtBusyMs; });
144
+
137
145
  /* T4 the next meeting while this one records: the recording tab asks once */
138
146
  await p.evaluate(() => new BroadcastChannel('pmos-rec').postMessage({ id: 'new1', switchTo: { title: 'Rail review', body: { title: 'Rail review' } }, at: Date.now() }));
139
147
  ok('T4 the recording tab asks: Stop Design crit and record Rail review?', await until(() => tab.evaluate(() => /Stop Design crit and record Rail review\?/.test(document.getElementById('rtAsk').textContent))));
@@ -107,9 +107,13 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
107
107
  const up = await until(() => page.evaluate(() => document.querySelectorAll('#ibBody [data-key]').length > 0), 20000);
108
108
  ok('R9 the Board loads', up);
109
109
  await page.click('#ibBody .ini2[data-key="board:self-serve-v2"]'); // a phone opens on the List view (premium-uncovered-features, BdPhone)
110
- /* re-pointed (viewer-shell-a, XvABoard): the initiative opens in the Viewer's shell A; "Open in full" under ⋯ leads to the initiative page */
111
- const pk = await until(() => page.evaluate(() => { const v = document.querySelector('#czViewer'), c = window.czViewer && window.czViewer.current(); return v && !v.hidden && c && c.kind === 'Initiative' ? { record: !!v.querySelector('[data-pk="record"]'), dlg: !!document.querySelector('#dlg.on'), href: c.url || '' } : null; }));
112
- ok('R9 an initiative row opens the Board\'s initiative in the Viewer, not the dialog, and its "Open in full" leads to the initiative page, where the record tab is', !!pk && !pk.record && !pk.dlg && /^\/premium-initiative\.html\?id=self-serve-v2&ws=w1&board=w1$/.test(pk.href), JSON.stringify(pk));
110
+ /* re-pointed (batch 14 item 5): the initiative opens in the Viewer's shell A; its ⋯ (the one initiative menu) has The record, as Home's has */
111
+ const pk = await until(() => page.evaluate(() => { const v = document.querySelector('#czViewer'), c = window.czViewer && window.czViewer.current(); return v && !v.hidden && c && c.kind === 'Initiative' ? { record: !!v.querySelector('[data-pk="record"]'), dlg: !!document.querySelector('#dlg.on') } : null; }));
112
+ await page.click('#czViewer [data-cz-vw="more"]'); await page.waitForSelector('.cz-vw-menu [role="menuitem"]');
113
+ const mm = await page.evaluate(() => [...document.querySelectorAll('.cz-vw-menu [role="menuitem"]')].map((b) => b.querySelector('span').textContent));
114
+ ok('R9 an initiative row opens the Board\'s initiative in the Viewer, not the dialog, and its ⋯ has The record and no Open in full', !!pk && !pk.record && !pk.dlg && mm.includes('The record') && !mm.includes('Open in full'), JSON.stringify([pk, mm]));
115
+ await page.locator('.cz-vw-menu [role="menuitem"]').nth(mm.indexOf('The record')).click();
116
+ ok('R9 The record opens the initiative\'s record as a drill-in', await until(() => page.evaluate(() => { const c = window.czViewer && window.czViewer.current(); return !!c && c.kind !== 'Initiative' && !!document.querySelector('#czViewer [data-cz-vw="back"]'); })), await page.evaluate(() => JSON.stringify(window.czViewer.current())));
113
117
  ok('R9 no page error on the Board', errors.length === 0, errors.join(' | '));
114
118
  await ctx.close();
115
119
  }
@@ -132,8 +132,9 @@ const TICKETS = {
132
132
  const tk = await until(async () => { const t = await paneText(p, 'jira:PMOS-142'); return t && /Acceptance criteria/.test(t) ? t : null; });
133
133
  ok('K1 a card opens its ticket in place of the sprint', !!tk && (await curId(p)) === 'jira:PMOS-142', JSON.stringify(await curId(p)));
134
134
  ok('K2 the ticket leads with what holds it (flagged in Jira), then the facts Jira owns: status, sprint, points and priority', /^Blocked/.test(tk) && /Flagged in Jira/.test(tk) && /StatusTo Do/.test(tk) && /SprintSprint 14/.test(tk) && /Points5/.test(tk) && /PriorityHigh/.test(tk) && /Jira owns these\. They change only in Jira\./.test(tk), tk);
135
- ok('K3 the description is the draft\'s sections, with bold kept and nothing run', /Description · from Jira/.test(tk) && /User Story/.test(tk) && await p.evaluate(() => !!document.querySelector('#czViewer .tkv .ovd strong') && !document.querySelector('#czViewer .tkv img') && !window.__pwned));
135
+ ok('K3 the description is the draft\'s sections, with bold kept and nothing run', /Description · PMOS's copy, Jira may differ/.test(tk) && /User Story/.test(tk) && await p.evaluate(() => !!document.querySelector('#czViewer .tkv .ovd strong') && !document.querySelector('#czViewer .tkv img') && !window.__pwned));
136
136
  ok('K4 the folds: acceptance criteria, subtasks as the reading\'s count, and the links from the draft; the where row names the initiative and its epic', /Acceptance criteria2/.test(tk) && /Subtasks1 of 3 done/.test(tk) && /Linked2/.test(tk) && /blocks/.test(tk) && /PMOS-152/.test(tk) && /drafted fromplanning\/prd\/self-serve-v2-prd.md/.test(tk) && /Self-serve onboarding v2Epic Self-serve v2/.test(tk));
137
+ ok('K6 batch 14 item 12: the header names the ticket by its key and title, not the key alone', await until(() => p.evaluate(() => /^PMOS-142 \S/.test(((document.querySelector('#czVwTitle') || {}).textContent || '').trim())), 5000), await p.evaluate(() => (document.querySelector('#czVwTitle') || {}).textContent));
137
138
  ok('K5 no comments, history or fields panel: Open in Jira at the foot is the one real link', !/pull request|\bPR\b|builder/i.test(tk) && !/Comments \(/.test(tk) && /Open in Jira$/.test(tk)
138
139
  && await p.evaluate(() => [...document.querySelectorAll('#czViewer .obody.vw a[href]')].every((a) => a.href === 'https://acme.atlassian.net/browse/PMOS-142' && a.target === '_blank' && /noopener/.test(a.rel))));
139
140
  await p.evaluate(() => { const f = document.querySelector('#czViewer [data-czs-fold="links"]'); if (f && f.getAttribute('aria-expanded') !== 'true') f.click(); }); // the one ticket Viewer's Linked fold (tk-view.js) opens first
@@ -85,7 +85,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
85
85
  await p.click('#czViewer [data-pp="edit"]');
86
86
  ok('W the pencil opens the charter as a drill-in (← back to the program)', await charterShown(p));
87
87
  const ch = await head(p);
88
- ok('F the header: ←, the program\'s name with "Charter" under it, no Save before a change, no ⋯', ch.tools[0] === 'Back' && /^Project Ascent · CIAM migration/.test(ch.title) && ch.sub === 'Charter' && !ch.save && !ch.tools.includes('More'), JSON.stringify(ch));
88
+ ok('F the header: ←, the program\'s name with "Charter" under it, no Save before a change, no ⋯', /^Back to /.test(ch.tools[0]) && /^Project Ascent · CIAM migration/.test(ch.title) && ch.sub === 'Charter' && !ch.save && !ch.tools.includes('More'), JSON.stringify(ch));
89
89
  const fv = await p.evaluate(() => { const v = (f) => (document.querySelector(`#czViewer [data-f="${f}"]:not(.pc-dt)`) || {}).value; return { goal: v('goal'), owner: v('owner'), jira: v('jira'), why: v('why'), start: document.querySelector('#czViewer [data-pc="date"][data-f="start"] span').textContent, target: document.querySelector('#czViewer [data-pc="date"][data-f="target"] span').textContent, lim: document.querySelector('#czViewer .pc-lim').textContent, done: document.querySelector('#czViewer button.pc-ln.dn').textContent }; });
90
90
  ok('F every field as the record holds it; the span as days; "8 of 12"; the done ones fold into "2 done · …"', fv.goal === 'CIAM migration' && fv.owner === 'Wawan' && fv.jira === '' && /^Move every product/.test(fv.why) && fv.start === 'Sep 1, 2026' && fv.target === 'Jun 30, 2028' && fv.lim === '8 of 12' && fv.done === '2 done · Vendor picked, Charter approved', JSON.stringify(fv));
91
91
  const r0 = await rowsOf(p);
@@ -96,7 +96,7 @@ const waitsOf = (id) => ((R.all(rctx).find((p) => p.id === 'project-ascent') ||
96
96
  return { ctx, page, errors };
97
97
  };
98
98
  const menu = async (p) => { await p.click('#czViewer [data-cz-vw="more"]'); await p.waitForTimeout(80); return p.evaluate(() => [...document.querySelectorAll('.cz-vw-menu [role="menuitem"]')].map((b) => b.textContent.trim())); };
99
- const kids = (p) => p.evaluate(() => [...document.querySelectorAll('#ibBody [data-po-list] [data-po-id]')].map((r) => r.dataset.poId));
99
+ const kids = (p) => p.evaluate(() => [...document.querySelectorAll('#ibBody [data-po-list]:not([data-po-list^="@"]) > [data-po-id]')].map((r) => r.dataset.poId));
100
100
  const toast = (p) => p.evaluate(() => { const t = document.querySelector('#bdToast'); return t && !t.hidden ? t.textContent : ''; });
101
101
 
102
102
  /* B — the Board's initiative panel */
@@ -116,7 +116,7 @@ const waitsOf = (id) => ((R.all(rctx).find((p) => p.id === 'project-ascent') ||
116
116
  ok('B Move out is one press: one leave, no confirm; the toast says where it went and the milestone it left, with Undo',
117
117
  posts.length === n0 + 1 && posts[n0].body.leave === true && /Moved out of Project Ascent · now under IDPF · off 1 milestone/.test(t) && /Undo/.test(t), JSON.stringify({ t, posts: posts.slice(n0) }));
118
118
  ok('B the program no longer has it, and Legacy IdP off no longer waits on it', !members().includes('legacy-idp-sunset') && !waitsOf('legacy-idp-off').includes('legacy-idp-sunset'), JSON.stringify({ m: members(), w: waitsOf('legacy-idp-off') }));
119
- const after = await until(() => p.evaluate(() => { const r = [...document.querySelectorAll('#ibBody [data-key]')].find((x) => /Legacy IdP sunset/.test(x.textContent) && !x.closest('[data-po-list]')); const v = document.querySelector('#czViewer'); return r ? { sel: r.classList.contains('sel') || !!r.querySelector('.sel'), open: !!v && !v.hidden && /Legacy IdP sunset/.test(v.textContent) } : null; }));
119
+ const after = await until(() => p.evaluate(() => { const r = [...document.querySelectorAll('#ibBody [data-key]')].find((x) => /Legacy IdP sunset/.test(x.textContent) && !x.closest('[data-po-list]:not([data-po-list^="@"])')); const v = document.querySelector('#czViewer'); return r ? { sel: r.classList.contains('sel') || !!r.querySelector('.sel'), open: !!v && !v.hidden && /Legacy IdP sunset/.test(v.textContent) } : null; }));
120
120
  ok('B the row shows under its product, and the panel stays on it', !!after && after.open, JSON.stringify(after));
121
121
  if (process.env.SHOTS) await p.screenshot({ path: process.env.SHOTS + '/board-done.png' });
122
122
  await p.click('#bdToast .bd-undo');
@@ -5,6 +5,7 @@
5
5
  * (fixtures/program-ascent.js) and POST /api/programs/order is answered here, from the order the page sent, so a reload reads it back.
6
6
  * B Board: the program's rows follow its order; ✦ shows (with its dot) only while the dates disagree; the suggestion lists the date order with a
7
7
  * reason per row; ✓ applies it, Undo puts the order back; ✕ is "not now" until a date changes; drag by the grip; Alt + ↓ moves a row
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)
8
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 */
9
10
  const path = require('path');
10
11
  const { spawn } = require('child_process');
@@ -69,14 +70,14 @@ const routePrograms = async (page) => {
69
70
  await page.waitForTimeout(700);
70
71
  return { ctx, page, errors };
71
72
  };
72
- const kids = (p) => p.evaluate(() => [...document.querySelectorAll('#ibBody [data-po-list] [data-po-id]')].map((r) => r.dataset.poId));
73
+ const kids = (p) => p.evaluate(() => [...document.querySelectorAll('#ibBody [data-po-list]:not([data-po-list^="@"]) > [data-po-id]')].map((r) => r.dataset.poId));
73
74
  const sug = (p) => p.evaluate(() => { const b = document.querySelector('#ibBody .bt-pg [data-po-sug]'); return b ? { dot: !!b.querySelector('.po-nd'), label: b.getAttribute('aria-label') } : null; });
74
75
 
75
76
  /* B — the Board's stage track */
76
77
  {
77
78
  ORDER = ['legacy-idp-sunset', 'descope-parity']; // the PM's order, against the dates (Descope starts Oct 5, Legacy Oct 11)
78
79
  const { ctx, page: p, errors } = await board();
79
- ok('B the program\'s rows follow its order, each with a grip', (await kids(p)).join() === 'legacy-idp-sunset,descope-parity' && (await p.locator('#ibBody [data-po-id] [data-po-grip]').count()) === 2, JSON.stringify(await kids(p)));
80
+ ok('B the program\'s rows follow its order, each with a grip', (await kids(p)).join() === 'legacy-idp-sunset,descope-parity' && (await p.locator('#ibBody [data-po-list]:not([data-po-list^="@"]) > [data-po-id] [data-po-grip]').count()) === 2, JSON.stringify(await kids(p)));
80
81
  const s = await sug(p);
81
82
  ok('B ✦ shows in the program header while the dates disagree, with the blue dot', !!s && s.dot, JSON.stringify(s));
82
83
  await p.click('#ibBody .bt-pg [data-po-sug]');
@@ -107,7 +107,8 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
107
107
  ok('F a row folds', await until(() => p.evaluate(() => document.querySelector('#czViewer [data-czs-fold="tree"]').getAttribute('aria-expanded') === 'false')));
108
108
  await p.click('#czViewer [data-cz-vw="close"]');
109
109
  ok('P Close closes the Viewer', await until(() => p.evaluate(() => document.querySelector('#czViewer').hidden)));
110
- await p.reload();
110
+ ok('P Close takes the program out of the address (batch 14 item 7: the address follows the Viewer)', !new URL(p.url()).searchParams.get('program'), p.url());
111
+ await p.goto(BASE + '/premium-board.html?ws=idpf&program=project-ascent'); // the program's own link again
111
112
  await shown(p);
112
113
  ok('F the folds are kept after a reload', await until(async () => !(await isOpen(p, 'tree')) && await isOpen(p, 'ms')));
113
114
  await fold(p, 'tasks');
@@ -1,8 +1,9 @@
1
1
  /* pm/bd-acts.js — the Board's presses and the panels and popovers around them (initiative premium-uncovered-features, Board: BdActions, BdFilter,
2
2
  * BdSprint, BdPanel, BdDocs; built on premium-agreed-design's plain versions, whose function each designed one keeps). The routes are the ones the
3
3
  * console presses, behind the launch nonce:
4
- * a row's actions (BdActions) the ⋯ menu: Move to <next> with how much of the step is ready, Back to <prev> (asks why), Hold, Cancel (asks why,
5
- * the same chips as Decline), Archive; Resume, Reopen, Restore. POST /api/boards/move { board, id, to, why? } ·
4
+ * a row's actions (BdActions) the stage presses of the initiative's ⋯ (pm/ini-more.js, batch 14 item 5; open.more): Move to a stage (the next
5
+ * with how much of the step is ready), Back to <prev> (asks why), Hold, Resume, Cancel (asks why, the same chips as
6
+ * Decline); Reopen and Restore in Cancelled and archived. POST /api/boards/move { board, id, to, why? } ·
6
7
  * /api/lifecycle { initiative_id, state, reason, back? } · /api/boards/archive { board, id, archived, reason? }.
7
8
  * Each one is done at once, with Undo in the toast, which writes the opposite line through the same route.
8
9
  * Cancelled and archived the side panel: All, On hold, Cancelled, Archived, each with Resume, Reopen or Restore
@@ -73,28 +74,6 @@ const prevOf = (r) => ({ life: r.acts.life, reason: r.acts.reason, backDay: r.ac
73
74
  const lifeBack = (r, p) => (p.life === 'hold' ? life(r.id, 'on-hold', p.reason, p.backDay) : p.life === 'cancelled' ? life(r.id, 'cancelled', p.reason) : life(r.id, 'active', 'undo'));
74
75
  /** How much of the step is ready, for "Move to <next> · 2 of 4 ready": the parts or tickets counted toward its output. */
75
76
  const readyOf = (r) => { const t = r.track || {}; return t.count && /\d+ of \d+/.test(t.count) ? t.count.replace(/ parts?$/, '') + ' ready' : ''; };
76
- function menuItems(r) {
77
- const a = r.acts || { stages: [], stage: '' }, cur = a.stages.indexOf(a.stage), out = [];
78
- if (a.archived) return [['restore', 'Restore', I.back, 'Back in the lists, as it was']];
79
- if (a.life === 'cancelled') return [['reopen', 'Reopen', I.back, 'Back to ' + (a.stage || 'its stage') + ', active again']];
80
- if (!M().board.self && !a.life && cur >= 0) {
81
- if (a.stages[cur + 1]) out.push(['mv:' + (cur + 1), 'Move to ' + a.stages[cur + 1], I.go, readyOf(r)]);
82
- if (cur > 0) out.push(['back:' + (cur - 1), 'Back to ' + a.stages[cur - 1], I.back, '']);
83
- }
84
- out.push(['hr']);
85
- if (a.life === 'hold') out.push(['resume', 'Resume', I.play, '']); else out.push(['hold', 'Hold', I.hold, '']);
86
- out.push(['cancel', 'Cancel', I.x, ''], ['archive', 'Archive', I.arch, '']);
87
- return out;
88
- }
89
- function menuHtml(r) {
90
- const it = menuItems(r), stage = it.some(([k]) => /^(mv|back):/.test(k));
91
- const self = M().board.self ? '<p class="bd-amut bd-mnote">The stage of a PMOS-self initiative comes from the repository. It moves when the files land.</p>' : '';
92
- return `<p class="bd-mlbl" id="mnT">${esc(r.title)}</p>${self}${stage ? '<p class="bd-mlbl">Stage</p>' : ''}`
93
- + it.map(([k, l, ic, s]) => (k === 'hr' ? (stage ? '<div class="bd-hr"></div>' : '') : `<button type="button" class="bd-mi" role="menuitem" data-rowact="${esc(k)}" data-id="${esc(r.key)}">${SV(ic)}<span>${esc(l)}</span>${s && /ready$/.test(s) ? `<span class="k">${esc(s)}</span>` : ''}</button>`)).join('');
94
- }
95
- function openRowMenu(r, btn) {
96
- Pop.open(menuHtml(r), btn, { label: 'Actions for ' + r.title, role: 'menu', width: 270, align: 'right', cls: 'bd-menu', focus: '.bd-mi' });
97
- }
98
77
  function reasonHtml(r, kind, to) {
99
78
  const L = kind === 'cancel' ? WHY_NOT : BACK_WHY;
100
79
  const q = kind === 'cancel' ? 'Why cancel ' + r.title + '?' : 'Why back to ' + to + '?';
@@ -102,9 +81,24 @@ function reasonHtml(r, kind, to) {
102
81
  + `<div class="bd-arow"><button type="button" class="bd-btn sm solid" data-rowact="${kind === 'cancel' ? 'cancel-go' : 'back-go:' + to}" data-id="${esc(r.key)}">${kind === 'cancel' ? 'Cancel initiative' : 'Back to ' + esc(to)}</button><button type="button" class="bd-btn sm ghost" data-rowact="menu" data-id="${esc(r.key)}">Not now</button></div>`
103
82
  + `<p class="bd-amut">${kind === 'cancel' ? 'Keeps its stage, its work and its history. Reopen it any time.' : 'The reason is kept with the move in the board ledger.'}</p></div>`;
104
83
  }
84
+ /** The stages to move to from the initiative's ⋯ (Move to a stage): a later one moves at once with Undo, an earlier one asks why. */
85
+ function stageHtml(r) {
86
+ const a = r.acts, cur = a.stages.indexOf(a.stage);
87
+ return `<p class="bd-mlbl">Move to a stage</p>` + a.stages.map((s, i) => (i === cur ? '' : `<button type="button" class="bd-mi" role="menuitem" data-rowact="${i > cur ? 'mv:' : 'back:'}${i}" data-id="${esc(r.key)}">${SV(i > cur ? I.go : I.back)}<span>${esc(s)}</span>${i === cur + 1 && readyOf(r) ? `<span class="k">${esc(readyOf(r))}</span>` : ''}</button>`)).join('');
88
+ }
89
+ /** One press of the initiative's ⋯ (pm/ini-more.js, feedback batch 14 item 5), by the row menu's own handlers: stage lists the stages,
90
+ * back:<stage> and cancel ask why in a card under the ⋯, hold and resume act at once with Undo. */
91
+ function moreAct(r, k, btn) {
92
+ if (!r || !r.acts) return;
93
+ if (k === 'hold' || k === 'resume') { runRow(r, k, null); return; }
94
+ const card = (html, label, cls) => Pop.open(html, btn, { label, role: cls ? 'menu' : 'dialog', width: cls ? 270 : 300, align: 'right', cls: cls || '', focus: '[data-why], .bd-mi' });
95
+ if (k === 'stage') card(stageHtml(r), 'Move ' + r.title + ' to a stage', 'bd-menu');
96
+ else if (k === 'cancel') card(reasonHtml(r, 'cancel'), 'Cancel ' + r.title);
97
+ else if (k.startsWith('back:')) card(reasonHtml(r, 'back', k.slice(5)), 'Back to ' + k.slice(5));
98
+ }
105
99
  async function runRow(r, k, btn) {
106
100
  const a = r.acts, p = prevOf(r), m = $('#rowM');
107
- if (k === 'menu') { Pop.redraw(menuHtml(r)); return; }
101
+ if (k === 'menu') { Pop.close(true); return; } // Not now
108
102
  if (k.startsWith('mv:') || k.startsWith('back-go:')) {
109
103
  const to = k.startsWith('mv:') ? a.stages[+k.slice(3)] : k.slice(8), fromStage = a.stage, why = k.startsWith('back-go:') ? whyOf(Pop.el()) : '';
110
104
  if (!to) return;
@@ -392,7 +386,7 @@ async function setBack(r, input) {
392
386
  await done(res, 'On hold · ' + r.title + ' · back ' + md(day(v)), async () => { const u = await lifeBack(r, p); A.say(u && u.ok ? r.title + ' is back as it was.' : errOf(u)); await A.load(); });
393
387
  }
394
388
 
395
- export const open = { hold: openHold, new: (from) => Asks.openNew(from), asks: (from) => Asks.openAsks(from), row: openRowMenu, sprint: openSprint, metrics: openMetrics, find: openFind, filter: openFilter, gone: (from) => openGone(from, 'all'), bell: openBell, trend: openTrend, release: openRelease, doc: openDocPanel };
389
+ export const open = { more: moreAct, hold: openHold, new: (from) => Asks.openNew(from), asks: (from) => Asks.openAsks(from), sprint: openSprint, metrics: openMetrics, find: openFind, filter: openFilter, gone: (from) => openGone(from, 'all'), bell: openBell, trend: openTrend, release: openRelease, doc: openDocPanel };
396
390
  export const closeDoc = () => { docOpen = null; };
397
391
 
398
392
  /* ── the presses ─────────────────────────────────────────────────────────────────────────────────────────────── */
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * mount(o) once, from premium-board.js. o: { M() the model, statusOf(r), fmt(iso), md(date), ago(iso), grill(id) the open first
5
5
  * questions, usual(track) the usual days in the step, rowOf(key), pageHref(r), askHref(r, q), refreshJira(), send(r) the
6
- * Send to Jira sheet, acts(r, btn) the row actions popover, grillOpen(r, btn), onShow(key, from) / onHide() so the page
6
+ * Send to Jira sheet, moreAct(r, k, btn) a stage press of ⋯ (bd-acts.js), grillOpen(r, btn), onShow(key, from) / onHide() so the page
7
7
  * marks the row the item came from, programOf(r) the program it is in or null, openProgram(id, btn), turnProgram(r)
8
8
  * "Turn into a program", moveItems(r) Move out of its program and Move to another (pm/prog-move.js), smItems(r) and
9
9
  * smPress(r, act, btn) Split into a new initiative and Merge into (pm/split-merge.js), openIniId(id) a row by its record id, setTask(r, uid, state) a task's state, setDates(r, uid, { start?, due? }) its days (the Tasks
@@ -16,8 +16,9 @@
16
16
  * openTicket(r, k) the ticket as a drill-in, in the one ticket Viewer (tk-view.js): ← goes back to the initiative; the summary says what blocks it and what that delays
17
17
  * refresh() draws the shown item again after a new read, in place · close() · shown() → the key of the initiative shown, or null
18
18
  *
19
- * What has no place on the view is under ⋯ in the shell's order: change it (move, hold, cancel or archive; the plan dates), look back (read
20
- * Jira again), then link and copy. "Open in full" (the initiative page) is the shell's own ⋯ item. Discuss in chat takes the question to Home. */
19
+ * What has no place on the view is under ⋯: the ONE initiative menu (pm/ini-more.js, feedback batch 14 item 5), the same words and order as
20
+ * Home's initiative page. Its stage presses (Move back a stage, Move to a stage, Put on hold, Cancel) are the row menu's own (moreAct(r, k, btn),
21
+ * bd-acts.js); Change workflow, Won't do and Archive are Home's (ini-wf.js). Discuss in chat takes the question to Home. */
21
22
  import * as VW from './cozy-viewer.js';
22
23
  import { esc } from './premium-shell.js';
23
24
  import { lr, copyText } from './cozy-xv.js';
@@ -25,6 +26,11 @@ import { iniView } from './ini-view-model.js';
25
26
  import { rowFor } from './ini-versions.js'; // planned versus actual (batch 11 item 8): Live or the draft the PM shows, with the plan line
26
27
  import { viewHtml, wireView } from './ini-view.js';
27
28
  import * as TV from './tk-view.js';
29
+ import { pmGet, pmPost } from './http.js';
30
+ import * as MD from './home-ini-model.js'; // the stage move's rules, as Home reads them (Moves on by itself, Move back a stage)
31
+ import * as WF from './ini-wf.js'; // D99: Change workflow, Won't do, Back to Triage, Archive, the same popovers as Home's
32
+ import { openPop, closePop, undoToast, ensureCss as ensurePopCss } from './hi-pop.js';
33
+ import { iniMore as iniMoreOf, iniText } from './ini-more.js'; // the one initiative ⋯ menu (batch 14 item 5)
28
34
 
29
35
  let O = null;
30
36
  let cur = null; // { key, tk } the initiative shown, and its ticket while the drill-in is shown
@@ -32,7 +38,6 @@ let adding = null; // the key of the initiative whose inline Add a task is open
32
38
  let addTo = ''; // the stage a task added there finishes (the Board's Next cell: "Add what finishes <stage>")
33
39
  let addDates = null; // the start and due a task added there takes (a gap's + on the timeline, batch 11 item 13)
34
40
  const TI = (r) => (r && r.trail) || null;
35
- const tkState = (k) => (k.blocked ? 'Blocked' + (k.reason ? ' by ' + k.reason.replace(/^Waiting on /i, '') : '') : k.status || 'To do');
36
41
  const jiraAt = () => { const J = (O.M() && O.M().jira) || {}; return J.readAt ? 'Jira · ' + O.ago(J.readAt) : ''; };
37
42
 
38
43
  /* ── the initiative: the one view ── */
@@ -58,32 +63,83 @@ function boardSections(r) {
58
63
  if (dr.length) S.push({ id: 'drift', title: 'Jira differs from the PRD', count: dr.length, render: () => driftHtml(dr) });
59
64
  return S;
60
65
  }
61
- /** ⋯ in the shell's order: change it, look back, then link and copy. Archive and cancel stay in the row actions, with their Undo. */
62
- function iniMore(r) {
63
- const more = [];
64
- if (r.acts) more.push({ label: 'Move, hold, cancel or archive', on: (b) => O.acts(r, b) });
65
- if (r.id) more.push({ label: 'Change the plan dates', on: () => location.assign(O.askHref(r, 'Propose new start and end dates for ' + r.title)) });
66
- // P7 (program-hierarchy PRD): an initiative in no program can become one; the chat cannot, because every program write is a page press
67
- if (r.id && O.turnProgram && !(O.programOf && O.programOf(r))) more.push({ label: 'Turn into a program', on: () => O.turnProgram(r) });
68
- // an initiative in a program can move out of it, or to another one (feedback batch 11 item 2, canvas LpA1More, LpA2Other; pm/prog-move.js)
69
- const mv = r.id && O.moveItems ? O.moveItems(r) : [];
70
- // split it into a new initiative, or merge it into another, above the program moves (batch 11 item 14, canvas XsmA1Menu; pm/split-merge.js)
71
- const sm = r.id && O.smItems ? O.smItems(r) : [];
72
- if (sm.length || mv.length) more.push({ sep: true }, ...sm, ...mv);
73
- if ((O.M() || {}).jira) more.push({ sep: true }, { label: 'Read Jira again', on: () => O.refreshJira() });
74
- more.push({ sep: true });
75
- if (r.id) more.push({ label: 'Copy link', on: () => copyText(new URL(O.pageHref(r), location.href).href, 'Link copied.') });
76
- more.push({ label: 'Copy as text', on: () => copyText(iniText(r), 'Copied as text.') });
77
- return more;
66
+ /* ── ⋯: the ONE initiative menu (pm/ini-more.js, feedback batch 14 item 5), the same words and order as Home's initiative page ── */
67
+ const LAY = new Map(); // the initiative's layout record (GET /api/initiative-layout): its own Moves on by itself, read when the panel opens
68
+ const ownWf = (r) => !!(r.wf && r.wf.id && r.wf.id !== 'product-feature' && Array.isArray(r.wfStages) && r.wfStage);
69
+ const where = (r) => { const B = (O.M() || {}).board || {}; return { ws: r.ws || B.ws, board: r.boardId || B.id }; };
70
+ async function readLay(r) {
71
+ if (!r.id || ownWf(r) || LAY.has(r.id)) return;
72
+ LAY.set(r.id, null);
73
+ const ws = where(r).ws, x = await pmGet('/api/initiative-layout?initiative=' + encodeURIComponent(r.id) + (ws ? '&ws=' + encodeURIComponent(ws) : '')).catch(() => null);
74
+ LAY.set(r.id, x && x.ok ? x : { auto: true, held: [] });
75
+ }
76
+ /** Where the row's stage can move, as Home reads it (home-ini-model.js moveModel): a workflow of the library moves between ITS stages. */
77
+ function moveOf(r) {
78
+ const a = r.acts || {}, acts = { stages: a.stages || [], stage: a.stage || '', self: !!((O.M() || {}).board || {}).self, life: a.life || null };
79
+ let L = LAY.get(r.id) || { auto: true, held: [] };
80
+ if (ownWf(r)) {
81
+ const st = r.wfStages.filter((s) => s.status !== 'skipped' || s.key === r.wfStage.key), cur = r.wfStages.find((s) => s.key === r.wfStage.key) || {};
82
+ Object.assign(acts, { stages: st.map((s) => s.name), stage: r.wfStage.name, msNames: st.filter((s) => s.milestone).map((s) => s.name), self: false });
83
+ L = { auto: !!cur.auto, held: [] };
84
+ }
85
+ if (r.ended) acts.life = 'ended';
86
+ return MD.moveModel(null, { acts }, L);
87
+ }
88
+ /** Moves on by itself for this one initiative: a library workflow's stage (POST /api/boards/ini-auto), else the layout record. */
89
+ async function setAuto(r, on) {
90
+ const res = ownWf(r) ? await pmPost('/api/boards/ini-auto', { ...where(r), id: r.id, stage: r.wfStage.key, auto: on }).catch(() => null)
91
+ : await pmPost('/api/initiative-layout', { ws: where(r).ws, initiative: r.id, kind: 'auto', on }).catch(() => null);
92
+ if (!res || res.ok === false) { O.toast((res && res.error) || 'Nothing was changed.'); return; }
93
+ if (!ownWf(r)) LAY.set(r.id, res);
94
+ O.toast('Moves on by itself: ' + (on ? 'on' : 'off') + ' · ' + r.title + '.');
95
+ if (O.reload) O.reload();
96
+ }
97
+ /** What ini-wf.js needs from the page (Change workflow, Won't do, Back to Triage, Archive): the popovers of pm/hi-pop.js, the Board's toast. */
98
+ function wfUi() {
99
+ const byId = (id) => ((O.M() || {}).rows || []).find((x) => x.id === id) || {};
100
+ return { openPop, closePop, undoToast: (t, undo) => O.toast(t, undo), toast: (t) => O.toast(t), pmGet, pmPost, load: async () => { if (O.reload) await O.reload(); },
101
+ row: byId, title: (id) => byId(id).title || id, bw: (id) => where(byId(id)) };
78
102
  }
79
- /** The initiative as plain text, for Copy as text: the summary, the stage and the open tasks. */
80
- function iniText(r) {
81
- const v = viewOf(r), s = v.summary, lines = [r.title, s.line + (s.right ? ' · ' + s.right : '')];
82
- if (s.text) lines.push(s.text);
83
- lines.push('', v.stage.name + (v.stage.n ? ' · ' + v.stage.n + ' of ' + v.stage.of : '') + (v.stage.doneOf ? ' · ' + v.stage.doneOf : ''));
84
- for (const sec of v.tasks.sections) for (const x of sec.top || []) lines.push('- ' + x.title + (x.sub ? ' · ' + x.sub : ''));
85
- for (const k of ((r.track && r.track.tickets) || []).filter((x) => x.status !== 'Done')) lines.push('- ' + k.key + ' ' + k.title + ' · ' + tkState(k) + (k.assignee ? ' · ' + k.assignee : ''));
86
- return lines.join('\n');
103
+ /** The stakeholder form, as Home's (POST /api/home-desk/stakeholder), a drill-in of the initiative: ← comes back to it. */
104
+ function addPerson(r) {
105
+ VW.drill();
106
+ const body = VW.open({ id: 'person:new', kind: 'Stakeholder', title: 'Add a stakeholder to ' + r.title, icon: 'info', back: true,
107
+ html: '<div class="hi-form"><label class="hi-field"><span>Name</span><input id="hpN" autocomplete="off"></label><label class="hi-field"><span>Role</span><input id="hpR" placeholder="e.g. Head of Sales"></label><label class="hi-field"><span>Note</span><input id="hpT" placeholder="What they care about"></label><div class="hi-acts"><button type="button" class="hi-btn dark" data-hp-add>Add</button></div></div>' });
108
+ setTimeout(() => { const i = body.querySelector('#hpN'); if (i) i.focus(); }, 0);
109
+ body.onclick = async (e) => {
110
+ if (!e.target.closest('[data-hp-add]')) return;
111
+ const name = body.querySelector('#hpN').value.trim(); if (!name) return;
112
+ const res = await pmPost('/api/home-desk/stakeholder', { ws: where(r).ws, initiative: r.id, name, role: body.querySelector('#hpR').value.trim(), note: body.querySelector('#hpT').value.trim() }).catch(() => null);
113
+ if (res && res.ok) { O.toast('Added ' + name + '.'); openIni(O.rowOf(r.key) || r); } else O.toast((res && res.error) || 'Not added.');
114
+ };
115
+ }
116
+ function iniMore(r) {
117
+ const M = O.M() || {}, a = r.acts || null, self = !!(M.board || {}).self, mv = moveOf(r), id = r.id;
118
+ const live = a && !a.life && !r.ended && !a.archived;
119
+ return iniMoreOf({
120
+ wf: id && !self && !r.ended ? { name: (r.wf || {}).name, on: (b) => WF.openPicker(b, wfUi(), id) } : null,
121
+ rename: O.rename && id ? () => { const t = document.querySelector('#czViewer [data-cz-vw-rn]'); if (t) t.click(); } : null,
122
+ auto: id && !mv.why ? { on: mv.auto, press: () => setAuto(r, !mv.auto) } : null,
123
+ back: id && a && mv.canBack ? { prev: mv.prev, on: (b) => O.moreAct(r, 'back:' + mv.prev, b) } : null,
124
+ toStage: id && live && !self && (a.stages || []).length > 1 ? (b) => O.moreAct(r, 'stage', b) : null,
125
+ dates: id ? () => location.assign(O.askHref(r, 'Propose new start and end dates for ' + r.title)) : null,
126
+ person: id ? () => addPerson(r) : null,
127
+ // split or merge, then the program moves (batch 11 items 2 and 14; pm/split-merge.js, pm/prog-move.js)
128
+ sm: id && O.smItems && !r.ended ? O.smItems(r) : [],
129
+ pm: id && O.moveItems ? O.moveItems(r) : [],
130
+ turnProgram: id && O.turnProgram && !(O.programOf && O.programOf(r)) ? () => O.turnProgram(r) : null,
131
+ jira: M.jira ? () => O.refreshJira() : null,
132
+ record: id ? async () => { VW.drill(); (await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: r.title, ...where(r) }); } : null,
133
+ link: id ? () => copyText(new URL(O.pageHref(r), location.href).href, 'Link copied.') : null,
134
+ text: () => copyText(iniText(r.title, viewOf(r), (r.track && r.track.tickets) || []), 'Copied as text.'),
135
+ ended: !!r.ended,
136
+ wontDo: id && !self ? (b) => WF.openWontDo(b, wfUi(), id) : null,
137
+ backToTriage: id && !self ? () => WF.backToTriage(wfUi(), id) : null,
138
+ archive: id && !self && !(a && a.archived) ? () => WF.archive(wfUi(), id) : null,
139
+ hold: id && live && O.moreAct ? (b) => O.moreAct(r, 'hold', b) : null,
140
+ resume: id && a && a.life === 'hold' && !r.ended && O.moreAct ? (b) => O.moreAct(r, 'resume', b) : null,
141
+ cancel: id && live && O.moreAct ? (b) => O.moreAct(r, 'cancel', b) : null,
142
+ });
87
143
  }
88
144
  function iniBody(r) {
89
145
  const md = (v) => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+v.slice(5, 7) - 1] + ' ' + +v.slice(8, 10);
@@ -142,8 +198,10 @@ export function openIni(r, from, o = {}) {
142
198
  if (!O || !r || !r.track) return;
143
199
  adding = o.addTo != null ? r.key : null; addTo = o.addTo || ''; addDates = o.addDates || null;
144
200
  // a row with no record id has no chat of its own: its question goes to the board's chat
145
- VW.open({ kind: 'Initiative', title: r.title, icon: 'flag', id: vidOf(r), url: r.id ? O.pageHref(r) : '', full: true,
146
- discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: iniMore(r), rename: O.rename ? O.rename(r) : null,
201
+ readLay(r); // Moves on by itself shows once the layout record is read
202
+ // the same tile as Home's initiative page; no "Open in full": the header's expand already opens it wide (batch 14 item 5)
203
+ VW.open({ kind: 'Initiative', title: r.title, icon: 'goal', id: vidOf(r),
204
+ discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: () => iniMore(O.rowOf(r.key) || r), rename: O.rename ? O.rename(r) : null,
147
205
  render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null }; O.onShow(x.key, from); body.innerHTML = iniBody(x); wire(body, x.key); if (adding === x.key) { const f = body.querySelector('#ivAddTask'); if (f && document.activeElement !== f) f.focus(); } },
148
206
  onClose: () => { if (cur && cur.key === r.key && !cur.tk) { cur = null; O.onHide(); } } });
149
207
  }
@@ -182,4 +240,4 @@ export function refresh() {
182
240
  }
183
241
  export function close() { if (cur) { cur = null; VW.close(); } }
184
242
  export const shown = () => (cur ? cur.key : null);
185
- export function mount(o) { O = o; }
243
+ export function mount(o) { O = o; ensurePopCss(); }