create-pmos 0.480.0 → 0.482.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 (49) hide show
  1. package/package.json +26 -27
  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/briefing-premium-board-test.js +1 -3
  7. package/workspace/briefing-premium-insights-test.js +6 -6
  8. package/workspace/briefing-premium-metrics-test.js +5 -84
  9. package/workspace/briefing-premium-sources-test.js +6 -1
  10. package/workspace/changelog.json +25 -0
  11. package/workspace/guide/briefing-premium.md +9 -3
  12. package/workspace/guide/programs.md +4 -2
  13. package/workspace/lib/board-pack.js +1 -1
  14. package/workspace/lib/goal-chat.js +3 -0
  15. package/workspace/lib/metric-drafts.js +37 -6
  16. package/workspace/lib/ready-reports.js +6 -4
  17. package/workspace/lib/report-chat.js +1 -0
  18. package/workspace/lib/routes-metric-drafts.js +2 -1
  19. package/workspace/lib/routes-ready-reports.js +6 -2
  20. package/workspace/package-lock.json +2 -2
  21. package/workspace/package.json +1 -1
  22. package/workspace/premium-html-viewer-test.js +2 -0
  23. package/workspace/public/pm/bd-acts.js +2 -20
  24. package/workspace/public/pm/bd-prog-panel.js +1 -2
  25. package/workspace/public/pm/cozy-board.css +0 -11
  26. package/workspace/public/pm/cozy-home.css +5 -0
  27. package/workspace/public/pm/cozy-insights.css +31 -0
  28. package/workspace/public/pm/cozy-vw-rp.css +5 -0
  29. package/workspace/public/pm/dash-view.css +19 -0
  30. package/workspace/public/pm/dash-view.js +49 -11
  31. package/workspace/public/pm/goal-chat.js +10 -3
  32. package/workspace/public/pm/home-app.js +31 -89
  33. package/workspace/public/pm/home-chat.js +27 -4
  34. package/workspace/public/pm/home-goal.js +1 -1
  35. package/workspace/public/pm/home-line.js +16 -1
  36. package/workspace/public/pm/home-list.js +1 -1
  37. package/workspace/public/pm/premium-board.js +2 -2
  38. package/workspace/public/pm/premium-insights.js +64 -11
  39. package/workspace/public/pm/premium-report-read.js +34 -4
  40. package/workspace/public/pm/premium-report-tab.js +57 -6
  41. package/workspace/public/pm/premium-vw-doc.css +5 -0
  42. package/workspace/public/pm/premium-vw-file.js +4 -0
  43. package/workspace/public/pm/prog-page.css +1 -1
  44. package/workspace/public/pm/prog-page.js +6 -3
  45. package/workspace/public/pm/report-chat.js +8 -2
  46. package/workspace/public/pm/trends-review.js +55 -0
  47. package/workspace/ready-dash-ui-test.js +1 -3
  48. package/workspace/stage-card-tasks-test.js +3 -1
  49. package/workspace/test-files.json +1 -0
@@ -0,0 +1,55 @@
1
+ /* trends-review.js — the words of Intelligence › Delivery trends (batch 22 item 4, canvas MxA–MxD): the month in one ✦ line, "Up N vs last week"
2
+ * on each tile, and "What moved it". PURE: no DOM, no fetch. Every sentence is made from a tile's own value and series; a tile that is not read
3
+ * says nothing, and a number that is not there is never guessed.
4
+ *
5
+ * changeOf(ser, dec) → { d, txt } | null the last week against the one before it, as "Up 7 vs last week"; null when either week is blank
6
+ * movedRows(tiles) → [{ key, label, note, effect }] only the tiles that moved (zero is silence)
7
+ * monthLine(o) → text | null { month, tiles, open } → "November so far: merges are up (...), but 7 of your 14 open initiatives are blocked."
8
+ *
9
+ * A tile here: { key, label, v, ser, abs, change, s } — v is the text shown, ser the weekly series, abs set when the tile is not read, change the
10
+ * server's own { d, txt } where the Board measure has one. lowBetter says which way is good. */
11
+ export const LOW_BETTER = { blocked: true, late: true, idle: true, scope: true, corrections: true, merges: false };
12
+
13
+ const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : null);
14
+ const round = (v, dec) => Math.round(v * 10 ** dec) / 10 ** dec;
15
+
16
+ export function changeOf(ser, dec = 0) {
17
+ const S = Array.isArray(ser) ? ser : [], n = S.length, cur = num(S[n - 1]), prev = num(S[n - 2]);
18
+ if (cur === null || prev === null) return null;
19
+ const d = round(cur - prev, dec), a = Math.abs(d).toFixed(dec);
20
+ return { d, txt: (d === 0 ? 'No change' : (d > 0 ? 'Up ' : 'Down ') + a) + ' vs last week' };
21
+ }
22
+
23
+ const moved = (t) => !t.abs && t.change && t.change.d !== 0 && !/^No change/.test(t.change.txt);
24
+ export function movedRows(tiles) {
25
+ return (tiles || []).filter(moved).map((t) => ({ key: t.key, label: t.label, note: t.note || '', effect: t.change.txt }));
26
+ }
27
+
28
+ const list = (a) => (a.length < 2 ? a.join('') : a.slice(0, -1).join(', ') + ' and ' + a[a.length - 1]);
29
+ export function monthLine({ month, tiles, open }) {
30
+ const T = (k) => (tiles || []).find((t) => t.key === k && !t.abs) || null, n = (t) => (t ? Number(t.v) : NaN);
31
+ const good = [], bad = [];
32
+ const mer = T('merges'), cor = T('corrections'), blk = T('blocked'), idl = T('idle'), lat = T('late');
33
+ if (cor) {
34
+ const c = cor.change;
35
+ if (c && c.d < 0) good.push('corrections fell to ' + cor.v + ' per 100 runs');
36
+ else if (c && c.d > 0) bad.push('corrections rose to ' + cor.v + ' per 100 runs'); // no change: the tile says the value, the line stays quiet
37
+ }
38
+ if (mer && Number.isFinite(n(mer))) {
39
+ const d = mer.change ? mer.change.d : null, v = n(mer);
40
+ if (d > 0) good.push('merges are up (' + v + ' this week, ' + d + ' more than last week)');
41
+ else if (d < 0) bad.push('merges are down (' + v + ' this week, ' + -d + ' fewer than last week)');
42
+ else if (d === 0) good.push('merges held at ' + v);
43
+ }
44
+ const of = open ? 'of your ' + open + ' open initiatives ' : '';
45
+ const bl = n(blk), id = n(idl), la = n(lat);
46
+ const tail = [];
47
+ if (bl > 0) tail.push(open ? bl + ' ' + of + (bl === 1 ? 'is' : 'are') + ' blocked' : bl + ' open ' + (bl === 1 ? 'initiative is' : 'initiatives are') + ' blocked');
48
+ if (id > 0) tail.push(id + (open && !tail.length ? ' ' + of : ' ') + (id === 1 ? 'has' : 'have') + ' been idle for a month');
49
+ if (la > 0) tail.push(la + (la === 1 ? ' is' : ' are') + ' late');
50
+ bad.push(...tail);
51
+ if (!good.length && !bad.length) return null;
52
+ const head = (month ? month + ' so far: ' : '');
53
+ const s = good.length ? list(good) + (bad.length ? ', but ' + list(bad) : '') : list(bad);
54
+ return head + s + '.';
55
+ }
@@ -195,9 +195,7 @@ const SPONSORS = '# Inline login slips to early December unless passkeys move to
195
195
  const pd = await until(() => pg.evaluate(() => { const v = document.querySelector('#czViewer .pv'); if (!v) return null; return { goal: !!v.querySelector('.pv-gc'), tabs: [...v.querySelectorAll('[data-pv="tab"]')].map((t) => t.dataset.k + (t.getAttribute('aria-selected') === 'true' ? '*' : '')), over: v.scrollWidth > v.clientWidth + 1, toggle: !!document.querySelector('#czViewer [data-cz-vw-p="dash"]') }; }), 15000);
196
196
  ok('P (' + nm + ') the product page is the one page: the goal card, Tasks, Initiatives (open first), Reports, Documents; no toggle', !!pd && pd.goal && pd.tabs.join() === 'tasks,initiatives*,reports,documents' && !pd.toggle && !pd.over, JSON.stringify(pd));
197
197
  await pg.click('#czViewer [data-pv="tab"][data-k="reports"]');
198
- const mx = await until(() => pg.evaluate(() => { const b = document.querySelector('#czViewer [data-hp="metrics"]'); if (!b) return null; const r = b.getBoundingClientRect(); return { h: r.height, text: b.textContent }; }), 4000);
199
- ok('P (' + nm + ') the metrics review keeps its way in: a row in the Reports tab, 40 px', !!mx && /Metrics review/.test(mx.text) && mx.h >= 40, JSON.stringify(mx));
200
- if (nm === 'desk') { await pg.click('#czViewer [data-hp="metrics"]'); ok('P the row opens the metrics review, ← back to the product', !!(await until(() => pg.evaluate(() => { const c = window.czViewer && window.czViewer.current(); return c && c.id !== 'product' ? c.id : null; })))); }
198
+ ok('P (' + nm + ') the Reports tab has no Metrics review row: it is Intelligence › Delivery trends now', await pg.evaluate(() => !document.querySelector('#czViewer [data-hp="metrics"]')));
201
199
  ok('P (' + nm + ') read as a page to read (scope product)', gets.some((g) => g.scope === 'product' && g.from === 'read'), JSON.stringify(gets));
202
200
  await shot(pg, 'RdProgProduct-' + nm + '-built');
203
201
  ok('0 no page error (product, ' + nm + ')', errs.length === 0, errs.join(' | '));
@@ -27,6 +27,7 @@ const BASE = T.BASE, SHOTS = process.env.PMOS_SHOTS || '';
27
27
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
28
28
  const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { let v = null; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
29
29
  const results = [];
30
+ const DAY = Date.parse('2026-10-17T09:00:00Z'); // the fixture's day, and the browser's clock
30
31
  const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 500) : ''}`); };
31
32
  let srv = null; let browser = null;
32
33
  const finish = async (code) => {
@@ -66,13 +67,14 @@ const TICKETS = [{ key: 'IDPF-3387', title: 'Refactor the AppAuthService', statu
66
67
  await ctx.addInitScript(() => { try { if (localStorage.getItem('cz-pn:board') == null) localStorage.setItem('cz-pn:board', JSON.stringify({ v: 2, share: 0.405 })); } catch { /* none */ } }); // the Board's Viewer at 560 px beside the page (cozy-panels.js keeps only this share), so its Tasks Timeline is wide enough to drag
67
68
  await ctx.addInitScript((v) => { localStorage.setItem('pmos.tasks.view', v); localStorage.setItem('pmos.tasks.zoom', 'month'); }, view);
68
69
  const page = await ctx.newPage(), errors = [], posts = [];
70
+ await page.clock.install({ time: DAY }); // the fixture's day: the date picker's month and its Today chips stay on it after the real day passes
69
71
  // the board's state: the writes land here, and the next read shows them
70
72
  const S = { tasks: TASKS(), order: {} };
71
73
  const M = () => {
72
74
  const m = BP.build(F.facts()); const r = m.rows.find((x) => x.id === id);
73
75
  r.tasks = S.tasks.map((t) => { const L = S.order[t.section || ''] || [], i = L.indexOf(t.uid); return { ...t, ...(i >= 0 ? { rank: i } : {}) }; });
74
76
  r.track = { ...(r.track || {}), tickets: TICKETS };
75
- m.jira = { ...(m.jira || {}), readAt: new Date(Date.now() - 4 * 60000).toISOString() };
77
+ m.jira = { ...(m.jira || {}), readAt: new Date(DAY - 4 * 60000).toISOString() };
76
78
  return m;
77
79
  };
78
80
  const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
@@ -65,6 +65,7 @@
65
65
  "agent-inbox.test.js",
66
66
  "session-rail.test.js",
67
67
  "briefing-premium-metrics.test.js",
68
+ "trends-review.test.js",
68
69
  "premium-welcome.test.js",
69
70
  "calendar-events.test.js",
70
71
  "calendar-supersede.test.js",