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
@@ -7,7 +7,8 @@
7
7
  * setTarget(runtime, root, target, { front, by }) · clearTarget(runtime, root, { by }) · undoTarget(runtime, root, { by })
8
8
  * append-only `<runtime>/balance-targets.jsonl`; one line per write. Undo takes the last set or clear back.
9
9
  * targetOf(runtime, root) → { target, front, at, by } | null
10
- * ranked(root) → [{ id, title, kind }] the live initiatives in Roadmap order (D105), finished ones left out
10
+ * ranked(root, { peek }) → [{ id, title, kind }] the live initiatives in Roadmap order (D105), finished ones left out;
11
+ * peek: the cached rows only (lib/initiative-rows.js peek), [] until a derivation has landed: the needs provider never derives
11
12
  * gapOf(list, target, front) → { front: [...], mix: { kind: pct }, gap } gap = half the sum of |actual − target|, in points
12
13
  * movesOf(list, target, front, { max }) → the best rank moves, at most `max` (2): an under-target initiative from below the front
13
14
  * moved just above an over-target one in it. Each: { id, above, kind, pushes, gapAfter, closes, cli, undo }. Only moves that close gap.
@@ -104,10 +105,12 @@ function count(runtime, { days = 7, now = Date.now() } = {}) {
104
105
  }
105
106
 
106
107
  /** The live initiatives of a repository in Roadmap order (one ranked list, D105). Finished ones are left out. */
107
- function ranked(root) {
108
+ function ranked(root, { peek = false } = {}) {
108
109
  const rowsLib = require('./initiative-rows.js'), P = require('./placements.js'), PR = require('./plan-rules.js');
109
- const d = rowsLib.deriveSync(root);
110
- if (!d.ok) return [];
110
+ // the needs provider reads the cached rows only (peek), so the Today poll and `pmos today` never pay for a derivation
111
+ // (about 260 ms per record); the CLI derives now
112
+ const d = peek ? rowsLib.peek(root) : rowsLib.deriveSync(root);
113
+ if (!d || !d.ok) return [];
111
114
  const rows = new Map(d.rows.map((r) => [r.id, r]));
112
115
  const placed = P.readPlacements(root, { now: Date.now(), rules: PR.readRules(root), records: d.rows });
113
116
  return placed.ranked.map((id) => rows.get(id)).filter((r) => r && !r.accepted && !r.stopped)
@@ -207,14 +210,18 @@ const runtimeNow = () => require('./state-root.js').defaultRoot({ env: process.e
207
210
  function rowsFor(w, { lead } = {}) {
208
211
  if (!lead || !w || !w.root) return [];
209
212
  const saved = targetOf(runtimeNow(), w.root);
210
- return saved ? rowsOf(w.id, saved, ranked(w.root)) : proposalRowsOf(w.id, ranked(w.root));
213
+ const list = ranked(w.root, { peek: true });
214
+ return saved ? rowsOf(w.id, saved, list) : proposalRowsOf(w.id, list);
211
215
  }
212
216
  function sig(w) {
213
217
  let t = '-';
214
218
  try { const st = fs.statSync(fileOf(runtimeNow())); t = st.size + ':' + st.mtimeMs; } catch { /* no target yet */ }
215
219
  let p = '-';
216
220
  try { p = String(require('./plan-ledgers.js').ledgerSig(w.root, 'placements')); } catch { /* no ledger */ }
217
- return t + '|' + p + '|' + new Date().toISOString().slice(0, 10);
221
+ // the cached rows' signature changes when a derivation lands, so Today recounts then
222
+ let c = '-';
223
+ try { c = String(require('./initiative-rows.js').cachedSig(w.root)); } catch { /* no cache yet */ }
224
+ return t + '|' + p + '|' + c + '|' + new Date().toISOString().slice(0, 10);
218
225
  }
219
226
 
220
227
  module.exports = { FILE, DEFAULT_FRONT, ROW_GAP, KIND, kinds: [KIND], fileOf, parseTarget, targetOf, setTarget, clearTarget, undoTarget, used, count,
@@ -0,0 +1,140 @@
1
+ 'use strict';
2
+ /* compare-cli.js — `pmos compare <a> <b>`: two items side by side, the differences marked (idea A421, initiative compare-items; done test
3
+ * planning/done-tests/compare-items.md). The chat's way to the compare panel Work opens (public/pm/compare-items.js).
4
+ *
5
+ * pmos compare <a> <b> [--json] [--root <dir>] (pmos compare show <a> <b> is the same)
6
+ * <a>, <b>: an initiative id (its record, kit or PMOS-self layout) or a file path, each with an optional @<git revision>:
7
+ * pmos compare checkout-redesign wechat-login two initiatives: their fields and their `## ` sections
8
+ * pmos compare planning/prd/otp.md@HEAD~1 planning/prd/otp.md two versions of one brief
9
+ * Prints the rows that differ (removed words in [-…-], added words in {+…+}) and the rows that are the same in one line.
10
+ *
11
+ * sideOf(root, ref) → { ok: true, side } | { ok: false, error } side: { title, sub, fields: [[name, value]], parts: [[name, text]] }
12
+ * splitOf(text) → { front: [[key, value]], parts: [[heading, text]] } PURE
13
+ *
14
+ * The rows come from the page's own pure model (public/pm/compare-items.js compareOf), so the chat and the panel never disagree.
15
+ * READ ONLY: it reads files and `git show`, writes nothing to the product and sends nothing. Each run counts the use-log control
16
+ * compareOpen (this computer's runtime folder, the health number) and prints one [compare-items] line on stderr.
17
+ * Exit codes: 0 done, 1 an item was not found, 2 usage. */
18
+ const fs = require('fs');
19
+ const path = require('path');
20
+ const { execFileSync } = require('child_process');
21
+ const why = require('./item-why.js');
22
+
23
+ const TAG = '[compare-items]';
24
+ const COMMANDS = { compare: ['show'] };
25
+ const USAGE = [
26
+ 'usage: pmos compare <a> <b> — two items side by side, the differences marked',
27
+ ' <a>, <b> an initiative id or a file path, each with an optional @<git revision> (a version: brief.md@HEAD~1)',
28
+ ' pmos compare show <a> <b> the same',
29
+ ' every command: [--json] [--root <dir>]',
30
+ 'Removed words show in [-…-], added words in {+…+}. Nothing is written or sent.',
31
+ ];
32
+ const FIELD_WORD = { parent_kr: 'Goal it moves', status: 'Status', lane: 'Lane', kind: 'Kind', owner: 'Owner', stage: 'Stage', state: 'State',
33
+ expected_outcome: 'Expected outcome', outcome_horizon: 'Check date', kill: 'Kill if', start: 'Start', due: 'Due', target_date: 'Due' };
34
+ const SKIP = new Set(['title', 'type', 'timestamp', 'id', 'done_test_path', 'health_read', 'health_log', 'try_open']);
35
+ const nameOf = (k) => FIELD_WORD[k] || (k.charAt(0).toUpperCase() + k.slice(1)).replace(/_/g, ' ');
36
+
37
+ function repoRoot(cwd) {
38
+ try { return execFileSync('git', ['rev-parse', '--show-toplevel'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || cwd; }
39
+ catch { return cwd; }
40
+ }
41
+
42
+ /** The frontmatter as named fields and the body as its `## ` parts (the text before the first heading is "Opening"). PURE. */
43
+ function splitOf(text) {
44
+ const t = String(text || '').replace(/\r\n?/g, '\n');
45
+ const fm = why.frontOf(t);
46
+ const front = Object.entries(fm).filter(([k, v]) => !SKIP.has(k) && String(v == null ? '' : v).trim() !== '').map(([k, v]) => [nameOf(k), String(v)]);
47
+ const body = t.replace(/^---\n[\s\S]*?\n---\n?/, '');
48
+ const parts = []; let cur = 'Opening', buf = [];
49
+ const flush = () => { const x = buf.join('\n').trim(); if (x) parts.push([cur, x]); buf = []; };
50
+ for (const line of body.split('\n')) {
51
+ const m = /^##\s+(.+?)\s*#*\s*$/.exec(line);
52
+ if (m) { flush(); cur = m[1]; } else if (!/^#\s/.test(line)) buf.push(line);
53
+ }
54
+ flush();
55
+ // a heading used twice keeps both, numbered, so no part hides another
56
+ const seen = new Map();
57
+ return { front, parts: parts.map(([k, v]) => { const n = (seen.get(k) || 0) + 1; seen.set(k, n); return [n > 1 ? `${k} (${n})` : k, v]; }) };
58
+ }
59
+
60
+ const inside = (root, f) => { const a = path.resolve(f); return a === root || a.startsWith(root + path.sep); };
61
+ /** One item read from disk or from git. */
62
+ function sideOf(root, ref) {
63
+ const raw = String(ref || '').trim();
64
+ if (!raw) return { ok: false, error: 'an item is missing' };
65
+ const at = raw.lastIndexOf('@');
66
+ const base = at > 0 ? raw.slice(0, at) : raw, rev = at > 0 ? raw.slice(at + 1) : '';
67
+ if (rev && !/^[A-Za-z0-9._~^/-]{1,80}$/.test(rev)) return { ok: false, error: `"${rev}" is not a git revision` };
68
+ let file = null;
69
+ const asPath = path.resolve(root, base);
70
+ if (inside(root, asPath) && (fs.existsSync(asPath) || rev) && /[./\\]/.test(base)) file = asPath;
71
+ else { const rec = why.recordPathOf(root, base); if (rec) file = rec; }
72
+ if (!file || !inside(root, file)) return { ok: false, error: `no initiative or file "${base}" here` };
73
+ const relp = path.relative(root, file).split(path.sep).join('/');
74
+ let text = null, when = '';
75
+ if (rev) {
76
+ try {
77
+ text = execFileSync('git', ['show', `${rev}:${relp}`], { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], maxBuffer: 8 << 20 });
78
+ when = execFileSync('git', ['log', '-1', '--format=%cs', rev, '--', relp], { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
79
+ } catch { return { ok: false, error: `${relp} has no version at ${rev}` }; }
80
+ } else {
81
+ try { text = fs.readFileSync(file, 'utf8'); } catch { return { ok: false, error: `${relp} cannot be read` }; }
82
+ }
83
+ const fm = why.frontOf(text), s = splitOf(text);
84
+ const title = String(fm.title || path.basename(relp, path.extname(relp))) + (rev ? ` @ ${rev}` : '');
85
+ return { ok: true, side: { title, sub: [relp, when].filter(Boolean).join(' · '), fields: s.front, parts: s.parts } };
86
+ }
87
+
88
+ function parse(argv) {
89
+ const pos = [], flags = {};
90
+ for (let i = 0; i < argv.length; i++) {
91
+ const a = argv[i];
92
+ if (a === '--root') flags.root = argv[++i];
93
+ else if (a.startsWith('--root=')) flags.root = a.slice(7);
94
+ else if (a === '-h' || a === '--help') flags.help = true;
95
+ else if (a.startsWith('--')) flags[a.slice(2)] = true;
96
+ else pos.push(a);
97
+ }
98
+ return { pos, flags };
99
+ }
100
+
101
+ const pieceText = (p) => (p.op === 'del' ? `[-${p.t.trim()}-]${/\s$/.test(p.t) ? ' ' : ''}` : p.op === 'add' ? `{+${p.t.trim()}+}${/\s$/.test(p.t) ? ' ' : ''}` : p.t);
102
+ const oneLine = (s, n = 160) => { const t = String(s || '').replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '…' : t; };
103
+ function used(o) {
104
+ try {
105
+ const dir = o.stateDir || require('./state-root.js').defaultRoot({ env: o.env || process.env });
106
+ require('./use-log.js').record(dir, [{ kind: 'use', page: 'today', control: 'compareOpen', device: 'desk' }], o.now || Date.now());
107
+ } catch { /* a count, never a reason to fail */ }
108
+ }
109
+
110
+ async function run(argv, o = {}) {
111
+ const say = o.say || ((s) => console.log(s));
112
+ const args = argv[0] === 'compare' ? argv.slice(1) : argv.slice();
113
+ const { pos, flags } = parse(args);
114
+ if (pos[0] === 'show') pos.shift();
115
+ if (flags.help || pos[0] === 'help') { for (const l of USAGE) say(l); return 0; }
116
+ if (pos.length !== 2) { for (const l of USAGE) say(l); return 2; }
117
+ const root = path.resolve(flags.root || repoRoot(o.cwd || process.cwd()));
118
+ const A = sideOf(root, pos[0]), B = sideOf(root, pos[1]);
119
+ for (const x of [A, B]) if (!x.ok) { if (flags.json) say(JSON.stringify({ ok: false, error: x.error })); else say(`✗ ${x.error}`); return 1; }
120
+ const C = await import(require('url').pathToFileURL(path.join(__dirname, '..', 'public', 'pm', 'compare-items.js')).href);
121
+ const m = C.compareOf(A.side, B.side);
122
+ used(o);
123
+ try { console.error(TAG, 'compare', m.differ, 'of', m.total); } catch { /* no stderr */ }
124
+ if (flags.json) {
125
+ say(JSON.stringify({ ok: true, left: { title: m.left.title, sub: m.left.sub }, right: { title: m.right.title, sub: m.right.sub }, unit: m.unit, differ: m.differ, same: m.same, total: m.total, rows: m.rows }));
126
+ return 0;
127
+ }
128
+ say(`${m.left.title} and ${m.right.title}: ${C.sumText(m) || 'nothing to compare'}.`);
129
+ for (const r of m.rows.filter((x) => !x.same)) {
130
+ say(`• ${r.name}`);
131
+ if (r.diff) { say(` - ${oneLine(r.diff.a.map(pieceText).join(''), 400) || 'None'}`); say(` + ${oneLine(r.diff.b.map(pieceText).join(''), 400) || 'None'}`); }
132
+ else { say(` - ${oneLine(r.a) || 'None'}`); say(` + ${oneLine(r.b) || 'None'}`); }
133
+ }
134
+ const same = m.rows.filter((x) => x.same);
135
+ if (same.length) say(`${same.length} the same: ${oneLine(same.map((x) => x.name).join(', '), 300)}.`);
136
+ say('Nothing was changed or sent.');
137
+ return 0;
138
+ }
139
+
140
+ module.exports = { TAG, COMMANDS, USAGE, splitOf, sideOf, run };
@@ -0,0 +1,182 @@
1
+ 'use strict';
2
+ /* design-boards.js — `pmos design boards`: the design-token check for canvas boards (*.dc.html), initiative text-token-guard.
3
+ *
4
+ * Why it exists. Wawan, 2026-11-25: "I thought we have design system which guard the design to make it consistent". The drift guard reads the
5
+ * repository only, so a canvas board never passed through it. The Goals boards (Exploring 3, page goalstack) wrote their own colour values
6
+ * into their :root block and hand-wrote text sizes off the type scale (12, 14, 22, 24, 28 px). A board can only be held to the system by a
7
+ * check that the design threads run on the board files before they publish, and by --fix, which puts a board back on the system.
8
+ *
9
+ * A board passes when:
10
+ * 1. every colour or shadow token its <style> blocks define has the design system's value for that theme (:root / [data-theme="light"]
11
+ * is light, [data-theme="dark"] is dark), and it defines no colour token the system does not have;
12
+ * 2. no style attribute and no other style rule holds a literal colour (#hex, rgb(), hsl());
13
+ * 3. every font-size reads a type token (var(--type-…)) or is one of the type scale's sizes (13, 15, 18, 26 px in PMOS Komorebi).
14
+ *
15
+ * check(html, sys) PURE → [{ kind, line, say }] · fix(html, sys) PURE → { html, changed } · systemFrom(dir) → sys
16
+ * run({ files, fix, say, dir }) → exit code (0 every board passes, 1 a board fails, 2 usage)
17
+ * sys = { light: { name: value }, dark: { name: value }, type: [{ name, size, line }] }. Token names have no leading --.
18
+ */
19
+ const fs = require('fs');
20
+ const path = require('path');
21
+
22
+ const COLOUR = /#[0-9a-fA-F]{3,8}\b|\b(?:rgba?|hsla?)\([^()]*\)/g;
23
+ const hasColour = (v) => { COLOUR.lastIndex = 0; const hit = COLOUR.test(String(v)); COLOUR.lastIndex = 0; return hit; };
24
+ const norm = (v) => String(v).toLowerCase().replace(/\s+/g, '');
25
+
26
+ /** The system's colour, shadow and type values from a design-system folder (brand/ and ui/ tokens.json). */
27
+ function systemFrom(dir) {
28
+ const read = (s) => JSON.parse(fs.readFileSync(path.join(dir, s, 'tokens.json'), 'utf8'));
29
+ const brand = read('brand'); const ui = read('ui');
30
+ const light = {}; const dark = {};
31
+ const put = (t) => {
32
+ if (t.value && typeof t.value === 'object') { light[t.name] = t.value.light; dark[t.name] = t.value.dark; } else { light[t.name] = t.value; dark[t.name] = t.value; }
33
+ };
34
+ for (const t of (brand.color && brand.color.tokens) || []) put(t);
35
+ for (const t of (ui.shadow && ui.shadow.tokens) || []) put(t);
36
+ // ground-night is the dark ground: a board's dark block uses it as --ground-night, so dark and light agree
37
+ const type = [];
38
+ for (const g of (ui.type && ui.type.groups) || []) for (const st of g.styles || []) {
39
+ if (st.family === 'mono') continue;
40
+ type.push({ name: 'type-' + st.name, size: parseFloat(st.fontSize), line: st.lineHeight });
41
+ }
42
+ type.sort((a, b) => a.size - b.size);
43
+ return { light, dark, type };
44
+ }
45
+
46
+ /** Which theme a token block's selector is: 'light', 'dark' or null (not a token block). */
47
+ function themeOf(selector) {
48
+ const s = String(selector);
49
+ if (/data-theme\s*=\s*["']?dark/.test(s)) return 'dark';
50
+ if (/^\s*:root\b|data-theme\s*=\s*["']?light/.test(s)) return 'light';
51
+ return null;
52
+ }
53
+
54
+ const lineAt = (text, i) => text.slice(0, i).split('\n').length;
55
+
56
+ /** Every <style> block's rules: [{ selector, body, start (index of body in html) }]. Flat rules and @media are walked one level. */
57
+ function styleRules(html) {
58
+ const out = [];
59
+ for (const m of html.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)) {
60
+ const base = m.index + m[0].indexOf(m[1]);
61
+ const css = m[1];
62
+ const re = /([^{}]+)\{([^{}]*)\}/g;
63
+ let r;
64
+ while ((r = re.exec(css))) out.push({ selector: r[1].replace(/^[\s\S]*\{/, '').trim(), body: r[2], start: base + r.index + r[0].indexOf('{') + 1 });
65
+ }
66
+ return out;
67
+ }
68
+
69
+ /** The nearest type step for a size in px: the scale is the system's, so a 12 px line becomes small (13) and 14 px becomes body (15). */
70
+ function stepFor(px, type) {
71
+ if (!type.length) return null;
72
+ let best = type[0];
73
+ for (const t of type) if (Math.abs(t.size - px) < Math.abs(best.size - px) || (Math.abs(t.size - px) === Math.abs(best.size - px) && t.size > best.size)) best = t;
74
+ return best;
75
+ }
76
+
77
+ /** Findings for one board. PURE. */
78
+ function check(html, sys) {
79
+ const out = [];
80
+ const scale = new Set(sys.type.map((t) => t.size));
81
+ const known = new Set(Object.keys(sys.light));
82
+ const tokenSpans = [];
83
+ for (const r of styleRules(html)) {
84
+ const theme = themeOf(r.selector);
85
+ if (theme) tokenSpans.push([r.start, r.start + r.body.length]);
86
+ for (const d of r.body.matchAll(/(--?[a-zA-Z][a-zA-Z0-9-]*)\s*:\s*([^;]+)/g)) {
87
+ const prop = d[1]; const value = d[2].trim(); const line = lineAt(html, r.start + d.index);
88
+ if (prop.startsWith('--')) {
89
+ const name = prop.slice(2);
90
+ if (!theme) { if (hasColour(value)) out.push({ kind: 'colour', line, say: `${prop} is defined outside the board's token block with a colour (${value})` }); continue; }
91
+ if (known.has(name)) {
92
+ const want = sys[theme][name];
93
+ if (want != null && norm(want) !== norm(value)) out.push({ kind: 'token', line, say: `${prop} (${theme}) is ${value}; the design system's value is ${want}` });
94
+ } else if (hasColour(value)) out.push({ kind: 'token', line, say: `${prop} is a colour token the design system does not have (${value})` });
95
+ continue;
96
+ }
97
+ if (!theme && hasColour(value.replace(/var\([^()]*\)/g, ''))) out.push({ kind: 'colour', line, say: `${prop}: ${value} is a literal colour; read a token (--ink, --muted, --blue, --alert …)` });
98
+ }
99
+ }
100
+ const inToken = (i) => tokenSpans.some(([a, b]) => i >= a && i < b);
101
+ for (const m of html.matchAll(/\bstyle\s*=\s*"([^"]*)"/g)) {
102
+ const at = m.index; const v = m[1];
103
+ if (inToken(at)) continue;
104
+ const line = lineAt(html, at);
105
+ for (const c of v.replace(/var\([^()]*\)/g, '').matchAll(COLOUR)) out.push({ kind: 'colour', line, say: `literal colour ${c[0]} in a style attribute; read a token` });
106
+ }
107
+ for (const m of html.matchAll(/font-size\s*:\s*([^;"}]+)/g)) {
108
+ if (inToken(m.index)) continue;
109
+ const v = m[1].trim();
110
+ if (/^var\(--type-/.test(v) || /^(inherit|initial|unset|100%|1em)$/.test(v)) continue;
111
+ const px = v.match(/^(\d*\.?\d+)px$/);
112
+ if (px && scale.has(Number(px[1]))) continue;
113
+ const step = px ? stepFor(Number(px[1]), sys.type) : null;
114
+ out.push({ kind: 'size', line: lineAt(html, m.index), say: `font-size ${v} is not on the type scale (${[...scale].join(', ')} px)${step ? `; nearest is var(--${step.name}) ${step.size}px` : ''}` });
115
+ }
116
+ return out.sort((a, b) => a.line - b.line);
117
+ }
118
+
119
+ /** Put a board back on the system. PURE. Token blocks take the system's values (and gain the --type-* tokens); every font-size in px
120
+ * becomes the nearest type token, and a line-height in the same declaration list becomes that step's. Literal colours elsewhere are left
121
+ * for a person: their meaning (ink, muted, alert) cannot be guessed. */
122
+ function fix(html, sys) {
123
+ let out = html;
124
+ // 1. token blocks
125
+ const rules = styleRules(out).filter((r) => themeOf(r.selector)).sort((a, b) => b.start - a.start);
126
+ for (const r of rules) {
127
+ const theme = themeOf(r.selector);
128
+ let body = r.body.replace(/(--([a-zA-Z][a-zA-Z0-9-]*))\s*:\s*([^;]+)/g, (all, prop, name, value) => {
129
+ const want = sys[theme][name];
130
+ return want != null && norm(want) !== norm(value) ? `${prop}:${want}` : all;
131
+ });
132
+ if (theme === 'light' && /^\s*:root\b/.test(r.selector) && sys.type.length && !/--type-/.test(body) && /--font-sans|--ink/.test(body)) {
133
+ body = body.replace(/;?\s*$/, '') + ';' + sys.type.map((t) => `--${t.name}:${t.size}px;--${t.name}-line:${t.line}`).join(';');
134
+ }
135
+ out = out.slice(0, r.start) + body + out.slice(r.start + r.body.length);
136
+ }
137
+ // 2. font sizes, in style attributes and style rules alike
138
+ const decl = (list) => {
139
+ let lineStep = null;
140
+ let next = list.replace(/font-size\s*:\s*(\d*\.?\d+)px/g, (all, n) => {
141
+ const step = stepFor(Number(n), sys.type);
142
+ if (!step) return all;
143
+ if (Number(n) !== step.size) lineStep = step;
144
+ return `font-size:var(--${step.name})`;
145
+ });
146
+ if (lineStep) next = next.replace(/line-height\s*:\s*\d*\.?\d+px/g, `line-height:var(--${lineStep.name}-line)`);
147
+ return next;
148
+ };
149
+ out = out.replace(/\bstyle\s*=\s*"([^"]*)"/g, (all, v) => `style="${decl(v)}"`);
150
+ out = out.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, (block) => block.replace(/\{([^{}]*)\}/g, (all, body) => `{${decl(body)}}`));
151
+ return { html: out, changed: out !== html };
152
+ }
153
+
154
+ function listFiles(paths) {
155
+ const out = [];
156
+ for (const p of paths) {
157
+ if (!fs.existsSync(p)) { out.push({ missing: p }); continue; }
158
+ if (fs.statSync(p).isDirectory()) { for (const f of fs.readdirSync(p).sort()) if (f.endsWith('.dc.html')) out.push({ file: path.join(p, f) }); } else out.push({ file: p });
159
+ }
160
+ return out;
161
+ }
162
+
163
+ function run({ files, write = false, say = (s) => console.log(s), dir = path.join(__dirname, '..', 'design-system') } = {}) {
164
+ if (!files || !files.length) { say('✗ usage: pmos design boards <board.dc.html | folder>… [--fix]'); return 2; }
165
+ const sys = systemFrom(dir);
166
+ let failed = 0; let fixed = 0;
167
+ for (const f of listFiles(files)) {
168
+ if (f.missing) { say(`✗ ${f.missing}: no such file or folder`); failed++; continue; }
169
+ let html = fs.readFileSync(f.file, 'utf8');
170
+ if (write) { const r = fix(html, sys); if (r.changed) { fs.writeFileSync(f.file, r.html); html = r.html; fixed++; } }
171
+ const found = check(html, sys);
172
+ if (!found.length) { say(`✓ ${f.file}`); continue; }
173
+ failed++;
174
+ say(`✗ ${f.file}: ${found.length} place${found.length === 1 ? '' : 's'} outside the design system`);
175
+ for (const x of found.slice(0, 12)) say(` line ${x.line}: ${x.say}`);
176
+ if (found.length > 12) say(` … ${found.length - 12} more`);
177
+ }
178
+ if (write) say(`${fixed} board${fixed === 1 ? '' : 's'} changed by --fix.`);
179
+ return failed ? 1 : 0;
180
+ }
181
+
182
+ module.exports = { systemFrom, themeOf, styleRules, stepFor, check, fix, run };
@@ -13,6 +13,10 @@
13
13
  * --gate exit 1 when a count rose against --base
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
+ * --block-text exit 1 when an added line gives text a colour or size the design system does not own (CI blocks on it; the other kinds warn)
17
+ *
18
+ * pmos design boards <board.dc.html | folder>… [--fix] (initiative text-token-guard, lib/design-boards.js) a canvas board's colour tokens,
19
+ * literal colours and text sizes against the design system. Design threads run it on every board before they publish.
16
20
  *
17
21
  * pmos design swap [--write] (initiative token-swap-same-value, lib/design-swap.js) each fixed spacing or corner value in a scanned
18
22
  * stylesheet that equals a design token: counted per file, or with --write replaced by that token. Nothing on screen moves.
@@ -23,10 +27,11 @@ const fs = require('fs');
23
27
  const path = require('path');
24
28
  const D = require('./design-drift.js');
25
29
 
26
- const COMMANDS = { design: ['drift', 'swap'] };
30
+ const COMMANDS = { design: ['drift', 'swap', 'boards'] };
27
31
  const USAGE = [
28
32
  'usage: pmos design drift — every place your styles and scripts do not read a design token, and which ones a change adds',
29
- ' pmos design drift [--ref <ref>] [--base <ref>|week] [--weeks <n>] [--json] [--write] [--gate] [--github] [--pages]',
33
+ ' pmos design drift [--ref <ref>] [--base <ref>|week] [--weeks <n>] [--json] [--write] [--gate] [--github] [--pages] [--block-text]',
34
+ ' --block-text fail when a change adds a text colour or size outside the design system (literal colour or text size, or a colour token defined outside the system sheets)',
30
35
  ' --ref <ref> the commit to count (default HEAD; WORKTREE reads the files on disk)',
31
36
  ' --base <ref> compare with this commit and name each added line that bypasses a token; "week" is the last commit a week earlier',
32
37
  ' --weeks <n> the total at the end of each of the last n weeks (1 to 12)',
@@ -35,10 +40,11 @@ const USAGE = [
35
40
  ' --github print each new bypass as a GitHub warning on its line',
36
41
  ' --pages each page\'s share of system classes instead (a measure only)',
37
42
  'It reads git only. A product sets its files and system sheets in design-drift.json in its design-system folder.',
43
+ ' pmos design boards <board.dc.html | folder>… [--fix] check canvas boards: colour tokens with the system\'s values, no literal colours, text sizes on the type scale; --fix puts a board back on the system',
38
44
  ' pmos design swap [--write] each fixed spacing or corner value that equals a design token: counted, or with --write replaced by the token',
39
45
  ];
40
- const FLAGS = new Set(['ref', 'base', 'weeks', 'json', 'write', 'gate', 'repo', 'github', 'pages']);
41
- const BOOL = new Set(['json', 'write', 'gate', 'github', 'pages']);
46
+ const FLAGS = new Set(['ref', 'base', 'weeks', 'json', 'write', 'gate', 'repo', 'github', 'pages', 'block-text']);
47
+ const BOOL = new Set(['json', 'write', 'gate', 'github', 'pages', 'block-text', 'fix']);
42
48
 
43
49
  function parse(args) {
44
50
  const pos = [], flags = {};
@@ -64,6 +70,11 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), now
64
70
  if (!sub || ['help', '--help', '-h'].includes(sub)) { for (const l of USAGE) say(l); return sub ? 0 : 2; }
65
71
  if (!COMMANDS.design.includes(sub)) { say(`unknown design command "${sub}". Use one of: ${COMMANDS.design.join(', ')}`); return 2; }
66
72
  const { pos, flags } = parse(args.slice(1));
73
+ if (sub === 'boards') {
74
+ const bad = Object.keys(flags).filter((k) => k !== 'fix');
75
+ if (!pos.length || bad.length) { say('✗ usage: pmos design boards <board.dc.html | folder>… [--fix]'); return 2; }
76
+ return require('./design-boards.js').run({ files: pos.map((p) => path.resolve(cwd, p)), write: 'fix' in flags, say });
77
+ }
67
78
  if (sub === 'swap') {
68
79
  const bad = Object.keys(flags).filter((k) => k !== 'write' && k !== 'repo');
69
80
  if (pos.length || bad.length) { say('✗ usage: pmos design swap [--write]'); return 2; }
@@ -79,6 +90,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), now
79
90
  if (!Number.isInteger(weeks) || weeks < 0 || weeks > 12) { say('✗ --weeks is a whole number from 1 to 12'); return 2; }
80
91
  if (flags.gate && !flags.base) { say('✗ --gate needs --base: it fails only a count that rose against an earlier commit'); return 2; }
81
92
  if (flags.github && !flags.base) { say('✗ --github needs --base: it marks only the lines a change added'); return 2; }
93
+ if (flags['block-text'] && !flags.base) { say('✗ --block-text needs --base: it fails only the text colours and sizes a change added'); return 2; }
82
94
 
83
95
  const repo = repoRoot(flags.repo ? path.resolve(cwd, flags.repo) : cwd);
84
96
  if (!repo) { say('✗ this is not a git repository. Run pmos design drift in your product\'s repository.'); return 1; }
@@ -160,10 +172,16 @@ function tokens({ repo, ref, base, worktree, weeks, flags, say, now }) {
160
172
  }
161
173
  if (trend) say('By week: ' + trend.map((t) => `${t.week} ${t.total == null ? '–' : n(t.total)}`).join(' · '));
162
174
  }
175
+ const blocked = flags['block-text'] && findings ? D.textBlock(findings, head.colourTokens) : [];
176
+ const isBlocked = (g, x) => flags['block-text'] && D.isTextFinding(x, head.colourTokens);
163
177
  if (flags.github && findings) {
164
178
  for (const g of findings) {
165
179
  if (!g.lines.length) { say(`::warning file=${g.file},title=Design tokens::${D.KIND_LABEL[g.kind]} count ${g.before} → ${g.after}`); continue; }
166
- for (const x of g.lines) say(`::warning file=${g.file},line=${x.line},title=Design tokens::${D.findingSay(x).replace(/[\r\n%]/g, ' ')}`);
180
+ for (const x of g.lines) {
181
+ const level = isBlocked(g, x) ? 'error' : 'warning';
182
+ const why = level === 'error' ? ' (text colour or size outside the design system: this fails the check)' : '';
183
+ say(`::${level} file=${g.file},line=${x.line},title=Design tokens::${D.findingSay(x).replace(/[\r\n%]/g, ' ')}${why}`);
184
+ }
167
185
  }
168
186
  if (!findings.length) say(`No new token bypasses against ${before.commit}.`);
169
187
  }
@@ -173,6 +191,11 @@ function tokens({ repo, ref, base, worktree, weeks, flags, say, now }) {
173
191
  fs.writeFileSync(file, D.tokensMd({ date, ref, now: head, base, baseCommit: before && before.commit, findings, trend, cmd }));
174
192
  if (!flags.json && !flags.github) say('Report: ' + path.relative(repo, file));
175
193
  }
194
+ if (blocked.length) {
195
+ const n1 = blocked.reduce((a, g) => a + g.lines.length, 0);
196
+ say(`✗ ${n1} added line${n1 === 1 ? '' : 's'} give text a colour or size outside the design system. Read a token instead: --ink, --muted, --blue, --alert for colour; --type-small, --type-body, --type-heading, --type-title for size. A new colour or size goes into design-system/brand or design-system/ui first.`);
197
+ return 1;
198
+ }
176
199
  return flags.gate && findings && findings.length ? 1 : 0;
177
200
  }
178
201
 
@@ -583,7 +583,31 @@ function bypasses(repo, ref, { files: given } = {}) {
583
583
  files.push({ file: f, counts, findings });
584
584
  }
585
585
  const commit = given ? null : (isWorktree(ref) ? 'WORKTREE' : (gitOut(repo, ['rev-parse', '--short', ref]) || '').trim() || null);
586
- return { ref: isWorktree(ref) ? 'WORKTREE' : ref, commit, config: cfg, tokens: tokens.size, files, totals, total: Object.values(totals).reduce((a, b) => a + b, 0), swaps };
586
+ const colourTokens = [...tokens.entries()].filter(([, v]) => { COLOUR.lastIndex = 0; return COLOUR.test(v); }).map(([n]) => n);
587
+ COLOUR.lastIndex = 0;
588
+ return { ref: isWorktree(ref) ? 'WORKTREE' : ref, commit, config: cfg, tokens: tokens.size, colourTokens, files, totals, total: Object.values(totals).reduce((a, b) => a + b, 0), swaps };
589
+ }
590
+
591
+ // ── the text block (Wawan 2026-11-25: "I thought we have design system which guard the design to make it consistent") ─────────────────
592
+ // The ratchet above only warns. These added lines fail the check, because each one gives text a colour or a size the design system does not
593
+ // own: a literal colour, a literal text size, an inline style with either, and a token that defines a colour outside the system sheets
594
+ // (a second palette, such as --nz-ink, or a page giving --ink its own value).
595
+ /** Is one finding a text colour or size outside the system? colourTokens = the system's colour token names (--ink …). PURE. */
596
+ function isTextFinding(x, colourTokens) {
597
+ if (x.kind === 'colour' || x.kind === 'size') return true;
598
+ const hasColour = (v) => { COLOUR.lastIndex = 0; const hit = COLOUR.test(String(v)); COLOUR.lastIndex = 0; return hit; };
599
+ if (x.kind === 'tokenDef') return hasColour(x.value) || new Set(colourTokens || []).has(x.prop);
600
+ if (x.kind === 'inline') return hasColour(x.value) || /font-size\s*:\s*-?\d*\.?\d+(px|rem|em)/.test(String(x.value));
601
+ return false;
602
+ }
603
+ /** The ratchet's findings that the text block fails: [{ file, kind, lines }] with only the text lines kept. PURE. */
604
+ function textBlock(findings, colourTokens) {
605
+ const out = [];
606
+ for (const g of findings || []) {
607
+ const lines = g.lines.filter((x) => isTextFinding(x, colourTokens));
608
+ if (lines.length) out.push({ ...g, lines });
609
+ }
610
+ return out;
587
611
  }
588
612
 
589
613
  /** The lines a commit range added to one file (base → head; head WORKTREE compares with the files on disk). */
@@ -668,6 +692,6 @@ function tokenTrend(repo, ref, weeks, { now = Date.now() } = {}) {
668
692
  module.exports = {
669
693
  DEFAULTS, CONFIG_PLACES, REBUILT_SHARE, REBUILT_SHRINK,
670
694
  rulesOf, selectorClasses, splitSelectors, compoundsOf, systemOf, classesOf, importsOf, colourCount, globRe, resolveRef,
671
- KINDS, KIND_LABEL, dropVars, tokensOf, tokenFor, cssBypasses, scriptBypasses, systemClassesAll, readMany, bypasses, addedLines, ratchet, findingSay, tokensMd, tokenTrend,
695
+ KINDS, KIND_LABEL, isTextFinding, textBlock, dropVars, tokensOf, tokenFor, cssBypasses, scriptBypasses, systemClassesAll, readMany, bypasses, addedLines, ratchet, findingSay, tokensMd, tokenTrend,
672
696
  configAt, readerOf, measure, compare, queue, meanShare, trend, summary, reportMd, gitOut,
673
697
  };
@@ -8,6 +8,7 @@
8
8
  * replay (lib/ai-guard.js), and writes one replay line to your own ledger. This product's items show
9
9
  * on Home only after a replay that passed.
10
10
  * pmos drift status [--json] the last weekly result and the replays on record.
11
+ * pmos drift spec … Library › Drift: specs and code that no longer match (lib/spec-drift-cli.js).
11
12
  *
12
13
  * Run it in the product's repository. The weekly run itself needs no command: the server runs it each Monday. Nothing here changes a task,
13
14
  * an initiative or a ticket, and nothing is sent. Exit codes: 0 done, 1 refused or the replay failed, 2 usage. */
@@ -17,12 +18,13 @@ const D = require('./drift.js');
17
18
  const R = require('./drift-runs.js');
18
19
  const Facts = require('./drift-facts.js');
19
20
 
20
- const COMMANDS = { drift: ['show', 'replay', 'status'] };
21
+ const COMMANDS = { drift: ['show', 'replay', 'status', 'spec'] };
21
22
  const USAGE = [
22
23
  'usage: pmos drift show|replay|status — the weekly check for quiet drift (What would I have missed)',
23
24
  ' pmos drift show [--weeks <n>] [--json] what each of the last n weeks (default 4) would have shown for this repository; writes nothing',
24
25
  ' pmos drift replay [--json] replay the last 4 weeks of this repository on its real records; its items show on Today only after this passes',
25
26
  ' pmos drift status [--json] the last weekly result and the replays on record',
27
+ ' pmos drift spec [fix|update|undo <row>] specs and code that no longer match (Library › Drift; pmos drift spec help)',
26
28
  'The weekly run starts by itself each Monday. Nothing is changed in a task, an initiative or Jira, and nothing is sent.',
27
29
  ];
28
30
 
@@ -47,6 +49,7 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, cwd =
47
49
  const sub = args[0];
48
50
  if (!sub || ['help', '--help', '-h'].includes(sub)) { for (const l of USAGE) say(l); return sub ? 0 : 1; }
49
51
  if (!COMMANDS.drift.includes(sub)) { say(`unknown drift command "${sub}". Use one of: ${COMMANDS.drift.join(', ')}`); return 2; }
52
+ if (sub === 'spec') return require('./spec-drift-cli.js').run(args.slice(1), { say, env, cwd, now, runtime });
50
53
  const { pos, flags } = parse(args.slice(1));
51
54
  if (pos.length) { say(`✗ pmos drift ${sub} takes no argument`); return 2; }
52
55
  for (const k of Object.keys(flags)) if (k !== 'json' && !(k === 'weeks' && sub === 'show')) { say(`✗ --${k} is not an option of pmos drift ${sub}`); return 2; }
@@ -62,6 +62,7 @@
62
62
  {"id": "rules", "audience": "user", "status": "ga", "group": "What PMOS did", "name": "Rules PMOS learned", "say": "The standing rules PMOS learned from your corrections, and edit or retire one.", "cmd": "/rules", "verb": "rules"},
63
63
  {"id": "line", "audience": "user", "status": "ga", "group": "Catch up", "name": "Where each initiative stands", "say": "Days in its stage, what is missing, the next move, and whether it is stuck.", "cmd": "/line", "verb": "line", "hint": "<initiative>", "ask": ["initiative"]},
64
64
  {"id": "hire", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "The next hire", "say": "The role your open work most needs, and a one-page role brief to edit.", "cmd": "/hire", "verb": "hire"},
65
+ {"id": "compare", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Compare two items", "say": "Two items or two versions of one file side by side, with the differences marked.", "cmd": "/compare", "verb": "compare", "hint": "<item> <item>", "place": "board"},
65
66
  {"id": "experiment", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Copy and layout tests", "say": "Try new words or a new layout on an initiative: PMOS drafts the test, you start it, one line says how sure the winner is.", "cmd": "/experiment", "verb": "experiment", "hint": "draft <initiative> \"<what to try>\""},
66
67
  {"id": "review", "audience": "user", "status": "ga", "group": "Before you ship", "name": "Built beside its design", "say": "The built screen beside its design, each difference circled and numbered. Accept it, or send a difference back as a fix.", "cmd": "/built-vs-design", "verb": "review", "sub": "list", "hint": "<initiative>", "place": "board"},
67
68
  {"id": "story-map", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Story map", "say": "A new bet's user journey left to right, with the Release 1 line to move tasks across.", "cmd": "/story-map", "verb": "story-map", "hint": "<initiative>"},
@@ -159,6 +159,9 @@ const VERBS = Object.freeze({
159
159
  // Not a pm-os-absorb verb (run: null): initiative three-line-why (bet A86) added it through the same table.
160
160
  why: Object.freeze({ module: 'why-cli.js', run: null, guide: 'cli.md',
161
161
  help: 'pmos why <initiative or task> | coverage — why the work exists in three lines: goal, problem, evidence, read from its records (pmos why help)' }),
162
+ // Not a pm-os-absorb verb (run: null): initiative compare-items (job #1919, A421) added it through the same table.
163
+ compare: Object.freeze({ module: 'compare-cli.js', run: null, guide: 'cli.md',
164
+ help: 'pmos compare <a> <b> — two initiatives, or two versions of a document (<file>@<revision>), side by side with the differences marked (pmos compare help)' }),
162
165
  // Not a pm-os-absorb verb (run: null): initiative copy-tests (job #1905, A351) added it through the same table.
163
166
  experiment: Object.freeze({ module: 'copy-tests.js', run: null, guide: 'cli.md',
164
167
  help: 'pmos experiment draft|list|show|flag|start|result|keep|undo|count — copy and layout tests on an initiative: drafted from plain words, started by you, one table and one ✦ line with how sure (pmos experiment help)' }),
@@ -13,6 +13,7 @@
13
13
  * GET /api/drift/slip?ws=<id> → { ok, ws, name, notRead, today, initiatives, tasks, days, unsourced_days } open tasks behind
14
14
  * their first plan (initiative slip-baseline-contradictions, lib/plan-baseline.js); read-only
15
15
  * GET /api/drift/contradictions?ws=<id> → { ok, ws, name, notRead, items, total } records that disagree (lib/contradictions.js); read-only
16
+ * /api/spec-drift[/act|/undo] Library › Drift: specs and code that no longer match (lib/spec-drift-http.js, which says what each does)
16
17
  *
17
18
  * THE SWITCH. PMOS_DRIFT=off, or the shared guard's switch (lib/ai-guard.js off: PMOS_AI, the ai settings): every GET answers { ok, on: false }
18
19
  * and every POST 409. WHO WRITES: a POST that carries an agent session header is refused (403); pm-guard requirePagePress checks the page. */
@@ -30,6 +31,8 @@ function isOn(ctx) {
30
31
  }
31
32
 
32
33
  async function handle(req, res, url, ctx) {
34
+ // Library › Drift, spec and code (initiative spec-code-drift): its own module, under this module's place in the route table
35
+ if (url.pathname === '/api/spec-drift' || url.pathname.startsWith('/api/spec-drift/')) return require('./spec-drift-http.js').handle(req, res, url, ctx);
33
36
  const send = (r) => { ctx.json(res, r.body, r.status); return true; };
34
37
  const what = url.pathname.replace(/^\/api\/drift\/?/, '');
35
38
  const dir = D.dirOf(ctx.runtimeDir);
@@ -115,4 +118,4 @@ async function handle(req, res, url, ctx) {
115
118
  return send({ status: 200, body: { ok: true } });
116
119
  }
117
120
 
118
- module.exports = { prefixes: ['/api/drift'], handle };
121
+ module.exports = { prefixes: ['/api/drift', '/api/spec-drift'], handle };