@jonandev/longbeard 0.11.2 → 0.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 (93) hide show
  1. package/AGENTS.md +3 -4
  2. package/CHANGELOG.md +67 -0
  3. package/README.md +63 -43
  4. package/beard.json +113 -26
  5. package/bin/long-beard.js +172 -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 +17 -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/idea/SKILL.md +13 -7
  90. package/skills/idea/references/graphic.md +64 -0
  91. package/skills/design/references/design-md-template.md +0 -58
  92. package/skills/design/scripts/contrast.mjs +0 -27
  93. 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,149 @@
1
+ ---
2
+ name: design-prototype
3
+ description: >
4
+ Design the product's key screens in the chosen direction and identity: the
5
+ first screen finished, the other key screens prototyped in one go with real
6
+ copy and pictures, every reachable state, options only where a layout really
7
+ forks. On their yes to the rendered prototype, writes DESIGN.md in one go,
8
+ contrast-checked. Runs when docs/design/design-direction.md and design-identity.md exist and there
9
+ is no DESIGN.md, or for a feature that needs screens once DESIGN.md exists.
10
+ ---
11
+
12
+ # Design prototype
13
+
14
+ **Needs:** `docs/design/design-direction.md`, `docs/design/design-identity.md`
15
+ **Uses if there:** `docs/design/design-content.md`, `docs/design/design-moodboard.md`
16
+ **Writes:** `DESIGN.md`
17
+
18
+ Comes out: a prototype they approved (in `.longbeard/design/prototype/`, gitignored), then **`DESIGN.md`**, committed, the official look. Then `design-figma`.
19
+
20
+ Read [design-rules.md](references/design-rules.md) before the first screen: it is the checklist here and in `design-check`.
21
+
22
+ ## Gate
23
+
24
+ 1. No `docs/design/design-direction.md` → `design-direction`. No `docs/design/design-identity.md` → `design-identity`. Stop, and say which.
25
+ 2. `DESIGN.md` exists with token tables (rows like `color/ink`) → **Feature loop**.
26
+ 3. Otherwise → **First pass**. A `DESIGN.md` with no token tables is one they brought: say that this writes ours, and ask before it replaces theirs.
27
+
28
+ A graphic (the brief's surface): read [graphic.md](references/graphic.md) first.
29
+
30
+ Read the brief, `docs/design/design-brief.md`, `design-identity.md`, `design-direction.md`, and `design-content.md` if it exists. The chosen first screen is `.longbeard/design/direction/prototype/first.html`. If the private folder is gone, rebuild the first screen from `design-direction.md`'s composition and the identity, and say so.
31
+
32
+ **At `pace: quick`** (the design brief): options only when they ask, never offered at a fork (build the one that follows the first screen, and name the fork). Everything else is as full: the states, contrast, the walks and the five-second check are what make it work, and quick never skips them.
33
+
34
+ ## First pass
35
+
36
+ ### 1. Finish the first screen
37
+
38
+ The chosen screen, `first.html`, is a fixed 1440×900 page built from their references: the reference, not the page. Build `.longbeard/design/prototype/home.html` (or the brief's first key screen) as a real page from it: the same composition, type, colours, finish, content and devices, responsive, on one stylesheet (and script) that every key screen shares. Keep `first.html` open beside it and compare captures at 1440: the first screen must still be the one they chose. Then finish it:
39
+
40
+ - **The faces** loaded properly at every size. A stand-in face is said again: the product ships it, or the face it stands in for.
41
+ - **Spacing:** as built, tighter and looser (the same page with its margins and gaps scaled to 0.8 and 1.25), shown on a crop where the margin and the navigation meet as well as whole. They pick.
42
+ - **The rest of the page:** what sits below the first screen, the small text, every width down to the phone. The direction's ranges hold.
43
+ - **Motion,** exactly what the design brief's `motion` line picks, and nothing beyond it. `none` is state changes only, no entrances. How much: quiet is fades only; present adds moves that guide the eye; leading makes motion part of the identity. Driven by: only the triggers it names (scroll, cursor, time). Character: each named character (physics: inertia, springs, weight; smooth: eased, calm; snappy: fast, crisp) where the line says it applies. Moments: only those it names. A pick the line leaves out is not built. Build from `design-direction.md`'s `motion:` line, within the picks. Play its base reference again from its frames or its live link (`capture.mjs <url> --out .longbeard/design/prototype/<name>-replay --frames 12`), build that motion in CSS, none of its content, and say which reference's motion was replayed. Every motion honours `prefers-reduced-motion`.
44
+ - **What waits for the prototype.** The grid screen carried only what its reference carries; `design-direction.md`'s `for the prototype` line lists the rest the first screen needs (a second action, the full list, pickup times). Place each in the composition's own system: aligned to what is there, in its type sizes, never shrinking the headline or tidying a device to make room. What does not fit the first screen goes below it or onto the screen it belongs to. Where it forks (the full list on the first screen, or one line and a link to it), build two or three options and let them choose (at `pace: quick`, the one that keeps the first screen as chosen, and name the fork).
45
+ - **The ownable**, finished from the product's own world.
46
+ - **The states** a person can reach here (empty, loading, error), and the second theme if the design brief asked for both.
47
+
48
+ ### 2. The other key screens, in one go
49
+
50
+ List them once, navigation's details first (the menu open, on scroll, on a phone):
51
+
52
+ > I'll prototype <the menu>, <screen>, <screen>. Change the list?
53
+
54
+ Then build them all, linked so they click through, in the identity and the direction. Build once and reuse: one menu, one card, one row, one heading style everywhere.
55
+
56
+ - **Layout:** where a moodboard reference shows that kind of screen, take its layout (never its content), from any family; the look is already fixed. Where none does, it follows from the first screen.
57
+ - **The direction's devices carry over.** Overlaps, collisions, crops, giant type, wide empty space: the chosen screen's moves appear on the other screens too, never tidied away. Text cropped on purpose is marked `data-crop`. Each screen gets the same light touch-up as the first: contrast where text sits, every item the screen needs and its primary action present, nothing plainly broken. A screen is not done until it reads right *and* still looks like the chosen one.
58
+ - **Density** as the design brief's `dense` asks, on every screen: how much sits on a screen, row heights, how much is shown before "more". An airy 1–2 shows less and lets it breathe; a dense 4–5 shows more per screen and keeps spacing tight.
59
+ - **Real content, complete.** Copy in the voice, the longest real names, every section a person needs to act, and everything under `for the prototype` that belongs on this screen. With `design-content.md`, follow it. Without it, fill `design-content`'s fact sheet from the brief and the design brief first, and draft only from the fields that have something in them: an empty field shrinks or drops its section, and you say what they must supply. Each rhetorical device appears once on a screen. A detail you assumed is marked as assumed (see the prototype's stand-in marks). Say the copy is a draft. Pictures: theirs, or the stand-ins of the product's own subject in `.longbeard/design/pictures/` (more with `pictures.mjs`, or a full set planned with `design-content`); never grey boxes, never the references' subject.
60
+ - **States,** once a screen is settled: empty, loading and error where reachable (`?state=empty`), every width, each theme.
61
+
62
+ - **Marked, not hidden.** Anything a screen shows that the product does not really have yet carries a mark in the markup: `data-standin="picture"` on a stand-in picture, `data-standin="fact"` on a price, hour, number or name the brief and `design-content.md` do not give, with `data-standin-note` for what is assumed. A picture and a fact of theirs carry nothing.
63
+
64
+ A pattern that brings a feature the brief does not have is named when shown: kept, it is a product change (`idea`, Change) before `DESIGN.md`.
65
+
66
+ ### 3. Show it, and name the forks
67
+
68
+ Give the paths and say what each screen is made of. Name every fork: a screen the references arrange in clearly different ways, or one where you had to choose. Never pick among them silently.
69
+
70
+ > Click through. Want options anywhere? I'd offer them for <forks>.
71
+
72
+ **Options, only at a fork or when asked:** two to four layouts, each from a different reference (or one that follows the first screen), built inside the prototype, captured on one sheet (`sheet.mjs`), never ranked. They pick, mix or ask for more. Nothing fits → `design-moodboard`, one piece, then back.
73
+
74
+ ### 4. Self-check
75
+
76
+ Capture every screen and state at desktop and phone, each theme:
77
+
78
+ ```
79
+ node <skill>/scripts/capture.mjs "file://$PWD/.longbeard/design/prototype/home.html?capture" --out <scratch>/home.png
80
+ node <skill>/scripts/capture.mjs "file://$PWD/.longbeard/design/prototype/home.html?capture" --out <scratch>/home-phone.png --width 390
81
+ node <skill>/scripts/screen-contrast.mjs "file://$PWD/.longbeard/design/prototype/home.html" --wait-title ready
82
+ ```
83
+
84
+ `screen-contrast.mjs` reads the whole page down to `--max-height` (10000 px), and takes `--level AAA` at that brief. Say in the self-check where it stopped if it did not reach the bottom, and list every text it printed as "not read" (a colour it could not resolve, a fill clipped to the letters): those are unchecked, not passed. Exit 1 is a failing text, 3 is a run that did not finish.
85
+
86
+ Check them against the rules: Idea first, then hard (structure, contrast, targets, focus, states, labels), then soft. Fix what fails before they see it.
87
+
88
+ **Run the rules script** on every screen and state, in each theme. It measures what a browser can: sideways scroll at phone width, small targets, inputs without a visible label, a focus that shows nothing, placeholder copy and clipped text.
89
+
90
+ ```
91
+ node <skill>/scripts/rules.mjs "file://$PWD/.longbeard/design/prototype/home.html" --screen home
92
+ ```
93
+
94
+ It prints findings in `design-check`'s table, each with its rule. Fix every hard one. Words cut off on purpose, the look's own crop, carry `data-crop` in the markup and are skipped; any other cut word is a finding. Fix what it found after every run, then run it again: two runs with no fix between are one round, and so is a first run of another state of the same screen (`?menu=open`, the same `--screen`). The script counts rounds per screen: when it says "rounds used up", stop fixing and tell them what is open. A finding that is wrong is waived with a reason (`--waive <id> --reason "…"`) and still shown to them. A check it could not run is "not checked", never passed. It does not look at overlap, collision, alignment, empty space or section height: those are the look, and only your eye judges them.
95
+
96
+ **Scan the links.** Every page of the prototype, from the first:
97
+
98
+ ```
99
+ node <skill>/scripts/links.mjs "file://$PWD/.longbeard/design/prototype/home.html"
100
+ ```
101
+
102
+ It says each broken link, each link or button that goes nowhere, and each page with no way on. Fix every one before they see it. Whether a person reaches each key screen is the flow walks' to say, below, not this scan's. It also lists every stand-in and assumed fact on the pages it walks (`stand-in` lines, or "stand-ins: none marked"), and says `unmarked` for a stand-in picture that carries no mark: mark it.
103
+
104
+ **Walk the flows.** For each flow in the brief, one fresh agent that knows nothing of the product: a new agent or a clean session, on a smaller model where your agent lets you choose one (in Claude Code, the Agent tool's `model: sonnet`), given the first page's path and the flow's goal in the person's words, never the steps ("you want a sourdough for Saturday pickup"). It uses the browser it already has (a browser tool, or Playwright from a script: never a browser tool written for the job) to click, fill and choose through the prototype like a person, and says where it went, where it hesitated, and whether it got there. A flow it cannot finish, a wrong turn two of them take, or a step it calls unclear is fixed inside the identity and the direction: a label, a missing link or action, an order of sections. No agent can be started clean: walk it yourself, say so, and say it is weaker.
105
+
106
+ **The five-second check** on the first screen and each key screen, with what each screen is for as its takeaway: [five-second.md](references/five-second.md). Then show the screens with what the walks and the five-second check found and fixed, ask whether this is the product, and iterate until it is. Show the list with them, as what they still need to supply (below). Check it against the design brief too, as facts said with the screens: its three words and never word, its never, and apart from (could it be mistaken for the kind of product named there?).
107
+
108
+ **What they still need to supply.** The stand-ins and assumed facts from `links.mjs`, shown with the prototype in plain words, one line each, by screen: what it shows or says, and that it stands in. They give the real one, say it is right (it loses its mark), or leave it on the list. Nothing is dropped from it unasked.
109
+
110
+ ### 5. Approve: write `DESIGN.md` in one go
111
+
112
+ Only on their yes to the rendered prototype, and, when the design brief's `decides` names someone else, once that person has seen the paths and it holds. Write the whole file from [design-md-template.md](references/design-md-template.md): idea, voice, colour, type, spacing, components, decisions.
113
+
114
+ - **Contrast first.** Every text and background pair, and every control against its ground, through `contrast.mjs` (4.5:1 body, 3:1 large and non-text; at the design brief's AAA, `--level AAA`: 7:1 body, 4.5:1 large). Never write a failing pair, except a colour they liked by name and kept: its line carries `WARN liked, kept` after the ratio, its why goes under Decisions, and they are told in one line. The level goes in `DESIGN.md`'s Accessibility line.
115
+ ```
116
+ node <skill>/scripts/contrast.mjs "#1b1b1f on #fafaf7" "#c2410c on #fafaf7:mark"
117
+ ```
118
+ - **Themes:** each colour token once, a value per theme, every pair checked in each.
119
+ - **Tokens are code names** (`color/ink`, `type/body`, `space/md`, `radius/md`, `motion/enter`); Figma uses the same. Colour, type, spacing and radius are tables, and motion is a table when the design has motion (the direction's durations and easings as `motion/<name>` rows). The direction's `finish:` is the Finish line under Imagery.
120
+ - **The token block.** The tables are the source. Once they are written, run `tokens.mjs`: it writes the same tokens as front matter at the top of `DESIGN.md`, in the published DESIGN.md format, so another tool can take the design without Long Beard. Never write the block by hand. The script changes nothing below it.
121
+ ```
122
+ node <skill>/scripts/tokens.mjs DESIGN.md --name "<product name>"
123
+ ```
124
+ It exits 2 and names the row when a table cannot be read (a value that is not a colour, a token twice). `--check` exits 1 when the block and the tables disagree. The format has its own linter that anyone who wants to can run on the file (its command is in the script's header); it is not a gate here.
125
+ - **What makes it this design** goes under Components, with values, not adjectives.
126
+ - **Soft rules overridden on purpose** go under Decisions, with the reason. A device the chosen look relies on that the rules call a tell is on purpose: write the idea it serves.
127
+ - **Still to supply.** Run `links.mjs` again, show the current list once more, then write it as the template's section: what each stand-in picture shows and what each assumed fact says, by screen, never a file name or where a picture came from; "nothing" when `links.mjs` listed none. Figma and the build read it.
128
+ - **Ideas, not sources.** Nothing names a reference, site, studio, designer, link or `.longbeard/` path.
129
+
130
+ Then run `design-check` in docs mode on `DESIGN.md` and `docs/design/` (it runs `tokens.mjs --check` too): a picture site, a reference, a link or a `.longbeard/` path left in a committed doc (a copied template's comment counts) is fixed before you say it is done.
131
+
132
+ Then the next step: `design-figma`.
133
+
134
+ ## Feature loop
135
+
136
+ A feature with screens, once `DESIGN.md` exists.
137
+
138
+ - **Only existing parts:** compose the screens in Figma (`design-figma`) with their states; no prototype.
139
+ - **New parts:** prototype only them, on the real screens around them, in `.longbeard/design/<feature>/`, with 2–3 options where a real choice is open, then the self-check.
140
+ - `DESIGN.md` gets entries (a token, a component, a decision with date and reason, an item under Still to supply). It is never rewritten in a feature. A new or changed token goes in its table, then `tokens.mjs` refreshes the block.
141
+ - **Identity changes need their own yes:** a new colour role, a face, a change to the idea or voice, each shown rendered and approved one at a time. A rebrand is `design-identity` again.
142
+
143
+ ## Do not
144
+
145
+ - Write `DESIGN.md` before they approve a rendered prototype, or rewrite it in a feature.
146
+ - Change the identity or the direction's composition while building screens. Say it, and send it back to that skill.
147
+ - Pick a fork silently, or rank options.
148
+ - Ship a screen with grey boxes, lorem, or an item it needs missing (the `for the prototype` list included).
149
+ - Name a reference anywhere that is kept.
@@ -0,0 +1,82 @@
1
+ # DESIGN.md template
2
+
3
+ Write the whole file once, from the approved prototype. A builder follows it without the prototype or the references open. Short lines. Our words, never a reference's name.
4
+
5
+ The tables are the source. Write them, then run `tokens.mjs` (see the notes below): it puts the same tokens at the top of the file as a front-matter block, so a tool that reads the published DESIGN.md format can take the design without Long Beard. Never write the block by hand.
6
+
7
+ ```markdown
8
+ # Design
9
+
10
+ Figma: <file URL>. Figma is the truth for screens. This file is the rules behind them.
11
+
12
+ ## Idea
13
+ <one sentence: what this product's look says>
14
+ - ownable: <the one element made from the product's own identity, as approved on the prototype>
15
+
16
+ ## Voice
17
+ - <three adjectives>
18
+ - <one sample line, and one line it would never say>
19
+
20
+ ## Colour
21
+ | Token | Value | Use |
22
+ |---|---|---|
23
+ | color/bg | #… | page ground |
24
+ | color/ink | #… | body text |
25
+ | … | | |
26
+
27
+ Contrast (scripts/contrast.mjs, at the level under Accessibility):
28
+ - color/ink on color/bg: <ratio> <AA | AAA>
29
+ - <every text, control and focus pair>
30
+ - <a colour they liked and kept under the level: its pair, its ratio, then `WARN liked, kept`>
31
+
32
+ ## Type
33
+ | Token | Face, weight | Size / line height | Tracking | Use |
34
+ |---|---|---|---|---|
35
+ | type/heading | <face>, <weight> | <size> / <line height> | <tracking, or blank> | screen titles |
36
+ | type/body | … | …/… | | body, lists |
37
+
38
+ - Licence: <covers how this ships: web, app bundle>
39
+
40
+ ## Spacing
41
+ - Density: <airy | balanced | dense, from the design brief, and what it means here: rows per screen, how much before "more">
42
+ - <how the scale is used: inside components, between items, between groups, between sections>
43
+
44
+ | Token | Value | Use |
45
+ |---|---|---|
46
+ | space/<step> | <px> | <where it is used> |
47
+ | radius/<step> | <px> | <where, and where not> |
48
+
49
+ ## Components
50
+ - <component>: <what it is for, its variants, its states>
51
+
52
+ ## Motion
53
+ - <the design brief's picks as built: how much, driven by, character and where it applies, moments, or "none: state changes only"; what moves and when, as the direction's `motion:` line has it; reduced motion turns it off>
54
+
55
+ | Token | Duration | Easing | Use |
56
+ |---|---|---|---|
57
+ | motion/<purpose> | <ms> | <easing> | <what moves> |
58
+
59
+ ## Accessibility
60
+ - Level: <AA | AAA, from the design brief>. Every contrast pair above meets it, except a pair marked `WARN liked, kept`; design-check checks against it and reports those as warnings.
61
+
62
+ ## Imagery
63
+ - <what the pictures are and how they are treated, or "none">
64
+ - Finish: <the surface finish (a grain, a shadow, a blend) as a recipe that can be pasted, or "none">
65
+
66
+ ## Still to supply
67
+ - <screen>: <what the stand-in picture shows, or the assumed fact as shown> — <stand-in | assumed>. <What replaces it>
68
+ - Written even when empty: "Nothing: every picture and fact is theirs."
69
+
70
+ ## Decisions
71
+ - <date>: <what was decided> — <the reason>. <Soft rule overridden, if any: rule number and why>
72
+
73
+ ## Do not
74
+ - <what we leave, as ideas: "a bright brand accent", never whose>
75
+ ```
76
+
77
+ - Every token name is its code name, and the same name in Figma. A token is `group/name`: `color/`, `type/`, `space/`, `radius/`, `motion/`.
78
+ - Values are plain: a hex or a css colour for colour, a number (px) or a unit for sizes, a weight as a number or its name, a line height under 4 as a multiplier, durations in ms. A table with no tokens of a kind (a design with no motion) leaves that kind out.
79
+ - `tokens.mjs` reads every table row whose Token starts with one of those groups, and writes the block: `colors`, `typography`, `rounded`, `spacing` and `motion`, with `version` and `name`. It adds `primary`, the one name the format expects, pointing at `color/primary` if the table has it, else `color/accent`, else `color/ink`. Our names stay as they are. `--check` exits 1 when the block and the tables disagree.
80
+ - Every colour pair in the table has been through `scripts/contrast.mjs`. No FAIL is written. A colour they liked by name and kept under the level is written `WARN liked, kept`, with its why under Decisions.
81
+ - More than one theme: one row per token, with a value column per theme, headed by its name (Light, Dark). Every pair is checked in each theme. The block groups them under `colors.light` and `colors.dark`, each with its own `primary`.
82
+ - A section with nothing to say is left out, not filled with a guess. Still to supply is the one that stays: its "nothing" says it was checked.