create-pmos 0.838.0 → 0.840.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 (44) hide show
  1. package/package.json +94 -62
  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/changelog.json +93 -24
  7. package/workspace/guide/cli.md +26 -0
  8. package/workspace/guide/home.md +1 -0
  9. package/workspace/guide/layout.md +3 -1
  10. package/workspace/guide/programs.md +3 -0
  11. package/workspace/guide/reports.md +9 -1
  12. package/workspace/lib/app-versions.js +169 -0
  13. package/workspace/lib/features.json +2 -0
  14. package/workspace/lib/pmos-verbs.js +6 -0
  15. package/workspace/lib/report-translate.js +26 -1
  16. package/workspace/lib/report-variants.js +14 -1
  17. package/workspace/lib/roadmap-audiences.js +157 -0
  18. package/workspace/lib/roadmap-cli.js +68 -0
  19. package/workspace/lib/route-modules.js +2 -0
  20. package/workspace/lib/routes-app-versions.js +54 -0
  21. package/workspace/lib/routes-reports.js +20 -3
  22. package/workspace/lib/routes-roadmap-audiences.js +55 -0
  23. package/workspace/lib/routes-today.js +15 -1
  24. package/workspace/lib/tracker-digest.js +12 -1
  25. package/workspace/lib/versions-cli.js +112 -0
  26. package/workspace/package-lock.json +2 -2
  27. package/workspace/package.json +1 -1
  28. package/workspace/public/pm/app-versions.js +97 -0
  29. package/workspace/public/pm/bd-ds.css +6 -0
  30. package/workspace/public/pm/bd-work-ds.css +26 -0
  31. package/workspace/public/pm/cozy-pop-work.js +7 -3
  32. package/workspace/public/pm/cozy-today-app.js +19 -1
  33. package/workspace/public/pm/ini-detail.css +38 -0
  34. package/workspace/public/pm/ini-detail.js +117 -0
  35. package/workspace/public/pm/premium-board.js +28 -5
  36. package/workspace/public/pm/premium-report-read.js +61 -3
  37. package/workspace/public/pm/roadmap-audiences.js +72 -0
  38. package/workspace/public/pm/standup-line.js +37 -0
  39. package/workspace/public/pm/wk-sum.js +103 -0
  40. package/workspace/public/premium-board.html +3 -0
  41. package/workspace/test-lists/app-versions.json +9 -0
  42. package/workspace/test-lists/ini-detail.json +9 -0
  43. package/workspace/test-lists/roadmap-audiences.json +9 -0
  44. package/workspace/test-lists/surface-reports.json +9 -0
@@ -0,0 +1,117 @@
1
+ /* pm/ini-detail.js — the initiative page in two columns (job #2013, initiative tb-initiative-detail; spec: Exploring 3 canvas, page
2
+ * "balanced", board TbInitiative). The main column holds four numbers, then the Stages and the Work breakdown; the side column holds the
3
+ * Overview and a Details card. pm/cozy-pop-work.js dsHtml draws the blocks and calls pageHtml to place them.
4
+ *
5
+ * statsHtml(v, st, today) the four numbers: days in the stage, tasks done, the next date, the end. '' when none has a value
6
+ * detailsHtml(r, v, W, o) Details: Workflow, Stage, Anchor, Program, Owner, Opened, Ends, Jira epics, then the model's other facts
7
+ * msLabel(rows) the list rows with "Milestone · ends <stage>" on each milestone row (copies; the rows are not changed)
8
+ * pageHtml({ stats, main, side }) the two columns
9
+ *
10
+ * Zero is silence: a field with no value draws no row, and a number with no value draws no cell. A value that can change is a press
11
+ * (data-pw-fact, the popup's own handler); a Jira epic opens in Jira. No inline style. */
12
+ import { dayText } from './bd-pop-ds.js';
13
+
14
+ const CSS = new URL('./ini-detail.css', import.meta.url).href;
15
+ if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
16
+ const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
17
+ }
18
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
19
+ const SV = (d, w = 12) => `<svg class="pm-ic" aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
20
+ const OPEN = 'M14 4h6v6M20 4l-9 9M18 14v6H4V6h6';
21
+ const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
22
+ const day = (v) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? m[1] + '-' + m[2] + '-' + m[3] : ''; };
23
+ const DAY = 864e5;
24
+ const between = (a, b) => Math.round((Date.parse(b) - Date.parse(a)) / DAY);
25
+
26
+ /** Every task of the initiative, from the view's sections (the list may fold a long stage; the numbers count them all). */
27
+ function allTasks(v) {
28
+ const out = [];
29
+ for (const s of ((v && v.tasks) || {}).sections || []) {
30
+ if (s.kind && s.kind !== 'stage') continue;
31
+ for (const x of (s.top || []).concat(...(s.groups || []).map((g) => g.rows || []))) out.push({ ...x, sec: s.key, secName: s.name });
32
+ }
33
+ return out;
34
+ }
35
+
36
+ /** The four numbers. st: the stage rows (stagesOf); today: 'YYYY-MM-DD'. */
37
+ export function statsHtml(v, st, today) {
38
+ const S = (v && v.stage) || {}, cells = [];
39
+ const cell = (big, label, note, warn) => cells.push(`<div class="idt-n${warn ? ' warn' : ''}"><b>${esc(big)}</b><span class="pm-meta">${esc(label)}</span>${note ? `<span class="pm-meta idt-sub">${esc(note)}</span>` : ''}</div>`);
40
+ // 1 days in the stage, and the usual days for it (ini-view-model stage.clock): "6 of ~5 days", in Plan
41
+ if (S.clock && S.name) cell(S.clock, 'in ' + S.name, S.dayOver ? 'over the usual' : '', !!S.dayOver);
42
+ // 2 tasks done, and the count of each stage that started (done or now): "Assess 2 of 2 · Plan 4 of 12"
43
+ const T = allTasks(v).filter((x) => !x.wont);
44
+ if (T.length) {
45
+ const per = (st || []).filter((x) => x.kind === 'stage' && x.key !== '' && (x.done || x.now) && x.count).map((x) => x.name + ' ' + x.count.replace(/ done$/, ''));
46
+ cell(T.filter((x) => x.closed).length + ' of ' + T.length, 'tasks done', per.join(' · '), false);
47
+ }
48
+ // 3 the next date an open task is due, and how many fall on it
49
+ const open = T.filter((x) => !x.closed && day(x.end) && day(x.end) >= today).sort((a, b) => day(a.end).localeCompare(day(b.end)));
50
+ if (open.length) {
51
+ const d = day(open[0].end), on = open.filter((x) => day(x.end) === d), ms = on.find((x) => x.ms);
52
+ cell(dayText(d, today), 'next date', ms ? ms.title : plural(on.length, 'task', 'tasks') + ' due', false);
53
+ }
54
+ // 4 the end of the plan and the days left (or over)
55
+ const D = S.dates || null;
56
+ if (D && D.end) cell(D.end, 'ends', D.left || '', !!D.over);
57
+ return cells.length ? `<section class="pm-block idt-stats" aria-label="In numbers">${cells.join('')}</section>` : '';
58
+ }
59
+
60
+ /** A Jira epic's link: its own, else the site of a Jira row on the page with its key. */
61
+ const epicUrl = (key, rows) => {
62
+ const r = (rows || []).find((x) => x && x.jurl && /\/browse\//.test(x.jurl));
63
+ return r ? r.jurl.replace(/\/browse\/[^/?#]+/, '/browse/' + encodeURIComponent(key)) : '';
64
+ };
65
+
66
+ /** Details. r: the board row; v: the view; W: the popup model (facts); o: { ro, rows (the list rows, for the Jira site), program }.
67
+ * Each row: { k, v, act? (a press: data-pw-fact), note? }. */
68
+ export function detailsRows(r, v, W, o = {}) {
69
+ const S = (v && v.stage) || {}, sum = (v && v.summary) || {}, today = (W && W.today) || '';
70
+ const R = [];
71
+ const add = (k, val, act, note) => { if (val) R.push({ k, v: String(val), act: o.ro ? '' : act || '', note: note || '' }); };
72
+ const wf = (r && r.wf && r.wf.name) || (sum.wf && sum.wf.name) || '';
73
+ add('Workflow', wf, r && r.id ? 'wf' : '');
74
+ const since = day(r && r.trail && r.trail.since);
75
+ add('Stage', S.name && S.n != null ? S.name : '', 'stage', since ? 'since ' + dayText(since, today) : '');
76
+ add('Anchor', (r && (r.kr || r.anchor)) || '', '');
77
+ const prog = o.program || sum.program || null;
78
+ add('Program', prog && prog.title, prog && prog.id ? 'program' : '');
79
+ add('Owner', r && r.owner, '');
80
+ add('Opened', r && day(r.start) ? dayText(day(r.start), today) : '', '');
81
+ add('Ends', r && day(r.end) ? dayText(day(r.end), today) : '', 'dates', S.dates && S.dates.left ? S.dates.left : '');
82
+ // the model's other facts (Status, Next milestone, Goal, Product) keep their own presses; the ones above are not repeated
83
+ const seen = new Set(['Stage', 'Start', 'Target end', 'Workflow', 'Program', 'Open']);
84
+ for (const f of (W && W.facts) || []) if (!seen.has(f.k) && f.v) R.push({ k: f.k, v: String(f.v), act: o.ro || f.read ? '' : f.act || '', note: f.note || '', warn: !!f.warn });
85
+ return R;
86
+ }
87
+ export function detailsHtml(r, v, W, o = {}) {
88
+ const R = detailsRows(r, v, W, o);
89
+ const epics = ((r && r.epics) || []).filter(Boolean);
90
+ if (!R.length && !epics.length) return '';
91
+ const val = (x) => {
92
+ const t = `<span class="${x.warn && !x.note ? 'warn' : ''}">${esc(x.v)}</span>${x.note ? ` <span class="pm-meta${x.warn ? ' warn' : ''}">${esc(x.note)}</span>` : ''}`;
93
+ return x.act ? `<button type="button" class="idt-v" data-pw-fact="${esc(x.act)}" data-idt-edit aria-label="${esc(x.k + ': ' + x.v + '. Change it')}">${t}</button>` : `<span class="idt-v ro">${t}</span>`;
94
+ };
95
+ const rows = R.map((x) => `<dt>${esc(x.k)}</dt><dd>${val(x)}</dd>`).join('');
96
+ const ep = epics.length ? `<dt>Jira epics</dt><dd class="idt-eps">${epics.map((k) => {
97
+ const u = epicUrl(k, o.rows);
98
+ return u && /^https:\/\//.test(u) ? `<a class="pm-chip code idt-ep" href="${esc(u)}" target="_blank" rel="noopener" aria-label="${esc('Open ' + k + ' in Jira')}" title="Open in Jira">${esc(k)}${SV(OPEN)}</a>` : `<span class="pm-chip code idt-ep">${esc(k)}</span>`;
99
+ }).join('')}</dd>` : '';
100
+ const sub = R.some((x) => x.act) ? '<span class="pm-meta">press a value to change it</span>' : '';
101
+ return `<section class="pm-block pwd-blk idt-det" aria-label="Details"><div class="pm-row idt-dh"><h2 class="pm-h-sm">Details</h2>${sub}</div><dl class="idt-dl">${rows}${ep}</dl></section>`;
102
+ }
103
+
104
+ /** Milestones per stage: a milestone row says "Milestone · ends <stage>" before its date and owner. Copies; the rows are not changed. */
105
+ export function msLabel(rows) {
106
+ let stage = null;
107
+ return (rows || []).map((x) => {
108
+ if (x && x.kind === 'stage') { stage = x.key === '' ? null : x; return x; }
109
+ if (x && x.kind === 'task' && x.ms && !x.depth && stage) return { ...x, priority: ['Milestone · ends ' + stage.name, x.priority || ''].filter(Boolean).join(' · ') };
110
+ return x;
111
+ });
112
+ }
113
+
114
+ /** The two columns: the numbers on top of the main column; the side column on the right (below the main one on a narrow window). */
115
+ export function pageHtml(p) {
116
+ return `<div class="pw pwd">${p.top || ''}<div class="idt-g"><div class="pwd-main idt-m">${p.stats || ''}${p.main || ''}</div>${p.side ? `<aside class="idt-s" aria-label="Overview and details">${p.side}</aside>` : ''}</div></div>`;
117
+ }
@@ -20,7 +20,7 @@
20
20
  import './fetch-share.js'; // first: identical GETs in flight are asked once (page-open-speed)
21
21
  import { noteUse as noteUseLog } from './use-log.js'; // one count a page when Work is read by objective (TbInitiatives check)
22
22
  import * as WK from './work-kind.js'; // the kind of work before each title (batch 29 item 11, KdBd)
23
- import { pmPost } from './http.js';
23
+ import { pmPost, pmGet } from './http.js';
24
24
  import * as LE from './live-edit.js'; // a task's status or days show at once (the save answers later; a failed save is put back)
25
25
  import { followDoc } from './doc-follow.js';
26
26
  import { $, $$, esc, store, chatAbout, setPageGaps } from './premium-shell.js';
@@ -59,7 +59,8 @@ import * as BI from './bd-ini-panel.js';
59
59
  import * as DL from './bd-deliveries.js';
60
60
  import * as CO from './bd-cols.js'; // the timeline's columns, their menu and their sort (batch 19 item 5, StsA8Board) // the Deliveries lane under the timeline's axis (batch 13 item 4, XcalmA6Lane)
61
61
  import { nextHtml } from './bd-next.js';
62
- import * as GL from './bd-goal.js'; // board AwH: the Track grouped By goal
62
+ import * as GL from './bd-goal.js';
63
+ import * as WS from './wk-sum.js'; // Work › Initiatives: the summary strip, the chips and the Key results column (TbInitiatives slice 2, job #2038) // board AwH: the Track grouped By goal
63
64
  import { statusOf as ivStatus } from './ini-view-model.js';
64
65
  import { initiativeRename, taskRename } from './rename-press.js';
65
66
  import * as CM from './changed-mark.js'; // bet A456: the ✦ and Undo on a row PMOS changed by itself in the last 24 h
@@ -74,10 +75,12 @@ import * as ST from './bd-stands.js'; // Where it stands, its Suggestion and t
74
75
  import * as LS from './load-shapes.js'; // the skeleton and the slow-case line while the board is read (page-open-speed, SpD) // the Board as the first panel: fit(), the rows that open beside, the open row's mark
75
76
  import * as STRAT from './bd-strategy.js'; // the product's strategy in five lines above the initiatives (bet A458)
76
77
  import * as PRIN from './bd-principles.js'; // the product's principles drafted from its decisions, below the strategy (bet A352)
78
+ import * as VERS from './app-versions.js'; // the app versions still in use and the open bugs their users hit, below the principles (idea A211)
77
79
  import * as SEG from './segments.js'; // the product's user groups and the roadmap items that serve each, below the principles (idea A327)
78
80
  import * as SWO from './switch-owners.js'; // who has which switch, per customer, below the principles (idea A263)
79
81
  import * as SKM from './skill-map.js'; // the team skill map below the principles (bet A208)
80
82
  import * as FHR from './first-hour.js'; // the first hour for a new engineer, below Team skills (bet A55)
83
+ import * as RFA from './roadmap-audiences.js'; // the roadmap for exec, team or customer, below Welcome (bet A88)
81
84
  import * as CMAP from './code-map.js'; // the product's code map, one box per main part (idea A176)
82
85
  import * as SWN from './cozy-status-when.js'; // the day a status move really happened, in the toast (round 3 point 18)
83
86
  import { pressHold } from './state-glyph.js';
@@ -717,6 +720,15 @@ const wkMany = () => !!(M && M.board.all && (M.board.products || []).length > 1)
717
720
  const wkProduct = (r) => productName(r.ws || (M && M.board && M.board.ws), r.product || (M && M.board && (M.board.product || M.board.name)) || '');
718
721
  const wkGoalOf = (r) => { if (!GOALS) return ''; const k = (GOALS.of || {})[String(r.anchor || '')], g = k && (GOALS.goals || []).find((x) => x.key === k); return g ? g.title : ''; };
719
722
  const wkProgOf = (r) => { const p = programOf(PGS, r.ws || (M && M.board.ws) || '', r.id); return p ? p.title || p.id : ''; };
723
+ /* TbInitiatives slice 2: the line (GET /api/line) says which initiatives are over time. It is read after the page is drawn, once a board,
724
+ * so the page opens no slower; until it lands there is no Over time cell or chip. WK_CHIP: the chip that is on ('' = All), for this page. */
725
+ let WK_OVER = null, WK_OVER_FOR = '', WK_CHIP = '';
726
+ function readOver() {
727
+ const ws = M.board.all ? [...new Set((M.board.products || []).map((p) => p.ws).filter(Boolean))] : [M.board.ws || ''];
728
+ const k = ws.join(','); if (k === WK_OVER_FOR) return; WK_OVER_FOR = k;
729
+ Promise.all(ws.map((w) => pmGet('/api/line' + (w ? '?ws=' + encodeURIComponent(w) : '')).catch(() => null)))
730
+ .then((got) => { if (k !== WK_OVER_FOR) return; WK_OVER = WS.overOf(got.filter((r) => r && r.ok).map((r) => ({ ws: r.ws, rows: r.rows || [] }))); if (WK_OVER && workOn()) drawInit(); });
731
+ }
720
732
  let BY_OBJ_NOTED = false; // Work read by objective: counted once a page (use-log control workByObjective)
721
733
  function drawWork(L) {
722
734
  const pk = prodKey((M.board && (M.board.product || M.board.name)) || ''), lay = SO.layout();
@@ -725,19 +737,27 @@ function drawWork(L) {
725
737
  if (BAL_KIND && !B.parts.some((p) => p.key === BAL_KIND)) BAL_KIND = '';
726
738
  const meter = LB.meterHtml(B, { on: BAL_KIND, label: 'Mix of the initiatives' });
727
739
  if (meter && BAL_KIND) L = L.filter((r) => LB.kindOf(r) === BAL_KIND);
740
+ // TbInitiatives slice 2: the strip counts every open row; a chip shows only its rows; grouped by goal, the Key results column sits on the right
741
+ if (!ROC) readOver();
742
+ const SU = WS.sumOf(L, { over: WK_OVER, goals: GOALS });
743
+ if (WK_CHIP && !WS.chipsHtml(SU, WK_CHIP).includes(`data-wkchip="${WK_CHIP}"`)) WK_CHIP = '';
744
+ const chips = ROC ? '' : WS.chipsHtml(SU, WK_CHIP), strip = WS.stripHtml(SU);
745
+ const krCol = WV.read().group === 'goal' ? WS.krColHtml(L, GOALS, { over: WK_OVER }) : '';
746
+ L = WS.chipRows(L, WK_CHIP, { over: WK_OVER });
728
747
  // WorkDS: Where it stands (a Summary block and one Suggestion), the Initiatives table, then the Next milestones date line on the table's scale
729
- const list = WV.listHtml(L, { above: meter, tpx: WK_TPX, many: wkMany(), sel: peek && peek.kind === 'ini' ? peek.key : null, rowOf, bar: wkBar,
748
+ const list0 = WV.listHtml(L, { above: chips + (meter || ''), tpx: WK_TPX, many: wkMany(), sel: peek && peek.kind === 'ini' ? peek.key : null, rowOf, bar: wkBar,
730
749
  product: wkProduct, goalOf: wkGoalOf, programOf: wkProgOf, order: (rows) => sortInis(pk, rows, lay, INI_ACC),
731
750
  // grouped by goal, the list groups by the objective each key result serves and names the key result on the row (TbInitiatives)
732
751
  goalGroups: (rows) => { const G = GOALS ? GL.objectiveGroups(rows, GOALS, (rs) => sortInis(pk, rs, lay, INI_ACC)) : null; if (G && !BY_OBJ_NOTED) BY_OBJ_NOTED = noteUseLog('workByObjective'); return G; },
733
752
  serves: (r) => (GOALS ? GL.servesOf(r, GOALS) : ''),
734
753
  canMove: (r) => !ROC && !!(r.track && r.acts && (r.acts.stages || []).length > 1) });
754
+ const list = (krCol ? `<div class="wk-tb"><div class="wk-tbm">${list0}</div>${krCol}</div>` : list0);
735
755
  const W = WV.lastWindow(), vis = WV.filterRows(L, { product: wkProduct, programOf: wkProgOf });
736
- if (!W || WV.read().tl === false) return ST.standsHtml(vis, { sug: !ROC }) + list;
756
+ if (!W || WV.read().tl === false) return strip + ST.standsHtml(vis, { sug: !ROC }) + list;
737
757
  // the Next milestones strip keeps its own window, apart from the table's (Wawan 2026-11-22): it fits the next milestones on the full width
738
758
  const NM = ST.nextMilestones(vis), DW = ST.dlineWindow(NM, new Date(), { off: DL_OFF });
739
759
  DL_W = DW;
740
- return ST.standsHtml(vis, { sug: !ROC }) + list + ST.dlineHtml(NM, DW, { sub: 'all initiatives', ro: ROC, moved: !!DL_OFF, lw: ($('#ibBody').clientWidth || innerWidth) - 90 });
760
+ return strip + ST.standsHtml(vis, { sug: !ROC }) + list + ST.dlineHtml(NM, DW, { sub: 'all initiatives', ro: ROC, moved: !!DL_OFF, lw: ($('#ibBody').clientWidth || innerWidth) - 90 });
741
761
  }
742
762
  /** How far the PM scrolled the Next milestones strip, in ms (0: it fits from today), and the window it was last drawn with. */
743
763
  let DL_OFF = 0, DL_W = null;
@@ -1026,6 +1046,7 @@ $('#ibBody').addEventListener('click', (e) => {
1026
1046
  const bk = e.target.closest('.lb-m [data-balance-kind]'); if (bk) { const k = bk.dataset.balanceKind; BAL_KIND = BAL_KIND === k ? '' : k; drawInit(); const n = $(`#ibBody .lb-m button[data-balance-kind="${k}"]`); if (n) n.focus(); return; }
1027
1047
  // the strip's +N marks and Fit move only the strip, never the table
1028
1048
  const dl = e.target.closest('[data-wkdl]'); if (dl && dl.dataset.wkdl !== 'add') { DL_OFF = dl.dataset.wkdl === 'fit' || !DL_W ? 0 : DL_OFF + (+dl.dataset.at - +DL_W.from); drawInit(); const n = $(`#ibBody [data-wkdl="${dl.dataset.wkdl}"]`) || $('#ibBody .wk-next .pm-more') || $('#ibBody [data-wknav="today"]'); if (n) n.focus(); return; }
1049
+ const ch = e.target.closest('[data-wkchip]'); if (ch) { const k = ch.dataset.wkchip; WK_CHIP = WK_CHIP === k ? '' : k; if (k) noteUseLog('workChip'); drawInit(); const n = $(`#ibBody [data-wkchip="${WK_CHIP === k ? k : ''}"]`); if (n) n.focus(); return; }
1029
1050
  if (workPress(e)) return;
1030
1051
  }
1031
1052
  if (e.target.closest('#fold, [data-mefold]')) { foldOpen = !foldOpen; drawInit(); const f = $('#fold') || $('#ibBody [data-mefold]'); if (f) f.focus(); return; }
@@ -1533,10 +1554,12 @@ async function load() {
1533
1554
  LE.loaded({ since, stale: !!r.stale }); // a change still saving stays on the new read; open views (the big Work breakdown) follow it
1534
1555
  STRAT.refresh($('#cStrat'), { ws: M.board.ws || null, board: M.board.id || null, single: !ALL, say });
1535
1556
  PRIN.refresh($('#cPrin'), { ws: M.board.ws || null, single: !ALL, say });
1557
+ VERS.refresh($('#cVers'), { ws: M.board.ws || null, single: !ALL, say });
1536
1558
  SEG.refresh($('#cSeg'), { ws: M.board.ws || null, single: !ALL, say });
1537
1559
  SWO.refresh($('#cSw'), { ws: M.board.ws || null, single: !ALL, say });
1538
1560
  SKM.refresh($('#cSkills'), { ws: M.board.ws || null, single: !ALL, say });
1539
1561
  FHR.refresh($('#cWelcome'), { ws: M.board.ws || null, single: !ALL, say });
1562
+ RFA.refresh($('#cRoadFor'), { ws: M.board.ws || null, single: !ALL, say });
1540
1563
  CMAP.mount($('#cCode'), { ws: M.board.ws || null, single: !ALL });
1541
1564
  focusOnce(); taskOnce(); programOnce(); newOnce(); loadOthers(); loadWorkflows();
1542
1565
  if (r.stale) setTimeout(load, 2000); // a press is still being derived: ask again
@@ -34,6 +34,8 @@
34
34
  * thumbnails; Undo and Redo dim when there is nothing to take back or do again. premium-vw-slides.js draws it in the card.
35
35
  *
36
36
  * openReport(row, hand) row = a Reports card document { cadence, slot, date, path, state, archived }; hand = { ws, name, cycles, onIssue, onChange }
37
+ * versionsHtml(V) the Draft | For executives | For engineers | For customers | In <language> tabs, '' with none (pure)
38
+ * langHtml(H) the ✦ when the readers name a language with no copy: ✓ adds it, then Undo; '' with no hint (pure)
37
39
  * openReportView(ref, o) ref = a report path reports/<cadence>/<date>.md or a row; the window.czViews entry (premium-vw-open.js).
38
40
  * o.cuts: a ready-made report (batch 17 item 1, PbG5): Sponsors · 1 minute | Team · full over the same numbers
39
41
  * wordsOf(md, fallback) the document as { title, sections: [{ h, lines }] } (pure)
@@ -51,6 +53,7 @@
51
53
  * (Read again: a redraft that keeps the notes; Start the next cycle without a template), /api/report-setups/draft (Start the next cycle),
52
54
  * /api/report-design/revert (Go back to it). */
53
55
  import { pmGet, pmPost } from './http.js';
56
+ import { noteUse } from './use-log.js'; // surface-reports: reportVersionTab, reportLanguageAdd
54
57
  import * as PR from './print-pdf.js'; // Print or PDF and Send a copy: the one print layout (job #1911, A379)
55
58
  import { open as vOpen, current as vCur, czSections } from './cozy-viewer.js';
56
59
  import * as MP from './premium-mtg-present.js'; // the one presenter window for every kind (canvas note xvPresent)
@@ -413,9 +416,57 @@ async function cutTo(k) {
413
416
  R.text = C.sponsors; R.W = wordsOf(R.text, R.name); R.i = 0;
414
417
  draw();
415
418
  }
419
+ /* ── the versions beside a draft (initiative report-three-audiences, Wawan's try feedback 2026-11-25): Draft | For executives | For engineers |
420
+ * For customers, only the versions on disk (GET /api/report/draft `versions`, lib/report-variants.js versionsOf). A press shows that version's
421
+ * words in this same view; the designed render and the Pyramid deck belong to the draft, so a version shows its own words. Only the draft is
422
+ * edited. No versions: nothing is drawn. */
423
+ export function versionsHtml(V) {
424
+ if (!V || !Array.isArray(V.list) || !V.list.length) return '';
425
+ const b = (k, l) => `<button type="button" data-r="ver|${esc(k)}" aria-pressed="${(V.on || '') === k}"><span>${esc(l)}</span></button>`;
426
+ return `<div class="vz-cut"><div class="rp-seg vz-cuts" role="group" aria-label="Which version">${b('', 'Draft')}${V.list.map((x) => b(x.audience, x.label)).join('')}</div>${V.err ? `<p class="vz-msg" role="status">${esc(V.err)}</p>` : ''}</div>`;
427
+ }
428
+ /** The ✦ on the draft when the report's readers name a language that has no copy yet (surface-reports; GET /api/report/draft langHint):
429
+ * one sentence and an icon-only ✓ that adds it to the definition (POST /api/report/language). After the ✓: what changed, and Undo. '' with
430
+ * no hint. H: { list: [{ language, code }], done: language | null }. */
431
+ export function langHtml(H) {
432
+ if (!H || !Array.isArray(H.list) || !H.list.length) return '';
433
+ const star = '<span class="pm-star" aria-hidden="true">✦</span>';
434
+ if (H.done) {
435
+ const u = `Stop the ${H.done} copy`;
436
+ return `<p class="pm-said vz-lh" role="status">${star}<span>Each new draft now gets a copy in ${esc(H.done)}.</span><button type="button" class="vz-ib vz-hv" data-r="langundo|${esc(H.done)}" aria-label="${esc(u)}" title="Undo">${ic('undo', 15)}</button></p>`;
437
+ }
438
+ const L = H.list[0].language, a = `Add a copy in ${L} to each draft`;
439
+ return `<p class="pm-said vz-lh">${star}<span>Your readers include ${esc(L)}. Add a copy in ${esc(L)} to each draft?</span><button type="button" class="vz-ib vz-hv" data-r="lang|${esc(L)}" aria-label="${esc(a)}" title="${esc(a)}">${ic('check', 15)}</button></p>`;
440
+ }
441
+ async function langSet(language, off) {
442
+ const me = R, c = cycleOf(R.row); if (!R.lh || !c.cadence) return;
443
+ R.busy = true; draw();
444
+ const r = await pmPost('/api/report/language', { ws: R.ws, cadence: c.cadence, language, ...(off ? { off: true } : {}) }).catch(() => null);
445
+ if (R !== me) return;
446
+ R.busy = false;
447
+ if (!r || !r.ok) return say((r && r.error) || 'The language was not saved. Nothing changed.', 'bad');
448
+ if (!off) noteUse('reportLanguageAdd');
449
+ R.lh.done = off ? null : language;
450
+ draw();
451
+ }
452
+ async function verTo(k) {
453
+ const V = R.vers, me = R; if (!V || (V.on || '') === k) return;
454
+ if (!k) { V.on = ''; V.err = ''; R.text = V.draft.text; R.cyc = V.draft.cyc; R.pyr = V.draft.pyr; R.W = wordsOf(R.text, R.name); R.i = 0; return draw(); }
455
+ const x = V.list.find((y) => y.audience === k); if (!x) return;
456
+ if (V.texts[k] == null) {
457
+ let t = null; try { t = await textOf('/api/doc?' + q({ ws: R.ws, path: x.path })); } catch { t = null; }
458
+ if (R !== me) return;
459
+ if (t == null) { V.err = x.label + ' could not be read. The draft is shown.'; return draw(); }
460
+ V.texts[k] = t;
461
+ }
462
+ if (!V.on) V.draft = { text: R.text, cyc: R.cyc, pyr: R.pyr };
463
+ noteUse('reportVersionTab');
464
+ V.err = ''; V.on = k; R.text = V.texts[k]; R.cyc = null; R.pyr = null; R.W = wordsOf(R.text, R.name); R.i = 0;
465
+ draw();
466
+ }
416
467
  function barHtml() {
417
468
  return rpBarHtml({ view: R.view, views: [['deck', 'Slides'], ['doc', 'Document'], ['live', 'Live page']], tools: [
418
- R.issued || (R.cuts && R.cuts.on === 'sponsors') ? null : { act: 'edit', label: 'Edit', icon: 'pen' }, { act: 'present', label: 'Present', icon: 'present' },
469
+ R.issued || (R.cuts && R.cuts.on === 'sponsors') || (R.vers && R.vers.on) ? null : { act: 'edit', label: 'Edit', icon: 'pen' }, { act: 'present', label: 'Present', icon: 'present' },
419
470
  R.issued && !R.archived ? null : { act: 'share', label: 'Share', icon: 'share', exp: R.pop === 'share', pop: 'dialog' },
420
471
  { act: 'dlm', label: 'Download', icon: 'dl', exp: R.pop === 'dl' }] });
421
472
  }
@@ -493,7 +544,7 @@ function bodyHtml() {
493
544
  }
494
545
  const view = R.err ? SB.error('The document could not be read: ' + R.err) : !R.W ? SB.loading('Reading the report.')
495
546
  : R.gal ? galView() : (R.view === 'deck' ? deckHtml() : R.view === 'live' ? liveView() : pageHtml()) + ordAssHtml();
496
- return `<div class="vz-rpb">${R.conf ? confHtml() : R.W ? sumHtml() + ordRowHtml() : ''}${R.W && !R.err ? cutsHtml() : ''}${R.msg ? `<p class="vz-msg" role="status" data-tone="${R.msg.tone || ''}">${esc(R.msg.text)}</p>` : ''}${R.edit ? '' : waitHtml()}${R.W && !R.err ? barHtml() : ''}${view}${R.W && !R.err && !R.issued ? rvHtml() : ''}${R.W && !R.err ? foldsHtml() : ''}${askHtml()}</div>`;
547
+ return `<div class="vz-rpb">${R.conf ? confHtml() : R.W ? sumHtml() + ordRowHtml() : ''}${R.W && !R.err ? cutsHtml() : ''}${R.W && !R.err && !R.edit ? versionsHtml(R.vers) : ''}${R.W && !R.err && !R.edit && !R.issued ? langHtml(R.lh) : ''}${R.msg ? `<p class="vz-msg" role="status" data-tone="${R.msg.tone || ''}">${esc(R.msg.text)}</p>` : ''}${R.edit ? '' : waitHtml()}${R.W && !R.err ? barHtml() : ''}${view}${R.W && !R.err && !R.issued ? rvHtml() : ''}${R.W && !R.err ? foldsHtml() : ''}${askHtml()}</div>`;
497
548
  }
498
549
  /* ── the orders of a draft (batch 27 item 16; canvas TpA, TpD, TpE; report-orders-ui.js, GET /api/report-orders) ── */
499
550
  const ORD_HIDE = 'pmos-report-orders-hidden';
@@ -720,6 +771,9 @@ async function act([k, v], t) {
720
771
  if (k === 'ord') return ordAct(v, t.dataset.r.split('|').slice(2).join('|'));
721
772
  if (k === 'pop') { R.pop = v || null; return draw(); }
722
773
  if (k === 'cut') return cutTo(v);
774
+ if (k === 'ver') return verTo(v || '');
775
+ if (k === 'lang') return langSet(v, false);
776
+ if (k === 'langundo') return langSet(v, true);
723
777
  if (k === 'bf') return briefAct(v, t.dataset.r.split('|').slice(2).join('|'));
724
778
  if (k === 'lv') return liveAct(v, t.dataset.r.split('|').slice(2).join('|'));
725
779
  if (k === 'dlm') { R.pop = R.pop === 'dl' ? null : 'dl'; return draw(); }
@@ -1135,6 +1189,10 @@ export async function openReport(row, hand = {}) {
1135
1189
  if (R !== me) return me;
1136
1190
  if (!R.ws && d && d.ws) R.ws = d.ws;
1137
1191
  R.also = d && Array.isArray(d.also) ? d.also : [];
1192
+ // Draft | For … | In …: the versions for an audience and the translated copies beside the draft (surface-reports: shown, never asked for)
1193
+ const vl = [...(d && Array.isArray(d.versions) ? d.versions : []), ...R.also.filter((a) => a && a.path && a.language).map((a) => ({ audience: 'lang-' + a.code, label: 'In ' + a.language, path: a.path }))];
1194
+ R.vers = vl.length ? { on: '', list: vl, texts: {}, draft: null, err: '' } : null;
1195
+ R.lh = d && Array.isArray(d.langHint) && d.langHint.length ? { list: d.langHint, done: null } : null; // the ✦ when a reader's language has no copy
1138
1196
  }
1139
1197
  await Promise.all([readCycle(), readSetup(), readShares()]);
1140
1198
  if (R !== me) return me;
@@ -1155,7 +1213,7 @@ async function watchFile(me) {
1155
1213
  while (R === me) {
1156
1214
  await new Promise((ok) => setTimeout(ok, CHECK_MS));
1157
1215
  if (R !== me) return;
1158
- if (document.hidden || me.edit || me.busy || me.pop || (me.cuts && me.cuts.on === 'sponsors')) continue; // the sponsors cut is read from the file, not the file
1216
+ if (document.hidden || me.edit || me.busy || me.pop || (me.cuts && me.cuts.on === 'sponsors') || (me.vers && me.vers.on)) continue; // the sponsors cut is read from the file, not the file
1159
1217
  const h = await stamp();
1160
1218
  if (R !== me || !h) continue;
1161
1219
  // a session writes the draft in many steps: read it when the file has been still for one more check, so a burst of writes is one redraw
@@ -0,0 +1,72 @@
1
+ /* pm/roadmap-audiences.js — Roadmap for others on Work: the ranked roadmap written for leadership, the team or customers (bet A88,
2
+ * initiative roadmap-audiences).
3
+ *
4
+ * mount(host, { ws, single, say }) → draws the block into `host`; a Work page that shows several products at once shows none
5
+ *
6
+ * Built only from Komorebi parts: a block (pm-block, its head with pm-tabs Exec · Team · Customer), the chosen version as plain text in a
7
+ * pm-said line, an icon-only copy button, and on Customer up to five pm-li rows of items not yet marked, each with an icon-only ✓
8
+ * ("Mark for customers"). It reads GET /api/roadmap-for and writes POST /api/roadmap-for/share (lib/routes-roadmap-audiences.js)
9
+ * and nothing else. Copy puts the text on this computer's clipboard; nothing is sent.
10
+ * · A product with no live roadmap item gets no block (zero is silence). A published page (?pack=) never draws it.
11
+ * Each tab press notes roadmapFor in the local use log (the bet's kill line). */
12
+ import { pmGet, pmPost } from './http.js';
13
+ import { noteUse } from './use-log.js';
14
+
15
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
16
+ const SV = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
17
+ const I = { copy: 'M9 9h10v10H9zM5 15V5h10', ok: 'M5 12.5l4.5 4.5L19 7.5' };
18
+ const TABS = [['exec', 'Exec'], ['team', 'Team'], ['customer', 'Customer']];
19
+
20
+ /** The block's markup. v = { audience, markdown, offer } for the chosen tab, or null when none is chosen yet. Pure, so the test reads it. */
21
+ export function blockHtml(v) {
22
+ const on = v && v.audience ? v.audience : '';
23
+ const tabs = TABS.map(([k, n]) => `<button type="button" class="pm-tab" role="tab" name="roadmapFor" value="${k}" aria-selected="${k === on}">${n}</button>`).join('');
24
+ let body = '';
25
+ if (on) {
26
+ body += `<p class="pm-said" data-roadmap-for="${esc(on)}"><span class="ra-md">${esc(v.markdown || '').replace(/\n/g, '<br>')}</span>`
27
+ + `<button type="button" class="pm-btn outline" name="roadmapCopy" value="${esc(on)}" aria-label="Copy this version" title="Copy this version">${SV(I.copy)}</button></p>`;
28
+ const offer = Array.isArray(v.offer) ? v.offer : [];
29
+ if (on === 'customer' && offer.length) {
30
+ body += `<div class="rows">${offer.map((o) => `<div class="pm-li" data-ask="initiative:${esc(o.id)}"><span class="txt"><span class="t">${esc(o.title)}</span></span>`
31
+ + `<button type="button" class="pm-btn outline" name="roadmapShare" value="${esc(o.id)}" aria-label="Mark for customers" title="Mark for customers">${SV(I.ok)}</button></div>`).join('')}</div>`;
32
+ }
33
+ }
34
+ return `<section class="pm-block" aria-label="Roadmap for others"><div class="head"><h3 class="pm-h-sm">Roadmap for others</h3><span class="sp"></span>`
35
+ + `<div class="pm-tabs" role="tablist" aria-label="Who the roadmap is for">${tabs}</div></div>${body}</section>`;
36
+ }
37
+
38
+ const published = () => typeof location !== 'undefined' && /[?&]pack=/.test(location.search || '');
39
+ const url = (ws, who) => `/api/roadmap-for?for=${encodeURIComponent(who)}${ws ? '&ws=' + encodeURIComponent(ws) : ''}`;
40
+
41
+ /** Draw the block into `host` and wire its presses. The block shows only when the exec version has a live item. */
42
+ export async function mount(host, opts = {}) {
43
+ if (!host) return;
44
+ const { ws = null, single = true, say = null } = opts;
45
+ if (!single || published()) { host.hidden = true; host.innerHTML = ''; return; }
46
+ const who = host._who || '';
47
+ const r = await pmGet(url(ws, who || 'exec')).catch(() => null);
48
+ if (r && r.pending) { host._wait = setTimeout(() => mount(host, opts), 1500); return; }
49
+ if (!r || !r.ok || (!who && !(r.lines || []).length)) { host.hidden = true; host.innerHTML = ''; return; } // an extra: zero is silence
50
+ host.hidden = false; host.innerHTML = blockHtml(who ? r : null);
51
+ host._md = who ? r.markdown : '';
52
+ host.onclick = async (e) => {
53
+ const b = e.target.closest('button[name^="roadmap"]'); if (!b) return;
54
+ noteUse(b.name);
55
+ if (b.name === 'roadmapFor') { host._who = b.value; return mount(host, opts); }
56
+ if (b.name === 'roadmapCopy') {
57
+ try { await navigator.clipboard.writeText(host._md || ''); if (say) say('Copied.'); } catch { if (say) say('Not copied: the browser did not allow it.'); }
58
+ return;
59
+ }
60
+ if (b.name === 'roadmapShare') {
61
+ b.disabled = true;
62
+ const id = b.value;
63
+ const res = await pmPost('/api/roadmap-for/share', { ws, id, on: true }).catch(() => null);
64
+ if (!res || !res.ok) { b.disabled = false; if (say) say((res && res.error) || 'Not saved.'); return; }
65
+ if (say) say('Marked for customers.', async () => { await pmPost('/api/roadmap-for/share', { ws, id, on: false }).catch(() => null); mount(host, opts); });
66
+ mount(host, opts);
67
+ }
68
+ };
69
+ }
70
+
71
+ /** Draw the block again after a read of Work. */
72
+ export const refresh = (host, opts) => mount(host, opts);
@@ -0,0 +1,37 @@
1
+ /* pm/standup-line.js — the standup in Today's Overview (initiative surface-reports, job #1987, LINE.md Rule 12). Pure: Node imports it
2
+ * (surface-reports.test.js).
3
+ *
4
+ * The standup digest from Jira (lib/tracker-digest.js, #1716) was reached only by asking the chat. Now, before noon, when the stored Jira
5
+ * reads hold a move since yesterday (GET /api/standup line), the Overview says so in one sentence, and the sentence opens the digest in the
6
+ * reading view. After noon, with no Jira read, or with nothing moved, nothing shows: zero is silence.
7
+ *
8
+ * MORNING_END the hour the line goes away (12)
9
+ * standupParts(answers) → [{ ws, line, lines }] the workspaces whose answer has a line
10
+ * withStandup(O, parts, now, nameOf) → the Overview model with the line added as a ref (key 'standup'), or O unchanged
11
+ * standupHtml(parts, nameOf) → the digest for the reading view
12
+ */
13
+ export const MORNING_END = 12;
14
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
15
+
16
+ /** The answers of GET /api/standup that have a line. */
17
+ export function standupParts(answers) {
18
+ return (Array.isArray(answers) ? answers : []).filter((r) => r && r.ok && typeof r.line === 'string' && r.line)
19
+ .map((r) => ({ ws: r.ws || '', line: r.line, lines: Array.isArray(r.lines) ? r.lines.map(String) : [] }));
20
+ }
21
+
22
+ /** The Overview with the standup sentence, before noon only. One product: its sentence. More: the first, with the product's name. */
23
+ export function withStandup(O, parts, now = Date.now(), nameOf = () => '') {
24
+ if (!O || !Array.isArray(parts) || !parts.length || new Date(now).getHours() >= MORNING_END) return O;
25
+ const p = parts[0], name = parts.length > 1 ? nameOf(p.ws) : '';
26
+ const text = name ? `${name}: ${p.line}` : p.line;
27
+ return { ...O, said: [O.said, text].filter(Boolean).join(' '), refs: [...(O.refs || []), { text, key: 'standup' }] };
28
+ }
29
+
30
+ /** The digest in the reading view: each product's lines, the heading lines bold. */
31
+ export function standupHtml(parts, nameOf = () => '') {
32
+ return `<div class="pm-prose su-dg">${(parts || []).map((p) => {
33
+ const head = parts.length > 1 && nameOf(p.ws) ? `<h3>${esc(nameOf(p.ws))}</h3>` : '';
34
+ const body = p.lines.map((l) => (!l.trim() ? '' : /^\s/.test(l) ? `<p class="su-it">${esc(l.trim())}</p>` : `<p><b>${esc(l)}</b></p>`)).join('');
35
+ return head + body;
36
+ }).join('')}</div>`;
37
+ }
@@ -0,0 +1,103 @@
1
+ /* pm/wk-sum.js — Work › Initiatives: the summary strip, the chips and the Key results column (board TbInitiatives, Exploring 3 page
2
+ * balanced; job #2038, slice 2 after #2030's objective groups). Pure: Node imports it (work-view.test.js).
3
+ *
4
+ * overOf(lines) → Map('<ws>|<id>' and '<id>' → days over) | null from GET /api/line answers; null when none came back
5
+ * sumOf(rows, o) → { n, objectives, krs, over, tasks: { done, n, pct, most }, noOwner: [titles], you, noEpic }
6
+ * stripHtml(S) → the strip: up to four cells; a cell that would read zero is not drawn (zero is silence)
7
+ * chipsHtml(S, on) → All, Over time, Waits on you, No epic, each with its count; a zero chip is not drawn unless it is on
8
+ * chipRows(rows, chip, o) → the rows a chip lets through ('' lets every row through)
9
+ * krColHtml(rows, R, o) → the Key results column: each key result the rows serve, in the OKR file's order, with how its rows stand
10
+ *
11
+ * o: { over: overOf(...) | null, goals: R ({ goals, of } from GET /api/artefacts/goals) }. A row is open when it is not ended and not closed.
12
+ * "Over time" is the line's word (pm/line-view.js): a live row past its stage's expected days. The UI says PMOS. Text goes through esc(). */
13
+ import { esc, tasksOf, epicOf, isClosed } from './bd-work.js';
14
+
15
+ const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
16
+ const open = (rows) => (rows || []).filter((r) => r && !r.ended && !isClosed(r));
17
+
18
+ /** Days over each live row's expected days, by '<ws>|<id>' and by id. A row the line cannot read (no days in the stage, no number of
19
+ * expected days) is not in the map. lines: [{ ws, rows }]. null when no answer came back, so "Over time" is not drawn at all. */
20
+ export function overOf(lines) {
21
+ const got = (lines || []).filter((l) => l && Array.isArray(l.rows));
22
+ if (!got.length) return null;
23
+ const m = new Map();
24
+ for (const l of got) for (const x of l.rows) {
25
+ if (!x || !x.id || !x.live || x.daysThere == null || typeof x.limit !== 'number' || !(x.limit > 0)) continue;
26
+ const d = x.daysThere - x.limit;
27
+ m.set((x.ws || l.ws || '') + '|' + x.id, d); if (!m.has(x.id)) m.set(x.id, d);
28
+ }
29
+ return m;
30
+ }
31
+ /** Days over for a row, or null when the line does not say. */
32
+ export function overDays(r, over) {
33
+ if (!over || !r) return null;
34
+ const k = (r.ws || '') + '|' + r.id;
35
+ return over.has(k) ? over.get(k) : over.has(r.id) ? over.get(r.id) : null;
36
+ }
37
+ const isOver = (r, over) => { const d = overDays(r, over); return d != null && d > 0; };
38
+ const krOf = (r, R) => { const k = R && R.of ? R.of[String((r && r.anchor) || '')] : null; const g = k && (R.goals || []).find((x) => x.key === k); return g && g.kind === 'kr' ? g : null; };
39
+
40
+ export function sumOf(rows, o = {}) {
41
+ const L = open(rows), R = o.goals || null;
42
+ const krs = new Map(); for (const r of L) { const g = krOf(r, R); if (g) krs.set(g.key, g); }
43
+ const objectives = new Set([...krs.values()].map((g) => g.objective).filter(Boolean));
44
+ let done = 0, n = 0, most = null;
45
+ for (const r of L) {
46
+ const t = tasksOf(r); done += t.done; n += t.n;
47
+ const left = t.n - t.done; if (left > 0 && (!most || left > most.left)) most = { title: r.title, left };
48
+ }
49
+ return {
50
+ n: L.length, objectives: objectives.size, krs: krs.size,
51
+ over: o.over ? L.filter((r) => isOver(r, o.over)).length : null,
52
+ tasks: { done, n, pct: n ? Math.min(100, Math.round((done / n) * 100)) : 0, most: most ? most.title : '' },
53
+ noOwner: L.filter((r) => !r.owner).map((r) => r.title),
54
+ you: L.filter((r) => r.track && r.track.you).length,
55
+ noEpic: L.filter((r) => !epicOf(r)).length,
56
+ };
57
+ }
58
+
59
+ const cell = (big, name, sub, tone) => `<div class="wk-sc${tone ? ' ' + tone : ''}"><b>${esc(big)}</b><span class="nm">${esc(name)}</span>${sub ? `<span class="pm-meta">${esc(sub)}</span>` : ''}</div>`;
60
+ const names = (xs) => (xs.length <= 2 ? xs.join(' and ') : xs.slice(0, 2).join(', ') + ' and ' + (xs.length - 2) + ' more');
61
+ export function stripHtml(S) {
62
+ if (!S || !S.n) return '';
63
+ const c = [cell(S.n, plural(S.n, 'Initiative', 'Initiatives').replace(/^\d+ /, ''), S.krs ? plural(S.objectives, 'objective', 'objectives') + ', ' + plural(S.krs, 'key result', 'key results') : '')];
64
+ if (S.over) c.push(cell(S.over, 'Over time', 'past their stage’s expected days', 'warn'));
65
+ if (S.tasks.n) c.push(cell(S.tasks.done + ' of ' + S.tasks.n, 'Tasks done', S.tasks.pct + '%' + (S.tasks.most ? ' · ' + S.tasks.most + ' has the most open' : '')));
66
+ if (S.noOwner.length) c.push(cell(S.noOwner.length, 'No owner', names(S.noOwner)));
67
+ return `<div class="wk-strip" role="group" aria-label="Initiatives at a glance">${c.join('')}</div>`;
68
+ }
69
+
70
+ export const CHIPS = [['', 'All'], ['over', 'Over time'], ['you', 'Waits on you'], ['noepic', 'No epic']];
71
+ export function chipsHtml(S, on = '') {
72
+ if (!S || !S.n) return '';
73
+ const n = { '': S.n, over: S.over, you: S.you, noepic: S.noEpic };
74
+ const cs = CHIPS.filter(([k]) => k === '' || k === on || (n[k] != null && n[k] > 0));
75
+ if (cs.length < 2) return ''; // All alone says nothing
76
+ return `<div class="wk-chips" role="group" aria-label="Show only">${cs.map(([k, w]) => `<button type="button" class="pm-chip wk-chip${k === on ? ' on' : ''}" data-wkchip="${k}" aria-pressed="${k === on}">${esc(w)}<span class="k">${n[k] == null ? 0 : n[k]}</span></button>`).join('')}</div>`;
77
+ }
78
+ export function chipRows(rows, chip, o = {}) {
79
+ if (!chip) return rows;
80
+ if (chip === 'over') return rows.filter((r) => isOver(r, o.over));
81
+ if (chip === 'you') return rows.filter((r) => r.track && r.track.you);
82
+ if (chip === 'noepic') return rows.filter((r) => !epicOf(r));
83
+ return rows;
84
+ }
85
+
86
+ /** How a key result's rows stand, in one line: who waits on you first, then over time, else nothing. */
87
+ function standWord(L, over) {
88
+ const you = L.filter((r) => r.track && r.track.you);
89
+ if (you.length) return you.length === 1 ? you[0].title + ' waits on you' : you.length + ' wait on you';
90
+ const ov = over ? L.filter((r) => isOver(r, over)).length : 0;
91
+ if (!ov) return '';
92
+ if (ov === L.length) return L.length === 1 ? 'over time' : L.length === 2 ? 'both over time' : 'all over time';
93
+ return ov + ' over time';
94
+ }
95
+ export function krColHtml(rows, R, o = {}) {
96
+ if (!R || !(R.goals || []).length) return '';
97
+ const L = open(rows), by = new Map();
98
+ for (const r of L) { const g = krOf(r, R); if (g) { if (!by.has(g.key)) by.set(g.key, []); by.get(g.key).push(r); } }
99
+ const ks = (R.goals || []).filter((g) => g.kind === 'kr' && by.has(g.key)).sort((a, b) => String(a.key).localeCompare(String(b.key), undefined, { numeric: true })); // the OKR file's order: o1::kr1-1 before o1::kr1-2 before o2::
100
+ if (!ks.length) return '';
101
+ const item = (g) => { const rs = by.get(g.key), w = standWord(rs, o.over); return `<li class="wk-kr"><b>${esc(g.token || '')}</b> <span class="t">${esc(g.title)}</span><span class="pm-meta">${esc(plural(rs.length, 'initiative', 'initiatives') + (w ? ' · ' + w : ''))}</span></li>`; };
102
+ return `<aside class="pm-block wk-krs" aria-label="Key results"><h2 class="pm-h-sm">Key results</h2><ul>${ks.map(item).join('')}</ul></aside>`;
103
+ }
@@ -65,6 +65,8 @@
65
65
  <section class="bd-sec" id="cStrat" aria-label="Strategy" hidden></section>
66
66
  <!-- the product's principles drafted from its decisions (pm/bd-principles.js, bet A352): below the strategy, one product only -->
67
67
  <section class="bd-sec" id="cPrin" aria-label="Principles" hidden></section>
68
+ <!-- the app versions still in use and the open bugs their users hit (pm/app-versions.js, idea A211): below the principles, one product only -->
69
+ <section class="bd-sec" id="cVers" aria-label="Versions" hidden></section>
68
70
  <!-- the product's user groups and the roadmap items that serve each (pm/segments.js, idea A327): below the principles, one product only -->
69
71
  <section class="bd-sec" id="cSeg" aria-label="Segments" hidden></section>
70
72
  <!-- who has which switch, per customer (pm/switch-owners.js, idea A263): below the principles, one product only -->
@@ -72,6 +74,7 @@
72
74
  <!-- the team skill map (pm/skill-map.js, bet A208): below the principles, one product only, for the person and their lead -->
73
75
  <section class="bd-sec" id="cSkills" aria-label="Team skills" hidden></section>
74
76
  <section class="bd-sec" id="cWelcome" aria-label="Welcome" hidden></section>
77
+ <section class="bd-sec" id="cRoadFor" aria-label="Roadmap for others" hidden></section>
75
78
  <!-- the product's code map (pm/code-map.js, idea A176): one box per main part of its repository, one product only -->
76
79
  <section class="bd-sec" id="cCode" aria-label="Code" hidden></section>
77
80
  <section class="bd-sec" id="cIni" aria-labelledby="hIni">
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Old app versions (initiative app-versions, job #1907, idea A211, done test V1-V6, N1-N3): the store's rows and ✦ proposal, pmos versions on a scratch root, the routes in process and the Work block's pure markup. No server, browser, model or network.",
3
+ "modules": [
4
+ "app-versions.test.js"
5
+ ],
6
+ "seconds": {
7
+ "app-versions.test.js": 1
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "The initiative page in two columns (job #2013, initiative tb-initiative-detail, done test S1, V1-V5, N1-N3): the numbers, Details and the milestone label from pm/ini-detail.js and its wiring in pm/cozy-pop-work.js dsHtml. No browser, model or network.",
3
+ "modules": [
4
+ "ini-detail.test.js"
5
+ ],
6
+ "seconds": {
7
+ "ini-detail.test.js": 1
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "The roadmap for exec, team or customer (initiative roadmap-audiences, job #2052, idea A88; done test R1-R6, S1, N1-N2): the live roadmap in rank order, the three versions, the share ledger, pmos roadmap, the route and the Work block's markup. No server, browser, model or network.",
3
+ "modules": [
4
+ "roadmap-audiences.test.js"
5
+ ],
6
+ "seconds": {
7
+ "roadmap-audiences.test.js": 1
8
+ }
9
+ }