@jonandev/longbeard 0.11.2 → 0.12.1

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 (94) hide show
  1. package/AGENTS.md +4 -5
  2. package/CHANGELOG.md +72 -0
  3. package/README.md +64 -43
  4. package/beard.json +124 -28
  5. package/bin/long-beard.js +171 -36
  6. package/package.json +1 -1
  7. package/skills/design/SKILL.md +51 -126
  8. package/skills/design-brief/SKILL.md +146 -0
  9. package/skills/design-brief/references/graphic.md +59 -0
  10. package/skills/design-check/SKILL.md +27 -11
  11. package/skills/design-check/references/design-rules.md +21 -7
  12. package/skills/design-check/scripts/capture.mjs +121 -37
  13. package/skills/design-check/scripts/contrast.mjs +23 -9
  14. package/skills/design-check/scripts/rules.mjs +613 -0
  15. package/skills/design-check/scripts/screen-contrast.mjs +428 -0
  16. package/skills/design-check/scripts/tokens.mjs +346 -0
  17. package/skills/design-content/SKILL.md +118 -0
  18. package/skills/design-content/scripts/contact-sheet.mjs +259 -0
  19. package/skills/design-content/scripts/pictures.mjs +197 -0
  20. package/skills/design-direction/SKILL.md +115 -200
  21. package/skills/design-direction/references/controls.md +58 -0
  22. package/skills/{design → design-direction}/references/design-rules.md +21 -7
  23. package/skills/design-direction/references/five-second.md +47 -0
  24. package/skills/design-direction/references/full-build.md +19 -0
  25. package/skills/design-direction/references/graphic.md +35 -0
  26. package/skills/design-direction/references/grid.md +114 -0
  27. package/skills/design-direction/references/library.md +75 -0
  28. package/skills/design-direction/references/screen-template.html +233 -0
  29. package/skills/design-direction/references/subject.md +33 -0
  30. package/skills/design-direction/scripts/capture.mjs +121 -37
  31. package/skills/design-direction/scripts/contact-sheet.mjs +18 -7
  32. package/skills/design-direction/scripts/fonts.mjs +276 -0
  33. package/skills/design-direction/scripts/layout-diff.mjs +118 -0
  34. package/skills/design-direction/scripts/measure.mjs +1728 -0
  35. package/skills/design-direction/scripts/moodboard.mjs +123 -32
  36. package/skills/design-direction/scripts/picture-cast.mjs +270 -0
  37. package/skills/design-direction/scripts/pictures.mjs +197 -0
  38. package/skills/design-direction/scripts/screen-contrast.mjs +428 -0
  39. package/skills/design-direction/scripts/sheet.mjs +67 -0
  40. package/skills/design-direction/scripts/subject-colours.mjs +410 -0
  41. package/skills/design-families/SKILL.md +138 -0
  42. package/skills/design-families/scripts/contact-sheet.mjs +259 -0
  43. package/skills/design-families/scripts/families.mjs +606 -0
  44. package/skills/design-families/scripts/measure.mjs +1728 -0
  45. package/skills/design-families/scripts/moodboard.mjs +467 -0
  46. package/skills/design-families/scripts/tag.mjs +289 -0
  47. package/skills/design-figma/SKILL.md +69 -0
  48. package/skills/design-figma/references/graphic.md +26 -0
  49. package/skills/design-identity/SKILL.md +134 -0
  50. package/skills/design-identity/references/graphic.md +8 -0
  51. package/skills/design-identity/references/identity-board.html +140 -0
  52. package/skills/{design → design-identity}/scripts/capture.mjs +121 -37
  53. package/skills/design-identity/scripts/colours.mjs +213 -0
  54. package/skills/design-identity/scripts/contrast.mjs +41 -0
  55. package/skills/design-identity/scripts/fonts.mjs +276 -0
  56. package/skills/design-identity/scripts/measure.mjs +1728 -0
  57. package/skills/design-identity/scripts/sheet.mjs +67 -0
  58. package/skills/design-identity/scripts/subject-colours.mjs +410 -0
  59. package/skills/design-moodboard/SKILL.md +184 -0
  60. package/skills/design-moodboard/references/graphic.md +25 -0
  61. package/skills/{design-direction → design-moodboard}/references/sources.md +21 -11
  62. package/skills/design-moodboard/scripts/capture.mjs +893 -0
  63. package/skills/design-moodboard/scripts/contact-sheet.mjs +259 -0
  64. package/skills/design-moodboard/scripts/crops.mjs +256 -0
  65. package/skills/design-moodboard/scripts/dribbble-cards.mjs +418 -0
  66. package/skills/design-moodboard/scripts/families.mjs +606 -0
  67. package/skills/design-moodboard/scripts/group.mjs +221 -0
  68. package/skills/design-moodboard/scripts/measure.mjs +1728 -0
  69. package/skills/design-moodboard/scripts/moodboard.mjs +467 -0
  70. package/skills/{design-direction → design-moodboard}/scripts/picker.mjs +121 -20
  71. package/skills/design-moodboard/scripts/pictures.mjs +197 -0
  72. package/skills/design-moodboard/scripts/tag.mjs +289 -0
  73. package/skills/design-prototype/SKILL.md +149 -0
  74. package/skills/design-prototype/references/design-md-template.md +82 -0
  75. package/skills/design-prototype/references/design-rules.md +203 -0
  76. package/skills/design-prototype/references/five-second.md +47 -0
  77. package/skills/design-prototype/references/graphic.md +27 -0
  78. package/skills/design-prototype/scripts/capture.mjs +893 -0
  79. package/skills/design-prototype/scripts/contrast.mjs +41 -0
  80. package/skills/design-prototype/scripts/links.mjs +308 -0
  81. package/skills/design-prototype/scripts/pictures.mjs +197 -0
  82. package/skills/design-prototype/scripts/rules.mjs +613 -0
  83. package/skills/design-prototype/scripts/screen-contrast.mjs +428 -0
  84. package/skills/design-prototype/scripts/sheet.mjs +67 -0
  85. package/skills/design-prototype/scripts/tokens.mjs +346 -0
  86. package/skills/design-wordmark/SKILL.md +65 -0
  87. package/skills/design-wordmark/scripts/capture.mjs +893 -0
  88. package/skills/design-wordmark/scripts/sheet.mjs +67 -0
  89. package/skills/framework-skills/SKILL.md +71 -0
  90. package/skills/idea/SKILL.md +13 -7
  91. package/skills/idea/references/graphic.md +64 -0
  92. package/skills/design/references/design-md-template.md +0 -58
  93. package/skills/design/scripts/contrast.mjs +0 -27
  94. package/skills/design-direction/scripts/dribbble-cards.mjs +0 -356
@@ -0,0 +1,289 @@
1
+ #!/usr/bin/env node
2
+ // The agent's eye, written down in one fixed vocabulary of two layers, so what
3
+ // numbers cannot see (a photograph, a 3D render, chrome lettering) counts when
4
+ // families are sorted, and a brief can pick references by what they are for.
5
+ // Tags live in profiles.json beside the measurements. No dependencies.
6
+ //
7
+ // node tag.mjs .longbeard/design/<step>/profiles.json --sheets <scratch>/tag
8
+ // Contact sheets of the references not yet tagged, 16 a sheet, 4 across, and
9
+ // both layers' words. Open each sheet, write one row per reference into a TSV.
10
+ // node tag.mjs .longbeard/design/<step>/profiles.json tags.tsv
11
+ // Check every word against its field and merge the rows into the profiles.
12
+ //
13
+ // Two layers. The look (VOCABULARY: picture, photo, type, weight, layout,
14
+ // colour, surface, scale, motion) is how a reference looks, and families.mjs
15
+ // sorts on it; it is stored in profile.tags. The about layer (ABOUT: format,
16
+ // domain, mood, hue, density, shows) is what a reference is and is for, and
17
+ // what the picture shows: it is stored in profile.about and checked like the
18
+ // look, but never sorted on.
19
+ //
20
+ // A row, as before: name<TAB>picture<TAB>photo<TAB>type<TAB>weight<TAB>layout<TAB>colour<TAB>surface<TAB>scale[<TAB>note]
21
+ // Or a header row first, naming its columns in any order, so motion and the
22
+ // about fields can be given: name<TAB>picture<TAB>…<TAB>scale<TAB>motion<TAB>format<TAB>domain<TAB>note
23
+ // The eight look fields above are required; motion, the about fields and the
24
+ // note are optional, and an empty cell means not given. A header without a
25
+ // note column still takes one extra cell at the end of a row as the note.
26
+ // Two values in one field are joined with +, the main one first: photo+lettering.
27
+ // The note is a few words of what is seen ("chrome 3D wordmark, pixel fill"):
28
+ // it is not sorted on, but it names families and reads into the library.
29
+ //
30
+ // A tag line: both layers as one flat line of words, the way people keep a
31
+ // reference's tags by hand, easy to edit and to search:
32
+ // photo serif weight:bold split muted grain large kinetic · web-hero fashion calm red airy portrait
33
+ // parseTagLine and formatTagLine read and write it, so every tool reads a line
34
+ // the same way. Words split on whitespace and ·. A word belongs to its field
35
+ // when it is in exactly one field across both layers; a word in two or more
36
+ // (none, ui, collage, mono, duotone, bold, editorial today: AMBIGUOUS) is
37
+ // written field:word, as type:mono or mood:editorial, and bare it is refused.
38
+ // Two words for one field are both written, the main one first. none is left
39
+ // out of a line, and a line without picture, photo or motion reads them as none.
40
+ // A header may name one more column, line, holding a tag line for the fields
41
+ // the cells leave empty; the eight look fields are then required from the two
42
+ // together, and an unknown or ambiguous word in it refuses the merge.
43
+ import { spawnSync } from "node:child_process";
44
+ import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
45
+ import { basename, dirname, join, resolve } from "node:path";
46
+ import { fileURLToPath } from "node:url";
47
+
48
+ export const VOCABULARY = {
49
+ picture: {
50
+ photo: "a photograph",
51
+ illustration: "drawn or painted scenes, characters, objects",
52
+ render: "3D: rendered objects, glass, clay, blobs",
53
+ lettering: "the type itself is the picture",
54
+ ui: "screens of a product, a device mock-up",
55
+ product: "an object cut out on the ground, packshot",
56
+ pattern: "a repeat: grid, dots, lines, tiles",
57
+ icon: "small symbols: icons, logos, emoji, pictograms",
58
+ shape: "solid flat shapes or colour blocks, no drawing in them",
59
+ collage: "cut-outs, stickers, layered scraps",
60
+ none: "no picture: type and ground only",
61
+ },
62
+ photo: { colour: "colour photographs", mono: "black and white", duotone: "one or two tints", none: "no photographs" },
63
+ type: { serif: "serif", sans: "sans serif", mono: "monospaced", display: "a display face: wide, decorative, rounded", condensed: "narrow display", outline: "outlined letters", script: "handwriting or script", mixed: "two kinds, both prominent" },
64
+ weight: { thin: "thin or light", regular: "regular", bold: "bold", black: "black, heaviest" },
65
+ layout: {
66
+ centred: "one centred stack",
67
+ left: "aligned left, ragged right",
68
+ split: "two halves or columns",
69
+ grid: "cards or tiles in a grid",
70
+ "full-bleed": "one picture fills the screen",
71
+ collage: "overlapping pieces at angles",
72
+ scattered: "items floating apart",
73
+ "edge-type": "type runs off the edges",
74
+ },
75
+ colour: { neutral: "black, white, greys", muted: "soft, dusty, low saturation", "one-accent": "neutral plus one loud colour", bright: "saturated grounds or shapes", multi: "many colours", pastel: "pale, soft tints", dark: "dark-mode grounds", duotone: "two colours only" },
76
+ surface: { flat: "flat fills", grain: "grain, noise, paper", glossy: "shine, glass, reflections", "hand-drawn": "lines by hand", glow: "glows, soft gradients", chrome: "metal, chrome" },
77
+ // How big the largest type is. A live page measures it; a picture alone (a Figma board, a folder) only has this.
78
+ scale: { quiet: "the largest type is near the body size", heading: "a clear headline, well under a third of the width", large: "the headline dominates the screen", huge: "type fills the screen or runs off it" },
79
+ // Optional: what moves, for a gif, a video or a live page. Not given on a still is not given, not none.
80
+ motion: { none: "nothing moves", kinetic: "type or shapes moving", "blur-grain": "blur, grain, light leaks", ui: "interface transitions", repetition: "looping or repeated elements" },
81
+ };
82
+ // What a reference is and is for: stored in profile.about and checked, never sorted on.
83
+ const words = (list) => Object.fromEntries(list.split(" ").map((w) => [w, w.replace(/-/g, " ")]));
84
+ export const ABOUT = {
85
+ format: words("web-hero web-page web-section app-screens dashboard poster editorial cover logo-mark packaging social-post brand-system type-specimen palette pattern-icons merch-stickers deck-slides print-collateral"),
86
+ domain: words("portfolio fashion art-museum food-drink film tech-saas finance travel-outdoors education music-events beauty-wellness interiors-architecture sport-cycling agency-studio"),
87
+ mood: words("cinematic nostalgic calm playful luxe raw editorial minimal tech bold"),
88
+ hue: words("red orange lime yellow blue pink purple green teal brown-ochre"),
89
+ density: { airy: "much room", balanced: "room and matter even", dense: "packed" },
90
+ // What the picture shows.
91
+ // What the picture shows. Not "subject": that word is the product's own world, in design-direction.
92
+ shows: words("portrait close-crop landscape still-life classical-art cutout type-only"),
93
+ };
94
+ // Every look field; the first eight are required in every row, and are the old row's columns in order.
95
+ export const FIELDS = Object.keys(VOCABULARY);
96
+ export const REQUIRED = FIELDS.filter((f) => f !== "motion");
97
+ const OPTIONAL = ["motion"];
98
+ const ABOUT_FIELDS = Object.keys(ABOUT);
99
+ const vocabOf = (field) => VOCABULARY[field] || ABOUT[field];
100
+
101
+ // Every word, and the fields across both layers that hold it.
102
+ const FIELDS_OF = new Map();
103
+ for (const [field, vocab] of [...Object.entries(VOCABULARY), ...Object.entries(ABOUT)])
104
+ for (const word of Object.keys(vocab)) FIELDS_OF.set(word, [...(FIELDS_OF.get(word) || []), field]);
105
+ // The words a tag line must write as field:word.
106
+ export const AMBIGUOUS = [...FIELDS_OF].filter(([, fields]) => fields.length > 1).map(([word]) => word);
107
+ // A line that does not name these reads them as none.
108
+ const NONE_WHEN_MISSING = ["picture", "photo", "motion"];
109
+
110
+ // One flat line of words → { tags, about, unknown, ambiguous }. Nothing is dropped:
111
+ // a word that is not assigned is in unknown or ambiguous, as it was written.
112
+ export function parseTagLine(line) {
113
+ const tags = {};
114
+ const about = {};
115
+ const unknown = [];
116
+ const ambiguous = [];
117
+ const add = (field, word) => {
118
+ const layer = field in VOCABULARY ? tags : about;
119
+ if (!(layer[field] ||= []).includes(word)) layer[field].push(word);
120
+ };
121
+ for (const token of String(line || "").toLowerCase().split(/[\s·]+/).filter(Boolean)) {
122
+ const colon = token.indexOf(":");
123
+ if (colon !== -1) {
124
+ const [field, word] = [token.slice(0, colon), token.slice(colon + 1)];
125
+ if (vocabOf(field) && Object.hasOwn(vocabOf(field), word)) add(field, word);
126
+ else if (!unknown.includes(token)) unknown.push(token);
127
+ continue;
128
+ }
129
+ const fields = FIELDS_OF.get(token) || [];
130
+ if (fields.length === 1) add(fields[0], token);
131
+ else if (fields.length > 1) ambiguous.includes(token) || ambiguous.push(token);
132
+ else unknown.includes(token) || unknown.push(token);
133
+ }
134
+ for (const field of NONE_WHEN_MISSING) if (!tags[field]) tags[field] = ["none"];
135
+ // In field order, as formatTagLine writes them.
136
+ const ordered = (layer, order) => Object.fromEntries(order.filter((f) => layer[f]).map((f) => [f, layer[f]]));
137
+ return { tags: ordered(tags, FIELDS), about: ordered(about, ABOUT_FIELDS), unknown, ambiguous };
138
+ }
139
+
140
+ // { tags, about } → the line: look fields in VOCABULARY order, " · ", about fields in
141
+ // ABOUT order. none is left out; a word in two fields gets its field: prefix.
142
+ export function formatTagLine({ tags = {}, about = {} } = {}) {
143
+ // A profile stored before the field was renamed keeps its words under subject.
144
+ if (about.subject && !about.shows) about = { ...about, shows: about.subject };
145
+ const part = (layer, order) =>
146
+ order
147
+ .flatMap((field) =>
148
+ (layer[field] || []).filter((word) => word !== "none").map((word) => {
149
+ if (!Object.hasOwn(vocabOf(field), word)) throw new Error(`tag: ${field} "${word}" is not in the vocabulary: use ${Object.keys(vocabOf(field)).join(", ")}`);
150
+ return AMBIGUOUS.includes(word) ? `${field}:${word}` : word;
151
+ }),
152
+ )
153
+ .join(" ");
154
+ return [part(tags, FIELDS), part(about, ABOUT_FIELDS)].filter(Boolean).join(" · ");
155
+ }
156
+
157
+ const fail = (text) => {
158
+ console.error(`tag: ${text}`);
159
+ process.exit(1);
160
+ };
161
+
162
+ function main() {
163
+ const args = process.argv.slice(2);
164
+ const at = args.indexOf("--sheets");
165
+ const sheetsArg = at === -1 ? "" : (args.splice(at, 2)[1] ?? "");
166
+ const [profilesArg, tagsArg] = args;
167
+ if (!profilesArg || (!sheetsArg && !tagsArg) || (sheetsArg && tagsArg)) {
168
+ console.error("usage: node tag.mjs profiles.json --sheets <dir> | node tag.mjs profiles.json tags.tsv");
169
+ process.exit(2);
170
+ }
171
+ if (!existsSync(profilesArg)) fail(`no profiles at ${profilesArg}: make them with measure.mjs --profiles`);
172
+ const store = JSON.parse(readFileSync(profilesArg, "utf8"));
173
+ const refs = store.refs || {};
174
+
175
+ if (sheetsArg) {
176
+ const todo = Object.entries(refs).filter(([, p]) => !p.tags && p.shot && existsSync(p.shot));
177
+ if (!todo.length) return console.log("every reference is tagged");
178
+ mkdirSync(sheetsArg, { recursive: true });
179
+ const lists = [];
180
+ for (let i = 0; i < todo.length; i += 16) {
181
+ const list = join(sheetsArg, `untagged-${String(i / 16 + 1).padStart(2, "0")}.tsv`);
182
+ writeFileSync(list, `${todo.slice(i, i + 16).map(([name, p]) => `${name}\t${resolve(p.shot)}`).join("\n")}\n`);
183
+ lists.push(list);
184
+ }
185
+ const sheet = join(dirname(fileURLToPath(import.meta.url)), "contact-sheet.mjs");
186
+ for (const list of lists) {
187
+ const r = spawnSync(process.execPath, [sheet, list, "--out", join(sheetsArg, basename(list, ".tsv")), "--per", "16", "--cols", "4", "--contain"], { encoding: "utf8" });
188
+ if (r.status !== 0) fail(r.stderr || "contact-sheet.mjs failed");
189
+ process.stdout.write(r.stdout);
190
+ }
191
+ console.log(`\n${todo.length} to tag. A header row, then one row each: name\t${[...FIELDS, ...ABOUT_FIELDS].join("\t")}\tnote`);
192
+ console.log(`Required: ${REQUIRED.join(", ")}. Optional, an empty cell when not seen: ${[...OPTIONAL, ...ABOUT_FIELDS].join(", ")}, note.`);
193
+ console.log("\nThe look (sorted on):");
194
+ for (const field of FIELDS) console.log(`${field}: ${Object.entries(VOCABULARY[field]).map(([w, what]) => `${w} (${what})`).join(", ")}`);
195
+ console.log("\nWhat it is and is for (stored, never sorted on):");
196
+ for (const field of ABOUT_FIELDS) console.log(`${field}: ${Object.keys(ABOUT[field]).join(", ")}`);
197
+ console.log(`\nOr a line column, one tag line for both layers (look · about). Write ${AMBIGUOUS.join(", ")} as field:word; leave none out.`);
198
+ return;
199
+ }
200
+
201
+ if (!existsSync(tagsArg)) fail(`no tags at ${tagsArg}`);
202
+ const problems = [];
203
+ let merged = 0;
204
+ // Columns: the old row's order until a header row names them.
205
+ let columns = null;
206
+ for (const [n, line] of readFileSync(tagsArg, "utf8").split(/\r?\n/).entries()) {
207
+ if (!line.trim()) continue;
208
+ const cells = line.split("\t").map((x) => x.trim());
209
+ if (cells[0] === "name") {
210
+ // "subject" was this column's first name: read it as shows.
211
+ columns = cells.slice(1).map((c) => (c === "subject" ? "shows" : c));
212
+ const known = new Set([...FIELDS, ...ABOUT_FIELDS, "note", "line"]);
213
+ const unknown = columns.filter((c) => !known.has(c));
214
+ // With a line column, the look fields the header leaves out come from the line.
215
+ const missing = columns.includes("line") ? [] : REQUIRED.filter((f) => !columns.includes(f));
216
+ const twice = columns.filter((c, i) => columns.indexOf(c) !== i);
217
+ if (unknown.length) problems.push(`line ${n + 1}: header names ${unknown.join(", ")}: use ${[...FIELDS, ...ABOUT_FIELDS].join(", ")}, note, line`);
218
+ if (missing.length) problems.push(`line ${n + 1}: header has no ${missing.join(", ")}: every row needs ${REQUIRED.join(", ")}`);
219
+ if (twice.length) problems.push(`line ${n + 1}: header names ${[...new Set(twice)].join(", ")} twice`);
220
+ continue;
221
+ }
222
+ const [name, ...values] = cells;
223
+ if (!refs[name]) {
224
+ problems.push(`line ${n + 1}: no reference called ${name}`);
225
+ continue;
226
+ }
227
+ let row;
228
+ if (!columns) {
229
+ if (values.length !== REQUIRED.length && values.length !== REQUIRED.length + 1) {
230
+ problems.push(`line ${n + 1}: ${name} has ${values.length} fields, not ${REQUIRED.length} (${REQUIRED.join(", ")}) and an optional note; a header row can name motion and the about fields`);
231
+ continue;
232
+ }
233
+ row = Object.fromEntries(REQUIRED.map((f, k) => [f, values[k]]));
234
+ row.note = values[REQUIRED.length] || "";
235
+ } else {
236
+ // A header without a note column takes one extra cell as the note; cells left off the end are empty.
237
+ const width = columns.length + (columns.includes("note") ? 0 : 1);
238
+ if (values.length > width) {
239
+ problems.push(`line ${n + 1}: ${name} has ${values.length} fields, the header names ${columns.length}`);
240
+ continue;
241
+ }
242
+ row = Object.fromEntries(columns.map((c, k) => [c, values[k] || ""]));
243
+ if (!columns.includes("note")) row.note = values[columns.length] || "";
244
+ }
245
+ if (row.line) {
246
+ // The line fills the fields its cells leave empty, read as every tool reads one.
247
+ const parsed = parseTagLine(row.line);
248
+ if (parsed.unknown.length) problems.push(`line ${n + 1}: ${name} line: ${parsed.unknown.map((w) => `"${w}"`).join(", ")} in no field`);
249
+ if (parsed.ambiguous.length) problems.push(`line ${n + 1}: ${name} line: ${parsed.ambiguous.map((w) => `"${w}" is in ${FIELDS_OF.get(w).join(", ")}: write ${FIELDS_OF.get(w).map((f) => `${f}:${w}`).join(" or ")}`).join("; ")}`);
250
+ const tokens = row.line.toLowerCase().split(/[\s·]+/);
251
+ for (const [field, given] of Object.entries({ ...parsed.tags, ...parsed.about })) {
252
+ // A none the line only reads for a missing field gives way to a filled cell.
253
+ const defaulted = given.join() === "none" && !tokens.includes(`${field}:none`);
254
+ if (!row[field]) row[field] = given.join("+");
255
+ else if (!defaulted) problems.push(`line ${n + 1}: ${name} ${field} is in its cell and in the line: give it once`);
256
+ }
257
+ }
258
+ const read = (field) => {
259
+ const given = (row[field] || "").split("+").map((w) => w.trim()).filter(Boolean);
260
+ const bad = given.filter((w) => !(w in vocabOf(field)));
261
+ if (bad.length || (!given.length && REQUIRED.includes(field))) problems.push(`line ${n + 1}: ${name} ${field} "${row[field] || ""}": use ${Object.keys(vocabOf(field)).join(", ")}`);
262
+ return given;
263
+ };
264
+ const tags = {};
265
+ for (const field of FIELDS) {
266
+ const given = read(field);
267
+ if (given.length) tags[field] = given;
268
+ }
269
+ const about = {};
270
+ for (const field of ABOUT_FIELDS) {
271
+ const given = read(field);
272
+ if (given.length) about[field] = given;
273
+ }
274
+ // Merged over what was there: a field not given keeps its words.
275
+ refs[name].tags = { ...(refs[name].tags || {}), ...tags };
276
+ if (Object.keys(about).length) {
277
+ const { subject: was, ...before } = refs[name].about || {};
278
+ refs[name].about = { ...before, ...(was && !before.shows ? { shows: was } : {}), ...about };
279
+ }
280
+ if (row.note) refs[name].note = row.note;
281
+ merged++;
282
+ }
283
+ if (problems.length) fail(`nothing merged:\n${problems.join("\n")}`);
284
+ writeFileSync(profilesArg, `${JSON.stringify(store, null, 1)}\n`);
285
+ const left = Object.values(refs).filter((p) => !p.tags).length;
286
+ console.log(`tagged ${merged}, ${left} left untagged`);
287
+ }
288
+
289
+ if (process.argv[1] && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))) main();
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: design-figma
3
+ description: >
4
+ Build the approved design in Figma: variables and styles from DESIGN.md, the
5
+ identity board on the Cover, only the components the key screens need, the
6
+ key screens and every reachable state, each checked with design-check and
7
+ marked Ready on approval. Runs when DESIGN.md exists and its screens have no
8
+ Ready frames, or for a feature's screens. Figma is required for UI projects.
9
+ ---
10
+
11
+ # Design Figma
12
+
13
+ **Needs:** `DESIGN.md`, `docs/design/design-identity.html`
14
+ **Writes:** Ready Figma frames
15
+
16
+ Figma is the truth for screens. `DESIGN.md` is the written summary of the rules behind them. This skill builds the first from the second, faithful to the approved prototype.
17
+
18
+ Load `figma-use`, `figma-generate-library` and `figma-generate-design`, and follow them. This skill adds only what they do not decide.
19
+
20
+ ## Gate
21
+
22
+ 1. No `DESIGN.md` → `design-prototype` first. Stop.
23
+ 2. No Figma connection → say Figma is required for UI projects, and stop.
24
+
25
+ A graphic (the brief's surface): read [graphic.md](references/graphic.md) first.
26
+
27
+ Open the approved prototype (`.longbeard/design/prototype/`) beside every screen you build. If it is gone, work from `DESIGN.md` and say so.
28
+
29
+ ## Rules
30
+
31
+ - **One file per product.** A new one if the project has none. Its URL goes in `DESIGN.md`.
32
+ - **Our tokens, not a kit.** Variables and styles come from `DESIGN.md`. New files can come with community kits attached; their steps say to reuse them. Do not: search the file only, and build what is missing from `DESIGN.md`. Read its tables or the token block at the top (the same tokens, written from the tables); if they differ, the tables win and `design-check` docs mode reports it.
33
+ - **Build, do not capture.** Compose screens from tokens and components. Never run `generate_figma_design` on the prototype. For pictures, create the image frames, then `upload_assets` the prototype's own files.
34
+ - **Themes are modes.** One colour collection, a mode per theme; each screen built once. If Figma refuses the modes, stop and ask.
35
+ - **Pages:** Cover, Foundations, Components, one `Screens — <flow>` per flow in the brief, `Explorations` for anything kept for later.
36
+ - **Order:** tokens and styles → the Cover board → only the components the key screens need → the key screens → their states. The library grows with features.
37
+ - **States:** a frame for each of empty, loading and error a person can reach, beside the default. One nobody can reach gets no frame: add it, with the reason, under Decisions in `DESIGN.md`.
38
+ - **Names:** `<screen> — <state>`; `<screen> · <device> — <state>` when the layout differs by device. Never the theme.
39
+ - **Components have their states:** focus and pressed for every control, before a screen uses it.
40
+ - **One text style per weight used.** A weight `DESIGN.md` lacks is a new style and a new row there.
41
+ - **Trust the file, not the picture.** Screenshot only after an edit returns, and read text back from the nodes. Re-wire a cloned variant's text properties; replace a swapped instance that keeps old overrides.
42
+ - **Stand-ins are said on the frame.** Each item under Still to supply in `DESIGN.md` gets a short note beside the frame that shows it (what is a stand-in or assumed, and what replaces it), and a stand-in picture's layer is named `… (stand-in)`. The note is not part of the design. It stays until the real one is in.
43
+ - **Finish and motion.** A static finish (a grain, a shadow, a blend) is built as fills and effects from the Finish line. Motion Figma cannot carry (scroll, physics) is a note beside the frame, from the Motion section, and not built.
44
+ - **Faithful.** Match the approved prototype. Anything that cannot be built the same way: say so and ask. Never simplify silently.
45
+ - **Check each screen** with `design-check` frame mode, passing the prototype shot. Fix its hard findings.
46
+ - **Ready:** on their yes to a frame, add `— Ready` to its name. Tickets link Ready frames.
47
+
48
+ ## The Cover: the identity board
49
+
50
+ Rebuild `docs/design/design-identity.html` on one frame, `Identity`, on the Cover page: the same board they approved, now bound to the variables and styles. Primary and secondary type at size with their names; every colour as a squircle swatch with its token name and value, for each theme. Add the wordmark if `design-wordmark` made one.
51
+
52
+ - Every fill, text and radius bound to a variable or style, so the board changes when the tokens do.
53
+ - Real copy: the name and one line in the voice. No reference's name or picture.
54
+ - Screenshot it, read the text back, and show it. A no is a change to `DESIGN.md` first, then the board again. It is not marked Ready: it is not a screen.
55
+
56
+ If a Figma decision changes a rule (a new token, a variant, a spacing step), update `DESIGN.md` in the same turn and say what changed.
57
+
58
+ ## Then
59
+
60
+ Say in two lines what they now have: a Figma file of their own, with its link, built from variables and components, so a change to a token changes every screen. They can keep working in it by hand or by asking; a change to a rule goes into `DESIGN.md` too.
61
+
62
+ Offer to delete `.longbeard/design/` working files: the docs, `DESIGN.md` and Figma carry the result. On no, leave them; they are gitignored. Then the next stage the router lists: architecture, which they start by typing `/grill-with-docs`. A design-only install has none, and ends here.
63
+
64
+ ## Do not
65
+
66
+ - Use a community kit's components or variables.
67
+ - Build the whole component library before the screens need it.
68
+ - Mark a frame Ready that lacks a reachable state or has open hard findings.
69
+ - Name a reference in a layer, description or comment.
@@ -0,0 +1,26 @@
1
+ # Figma for a graphic
2
+
3
+ Read when the product brief's surface is a graphic. Everything in `SKILL.md` holds except what is said here. A piece counts as a screen wherever the skill says screen.
4
+
5
+ A graphic's run ends here. Nothing is offered after the exported frame: no Architecture, no Plan.
6
+
7
+ ## Build
8
+
9
+ - **One frame per size.** A single piece is one frame. A set is one frame for each piece, side by side, named `<piece> — <width>×<height>`.
10
+ - **Pages:** Cover, Foundations, `Pieces`, `Explorations`. There is no `Components` page unless a set repeats a block (a footer, a date lockup) that each piece reuses. Then it holds that one component and nothing else.
11
+ - **No state frames.** A piece has no empty, loading or error. Rule 8 does not apply, so a missing state is not a finding.
12
+ - **Tokens, the Cover board, faithful build, stand-in notes, and Ready** are as in the skill. Variables and styles still come from `DESIGN.md`.
13
+ - **A print piece's frame includes the bleed** (3 mm unless they give one), with an inner frame named `Trim` where it is cut. Nothing important sits in the trim.
14
+ - **Check each frame** with `design-check` frame mode and the Graphics list in the rules.
15
+
16
+ ## What is delivered
17
+
18
+ Say it plainly, in the file's `DESIGN.md` under Decisions and to them, before the export:
19
+
20
+ - **Delivered:** each frame exported as a PNG at its size, and for print also a PDF at the trim size plus bleed. Both are RGB. The export settings are set on the frame, so they can export again.
21
+ - **Not delivered:** CMYK, spot colours, crop marks, a colour-managed proof or any prepress. Figma works in RGB. If a printer needs them, that step is done in a print tool, not here.
22
+ - **Assumptions are said and theirs to change:** the bleed (3 mm), and the print resolution the PNG scale gives (300 ppi). A scale or a size that could not be checked in the file is "not checked".
23
+
24
+ ## Then
25
+
26
+ Say in two lines what they have: the frame or frames in their own Figma file, with its link, and the exports. Offer to delete `.longbeard/design/` working files as the skill says. Then stop. Do not offer `/grill-with-docs`, even though no `GLOSSARY.md` exists.
@@ -0,0 +1,134 @@
1
+ ---
2
+ name: design-identity
3
+ description: >
4
+ Lock and refine the identity on the screen they chose in design-direction:
5
+ the type pairing and a small set of colours, starting from what that screen
6
+ was built with, with close alternatives from measured font lists, even colour
7
+ steps, their other references, the subject's pictures and anything they own,
8
+ all rendered on that screen, never picked by the agent. Ends in the identity
9
+ board: the faces at size and the colours as swatches with their values and
10
+ roles. Runs after design-direction; or for a rebrand.
11
+ ---
12
+
13
+ # Design identity
14
+
15
+ **Needs:** `docs/design/design-brief.md`, `docs/design/design-direction.md`
16
+ **Uses if there:** `docs/design/design-moodboard.md`, `docs/design/design-families.md`
17
+ **Writes:** `docs/design/design-identity.md`, `docs/design/design-identity.html`
18
+
19
+ The direction found the look by building screens from their references. This skill makes it the product's own: it starts from what the chosen screen was built with, shows close alternatives on that same screen, and locks one pairing and one palette. Every option comes from somewhere they can point to: the chosen screen, the measured lists, their references, the subject's pictures, what they own. The agent never invents a palette or picks a face by taste.
20
+
21
+ Two files come out, both committed:
22
+
23
+ - **`docs/design/design-identity.md`**: the faces and the colours with their values and roles, and why, in plain words. Its `json identity` block is what `design-prototype` builds with.
24
+ - **`docs/design/design-identity.html`**: the identity board. `design-figma` puts it on the Figma Cover.
25
+
26
+ Options and captures live in `.longbeard/design/identity/`, gitignored.
27
+
28
+ Three stops, no more: options, one refinement, the board.
29
+
30
+ ## Gate
31
+
32
+ 1. No `docs/design/design-brief.md` → `design-brief`. No `docs/design/design-direction.md` → `design-direction`. Stop, and say which.
33
+ 2. An identity exists → a change. Show the board, ask what changes, and reopen only that.
34
+
35
+ A graphic (the brief's surface): read [graphic.md](references/graphic.md) first.
36
+
37
+ Read the design brief (words, personality, feel, never, what is fixed, accessibility, voice, decides) and the direction's "Look, as built". The chosen screen is `.longbeard/design/direction/prototype/first.html`; if the private folder is gone, rebuild it from `design-direction.md` and say so. **What is fixed is fixed:** a face or colour they own is in every option; a refused one is in none; light, dark or both decides which grounds count.
38
+
39
+ **At `pace: quick`** (the design brief): no options and no refinement. The chosen screen's type and colours, as built, are the identity: check every pair with `contrast.mjs` (at the brief's level), fix a failing ink with the nearest step that passes (`colours.mjs`, with `--level AAA` when the brief asks for it); a colour they liked by name is never stepped: it stays, with its warning, and go to **3. The board**. They can ask for options at the board; that is full pace from there.
40
+
41
+ ## 1. Options, on the chosen screen, in one message
42
+
43
+ When the project brought a `DESIGN.md` with tokens (see `design`), its faces and colours come first on each sheet, "as brought", ahead of the options below, and are rendered on the chosen screen like any other. They are the person's choice and are never overruled.
44
+
45
+ **Type pairings, three to five.** A pairing is a display face and a text face. The first is the one the screen was built with.
46
+
47
+ - **Measured neighbours, never from memory:** `fonts.mjs` lists every Google Fonts face of the same kind, measured (width, x-height, darkness, stroke contrast), nearest first, each with how widely it is used.
48
+
49
+ ```
50
+ node <skill>/scripts/fonts.mjs "Newsreader" --weight 300
51
+ node <skill>/scripts/fonts.mjs "Inter" --body
52
+ node <skill>/scripts/fonts.mjs "Their Face" --kind sans --css "<its stylesheet>"
53
+ ```
54
+
55
+ - **From their other references:** a face another like uses (the library's `type`), when it suits this composition.
56
+ - At least two of the pairings use faces from beyond the hundred most used (`used` over 100), so the set is not only what every site has. A face read `by: eye` is a stand-in: say so, and offer the free faces nearest it. Every face is free to license, or theirs.
57
+
58
+ **Palettes, three to five.** A palette is three to five colours, each with a role: `ground` (a surface it can stand on), `ink` (text), `accent`. A colour can hold more than one role. The first is the one the screen was built with.
59
+
60
+ - **Even steps** around it: `colours.mjs` gives lighter, darker, warmer, cooler in OKLCH, and the derived roles, and leaves out what fails contrast.
61
+
62
+ ```
63
+ node <skill>/scripts/colours.mjs --ground "#f1ede4" --ink "#111111" --accent "#fe2601" --family "<the references' colours>" --theirs "<theirs>" --level <AA|AAA, the design brief's accessibility>
64
+ ```
65
+
66
+ - **From their other references,** the palettes in the direction's readings (`library.json`), each whole.
67
+ - **From the subject:** the light, dark and signature palettes `subject-colours.mjs .longbeard/design/pictures --level <AA|AAA>` proposes: the pictures' own colours, chosen and tuned to their roles by rule, never sampled raw. Often the most ownable, because they are the product's own world. Say for each the thing in the picture it came from ("the crust, lightened to carry white text"); a colour that cannot be named as part of the subject is not offered.
68
+ - **Theirs,** what the design brief records as owned.
69
+ - Every palette has an ink that reads on each ground at 4.5:1 (7:1 when the design brief's accessibility is AAA: `contrast.mjs --level AAA`), and an accent that holds 3:1 on at least one ground (4.5:1 at AAA). `colours.mjs` and `subject-colours.mjs` offer only what meets the level they are given, so pass it every time. A colour they liked by name is the exception: it is never stepped to pass. Fix the pair with its other colour, or move the liked one to a fill, a mark or large text; when it still fails, keep it, show the option with a warning and the ratio, and let them choose.
70
+
71
+ **Render them on the chosen screen, never list them.** The screen takes overrides in its URL, so each option is a capture, not a rebuild:
72
+
73
+ ```
74
+ node <skill>/scripts/capture.mjs "file://$PWD/.longbeard/design/direction/prototype/first.html?face=Newsreader&body=Inter&weight=300" --out .longbeard/design/identity/type-1.png --clip 0,0,1440,900
75
+ node <skill>/scripts/capture.mjs "file://$PWD/.longbeard/design/direction/prototype/first.html?ground=%23f1ede4&ink=%23111111&accent=%23fe2601" --out .longbeard/design/identity/colour-1.png --clip 0,0,1440,900
76
+ node <skill>/scripts/sheet.mjs .longbeard/design/identity/type.html .longbeard/design/identity/type-1.png … --cols 3
77
+ ```
78
+
79
+ One sheet of pairings (each on the screen's colours) and one of palettes (each on the screen's type), so each choice is seen alone and in the composition they chose. Number them, never rank them. For each, one line of where it comes from ("as built", "a narrower, darker cousin, less used", "from the bread's crust and flour"), never which is best. Where an option sits plainly against the design brief (a script face for a serious 1, a cold palette for a warm 1, its never word), add that as a fact on the same line; it stays an option.
80
+
81
+ > Pick a pairing and a palette (any mix: "type 2, colours 4"), or tell me what you're after: "warmer", "no green", "something like the type in X". "Keep" leaves the screen as built.
82
+
83
+ ## 2. One refinement
84
+
85
+ On what they picked, one row of nearby choices, rendered on the screen the same way: the display face's nearest neighbours, each colour's even steps. Or build what they asked for in words, and show it before it counts.
86
+
87
+ > Keep this, or take any from the row?
88
+
89
+ "Go" keeps what they picked.
90
+
91
+ ## 3. The board
92
+
93
+ Copy [identity-board.html](references/identity-board.html) to `docs/design/design-identity.html`, write its `IDENTITY` block (the product's real name, one line in the voice, the faces, the colours with roles), capture it, read it yourself (every face loaded, every colour shown, nothing clipped), and show it beside the chosen screen in the identity.
94
+
95
+ > Is this us?
96
+
97
+ A note reopens only that row, then the board again. A yes is the identity. When the design brief's `decides` names someone else, the board is what they confirm: give its path, and write the identity once they say it holds.
98
+
99
+ ## Write `docs/design/design-identity.md`
100
+
101
+ ~~~markdown
102
+ # Identity: <product>
103
+
104
+ ## Type
105
+ - display: <face>, <weight>, <case>, <tracking> — <why, in plain words: "narrow and dark, so one word can fill a screen">
106
+ - text: <face>, <weight> — <why>
107
+
108
+ ## Colour
109
+ | Name | Value | Role | Reads on |
110
+ |---|---|---|---|
111
+ | <name> | #… | ground | ink 17.0:1 |
112
+
113
+ ## Board
114
+ docs/design/design-identity.html
115
+
116
+ ```json identity
117
+ { "name": "…", "display": { "face": "…", "weight": 500, "case": "uppercase", "tracking": "-0.01em", "css": null },
118
+ "body": { "face": "…", "weight": 400, "css": null },
119
+ "colours": [{ "name": "…", "hex": "#…", "role": ["ground", "accent"] }] }
120
+ ```
121
+ ~~~
122
+
123
+ Contrast is checked before it is written (`contrast.mjs "#111 on #eee"`, with `--level AAA` when the design brief asks for it). Faces with a stylesheet outside Google Fonts carry its `css`. Names and values only: no reference, site or person.
124
+
125
+ Then put the identity on the chosen screen, so the prototype starts from it: in `.longbeard/design/direction/prototype/first.html`, set `LOOK` to the identity's faces and colours (the display face and weight, the body face, the ground, the ink, the accent, and any other colour by its role in `more`), and capture it once to see it holds. Nothing else in the page changes.
126
+
127
+ Then the next step in one line: `design-prototype`. If the name is only set in the display face, offer `design-wordmark` once, in the same line; no mark is a fine answer.
128
+
129
+ ## Do not
130
+
131
+ - Pick a face or a colour for them, rank options, or show one that fails contrast without saying so (a liked colour kept under the level is shown with its warning).
132
+ - List faces from memory, or describe an option instead of rendering it.
133
+ - Run more than one refinement round before the board.
134
+ - Choose spacing, layout or a logo here.
@@ -0,0 +1,8 @@
1
+ # Identity for a graphic
2
+
3
+ Read when the product brief's surface is a graphic. Everything in `SKILL.md` holds except what is said here. A piece counts as a screen wherever the skill says screen.
4
+
5
+ Nothing about the identity changes: the same steps at the design brief's pace, and the same board. Only the size of a capture does.
6
+
7
+ - **Capture at the format.** The chosen piece, `first.html`, is built at the format's working size (see the direction's graphic reference). Every `--clip 0,0,1440,900` in this skill is `--clip 0,0,<width>,<height>` of that size. The board (`design-identity.html`) is its own page and is captured as the skill says.
8
+ - **Contrast** is checked as usual, at the level in the design brief.