create-pmos 0.849.0 → 0.851.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/package.json +100 -105
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/design-system/brand/README.md +5 -3
  4. package/payload/design-system/brand/tokens.css +2 -2
  5. package/payload/design-system/brand/tokens.json +31 -31
  6. package/payload/design-system/charts/tokens.css +2 -2
  7. package/payload/design-system/charts/tokens.json +6 -6
  8. package/payload/design-system/documents/tokens.css +2 -2
  9. package/payload/design-system/documents/tokens.json +6 -6
  10. package/payload/design-system/slides/tokens.css +2 -2
  11. package/payload/design-system/slides/tokens.json +2 -2
  12. package/payload/design-system/ui/tokens.css +2 -2
  13. package/payload/design-system/ui/tokens.json +6 -6
  14. package/payload/planning/evals/eval-calibration.md +1 -1
  15. package/payload/planning/okrs/health-budgets.md +1 -1
  16. package/payload/state/discoveries.md +1 -1
  17. package/workspace/briefing-premium-insights-test.js +2 -2
  18. package/workspace/changelog.json +99 -2
  19. package/workspace/design-system/brand/README.md +5 -3
  20. package/workspace/design-system/brand/tokens.css +2 -2
  21. package/workspace/design-system/brand/tokens.json +31 -31
  22. package/workspace/design-system/charts/tokens.css +2 -2
  23. package/workspace/design-system/charts/tokens.json +6 -6
  24. package/workspace/design-system/documents/tokens.css +2 -2
  25. package/workspace/design-system/documents/tokens.json +6 -6
  26. package/workspace/design-system/slides/tokens.css +2 -2
  27. package/workspace/design-system/slides/tokens.json +2 -2
  28. package/workspace/design-system/ui/tokens.css +2 -2
  29. package/workspace/design-system/ui/tokens.json +6 -6
  30. package/workspace/guide/cli.md +30 -1
  31. package/workspace/guide/layout.md +2 -0
  32. package/workspace/guide/settings-and-switches.md +2 -0
  33. package/workspace/lib/balance-target.js +13 -6
  34. package/workspace/lib/compare-cli.js +140 -0
  35. package/workspace/lib/design-boards.js +182 -0
  36. package/workspace/lib/design-cli.js +28 -5
  37. package/workspace/lib/design-drift.js +26 -2
  38. package/workspace/lib/drift-cli.js +4 -1
  39. package/workspace/lib/features.json +1 -0
  40. package/workspace/lib/pmos-verbs.js +3 -0
  41. package/workspace/lib/routes-drift.js +4 -1
  42. package/workspace/lib/spec-code-drift.js +334 -0
  43. package/workspace/lib/spec-drift-cli.js +89 -0
  44. package/workspace/lib/spec-drift-http.js +130 -0
  45. package/workspace/package-lock.json +2 -2
  46. package/workspace/package.json +1 -1
  47. package/workspace/premium-vw-doc-test.js +1 -1
  48. package/workspace/public/pm/bd-backlog.css +1 -0
  49. package/workspace/public/pm/bd-backlog.js +3 -0
  50. package/workspace/public/pm/brand.css +2 -2
  51. package/workspace/public/pm/charts.css +2 -2
  52. package/workspace/public/pm/compare-items.css +29 -0
  53. package/workspace/public/pm/compare-items.js +181 -0
  54. package/workspace/public/pm/cozy-viewer.css +8 -8
  55. package/workspace/public/pm/documents.css +2 -2
  56. package/workspace/public/pm/ds-bridge.css +16 -0
  57. package/workspace/public/pm/komorebi.css +2 -2
  58. package/workspace/public/pm/slides.css +2 -2
  59. package/workspace/public/pm/spec-code-drift.js +61 -0
  60. package/workspace/public/premium-library.html +2 -0
  61. package/workspace/test-lists/compare-items.json +9 -0
  62. package/workspace/test-lists/spec-code-drift.json +9 -0
  63. package/workspace/test-lists/text-token-guard.json +5 -0
@@ -3,8 +3,8 @@
3
3
  * so the sheet changes nothing until a page puts the class on its root. Load brand.css, then charts.css, then the system's own sheet. */
4
4
  @font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 200 800; font-display: swap; src: url(/vendor/plus-jakarta-sans-var.woff2) format('woff2'); }
5
5
  @font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(/vendor/ibm-plex-mono-400.woff2) format('woff2'); }
6
- :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--ground:#EFE8E3;--ground-morning:#EEF3F8;--ground-afternoon:#F5EEE2;--ground-evening:#EFE8E3;--ground-night:#1B1D21;--card:#FFFFFF;--well:#F4F2EE;--line:rgba(42,46,53,.12);--ink:#2A2E35;--muted:#646A74;--blue:#2F5FB3;--on-blue:#FFFFFF;--blue-tint:#ECF1F8;--leaf:#5F7A45;--leaf-tint:#F2F4F0;--alert:#A4461A;--alert-tint:#F7EEEA}
7
- :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds).dark, html.dark :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds), :root[data-theme="dark"] :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--ground:#1B1D21;--card:#24262B;--well:#1B1D21;--line:rgba(236,238,241,.12);--ink:#ECEEF1;--muted:#9EA4AD;--blue:#6AAAF0;--on-blue:#14161A;--blue-tint:#2A323D;--leaf:#A9C48C;--leaf-tint:#2F3333;--alert:#E8A07A;--alert-tint:#363132}
6
+ :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--ground:#F4F4F5;--ground-morning:#F4F4F5;--ground-afternoon:#F4F4F5;--ground-evening:#F4F4F5;--ground-night:#09090B;--card:#FFFFFF;--well:#F4F4F5;--line:#E4E4E7;--ink:#18181B;--muted:#6B6B74;--blue:#2F4FD8;--on-blue:#FFFFFF;--blue-tint:#EEF2FF;--leaf:#2F4FD8;--leaf-tint:#EEF2FF;--alert:#B91C1C;--alert-tint:#FEF2F2}
7
+ :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds).dark, html.dark :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds), :root[data-theme="dark"] :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--ground:#09090B;--card:#18181B;--well:#1F1F23;--line:#27272A;--ink:#FAFAFA;--muted:#A1A1AA;--blue:#8EA2FF;--on-blue:#09090B;--blue-tint:#1E2440;--leaf:#8EA2FF;--leaf-tint:#1E2440;--alert:#F87171;--alert-tint:#2A1717}
8
8
  :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--duration-quick:120ms;--duration-enter:200ms;--duration-leaf:600ms;--duration-light:20min;--ease-out:cubic-bezier(.2, .7, .2, 1);--ease-drift:cubic-bezier(.4, 0, .2, 1);--font-sans:"Plus Jakarta Sans", system-ui, sans-serif;--font-mono:"IBM Plex Mono", ui-monospace, monospace}
9
9
  :root[data-daytint="morning"]:not([data-theme="dark"]) :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--ground:var(--ground-morning)}
10
10
  :root[data-daytint="afternoon"]:not([data-theme="dark"]) :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--ground:var(--ground-afternoon)}
@@ -1,8 +1,8 @@
1
1
  /* charts.css: PMOS Charts, from the PMOS design system family, for the workspace. GENERATED from workspace/design-system/charts/ by
2
2
  * lib/design-system.js: do not edit; change the system's files and run `node lib/design-system.js --write`. Every rule is scoped to :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds),
3
3
  * so the sheet changes nothing until a page puts the class on its root. Load brand.css, then charts.css, then the system's own sheet. */
4
- :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--chart-read:var(--blue);--chart-done:var(--leaf);--chart-plan:var(--muted);--chart-risk:var(--alert);--chart-rest:#C9CDD3;--chart-grid:var(--line);--diagram-step:var(--card);--diagram-edge:var(--muted);--diagram-lane:var(--well);--diagram-now:var(--leaf);--raise:0 1px 2px rgba(42,46,53,.08), 0 4px 14px -6px rgba(70,80,50,.14);--lift:0 10px 28px -10px rgba(42,46,53,.28);--glow:0 0 0 2px #5F7A45, 0 0 0 5px rgba(95,122,69,.10)}
5
- :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds).dark, html.dark :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds), :root[data-theme="dark"] :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--chart-rest:#4A4F57;--raise:0 1px 2px rgba(0,0,0,.4), 0 4px 14px -6px rgba(169,196,140,.08);--lift:0 10px 28px -10px rgba(0,0,0,.6);--glow:0 0 0 2px #A9C48C, 0 0 0 5px rgba(169,196,140,.12)}
4
+ :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--chart-read:var(--blue);--chart-done:var(--leaf);--chart-plan:var(--muted);--chart-risk:var(--alert);--chart-rest:#C9CDD3;--chart-grid:var(--line);--diagram-step:var(--card);--diagram-edge:var(--muted);--diagram-lane:var(--well);--diagram-now:var(--leaf);--raise:0 1px 2px rgba(0,0,0,.06);--lift:0 1px 3px rgba(0,0,0,.08), 0 8px 24px -12px rgba(0,0,0,.12);--glow:0 0 0 2px #18181B}
5
+ :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds).dark, html.dark :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds), :root[data-theme="dark"] :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--chart-rest:#4A4F57;--raise:0 1px 2px rgba(0,0,0,.4);--lift:0 1px 3px rgba(0,0,0,.5), 0 8px 24px -12px rgba(0,0,0,.6);--glow:0 0 0 2px #FAFAFA}
6
6
  :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--chart-h-spark:32px;--chart-h-compact:120px;--chart-h-standard:180px;--chart-h-tall:240px;--chart-w-slide:1408px;--chart-w-page:642px;--chart-max-bars:12;--chart-max-series:3;--diagram-max-steps:6;--radius-mark:4px;--radius-step:16px;--radius-lane:10px}
7
7
  :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds) .pc *{box-sizing:border-box}
8
8
  :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds) .pc{margin:0;display:flex;flex-direction:column;gap:8px;font-family:var(--font-sans);color:var(--ink);min-width:0}
@@ -0,0 +1,29 @@
1
+ /* pm/compare-items.css — the compare panel (pm/compare-items.js; board CompareDS, phone FourPhone). Cozy tokens only. */
2
+ .cmp { display: flex; flex-direction: column; gap: 6px; padding: var(--space-4) 0 var(--space-8); }
3
+ .cmp * { box-sizing: border-box; }
4
+ .cmp-sum { margin: 0 0 var(--space-4); font-size: var(--fs-label); color: var(--cz-ink3); }
5
+ .cmp-h, .cmp-r { display: grid; grid-template-columns: 6px minmax(80px, 130px) 1fr 1fr; gap: var(--space-12); padding: var(--space-8) var(--space-12); border-radius: var(--radius-sm); font-size: var(--fs-body); line-height: 1.45; color: var(--cz-ink); }
6
+ .cmp-h { padding-top: 0; padding-bottom: 0; font-size: var(--fs-label); }
7
+ .cmp-h small { display: block; color: var(--cz-ink3); font-weight: var(--fw-regular); }
8
+ .cmp-n { font: inherit; font-weight: var(--fw-strong); color: var(--cz-ink); background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
9
+ @media (hover: hover) { button.cmp-n:hover { text-decoration: underline; } }
10
+ button.cmp-n:focus-visible, .cmp-fold:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
11
+ .cmp-r.df { background: var(--cz-bluebg); }
12
+ .cmp-dot .cdot { display: block; width: 6px; height: 6px; margin-top: 8px; border-radius: 50%; background: var(--cz-blue); }
13
+ .cmp-k { font-size: var(--fs-label); color: var(--cz-ink3); }
14
+ .cmp-a, .cmp-b { min-width: 0; overflow-wrap: anywhere; white-space: pre-line; }
15
+ .cmp del { text-decoration: line-through; color: var(--cz-ink3); }
16
+ .cmp ins { text-decoration: underline; text-decoration-color: var(--cz-ok); text-decoration-thickness: 2px; }
17
+ .cmp-none { color: var(--cz-ink3); }
18
+ .cmp-one { display: none; }
19
+ .cmp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
20
+ .cmp-fold { margin-top: var(--space-4); height: 44px; display: flex; align-items: center; padding: 0 14px; border: 0; border-top: 1px dashed var(--cz-hair); background: none; width: 100%; font: inherit; font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink3); text-align: left; cursor: pointer; }
21
+ /* a phone: one column, each changed part shows old and new together (FourPhone) */
22
+ @media (max-width: 760px) {
23
+ .cmp-h { display: none; }
24
+ .cmp-r { grid-template-columns: 1fr; gap: 2px; }
25
+ .cmp-dot { display: none; }
26
+ .cmp-r.df .cmp-a, .cmp-r.df .cmp-b { display: none; }
27
+ .cmp-r.df .cmp-one { display: block; overflow-wrap: anywhere; white-space: pre-line; }
28
+ .cmp-r:not(.df) .cmp-b { display: none; }
29
+ }
@@ -0,0 +1,181 @@
1
+ /* pm/compare-items.js — two items side by side, the differences marked (idea A421, initiative compare-items; board CompareDS and
2
+ * FourPhone on the main canvas, In development; done test planning/done-tests/compare-items.md).
3
+ *
4
+ * A SIDE is what one item shows: { title, sub?, fields: [[name, value]], parts?: [[name, text]], open?: () => void }
5
+ * fields are short values (State, Due, Owner); parts are text (a brief's sections), compared in words.
6
+ *
7
+ * wordDiff(a, b) → { a: [{ t, op: 'same'|'del' }], b: [{ t, op: 'same'|'add' }] } PURE, words and the spaces after them
8
+ * compareOf(left, right) → { left, right, unit, rows: [{ name, a, b, same, text, diff? }], differ, same, total } PURE
9
+ * rows: the left's names in order, then the right's extra. unit: 'parts' when the items have text, else 'fields'.
10
+ * taskSide(t) → a side from one Work task (pm/bd-backlog.js DATA.tasks) PURE
11
+ * canCompare(n) · barPressHtml(n) exactly two picked: the bar's icon-only Compare press; one or three: nothing PURE
12
+ * compareHtml(m, o) the panel body (CompareDS): the two names as presses that open each item, the rows that differ with a dot and
13
+ * a tint, removed words struck through and added words underlined, and one fold line for the rows that are the
14
+ * same. On a phone (FourPhone) one column: each changed part shows old and new together. PURE
15
+ * openCompare(left, right, o?) one Viewer beside the list (one panel under the panel rule): Swap sides in its header, Close is the
16
+ * Viewer's own ×. A press on a name opens that item. Counts the use-log control compareOpen (this computer only).
17
+ * A `pmos:compare` event on document with detail { left, right } opens it too (the trade-off card's Compare in full lands here).
18
+ *
19
+ * READ ONLY. Nothing here writes: no POST, no record, no Jira. `pmos compare` (lib/compare-cli.js) gives the chat the same rows. */
20
+
21
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
22
+ const SV = (d, w = 16) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
23
+ export const CI = { cols: 'M4 5h7v14H4zM13 5h7v14h-7z', swap: 'M7 7h13M16 3l4 4-4 4M17 17H4M8 13l-4 4 4 4', down: 'M7 10l5 5 5-5' };
24
+ const MAX_WORDS = 1500; // past this a part is shown whole on both sides, marked as changed (a quadratic diff on a whole spec is too slow)
25
+ const clip = (s, n) => { const t = String(s || '').replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '…' : t; };
26
+ const norm = (v) => String(v == null ? '' : v).replace(/\r\n?/g, '\n').replace(/[ \t]+/g, ' ').replace(/\n{3,}/g, '\n\n').trim();
27
+
28
+ /** The words of a text, each with the spaces after it, so the pieces put back together give the text. */
29
+ const tokens = (s) => String(s || '').match(/(?:[\p{L}\p{N}_%'’.-]*[\p{L}\p{N}_%]|[^\s\p{L}\p{N}_%])\s*/gu) || []; // a word, or one mark ("cents," is cents + ,)
30
+ /** Words both sides keep, the left's removed and the right's added (longest common run of words). PURE. */
31
+ export function wordDiff(a, b) {
32
+ const A = tokens(a), B = tokens(b), key = (w) => w.trim();
33
+ if (A.length * B.length > MAX_WORDS * MAX_WORDS / 4 || A.length > MAX_WORDS || B.length > MAX_WORDS) {
34
+ return { a: A.length ? [{ t: A.join(''), op: 'del' }] : [], b: B.length ? [{ t: B.join(''), op: 'add' }] : [] };
35
+ }
36
+ const n = A.length, m = B.length, L = Array.from({ length: n + 1 }, () => new Uint16Array(m + 1));
37
+ for (let i = n - 1; i >= 0; i--) for (let j = m - 1; j >= 0; j--) L[i][j] = key(A[i]) === key(B[j]) ? L[i + 1][j + 1] + 1 : Math.max(L[i + 1][j], L[i][j + 1]);
38
+ const ra = [], rb = [];
39
+ const push = (r, t, op) => { const x = r[r.length - 1]; if (x && x.op === op) x.t += t; else r.push({ t, op }); };
40
+ let i = 0, j = 0;
41
+ while (i < n && j < m) {
42
+ if (key(A[i]) === key(B[j])) { push(ra, A[i], 'same'); push(rb, B[j], 'same'); i++; j++; }
43
+ else if (L[i + 1][j] >= L[i][j + 1]) push(ra, A[i++], 'del');
44
+ else push(rb, B[j++], 'add');
45
+ }
46
+ while (i < n) push(ra, A[i++], 'del');
47
+ while (j < m) push(rb, B[j++], 'add');
48
+ return { a: ra, b: rb };
49
+ }
50
+
51
+ const sideOf = (s) => ({ title: String((s && s.title) || 'Untitled'), sub: (s && s.sub) || '', fields: (s && s.fields) || [], parts: (s && s.parts) || [], open: s && typeof s.open === 'function' ? s.open : null });
52
+ /** The rows of two sides, row by row. PURE. */
53
+ export function compareOf(left, right) {
54
+ const l = sideOf(left), r = sideOf(right), rows = [];
55
+ const add = (list, text) => {
56
+ const A = new Map(l[list].map(([k, v]) => [k, v])), B = new Map(r[list].map(([k, v]) => [k, v]));
57
+ const names = [...A.keys()]; for (const k of B.keys()) if (!A.has(k)) names.push(k);
58
+ for (const name of names) {
59
+ const a = norm(A.get(name)), b = norm(B.get(name)), same = a === b;
60
+ const row = { name, a, b, same, text };
61
+ if (text && !same) row.diff = wordDiff(a, b);
62
+ rows.push(row);
63
+ }
64
+ };
65
+ add('fields', false); add('parts', true);
66
+ const differ = rows.filter((x) => !x.same).length;
67
+ return { left: l, right: r, unit: l.parts.length || r.parts.length ? 'parts' : 'fields', rows, differ, same: rows.length - differ, total: rows.length };
68
+ }
69
+
70
+ const dayOf = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? `${+m[3]} ${['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+m[2] - 1]} ${m[1]}` : ''; };
71
+ /** One Work task as a side: the fields its row shows, in the row's order. PURE. */
72
+ export function taskSide(t, open) {
73
+ const x = t || {};
74
+ const epic = x.epic ? (x.epic.name || x.epic.key || '') : '';
75
+ return {
76
+ title: x.title || 'A task', sub: x.key || '',
77
+ fields: [['State', x.state || ''], ['Due', dayOf(x.due)], ['Start', dayOf(x.start)], ['Owner', x.who || ''], ['Initiative', x.iniTitle || ''],
78
+ ['Epic', epic], ['Sprint', (x.sprint && (x.sprint.name || x.sprint)) || ''], ['Priority', x.priority || ''], ['Jira', x.key || '']],
79
+ open: typeof open === 'function' ? open : null,
80
+ };
81
+ }
82
+
83
+ /** Exactly two picked. */
84
+ export const canCompare = (n) => n === 2;
85
+ /** The bar's Compare press: icon only, with a label for screen readers; nothing unless exactly two are picked. PURE. */
86
+ export const barPressHtml = (n) => (canCompare(n) ? `<button type="button" class="bk-cmp" data-bkb="compare" aria-label="Compare the two" title="Compare the two">${SV(CI.cols)}</button>` : '');
87
+
88
+ // the spaces after a changed run stay outside its mark, so no space is struck or underlined
89
+ const piece = (p) => { if (p.op === 'same') return esc(p.t); const m = /^([\s\S]*?)(\s*)$/.exec(p.t), tag = p.op === 'del' ? 'del' : 'ins'; return `<${tag}>${esc(m[1])}</${tag}>${m[2]}`; };
90
+ const cellHtml = (row, side) => {
91
+ const v = side === 'a' ? row.a : row.b;
92
+ if (row.diff) return row.diff[side].map(piece).join('') || '<span class="cmp-none">None</span>';
93
+ if (!v) return '<span class="cmp-none">None</span>';
94
+ return row.same ? esc(v) : side === 'a' ? `<del>${esc(v)}</del>` : `<ins>${esc(v)}</ins>`;
95
+ };
96
+ /** One column on a phone: the old and the new together. */
97
+ const oneHtml = (row) => (row.diff ? mergeHtml(row.diff) : `${row.a ? `<del>${esc(row.a)}</del> ` : ''}${row.b ? `<ins>${esc(row.b)}</ins>` : ''}`);
98
+ function mergeHtml(d) {
99
+ // the same words once, each removed run before the added run that takes its place
100
+ const out = []; let i = 0, j = 0;
101
+ const A = d.a, B = d.b;
102
+ while (i < A.length || j < B.length) {
103
+ if (i < A.length && A[i].op === 'del') { out.push(piece(A[i]) + (/\s$/.test(A[i].t) ? '' : ' ')); i++; continue; }
104
+ if (j < B.length && B[j].op === 'add') { out.push(piece(B[j++])); continue; }
105
+ if (i < A.length && j < B.length) { out.push(esc(B[j].t)); i++; j++; continue; }
106
+ if (i < A.length) out.push(piece(A[i++])); else out.push(piece(B[j++]));
107
+ }
108
+ return out.join('');
109
+ }
110
+ const rowHtml = (row) => `<div class="cmp-r${row.same ? '' : ' df'}" role="row">`
111
+ + `<span class="cmp-dot" role="cell">${row.same ? '' : '<i class="cdot" aria-hidden="true"></i><span class="cmp-sr">differs</span>'}</span>`
112
+ + `<span class="cmp-k" role="rowheader">${esc(row.name)}</span>`
113
+ + `<span class="cmp-a" role="cell">${cellHtml(row, 'a')}</span><span class="cmp-b" role="cell">${cellHtml(row, 'b')}</span>`
114
+ + (row.same ? '' : `<span class="cmp-one" aria-hidden="true">${oneHtml(row)}</span>`) + '</div>';
115
+
116
+ /** The summary line: "3 of 7 parts differ · the 4 that are the same are folded"; zero is silence. */
117
+ export function sumText(m) {
118
+ const u = m.unit, one = u === 'parts' ? 'part' : 'field';
119
+ if (!m.total) return '';
120
+ if (!m.differ) return `The ${m.total === 1 ? one : m.total + ' ' + u} are the same`;
121
+ return `${m.differ} of ${m.total} ${m.total === 1 ? one : u} differ` + (m.same ? ` · the ${m.same} that ${m.same === 1 ? 'is' : 'are'} the same ${m.same === 1 ? 'is' : 'are'} folded` : '');
122
+ }
123
+ /** The panel body. o.open: the same rows are shown (the fold pressed). PURE. */
124
+ export function compareHtml(m, o = {}) {
125
+ const name = (s, i) => (s.open
126
+ ? `<button type="button" class="cmp-n" data-cmp-open="${i}" title="${esc('Open ' + s.title)}">${esc(clip(s.title, 80))}</button>`
127
+ : `<b class="cmp-n">${esc(clip(s.title, 80))}</b>`) + (s.sub ? `<small>${esc(s.sub)}</small>` : '');
128
+ const diff = m.rows.filter((r) => !r.same), same = m.rows.filter((r) => r.same);
129
+ const word = m.unit === 'parts' ? (same.length === 1 ? 'part' : 'parts') : (same.length === 1 ? 'field' : 'fields');
130
+ const sum = sumText(m);
131
+ return `<div class="cmp" role="table" aria-label="${esc(m.left.title + ' and ' + m.right.title)}">`
132
+ + (sum ? `<p class="cmp-sum">${esc(sum)}</p>` : '')
133
+ + `<div class="cmp-h" role="row"><span role="cell"></span><span role="cell"></span><span class="cmp-a" role="columnheader">${name(m.left, 0)}</span><span class="cmp-b" role="columnheader">${name(m.right, 1)}</span></div>`
134
+ + diff.map(rowHtml).join('')
135
+ + (same.length ? (o.open ? same.map(rowHtml).join('')
136
+ : `<button type="button" class="cmp-fold" data-cmp-fold aria-expanded="false">${same.length} ${word} the same</button>`) : '')
137
+ + '</div>';
138
+ }
139
+
140
+ /* ── the panel ── */
141
+ let cssOn = false;
142
+ function ensureCss() {
143
+ if (cssOn || typeof document === 'undefined') return; cssOn = true;
144
+ const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = new URL('./compare-items.css', import.meta.url).href; l.setAttribute('data-cmp-css', '');
145
+ document.head.appendChild(l);
146
+ }
147
+ /** Open the two items in one compare panel beside the list. Returns the panel body, or null. */
148
+ export async function openCompare(left, right, o = {}) {
149
+ if (!left || !right || typeof document === 'undefined') return null;
150
+ ensureCss();
151
+ const VW = o.viewer || await import('./cozy-viewer.js');
152
+ const S = { l: left, r: right, open: false };
153
+ let body = null;
154
+ const draw = () => {
155
+ if (!body) return;
156
+ const m = compareOf(S.l, S.r);
157
+ body.innerHTML = compareHtml(m, { open: S.open });
158
+ };
159
+ const id = 'compare:' + (left.title || '') + '|' + (right.title || '');
160
+ body = VW.open({
161
+ id, kind: 'Compare', icon: CI.cols, title: clip(left.title, 40) + ' and ' + clip(right.title, 40), wrap: true,
162
+ presses: [{ act: 'swap', label: 'Swap sides', icon: CI.swap }],
163
+ onPress: (act) => { if (act === 'swap') { const x = S.l; S.l = S.r; S.r = x; draw(); } },
164
+ render: (b) => {
165
+ body = b; draw();
166
+ b.onclick = (e) => {
167
+ const op = e.target.closest('[data-cmp-open]');
168
+ if (op) { const s = op.dataset.cmpOpen === '0' ? S.l : S.r; if (s && typeof s.open === 'function') s.open(op); return; }
169
+ if (e.target.closest('[data-cmp-fold]')) { S.open = true; draw(); }
170
+ };
171
+ },
172
+ });
173
+ // the health number (compareOpen), on this computer only
174
+ import('./use-log.js').then((U) => { if (U.startUseLog) U.startUseLog(); if (U.noteUse) U.noteUse('compareOpen'); }).catch(() => {});
175
+ return body;
176
+ }
177
+
178
+ if (typeof document !== 'undefined' && !(typeof window !== 'undefined' && window.__pmosCompareOn)) {
179
+ if (typeof window !== 'undefined') window.__pmosCompareOn = true;
180
+ document.addEventListener('pmos:compare', (e) => { const d = (e && e.detail) || {}; openCompare(d.left, d.right); });
181
+ }
@@ -6,10 +6,12 @@
6
6
 
7
7
  .cz .dlg, .cz .veil, .cz .toast, .cz .vmenu, .cz .crmenu, .cz .tbmenu, .cz .czi-tok, .cz .cz-vw { /* .cz-vw: the Home Viewer (cozy-viewer.js), whose views read the same tokens */
8
8
  --sans: var(--cz-sans);
9
- --ink: var(--cz-c-2a2e35); --ink-2: var(--cz-c-4a4f58); --ink-3: var(--cz-c-646a74);
10
- --card: var(--cz-c-ffffff); --card-solid: var(--cz-c-ffffff); --well: var(--cz-c-f4f3f0); --hair: rgba(42,46,53,.1);
11
- --ember: var(--cz-c-4894ea); --ember-ink: var(--cz-c-2f5fb3); --solid: var(--cz-c-2f5fb3); --on-solid: var(--cz-c-ffffff); --spot: var(--cz-c-eef5fc);
12
- --ok: var(--cz-c-1e6b45); --bad: var(--cz-c-a8322a); --warn: var(--cz-c-8a5a00); --warn-bg: var(--cz-c-fbf3e4); --ok-bg: var(--cz-c-e7f4ec); --live: var(--cz-c-9a3412); --live-bg: var(--cz-c-fdeee6);
9
+ /* text, surfaces and the accent read the page's --cz-* names, which ds-bridge.css points at the design system on a pm-ds page:
10
+ * one colour set for the page and its Viewer (initiative text-token-guard). They follow the theme by themselves. */
11
+ --ink: var(--cz-ink); --ink-2: var(--cz-ink2); --ink-3: var(--cz-ink3);
12
+ --card: var(--cz-card); --card-solid: var(--cz-card); --well: var(--cz-well); --hair: var(--cz-hair);
13
+ --ember: var(--cz-blue); --ember-ink: var(--cz-blueink); --solid: var(--cz-solid); --on-solid: var(--cz-onsolid); --spot: var(--cz-bluebg);
14
+ --ok: var(--cz-c-1e6b45); --bad: var(--cz-red); --warn: var(--cz-c-8a5a00); --warn-bg: var(--cz-c-fbf3e4); --ok-bg: var(--cz-c-e7f4ec); --live: var(--cz-c-9a3412); --live-bg: var(--cz-c-fdeee6);
13
15
  --b3: rgba(42,46,53,.16);
14
16
  --card-shadow: 0 1px 3px rgba(42,46,53,.08);
15
17
  --glass: var(--cz-c-ffffff); --glass-edge: rgba(42,46,53,.08); --glass-shadow: 0 14px 34px -12px rgba(42,46,53,.35);
@@ -18,17 +20,15 @@
18
20
  }
19
21
  :root[data-theme="dark"] .cz .dlg, :root[data-theme="dark"] .cz .veil, :root[data-theme="dark"] .cz .toast, :root[data-theme="dark"] .cz .vmenu,
20
22
  :root[data-theme="dark"] .cz .crmenu, :root[data-theme="dark"] .cz .tbmenu, :root[data-theme="dark"] .cz .czi-tok, :root[data-theme="dark"] .cz .cz-vw {
21
- --ink: var(--cz-c-eceef1); --ink-2: var(--cz-c-c5c9d0); --ink-3: var(--cz-c-9ea4ad); --card: var(--cz-c-24262b); --card-solid: var(--cz-c-24262b); --well: var(--cz-c-1b1d21); --hair: rgba(236,238,241,.1);
22
- --ember: var(--cz-c-6aaaf0); --ember-ink: var(--cz-c-9bc7f4); --solid: var(--cz-c-6aaaf0); --on-solid: var(--cz-c-17191c); --spot: rgba(106,170,240,.14);
23
23
  --ok: var(--cz-c-7fc79a); --bad: var(--cz-c-f2948c); --warn: var(--cz-c-e8c27a); --warn-bg: rgba(212,161,58,.14); --ok-bg: rgba(94,156,106,.16); --live: var(--cz-c-f2a27a); --live-bg: rgba(217,119,63,.16);
24
+ --bad: var(--cz-red); /* the alert text follows the page (text-token-guard) */
24
25
  --b3: rgba(236,238,241,.16); --glass: var(--cz-c-24262b); --glass-edge: rgba(236,238,241,.08); --card-shadow: 0 1px 3px rgba(0,0,0,.4);
25
26
  }
26
27
  @media (prefers-color-scheme: dark) {
27
28
  :root:not([data-theme="light"]) .cz .dlg, :root:not([data-theme="light"]) .cz .veil, :root:not([data-theme="light"]) .cz .toast, :root:not([data-theme="light"]) .cz .vmenu,
28
29
  :root:not([data-theme="light"]) .cz .crmenu, :root:not([data-theme="light"]) .cz .tbmenu, :root:not([data-theme="light"]) .cz .czi-tok, :root:not([data-theme="light"]) .cz .cz-vw {
29
- --ink: var(--cz-c-eceef1); --ink-2: var(--cz-c-c5c9d0); --ink-3: var(--cz-c-9ea4ad); --card: var(--cz-c-24262b); --card-solid: var(--cz-c-24262b); --well: var(--cz-c-1b1d21); --hair: rgba(236,238,241,.1);
30
- --ember: var(--cz-c-6aaaf0); --ember-ink: var(--cz-c-9bc7f4); --solid: var(--cz-c-6aaaf0); --on-solid: var(--cz-c-17191c); --spot: rgba(106,170,240,.14);
31
30
  --ok: var(--cz-c-7fc79a); --bad: var(--cz-c-f2948c); --warn: var(--cz-c-e8c27a); --warn-bg: rgba(212,161,58,.14); --ok-bg: rgba(94,156,106,.16); --live: var(--cz-c-f2a27a); --live-bg: rgba(217,119,63,.16);
31
+ --bad: var(--cz-red); /* the alert text follows the page (text-token-guard) */
32
32
  --b3: rgba(236,238,241,.16); --glass: var(--cz-c-24262b); --glass-edge: rgba(236,238,241,.08); --card-shadow: 0 1px 3px rgba(0,0,0,.4);
33
33
  }
34
34
  }
@@ -1,8 +1,8 @@
1
1
  /* documents.css: PMOS Documents, from the PMOS design system family, for the workspace. GENERATED from workspace/design-system/documents/ by
2
2
  * lib/design-system.js: do not edit; change the system's files and run `node lib/design-system.js --write`. Every rule is scoped to .pmd-ds,
3
3
  * so the sheet changes nothing until a page puts the class on its root. Load brand.css, then charts.css, then the system's own sheet. */
4
- .pmd-ds{--raise:0 1px 2px rgba(42,46,53,.08), 0 4px 14px -6px rgba(70,80,50,.14);--lift:0 10px 28px -10px rgba(42,46,53,.28);--glow:0 0 0 2px #5F7A45, 0 0 0 5px rgba(95,122,69,.10)}
5
- .pmd-ds.dark, html.dark .pmd-ds, :root[data-theme="dark"] .pmd-ds{--raise:0 1px 2px rgba(0,0,0,.4), 0 4px 14px -6px rgba(169,196,140,.08);--lift:0 10px 28px -10px rgba(0,0,0,.6);--glow:0 0 0 2px #A9C48C, 0 0 0 5px rgba(169,196,140,.12)}
4
+ .pmd-ds{--raise:0 1px 2px rgba(0,0,0,.06);--lift:0 1px 3px rgba(0,0,0,.08), 0 8px 24px -12px rgba(0,0,0,.12);--glow:0 0 0 2px #18181B}
5
+ .pmd-ds.dark, html.dark .pmd-ds, :root[data-theme="dark"] .pmd-ds{--raise:0 1px 2px rgba(0,0,0,.4);--lift:0 1px 3px rgba(0,0,0,.5), 0 8px 24px -12px rgba(0,0,0,.6);--glow:0 0 0 2px #FAFAFA}
6
6
  .pmd-ds{--doc-measure:640px;--doc-space-para:16px;--doc-space-block:24px;--doc-space-section:40px;--page-width:794px;--page-height:1123px;--page-margin-x:68px;--page-margin-top:76px;--page-margin-bottom:83px;--radius-sm:6px;--radius-md:10px;--radius-card:16px;--radius-pill:999px}
7
7
  .pmd-ds{margin:0;background:var(--ground);color:var(--ink);font-family:var(--font-sans);font-size:16px;line-height:1.7}
8
8
  .pmd-ds *{box-sizing:border-box}
@@ -18,6 +18,22 @@
18
18
  --cz-sans: var(--font-sans); --cz-mono: var(--font-mono);
19
19
  --cz-done: var(--blue); --cz-bubble: var(--blue-tint); --cz-solid: var(--blue); --cz-onsolid: var(--on-blue);
20
20
  }
21
+ /* Dark: cozy.css's dark block (:root[data-theme="dark"] .cz) outranks the rule above on body.cz itself, so in Dark the shared modules on the
22
+ * body read cozy's own dark colours. Before 2026-11-25 those equalled the brand's; with the neutral set they differ (two blues in one sheet).
23
+ * The same names again, one step stronger, so Dark follows the system too (initiative text-token-guard). */
24
+ :root[data-theme="dark"] body.pm-ds, :root[data-theme="dark"] body.pm-ds .cz, :root[data-theme="dark"] body.pm-ds .pm-ds,
25
+ html.dark body.pm-ds, html.dark body.pm-ds .cz, html.dark body.pm-ds .pm-ds { /* a nested pm-ds (a Dark-theme island) resolves the names again */
26
+ --cz-ink: var(--ink); --cz-ink2: var(--ink); --cz-ink3: var(--muted);
27
+ --cz-card: var(--card); --cz-well: var(--well); --cz-well2: var(--well); --cz-hair: var(--line);
28
+ --cz-blue: var(--blue); --cz-blueink: var(--blue); --cz-bluebg: var(--blue-tint);
29
+ --cz-late: var(--alert); --cz-latebg: var(--alert-tint); --cz-risk: var(--alert); --cz-riskbg: var(--alert-tint);
30
+ --cz-red: var(--alert); --cz-redbg: var(--alert-tint); --cz-ok: var(--muted); --cz-okbg: var(--well);
31
+ --cz-dot-late: var(--alert); --cz-dot-risk: var(--alert); --cz-dot-red: var(--alert); --cz-dot-ok: var(--muted); --cz-dot-q: var(--line);
32
+ --cz-ground: var(--ground);
33
+ --cz-lift: var(--lift); --cz-float: var(--lift); --cz-sheet: var(--lift); --cz-vlift: var(--raise);
34
+ --cz-sans: var(--font-sans); --cz-mono: var(--font-mono);
35
+ --cz-done: var(--blue); --cz-bubble: var(--blue-tint); --cz-solid: var(--blue); --cz-onsolid: var(--on-blue);
36
+ }
21
37
  :root body.pm-ds :focus-visible { outline: none; box-shadow: var(--glow); }
22
38
  /* the ground follows the clock (pm/day-tint.js, bet A339): after the first paint, a change of part moves slowly */
23
39
  :root[data-daytint-ease] body.pm-ds { transition: background-color var(--duration-light) var(--ease-drift); }
@@ -3,8 +3,8 @@
3
3
  * so the sheet changes nothing until a page puts the class on its root. Load brand.css, then charts.css, then the system's own sheet. */
4
4
  /* Except the type, spacing and corner tokens (--type-, --leading-, --weight-, --space-, --radius-) and the workspace's older type names that
5
5
  * point at them (--fs-*, --fw-*, --lh-*): those sit at :root, so a change to one Komorebi token reaches every page, with or without the class. */
6
- .pm-ds{--raise:0 1px 2px rgba(42,46,53,.08), 0 4px 14px -6px rgba(70,80,50,.14);--lift:0 10px 28px -10px rgba(42,46,53,.28);--glow:0 0 0 2px #5F7A45, 0 0 0 5px rgba(95,122,69,.10)}
7
- .pm-ds.dark, html.dark .pm-ds, :root[data-theme="dark"] .pm-ds{--raise:0 1px 2px rgba(0,0,0,.4), 0 4px 14px -6px rgba(169,196,140,.08);--lift:0 10px 28px -10px rgba(0,0,0,.6);--glow:0 0 0 2px #A9C48C, 0 0 0 5px rgba(169,196,140,.12)}
6
+ .pm-ds{--raise:0 1px 2px rgba(0,0,0,.06);--lift:0 1px 3px rgba(0,0,0,.08), 0 8px 24px -12px rgba(0,0,0,.12);--glow:0 0 0 2px #18181B}
7
+ .pm-ds.dark, html.dark .pm-ds, :root[data-theme="dark"] .pm-ds{--raise:0 1px 2px rgba(0,0,0,.4);--lift:0 1px 3px rgba(0,0,0,.5), 0 8px 24px -12px rgba(0,0,0,.6);--glow:0 0 0 2px #FAFAFA}
8
8
  :root{--space-4:4px;--space-8:8px;--space-12:12px;--space-16:16px;--space-24:24px;--space-32:32px;--space-48:48px;--space-64:64px;--doc-measure:640px;--page-measure:960px;--width-side:340px;--width-item:480px;--width-contents:200px;--width-margin:240px;--radius-sm:6px;--radius-md:10px;--radius-card:16px;--radius-panel:24px;--radius-pill:999px}
9
9
  :root{--type-title:26px;--leading-title:32px;--weight-title:600;--type-heading:18px;--leading-heading:24px;--weight-heading:600;--type-body:15px;--leading-body:24px;--weight-body:400;--type-small:13px;--leading-small:20px;--weight-small:400;--type-code:13px;--leading-code:20px;--weight-code:400}
10
10
  .pm-ds .title{font-family:var(--font-sans);font-size:var(--type-title);line-height:var(--leading-title);font-weight:var(--weight-title)}
@@ -1,8 +1,8 @@
1
1
  /* slides.css: PMOS Slides, from the PMOS design system family, for the workspace. GENERATED from workspace/design-system/slides/ by
2
2
  * lib/design-system.js: do not edit; change the system's files and run `node lib/design-system.js --write`. Every rule is scoped to .pms-ds,
3
3
  * so the sheet changes nothing until a page puts the class on its root. Load brand.css, then charts.css, then the system's own sheet. */
4
- .pms-ds{--glow:0 0 0 2px #5F7A45, 0 0 0 5px rgba(95,122,69,.10)}
5
- .pms-ds.dark, html.dark .pms-ds, :root[data-theme="dark"] .pms-ds{--glow:0 0 0 2px #A9C48C, 0 0 0 5px rgba(169,196,140,.12)}
4
+ .pms-ds{--glow:0 0 0 2px #18181B}
5
+ .pms-ds.dark, html.dark .pms-ds, :root[data-theme="dark"] .pms-ds{--glow:0 0 0 2px #FAFAFA}
6
6
  .pms-ds{--slide-width:1920px;--slide-height:1080px;--slide-margin-x:112px;--slide-margin-top:96px;--slide-margin-bottom:128px;--slide-column:112px;--slide-gutter:32px;--slide-gap-16:16px;--slide-gap-24:24px;--slide-gap-48:48px;--slide-gap-64:64px;--slide-radius-mark:8px;--slide-radius-box:24px;--slide-radius-pill:999px}
7
7
  .pms-ds{margin:0;background:var(--ground);color:var(--ink);font-family:var(--font-sans)}
8
8
  .pms-ds *{box-sizing:border-box}
@@ -0,0 +1,61 @@
1
+ /* pm/spec-code-drift.js — Library › Drift: "Spec and code no longer match" (initiative spec-code-drift, idea A495; board BatchCodeDS panel 16).
2
+ *
3
+ * One List block above the Library list, "This week", with "N of M specs" at the right. One row per mismatch (lib/spec-code-drift.js):
4
+ * the At risk glyph, what the spec says and what the code does now, and both dates. Each row offers two icon buttons: fix the code, or
5
+ * update the spec. Either adds a work item (a task) to the spec's initiative; the row then says so, with Undo. Zero is silence: with no
6
+ * mismatch the block is not drawn at all. It reads GET /api/spec-drift (lib/routes-spec-drift.js) and writes POST /api/spec-drift/act and
7
+ * /undo; the chat writes the same ledger with `pmos drift spec fix|update|undo`.
8
+ * blockHtml is pure (Node imports it); mount() is the browser part. */
9
+ import { stateGlyph } from './state-glyph.js';
10
+
11
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
12
+ const icon = (d) => `<svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
13
+ export const ICON = {
14
+ code: 'M14.7 6.3a4 4 0 0 0-5.4 5.4L4 17v3h3l5.3-5.3a4 4 0 0 0 5.4-5.4l-2.5 2.5-2.4-.6-.6-2.4z', // a wrench: fix the code
15
+ spec: 'M7 4h7l4 4v3M7 4v16h4M14 4v4h4M13 20v-2.5l5.5-5.5 2.5 2.5-5.5 5.5z', // a page with a pen: update the spec
16
+ undo: 'M9 14l-4-4 4-4M5 10h9a5 5 0 0 1 0 10h-3',
17
+ };
18
+ const btn = (act, label, d, row) => `<button type="button" class="pm-btn" data-sd="${act}" data-ws="${esc(row.ws)}" data-id="${esc(row.id)}" aria-label="${esc(label)}" title="${esc(label)}">${icon(d)}</button>`;
19
+
20
+ /** PURE. The block's HTML; '' when there is nothing to show (zero is silence). data: the GET answer. */
21
+ export function blockHtml(data) {
22
+ const rows = (data && data.on !== false && Array.isArray(data.rows)) ? data.rows : [];
23
+ if (!rows.length) return '';
24
+ const many = new Set(rows.map((r) => r.ws)).size > 1;
25
+ const li = rows.map((r) => {
26
+ const done = r.act ? `<span class="pm-meta">${r.act.what === 'code' ? 'Fix the code' : 'Update the spec'}: task added</span>${btn('undo', 'Undo: remove the task', ICON.undo, r)}`
27
+ : btn('code', 'Fix the code: add a task to ' + r.ini, ICON.code, r) + btn('spec', 'Update the spec: add a task to ' + r.ini, ICON.spec, r);
28
+ return `<div class="pm-li sd-row" data-ask="initiative:${esc(r.ini)}">${stateGlyph('risk', { why: 'spec and code no longer match' })}`
29
+ + `<span class="txt"><span class="t" title="${esc(r.line)}">${esc(r.line)}</span><span class="w">${esc(r.dates)}${many ? ' · ' + esc(r.product) : ''}</span></span>${done}</div>`;
30
+ }).join('');
31
+ return `<section class="pm-block list sd-blk" aria-label="Spec and code no longer match"><div class="head"><h3 class="pm-h-sm">This week</h3><span class="sp"></span>`
32
+ + `<span class="pm-meta">${esc(data.drifted)} of ${esc(data.compared)} specs</span></div><div class="rows">${li}</div></section>`;
33
+ }
34
+
35
+ /** Browser. Draws the block into #lbDrift on the Library page and handles its presses. */
36
+ export async function mount(doc = document) {
37
+ const host = doc.getElementById('lbDrift');
38
+ if (!host) return;
39
+ const { pmGet, pmPost } = await import('./http.js');
40
+ let noteUse = () => false;
41
+ try { ({ noteUse } = await import('./use-log.js')); } catch { /* the use log is optional */ }
42
+ let data = null;
43
+ const draw = () => { const h = blockHtml(data); host.innerHTML = h; host.hidden = !h; };
44
+ let tries = 0;
45
+ // a product with no result this week is read in the background: look again a little later, a few times at most
46
+ const load = async () => { const r = await pmGet('/api/spec-drift'); if (r && r.ok) { data = r; draw(); if (r.running && tries++ < 6) setTimeout(load, 20000); } };
47
+ // delegated from the document (the page's presses go there), so the buttons stay plain design-system Buttons
48
+ document.addEventListener('click', async (e) => {
49
+ const b = e.target && e.target.closest ? e.target.closest('#lbDrift button[data-sd]') : null;
50
+ if (!b || b.disabled) return;
51
+ b.disabled = true;
52
+ const act = b.dataset.sd, body = { ws: b.dataset.ws, id: b.dataset.id };
53
+ const row = data && data.rows.find((r) => r.id === body.id && r.ws === body.ws);
54
+ const r = act === 'undo' ? await pmPost('/api/spec-drift/undo', body) : await pmPost('/api/spec-drift/act', { ...body, what: act });
55
+ if (r && r.ok && row) { row.act = act === 'undo' ? null : { what: act, task: r.task && r.task.id }; noteUse(act === 'undo' ? 'specDriftUndo' : 'specDriftAct'); draw(); }
56
+ else { b.disabled = false; b.title = (r && r.error) || 'Not done'; }
57
+ });
58
+ await load();
59
+ }
60
+
61
+ if (typeof document !== 'undefined' && document.getElementById && document.getElementById('lbDrift')) mount();
@@ -37,6 +37,7 @@
37
37
  <div class="pm-row lb-find"><input class="pm-input" id="lbQ" type="search" autocomplete="off" spellcheck="false" placeholder="Find in Library" aria-label="Find in Library" /><span class="pm-kbd" aria-hidden="true">/</span></div>
38
38
  <div class="pm-row lb-fl" id="lbFilters" role="group" aria-label="Filters"></div>
39
39
  <p class="pm-meta lb-hid" id="lbHid" aria-live="polite"></p>
40
+ <div id="lbDrift" hidden></div><!-- Library › Drift: specs and code that no longer match, weekly (pm/spec-code-drift.js); not drawn when nothing differs -->
40
41
  <div class="lb-wrap">
41
42
  <div class="lb-main">
42
43
  <div id="lbBody" aria-live="polite"><div class="pm-block list lb-blk lb-sk" aria-hidden="true"><div class="rows"><i></i><i></i><i></i></div></div></div>
@@ -47,5 +48,6 @@
47
48
  </main>
48
49
  <noscript>This page needs JavaScript.</noscript>
49
50
  <script type="module" src="/pm/premium-library.js"></script>
51
+ <script type="module" src="/pm/spec-code-drift.js"></script>
50
52
  </body>
51
53
  </html>
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Compare two items side by side (initiative compare-items, done test C1-C5, N1, N2): the pure model and panel, Work's bar press, pmos compare on a scratch repository, its wiring and words. No server, browser, model or network.",
3
+ "modules": [
4
+ "compare-items.test.js"
5
+ ],
6
+ "seconds": {
7
+ "compare-items.test.js": 2
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "spec-code-drift (job #1902, A495): Library › Drift, specs and code that no longer match: the git check, the weekly route, the block and pmos drift spec. Small temp git repositories; no browser, no network.",
3
+ "modules": [
4
+ "spec-code-drift.test.js"
5
+ ],
6
+ "seconds": {
7
+ "spec-code-drift.test.js": 3
8
+ }
9
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "_comment": "text-token-guard (Wawan 2026-11-25): the neutral set is the one palette; `pmos design boards` checks and fixes canvas boards (colour tokens, literal colours, the type scale); `pmos design drift --block-text` fails a change that adds a text colour or size outside the system. Pure parts and one scratch git repository; no server, no network, no model.",
3
+ "modules": ["text-token-guard.test.js"],
4
+ "seconds": { "text-token-guard.test.js": 2 }
5
+ }