yadflow 4.11.0 → 4.12.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 (42) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +2 -0
  3. package/bin/commands.mjs +2 -0
  4. package/bin/yad.mjs +55 -2
  5. package/cli/agent-rules.mjs +26 -1
  6. package/cli/argv-flags.mjs +1 -1
  7. package/cli/brain/view/index.html +1 -1
  8. package/cli/brain/view/live.html +1 -1
  9. package/cli/brain-view.mjs +5 -4
  10. package/cli/brand-cmd.mjs +326 -0
  11. package/cli/brand.mjs +327 -0
  12. package/cli/doctor.mjs +65 -1
  13. package/cli/guide.mjs +26 -3
  14. package/cli/issues.mjs +9 -3
  15. package/cli/local-page.mjs +2 -2
  16. package/cli/local-setup-record.mjs +71 -0
  17. package/cli/local-setup-steps.mjs +186 -0
  18. package/cli/local-setup.mjs +611 -0
  19. package/cli/manifest.mjs +5 -0
  20. package/cli/map/view/index.html +1 -1
  21. package/cli/map-view.mjs +8 -4
  22. package/cli/plain-text.mjs +22 -0
  23. package/cli/plan.mjs +185 -36
  24. package/cli/reconcile.mjs +53 -11
  25. package/cli/reports-dir.mjs +6 -4
  26. package/cli/scan.mjs +3 -5
  27. package/cli/secret-text.mjs +66 -0
  28. package/cli/setup.mjs +25 -4
  29. package/cli/standup.mjs +8 -2
  30. package/cli/test-brand.mjs +558 -0
  31. package/cli/test-guide.mjs +227 -0
  32. package/cli/test-local-setup.mjs +1188 -0
  33. package/cli/toolbox.mjs +15 -1
  34. package/cli/update-commit.mjs +35 -18
  35. package/cli/usage.mjs +9 -3
  36. package/cli/workspace.mjs +11 -2
  37. package/package.json +3 -3
  38. package/skills/sdlc/module-help.csv +1 -0
  39. package/skills/yad-brand/SKILL.md +69 -0
  40. package/skills/yad-checks/templates/hooks/local-setup-notice.mjs +96 -0
  41. package/skills/yad-checks/templates/hooks/yad-activity.mjs +2 -2
  42. package/skills/yad-guide/SKILL.md +9 -6
package/cli/brand.mjs ADDED
@@ -0,0 +1,327 @@
1
+ // The Product's brand on every page yadflow makes (E184).
2
+ //
3
+ // A Product may hold its design system — its logo, its colours, its fonts — in many shapes: a DESIGN.md with
4
+ // YAML front matter, one with a CSS `:root` block, prose tables, or a design tool. Pages never parse those.
5
+ // They read ONE small committed file, `.sdlc/brand.json`, which `yad brand init` (or the yad-brand skill)
6
+ // fills from the Product's design system:
7
+ //
8
+ // { "version": 1, "name": "…", "source": "DESIGN.md", "sourceHash": "sha256:…",
9
+ // "logo": "design/logo.svg", "mark": "design/mark.svg",
10
+ // "colors": { "light": { bg, surface, text, muted, border, primary, accent }, "dark": { … } | null },
11
+ // "fonts": { "heading": { "family": "Cairo", "files": ["design/fonts/Cairo.woff2"] } | null, "body": …, "mono": … },
12
+ // "status": { live, merged, active, planned, idle } | null }
13
+ //
14
+ // With no file — or a file that cannot be used — every page wears yadflow's own look (its logo's purple and
15
+ // pink) and says why in `yad brand`. A brand never breaks a page: each value is checked before it reaches one.
16
+ //
17
+ // SAFETY. A colour must match a narrow pattern (hex, or rgb/hsl/oklch/oklab of numbers), so no value can end
18
+ // the CSS it is written into. A file must sit inside the Product (no `..`, no link out), be of an allowed type
19
+ // and under its size cap; it is embedded as a data: URI, and an SVG is only ever shown through <img>, where
20
+ // its scripts never run. A font family is letters, digits, spaces, `-` and `_`.
21
+ import fs from 'node:fs';
22
+ import path from 'node:path';
23
+ import { createHash } from 'node:crypto';
24
+ import { fileURLToPath } from 'node:url';
25
+ import { readJSONStrict } from './lib.mjs';
26
+ import { PROJECT_FILES } from './manifest.mjs';
27
+
28
+ export const BRAND_FILE = PROJECT_FILES.brandConfig;
29
+ export const BRAND_VERSION = 1;
30
+ export const ROLES = Object.freeze(['bg', 'surface', 'text', 'muted', 'border', 'primary', 'accent']);
31
+ export const STATUS_KEYS = Object.freeze(['live', 'merged', 'active', 'planned', 'idle']);
32
+ export const FONT_SLOTS = Object.freeze(['heading', 'body', 'mono']);
33
+ export const IMAGE_CAP = 512 * 1024;
34
+ export const FONT_CAP = 600 * 1024;
35
+ const IMAGE_TYPES = Object.freeze({ '.svg': 'image/svg+xml', '.png': 'image/png', '.webp': 'image/webp', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg' });
36
+ const FONT_TYPES = Object.freeze({ '.woff2': ['font/woff2', 'woff2'], '.woff': ['font/woff', 'woff'], '.ttf': ['font/ttf', 'truetype'], '.otf': ['font/otf', 'opentype'] });
37
+
38
+ // A colour value: hex, or a CSS colour function holding only numbers, units, `%`, `.`, `/`, `,` and spaces.
39
+ export const COLOR_RE = /^(?:#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|(?:rgba?|hsla?|oklch|oklab)\(\s*(?:[-+0-9.%\s/,]|deg|turn|none)+\))$/i;
40
+ export const FAMILY_RE = /^[A-Za-z0-9][A-Za-z0-9 _-]{0,63}$/;
41
+ // A colour yadflow can write: checked for length first, so a huge value never reaches the pattern (review 1).
42
+ export const COLOR_MAX = 64;
43
+ export const isColor = (v) => typeof v === 'string' && v.trim().length <= COLOR_MAX && COLOR_RE.test(v.trim());
44
+ const SYSTEM_SANS = 'system-ui, -apple-system, "Segoe UI", Roboto, sans-serif';
45
+ const SYSTEM_MONO = 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace';
46
+
47
+ const HERE = path.dirname(fileURLToPath(import.meta.url));
48
+ export const YADFLOW_MARK_FILE = path.join(HERE, '..', 'skills', 'yad-docs', 'templates', 'app', 'public', 'favicon.svg');
49
+
50
+ // yadflow's own look, from its logo: purple #6316DB and pink #FB2576 (until yadflow defines its brand).
51
+ export const YADFLOW_BRAND = Object.freeze({
52
+ version: BRAND_VERSION, name: 'yadflow', source: null, sourceHash: null, logo: null, mark: null,
53
+ colors: {
54
+ light: { bg: '#ffffff', surface: '#f7f5fb', text: '#1b1530', muted: '#5f5873', border: '#e4dff0', primary: '#6316db', accent: '#fb2576' },
55
+ dark: { bg: '#120e1c', surface: '#1c1729', text: '#f1edfa', muted: '#a59cba', border: '#2f2842', primary: '#9466f8', accent: '#ff6490' },
56
+ },
57
+ fonts: { heading: null, body: null, mono: null },
58
+ status: null,
59
+ });
60
+
61
+ const isObj = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
62
+
63
+ // A path in brand.json: relative, inside the Product, never through a link that leaves it. → absolute | null
64
+ export function brandPath(root, rel) {
65
+ if (typeof rel !== 'string' || !rel.trim() || path.isAbsolute(rel) || rel.split(/[\\/]/).includes('..')) return null;
66
+ const full = path.resolve(root, rel);
67
+ let realRoot, realFull;
68
+ try { realRoot = fs.realpathSync(root); realFull = fs.realpathSync(full); } catch { return null; }
69
+ return realFull.startsWith(realRoot + path.sep) ? realFull : null;
70
+ }
71
+
72
+ // Check a parsed brand.json. → { brand (normalised), problems: [text], warnings: [text] }
73
+ export function checkBrand(root, rec) {
74
+ const problems = [], warnings = [];
75
+ if (!isObj(rec)) return { brand: null, problems: [`${BRAND_FILE} is not a JSON object`], warnings };
76
+ if (rec.version !== BRAND_VERSION) problems.push(`${BRAND_FILE} is version ${JSON.stringify(rec.version ?? null)}, and this yadflow reads version ${BRAND_VERSION}`);
77
+ const name = typeof rec.name === 'string' && rec.name.trim() ? rec.name.trim().slice(0, 80) : null;
78
+ if (!name) problems.push('"name" must be the product\'s name');
79
+ const colors = { light: null, dark: null };
80
+ for (const scheme of ['light', 'dark']) {
81
+ const c = rec.colors?.[scheme];
82
+ if (c === null || c === undefined) { if (scheme === 'light') problems.push('"colors.light" is needed'); continue; }
83
+ if (!isObj(c)) { problems.push(`"colors.${scheme}" must be an object of colour roles`); continue; }
84
+ const out = {};
85
+ for (const role of ROLES) {
86
+ const v = c[role];
87
+ if (v === undefined || v === null) { warnings.push(`colors.${scheme}.${role} is not set — yadflow's is used`); continue; }
88
+ if (!isColor(v)) { problems.push(`colors.${scheme}.${role} is not a colour yadflow can use (hex, rgb(), hsl(), oklch() or oklab())`); continue; }
89
+ out[role] = v.trim();
90
+ }
91
+ for (const k of Object.keys(c)) if (!ROLES.includes(k)) warnings.push(`colors.${scheme}.${k} is not a role yadflow uses (${ROLES.join(', ')})`);
92
+ colors[scheme] = out;
93
+ }
94
+ const files = (rel, kind, types, cap) => {
95
+ if (rel === null || rel === undefined) return null;
96
+ const full = brandPath(root, rel);
97
+ if (!full) { problems.push(`${kind} "${String(rel)}" is not a file inside the Product`); return null; }
98
+ const ext = path.extname(full).toLowerCase();
99
+ if (!Object.hasOwn(types, ext)) { problems.push(`${kind} "${rel}" is not one of ${Object.keys(types).join(', ')}`); return null; }
100
+ let size;
101
+ try { const st = fs.statSync(full); if (!st.isFile()) throw new Error('not a file'); size = st.size; } catch { problems.push(`${kind} "${rel}" cannot be read`); return null; }
102
+ if (cap && size > cap) { problems.push(`${kind} "${rel}" is ${Math.ceil(size / 1024)} KB — at most ${cap / 1024} KB`); return null; }
103
+ return rel;
104
+ };
105
+ const logo = files(rec.logo, 'logo', IMAGE_TYPES, IMAGE_CAP);
106
+ const mark = files(rec.mark, 'mark', IMAGE_TYPES, IMAGE_CAP);
107
+ const fonts = {};
108
+ let fontBytes = 0;
109
+ for (const slot of FONT_SLOTS) {
110
+ const f = rec.fonts?.[slot];
111
+ if (f === null || f === undefined) { fonts[slot] = null; continue; }
112
+ if (!isObj(f) || typeof f.family !== 'string' || !FAMILY_RE.test(f.family.trim())) { problems.push(`fonts.${slot}.family must be a font name (letters, digits, spaces, - and _)`); fonts[slot] = null; continue; }
113
+ const list = [];
114
+ for (const rel of Array.isArray(f.files) ? f.files : []) {
115
+ const ok = files(rel, `fonts.${slot} file`, FONT_TYPES, 0);
116
+ if (!ok) continue;
117
+ fontBytes += fs.statSync(brandPath(root, ok)).size;
118
+ list.push(ok);
119
+ }
120
+ fonts[slot] = { family: f.family.trim(), files: list };
121
+ }
122
+ if (fontBytes > FONT_CAP) { warnings.push(`the font files add up to ${Math.ceil(fontBytes / 1024)} KB — over ${FONT_CAP / 1024} KB they are not embedded in self-contained pages; the font names are still used`); }
123
+ let status = null;
124
+ if (rec.status !== null && rec.status !== undefined) {
125
+ if (!isObj(rec.status)) problems.push('"status" must be an object of status colours, or null');
126
+ else {
127
+ status = {};
128
+ for (const k of STATUS_KEYS) {
129
+ const v = rec.status[k];
130
+ if (v === undefined) continue;
131
+ if (!isColor(v)) problems.push(`status.${k} is not a colour yadflow can use`);
132
+ else status[k] = v.trim();
133
+ }
134
+ }
135
+ }
136
+ const brand = { version: BRAND_VERSION, name, source: typeof rec.source === 'string' ? rec.source : null, sourceHash: typeof rec.sourceHash === 'string' ? rec.sourceHash : null,
137
+ logo, mark, colors, fonts, status, fontBytes };
138
+ return { brand, problems, warnings };
139
+ }
140
+
141
+ // The brand every page wears. → { brand (complete: every role set), origin: 'product' | 'yadflow', problems, warnings, file }
142
+ export function readBrand(root) {
143
+ const file = path.join(root, BRAND_FILE);
144
+ const fallback = (problems = [], warnings = []) => ({ brand: completeBrand(YADFLOW_BRAND), origin: 'yadflow', problems, warnings, file });
145
+ let rec;
146
+ try { rec = readJSONStrict(file, null); } catch (e) { return fallback([`${BRAND_FILE} cannot be read (${String(e.message).split('\n')[0]})`]); }
147
+ if (rec === null) return fallback();
148
+ const c = checkBrand(root, rec);
149
+ if (c.problems.length) return fallback(c.problems, c.warnings);
150
+ return { brand: completeBrand(c.brand), origin: 'product', problems: [], warnings: c.warnings, file };
151
+ }
152
+
153
+ // Every role set: a missing light role is yadflow's. A dark primary or accent the brand does not give (no dark
154
+ // scheme, or one without them) is its light one made lighter, or yadflow's when it cannot be made lighter, so
155
+ // it reads on a dark background; every other missing dark role is yadflow's neutral dark.
156
+ function completeBrand(b) {
157
+ const light = { ...YADFLOW_BRAND.colors.light, ...(b.colors?.light || {}) };
158
+ const ownDark = b.colors?.dark;
159
+ const derive = (role) => (b.colors?.light?.[role] && lighter(light[role])) || YADFLOW_BRAND.colors.dark[role];
160
+ const dark = { ...YADFLOW_BRAND.colors.dark, primary: derive('primary'), accent: derive('accent'), ...(ownDark || {}) };
161
+ // `derivedDark`: the brand gave no dark colours of its own, so its dark look is made from the light one.
162
+ return { ...b, colors: { light, dark, derivedDark: !ownDark || !Object.keys(ownDark).length }, fonts: b.fonts || { heading: null, body: null, mono: null } };
163
+ }
164
+
165
+ // ---- colour maths (for contrast, and the derived dark scheme) --------------------------------------
166
+
167
+ const clamp01 = (x) => Math.min(1, Math.max(0, x));
168
+ const toLinear = (c) => (c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4);
169
+ // A colour → linear sRGB [r, g, b] (0–1), or null when yadflow cannot read it (hsl, oklab: no contrast check).
170
+ export function linearRgb(value) {
171
+ const v = String(value).trim().toLowerCase();
172
+ let m = /^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(v);
173
+ if (m) {
174
+ let h = m[1];
175
+ if (h.length <= 4) h = [...h].map((ch) => ch + ch).join('');
176
+ return [0, 2, 4].map((i) => toLinear(parseInt(h.slice(i, i + 2), 16) / 255));
177
+ }
178
+ // Each channel read with its own unit; an alpha after `/` or a fourth value is left out. Anything else is
179
+ // not read (null), never guessed (review 1).
180
+ m = /^rgba?\(\s*([\d.]+)(%?)(?:\s*,\s*|\s+)([\d.]+)(%?)(?:\s*,\s*|\s+)([\d.]+)(%?)\s*(?:[,/]\s*[\d.]+%?\s*)?\)$/.exec(v);
181
+ if (m) return [[m[1], m[2]], [m[3], m[4]], [m[5], m[6]]].map(([x, pc]) => toLinear(clamp01(Number(x) / (pc ? 100 : 255))));
182
+ m = /^oklch\(\s*([\d.]+)(%?)\s+([\d.]+)(%?)\s+([-\d.]+)(deg)?\s*(?:\/\s*[\d.]+%?\s*)?\)$/.exec(v);
183
+ if (m) {
184
+ // CSS: L 100% is 1; C 100% is 0.4.
185
+ const L = Number(m[1]) / (m[2] ? 100 : 1), C = m[4] ? (Number(m[3]) / 100) * 0.4 : Number(m[3]), h = (Number(m[5]) * Math.PI) / 180;
186
+ const a = C * Math.cos(h), b = C * Math.sin(h);
187
+ const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3;
188
+ const mm = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3;
189
+ const s = (L - 0.0894841775 * a - 1.2914855480 * b) ** 3;
190
+ return [4.0767416621 * l - 3.3077115913 * mm + 0.2309699292 * s, -1.2684380046 * l + 2.6097574011 * mm - 0.3413193965 * s, -0.0041960863 * l - 0.7034186147 * mm + 1.7076147010 * s].map(clamp01);
191
+ }
192
+ return null;
193
+ }
194
+ const luminance = (rgb) => 0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2];
195
+ export function contrast(a, b) {
196
+ const x = linearRgb(a), y = linearRgb(b);
197
+ if (!x || !y) return null;
198
+ const [hi, lo] = [luminance(x), luminance(y)].sort((p, q) => q - p);
199
+ return (hi + 0.05) / (lo + 0.05);
200
+ }
201
+ // A colour made lighter for a dark background: oklch() with its lightness raised; any other colour yadflow can
202
+ // read (hex, rgb()) → a lighter hex; one it cannot read → null, and yadflow's dark colour is used (reviews 1, 2).
203
+ export function lighter(value) {
204
+ const ok = /^oklch\(\s*([\d.]+)(%?)(\s+[\d.]+%?\s+[-\d.]+(?:deg)?\s*(?:\/\s*[\d.]+%?\s*)?)\)$/i.exec(String(value).trim());
205
+ if (ok) {
206
+ const L = Number(ok[1]) / (ok[2] ? 100 : 1);
207
+ return `oklch(${(L + (1 - L) * 0.5).toFixed(3)}${ok[3]})`;
208
+ }
209
+ const rgb = linearRgb(value);
210
+ if (!rgb) return null;
211
+ const toS = (c) => { const s = c <= 0.0031308 ? 12.92 * c : 1.055 * c ** (1 / 2.4) - 0.055; return Math.round(clamp01(s) * 255); };
212
+ const mixed = rgb.map((c) => c + (1 - c) * 0.35);
213
+ return `#${mixed.map((c) => toS(c).toString(16).padStart(2, '0')).join('')}`;
214
+ }
215
+
216
+ // Text that is hard to read. → [text]; a colour yadflow cannot read is skipped, never guessed. `links`: also
217
+ // `primary`, which the pages use as link text, so it needs 4.5:1 like text (review 2). `yad brand check` asks
218
+ // for it; `yad doctor` does not, so a brand colour chosen for buttons never warns on every run.
219
+ export function contrastProblems(brand, { links = false } = {}) {
220
+ const out = [];
221
+ const pairs = [['text', 4.5, 'text'], ['muted', 3, 'muted'], ...(links ? [['primary', 4.5, 'primary (links)']] : [])];
222
+ for (const scheme of ['light', 'dark']) {
223
+ const c = brand.colors[scheme];
224
+ for (const [role, min, label] of pairs) {
225
+ const r = contrast(c[role], c.bg);
226
+ if (r !== null && r < min) out.push(`${scheme}: ${label} on bg is ${r.toFixed(1)}:1 — under ${min}:1, hard to read`);
227
+ }
228
+ }
229
+ return out;
230
+ }
231
+
232
+ // ---- what a page needs ----------------------------------------------------------------------------
233
+
234
+ const dataUri = (mime, buf) => `data:${mime};base64,${buf.toString('base64')}`;
235
+ // The logo, the mark and the fonts as data: URIs (the files were checked by checkBrand).
236
+ export function brandAssets(root, brand, origin) {
237
+ const image = (rel) => {
238
+ const full = rel ? brandPath(root, rel) : null;
239
+ if (!full) return null;
240
+ const mime = IMAGE_TYPES[path.extname(full).toLowerCase()];
241
+ if (!mime) return null;
242
+ try { return dataUri(mime, fs.readFileSync(full)); } catch { return null; }
243
+ };
244
+ let mark = image(brand.mark) || image(brand.logo);
245
+ if (!mark && origin === 'yadflow') { try { mark = dataUri('image/svg+xml', fs.readFileSync(YADFLOW_MARK_FILE)); } catch { mark = null; } }
246
+ const fonts = [];
247
+ if ((brand.fontBytes || 0) <= FONT_CAP) {
248
+ for (const slot of FONT_SLOTS) {
249
+ const f = brand.fonts?.[slot];
250
+ for (const rel of f?.files || []) {
251
+ const full = brandPath(root, rel);
252
+ if (!full) continue;
253
+ const type = FONT_TYPES[path.extname(full).toLowerCase()];
254
+ if (!type) continue; // a brand never breaks a page
255
+ const [mime, format] = type;
256
+ try { fonts.push({ family: f.family, src: dataUri(mime, fs.readFileSync(full)), format }); } catch { /* left out */ }
257
+ }
258
+ }
259
+ }
260
+ return { mark, fonts };
261
+ }
262
+
263
+ const familyStack = (f, system) => (f ? `"${f.family}", ${system}` : system);
264
+ // The brand as CSS: @font-face for embedded fonts, then every role as a variable, light and dark both named
265
+ // (`--brand-bg`, `--brand-dark-bg`) so a page that is always dark (the map) can take the dark ones directly.
266
+ export function brandCss(brand, assets) {
267
+ const lines = [];
268
+ for (const f of assets.fonts) lines.push(`@font-face{font-family:"${f.family}";src:url(${f.src}) format("${f.format}");font-display:swap}`);
269
+ const vars = [];
270
+ for (const role of ROLES) vars.push(`--brand-${role}:${brand.colors.light[role]}`, `--brand-dark-${role}:${brand.colors.dark[role]}`);
271
+ vars.push(`--brand-font-heading:${familyStack(brand.fonts?.heading || brand.fonts?.body, SYSTEM_SANS)}`);
272
+ vars.push(`--brand-font-body:${familyStack(brand.fonts?.body || brand.fonts?.heading, SYSTEM_SANS)}`);
273
+ vars.push(`--brand-font-mono:${familyStack(brand.fonts?.mono, SYSTEM_MONO)}`);
274
+ for (const k of STATUS_KEYS) if (brand.status?.[k]) vars.push(`--brand-status-${k}:${brand.status[k]}`);
275
+ if (assets.mark && DATA_IMAGE_RE.test(assets.mark)) vars.push(`--brand-mark:url("${assets.mark}")`);
276
+ lines.push(`:root{${vars.join(';')}}`);
277
+ return lines.join('\n');
278
+ }
279
+
280
+ // A data: image URI of the kinds brandAssets makes — nothing else is ever written into CSS.
281
+ export const DATA_IMAGE_RE = /^data:image\/(?:svg\+xml|png|webp|jpeg);base64,[A-Za-z0-9+/=]+$/;
282
+
283
+ // Where each page shows its brand mark: before its title, drawn from `--brand-mark` (CSS only — no page script
284
+ // changes, and the strict pages already allow `img-src data:`).
285
+ export const PAGE_TITLES = Object.freeze({ map: '.brand h1', brain: '.brand h1', live: 'header.bar .mark', catalog: 'body > main > h1', usage: 'body h1', standup: 'body h1', issues: 'body h1' });
286
+ const markRule = (sel) => `${sel}::before{content:"";display:inline-block;width:1.15em;height:1.15em;margin-right:.4em;vertical-align:-0.18em;background:var(--brand-mark) center/contain no-repeat}`;
287
+
288
+ // How each page's own variables take the brand. Status, layer and priority colours keep their meaning: only
289
+ // the page around them changes (the user's decision). A page with a light and a dark look maps both.
290
+ const both = (light, dark) => `:root{${light}}\n@media (prefers-color-scheme: dark){:root{${dark}}}`;
291
+ const map = (pairs, scheme) => pairs.map(([v, role]) => `${v}:var(--brand-${scheme === 'dark' ? 'dark-' : ''}${role})`).join(';');
292
+ export const PAGE_MAPS = Object.freeze({
293
+ // The progress map is always dark: the dark roles, a glass of the surface, the status colours only if set.
294
+ map: `:root{${map([['--bg', 'bg'], ['--ink', 'text'], ['--muted', 'muted']], 'dark')};--ink-2:color-mix(in srgb, var(--brand-dark-text) 60%, var(--brand-dark-muted));--hair:color-mix(in srgb, var(--brand-dark-border) 70%, transparent);--glass:color-mix(in srgb, var(--brand-dark-surface) 80%, transparent)}
295
+ :root{--live:var(--brand-status-live, #3987e5);--merged:var(--brand-status-merged, #d55181);--active:var(--brand-status-active, #c98500);--planned:var(--brand-status-planned, #93a0bf);--idle:var(--brand-status-idle, #5b6680)}
296
+ html,body{font-family:var(--brand-font-body)}.brand h1{font-family:var(--brand-font-heading)}.linkish,#panel a{color:var(--brand-dark-primary)}`,
297
+ brain: both(map([['--bg', 'bg'], ['--panel', 'surface'], ['--text', 'text'], ['--muted', 'muted'], ['--line', 'border'], ['--accent', 'primary']], 'light'),
298
+ map([['--bg', 'bg'], ['--panel', 'surface'], ['--text', 'text'], ['--muted', 'muted'], ['--line', 'border'], ['--accent', 'primary']], 'dark'))
299
+ + '\nbody{font-family:var(--brand-font-body)}h1,h2,h3{font-family:var(--brand-font-heading)}',
300
+ live: `:root{--sky-0:var(--brand-dark-bg);--sky-1:var(--brand-dark-surface);--ink:var(--brand-dark-text);--ink-2:color-mix(in srgb, var(--brand-dark-text) 60%, var(--brand-dark-muted));--ink-3:var(--brand-dark-muted);--rule:color-mix(in srgb, var(--brand-dark-border) 60%, transparent);--glass:color-mix(in srgb, var(--brand-dark-surface) 66%, transparent);--sans:var(--brand-font-body);--mono:var(--brand-font-mono)}`,
301
+ catalog: both(map([['--bg', 'bg'], ['--ink', 'text'], ['--muted', 'muted'], ['--line', 'border'], ['--tag', 'surface'], ['--link', 'primary']], 'light'),
302
+ map([['--bg', 'bg'], ['--ink', 'text'], ['--muted', 'muted'], ['--line', 'border'], ['--tag', 'surface'], ['--link', 'primary']], 'dark'))
303
+ + '\nbody{font-family:var(--brand-font-body)}h1,h2{font-family:var(--brand-font-heading)}',
304
+ // usage was dark only; it now follows the brand's light and dark looks like the other reports.
305
+ usage: both(map([['--bg', 'bg'], ['--fg', 'text'], ['--dim', 'muted'], ['--card', 'surface'], ['--line', 'border'], ['--accent', 'primary']], 'light'),
306
+ map([['--bg', 'bg'], ['--fg', 'text'], ['--dim', 'muted'], ['--card', 'surface'], ['--line', 'border'], ['--accent', 'primary']], 'dark'))
307
+ + '\nbody{font-family:var(--brand-font-body)}h1,h2{font-family:var(--brand-font-heading)}',
308
+ standup: both(map([['--bg', 'bg'], ['--fg', 'text'], ['--dim', 'muted'], ['--card', 'surface'], ['--line', 'border']], 'light'),
309
+ map([['--bg', 'bg'], ['--fg', 'text'], ['--dim', 'muted'], ['--card', 'surface'], ['--line', 'border']], 'dark'))
310
+ + '\nbody{font-family:var(--brand-font-body)}h1,h2{font-family:var(--brand-font-heading)}',
311
+ issues: both(map([['--bg', 'bg'], ['--fg', 'text'], ['--dim', 'muted'], ['--card', 'surface'], ['--line', 'border'], ['--link', 'primary']], 'light'),
312
+ map([['--bg', 'bg'], ['--fg', 'text'], ['--dim', 'muted'], ['--card', 'surface'], ['--line', 'border'], ['--link', 'primary']], 'dark'))
313
+ + '\nbody{font-family:var(--brand-font-body)}h1,h2{font-family:var(--brand-font-heading)}',
314
+ });
315
+
316
+ // Everything one page needs. → { css, name, origin, problems }
317
+ // css the brand block, the page's own mapping and its mark rule — added AFTER the page's CSS, so it wins.
318
+ export function brandForPage(root, page) {
319
+ const r = readBrand(root);
320
+ const assets = brandAssets(root, r.brand, r.origin);
321
+ const mark = assets.mark && DATA_IMAGE_RE.test(assets.mark) && PAGE_TITLES[page] ? `\n${markRule(PAGE_TITLES[page])}` : '';
322
+ const css = `${brandCss(r.brand, assets)}\n${PAGE_MAPS[page] || ''}${mark}`;
323
+ return { css, name: r.brand.name, origin: r.origin, problems: r.problems };
324
+ }
325
+
326
+ // The fingerprint of the design system brand.json was made from, for `yad brand check`.
327
+ export const sourceFingerprint = (text) => `sha256:${createHash('sha256').update(text, 'utf8').digest('hex')}`;
package/cli/doctor.mjs CHANGED
@@ -8,7 +8,7 @@ import path from 'node:path';
8
8
  import fs from 'node:fs';
9
9
  import { c, log, ok, info, warn, fail, hand, run, has, exists, isPlainObject, readJSON, readJSONStrict, emitJSON, asArg, nodeSupport, nodeEndOfLife, NODE_FLOOR, NODE_SUPPORTED } from './lib.mjs';
10
10
  import { VERSION, BACKUP_SUFFIX, MIRRORED_FILES, mirrorDrift, PROJECT_FILES, MODULE_CONFIG, epicFiles, DESIGN_TOOLS, TESTING_TOOLS, LEARNING_TOOLS, HOOK_ADAPTERS, CAPTURE_ADAPTERS, HOOK_WIRING, CAPTURE_WIRING, ACTIVITY_WIRING, ACTIVITY_ADAPTERS, PROTECTION_GUIDE_URL, isVerifiedLedger , productConfigPath, settingsEditHint, PRODUCT_LINK, ADVANCE_FROM_AUTOMATION, DRIVER_FROM_ASSISTANCE } from './manifest.mjs';
11
- import { mergeHookSettings, hookMatcherFires, ideTargetsFor, agentFilesState, safeIdeTargetStateFor, hookScriptReady, miswiredGuardCommand, gitHookState, legacyModuleActions, legacyProductActions, renamedNameHits, PRODUCT_CHECK_WORKFLOWS, productProfileEffect, workflowsPassingProduct, productGateBlockers, oldProfileAdvice, gateProfileFix } from './plan.mjs';
11
+ import { mergeHookSettings, hookMatcherFires, ideTargetsFor, agentFilesState, safeIdeTargetStateFor, hookScriptReady, miswiredGuardCommand, gitHookState, localSetupNoticeStates, localSetupNoticeAdvice, noticeCopyState, legacyModuleActions, legacyProductActions, renamedNameHits, PRODUCT_CHECK_WORKFLOWS, productProfileEffect, workflowsPassingProduct, productGateBlockers, oldProfileAdvice, gateProfileFix } from './plan.mjs';
12
12
  import { hasSiblingRepo, workspaceFileState, WORKSPACE_FILE } from './find-product.mjs';
13
13
  import { planMigration } from './migrate.mjs';
14
14
  import { ACTION_DIALS, ADVANCE_VALUES, isGateStep, killSwitchOn, loadAutomation, stepDef as catalogueStep, loadLedger, owedSteps, epicIds, epicRel, epicRoot, FOUNDATION_DIR, FOUNDATION_EPIC, DISCOVERY_EPIC, staleFoundationGuards, unwrittenSections, artifactBase, artifactAgrees, epicStories, laneStarted, isValidEpicId, epicLineage, isGenesisType, readFrontmatter, resolveThread, stateInvariants, contractSurfaceHash, doneStepUnapproved, workItemType, WORK_ITEM_TYPES, themeOf, themeKey, stepPhase, stepDef, matchLifecycleProfile, lifecycleProfile, LIFECYCLE_PROFILES, SENTINELS, normalizeBindings, stepsReadingBinding, optionalStepsFor, isSkippableStep, recordedRouteDisagrees, isPassed, stepStatus, claimsSkipped, STEP_STATES, isStepRecord, RECORDED_STEP_STATES, productDriftPairs } from './epic-state.mjs';
@@ -32,9 +32,11 @@ import { readOwners } from './owners.mjs';
32
32
  import { readMembers, judgedMemberFiles } from './members.mjs';
33
33
  import { loadChoices, readToolboxFile } from './toolbox.mjs';
34
34
  import { signingDoctorLine } from './signing.mjs';
35
+ import { localSetupWaiting } from './local-setup.mjs';
35
36
  import { nodePins, satisfies, nodeFix, dockerReasons, dockerState, glabConfigs } from './machine.mjs';
36
37
  import { allStoryFrames, FRAMES_KEY } from './story-frames.mjs';
37
38
  import { previewPattern, PREVIEW_KEY } from './preview.mjs';
39
+ import { readBrand, contrastProblems, brandPath, sourceFingerprint, BRAND_FILE } from './brand.mjs';
38
40
 
39
41
  // The design, testing and learning rows (E165 follow-up). The files are the team's, committed: `source` says
40
42
  // what was found on the machine of whoever refreshed last, so a row says what was RECORDED, and the refresh
@@ -124,6 +126,19 @@ export function signingChecks(checks, root) {
124
126
  check(checks, 'signing', 'environment', line.status, line.message, line.hint, { alwaysHint: true });
125
127
  }
126
128
 
129
+ // E185 — this machine against the Product's local setup script: the steps not answered for yet. The same cheap
130
+ // reading `yad guide` makes (no gh, no network); `yad local-setup` runs every check. Silent with no script.
131
+ export function localSetupChecks(checks, root) {
132
+ const w = localSetupWaiting(root);
133
+ if (!w) return;
134
+ if (w.error) { check(checks, 'local-setup', 'environment', 'warn', `local setup: ${forTerminal(w.error)}`, 'fix it, or restore it from git; `yad local-setup` says more'); return; }
135
+ if (w.recordError) check(checks, 'local-setup-record', 'environment', 'warn', `local setup: this machine's record ${w.recordError} — read as empty, so every step is asked again`, 'delete it (inside .git/yad/): it only remembers which steps you did or said no to');
136
+ const ids = [...w.pending, ...w.ask];
137
+ if (!ids.length) return;
138
+ check(checks, 'local-setup', 'environment', 'warn', `local setup: ${ids.length} step(s) for this machine are waiting for your answer: ${ids.join(', ')}${w.changed.length ? ` (${w.changed.length} changed since you answered)` : ''}`,
139
+ 'your agent can go through them with you: `yad local-setup` shows why each is needed and what it changes for you');
140
+ }
141
+
127
142
  // #352 — the machine setup local work depends on (cli/machine.mjs): the active Node against each repo's
128
143
  // pinned version, Docker where a repo asks for it, and duplicate glab config files. The Product folder and
129
144
  // every registered repo cloned here are read; the rest is not this machine's to judge.
@@ -471,6 +486,9 @@ export function projectChecks(checks, root, { headCount = null } = {}) {
471
486
  // a push to the `yad/wip/*` branches start the team's own CI?
472
487
  if (exists(productPath)) captureChecks(root, checks, readJSON(productPath, null));
473
488
  if (exists(productPath)) activityChecks(root, checks, readJSON(productPath, null));
489
+ if (exists(productPath)) brandChecks(root, checks);
490
+ // E185 part 4: this clone's notice after a pull, in either ledger mode.
491
+ if (exists(productPath)) localSetupNoticeCheck(root, checks);
474
492
  docsWorkflowChecks(root, checks);
475
493
  if (exists(productPath)) lineEndingChecks(root, checks);
476
494
 
@@ -2886,6 +2904,7 @@ export function collectDoctor(root, { headCount = null } = {}) {
2886
2904
  const checks = [];
2887
2905
  envChecks(checks);
2888
2906
  signingChecks(checks, root);
2907
+ localSetupChecks(checks, root);
2889
2908
  machineChecks(checks, root);
2890
2909
  projectChecks(checks, root, { headCount });
2891
2910
  riskMapChecks(checks, root);
@@ -3009,6 +3028,31 @@ export function captureChecks(root, checks, cfg) {
3009
3028
  }
3010
3029
  }
3011
3030
 
3031
+ // The brand (E184): which look the pages yad makes wear. No file is fine (yadflow's look); a file that cannot be
3032
+ // used, or one older than the DESIGN.md it was made from, is said — a page never breaks over it.
3033
+ export function brandChecks(root, checks) {
3034
+ const r = readBrand(root);
3035
+ // Every value from the committed file is passed through forTerminal: a teammate's file must never send
3036
+ // escape codes to the reader's terminal (review 1).
3037
+ const t = (v) => forTerminal(String(v));
3038
+ if (r.origin === 'yadflow' && !r.problems.length) { check(checks, 'brand', 'project', 'ok', `no ${BRAND_FILE} — the pages yad makes wear yadflow's look`, 'run `yad brand init` to make them wear the Product\'s own design system'); return; }
3039
+ if (r.problems.length) { check(checks, 'brand', 'project', 'warn', `${BRAND_FILE} cannot be used, so pages wear yadflow's look: ${t(r.problems[0])}${r.problems.length > 1 ? ` (and ${r.problems.length - 1} more)` : ''}`, 'see them all with `yad brand check`'); return; }
3040
+ // The same staleness `yad brand check` says: the source gone, unreadable, or changed since.
3041
+ let stale = null;
3042
+ if (r.brand.source) {
3043
+ const src = brandPath(root, r.brand.source);
3044
+ let text = null;
3045
+ try { text = src ? fs.readFileSync(src, 'utf8') : null; } catch { /* a folder, or unreadable */ }
3046
+ if (!src) stale = `its source ${t(r.brand.source)} is not in the Product any more`;
3047
+ else if (text === null) stale = `its source ${t(r.brand.source)} cannot be read`;
3048
+ else if (r.brand.sourceHash && sourceFingerprint(text) !== r.brand.sourceHash) stale = `${t(r.brand.source)} changed since ${BRAND_FILE} was made`;
3049
+ }
3050
+ if (stale) { check(checks, 'brand', 'project', 'warn', stale, 'run `yad brand init --force`, or update the brand file by hand'); return; }
3051
+ const hard = contrastProblems(r.brand);
3052
+ if (hard.length) { check(checks, 'brand', 'project', 'warn', `${BRAND_FILE}: ${hard[0]}`, 'pick a darker text or lighter background; `yad brand check` lists every pair'); return; }
3053
+ check(checks, 'brand', 'project', 'ok', `the pages yad makes wear ${t(r.brand.name)}'s brand (${BRAND_FILE})`);
3054
+ }
3055
+
3012
3056
  // The activity half (E178): off says so; on says whether the Product's own script and entries are wired, and
3013
3057
  // where the record is and how big. The code repos' entries are `yad check`'s to report, as the agent guard's are.
3014
3058
  export function activityChecks(root, checks, cfg) {
@@ -3196,6 +3240,26 @@ function gitHookCheck(root, checks) {
3196
3240
  }
3197
3241
  }
3198
3242
 
3243
+ // The notice after a pull (E185 part 4): this clone's post-merge and post-rewrite hooks. Per clone, like the
3244
+ // pre-commit hook, so a teammate's own `yad check --fix` installs them, and this row is how they find out.
3245
+ export function localSetupNoticeCheck(root, checks) {
3246
+ const cfg = readJSON(productConfigPath(root), null);
3247
+ if (cfg && cfg.localSetupNotice === false) { check(checks, 'local-setup-hook', 'project', 'ok', 'the local setup notice after a pull is turned off for this Product ("localSetupNotice": false)'); return; }
3248
+ const states = localSetupNoticeStates(root).filter((s) => s.applies);
3249
+ if (!states.length) return;
3250
+ const copy = noticeCopyState(root);
3251
+ // Every part that is not right is said, the hooks yad left alone and the ones it would install alike (review 1).
3252
+ const blocked = states.filter((s) => s.state === 'foreign' || s.state === 'hooks-path');
3253
+ const todo = states.filter((s) => s.state === 'missing' || s.state === 'outdated').map((s) => s.name);
3254
+ if (copy && copy.state !== 'ok') todo.push(`its script in git's folder (${copy.state})`);
3255
+ const byHand = states.filter((s) => s.state === 'hand-wired').map((s) => s.name);
3256
+ if (!blocked.length && !todo.length) { check(checks, 'local-setup-hook', 'project', 'ok', `the local setup notice after a pull is installed in this clone (post-merge, post-rewrite)${byHand.length ? `; ${byHand.join(' and ')} by the line in your own hook` : ''}`); return; }
3257
+ const parts = [];
3258
+ if (todo.length) parts.push(`not installed or out of date here: ${todo.join(', ')} — \`yad check --fix\` installs ${todo.length > 1 ? 'them' : 'it'}`);
3259
+ if (blocked.length) parts.push(forTerminal(localSetupNoticeAdvice(root) || ''));
3260
+ check(checks, 'local-setup-hook', 'project', 'warn', 'the local setup notice after a pull will not show in this clone', parts.join('; '));
3261
+ }
3262
+
3199
3263
  // The preview address patterns (#359), by the same rule `yad repo preview` writes with. Said only when
3200
3264
  // some repo records one: a repo with no pattern is the normal case, and its review says "locally only".
3201
3265
  export function previewChecks(checks, repoEntries) {
package/cli/guide.mjs CHANGED
@@ -33,6 +33,7 @@ import { seededSlugs } from './hook.mjs';
33
33
  import { setupQuestions } from './setup.mjs';
34
34
  import { reposBeside, insideGitRepo, PRODUCT_DIR } from './workspace.mjs';
35
35
  import { PREAPPROVED } from './agent-guard.mjs';
36
+ import { localSetupWaiting } from './local-setup.mjs';
36
37
 
37
38
  export const GUIDE_VERSION = 1;
38
39
 
@@ -392,7 +393,23 @@ export function installState(root, running = VERSION) {
392
393
  return { project: product?.version ?? null, yadflow: running, behind: rows.some((r) => r.behind) ? true : product?.behind ?? null, repos: rows.filter((r) => r.behind) };
393
394
  }
394
395
 
395
- function upkeepFor(install, { platform }) {
396
+ // The update first (an older yad misreads the files), then this machine's local setup steps (E185).
397
+ function upkeepFor(install, { platform, root }) {
398
+ const update = updateUpkeep(install, { platform });
399
+ const waiting = root ? localSetupWaiting(root) : null;
400
+ if (!waiting) return update;
401
+ const ids = [...waiting.pending, ...waiting.ask];
402
+ const why = waiting.error ? `the local setup script cannot be read (${forTerminal(waiting.error)}): read what it says, and tell the person`
403
+ : ids.length ? `steps for this machine are waiting (${ids.join(', ')}): follow the local-setup rule — show the person each step's \`purpose\`, \`impact\` and \`commands\`, run one only after their yes, then record it with \`yad local-setup done\` or \`skip\``
404
+ : 'this machine\'s local setup record cannot be read: show the person the warning it prints';
405
+ return {
406
+ agent: [...(update?.agent ?? []), agentRun('yad local-setup list --json', why)],
407
+ person: update?.person ?? [],
408
+ localSetup: waiting,
409
+ };
410
+ }
411
+
412
+ function updateUpkeep(install, { platform }) {
396
413
  if (!install.behind) return null;
397
414
  const which = install.repos.map((r) => (r.repo === 'product' ? 'the Product' : r.repo)).join(', ');
398
415
  if (!platform) {
@@ -443,7 +460,7 @@ export function buildGuide(root, { epic = null, cwd = root ?? process.cwd(), run
443
460
  const situation = { stage: 'ready', product: rel, platform, ledger: platform && verified ? 'verified' : 'local', solo, here: m.here ?? null, install };
444
461
  if (!m.setUp) return { ...base, situation: { ...situation, stage: 'no-product' }, ...noProduct(cwd, root) };
445
462
  // Upkeep rides every answer about this Product until it is done.
446
- base.upkeep = upkeepFor(install, { platform });
463
+ base.upkeep = upkeepFor(install, { platform, root });
447
464
 
448
465
  const ctx = { verified, platform, solo };
449
466
  const chosen = epic ?? m.here?.epic ?? null;
@@ -504,7 +521,13 @@ export function buildGuide(root, { epic = null, cwd = root ?? process.cwd(), run
504
521
  export function printGuide(g) {
505
522
  const s = g.step;
506
523
  if (g.upkeep) {
507
- log(`\n ${c.bold(`Upkeep first: yadflow is v${g.situation.install.yadflow}, and ${g.situation.install.repos.map((r) => `${r.repo} is on v${r.version ?? '?'}`).join(', ')}.`)}`);
524
+ const install = g.situation.install;
525
+ if (install?.behind) log(`\n ${c.bold(`Upkeep first: yadflow is v${install.yadflow}, and ${install.repos.map((r) => `${r.repo} is on v${r.version ?? '?'}`).join(', ')}.`)}`);
526
+ const ls = g.upkeep.localSetup;
527
+ if (ls) {
528
+ const n = ls.pending.length + ls.ask.length;
529
+ log(`\n ${c.bold(n ? `Local setup: ${n} step(s) for this machine are waiting for your answer.` : 'Local setup: something could not be read.')}`);
530
+ }
508
531
  for (const a of g.upkeep.agent) hand(`${c.bold(a.run)} ${c.dim(`— ${a.why}`)}`);
509
532
  for (const p of g.upkeep.person) for (const st of p.steps) info(st);
510
533
  }
package/cli/issues.mjs CHANGED
@@ -10,6 +10,7 @@
10
10
  // Status is worked out from facts (open or closed, and later the linked epic). A `status:` label is never read.
11
11
  import fs from 'node:fs';
12
12
  import { run, readJSON, forTerminal, c, log, fail, hand, info, note, warn } from './lib.mjs';
13
+ import { brandForPage } from './brand.mjs';
13
14
  import { productConfigPath } from './manifest.mjs';
14
15
  import { platformLogin } from './platform.mjs';
15
16
  import { readMembers, productIdentity } from './members.mjs';
@@ -321,7 +322,12 @@ const options = (values) => values.map((v) => `<option value="${esc(lower(v))}">
321
322
 
322
323
  // One self-contained file. The table is written here, escaped, and reads with scripting off. The script only
323
324
  // hides and re-orders those rows using their data attributes; it never builds markup from an item's text.
324
- export function renderHtml(m, rules = labelRules(null)) {
325
+ // The page with the Product's brand (E184) added after its own CSS, so the brand's colours and fonts win.
326
+ export function renderHtml(m, rules = labelRules(null), { brandCss = '' } = {}) {
327
+ const html = renderHtmlPage(m, rules);
328
+ return brandCss ? html.replace('</style>', () => `\n${brandCss}\n</style>`) : html;
329
+ }
330
+ function renderHtmlPage(m, rules = labelRules(null)) {
325
331
  const people = [...new Set(m.items.flatMap((i) => i.assignees.map((a) => a.member || a.login)))].sort();
326
332
  // #514: every other label seen, once each (the first spelling met), for the Label filter.
327
333
  const labelNames = [...new Map(m.items.flatMap((i) => othersOf(i, rules)).map((l) => [lower(l), l]).reverse()).values()].sort((a, b) => lower(a).localeCompare(lower(b)));
@@ -342,7 +348,7 @@ export function renderHtml(m, rules = labelRules(null)) {
342
348
  const select = (id, label, opts) => `<label>${label}<select id="${id}"><option value="">All</option>${opts}</select></label>`;
343
349
  const missing = gaps(m);
344
350
  return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
345
- <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'">
351
+ <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; img-src data:; font-src data:">
346
352
  <title>Issues and work items</title><style>
347
353
  :root{--bg:#fff;--fg:#1d2026;--dim:#5d6470;--card:#f6f7f9;--line:#e1e4ea;--link:#0b57d0;--warn:#8a4b00;--p0:#b3261e;--p1:#b3541e}
348
354
  @media (prefers-color-scheme:dark){:root{--bg:#0f1115;--fg:#e6e8ee;--dim:#9aa0ad;--card:#181b22;--line:#2b303a;--link:#8ab4f8;--warn:#f0b35a;--p0:#f28b82;--p1:#f6ae74}}
@@ -437,7 +443,7 @@ export async function runIssuesList(root, { priority = null, type = null, status
437
443
  if (format) {
438
444
  // E180: with no --out, saved in the local reports folder, named by the repos it covers and its count.
439
445
  const scope = repo ? list(repo).join(' ') : 'all repos';
440
- const saved = writeOrSave(root, { out, kind: 'issues', scope, state: `${items.length} items`, ext: format, content: format === 'md' ? renderMarkdown(model, rules) : renderHtml(model, rules), command: 'issues list', env });
446
+ const saved = writeOrSave(root, { out, kind: 'issues', scope, state: `${items.length} items`, ext: format, content: format === 'md' ? renderMarkdown(model, rules) : renderHtml(model, rules, { brandCss: brandForPage(root, 'issues').css }), command: 'issues list', env });
441
447
  if (saved.problem) return refuse(saved.problem);
442
448
  for (const w of saved.warnings) warn(w);
443
449
  const dest = saved.file;
@@ -17,7 +17,7 @@ import { createHash, randomBytes, timingSafeEqual } from 'node:crypto';
17
17
  import { spawnSync } from 'node:child_process';
18
18
  import { writePlain } from './brain.mjs';
19
19
 
20
- export const CSP = "default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'";
20
+ export const CSP = "default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src data:; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'";
21
21
  export const BASE_HEADERS = Object.freeze({
22
22
  'Content-Security-Policy': CSP,
23
23
  'X-Content-Type-Options': 'nosniff',
@@ -99,7 +99,7 @@ export function inlineSnapshot({ shell, scripts, css, dataId, data }) {
99
99
  "default-src 'none'",
100
100
  `script-src ${scripts.map((s) => `'sha256-${sha256b64(s)}'`).join(' ')}`,
101
101
  `style-src 'sha256-${sha256b64(css)}'`,
102
- "img-src data:", "base-uri 'none'", "form-action 'none'",
102
+ "img-src data:", "font-src data:", "base-uri 'none'", "form-action 'none'",
103
103
  ].join('; ');
104
104
  // The key placeholder goes before anything is spliced in: the data's own names may hold the same text.
105
105
  const page = shell.replaceAll('__TOKEN__', '');