@jonandev/longbeard 0.13.0 → 0.14.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 (55) hide show
  1. package/AGENTS.md +5 -5
  2. package/CHANGELOG.md +27 -0
  3. package/README.md +3 -4
  4. package/beard.json +6 -17
  5. package/bin/long-beard.js +2 -2
  6. package/package.json +1 -1
  7. package/skills/design/SKILL.md +4 -6
  8. package/skills/design-brief/SKILL.md +5 -5
  9. package/skills/design-check/SKILL.md +1 -1
  10. package/skills/design-check/references/design-rules.md +26 -4
  11. package/skills/design-check/scripts/rules.mjs +143 -9
  12. package/skills/design-direction/SKILL.md +70 -52
  13. package/skills/design-direction/references/design-floor.md +118 -0
  14. package/skills/design-direction/references/graphic.md +5 -6
  15. package/skills/design-direction/references/library.md +6 -6
  16. package/skills/design-direction/references/screen-template.html +2 -2
  17. package/skills/design-direction/references/subject.md +2 -2
  18. package/skills/design-direction/references/variants.js +43 -0
  19. package/skills/design-direction/scripts/canvas.mjs +12 -9
  20. package/skills/design-direction/scripts/colours.mjs +247 -0
  21. package/skills/design-direction/scripts/moodboard.mjs +1 -1
  22. package/skills/design-direction/scripts/rules.mjs +747 -0
  23. package/skills/design-direction/scripts/sheet.mjs +3 -1
  24. package/skills/design-figma/SKILL.md +1 -1
  25. package/skills/design-identity/SKILL.md +9 -7
  26. package/skills/design-identity/references/design-floor.md +118 -0
  27. package/skills/design-identity/scripts/colours.mjs +35 -1
  28. package/skills/design-identity/scripts/sheet.mjs +3 -1
  29. package/skills/design-moodboard/SKILL.md +6 -2
  30. package/skills/design-moodboard/references/graphic.md +1 -1
  31. package/skills/design-moodboard/scripts/group.mjs +1 -1
  32. package/skills/design-moodboard/scripts/moodboard.mjs +1 -1
  33. package/skills/design-prototype/SKILL.md +51 -48
  34. package/skills/design-prototype/references/design-floor.md +118 -0
  35. package/skills/design-prototype/references/design-md-template.md +3 -1
  36. package/skills/design-prototype/references/graphic.md +6 -5
  37. package/skills/design-prototype/references/variants.js +43 -0
  38. package/skills/design-prototype/scripts/links.mjs +5 -4
  39. package/skills/design-prototype/scripts/rules.mjs +143 -9
  40. package/skills/design-prototype/scripts/sheet.mjs +3 -1
  41. package/skills/design-wordmark/SKILL.md +6 -2
  42. package/skills/design-wordmark/scripts/sheet.mjs +3 -1
  43. package/skills/idea/SKILL.md +3 -3
  44. package/skills/design-direction/references/design-rules.md +0 -204
  45. package/skills/design-direction/references/full-build.md +0 -20
  46. package/skills/design-direction/references/grid.md +0 -97
  47. package/skills/design-direction/scripts/layout-diff.mjs +0 -118
  48. package/skills/design-families/SKILL.md +0 -139
  49. package/skills/design-families/scripts/contact-sheet.mjs +0 -259
  50. package/skills/design-families/scripts/families.mjs +0 -607
  51. package/skills/design-families/scripts/measure.mjs +0 -1728
  52. package/skills/design-families/scripts/moodboard.mjs +0 -609
  53. package/skills/design-families/scripts/tag.mjs +0 -289
  54. package/skills/design-prototype/references/design-rules.md +0 -204
  55. package/skills/design-prototype/references/five-second.md +0 -46
@@ -0,0 +1,118 @@
1
+ # Design floor
2
+
3
+ Generated from `rules/design-rules.md` by `npm run share`: its opening sections and every hard check. The soft checks and the tells are `design-check`'s.
4
+
5
+ How a screen is checked. `design-check` reads all of it on every frame and build. The skills that build read only the floor (`design-floor.md`: these opening sections and every hard check), so a better model's craft is never held to a textbook while drawing.
6
+
7
+ These rules decide execution, never the look. The direction and `DESIGN.md` decide the look. A rule that seems to ask for a colour, a typeface or a style is misread. It asks only that whatever was chosen is used with intent.
8
+
9
+ ## Before you build
10
+
11
+ A studio applies these while drawing each screen, not as a check after. Each is the numbered rule's, said there.
12
+
13
+ - One most prominent element and one primary action (rule 1).
14
+ - Contrast where the text sits, over pictures too (rules 6 and 12).
15
+ - One picture leads; pictures that share the screen never compete (rule 12).
16
+ - Text size at its floor (rule 5).
17
+ - One grouping device per group (rule 2).
18
+ - Every screen follows the direction's principles (before the pick, their whys), and reads as the same product as the first.
19
+
20
+ ## How to use this
21
+
22
+ - Check from a screenshot. Every check below can be passed or failed by looking at a rendered screen at its real size. When a check needs a state you cannot see (focus, error, empty), it needs that state's frame, and a missing frame fails rule 8.
23
+ - Go in order: **Idea** first, then every **hard** check, then **soft**.
24
+ - **Hard** is the floor: structure, contrast, text size, targets, focus and states. A hard failure blocks the screen. `DESIGN.md` cannot waive it, except for what the person liked or asked for (below).
25
+ - **When the floor meets a liked concept:**
26
+ - Text a person acts on (body, labels, prices, fields, navigation, buttons): the floor wins. The fix comes from inside the concept: its own ink, another crop, a device the board already has. Never by moving the text off the concept or dropping the concept.
27
+ - Display and composition (giant type over a picture, overlaps, crops): the concept wins, and the fault is written down.
28
+ - A colour or a small size the person liked or asked for: kept, reported as a warning with its measure, not a block. Marked `WARN liked, kept` in `DESIGN.md`; on a page, small text is marked `data-board-size`.
29
+ - **Soft** is a default. `DESIGN.md` may override a soft check on purpose, with a written reason. A soft finding with no reason in `DESIGN.md` is reported, not blocked.
30
+ - A finding is four things: the rule (number and check), hard or soft, where on the screen, and the fix.
31
+ - The shared core applies to everything, except where the Graphics list says it does not. Then add the site, app or graphics list, whichever the brief's surface says.
32
+
33
+ ## 1. Hierarchy
34
+
35
+ **Principle:** the eye lands first on what matters most, then moves in the order the task needs.
36
+ - [hard] Exactly one element is the most prominent on the screen. Squint or blur the shot: one thing still stands out.
37
+ - [hard] The primary action is easier to find than any secondary action. If two actions look equally important, only one of them should be.
38
+
39
+ ## 2. Grouping
40
+
41
+ **Principle:** things that belong together look together, and things that do not are kept apart.
42
+ - [hard] The space between related items is clearly smaller than the space between groups. A label sits closer to its field than to the field above.
43
+
44
+ ## 3. Alignment and grid
45
+
46
+ **Principle:** every element sits on a line shared with something else.
47
+ - [hard] Left edges of text blocks in one column line up. No block is nudged a few pixels off its neighbours.
48
+
49
+ ## 5. Typography
50
+
51
+ **Principle:** a few sizes, far apart, set for reading.
52
+ - [hard] At the screen's real size, nothing is under 12px, text a person acts on (links, buttons, labels, fields, prices, navigation) is at least 14px, and body is 16px at every width. Where a reference sets smaller, keep its proportions and scale the step up.
53
+ - [hard] No text is clipped, overlapped, or cut mid-word by its container, in any language the product ships.
54
+
55
+ ## 6. Colour
56
+
57
+ **Principle:** colour carries meaning, and the meaning stays the same everywhere.
58
+ - [hard] Body text has a contrast ratio of at least 4.5:1 against its background. Large text (24px, or 18.66px bold, and up) and the visible parts of controls and icons have at least 3:1. When `DESIGN.md` or the design brief sets the level to AAA: 7:1 for body text and 4.5:1 for large text.
59
+ - [hard] Colour is never the only signal. An error, a selected item or a required field also changes shape, weight, an icon or text.
60
+ - [hard] A product with more than one theme has one set of colour tokens, with a value for each theme, and passes every check here in each theme. A colour that stays the same when the theme changes, and should not, fails.
61
+
62
+ ## 7. Consistency
63
+
64
+ **Principle:** the same thing looks and behaves the same everywhere.
65
+ - [hard] One action has one look. Two primary buttons on different screens are the same component, same size and same label case.
66
+
67
+ ## 8. States
68
+
69
+ **Principle:** every screen is shown in every state a person will meet.
70
+ - [hard] The screen has a frame for each of empty, loading and error that a person can reach, next to the default. A state nobody can reach is recorded as not needed, with the reason. A reachable state with no frame is a failure, not a later task.
71
+ - [hard] Empty says what goes here and gives the one action that fills it. Error says what went wrong in plain words and how to recover.
72
+ - [hard] Interactive components show hover (pointer surfaces), focus, pressed, disabled, and selected where they apply. Each state is visibly different from default.
73
+
74
+ ## 9. Affordance and feedback
75
+
76
+ **Principle:** what can be acted on looks like it, and every action visibly answers.
77
+ - [hard] Every interactive element looks interactive without hovering. Text links are distinct from body text by more than colour alone, unless their position makes them obvious (a nav bar).
78
+ - [hard] Nothing that looks interactive is not. A card that looks clickable is clickable, or loses the look.
79
+
80
+ ## 10. Accessibility
81
+
82
+ **Principle:** the screen works for people who see, move and read differently.
83
+ - [hard] The focused state of every interactive element shows a visible indicator with at least 3:1 contrast against what is around it. Check it in the focus frame.
84
+ - [hard] Targets are at least 24×24 CSS pixels, or have that much space around them (WCAG 2.2 AA). The app list raises this for touch.
85
+ - [hard] Every input has a visible label. A placeholder alone is not a label.
86
+ - [hard] Text is real text, not text in an image, except in logos.
87
+
88
+ ## 11. Copy
89
+
90
+ **Principle:** words do the job of the screen in the product's own voice, made from facts it has.
91
+ - [hard] No placeholder copy: no lorem ipsum, no "Title", no "Button", no "User Name".
92
+
93
+ ## 12. Imagery
94
+
95
+ **Principle:** pictures show the real thing, or there are none.
96
+ - [hard] Text over an image meets the contrast floor in rule 6 across the whole text area, not only on the darkest part.
97
+
98
+ ## 13. Responsive
99
+
100
+ **Principle:** each size is designed, not squeezed.
101
+ - [hard] At mobile width (360–390px) nothing scrolls sideways, nothing is clipped, and nothing overlaps.
102
+ - [hard] The primary action is reachable at every size without hunting: visible, or one obvious step away.
103
+
104
+ ## Sites
105
+
106
+ - [hard] The first screen at mobile and desktop says what this is and who it is for, without scrolling.
107
+
108
+ ## Apps
109
+
110
+ - [hard] Touch targets on touch platforms are at least 44×44 pt (Apple) or 48×48 dp (Material), whichever platform it ships on. The web floor in rule 10 still applies.
111
+ - [hard] The person always knows where they are: the current place in navigation is marked, and the screen title matches the nav item.
112
+
113
+ ## Graphics
114
+
115
+ - **Applies:** rules 0 to 3, 5, 6, 11, 12 and 14. Rule 4 holds for the margin and the gaps between groups. Rule 7 holds across the pieces of a set.
116
+ - **Does not apply:** rule 8 (states), rule 9 (affordance), the targets, focus and label checks of rule 10, and rule 13 (responsive). A missing state frame is not a finding.
117
+ - [hard] Readable at its distance. Scale the shot to how the piece is seen (a poster read across a street, about 400 px on its long side; a feed post at phone width). The headline and every fact the brief gives still read.
118
+ - [hard] Nothing important in the trim. On a print piece, no word, fact or logo sits in the trim or the safe margin. A picture or a crop that runs off the edge on purpose is not a finding.
@@ -12,7 +12,9 @@ Figma: <file URL>. Figma is the truth for screens. This file is the rules behind
12
12
  ## Idea
13
13
  <one sentence: what this product's look says>
14
14
  - ownable: <the one element made from the product's own identity, as approved on the prototype>
15
- - five seconds: <first screen: what it is n of 3, what to do n of 3, feel words; people's answers when given; "not run" and why otherwise>
15
+
16
+ ## Principles
17
+ - <three to five, from the direction, as the prototype proved them: what every screen of this design does>
16
18
 
17
19
  ## Voice
18
20
  - <three adjectives>
@@ -6,12 +6,13 @@ For a single piece the prototype finishes the chosen piece and nothing else. For
6
6
 
7
7
  ## First pass
8
8
 
9
- 1. **Finish the chosen piece.** `first.html` is fixed at the format's size, so `home.html` is the same page at that size, not responsive, and `first.html` stays beside it. Keep the faces loaded at the size and the direction's devices untouched. Spacing options, widths, states and walks do not apply. The facts the direction left for the prototype (a second language, the small print) are placed in the composition's own system. A fact the brief marks missing stays a stand-in, marked, and listed under Still to supply.
10
- 2. **A set.** List the other pieces and their sizes once, and ask "Change the list?" Each is built from the chosen piece: reflowed to its size, never scaled, with the same type, colours, devices and facts. A story is tall, a square is square. Each takes the same touch-up as the first. A piece's own choices (which fact leads when there is less room) are named, never silent. A single piece skips this.
11
- 3. **The self-check.** Capture each piece whole: `--width <w> --clip 0,0,<w>,<h>` at its working size. Then:
9
+ 1. **Finish the chosen piece.** `first.html` is fixed at the format's size, so `home.html` is the same page at that size, not responsive, and `first.html` stays beside it. Keep the faces loaded at the size and the direction's devices untouched. Widths and states do not apply. The facts the direction left for the prototype (a second language, the small print) are placed in the composition's own system. A fact the brief marks missing stays a stand-in, marked, and listed under Still to supply.
10
+ 2. **A set.** List the other pieces and their sizes once, and ask "Change the list?" Each is built from the chosen piece: reflowed to its size, never scaled, with the same type, colours, devices and facts. A story is tall, a square is square. Each takes the same checks as the first. A piece's own choices (which fact leads when there is less room) are named, never silent. A single piece skips this.
11
+ 3. **The checks.** Capture each piece whole: `--width <w> --clip 0,0,<w>,<h>` at its working size. Then:
12
12
  - **Contrast:** `screen-contrast.mjs` as usual.
13
- - **Rules script:** run `rules.mjs` with `--widths <the piece's width>`. Read only its copy findings (rule 11) and its cut text (rule 5). Its sideways scroll is reported "not checked" above 480 px. Its targets, focus and labels do not apply to a graphic: report any it prints as "not applicable to a graphic" in the self-check. Never fix or waive them, and ignore its exit code and its round count for them.
14
- - **Walks:** The link scan and the flow walks are not run. The five-second check is, on each piece, at the size it reaches the eye: a poster read across a street, scaled so its long side is about 400 px; a feed post at phone size, about 390 px wide. "What would you do first" is what they would do about it: go, scan, remember the date. It is checked against the design brief's `read from` line and its takeaway.
13
+ - **Rules script:** run `rules.mjs` with `--widths <the piece's width>`. Read only its copy findings (rule 11) and its cut text (rule 5). Its sideways scroll is reported "not checked" above 480 px. Its targets, focus and labels do not apply to a graphic: report any it prints as "not applicable to a graphic". Never fix or waive them, and ignore its exit code and its round count for them.
14
+ - **Links and drift:** not run.
15
+ - **At the size it reaches the eye:** look at each piece as a poster read across a street (long side about 400 px) or a feed post at phone size (about 390 px wide), against the design brief's `read from` line and its takeaway.
15
16
  - **Facts:** every fact in the brief is on the piece, spelt as the brief gives it.
16
17
  - **Trim:** nothing important sits in the trim or the safe margin.
17
18
 
@@ -0,0 +1,43 @@
1
+ // Options on the real page. Each option is an element with data-variant="1", "2", …
2
+ // and data-from="<the reference it comes from>". The page shows one, chosen by
3
+ // ?variant=<n> (1 when absent), and a small bar at the bottom centre: the option's
4
+ // number, its reference, and arrows. ← and → flip between them and keep the URL in
5
+ // step, so a capture or a link opens the same option. ?bar=0 hides the bar for captures.
6
+ // Copy this file next to the page and load it last: <script src="variants.js"></script>
7
+ (() => {
8
+ const all = [...document.querySelectorAll("[data-variant]")];
9
+ const ns = [...new Set(all.map((el) => el.dataset.variant))].sort((a, b) => Number(a) - Number(b));
10
+ if (!ns.length) return;
11
+ const params = new URLSearchParams(location.search);
12
+ let at = Math.max(0, ns.indexOf(params.get("variant") || ns[0]));
13
+ const bar = document.createElement("div");
14
+ bar.setAttribute("role", "toolbar");
15
+ bar.setAttribute("aria-label", "Options");
16
+ bar.style.cssText = "position:fixed;left:50%;bottom:16px;transform:translateX(-50%);z-index:2147483647;display:flex;gap:12px;align-items:center;padding:8px 12px;border-radius:999px;background:#111;color:#fff;font:500 13px/1.2 system-ui,sans-serif;box-shadow:0 2px 12px rgba(0,0,0,.25)";
17
+ const button = (text, label, step) => {
18
+ const b = document.createElement("button");
19
+ b.type = "button";
20
+ b.textContent = text;
21
+ b.setAttribute("aria-label", label);
22
+ b.style.cssText = "all:unset;cursor:pointer;padding:4px 8px;min-width:24px;text-align:center";
23
+ b.onclick = () => show(at + step);
24
+ return b;
25
+ };
26
+ const label = document.createElement("span");
27
+ bar.append(button("←", "Previous option", -1), label, button("→", "Next option", 1));
28
+ function show(i) {
29
+ at = (i + ns.length) % ns.length;
30
+ for (const el of all) el.hidden = el.dataset.variant !== ns[at];
31
+ const from = all.find((el) => el.dataset.variant === ns[at])?.dataset.from || "";
32
+ label.textContent = `${at + 1} / ${ns.length}${from ? " \u00b7 from " + from : ""}`;
33
+ params.set("variant", ns[at]);
34
+ history.replaceState(null, "", "?" + params.toString() + location.hash);
35
+ }
36
+ addEventListener("keydown", (e) => {
37
+ if (e.target.closest?.("input, textarea, select, [contenteditable]")) return;
38
+ if (e.key === "ArrowLeft") show(at - 1);
39
+ if (e.key === "ArrowRight") show(at + 1);
40
+ });
41
+ if (params.get("bar") !== "0") document.body.append(bar);
42
+ show(at);
43
+ })();
@@ -1,14 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  // Scan a clickable prototype: every page in its folder, from its first page on, for
3
3
  // links that break and pages with no way on, and for what it still stands in for.
4
- // Whether a person can reach each screen is the flow walks' job, not this one's.
5
4
  // Node 22+, an installed Chrome, no dependencies.
6
5
  //
7
6
  // node links.mjs "file://$PWD/.longbeard/design/prototype/home.html"
8
7
  //
9
8
  // Pages are rendered (links a script builds count). Links are followed from the first page, then
10
9
  // every other page in the prototype's folder is opened too, so a page behind a state (an empty
11
- // basket) is still scanned. A link elsewhere (a real site, mailto:) is listed, never followed. A form that submits to another page is a way on, and so is
10
+ // basket) is still scanned. A sheet of screenshots that sheet.mjs made there is skipped. A link elsewhere (a real site, mailto:) is listed, never followed. A form that submits to another page is a way on, and so is
12
11
  // a button whose script navigates: each is clicked, and the page it lands on is followed. A query (?state=empty) or a hash is the same page, but the
13
12
  // page is opened with the query it was first reached by, so state a prototype keeps in
14
13
  // the address (a basket, a chosen slot) carries on as it does for a person.
@@ -238,8 +237,10 @@ const seen = new Set([startPath]);
238
237
  const firstUrl = new Map([[startPath, start.split("#")[0]]]);
239
238
  const queue = [startPath];
240
239
  const broken = [], nowhere = [], deadEnds = [], outside = new Set();
241
- // When the links run out, every page in the folder not reached yet is opened by itself.
242
- const rest = () => readdirSync(dirname(startPath)).filter((f) => /\.html?$/i.test(f)).sort().map((f) => join(dirname(startPath), f)).filter((p) => !seen.has(p));
240
+ // When the links run out, every page in the folder not reached yet is opened by itself,
241
+ // except a sheet of screenshots (sheet.mjs marks it): it shows the prototype, it is not a page of it.
242
+ const isSheet = (path) => { try { return /<meta name="generator" content="longbeard sheet">/.test(readFileSync(path, "utf8")); } catch { return false; } };
243
+ const rest = () => readdirSync(dirname(startPath)).filter((f) => /\.html?$/i.test(f)).sort().map((f) => join(dirname(startPath), f)).filter((p) => !seen.has(p) && !isSheet(p));
243
244
  while (queue.length || (queue.push(...rest().slice(0, 1)), queue.length)) {
244
245
  const path = queue.shift();
245
246
  seen.add(path);
@@ -18,6 +18,15 @@
18
18
  // 11 Copy no lorem ipsum, and no text that is only "Title", "Button", "User Name"...
19
19
  // 5 Typography text cut by its container, including an ellipsis. Text cut on purpose
20
20
  // carries data-crop on the element (or one above it) and is skipped
21
+ // 5 Typography text size: nothing under 12px; text a person acts on (links, buttons,
22
+ // labels, fields, navigation) at least 14px; body (running text of 60
23
+ // characters or more) at least 16px. Text marked data-board-size (on it or
24
+ // above it: the board shows it that small and the person kept it) is a
25
+ // warning with its measure, not a block
26
+ // Soft (reported, never blocking):
27
+ // 6 Colour proportion on the first screen, text and pictures left out: the ground
28
+ // (the largest colour) under 50%, or the accent over 20% (--accent "#hex"
29
+ // names it; else the most saturated colour). A board that does otherwise wins
21
30
  // Not checked, on purpose: overlap, collision, alignment, empty space, section height. They are
22
31
  // the look's own moves. Not checked either: contrast (screen-contrast.mjs), states, hierarchy.
23
32
  //
@@ -37,7 +46,8 @@
37
46
  // run. A check that could not run is "not checked", never passed. The first failure on a screen
38
47
  // says what to do; the second says to report it as not checked and go on.
39
48
  // --widths 1440,390, --screen name, --app, --cookie "a=b; c=d", --wait 300 (ms), --timeout 120000
40
- // (ms for the whole run; every browser call also has its own 15 s limit), --rounds 2, --dir, --json
49
+ // (ms for the whole run; every browser call also has its own 15 s limit), --rounds 2, --dir,
50
+ // --accent "#hex" (the accent from DESIGN.md, for the proportion), --json
41
51
  import { spawn } from "node:child_process";
42
52
  import { createHash } from "node:crypto";
43
53
  import { existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
@@ -65,11 +75,12 @@ const reason = flag("reason");
65
75
  const shipWords = flag("ship");
66
76
  const app = has("app");
67
77
  const json = has("json");
78
+ const accentArg = flag("accent");
68
79
  const [url] = args;
69
- const usage = 'usage: node rules.mjs "<file:// or http(s):// url>" [--screen name] [--widths 1440,390] [--app] [--cookie "a=b"] [--wait 300] [--timeout 120000] [--rounds 2] [--dir .longbeard/design] [--json]\n node rules.mjs --screen name --waive <id> --reason "why this finding is false"\n node rules.mjs --screen name --ship "the person\'s words"';
80
+ const usage = 'usage: node rules.mjs "<file:// or http(s):// url>" [--screen name] [--widths 1440,390] [--app] [--cookie "a=b"] [--wait 300] [--timeout 120000] [--rounds 2] [--dir .longbeard/design] [--accent "#hex"] [--json]\n node rules.mjs --screen name --waive <id> --reason "why this finding is false"\n node rules.mjs --screen name --ship "the person\'s words"';
70
81
  const recording = Boolean(waiveId || shipWords);
71
82
  const usageOk = recording ? Boolean(screenArg || url) && args.length <= 1 : url && args.length === 1 && /^(https?|file):/.test(url);
72
- if (!usageOk || widths.some((w) => !(w >= 200 && w <= 3840)) || !(wait >= 0 && wait <= 10000) || !(totalMs >= 5000) || !(limit >= 1) || (waiveId && shipWords) || (reason && !waiveId)) {
83
+ if (!usageOk || widths.some((w) => !(w >= 200 && w <= 3840)) || !(wait >= 0 && wait <= 10000) || !(totalMs >= 5000) || !(limit >= 1) || (waiveId && shipWords) || (reason && !waiveId) || (accentArg && !/^#?[0-9a-f]{6}$/i.test(accentArg))) {
73
84
  console.error(usage);
74
85
  process.exit(2);
75
86
  }
@@ -125,7 +136,7 @@ if (shipWords) {
125
136
  console.error(`rules: ${screen} has not been checked yet. Run it once, so the open findings are on record.`);
126
137
  process.exit(2);
127
138
  }
128
- record.closed = { words: shipWords.trim(), at: today(), open: record.found.filter((f) => !waivers.some((w) => w.screen === screen && w.id === f.id)) };
139
+ record.closed = { words: shipWords.trim(), at: today(), open: record.found.filter((f) => (f.level || "hard") === "hard" && !waivers.some((w) => w.screen === screen && w.id === f.id)) };
129
140
  rounds[screen] = record;
130
141
  writeJson(roundsFile, rounds);
131
142
  console.log(`${screen} closed by the person: "${record.closed.words}". Open findings, to report as open:`);
@@ -430,9 +441,102 @@ function staticChecks(opt) {
430
441
  }
431
442
  });
432
443
 
444
+ // 5: text size. Nothing under 12px; what a person acts on 14px; body 16px.
445
+ run("5 size", () => {
446
+ const act = 'a, button, label, input, select, textarea, summary, legend, nav, [role=button], [role=link], [role=tab], [role=menuitem], [role=option]';
447
+ const done = new Set();
448
+ const size = (el) => parseFloat(getComputedStyle(el).fontSize);
449
+ const judge = (el, text) => {
450
+ if (done.has(el)) return;
451
+ done.add(el);
452
+ const px = size(el);
453
+ const acts = !!el.closest(act);
454
+ const block = el.closest("p, li, dd, blockquote");
455
+ const body = !acts && block && !el.closest("figcaption, small, footer, aside, sup, sub") && (block.innerText || "").trim().length >= 60;
456
+ const [floor, role] = acts ? [14, "text a person acts on"] : body ? [16, "body text"] : [12, "text"];
457
+ if (px >= floor - 0.05) return;
458
+ const board = !!el.closest("[data-board-size]");
459
+ found.push({ rule: "5 Typography", check: "size", level: board ? "warn" : "hard", path: path(el), desc: desc(el), detail: `${Math.round(px * 10) / 10}px ${role}, floor ${floor}px${board ? " (data-board-size: the board's size, kept)" : ""}` });
460
+ };
461
+ const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
462
+ for (let n = walker.nextNode(); n; n = walker.nextNode()) {
463
+ const el = n.parentElement;
464
+ if (!el || !n.textContent.trim() || el instanceof SVGElement || /^(SCRIPT|STYLE|NOSCRIPT|TEMPLATE|OPTION)$/.test(el.tagName) || !visible(el)) continue;
465
+ const box = el.getBoundingClientRect();
466
+ if (box.width <= 2 || box.height <= 2) continue; // visually hidden text, read by screen readers
467
+ judge(el);
468
+ }
469
+ for (const el of document.body.querySelectorAll("input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select, textarea")) if (visible(el)) judge(el);
470
+ });
471
+
433
472
  return { found, notChecked };
434
473
  }
435
474
 
475
+ // Colour proportion of the first screen, from a shot with the text hidden. Pictures are left out.
476
+ // Returns { shares: [{ hex, share, chroma }], ground, accent } in shares of the pixels counted.
477
+ async function colourProportion(opt) {
478
+ const out = [];
479
+ for (const el of document.body.querySelectorAll("*")) {
480
+ const s = getComputedStyle(el);
481
+ if (el.matches("img, video, canvas, picture, iframe, svg image, object, embed") || /url\(/.test(s.backgroundImage)) {
482
+ const r = el.getBoundingClientRect();
483
+ if (r.width >= 1 && r.height >= 1) out.push(r);
484
+ }
485
+ }
486
+ const img = new Image();
487
+ img.src = `data:image/png;base64,${opt.png}`;
488
+ await img.decode();
489
+ const c = document.createElement("canvas");
490
+ c.width = img.naturalWidth;
491
+ c.height = img.naturalHeight;
492
+ const g = c.getContext("2d", { willReadFrequently: true });
493
+ g.drawImage(img, 0, 0);
494
+ const px = g.getImageData(0, 0, c.width, c.height).data;
495
+ const lin = (v) => ((v /= 255) <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4);
496
+ const lab = (r, gr, b) => {
497
+ const [R, G, B] = [lin(r), lin(gr), lin(b)];
498
+ const l = Math.cbrt(0.4122214708 * R + 0.5363325363 * G + 0.0514459929 * B), m = Math.cbrt(0.2119034982 * R + 0.6806995451 * G + 0.1073969566 * B), s2 = Math.cbrt(0.0883024619 * R + 0.2817188376 * G + 0.6299787005 * B);
499
+ return [0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s2, 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s2, 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s2];
500
+ };
501
+ const buckets = new Map();
502
+ let total = 0;
503
+ const step = 2;
504
+ for (let y = 0; y < c.height; y += step)
505
+ for (let x = 0; x < c.width; x += step) {
506
+ if (out.some((r) => x >= r.left && x < r.right && y >= r.top && y < r.bottom)) continue;
507
+ const i = (y * c.width + x) * 4;
508
+ const key = ((px[i] >> 3) << 10) | ((px[i + 1] >> 3) << 5) | (px[i + 2] >> 3);
509
+ const b = buckets.get(key) || { n: 0, r: px[i], g: px[i + 1], b: px[i + 2] };
510
+ b.n++;
511
+ buckets.set(key, b);
512
+ total++;
513
+ }
514
+ if (!total) return { shares: [], ground: null, accent: null };
515
+ // Near colours are one colour: a bucket joins the biggest cluster within a small distance.
516
+ const clusters = [];
517
+ for (const b of [...buckets.values()].sort((a, z) => z.n - a.n)) {
518
+ const L = lab(b.r, b.g, b.b);
519
+ const near = clusters.find((k) => Math.hypot(k.lab[0] - L[0], k.lab[1] - L[1], k.lab[2] - L[2]) < 0.06);
520
+ if (near) near.n += b.n;
521
+ else clusters.push({ n: b.n, lab: L, rgb: [b.r, b.g, b.b] });
522
+ }
523
+ const hex = (rgb) => `#${rgb.map((v) => v.toString(16).padStart(2, "0")).join("")}`;
524
+ const shares = clusters.sort((a, z) => z.n - a.n).map((k) => ({ hex: hex(k.rgb), share: k.n / total, chroma: Math.hypot(k.lab[1], k.lab[2]), lab: k.lab }));
525
+ const ground = shares[0];
526
+ let accent = null;
527
+ if (opt.accent) {
528
+ const h = opt.accent.replace("#", "");
529
+ const A = lab(parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16));
530
+ const near = shares.filter((k) => Math.hypot(k.lab[0] - A[0], k.lab[1] - A[1], k.lab[2] - A[2]) < 0.06);
531
+ accent = { hex: `#${h.toLowerCase()}`, share: near.reduce((a, k) => a + k.share, 0), named: true };
532
+ } else {
533
+ // Unnamed, the accent is the most saturated colour other than the ground.
534
+ const pick = shares.slice(1).filter((k) => k.chroma >= 0.1 && k.share >= 0.005).sort((a, z) => z.chroma - a.chroma)[0];
535
+ if (pick) accent = { hex: pick.hex, share: pick.share, named: false };
536
+ }
537
+ return { shares: shares.slice(0, 4).map(({ hex: h, share }) => ({ hex: h, share })), ground: { hex: ground.hex, share: ground.share }, accent };
538
+ }
539
+
436
540
  // The focus check. Called once to take the baseline, then after each Tab.
437
541
  function focusBaseline() {
438
542
  const sig = (el) => {
@@ -494,10 +598,13 @@ const FIX = {
494
598
  focus: "Give it a visible :focus-visible style with 3:1 contrast against what is around it (an outline or ring). Never outline: none alone.",
495
599
  placeholder: "Write the real copy, in the product's voice.",
496
600
  clipped: "Let the box grow or the text wrap, so no word is cut. If the cut is the look, mark that element data-crop.",
601
+ size: "Scale the step up, keeping the reference's proportions between sizes. If the board shows it this small and the person kept it, mark it data-board-size.",
602
+ proportion: "Let the ground dominate, the primary support and the accent stay small (about 60/30/10). If the board clearly does otherwise, keep it and say so in a note.",
497
603
  };
498
604
  const RULE_OF = { focus: "10 Accessibility" };
499
605
  const found = new Map();
500
606
  const notChecked = [];
607
+ const proportions = [];
501
608
  const checkedAt = new Map();
502
609
  const evaluate = async (expression, call) => {
503
610
  const r = await call("Runtime.evaluate", { expression, returnByValue: true, awaitPromise: true });
@@ -521,7 +628,7 @@ try {
521
628
  }
522
629
  const record1 = (item, w, check) => {
523
630
  const key = `${item.rule || RULE_OF[check] || ""}|${check}|${item.path}`;
524
- if (!found.has(key)) found.set(key, { rule: item.rule || RULE_OF[check], check, path: item.path, desc: item.desc, detail: item.detail || "", widths: [] });
631
+ if (!found.has(key)) found.set(key, { rule: item.rule || RULE_OF[check], check, level: item.level || "hard", path: item.path, desc: item.desc, detail: item.detail || "", widths: [] });
525
632
  const f = found.get(key);
526
633
  if (!f.widths.includes(w)) f.widths.push(w);
527
634
  };
@@ -554,6 +661,25 @@ try {
554
661
  } catch (e) {
555
662
  notChecked.push({ check: "10 focus", width: w, why: String(e.message).slice(0, 80) });
556
663
  }
664
+ // Colour proportion, last: it hides the text. The first screen only, as a person meets it.
665
+ try {
666
+ await evaluate(`(() => {
667
+ window.scrollTo(0, 0);
668
+ if (document.activeElement) document.activeElement.blur();
669
+ const s = document.createElement("style");
670
+ s.textContent = "* { color: transparent !important; text-shadow: none !important; -webkit-text-fill-color: transparent !important; text-decoration-color: transparent !important; caret-color: transparent !important; outline: none !important; }";
671
+ document.head.appendChild(s);
672
+ return new Promise((done) => requestAnimationFrame(() => requestAnimationFrame(() => done(true))));
673
+ })()`, call);
674
+ const shot = await call("Page.captureScreenshot", { format: "png" });
675
+ const p = await evaluate(`(${colourProportion})(${JSON.stringify({ png: shot.result.data, accent: accentArg })})`, call);
676
+ proportions.push({ width: w, ...p });
677
+ const pct = (x) => `${Math.round(x * 100)}%`;
678
+ if (p.ground && p.ground.share < 0.5) record1({ rule: "6 Colour", level: "soft", path: "ground", desc: "first screen", detail: `the ground (${p.ground.hex}) covers ${pct(p.ground.share)}; it should dominate (about 60%)` }, w, "proportion");
679
+ if (p.accent && p.accent.share > 0.2) record1({ rule: "6 Colour", level: "soft", path: "accent", desc: "first screen", detail: `the accent (${p.accent.hex}${p.accent.named ? "" : ", read as the most saturated colour"}) covers ${pct(p.accent.share)}; it should stay small (about 10%)` }, w, "proportion");
680
+ } catch (e) {
681
+ notChecked.push({ check: "6 proportion", width: w, why: String(e.message).slice(0, 80) });
682
+ }
557
683
  checkedAt.set(w, true);
558
684
  }
559
685
  ws.close();
@@ -567,7 +693,9 @@ finished = true;
567
693
  const id = (f) => createHash("sha1").update(`${f.rule}|${f.check}|${f.path}`).digest("hex").slice(0, 6);
568
694
  const rows = [...found.values()].map((f) => ({ ...f, id: id(f), where: `${f.desc}: ${f.detail} (at ${f.widths.sort((a, b) => b - a).join(", ")})` }));
569
695
  const waived = rows.filter((f) => waivers.some((w) => w.screen === screen && w.id === f.id));
570
- const open = rows.filter((f) => !waived.includes(f));
696
+ // Hard findings block. Warnings (the board's own small text) and soft ones are reported only.
697
+ const open = rows.filter((f) => !waived.includes(f) && f.level === "hard");
698
+ const reported = rows.filter((f) => !waived.includes(f) && f.level !== "hard");
571
699
 
572
700
  // A run on a changed page is a round; the same page again is the same round. Each url of a screen
573
701
  // (a state: ?menu=open) keeps its own fingerprint, so the first look at another state is part of
@@ -580,15 +708,15 @@ const changed = seen && fps[key] !== fingerprint;
580
708
  const round = !used ? 1 : changed && used < limit ? used + 1 : used;
581
709
  const beyond = changed && used >= limit;
582
710
  const closed = changed ? null : record.closed || null;
583
- rounds[screen] = { round, fps: { ...fps, [key]: fingerprint }, at: today(), failed: 0, found: rows.map((f) => ({ id: f.id, rule: f.rule, where: f.where })), ...(closed ? { closed } : {}) };
711
+ rounds[screen] = { round, fps: { ...fps, [key]: fingerprint }, at: today(), failed: 0, found: rows.map((f) => ({ id: f.id, rule: f.rule, level: f.level, where: f.where })), ...(closed ? { closed } : {}) };
584
712
  writeJson(roundsFile, rounds);
585
713
 
586
714
  const widthNote = widths.join(" and ");
587
- const checks = [["13 sideways", "13 sideways scroll (phone width)"], ["10 targets", `10 targets (${app ? "44 on phone, 24 otherwise" : "24"})`], ["10 labels", "10 visible labels"], ["10 focus", "10 focus shown (not its contrast)"], ["11 copy", "11 placeholder copy"], ["5 clipped", "5 clipped text (data-crop skipped)"]];
715
+ const checks = [["13 sideways", "13 sideways scroll (phone width)"], ["10 targets", `10 targets (${app ? "44 on phone, 24 otherwise" : "24"})`], ["10 labels", "10 visible labels"], ["10 focus", "10 focus shown (not its contrast)"], ["11 copy", "11 placeholder copy"], ["5 clipped", "5 clipped text (data-crop skipped)"], ["5 size", "5 text size (12 / 14 / 16)"], ["6 proportion", "6 colour proportion (soft)"]];
588
716
  if (!widths.some((w) => w <= 480)) notChecked.push({ check: "13 sideways", width: widths.join(","), why: "no phone width (480 or less) in --widths" });
589
717
  const done = checks.filter(([key]) => !notChecked.some((n) => n.check === key)).map(([, label]) => label);
590
718
  if (json) {
591
- console.log(JSON.stringify({ screen, round, limit, roundsUsedUp: round >= limit && open.length > 0, closed, open, waived, notChecked, checked: done }, null, 1));
719
+ console.log(JSON.stringify({ screen, round, limit, roundsUsedUp: round >= limit && open.length > 0, closed, open, reported, waived, proportions, notChecked, checked: done }, null, 1));
592
720
  } else {
593
721
  console.log(`rules: ${screen} at ${widthNote}, round ${round} of ${limit}${beyond ? " (this page changed after the last round: not counted)" : changed || !used ? "" : seen ? " (the page has not changed since the last run)" : " (another state of this screen: same round)"}`);
594
722
  if (closed) console.log(`closed by the person on ${closed.at}: "${closed.words}". Do not fix more. Report what is open.`);
@@ -602,6 +730,12 @@ if (json) {
602
730
  }
603
731
  for (const [check, n] of Object.entries(shown)) if (n > 10) console.log(`(${n - 10} more ${check} findings with the same fix, not listed: fix these, run again, or use --json for all)`);
604
732
  } else console.log(`passes: ${done.join("; ")}`);
733
+ if (reported.length) {
734
+ console.log("reported, not blocking:\n| Rule | Hard/soft | Where | Fix |\n|---|---|---|---|");
735
+ for (const f of reported.slice(0, 20)) console.log(`| ${f.rule} | ${f.level} | ${f.where.replace(/\|/g, "/")} [${f.id}] | ${FIX[f.check]} |`);
736
+ if (reported.length > 20) console.log(`(${reported.length - 20} more, not listed: --json has all)`);
737
+ }
738
+ for (const p of proportions) if (p.ground) console.log(`colour proportion at ${p.width}: ground ${p.ground.hex} ${Math.round(p.ground.share * 100)}%${p.shares.slice(1).map((k) => `, ${k.hex} ${Math.round(k.share * 100)}%`).join("")}${p.accent ? `; accent ${p.accent.hex} ${Math.round(p.accent.share * 100)}%` : ""}`);
605
739
  if (waived.length) {
606
740
  console.log(`waived (${waived.length}), listed so the person sees them:`);
607
741
  for (const f of waived) console.log(`- ${f.rule}: ${f.where} [${f.id}]: ${waivers.find((w) => w.screen === screen && w.id === f.id).reason}`);
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  // Lay screenshots out as one numbered sheet, so a round of first screens can
3
3
  // be seen and picked from together. It writes an HTML page; capture.mjs turns
4
- // that into the picture to show. No dependencies.
4
+ // that into the picture to show. The page is marked as a sheet, so links.mjs never
5
+ // counts it as a page of the prototype. No dependencies.
5
6
  //
6
7
  // node sheet.mjs .longbeard/design/direction/grid/sheet.html .longbeard/design/direction/grid/1.png .longbeard/design/direction/grid/2.png …
7
8
  // node sheet.mjs .longbeard/design/direction/grid/vary.html --cols 5 .longbeard/design/direction/grid/v*.png
@@ -49,6 +50,7 @@ writeFileSync(
49
50
  out,
50
51
  `<!doctype html>
51
52
  <meta charset="utf-8">
53
+ <meta name="generator" content="longbeard sheet">
52
54
  <title>Sheet</title>
53
55
  <style>
54
56
  body { margin: 0; padding: 24px; background: #6f6f6f; font: 600 22px/1 system-ui, sans-serif; }
@@ -28,9 +28,13 @@ Comes out: the chosen mark as SVG in `docs/design/wordmark.svg`, a section in `d
28
28
 
29
29
  Read the identity, the brief's name and identity nouns, and the design brief's personality.
30
30
 
31
+ ## 0. Marks they like
32
+
33
+ Ask once which marks they like and why: the cards on their board that show a mark, to pick from, or, when there are none, a search for marks (`design-moodboard`'s one piece). "None, just the name" is a fine answer. A liked mark lends only the kind of device (a cut, a ligature, a case, a rule); its letterforms and shapes never.
34
+
31
35
  ## 1. Marks, one sheet
32
36
 
33
- Four to six marks, each a small HTML page in `.longbeard/design/wordmark/`, made only from the identity's faces and colours and devices that belong to them: a cut, a ligature, a case, a rule, a shape, the accent. One of them is the name set plainly in the display face, so not making a mark is a choice too. Never a stock icon, a generic symbol, or anything from a reference.
37
+ Four to six marks, each a small HTML page in `.longbeard/design/wordmark/`, made only from the identity's faces and colours and devices that belong to them: a cut, a ligature, a case, a rule, a shape, the accent. One of them is the name set plainly in the display face, so not making a mark is a choice too. Never a stock icon, a generic symbol, or a reference's letterforms or shapes; a kind of device they liked in step 0 is fine.
34
38
 
35
39
  Each is shown where the name actually sits in the chosen screen (`.longbeard/design/direction/prototype/first.html`), at that size and on that ground, and once large on its own. Where the chosen screen does not show the name at all, that stays so: the mark is for the places that do (the navigation, the tab, the favicon). Capture them and set them on one sheet:
36
40
 
@@ -39,7 +43,7 @@ node <skill>/scripts/capture.mjs "file://$PWD/.longbeard/design/wordmark/1.html"
39
43
  node <skill>/scripts/sheet.mjs .longbeard/design/wordmark/sheet.html .longbeard/design/wordmark/1.png … --cols 3
40
44
  ```
41
45
 
42
- Each with one line of what it does ("the A's crossbar is the accent bar"). Numbered, never ranked.
46
+ Each with one line of what it does ("the A's crossbar is the accent bar"), and a fact when it breaks one of the direction's principles. Numbered, never ranked.
43
47
 
44
48
  > Which mark? Or one to push further ("2, but tighter").
45
49
 
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  // Lay screenshots out as one numbered sheet, so a round of first screens can
3
3
  // be seen and picked from together. It writes an HTML page; capture.mjs turns
4
- // that into the picture to show. No dependencies.
4
+ // that into the picture to show. The page is marked as a sheet, so links.mjs never
5
+ // counts it as a page of the prototype. No dependencies.
5
6
  //
6
7
  // node sheet.mjs .longbeard/design/direction/grid/sheet.html .longbeard/design/direction/grid/1.png .longbeard/design/direction/grid/2.png …
7
8
  // node sheet.mjs .longbeard/design/direction/grid/vary.html --cols 5 .longbeard/design/direction/grid/v*.png
@@ -49,6 +50,7 @@ writeFileSync(
49
50
  out,
50
51
  `<!doctype html>
51
52
  <meta charset="utf-8">
53
+ <meta name="generator" content="longbeard sheet">
52
54
  <title>Sheet</title>
53
55
  <style>
54
56
  body { margin: 0; padding: 24px; background: #6f6f6f; font: 600 22px/1 system-ui, sans-serif; }
@@ -19,7 +19,7 @@ The brief says what and for whom, never how. No framework, database, host or lib
19
19
 
20
20
  Look at the repo. Do not ask what is there.
21
21
 
22
- 1. `docs/brief.md` exists and they bring a feature → not this skill. Grill the feature: they type `/grill-with-docs` when it brings new terms, otherwise load `grilling`. Then they type `/to-spec`. The brief stays as it is.
22
+ 1. `docs/brief.md` exists and they bring a feature → not this skill. Grill the feature: they type `/grill-with-docs` when it brings new terms, otherwise load `grilling`. Then they type `/to-spec` and `/to-tickets` in the same session: `to-spec` asks nothing and writes from the conversation. The brief stays as it is.
23
23
  2. `docs/brief.md` exists and the product itself changes (new people, new surface, a flow dropped) → **Change**.
24
24
  3. No brief, and the repo has code or a README → **Existing project**.
25
25
  4. Otherwise → **New idea**.
@@ -103,8 +103,8 @@ Read the brief. Grill only what changes and what hangs off it: a new surface reo
103
103
  Offer the next stage in one line, from the stages the router lists. A stage whose file already exists is done, so go past it:
104
104
 
105
105
  - Site, app or graphic, no `DESIGN.md` → `design`, which suggests the first design skill (`design-brief`).
106
- - No UI, or `DESIGN.md` exists → Design is skipped. Next is Architecture: they type `/grill-with-docs`.
107
- - `GLOSSARY.md` exists too → next is Plan: they type `/to-spec` for the first flow or feature.
106
+ - No UI, or `DESIGN.md` exists → Design is skipped. Next is Architecture: they type `/grill-with-docs`. Its design tree is the stack (language, framework, data, hosting) and the words the brief and any Figma screens already use. It ends with the stack as an ADR in `docs/adr/`.
107
+ - A stack ADR exists too → next is Plan: grill the first flow with `grilling`, then they type `/to-spec` and `/to-tickets` in the same session.
108
108
 
109
109
  With no Architecture stage in the router (a design-only install), the next stage is `design` for a site or app. Otherwise the brief is the result.
110
110