create-pmos 0.823.0 → 0.824.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.823.0",
3
+ "version": "0.824.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -34,15 +34,15 @@
34
34
  ],
35
35
  "pmosChanges": [
36
36
  {
37
- "v": "0.823.0",
38
- "at": "2026-11-25T09:34:55.769Z",
37
+ "v": "0.824.0",
38
+ "at": "2026-11-25T09:50:46.868Z",
39
39
  "f": 4,
40
40
  "prs": [
41
41
  {
42
- "n": 1888,
43
- "t": "Pmos report variants, one report for executives, engineers and customers (A406)",
44
- "s": "Pmos report variants, one report for executives, engineers and customers (A406)",
45
- "k": "new",
42
+ "n": 1945,
43
+ "t": "Job-graph lists report-variants, so main is green again",
44
+ "s": "Job-graph lists report-variants, so main is green again",
45
+ "k": "fix",
46
46
  "i": "report-three-audiences",
47
47
  "try": {
48
48
  "steps": [
@@ -53,6 +53,37 @@
53
53
  "see": "Three versions sit beside the draft. Each one says who it is for, every number in it is in the draft, and it ends with the draft's sources.",
54
54
  "open": "/today.html"
55
55
  }
56
+ },
57
+ {
58
+ "n": 1922,
59
+ "t": "Balance meter on Work's Initiatives and Backlog lists (job #1859, board BalanceDS)",
60
+ "s": "Balance meter on Work's Initiatives and Backlog lists (job #1859, board BalanceDS)",
61
+ "k": "new",
62
+ "h": "Balance meter on Work's Initiatives and Backlog lists (job #1859, board BalanceDS)",
63
+ "try": {
64
+ "steps": [
65
+ "Open Work and look under the Initiatives header",
66
+ "Press a kind in the bar's legend, then press it again",
67
+ "Open the Backlog tab in Work and look under its header"
68
+ ],
69
+ "see": "On Work, the bar and its counts sit under each list header, largest first. A press shows only that kind, and a second press shows all of them again. A ✦ note shows only when one kind is over 60% of…",
70
+ "open": "/premium-board.html"
71
+ },
72
+ "i": "balance-meter"
73
+ }
74
+ ]
75
+ },
76
+ {
77
+ "v": "0.823.0",
78
+ "at": "2026-11-25T09:34:55.769Z",
79
+ "f": 4,
80
+ "prs": [
81
+ {
82
+ "n": 1888,
83
+ "t": "Pmos report variants, one report for executives, engineers and customers (A406)",
84
+ "s": "Pmos report variants, one report for executives, engineers and customers (A406)",
85
+ "k": "new",
86
+ "i": "report-three-audiences"
56
87
  }
57
88
  ]
58
89
  },
@@ -466,19 +497,6 @@
466
497
  "k": "fix"
467
498
  }
468
499
  ]
469
- },
470
- {
471
- "v": "0.794.0",
472
- "at": "2026-11-24T19:46:34.647Z",
473
- "f": 4,
474
- "prs": [
475
- {
476
- "n": 1809,
477
- "t": "The work popup shows five actions at most (job #1774, A498)",
478
- "s": "The work popup shows five actions at most (job #1774, A498)",
479
- "k": "new"
480
- }
481
- ]
482
500
  }
483
501
  ]
484
502
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@62f10ed83
1
+ kernel-source: pmos@998f901e6
2
2
  assembled: 2026-11-25
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-25T09:34:51Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T09:50:42Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-11-25T09:34:51Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T09:50:42Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-11-25T09:34:51Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T09:50:42Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,14 +1,14 @@
1
1
  [
2
2
  {
3
- "v": "0.823.0",
4
- "at": "2026-11-25T09:34:55.769Z",
3
+ "v": "0.824.0",
4
+ "at": "2026-11-25T09:50:46.868Z",
5
5
  "f": 4,
6
6
  "prs": [
7
7
  {
8
- "n": 1888,
9
- "t": "Pmos report variants, one report for executives, engineers and customers (A406)",
10
- "s": "Pmos report variants, one report for executives, engineers and customers (A406)",
11
- "k": "new",
8
+ "n": 1945,
9
+ "t": "Job-graph lists report-variants, so main is green again",
10
+ "s": "Job-graph lists report-variants, so main is green again",
11
+ "k": "fix",
12
12
  "i": "report-three-audiences",
13
13
  "try": {
14
14
  "steps": [
@@ -19,6 +19,37 @@
19
19
  "see": "Three versions sit beside the draft. Each one says who it is for, every number in it is in the draft, and it ends with the draft's sources.",
20
20
  "open": "/today.html"
21
21
  }
22
+ },
23
+ {
24
+ "n": 1922,
25
+ "t": "Balance meter on Work's Initiatives and Backlog lists (job #1859, board BalanceDS)",
26
+ "s": "Balance meter on Work's Initiatives and Backlog lists (job #1859, board BalanceDS)",
27
+ "k": "new",
28
+ "h": "Balance meter on Work's Initiatives and Backlog lists (job #1859, board BalanceDS)",
29
+ "try": {
30
+ "steps": [
31
+ "Open Work and look under the Initiatives header",
32
+ "Press a kind in the bar's legend, then press it again",
33
+ "Open the Backlog tab in Work and look under its header"
34
+ ],
35
+ "see": "On Work, the bar and its counts sit under each list header, largest first. A press shows only that kind, and a second press shows all of them again. A ✦ note shows only when one kind is over 60% of…",
36
+ "open": "/premium-board.html"
37
+ },
38
+ "i": "balance-meter"
39
+ }
40
+ ]
41
+ },
42
+ {
43
+ "v": "0.823.0",
44
+ "at": "2026-11-25T09:34:55.769Z",
45
+ "f": 4,
46
+ "prs": [
47
+ {
48
+ "n": 1888,
49
+ "t": "Pmos report variants, one report for executives, engineers and customers (A406)",
50
+ "s": "Pmos report variants, one report for executives, engineers and customers (A406)",
51
+ "k": "new",
52
+ "i": "report-three-audiences"
22
53
  }
23
54
  ]
24
55
  },
@@ -42,6 +42,14 @@ Press **Line** on the switch to see every live initiative of your pick in one ta
42
42
 
43
43
  When no task in the list has a Jira ticket, the **Jira ticket** column does not show. When no task has an epic, the **Epic** column does not show.
44
44
 
45
+ ## The mix of the list
46
+
47
+ When the Backlog has 5 or more tasks, a thin bar under its header shows the mix by kind, with the counts in a legend, largest first. The kind comes from each task's own type: a Jira Story or Epic is Feature, a Bug is Fix, a Spike is Discovery, and a plain Task is Other. PMOS never guesses a kind from a title. The **Initiatives** list in Work shows the same bar, by each initiative's lane.
48
+
49
+ - Press a kind in the legend to show only those tasks. Press it again to show all of them. The order of the backlog does not change.
50
+ - A ✦ line shows only when one kind is more than 60% of the list.
51
+ - `pmos balance show` gives the same counts in a terminal or in the chat.
52
+
45
53
  ## The groups
46
54
 
47
55
  The groups show in this order. An empty group does not show. An open group shows its first 5 tasks. **Show 50 more of N** under them shows the next 50, and the last press says **Show the other N**. To reach one task without opening the group, use **Find** on Work: its **Tasks** part searches every task in the Backlog, shown or not.
@@ -414,6 +414,7 @@ See if a list leans too far one way, for example all features and no fixes. PMOS
414
414
  - `--by outcome` counts the initiatives that name an expected outcome and the ones that do not.
415
415
  - `--file <items.json>` shows the mix of any list: a JSON array of items, for example ideas or backlog tasks. Each item's `kind`, `lane` or `type` field gives its kind. A Jira Bug is Fix, a Story or Epic is Feature, and a Spike is Discovery. PMOS never guesses a kind from a title.
416
416
  - A note shows only when one kind is more than your line of the list, and the list has 5 or more items. The line is 60% unless `--max <percent>` says otherwise. `--json` prints the counts as JSON.
417
+ - Work shows the same mix as a thin bar under the header of the **Initiatives** list and of the **Backlog**. Press a kind in its legend to show only those items.
417
418
 
418
419
  ### pmos decisions: a decision journal
419
420
 
@@ -172,6 +172,7 @@ const JOBS = Object.freeze([
172
172
  ai('past-repeat', 'lib/past-repeat.js', [props], ['repo:DECISIONS.md']),
173
173
  ai('report-readers', 'lib/report-readers.js', [props, '<runtime>/spec-critic.jsonl'], ['report drafts']), // report-reader-review: each report draft read as the CFO, the engineer and the sceptic
174
174
  ai('report-translate', 'lib/report-translate.js', [], ['report drafts', 'report definitions']), // report-reader-language: a translated copy beside each draft, numbers and names checked
175
+ ai('report-variants', 'lib/report-variants.js', [], ['report drafts']), // report-three-audiences: pmos report variants, the draft for executives, engineers and customers
175
176
  ai('decision-memory', 'lib/decision-memory.js', [props], ['repo:DECISIONS.md']),
176
177
  ai('outcomes', 'lib/outcome-props.js', [props, '<state>/outcome-runs.jsonl'], ['initiative records', 'repo:planning/runs/outcome_checks.jsonl', '<state>/metric-reads.jsonl']),
177
178
  ai('descriptions', 'lib/description-props.js', [props], ['initiative records']),
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.823.0",
3
+ "version": "0.824.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.823.0",
9
+ "version": "0.824.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.823.0",
3
+ "version": "0.824.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",
@@ -218,7 +218,7 @@ export function tableHtml(order, o = {}) {
218
218
  const table = R.length ? `<table class="pm-table wk-bkt${o.picking ? ' picking' : ''}"><thead><tr><th class="wk-rk">Rank</th><th>Item</th><th>Who</th><th>State</th><th>Source</th><th>Last change</th><th class="wk-ac" aria-label="Actions"></th></tr></thead><tbody>${body}</tbody></table>`
219
219
  : `<p class="pm-meta">${order.length ? 'Nothing here.' : 'Nothing waits outside the sprint.'}</p>`;
220
220
  const foot = R.length && drag ? '<p class="pm-meta">Drag a row to change its rank. The rank is one list across initiatives; groups only show where each item belongs.</p>' : '';
221
- return `<section class="pm-block wk-blk wk-bk" aria-label="Backlog"><div class="head"><h2 class="pm-h">Backlog</h2><span class="sp"></span>${tabs}${menu}${tune}</div>${cap}${o.said || ''}${table}${foot}${o.mode || ''}</section>`;
221
+ return `<section class="pm-block wk-blk wk-bk" aria-label="Backlog"><div class="head"><h2 class="pm-h">Backlog</h2><span class="sp"></span>${tabs}${menu}${tune}</div>${cap}${o.above || ''}${o.said || ''}${table}${foot}${o.mode || ''}</section>`;
222
222
  }
223
223
  function rowHtml(t, o, drag) {
224
224
  const u = t.ws + '|' + t.board + '|' + t.id, ck = o.sel && o.sel.has(u);
@@ -21,7 +21,8 @@ import * as WS from './work-select.js'; // the bulk move with one Undo, shared
21
21
  import * as IF from './inline-fields.js'; // a task's sprint and priority, set in the row (initiative inline-sprint-priority)
22
22
  import * as LE from './live-edit.js'; // a task's status or days show at once in the list, before it is read again; a failed save is put back
23
23
  import { noteUse } from './use-log.js'; // the sprint draft's presses, counted on this computer only (sprint-draft-capacity)
24
- import * as LV from './line-view.js'; // quiet-rows slice B: the Line tab, every initiative by station (GET /api/line)
24
+ import * as LV from './line-view.js';
25
+ import * as LB from './list-balance.js'; // the balance meter under the Backlog header (bet A448, board BalanceDS) // quiet-rows slice B: the Line tab, every initiative by station (GET /api/line)
25
26
  import * as BD from './bd-backlog-ds.js'; // the Backlog from the system's parts (WorkBacklogDS) // the sprint overview while "This sprint" is on (initiative sprint-overview)
26
27
 
27
28
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
@@ -219,6 +220,7 @@ function draw() {
219
220
  }
220
221
  /* ── the Backlog tab (WorkBacklogDS): Where it stands with one Suggestion, then the Backlog block ───────────────────────── */
221
222
  let ORDER = []; // the backlog in rank order, as drawn last
223
+ let BAL = ''; // the kind a legend press of the balance meter shows only ('' all)
222
224
  const backlogOf = () => DATA.tasks.filter(BD.inBacklog).filter((t) => BM.keeps(t, new Set(), PICK, partB()));
223
225
  /** The Suggestion: the sprint draft at the team's pace when PMOS knows it for one product (sprint-draft-capacity, A471), else the old
224
226
  * pull of the top 4. A draft whose sprint is already full suggests nothing (Where it stands says why). */
@@ -239,6 +241,11 @@ function drawBk() {
239
241
  const B = backlogOf(), order = BD.ranked(B, DATA.rank, DATA.inis);
240
242
  ORDER = order;
241
243
  const rank = new Map(order.map((t, i) => [t.id, i]));
244
+ // the balance meter (BalanceDS): the mix of the backlog by each task's own type; a legend press shows only that kind (the rank stays whole)
245
+ const MB = LB.balanceOf(B);
246
+ if (BAL && !MB.parts.some((p) => p.key === BAL)) BAL = '';
247
+ const meter = LB.meterHtml(MB, { on: BAL, label: 'Mix of the backlog' });
248
+ const rows = meter && BAL ? order.filter((t) => LB.kindOf(t) === BAL) : order;
242
249
  const sh = BM.showingLine(DATA.tasks, { chips: new Set(), pick: PICK, partB: partB() });
243
250
  const showing = sh ? `<p class="pm-meta">${esc(sh.text)}${sh.hidden ? ` · ${sh.hidden} hidden` : ''} · <button type="button" class="wk-sa" data-bkall>Show all</button></p>` : '';
244
251
  const said = SAID ? `<p class="pm-meta" role="status">${esc(SAID.text)}${SAID.undo ? ' <button type="button" class="wk-sa" data-bksaid>Undo</button>' : ''}</p>` : '';
@@ -250,9 +257,10 @@ function drawBk() {
250
257
  });
251
258
  host.innerHTML = (DATA.err ? `<p class="bk-err">${esc(DATA.err)}</p>` : '')
252
259
  + BD.standsHtml(B, { today: DATA.today, next: DATA.next, pull: pullFor(order), draft: draftFor(order) })
253
- + BD.tableHtml(order, { tab: BV.tab, group: BV.group, menu: BMENU, today: DATA.today, rank, sel: SEL, picking: host.classList.contains('picking'),
260
+ + BD.tableHtml(rows, { above: meter, tab: BV.tab, group: BV.group, menu: BMENU, today: DATA.today, rank, sel: SEL, picking: host.classList.contains('picking'),
254
261
  act: (t) => actHtml(t, BM.groupOf(t, partB())), stateOf: (t) => { if (!t.agent) return null; const x = BM.stateOf(t); return { text: x.text, tone: x.tone, title: x.text + (x.note ? ' · ' + x.note : '') }; },
255
262
  groupsPmos: pmosGroups, said: showing + said, mode, inline: true });
263
+ LB.sizeBars(host);
256
264
  drawBar();
257
265
  }
258
266
  const saveBv = () => put('pmos.work.backlog', BV);
@@ -260,6 +268,7 @@ const saveBv = () => put('pmos.work.backlog', BV);
260
268
  async function bkPress(e) {
261
269
  const t0 = e.target, hit = (a) => t0.closest('[' + a + ']');
262
270
  let b;
271
+ if ((b = t0.closest('.lb-m [data-balance-kind]'))) { const k = b.dataset.balanceKind; BAL = BAL === k ? '' : k; draw(); const n = host.querySelector(`.lb-m button[data-balance-kind="${k}"]`); if (n) n.focus(); return true; }
263
272
  if ((b = hit('data-bktab'))) { BV.tab = b.dataset.bktab; saveBv(); draw(); const n = host.querySelector(`[data-bktab="${BV.tab}"]`); if (n) n.focus(); return true; }
264
273
  if (hit('data-bkgroup')) { BMENU = !BMENU; draw(); const n = host.querySelector('[data-bkgrp][aria-checked="true"]'); if (BMENU && n) n.focus(); return true; }
265
274
  if ((b = hit('data-bkgrp'))) { BV.group = b.dataset.bkgrp; BMENU = false; saveBv(); draw(); const n = host.querySelector('[data-bkgroup]'); if (n) n.focus(); return true; }
@@ -200,3 +200,18 @@ body.bd-page.bk-on [id="bkBody"] { display: flex; flex-direction: column; gap: v
200
200
  .bd-pl2-l { display: flex; justify-content: space-between; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); }
201
201
  .bd-pl2.alert .bd-pl2-l span:last-child { color: var(--alert); }
202
202
  }
203
+
204
+ /* the balance meter under a list header (bet A448, board BalanceDS): the Bar and its Legend, the ✦ Said line only when over the line.
205
+ The bar's parts take the four series tokens in order, as the legend's swatches do. */
206
+ .lb-m { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
207
+ .lb-m .pm-bar { height: 6px; gap: 2px; }
208
+ .lb-m .pm-bar span { flex: var(--bd-lb-n, 1) 1 0; }
209
+ .lb-m .pm-bar .lb-blue { background: var(--blue); }
210
+ .lb-m .pm-bar .lb-leaf { background: var(--leaf); }
211
+ .lb-m .pm-bar .lb-muted { background: var(--muted); }
212
+ .lb-m .pm-bar .lb-alert { background: var(--alert); }
213
+ .lb-m .pm-leg { flex-wrap: wrap; gap: 4px 8px; }
214
+ .lb-m .lb-said { max-width: none; margin: 0; color: var(--muted); }
215
+ @media (max-width: 760px) {
216
+ .lb-m .lb-said span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
217
+ }
@@ -417,7 +417,7 @@ export function listHtml(rows, o = {}) {
417
417
  + (tl ? `<div class="pm-tabs" role="tablist" aria-label="Scale of the timeline">${scale}</div>${nav('back', 'Earlier', I.back)}${nav('today', 'Go to today', I.today)}${nav('on', 'Later', I.on)}` : '')
418
418
  + `<button type="button" class="pm-btn" data-wkmenu aria-haspopup="dialog" aria-label="Choose columns, sort and filter" title="Choose columns, sort and filter">${SV(I.tune, 16)}${filterCount() ? `<i class="wk-fc" aria-hidden="true">${filterCount()}</i>` : ''}</button></div>`;
419
419
  const ncol = 1 + keys.length + (tl ? 1 : 0);
420
- let h = `<section class="pm-block wk-blk" aria-label="Initiatives">${head}${showingHtml(every.length - rows.length)}`
420
+ let h = `<section class="pm-block wk-blk" aria-label="Initiatives">${head}${o.above || ''}${showingHtml(every.length - rows.length)}`
421
421
  + `<div class="wk-tw"><table class="pm-table wk${tl ? ' has-x' : ''}" aria-label="Initiatives"><colgroup><col class="c-title">${keys.map((k) => `<col class="c-${k}">`).join('')}${tl ? '<col class="c-x">' : ''}</colgroup>`
422
422
  + `<thead><tr>${sortHd('title', 'Initiative')}${keys.map((k) => sortHd(k, byK[k].n)).join('')}${tlHead}</tr></thead><tbody>`;
423
423
  const row = (r) => `<tr class="wk-i${o.sel === r.key ? ' sel' : ''}${CARD === r.key ? ' hov' : ''}${isClosed(r) ? ' cl' : ''}" tabindex="0" data-key="${esc(r.key)}" aria-label="${esc(r.title + (keys.length ? ', ' + words(r, keys, oo) : ''))}">`
@@ -0,0 +1,73 @@
1
+ /* list-balance.js — the balance meter on a list (initiative balance-meter, bet A448; board BalanceDS). The browser twin of
2
+ * lib/list-balance.js: the same kindOf and balanceOf (balance-meter.test.js checks they agree), plus the meter's HTML.
3
+ *
4
+ * meterHtml(B, { on }) the Bar (pm-bar) and its Legend (pm-leg), counts largest first, and a ✦ Said line (pm-said) only when one
5
+ * kind is over the line. '' under MIN_ITEMS items: zero is silence. `on` is the kind the list is filtered to.
6
+ *
7
+ * Built from system parts only. Colours come from the four series tokens in order (blue, leaf, muted, alert); the words carry the meaning.
8
+ * sizeBars(root) gives each bar part its share (run-time geometry, --bd-lb-n) after the meter is put on the page.
9
+ * A legend press carries data-balance-kind, so the use log counts it. Reading writes nothing.
10
+ */
11
+ export const KINDS = Object.freeze(['feature', 'fix', 'debt', 'discovery', 'other']);
12
+ export const KIND_LABEL = Object.freeze({ feature: 'Feature', fix: 'Fix', debt: 'Debt', discovery: 'Discovery', other: 'Other' });
13
+ export const DEFAULT_MAX = 60;
14
+ export const MIN_ITEMS = 5;
15
+ const ROLES = ['blue', 'leaf', 'muted', 'alert'];
16
+ const WORDS = {
17
+ feature: ['feature', 'story', 'user story', 'epic', 'new feature', 'improvement'],
18
+ fix: ['fix', 'bug', 'defect', 'incident', 'hotfix', 'regression'],
19
+ debt: ['debt', 'tech debt', 'tech-debt', 'technical debt', 'chore', 'refactor', 'maintenance'],
20
+ discovery: ['discovery', 'spike', 'prototype', 'research', 'experiment'],
21
+ };
22
+ const norm = (s) => String(s == null ? '' : s).trim().toLowerCase().replace(/[_]+/g, ' ').replace(/\s+/g, ' ');
23
+ const valOf = (v) => (v && typeof v === 'object' && 'value' in v ? v.value : v);
24
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
25
+
26
+ function wordKind(w) {
27
+ const t = norm(w);
28
+ if (!t) return '';
29
+ for (const k of ['feature', 'fix', 'debt', 'discovery']) if (WORDS[k].includes(t)) return k;
30
+ return '';
31
+ }
32
+
33
+ /** The item's kind from its own fields (kind, lane, type, issuetype), never from its title. */
34
+ export function kindOf(item) {
35
+ if (!item || typeof item !== 'object') return 'other';
36
+ for (const f of ['kind', 'lane', 'type', 'issuetype']) {
37
+ const v = valOf(item[f]);
38
+ const k = wordKind(v && typeof v === 'object' ? v.name : v);
39
+ if (k) return k;
40
+ }
41
+ return 'other';
42
+ }
43
+
44
+ function maxOf(max) { const n = Number(max); return Number.isFinite(n) && n > 0 && n < 100 ? Math.round(n) : DEFAULT_MAX; }
45
+
46
+ /** The mix by kind: { total, max, parts: [{ key, label, n, pct }], over, note }, as lib/list-balance.js balanceOf(items, { by: 'kind' }). */
47
+ export function balanceOf(items, { max = DEFAULT_MAX } = {}) {
48
+ const list = Array.isArray(items) ? items.filter((x) => x && typeof x === 'object') : [];
49
+ const n = Object.fromEntries(KINDS.map((k) => [k, 0]));
50
+ for (const it of list) n[kindOf(it)]++;
51
+ const total = list.length;
52
+ const parts = KINDS.filter((k) => n[k] > 0).map((k, i) => ({ key: k, label: KIND_LABEL[k], n: n[k], pct: Math.round((n[k] / total) * 100), i }))
53
+ .sort((a, b) => b.n - a.n || a.i - b.i).map(({ i, ...p }) => p);
54
+ const line = maxOf(max), top = parts[0];
55
+ const over = top && total >= MIN_ITEMS && (top.n / total) * 100 > line ? top : null;
56
+ return { by: 'kind', total, max: line, parts, over, note: over ? `${over.label} is ${over.pct}% of this list, over your ${line}% line.` : '' };
57
+ }
58
+
59
+ /** The meter: the bar, the legend with counts, and the ✦ note when over. '' for a list under MIN_ITEMS items. */
60
+ export function meterHtml(B, { on = '', label = 'Mix of this list' } = {}) {
61
+ if (!B || B.total < MIN_ITEMS || !B.parts.length) return '';
62
+ const role = (i) => ROLES[i] || 'muted';
63
+ const bar = B.parts.map((p, i) => `<span class="lb-${role(i)}" data-balance-kind="${esc(p.key)}" data-n="${p.n}" title="${esc(p.label)} ${p.n}"></span>`).join('');
64
+ const leg = B.parts.map((p, i) => `<button type="button" data-balance-kind="${esc(p.key)}" aria-pressed="${!on || on === p.key}" aria-label="${esc(p.label)} ${p.n}${on === p.key ? ', showing only these. Press to show all' : ', show only these'}"><i class="pm-sw-${role(i)}"></i>${esc(p.label)} ${p.n}</button>`).join('');
65
+ const said = B.over ? `<p class="pm-said lb-said"><span aria-hidden="true">✦</span><span>${esc(B.note)}</span></p>` : '';
66
+ return `<div class="lb-m" role="group" aria-label="${esc(label)}"><div class="pm-bar" aria-hidden="true">${bar}</div><div class="pm-leg">${leg}</div>${said}</div>`;
67
+ }
68
+
69
+ /** Each bar part's share, set after the meter is on the page (the conformance gate allows run-time geometry only through setProperty). */
70
+ export function sizeBars(root) {
71
+ if (!root || !root.querySelectorAll) return;
72
+ for (const s of root.querySelectorAll('.lb-m .pm-bar span[data-n]')) s.style.setProperty('--bd-lb-n', s.dataset.n);
73
+ }
@@ -73,7 +73,8 @@ import * as LS from './load-shapes.js'; // the skeleton and the slow-case line
73
73
  import * as STRAT from './bd-strategy.js'; // the product's strategy in five lines above the initiatives (bet A458)
74
74
  import * as PRIN from './bd-principles.js'; // the product's principles drafted from its decisions, below the strategy (bet A352)
75
75
  import * as SWN from './cozy-status-when.js'; // the day a status move really happened, in the toast (round 3 point 18)
76
- import { pressHold } from './state-glyph.js'; // a state is a shape, not a word (state-glyphs)
76
+ import { pressHold } from './state-glyph.js';
77
+ import * as LB from './list-balance.js'; // the balance meter under the Initiatives header (bet A448, board BalanceDS) // a state is a shape, not a word (state-glyphs)
77
78
  pressHold(typeof document !== 'undefined' ? document.body : null); // on a phone, press and hold a state glyph for its word and why (state-glyphs)
78
79
 
79
80
  const VIEW_KEY = 'pmos.board.view', PVIEW_KEY = 'pmos.board.pview', SPAN_KEY = 'pmos.board.span', GROUPING_KEY = 'pmos.board.grouping';
@@ -703,15 +704,20 @@ function drawTime(L) {
703
704
  return T.html;
704
705
  }
705
706
  /* ── Work, one view on a desk (initiative work-one-view; pm/bd-work.js draws, this wires): the list, its view menu, the Stage cell ── */
706
- let WK_MENU = null, WK_STM = null;
707
+ let WK_MENU = null, WK_STM = null, BAL_KIND = '';
707
708
  const wkMany = () => !!(M && M.board.all && (M.board.products || []).length > 1);
708
709
  const wkProduct = (r) => productName(r.ws || (M && M.board && M.board.ws), r.product || (M && M.board && (M.board.product || M.board.name)) || '');
709
710
  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 : ''; };
710
711
  const wkProgOf = (r) => { const p = programOf(PGS, r.ws || (M && M.board.ws) || '', r.id); return p ? p.title || p.id : ''; };
711
712
  function drawWork(L) {
712
713
  const pk = prodKey((M.board && (M.board.product || M.board.name)) || ''), lay = SO.layout();
714
+ // the balance meter (BalanceDS): the mix of the rows the table shows, by kind; a legend press shows only that kind
715
+ const B = LB.balanceOf(WV.filterRows(L, { product: wkProduct, programOf: wkProgOf }));
716
+ if (BAL_KIND && !B.parts.some((p) => p.key === BAL_KIND)) BAL_KIND = '';
717
+ const meter = LB.meterHtml(B, { on: BAL_KIND, label: 'Mix of the initiatives' });
718
+ if (meter && BAL_KIND) L = L.filter((r) => LB.kindOf(r) === BAL_KIND);
713
719
  // WorkDS: Where it stands (a Summary block and one Suggestion), the Initiatives table, then the Next milestones date line on the table's scale
714
- const list = WV.listHtml(L, { tpx: WK_TPX, many: wkMany(), sel: peek && peek.kind === 'ini' ? peek.key : null, rowOf, bar: wkBar,
720
+ const list = WV.listHtml(L, { above: meter, tpx: WK_TPX, many: wkMany(), sel: peek && peek.kind === 'ini' ? peek.key : null, rowOf, bar: wkBar,
715
721
  product: wkProduct, goalOf: wkGoalOf, programOf: wkProgOf, order: (rows) => sortInis(pk, rows, lay, INI_ACC),
716
722
  goalGroups: (rows) => (GOALS ? GL.asGroups(rows, GOALS, (rs) => sortInis(pk, rs, lay, INI_ACC)) : null),
717
723
  canMove: (r) => !ROC && !!(r.track && r.acts && (r.acts.stages || []).length > 1) });
@@ -962,6 +968,7 @@ function drawInit() {
962
968
  // a row with the focus keeps it when the rows are drawn again (the page panel changes form as a Viewer opens or closes beside it)
963
969
  const fe = document.activeElement, fk = fe && body.contains(fe) && fe.matches('[data-key]') ? fe.dataset.key : null;
964
970
  body.innerHTML = html + phx;
971
+ LB.sizeBars(body);
965
972
  if (fk) { const n = $$('#ibBody [data-key]').find((x) => x.dataset.key === fk); if (n) n.focus({ preventScroll: true }); }
966
973
  if (v === 'time') TL.mount(body);
967
974
  if (v === 'work' && wkMeasure()) { drawInit(); return; } // the bars' ◇s merge by the track's real width: once measured, draw again
@@ -995,6 +1002,7 @@ $('#ibBody').addEventListener('click', (e) => {
995
1002
  if (curView() === 'work') {
996
1003
  const op = e.target.closest('[data-wkopen]'); if (op) { e.preventDefault(); openIni(rowOf(op.dataset.wkopen), op); return; }
997
1004
  const sg = e.target.closest('[data-wksug]'); if (sg) { sugPress(sg); return; }
1005
+ 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; }
998
1006
  // the strip's +N marks and Fit move only the strip, never the table
999
1007
  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; }
1000
1008
  if (workPress(e)) return;