create-pmos 0.696.0 → 0.698.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 (128) hide show
  1. package/package.json +21 -27
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/design-system/ui/components/bundle.css +35 -35
  4. package/payload/design-system/ui/tokens.css +7 -6
  5. package/payload/planning/evals/eval-calibration.md +1 -1
  6. package/payload/planning/okrs/health-budgets.md +1 -1
  7. package/payload/state/discoveries.md +1 -1
  8. package/workspace/briefing-premium-insights-test.js +2 -1
  9. package/workspace/changelog.json +20 -7
  10. package/workspace/design-system/ui/components/bundle.css +35 -35
  11. package/workspace/design-system/ui/tokens.css +7 -6
  12. package/workspace/design-token-reach.js +151 -0
  13. package/workspace/guide/cli.md +16 -0
  14. package/workspace/lib/design-cli.js +14 -2
  15. package/workspace/lib/design-drift.js +2 -0
  16. package/workspace/lib/design-swap.js +146 -0
  17. package/workspace/lib/design-system.js +26 -5
  18. package/workspace/lib/premium-console-type.js +2 -1
  19. package/workspace/package-lock.json +2 -2
  20. package/workspace/package.json +1 -1
  21. package/workspace/premium-menu-rows-test.js +2 -1
  22. package/workspace/premium-vw-item-test.js +2 -0
  23. package/workspace/public/capture.html +1 -0
  24. package/workspace/public/pm/agenda-live.css +7 -7
  25. package/workspace/public/pm/bd-backlog.css +71 -71
  26. package/workspace/public/pm/bd-pin-card.css +2 -2
  27. package/workspace/public/pm/bd-pop-ds.css +1 -1
  28. package/workspace/public/pm/bd-publish.css +23 -23
  29. package/workspace/public/pm/bd-shared.css +22 -22
  30. package/workspace/public/pm/bd-work-ds.css +1 -1
  31. package/workspace/public/pm/bd-work.css +25 -25
  32. package/workspace/public/pm/c3-capture.css +3 -3
  33. package/workspace/public/pm/c3-initiatives.css +21 -21
  34. package/workspace/public/pm/components.css +585 -585
  35. package/workspace/public/pm/console3.css +305 -305
  36. package/workspace/public/pm/cozy-adler.css +6 -6
  37. package/workspace/public/pm/cozy-board.css +267 -267
  38. package/workspace/public/pm/cozy-buddy.css +1 -1
  39. package/workspace/public/pm/cozy-day-pick.css +7 -7
  40. package/workspace/public/pm/cozy-divider.css +2 -2
  41. package/workspace/public/pm/cozy-ev.css +121 -121
  42. package/workspace/public/pm/cozy-events.css +22 -22
  43. package/workspace/public/pm/cozy-goals.css +3 -3
  44. package/workspace/public/pm/cozy-home-rows.css +50 -50
  45. package/workspace/public/pm/cozy-home.css +218 -218
  46. package/workspace/public/pm/cozy-insights.css +197 -197
  47. package/workspace/public/pm/cozy-lab.css +18 -18
  48. package/workspace/public/pm/cozy-library.css +1 -1
  49. package/workspace/public/pm/cozy-live-pill.css +4 -4
  50. package/workspace/public/pm/cozy-mtg-present.css +32 -32
  51. package/workspace/public/pm/cozy-onboard.css +22 -22
  52. package/workspace/public/pm/cozy-panel.css +24 -24
  53. package/workspace/public/pm/cozy-panels.css +4 -4
  54. package/workspace/public/pm/cozy-phone-rec.css +12 -12
  55. package/workspace/public/pm/cozy-phone-settings.css +4 -4
  56. package/workspace/public/pm/cozy-pick.css +7 -7
  57. package/workspace/public/pm/cozy-pop-work.css +56 -56
  58. package/workspace/public/pm/cozy-popup.css +25 -25
  59. package/workspace/public/pm/cozy-proto.css +44 -44
  60. package/workspace/public/pm/cozy-rec-now.css +23 -23
  61. package/workspace/public/pm/cozy-rec-present.css +18 -18
  62. package/workspace/public/pm/cozy-rec-tab.css +8 -8
  63. package/workspace/public/pm/cozy-reveal.css +14 -14
  64. package/workspace/public/pm/cozy-routine.css +29 -29
  65. package/workspace/public/pm/cozy-steps.css +10 -10
  66. package/workspace/public/pm/cozy-task-pop.css +8 -8
  67. package/workspace/public/pm/cozy-today-page.css +28 -28
  68. package/workspace/public/pm/cozy-today.css +165 -165
  69. package/workspace/public/pm/cozy-viewer.css +21 -21
  70. package/workspace/public/pm/cozy-vw-mtg.css +105 -105
  71. package/workspace/public/pm/cozy-vw-rp.css +66 -66
  72. package/workspace/public/pm/cozy-vw-shell.css +42 -42
  73. package/workspace/public/pm/cozy-vw.css +90 -90
  74. package/workspace/public/pm/cozy-xv.css +8 -8
  75. package/workspace/public/pm/cozy.css +27 -31
  76. package/workspace/public/pm/dash-view.css +23 -23
  77. package/workspace/public/pm/ds-bridge.css +3 -1
  78. package/workspace/public/pm/hi-pop.css +29 -29
  79. package/workspace/public/pm/home-impact.css +10 -10
  80. package/workspace/public/pm/home-ini.css +34 -34
  81. package/workspace/public/pm/home-line.css +12 -12
  82. package/workspace/public/pm/impact.css +12 -12
  83. package/workspace/public/pm/ini-view.css +240 -240
  84. package/workspace/public/pm/intent.css +11 -11
  85. package/workspace/public/pm/komorebi.css +45 -41
  86. package/workspace/public/pm/load-shapes.css +10 -10
  87. package/workspace/public/pm/loose-props.css +17 -17
  88. package/workspace/public/pm/metric-drafts.css +10 -10
  89. package/workspace/public/pm/ms-suggest.css +12 -12
  90. package/workspace/public/pm/ov-view.css +10 -10
  91. package/workspace/public/pm/page-chat.css +1 -1
  92. package/workspace/public/pm/premium-mtg-present.js +1 -1
  93. package/workspace/public/pm/premium-vw-backlog.css +7 -8
  94. package/workspace/public/pm/premium-vw-cal.css +22 -23
  95. package/workspace/public/pm/premium-vw-copy.css +6 -7
  96. package/workspace/public/pm/premium-vw-doc.css +98 -99
  97. package/workspace/public/pm/premium-vw-guide.css +9 -10
  98. package/workspace/public/pm/premium-vw-item.css +7 -8
  99. package/workspace/public/pm/premium-vw-jira.css +28 -29
  100. package/workspace/public/pm/premium-vw-meet.css +26 -27
  101. package/workspace/public/pm/premium-vw-notepad.css +14 -15
  102. package/workspace/public/pm/premium-vw-notes.css +11 -12
  103. package/workspace/public/pm/premium-vw-rec.css +22 -23
  104. package/workspace/public/pm/premium-vw-report.css +14 -15
  105. package/workspace/public/pm/premium-vw-slides.css +27 -28
  106. package/workspace/public/pm/premium-vw-slides.js +1 -1
  107. package/workspace/public/pm/premium.css +598 -599
  108. package/workspace/public/pm/prog-order.css +7 -7
  109. package/workspace/public/pm/prog-page.css +16 -16
  110. package/workspace/public/pm/program-charter.css +23 -23
  111. package/workspace/public/pm/ready-lib.css +4 -4
  112. package/workspace/public/pm/sort-order.css +3 -3
  113. package/workspace/public/pm/split-merge.css +21 -21
  114. package/workspace/public/pm/story.css +3 -3
  115. package/workspace/public/pm/task-card.css +21 -21
  116. package/workspace/public/pm/tk-tasks.css +32 -32
  117. package/workspace/public/pm/tk-view.css +7 -7
  118. package/workspace/public/pm/wf-page.css +46 -46
  119. package/workspace/public/premium-board.html +1 -0
  120. package/workspace/public/premium-events.html +1 -0
  121. package/workspace/public/premium-goals.html +1 -0
  122. package/workspace/public/premium-intelligence.html +1 -0
  123. package/workspace/public/premium-library.html +1 -0
  124. package/workspace/public/premium-present.html +1 -0
  125. package/workspace/public/premium-routine.html +1 -0
  126. package/workspace/public/premium-viewer.html +1 -0
  127. package/workspace/test-lists/design-token-alias.json +9 -0
  128. package/workspace/test-lists/design-token-swap.json +9 -0
@@ -0,0 +1,151 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* design-token-reach.js — proof that one design token change reaches every page (initiative token-first-design-system, done test T7, T8).
4
+ * Not a suite: a look at the pages, run by hand or by the Checker. It serves the workspace, and for each page in public/*.html that loads
5
+ * stylesheets it takes a screenshot and reads every visible element's font size and colour. Then it serves a TEST COPY of a system sheet
6
+ * with one token changed and does the same again. Nothing on disk changes:
7
+ * type komorebi.css with --type-body 15px → 17px must change every page
8
+ * colour brand.css with the light --ink → a red must change every page whose body carries pm-ds (the colour tokens are scoped to it)
9
+ * A page that did not change fails the run (exit 1). Each page prints one "[token-reach]" line, and the run prints the computed type roles
10
+ * (--fs-body, --fs-meta, --fs-panel, --fs-display) of the unchanged page, which must still read 15, 13, 18 and 26 px.
11
+ * Changes also checked: --type-small, --muted (light and dark) and, since step 2 (token-swap-same-value), --space-8 must reach every page.
12
+ * OUT=<dir> where the before/after PNGs go (default: this run's state folder). PAGES=a.html,b.html only these pages.
13
+ * --same the other check: every page with each stylesheet in public/pm as on BASE_REF (default origin/main) against the files on
14
+ * disk, light and dark. A change that swaps a fixed value for a same-value token must show no difference. */
15
+ const fs = require('fs');
16
+ const path = require('path');
17
+ const { spawn } = require('child_process');
18
+ const { findBrowser } = require('./lib/find-browser');
19
+ const T = require('./test-run').configure({ name: 'design-token-reach' });
20
+ const OUT = process.env.OUT || path.join(T.STATE_DIR, 'token-reach');
21
+ const PUB = path.join(__dirname, 'public');
22
+ const read = (f) => fs.readFileSync(f, 'utf8');
23
+
24
+ const PAGES = (process.env.PAGES ? process.env.PAGES.split(',') : fs.readdirSync(PUB).filter((f) => f.endsWith('.html')))
25
+ .filter((f) => /href="\/pm\/[^"]+\.css"/.test(read(path.join(PUB, f))));
26
+ // each change is one token in a test copy of one system sheet; [from, to] pairs (a colour has a light and a dark value)
27
+ const CHANGES = [
28
+ { key: 'type-body', sheet: 'komorebi.css', pairs: [['--type-body:15px', '--type-body:17px']], kind: 'type' },
29
+ { key: 'type-small', sheet: 'komorebi.css', pairs: [['--type-small:13px', '--type-small:15px']], kind: 'type' },
30
+ { key: 'ink', sheet: 'brand.css', pairs: [['--ink:#2A2E35', '--ink:#B03020'], ['--ink:#ECEEF1', '--ink:#FF8A80']], kind: 'colour' },
31
+ { key: 'muted', sheet: 'brand.css', pairs: [['--muted:#646A74', '--muted:#B03020'], ['--muted:#9EA4AD', '--muted:#FF8A80']], kind: 'colour' },
32
+ { key: 'space-8', sheet: 'komorebi.css', pairs: [['--space-8:8px', '--space-8:14px']], kind: 'space' },
33
+ { key: 'space-4', sheet: 'komorebi.css', pairs: [['--space-4:4px', '--space-4:10px']], kind: 'space' },
34
+ { key: 'space-12', sheet: 'komorebi.css', pairs: [['--space-12:12px', '--space-12:20px']], kind: 'space' },
35
+ { key: 'radius-sm', sheet: 'komorebi.css', pairs: [['--radius-sm:6px', '--radius-sm:0px']], kind: 'corner' },
36
+ ];
37
+ const KINDS = [...new Set(CHANGES.map((c) => c.kind))];
38
+ // the kinds a page must show to pass; spacing and corners are measured and printed (step 2 moved part of them onto tokens; the values
39
+ // between two tokens still bypass them, so a page can show neither yet)
40
+ const REQUIRED = new Set((process.env.REQUIRE || 'type,colour').split(','));
41
+ // a page the server serves at another address
42
+ const URLS = { 'capture.html': '/console.html?capture=1', 'premium-present.html': '/pm/present' };
43
+ const log = (s) => console.log('[token-reach] ' + s);
44
+
45
+ /* every visible element's font size and colour, and the type roles on the body */
46
+ const sample = () => {
47
+ const out = [];
48
+ for (const el of document.querySelectorAll('body *')) {
49
+ const r = el.getBoundingClientRect();
50
+ if (!r.width || !r.height) continue;
51
+ const s = getComputedStyle(el);
52
+ out.push([s.fontSize, s.color, s.padding, s.margin, s.gap, s.borderRadius].join('|'));
53
+ }
54
+ const b = getComputedStyle(document.body);
55
+ return { els: out, pmds: document.body.classList.contains('pm-ds'), roles: ['--fs-body', '--fs-meta', '--fs-panel', '--fs-display'].map((n) => b.getPropertyValue(n).trim()) };
56
+ };
57
+
58
+ const SAME = process.argv.includes('--same');
59
+ const BASE_REF = process.env.BASE_REF || 'origin/main';
60
+
61
+ (async () => {
62
+ if (SAME) return same();
63
+ for (const c of CHANGES) for (const [from] of c.pairs) if (!read(path.join(PUB, 'pm', c.sheet)).includes(from)) { log(`${c.sheet} no longer holds "${from}": update CHANGES`); process.exit(2); }
64
+ const { chromium } = require('playwright-core');
65
+ const srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
66
+ await T.waitForServer(T.BASE);
67
+ const browser = await chromium.launch({ executablePath: findBrowser() });
68
+ fs.mkdirSync(OUT, { recursive: true });
69
+ const shoot = async (page, change) => {
70
+ const ctx = await browser.newContext({ viewport: { width: 1280, height: 800 }, colorScheme: 'light', reducedMotion: 'reduce' });
71
+ if (change) await ctx.route('**/pm/' + change.sheet + '*', (r) => r.fulfill({ contentType: 'text/css', body: change.pairs.reduce((t, [a, b]) => t.split(a).join(b), read(path.join(PUB, 'pm', change.sheet))) }));
72
+ const p = await ctx.newPage();
73
+ await p.goto(T.BASE + (URLS[page] || '/' + page), { waitUntil: 'load' }).catch(() => {});
74
+ await p.waitForTimeout(1500);
75
+ const s = await p.evaluate(sample);
76
+ const png = await p.screenshot({ fullPage: true });
77
+ await ctx.close();
78
+ return { ...s, png };
79
+ };
80
+ const misses = [], unreached = [];
81
+ const roleLines = [];
82
+ for (const page of PAGES) {
83
+ const base = await shoot(page, null);
84
+ const again = await shoot(page, null); // the same page twice: if it differs by itself, a changed screenshot proves nothing
85
+ const steady = Buffer.compare(base.png, again.png) === 0;
86
+ fs.writeFileSync(path.join(OUT, page.replace('.html', '') + '-before.png'), base.png);
87
+ roleLines.push(`${page}: ${base.roles.join(' / ')}`);
88
+ const parts = [], hit = Object.fromEntries(KINDS.map((k) => [k, false]));
89
+ for (const c of CHANGES) {
90
+ const after = await shoot(page, c);
91
+ fs.writeFileSync(path.join(OUT, page.replace('.html', '') + '-' + c.key + '.png'), after.png);
92
+ const shot = Buffer.compare(base.png, after.png) !== 0;
93
+ const n = base.els.filter((v, i) => after.els[i] !== undefined && after.els[i] !== v).length;
94
+ const reached = shot && n > 0; // the screenshot changed AND at least one element's size or colour changed
95
+ if (reached) hit[c.kind] = true;
96
+ parts.push(`${c.key} ${reached ? 'yes' : 'no'} (${n})`);
97
+ }
98
+ for (const k of KINDS) if (!hit[k] && REQUIRED.has(k)) misses.push(`${page} ${k}`);
99
+ for (const k of KINDS) if (!hit[k] && !REQUIRED.has(k)) unreached.push(`${page} ${k}`);
100
+ log(`${page}${steady ? '' : ' (moves by itself)'} · ${KINDS.map((k) => `${k} ${hit[k] ? 'reached' : 'NOT reached'}`).join(' · ')} · ${parts.join(', ')}`);
101
+ }
102
+ console.log('\ntype roles on each page before the change (--fs-body / --fs-meta / --fs-panel / --fs-display):\n ' + roleLines.join('\n '));
103
+ const wrongRoles = roleLines.filter((l) => !l.endsWith('15px / 13px / 18px / 26px'));
104
+ if (wrongRoles.length) misses.push('type roles not 15/13/18/26 px on ' + wrongRoles.length + ' page(s)');
105
+ log(`${PAGES.length - new Set(misses.map((m) => m.split(' ')[0])).size} of ${PAGES.length} pages reached · screenshots in ${OUT}`);
106
+ if (misses.length) log('NOT reached: ' + misses.join(', '));
107
+ if (unreached.length) log('measured, not required (REQUIRE=…): not reached on ' + unreached.join(', '));
108
+ await browser.close(); srv.kill('SIGKILL'); T.killTmux && T.killTmux();
109
+ process.exit(misses.length ? 1 : 0);
110
+ })().catch((e) => { console.error(e); process.exit(2); });
111
+
112
+ /* --same: every page with each stylesheet in public/pm as on BASE_REF, against the files on disk, in light and dark. A change that only swaps
113
+ * a fixed value for a token of the same value must show no difference: not in the screenshot, not in any element's size, colour, spacing
114
+ * or corners. (token-swap-same-value, done test W6) */
115
+ async function same() {
116
+ const { execFileSync } = require('child_process');
117
+ const old = (f) => { try { return execFileSync('git', ['show', `${BASE_REF}:workspace/public/pm/${f}`], { cwd: __dirname, encoding: 'utf8', maxBuffer: 1 << 26, stdio: ['ignore', 'pipe', 'ignore'] }); } catch { return null; } };
118
+ const { chromium } = require('playwright-core');
119
+ const srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
120
+ await T.waitForServer(T.BASE);
121
+ const browser = await chromium.launch({ executablePath: findBrowser() });
122
+ fs.mkdirSync(OUT, { recursive: true });
123
+ const shoot = async (page, scheme, base) => {
124
+ const ctx = await browser.newContext({ viewport: { width: 1280, height: 800 }, colorScheme: scheme, reducedMotion: 'reduce' });
125
+ if (base) await ctx.route(/\/pm\/[^/?]+\.css(\?.*)?$/, (r) => { const f = new URL(r.request().url()).pathname.split('/').pop(); const t = old(f); return t == null ? r.continue() : r.fulfill({ contentType: 'text/css', body: t }); });
126
+ const p = await ctx.newPage();
127
+ await p.goto(T.BASE + (URLS[page] || '/' + page), { waitUntil: 'load' }).catch(() => {});
128
+ await p.waitForTimeout(1500);
129
+ const s = await p.evaluate(sample);
130
+ const png = await p.screenshot({ fullPage: true });
131
+ await ctx.close();
132
+ return { ...s, png };
133
+ };
134
+ const diff = [];
135
+ for (const page of PAGES) for (const scheme of ['light', 'dark']) for (let attempt = 1; attempt <= 2; attempt++) {
136
+ // a difference must show twice: a page that drew while its data was still arriving differs once by timing, not by the change
137
+ const a = await shoot(page, scheme, true), b = await shoot(page, scheme, false);
138
+ const n = a.els.filter((v, i) => b.els[i] !== v).length + Math.abs(a.els.length - b.els.length);
139
+ const shot = Buffer.compare(a.png, b.png) !== 0;
140
+ let moves = false;
141
+ if (shot && !n) { const a2 = await shoot(page, scheme, true); moves = Buffer.compare(a.png, a2.png) !== 0; } // a page that moves by itself
142
+ const differs = n > 0 || (shot && !moves);
143
+ if (differs && attempt === 1) continue;
144
+ if (differs) { diff.push(`${page} ${scheme}`); fs.writeFileSync(path.join(OUT, `${page.replace('.html', '')}-${scheme}-base.png`), a.png); fs.writeFileSync(path.join(OUT, `${page.replace('.html', '')}-${scheme}-now.png`), b.png); }
145
+ log(`${page} ${scheme} · ${differs ? `DIFFERS (${n} elements${shot ? ', screenshot' : ''})` : `same${moves ? ' (moves by itself; every element the same)' : ''}${attempt > 1 ? ' (second try)' : ''}`}`);
146
+ break;
147
+ }
148
+ log(`${diff.length} of ${PAGES.length * 2} page views differ from ${BASE_REF}${diff.length ? ': ' + diff.join(', ') : ''}`);
149
+ await browser.close(); srv.kill('SIGKILL'); T.killTmux && T.killTmux();
150
+ process.exit(diff.length ? 1 : 0);
151
+ }
@@ -350,6 +350,22 @@ The aim: change one token and every page follows. Each place this command counts
350
350
  - `--pages` shows the older measure instead: for each page, the share of its classes that the system defines and its own CSS rules.
351
351
  - A product sets the files to count and its system sheets in `design-drift.json` in its design-system folder, for example `{ "scan": ["web/**/*.css"], "systemSheets": ["ds.css"] }`.
352
352
 
353
+ ### One token, every page
354
+
355
+ The design system's own sheet (Komorebi, `komorebi.css`) is the only place the text sizes are written. Its type styles are tokens: `--type-title`, `--type-heading`, `--type-body`, `--type-small` and `--type-code`, each with a `--leading-` and a `--weight-` token. The older names that pages use (`--fs-body`, `--fs-meta` and the other `--fs-*` roles, `--fw-regular`, `--fw-strong`) point at them. Every page loads the colour bridge (`ds-bridge.css`), so the older `--cz-*` colours point at the system's colours.
356
+
357
+ To change a text size on every page, change the style in `workspace/design-system/ui/tokens.json` and run `node lib/design-system.js --write`. Do not write a `--fs-*` value in a page's stylesheet.
358
+
359
+ ### pmos design swap: a fixed value becomes the token with the same value
360
+
361
+ - `pmos design swap` counts, for each stylesheet, the fixed spacing (padding, margin, gap) and corner values that equal a design token. It also counts the values that sit between two tokens. It changes no file.
362
+ - `pmos design swap --write` replaces each of those values with its token, for example `padding: 8px 12px` with `padding: var(--space-8) var(--space-12)`. Nothing on screen moves, because the token has the same value. After that, a change to the token reaches every place that reads it.
363
+ - It does not change a value between two tokens. That is a decision for a person. It does not change the system's own sheets, scripts, HTML, a custom property, a `var()` fallback, `@keyframes` or the scaled slide and report canvases.
364
+ - When two system sheets have a token with the same value, a token at `:root` wins, then the later sheet. So the UI system's own token wins over a chart token.
365
+ - A product sets its files in `design-drift.json`. `swapIgnore` names sheets that draw in a frame without the system's sheets.
366
+
367
+ To see that a change reaches every page, run `node design-token-reach.js` in `workspace/`. It changes one token in a test copy of the system's sheets, takes a screenshot of each page before and after, and names each page the change did not reach. It changes no file.
368
+
353
369
  ### pmos pages: fix a page before you add to it
354
370
 
355
371
  A page that keeps breaking should get fixed before it gets a new feature. This command shows which pages keep breaking.
@@ -14,13 +14,16 @@
14
14
  * --github print each new bypass as a GitHub warning on its file and line (the CI step uses it)
15
15
  * --pages the older view instead: each page's share of system classes and its own CSS (a measure only)
16
16
  *
17
- * Run it in the product's repository. It reads git only and changes nothing else. Exit codes: 0 done, 1 a count rose (only with --gate) or
17
+ * pmos design swap [--write] (initiative token-swap-same-value, lib/design-swap.js) each fixed spacing or corner value in a scanned
18
+ * stylesheet that equals a design token: counted per file, or with --write replaced by that token. Nothing on screen moves.
19
+ *
20
+ * Run it in the product's repository. drift reads git only and changes nothing else. Exit codes: 0 done, 1 a count rose (only with --gate) or
18
21
  * the refs cannot be read, 2 usage. */
19
22
  const fs = require('fs');
20
23
  const path = require('path');
21
24
  const D = require('./design-drift.js');
22
25
 
23
- const COMMANDS = { design: ['drift'] };
26
+ const COMMANDS = { design: ['drift', 'swap'] };
24
27
  const USAGE = [
25
28
  'usage: pmos design drift — every place your styles and scripts do not read a design token, and which ones a change adds',
26
29
  ' pmos design drift [--ref <ref>] [--base <ref>|week] [--weeks <n>] [--json] [--write] [--gate] [--github] [--pages]',
@@ -32,6 +35,7 @@ const USAGE = [
32
35
  ' --github print each new bypass as a GitHub warning on its line',
33
36
  ' --pages each page\'s share of system classes instead (a measure only)',
34
37
  'It reads git only. A product sets its files and system sheets in design-drift.json in its design-system folder.',
38
+ ' pmos design swap [--write] each fixed spacing or corner value that equals a design token: counted, or with --write replaced by the token',
35
39
  ];
36
40
  const FLAGS = new Set(['ref', 'base', 'weeks', 'json', 'write', 'gate', 'repo', 'github', 'pages']);
37
41
  const BOOL = new Set(['json', 'write', 'gate', 'github', 'pages']);
@@ -60,6 +64,14 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), now
60
64
  if (!sub || ['help', '--help', '-h'].includes(sub)) { for (const l of USAGE) say(l); return sub ? 0 : 2; }
61
65
  if (!COMMANDS.design.includes(sub)) { say(`unknown design command "${sub}". Use one of: ${COMMANDS.design.join(', ')}`); return 2; }
62
66
  const { pos, flags } = parse(args.slice(1));
67
+ if (sub === 'swap') {
68
+ const bad = Object.keys(flags).filter((k) => k !== 'write' && k !== 'repo');
69
+ if (pos.length || bad.length) { say('✗ usage: pmos design swap [--write]'); return 2; }
70
+ const root = repoRoot(flags.repo ? path.resolve(cwd, flags.repo) : cwd);
71
+ if (!root) { say('✗ this is not a git repository. Run pmos design swap in your product\'s repository.'); return 1; }
72
+ require('./design-swap.js').run({ root, write: !!flags.write, say });
73
+ return 0;
74
+ }
63
75
  if (pos.length) { say(`✗ pmos design ${sub} takes no argument`); return 2; }
64
76
  for (const k of Object.keys(flags)) if (!FLAGS.has(k)) { say(`✗ --${k} is not an option of pmos design drift`); return 2; }
65
77
  for (const k of ['ref', 'base', 'weeks', 'repo']) if (k in flags && !flags[k]) { say(`✗ --${k} needs a value`); return 2; }
@@ -47,6 +47,8 @@ const DEFAULTS = Object.freeze({
47
47
  scan: ['workspace/public/**/*.css', 'workspace/public/**/*.js', 'workspace/public/**/*.html'],
48
48
  ignore: ['workspace/public/vendor/**'],
49
49
  systemScripts: ['komorebi.js'],
50
+ // `pmos design swap` (token-swap-same-value) leaves these sheets alone: they draw in a frame that does not load the system's sheets
51
+ swapIgnore: ['workspace/public/pm/tokens.css', 'workspace/public/pm/premium-report-*.css'],
50
52
  });
51
53
  const CONFIG_PLACES = ['pmos/design-system/design-drift.json', 'design-system/design-drift.json', 'workspace/design-system/design-drift.json'];
52
54
  const REBUILT_SHARE = 0.10;
@@ -0,0 +1,146 @@
1
+ 'use strict';
2
+ /* design-swap.js — swap a fixed spacing or corner value for the design token with the same value (initiative token-swap-same-value,
3
+ * token-first design system step 2). Wawan, 2026-11-22: every part of every page reads the design system's tokens, so that changing one
4
+ * token changes every page. The token guard (lib/design-drift.js, `pmos design drift`) counts the places that skip a token; this rewrites
5
+ * the ones where a token has EXACTLY the value written, so nothing on screen moves.
6
+ *
7
+ * What it swaps: lengths in padding, margin, gap and border-radius declarations (each length of a shorthand on its own; px, and rem at
8
+ * 16 px). A length with no same-value token stays and is listed (`left`): a value between two tokens is a decision, never a guess.
9
+ * What it never touches: custom property definitions, a value inside var(--x, fallback), @keyframes, the scaled canvases (slides, report
10
+ * cards, the presented page, the diagram labels: their sizes follow the canvas, not the UI), the system's own sheets, scripts and HTML.
11
+ * Which token: from the system sheets (the product's design-drift config). A token declared at :root wins over a scoped one (it works on
12
+ * every page); then the later sheet wins, so the UI system's own sheet beats brand and charts (10px → --radius-md, not --radius-lane).
13
+ *
14
+ * swap(css, tokens) PURE → { css, n, left: [{ line, prop, value }] } · tokensFrom(sheetTexts) PURE → Map value(px) → { spacing, corner }
15
+ * run({ root, write, say }) → { files: [{ file, n, left }], total } — `pmos design swap [--write]` (lib/design-cli.js)
16
+ */
17
+ const fs = require('fs');
18
+ const path = require('path');
19
+ const DD = require('./design-drift.js');
20
+
21
+ const SPACE_PROP = /^(?:(?:padding|margin)(?:-(?:top|right|bottom|left|inline|block)(?:-(?:start|end))?)?|(?:row-|column-)?gap)$/;
22
+ const RADIUS_PROP = /^border(?:-[a-z]+)*-radius$/;
23
+ const FAMILY = { spacing: /^--space-/, corner: /^--radius-/ };
24
+ // the scaled canvases (conformance-gate.js SCALED_CANVAS, and the report slide): their lengths are canvas units
25
+ const CANVAS = /(?:^|[\s>+~,(])\.(?:sl-(?:cv|tx|it|lab|axl|ph)|r-(?:title|heading|small|kicker|big|quote)|vzx-page|vz-(?:words|tfig|th)|rds|rsm|rp-slide|tg-clu|tg-tmc|iv-tlm|pc-(?:flow|lanes|sn|dn|e|ln|bx))\b/;
26
+ const LENGTH = /(?<![\w.#/-])(-?\d*\.?\d+)(px|rem)\b/g;
27
+ const log = (s) => `[token-swap] ${s}`;
28
+
29
+ /** PURE. The system's spacing and corner tokens: px value → { spacing: name, corner: name }. */
30
+ function tokensFrom(sheets) {
31
+ const best = { spacing: new Map(), corner: new Map() }; // px → { name, root, order }
32
+ sheets.forEach((css, order) => {
33
+ const src = String(css || '').replace(/\/\*[\s\S]*?\*\//g, '');
34
+ for (const m of src.matchAll(/([^{}]*)\{([^{}]*)\}/g)) {
35
+ const root = m[1].split(',').some((x) => /^:root\b/.test(x.trim()));
36
+ for (const d of m[2].matchAll(/(--[a-z0-9-]+)\s*:\s*([^;]+)/g)) {
37
+ const v = /^(\d*\.?\d+)(px|rem)$/.exec(d[2].trim()); if (!v) continue;
38
+ const px = v[2] === 'px' ? Number(v[1]) : Number(v[1]) * 16;
39
+ for (const k of Object.keys(FAMILY)) {
40
+ if (!FAMILY[k].test(d[1])) continue;
41
+ const cur = best[k].get(px), cand = { name: d[1], root, order };
42
+ if (!cur || (cand.root && !cur.root) || (cand.root === cur.root && cand.order >= cur.order)) best[k].set(px, cand);
43
+ }
44
+ }
45
+ }
46
+ });
47
+ return { spacing: new Map([...best.spacing].map(([px, t]) => [px, t.name])), corner: new Map([...best.corner].map(([px, t]) => [px, t.name])) };
48
+ }
49
+
50
+ /** One declaration value with each same-value length swapped. → { value, n, left: [length] } */
51
+ function swapValue(value, map) {
52
+ let n = 0; const left = [];
53
+ // a var(…) call is a token already: keep it whole (its fallback included)
54
+ const parts = []; let rest = value;
55
+ while (rest.length) {
56
+ const i = rest.indexOf('var(');
57
+ if (i < 0) { parts.push([rest, false]); break; }
58
+ parts.push([rest.slice(0, i), false]);
59
+ let depth = 0, j = i + 3;
60
+ for (; j < rest.length; j++) { if (rest[j] === '(') depth++; else if (rest[j] === ')' && --depth === 0) break; }
61
+ parts.push([rest.slice(i, j + 1), true]); rest = rest.slice(j + 1);
62
+ }
63
+ const out = parts.map(([t, keep]) => (keep ? t : t.replace(LENGTH, (m, num, unit) => {
64
+ const px = unit === 'px' ? Number(num) : Number(num) * 16;
65
+ if (px === 0) return m;
66
+ const name = map.get(Math.abs(px));
67
+ if (!name) { left.push(m); return m; }
68
+ n++;
69
+ return px < 0 ? `calc(-1 * var(${name}))` : `var(${name})`;
70
+ }))).join('');
71
+ return { value: out, n, left };
72
+ }
73
+
74
+ /** PURE. Swap a stylesheet. Comments, @keyframes, custom properties and canvas rules stay as written. */
75
+ function swap(css, tokens) {
76
+ const src = String(css || '');
77
+ let out = '', n = 0, i = 0, line = 1;
78
+ const left = [];
79
+ const stack = []; // selector or at-rule prelude of each open block
80
+ let buf = '';
81
+ const skipBlock = () => stack.some((s) => /^@keyframes|^@-webkit-keyframes/.test(s) || CANVAS.test(' ' + s));
82
+ const flushDecl = (text) => {
83
+ // text: one declaration with its leading whitespace, no ';' or '}'
84
+ const m = /^(\s*)([a-z-]+)(\s*:\s*)([\s\S]*?)(\s*)$/.exec(text);
85
+ if (!m || skipBlock() || !stack.length) return text;
86
+ const prop = m[2];
87
+ const kind = SPACE_PROP.test(prop) ? 'spacing' : RADIUS_PROP.test(prop) ? 'corner' : null;
88
+ if (!kind) return text;
89
+ const r = swapValue(m[4], tokens[kind]);
90
+ n += r.n;
91
+ for (const v of r.left) left.push({ line, prop, value: v });
92
+ return m[1] + prop + m[3] + r.value + m[5];
93
+ };
94
+ while (i < src.length) {
95
+ const ch = src[i];
96
+ if (ch === '/' && src[i + 1] === '*') { const e = src.indexOf('*/', i + 2); const end = e < 0 ? src.length : e + 2; const c = src.slice(i, end); buf += c; line += (c.match(/\n/g) || []).length; i = end; continue; }
97
+ if (ch === '"' || ch === "'") { const e = src.indexOf(ch, i + 1); const end = e < 0 ? src.length : e + 1; buf += src.slice(i, end); i = end; continue; }
98
+ if (ch === '{') { stack.push(buf.replace(/\/\*[\s\S]*?\*\//g, '').trim()); out += buf + ch; buf = ''; i++; continue; }
99
+ if (ch === ';' || ch === '}') {
100
+ out += flushDecl(buf) + ch; buf = '';
101
+ if (ch === '}') stack.pop();
102
+ i++; continue;
103
+ }
104
+ if (ch === '\n') line++;
105
+ buf += ch; i++;
106
+ }
107
+ out += buf;
108
+ return { css: out, n, left };
109
+ }
110
+
111
+ /** Walk a folder for files (skips node_modules and .git). */
112
+ function walk(root, rel = '', acc = []) {
113
+ for (const e of fs.readdirSync(path.join(root, rel), { withFileTypes: true })) {
114
+ if (e.name === 'node_modules' || e.name === '.git') continue;
115
+ const p = rel ? rel + '/' + e.name : e.name;
116
+ if (e.isDirectory()) walk(root, p, acc); else acc.push(p);
117
+ }
118
+ return acc;
119
+ }
120
+
121
+ /** `pmos design swap [--write]`: every scanned stylesheet of the product at root, from its design-drift config. */
122
+ function run({ root = process.cwd(), write = false, say = (s) => console.log(s) } = {}) {
123
+ const read = (p) => { try { return fs.readFileSync(path.join(root, p), 'utf8'); } catch { return null; } };
124
+ const cfg = DD.configAt(read);
125
+ const files = walk(root).filter((p) => /\.css$/i.test(p));
126
+ const isSystem = (p) => (cfg.systemSheets || []).some((n) => p === n || p.endsWith('/' + n));
127
+ const sysSheets = files.filter(isSystem).sort((a, b) => cfg.systemSheets.findIndex((n) => a.endsWith(n)) - cfg.systemSheets.findIndex((n) => b.endsWith(n)));
128
+ const tokens = tokensFrom(sysSheets.map(read));
129
+ const scan = (cfg.scan || []).map(DD.globRe), ignore = [...(cfg.ignore || []), ...(cfg.swapIgnore || [])].map(DD.globRe);
130
+ const targets = files.filter((p) => !isSystem(p) && scan.some((re) => re.test(p)) && !ignore.some((re) => re.test(p))).sort();
131
+ const out = []; let total = 0, leftTotal = 0;
132
+ for (const f of targets) {
133
+ const text = read(f);
134
+ const r = swap(text, tokens);
135
+ if (!r.n && !r.left.length) continue;
136
+ out.push({ file: f, n: r.n, left: r.left });
137
+ total += r.n; leftTotal += r.left.length;
138
+ if (r.n) say(log(`${f}: ${r.n} ${write ? 'swapped' : 'to swap'}${r.left.length ? `, ${r.left.length} between two tokens` : ''}`));
139
+ if (write && r.n) fs.writeFileSync(path.join(root, f), r.css);
140
+ }
141
+ say(log(`${write ? 'swapped' : 'same-value swaps'} ${total} in ${out.filter((x) => x.n).length} stylesheets; ${leftTotal} lengths sit between two tokens and stay`));
142
+ say(String(total));
143
+ return { files: out, total, left: leftTotal };
144
+ }
145
+
146
+ module.exports = { swap, swapValue, tokensFrom, run, CANVAS };
@@ -100,6 +100,10 @@ function tokensOf(json) {
100
100
  }
101
101
 
102
102
  // a token can name another one: "{blue}" is the brand's blue, so the chart role follows the brand in both themes
103
+ // the UI system's unscoped token blocks (type, spacing, corners): written at :root in the workspace sheet too (not scoped to .pm-ds), so a
104
+ // page without pm-ds and the older names that alias them (LEGACY_TYPE) resolve them everywhere. No other sheet declares these names, so
105
+ // declaring them on every page changes no rule.
106
+ const TYPE_ROOT = ':root:where(*)';
103
107
  const valueOf = (v) => String(v).replace(/\{([a-z0-9-]+)\}/g, 'var(--$1)');
104
108
  /** PURE. A system's tokens.json → its tokens.css: the themed tokens (light, then dark), the rest, and (ui only) the type classes. */
105
109
  function tokensCss(json, name) {
@@ -117,11 +121,15 @@ function tokensCss(json, name) {
117
121
  const L = [`/* ${(SYSTEMS[name] || {}).title || name} tokens. GENERATED from tokens.json by lib/design-system.js: do not edit; run \`node lib/design-system.js --write\`. */`];
118
122
  if (light.length) L.push(`:root, [data-theme="light"] {${light.join(';')}}`);
119
123
  if (dark.length) L.push(`[data-theme="dark"] {${dark.join(';')}}`);
120
- if (rest.length) L.push(`:root {${rest.join(';')}}`);
124
+ // the UI system's spacing and corners sit at :root in the workspace sheet too (token-swap-same-value): a page sheet that reads them works
125
+ // on every page, with or without pm-ds
126
+ if (rest.length) L.push(`${(SYSTEMS[name] || {}).types ? TYPE_ROOT : ':root'} {${rest.join(';')}}`);
121
127
  if ((SYSTEMS[name] || {}).types) {
122
- for (const g of ((json && json.type) || {}).groups || []) {
123
- for (const st of g.styles || []) L.push(`.${st.name}{font-family:var(--font-${st.family || g.family || 'sans'});font-size:${st.fontSize};line-height:${st.lineHeight};font-weight:${st.fontWeight}}`);
124
- }
128
+ // the type styles are tokens (--type-, --leading-, --weight-<style>), and the type classes read them: a change to one style's size in
129
+ // tokens.json reaches every class and part that names it (initiative token-first-design-system)
130
+ const styles = (((json && json.type) || {}).groups || []).flatMap((g) => (g.styles || []).map((st) => ({ ...st, family: st.family || g.family || 'sans' })));
131
+ if (styles.length) L.push(`${TYPE_ROOT} {${styles.map((st) => `--type-${st.name}:${st.fontSize};--leading-${st.name}:${st.lineHeight};--weight-${st.name}:${st.fontWeight}`).join(';')}}`);
132
+ for (const st of styles) L.push(`.${st.name}{font-family:var(--font-${st.family});font-size:var(--type-${st.name});line-height:var(--leading-${st.name});font-weight:var(--weight-${st.name})}`);
125
133
  }
126
134
  return L.join('\n') + '\n';
127
135
  }
@@ -175,6 +183,17 @@ const UI_GLUE = [
175
183
  `${SCOPE} .pm-chart-head:empty{display:none}`,
176
184
  ];
177
185
 
186
+ /* The workspace's older type names, pointed at Komorebi once, here (initiative token-first-design-system). The 16 stylesheets that
187
+ * wrote them again are gone, so a change to a Komorebi type token reaches every page. The values are the ones they had: 26, 18, 15, 13 px
188
+ * and 400 / 600. --fs-field is not a role (a phone zooms into a field under 16 px) and the line heights are the roles' own densities. */
189
+ const LEGACY_TYPE = ':root{' + [
190
+ '--fw-regular:var(--weight-body)', '--fw-strong:var(--weight-heading)', '--fs-field:16px',
191
+ '--fs-display:var(--type-title)', '--fs-page:var(--type-title)', '--fs-panel:var(--type-heading)',
192
+ '--fs-section:var(--type-body)', '--fs-row:var(--type-body)', '--fs-body:var(--type-body)',
193
+ '--fs-meta:var(--type-small)', '--fs-label:var(--type-small)', '--fs-badge:var(--type-small)',
194
+ '--lh-display:1.2', '--lh-page:1.2', '--lh-panel:1.3', '--lh-section:1.35', '--lh-row:1.4', '--lh-body:1.6', '--lh-meta:1.5', '--lh-label:1.35', '--lh-badge:1.2',
195
+ ].join(';') + '}';
196
+
178
197
  /** PURE. One system's workspace sheet from its tokens.css and components/bundle.css. */
179
198
  function sheetOf(name, tokens, bundle) {
180
199
  const sys = SYSTEMS[name];
@@ -183,6 +202,7 @@ function sheetOf(name, tokens, bundle) {
183
202
  ` * 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 ${sys.scope},`,
184
203
  ' * 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. */',
185
204
  ];
205
+ if (sys.types) L.push('/* Except the type, spacing and corner tokens (--type-, --leading-, --weight-, --space-, --radius-) and the workspace\'s older type names that\n * 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. */');
186
206
  if (name === 'brand') L.push(...FONTS);
187
207
  // brand and charts sit inside another system's page: their own page-level rules (body, the preview root) are that system's job
188
208
  const shared = sys.scope === FAMILY;
@@ -201,12 +221,13 @@ function sheetOf(name, tokens, bundle) {
201
221
  if (/^@keyframes/.test(p.sel)) { L.push(`${indent}${p.sel}{${p.body.replace(/\s+/g, ' ')}}`); continue; }
202
222
  // a preview wrapper's own layout (padding, a column of cards) is for the system's previews, not for a workspace page
203
223
  if ((sys.roots || []).includes(p.sel) && /padding/.test(p.body)) continue;
224
+ if (p.sel === TYPE_ROOT) { L.push(`${indent}:root{${p.body}}`); continue; }
204
225
  L.push(`${indent}${scopeList(p.sel, sys)}{${p.body}}`);
205
226
  }
206
227
  };
207
228
  emit(pieces(dropImports(tokens)), '', false);
208
229
  emit(pieces(dropImports(bundle)), '', true);
209
- if (name === 'ui') L.push(...UI_GLUE);
230
+ if (name === 'ui') L.push(...UI_GLUE, LEGACY_TYPE);
210
231
  return L.join('\n') + '\n';
211
232
  }
212
233
 
@@ -8,6 +8,8 @@
8
8
  * transform(css) maps a premium stylesheet onto the console's type and changes nothing else: every font size goes to the nearest console
9
9
  * step, every heavy weight to 600 (550 to 500), the two font families to the console's, and the body line height to 1.5. It is idempotent,
10
10
  * so a stylesheet already on console type comes back unchanged (premium-console-type.test.js holds the committed stylesheets to that).
11
+ * It no longer writes the role tokens into the stylesheet: they come from the design system, once, at :root in komorebi.css
12
+ * (initiative token-first-design-system). FS is the same values, for a caller that draws without komorebi.css.
11
13
  * The browser suites also run it over the mockup before they compare computed styles, so the mockup stays the reference for the look and
12
14
  * the console is the reference for the type. */
13
15
 
@@ -53,7 +55,6 @@ function transform(css, { base = '/vendor/', faces = true } = {}) {
53
55
  .replace(/(\bbody\{[^}]*?)line-height:1\.45/g, '$1line-height:1.5')
54
56
  .replace(/(\.brief\{[^}]*?)max-width:42ch/g, '$1max-width:64ch')
55
57
  .replace(/\u0000(\d+)\u0000/g, (m, k) => kept[+k]);
56
- if (!/--fs-body:/.test(out)) out = ':root{' + FS + '}\n' + out;
57
58
  if (faces && !/space-grotesk-var\.woff2/.test(out)) out = fontFaces(base) + out;
58
59
  return out;
59
60
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.696.0",
3
+ "version": "0.698.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.696.0",
9
+ "version": "0.698.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.696.0",
3
+ "version": "0.698.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",
@@ -16,7 +16,8 @@ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); c
16
16
  const PUB = path.join(__dirname, 'public');
17
17
  const ORIGIN = 'http://pmos-menus.test';
18
18
  const TYPES = { '.css': 'text/css', '.woff2': 'font/woff2', '.html': 'text/html', '.svg': 'image/svg+xml' };
19
- const SHEETS = ['pm/premium.css', 'pm/premium-vw-doc.css', 'pm/premium-vw-rec.css'];
19
+ // komorebi.css first, as every page loads it: the type roles (--fs-*) come from it since token-first-design-system
20
+ const SHEETS = ['pm/komorebi.css', 'pm/premium.css', 'pm/premium-vw-doc.css', 'pm/premium-vw-rec.css'];
20
21
 
21
22
  const LONG = ['Migration off Okta (tender, award, migration), incl. the Okta CIS renewal runway', 'Inline login for eShop onsite checkout',
22
23
  'MAGW migration to auth-service (Java to Go) — Phase 1 and Phase 2', 'Email OTP'];
@@ -52,6 +52,8 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
52
52
  await page.route('**/api/briefing-premium/**', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, turns: [], working: false }) }));
53
53
  await page.goto(BASE + '/today.html?ini=self-serve-v2&ws=w1&board=w1&theme=' + theme);
54
54
  S.up = await until(() => page.evaluate(() => !!document.querySelector('#czViewer .iv-mc') && !!window.__premiumWorkItem), 20000);
55
+ // When Home does not come up, say what the page holds instead, so a CI-only failure can be read from the log.
56
+ if (!S.up) console.log(' (R9 not up: ' + JSON.stringify(await page.evaluate(() => { const v = document.querySelector('#czViewer'); return { url: location.pathname + location.search, viewer: v ? { hidden: v.hidden, w: v.getBoundingClientRect().width, cls: v.className, html: v.innerHTML.replace(/\s+/g, ' ').slice(0, 300) } : null, item: !!window.__premiumWorkItem, body: document.body.className, fs: getComputedStyle(document.documentElement).getPropertyValue('--fs-body') }; }).catch((e) => String(e))) + ' errors ' + JSON.stringify(S.errors.slice(0, 3)) + ' gets ' + S.gets.length + ')');
55
57
  return { page, ctx, S };
56
58
  };
57
59
  const viaMore = async (pg, label) => { const it = (l) => `#czViewer .cz-vw-menu [role="menuitem"]:has(> span:first-child:text-is("${l}"))`, more = async () => { await pg.click('#czViewer:not([hidden]) [data-cz-vw="more"]'); await until(() => pg.evaluate(() => !!document.querySelector('#czViewer .cz-vw-menu'))); }, view = (v) => until(() => pg.evaluate((x) => !!document.querySelector(`#czViewer:not([hidden]) [data-hi-v="${x}"]`), v)); if ((await pg.$('#czViewer:not([hidden]) [data-hi-v="page"]')) && (await pg.$('#czViewer:not([hidden]) [data-iv-docs]')) && !['Split into a new initiative', 'Merge into', 'Program', 'Open on the Board', 'Copy', 'The record', 'Delete'].includes(label)) { await pg.click('#czViewer:not([hidden]) [data-iv-docs]'); await view('docs'); if (label === 'Documents') return; } await more(); for (let i = 0; i < 20 && !(await pg.$(it(label))) && !(await pg.$(it('Stage'))); i++) { await pg.keyboard.press('Escape'); await pg.waitForTimeout(250); await more(); } if (!(await pg.$(it(label))) && (await pg.$(it('Stage')))) { await pg.click(it('Stage')); await view('stage'); if (label === 'Stage') return; await more(); } await pg.click(it(label)); }; // batch 16 item 5c: the page's ⋯ is short; Documents opens from its fold, and the Documents view's ⋯ holds Stage, whose ⋯ holds Documents, Open the full record and Sprint
@@ -12,6 +12,7 @@
12
12
  <link rel="stylesheet" href="/pm/brand.css" />
13
13
  <link rel="stylesheet" href="/pm/charts.css" />
14
14
  <link rel="stylesheet" href="/pm/komorebi.css" />
15
+ <link rel="stylesheet" href="/pm/ds-bridge.css" />
15
16
  <link rel="stylesheet" href="/pm/c3-capture.css" />
16
17
  </head>
17
18
  <body class="pm-ds cap-page">
@@ -1,17 +1,17 @@
1
1
  /* pm/agenda-live.css — the agenda in 3 to 5 topics (pm/agenda-live.js; boards MgD and MgRD, initiative live-agenda-topics). Cozy tokens only. */
2
- .mg { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 8px; }
2
+ .mg { display: flex; flex-direction: column; gap: var(--space-12); padding: var(--space-4) 0 var(--space-8); }
3
3
  .mg * { box-sizing: border-box; }
4
4
  .mg .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
5
- .mg-tm { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: var(--fs-label); color: var(--cz-ink3); font-variant-numeric: tabular-nums; }
5
+ .mg-tm { display: flex; align-items: baseline; gap: var(--space-8); flex-wrap: wrap; font-size: var(--fs-label); color: var(--cz-ink3); font-variant-numeric: tabular-nums; }
6
6
  .mg-tm b { color: var(--cz-ink); font-weight: var(--fw-strong); }
7
7
  .mg-tm .sp { flex: 1 1 0%; }
8
- .mg-pr { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 8px; background: var(--cz-well); }
8
+ .mg-pr { display: flex; align-items: flex-start; gap: 10px; padding: var(--space-12) 14px; border-radius: 8px; background: var(--cz-well); }
9
9
  .mg-pr .st { color: var(--cz-blueink); margin-top: 2px; display: inline-flex; }
10
10
  .mg-pr .tx { flex: 1 1 0%; font-size: var(--fs-body); line-height: 1.5; color: var(--cz-ink); }
11
11
  .mg-pr .tx small { display: block; margin-top: 2px; font-size: var(--fs-label); color: var(--cz-ink3); }
12
- .mg-pr button { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; border: 0; cursor: pointer; background: var(--cz-card); color: var(--cz-ink2); flex: 0 0 auto; }
12
+ .mg-pr button { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); border: 0; cursor: pointer; background: var(--cz-card); color: var(--cz-ink2); flex: 0 0 auto; }
13
13
  @media (hover: hover) { .mg-pr button:hover { color: var(--cz-ink); } }
14
- .mg-th { display: flex; flex-direction: column; gap: 6px; border-radius: 8px; background: var(--cz-well); padding: 10px 12px; }
14
+ .mg-th { display: flex; flex-direction: column; gap: 6px; border-radius: 8px; background: var(--cz-well); padding: 10px var(--space-12); }
15
15
  .mg-th[open] { gap: 6px; }
16
16
  .mg-th.now { background: var(--cz-bluebg); }
17
17
  .mg-th > summary { list-style: none; cursor: pointer; }
@@ -29,14 +29,14 @@
29
29
  .mg .mk .odot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--cz-ink3); background: linear-gradient(90deg, var(--cz-ink3) 50%, transparent 50%); display: block; opacity: .7; }
30
30
  .mg .t4 { margin-left: auto; font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink3); font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 2px; }
31
31
  .mg .t4.ov { color: var(--cz-risk); }
32
- .mg-now { background: var(--cz-card); border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
32
+ .mg-now { background: var(--cz-card); border-radius: 8px; padding: 14px var(--space-16); display: flex; flex-direction: column; gap: 6px; }
33
33
  .mg-now small { font-size: var(--fs-label); color: var(--cz-blueink); font-weight: var(--fw-strong); }
34
34
  .mg-now h4 { margin: 0; font-size: var(--fs-row); font-weight: var(--fw-strong); color: var(--cz-ink); line-height: 1.35; }
35
35
  .mg-now p { margin: 0; font-size: var(--fs-body); color: var(--cz-ink2); line-height: 1.5; }
36
36
  .mg-now .ft { display: flex; align-items: center; gap: 10px; font-size: var(--fs-label); color: var(--cz-ink3); }
37
37
  .mg-now .ft .sp { flex: 1 1 0%; }
38
38
  .mg-lk { border: 0; background: none; padding: 6px 0; font: inherit; color: var(--cz-blueink); font-weight: var(--fw-strong); cursor: pointer; min-height: 32px; }
39
- .mg-r { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; font-size: var(--fs-body); line-height: 1.4; color: var(--cz-ink); }
39
+ .mg-r { display: flex; align-items: flex-start; gap: 10px; padding: var(--space-8) var(--space-4); font-size: var(--fs-body); line-height: 1.4; color: var(--cz-ink); }
40
40
  .mg-r .tx { flex: 1 1 0%; min-width: 0; }
41
41
  .mg-r .tx small { display: block; font-size: var(--fs-label); color: var(--cz-ink3); margin-top: 1px; line-height: 1.4; }
42
42
  .mg-r .tx small.ok { color: var(--cz-ok); }