@jonandev/longbeard 0.5.2 → 0.8.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.
package/bin/long-beard.js CHANGED
@@ -1,9 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { spawnSync } from "node:child_process";
4
- import { existsSync, mkdirSync, readdirSync, readFileSync, readSync, statSync, writeFileSync } from "node:fs";
4
+ import { createHash } from "node:crypto";
5
+ import {
6
+ cpSync,
7
+ existsSync,
8
+ lstatSync,
9
+ mkdirSync,
10
+ readdirSync,
11
+ readFileSync,
12
+ readSync,
13
+ rmSync,
14
+ statSync,
15
+ writeFileSync,
16
+ } from "node:fs";
5
17
  import { homedir } from "node:os";
6
- import { dirname, join, resolve } from "node:path";
18
+ import { dirname, join, relative, resolve } from "node:path";
7
19
  import { fileURLToPath } from "node:url";
8
20
 
9
21
  const root = join(dirname(fileURLToPath(import.meta.url)), "..");
@@ -32,6 +44,9 @@ The catalog is beard.json. The command is longbeard, via npx in the project.
32
44
 
33
45
  init installs missing skills from beard.json. A skill already present for an agent is left there.
34
46
  update installs anything new, refreshes only items in beard-lock.json, and rewrites the AGENTS.md block.
47
+ A skill written here is copied from the installed package when its version moved, and the line says which versions.
48
+ A kit (ponytail, Matt Pocock) is every skill its author publishes. update adds new ones and removes retired ones you did not edit.
49
+ Install the package first (npm install -D @jonandev/longbeard@latest); update does not fetch it.
35
50
  add in a project writes beard.local.json (an extra, not a second kit). remove omits a kit skill here.
36
51
  --agent skips the agent list and installs for that tool. Repeat it.
37
52
  --force replaces local edits of skills this command installed.
@@ -215,6 +230,50 @@ function writeExtra(flags, state) {
215
230
  });
216
231
  }
217
232
 
233
+ // A kit is what its author publishes: the skills in their plugin manifest, else
234
+ // every folder in their skills/. Read at install time so a new or retired skill
235
+ // follows the author, not this catalog.
236
+ async function kitSkills(item) {
237
+ const repo = item.source.match(/github\.com\/([^/]+\/[^/#?]+)/)?.[1]?.replace(/\.git$/, "");
238
+ if (!repo) fail(`${item.name}: a kit needs a GitHub source.`);
239
+ // update retires what this list leaves out, so a failed fetch must stop here,
240
+ // never fall through to a guess. Only a missing manifest (404) falls back.
241
+ const cannot = `Could not list the ${item.name} kit from GitHub. Check the network and try again.`;
242
+ const get = async (url) => {
243
+ try {
244
+ const res = await fetch(url);
245
+ if (res.status === 404) return null;
246
+ if (!res.ok) fail(`${cannot} (${res.status} from ${url})`);
247
+ return await res.json();
248
+ } catch {
249
+ fail(cannot);
250
+ }
251
+ };
252
+ const manifest = await get(`https://raw.githubusercontent.com/${repo}/HEAD/.claude-plugin/plugin.json`);
253
+ const names = Array.isArray(manifest?.skills)
254
+ ? manifest.skills.map((path) => path.replace(/\/$/, "").split("/").pop())
255
+ : ((await get(`https://api.github.com/repos/${repo}/git/trees/HEAD?recursive=1`))?.tree ?? [])
256
+ .map((entry) => entry.path.match(/^skills\/([^/]+)\/SKILL\.md$/)?.[1])
257
+ .filter(Boolean);
258
+ if (names.length === 0) fail(cannot);
259
+ return names;
260
+ }
261
+
262
+ async function expandKits(skills, omit) {
263
+ const out = [];
264
+ for (const item of skills) {
265
+ if (!item.kit) {
266
+ out.push(item);
267
+ continue;
268
+ }
269
+ for (const name of await kitSkills(item)) {
270
+ if (omit.includes(name)) continue;
271
+ out.push({ name, source: item.source, author: item.author, license: item.license, kit: item.name });
272
+ }
273
+ }
274
+ return out;
275
+ }
276
+
218
277
  function chosen(flags) {
219
278
  const manifest = curated();
220
279
  const extra = extraState(flags);
@@ -374,16 +433,24 @@ function childDirs(dir) {
374
433
  }
375
434
  }
376
435
 
436
+ // Claude Code lists installed plugins in installed_plugins.json. A plugin keeps
437
+ // a skill anywhere under its install path: skills/<name> or skills/<group>/<name>.
377
438
  function pluginHas(name) {
378
- for (const base of [join(homedir(), ".claude", "plugins"), join(process.cwd(), ".claude", "plugins")]) {
379
- for (const plugin of childDirs(base)) {
380
- if (existsSync(join(plugin, "skills", name, "SKILL.md"))) return true;
381
- for (const nested of childDirs(plugin)) {
382
- if (existsSync(join(nested, "skills", name, "SKILL.md"))) return true;
383
- }
384
- }
439
+ let installs;
440
+ try {
441
+ installs = Object.values(readJson(join(homedir(), ".claude", "plugins", "installed_plugins.json")).plugins ?? {}).flat();
442
+ } catch {
443
+ return false;
385
444
  }
386
- return false;
445
+ const here = resolve(process.cwd());
446
+ const find = (dir, depth) =>
447
+ existsSync(join(dir, name, "SKILL.md")) || (depth > 0 && childDirs(dir).some((child) => find(child, depth - 1)));
448
+ return installs.some(
449
+ (install) =>
450
+ install.installPath &&
451
+ (install.scope === "user" || !install.projectPath || resolve(install.projectPath) === here) &&
452
+ find(install.installPath, 3),
453
+ );
387
454
  }
388
455
 
389
456
  function agentDir(agent, global) {
@@ -412,39 +479,91 @@ function writeLock(flags, lock) {
412
479
  writeJson(lockFile(flags, true), { version: 1, skills: lock.skills });
413
480
  }
414
481
 
415
- function recordInstall(lock, skill, agents) {
482
+ function packageVersion() {
483
+ try {
484
+ return readJson(join(root, "package.json")).version ?? "";
485
+ } catch {
486
+ return "";
487
+ }
488
+ }
489
+
490
+ function recordInstall(lock, skill, agents, global) {
416
491
  const prev = lock.skills[skill.name] ?? { agents: [] };
492
+ const all = [...new Set([...prev.agents, ...agents])];
493
+ const folder = skillFolders(skill.name, all, global)[0];
417
494
  lock.skills[skill.name] = {
418
495
  source: skill.source,
419
496
  author: skill.author,
420
- agents: [...new Set([...prev.agents, ...agents])],
497
+ agents: all,
421
498
  installedAt: new Date().toISOString(),
499
+ ...(skill.kit ? { kit: skill.kit } : {}),
500
+ ...(skill.source === "local" ? { version: packageVersion() } : {}),
501
+ ...(folder ? { hash: folderHash(folder) } : {}),
502
+ };
503
+ }
504
+
505
+ // A clone or a checkout rewrites every mtime, so an edit is a change of content.
506
+ function folderHash(dir) {
507
+ const hash = createHash("sha256");
508
+ const walk = (at) => {
509
+ for (const name of readdirSync(at).sort()) {
510
+ if (name === ".DS_Store") continue;
511
+ const file = join(at, name);
512
+ if (statSync(file).isDirectory()) walk(file);
513
+ else hash.update(`${relative(dir, file)}\0`).update(readFileSync(file));
514
+ }
422
515
  };
516
+ walk(dir);
517
+ return hash.digest("hex");
518
+ }
519
+
520
+ // The skills CLI can only update what it can fetch. A kit skill lives in this
521
+ // package, so update copies it here instead of reporting "up to date" over a
522
+ // stale file.
523
+ function copyLocalSkill(name, agents, global) {
524
+ const from = join(root, "skills", name);
525
+ if (!existsSync(join(from, "SKILL.md"))) return false;
526
+ let copied = false;
527
+ for (const dir of new Set(agents.map((agent) => agentDir(agent, global)))) {
528
+ const to = join(dir, name);
529
+ if (existsSync(to)) {
530
+ // A link already points at this package. Replacing it would pin a copy.
531
+ if (lstatSync(to).isSymbolicLink()) continue;
532
+ rmSync(to, { recursive: true, force: true });
533
+ }
534
+ mkdirSync(dirname(to), { recursive: true });
535
+ cpSync(from, to, { recursive: true });
536
+ copied = true;
537
+ }
538
+ return copied;
423
539
  }
424
540
 
425
- function skillMarkdown(name, agents, global) {
426
- const files = [];
541
+ function skillFolders(name, agents, global) {
542
+ const folders = [];
427
543
  const seen = new Set();
428
544
  for (const agent of agents) {
429
- const file = join(agentDir(agent, global), name, "SKILL.md");
430
- if (seen.has(file)) continue;
431
- seen.add(file);
432
- if (existsSync(file)) files.push(file);
545
+ const folder = join(agentDir(agent, global), name);
546
+ if (seen.has(folder)) continue;
547
+ seen.add(folder);
548
+ if (existsSync(join(folder, "SKILL.md"))) folders.push(folder);
433
549
  }
434
- return files;
550
+ return folders;
435
551
  }
436
552
 
437
553
  function locallyEdited(name, entry, agents, global) {
554
+ const folders = skillFolders(name, entry?.agents ?? agents, global);
555
+ if (entry?.hash) return folders.some((folder) => folderHash(folder) !== entry.hash);
556
+ // Locks written before 0.6.1 have no hash. The next update records one.
438
557
  const installed = Date.parse(entry?.installedAt ?? "");
439
558
  if (Number.isNaN(installed)) return false;
440
- return skillMarkdown(name, entry.agents ?? agents, global).some((file) => statSync(file).mtimeMs > installed + 2000);
559
+ return folders.some((folder) => statSync(join(folder, "SKILL.md")).mtimeMs > installed + 2000);
441
560
  }
442
561
 
443
562
  function generateRouter(items) {
444
- const lines = items.filter((item) => kind(item) === "skill").map((item) => {
445
- const when = item.when?.trim() || item.name;
446
- const why = item.why?.trim();
447
- return why ? `- ${when}: ${item.name}. ${why}` : `- ${when}: ${item.name}`;
563
+ const line = (when, name, why) => (why?.trim() ? `- ${when}: ${name}. ${why.trim()}` : `- ${when}: ${name}`);
564
+ const lines = items.filter((item) => kind(item) === "skill").flatMap((item) => {
565
+ if (item.kit) return (item.routes ?? []).map((route) => line(route.when, route.skill, route.why));
566
+ return [line(item.when?.trim() || item.name, item.name, item.why)];
448
567
  });
449
568
  return `# Long Beard
450
569
 
@@ -452,7 +571,7 @@ The project's own code, conventions, and DESIGN.md win.
452
571
 
453
572
  Load only what the task needs. Leave the rest unread.
454
573
 
455
- A marketing site is the page a person lands on to understand or choose. An application is the tool they come back to. Official look wins: DESIGN.md, then Figma, then the board. Hunt finds references and proposes an adaptation; it does not code the page. After they pick a leading reference, open the moodboard, say what we take, change, and leave, then ask once to write or update DESIGN.md — only on yes. Code the page only when they asked to build. Direction-only stops after persist. A site hunts live pages; an application hunts screen shots. With a direction already, hunt only the piece.
574
+ A marketing site is the page a person lands on to understand or choose. An application is the tool they come back to. Official look wins: DESIGN.md, then Figma, then the board. Hunt finds references and proposes an adaptation; it does not code the page. Open the moodboard before they pick, say what we take, change, and leave, then ask to write or update DESIGN.md as its own message — once more, first, if they move on without answering — only on yes. Code the page only when they asked to build. Direction-only stops after the next-step offer. A site hunts live pages; an application hunts screen shots. With a direction already, hunt only the piece.
456
575
 
457
576
  ${lines.join("\n")}
458
577
 
@@ -462,6 +581,12 @@ Write so a person can use the reply in one read. End with what you did not check
462
581
  `;
463
582
  }
464
583
 
584
+ // AGENTS.md in this repository is this output, without the optional skills.
585
+ // `npm run router` rewrites it; `npm test` fails when the two drift.
586
+ function kitRouter() {
587
+ return generateRouter(catalog(curated()).filter((item) => !item.optional));
588
+ }
589
+
465
590
  function pointerWrites(flags, agents) {
466
591
  if (flags.global) {
467
592
  const home = join(homedir(), ".longbeard");
@@ -581,14 +706,15 @@ function setCatalog(manifest, items) {
581
706
  }
582
707
 
583
708
  function remember(lock, flags, skills, agents) {
584
- for (const skill of skills) recordInstall(lock, skill, skill.agentsNeed ?? agents);
709
+ for (const skill of skills) recordInstall(lock, skill, skill.agentsNeed ?? agents, flags.global);
585
710
  writeLock(flags, lock);
586
711
  }
587
712
 
588
- function init(flags) {
713
+ async function init(flags) {
589
714
  requireProject(flags);
590
- const { manifest, skills, items, later } = chosen(flags);
715
+ const { manifest, extra, items, later, ...picked } = chosen(flags);
591
716
  const agents = chooseAgents(manifest, flags, { pick: true, lock: readLock(flags) });
717
+ const skills = await expandKits(picked.skills, extra.omit);
592
718
  const classified = classify(skills, agents, flags);
593
719
  classified.later = later;
594
720
  plan("init", flags, agents, classified);
@@ -604,31 +730,66 @@ function init(flags) {
604
730
  ]);
605
731
  }
606
732
 
607
- function update(flags) {
733
+ async function update(flags) {
608
734
  requireProject(flags);
609
- const { manifest, skills, items, later } = chosen(flags);
735
+ const { manifest, extra, items, later, ...picked } = chosen(flags);
610
736
  const agents = chooseAgents(manifest, flags, { pick: false, lock: readLock(flags) });
737
+ const skills = await expandKits(picked.skills, extra.omit);
611
738
  const classified = classify(skills, agents, flags);
612
739
  classified.later = later;
740
+ // A skill its author stopped publishing leaves with the kit, unless you edited it.
741
+ const kits = new Set(picked.skills.filter((item) => item.kit).map((item) => item.name));
742
+ const listed = new Set(skills.map((skill) => skill.name));
743
+ const retired = Object.entries(classified.lock.skills)
744
+ .filter(([name, entry]) => kits.has(entry.kit) && !listed.has(name) && !extra.omit.includes(name))
745
+ .map(([name, entry]) => ({ name, author: entry.author, edited: locallyEdited(name, entry, agents, flags.global) }));
746
+ const drop = retired.filter((skill) => !skill.edited);
613
747
  plan("update", flags, agents, classified);
748
+ rows("retired", yellow, drop, "The author no longer publishes it. Removed with the kit.", nameWidth([retired]));
749
+ rows("retired, kept", yellow, retired.filter((skill) => skill.edited), "The author no longer publishes it. Kept because you edited it.", nameWidth([retired]));
614
750
  confirmWrite(flags, classified.writes);
751
+ if (drop.length > 0) {
752
+ const args = ["remove", ...drop.map((skill) => skill.name), "-y"];
753
+ if (flags.global) args.push("--global");
754
+ for (const agent of agents) args.push("--agent", agent);
755
+ runSkills(args);
756
+ for (const skill of drop) delete classified.lock.skills[skill.name];
757
+ }
615
758
  const refresh = flags.force ? [...classified.ours, ...classified.edited] : classified.ours;
616
759
  if (classified.missing.length > 0) say(dim("Installing…"));
617
760
  installSkills(classified.missing, { global: flags.global, agents });
618
761
  remember(classified.lock, flags, classified.missing, agents);
619
- if (refresh.length > 0) {
620
- say(dim("Refreshing…"));
621
- const args = ["update", ...refresh.map((skill) => skill.name), "-y"];
762
+ const here = packageVersion();
763
+ const local = refresh.filter((skill) => skill.source === "local");
764
+ const theirs = refresh.filter((skill) => skill.source !== "local");
765
+ const stale = flags.force
766
+ ? local
767
+ : local.filter((skill) => (classified.lock.skills[skill.name]?.version ?? "") !== here);
768
+ let copied = 0;
769
+ if (stale.length > 0 || theirs.length > 0) say(dim("Refreshing…"));
770
+ for (const skill of stale) {
771
+ const was = classified.lock.skills[skill.name]?.version || "unknown";
772
+ if (!copyLocalSkill(skill.name, skill.agentsNeed ?? agents, flags.global)) continue;
773
+ copied += 1;
774
+ say(was === here ? ` ${skill.name} ${here}, replaced` : ` ${skill.name} ${was} → ${here}`);
775
+ }
776
+ for (const skill of local) {
777
+ if (stale.includes(skill)) continue;
778
+ say(dim(` ${skill.name} ${here}, already there`));
779
+ }
780
+ if (theirs.length > 0) {
781
+ const args = ["update", ...theirs.map((skill) => skill.name), "-y"];
622
782
  if (flags.global) args.push("--global");
623
783
  else args.push("--project");
624
784
  runSkills(args);
625
- remember(readLock(flags), flags, refresh, agents);
626
785
  }
786
+ if (refresh.length > 0) remember(readLock(flags), flags, refresh, agents);
627
787
  writePointers(flags, items);
628
788
  const held = flags.force ? classified.theirs.length : classified.theirs.length + classified.edited.length;
629
789
  finish([
630
790
  green("Done."),
631
- `${classified.missing.length} installed, ${refresh.length} refreshed, ${held} left as they are.`,
791
+ `${classified.missing.length} installed, ${copied + theirs.length} refreshed, ${drop.length} retired, ${held} left as they are.`,
792
+ `This is Long Beard ${here}. Run npm install -D @jonandev/longbeard@latest first if a newer one is out.`,
632
793
  flags.global ? "Rewrote ~/.longbeard/AGENTS.md." : "Rewrote the AGENTS.md block.",
633
794
  ]);
634
795
  }
@@ -647,9 +808,10 @@ function add(flags, rest) {
647
808
  }
648
809
  setCatalog(manifest, items);
649
810
  writeJson(curatedFile, manifest);
811
+ writeFileSync(join(root, "AGENTS.md"), kitRouter());
650
812
  heading("add", flags, curated().agents);
651
813
  rows("catalog", green, flags.skill.map((name) => entry(name, source, flags)), "", 16);
652
- finish([green("Done."), "Wrote beard.json. Commit it and push. Projects pick this up on update."]);
814
+ finish([green("Done."), "Wrote beard.json and AGENTS.md. Commit them and push. Projects pick this up on update."]);
653
815
  return;
654
816
  }
655
817
  const extra = extraState(flags);
@@ -690,13 +852,19 @@ function remove(flags, rest) {
690
852
  }
691
853
  setCatalog(manifest, items.filter((item) => !names.includes(item.name)));
692
854
  writeJson(curatedFile, manifest);
855
+ writeFileSync(join(root, "AGENTS.md"), kitRouter());
693
856
  heading("remove", flags, curated().agents);
694
857
  rows("catalog", yellow, names.map((name) => ({ name })), "", 16);
695
- finish([green("Done."), "Wrote beard.json. Commit it and push."]);
858
+ finish([green("Done."), "Wrote beard.json and AGENTS.md. Commit them and push."]);
696
859
  return;
697
860
  }
698
861
  const { manifest, extra } = chosen(flags);
699
- const shared = new Set(catalog(manifest).map((item) => item.name));
862
+ const lock = readLock(flags);
863
+ // A skill a kit installed can be omitted like a catalog item.
864
+ const shared = new Set([
865
+ ...catalog(manifest).map((item) => item.name),
866
+ ...Object.keys(lock.skills).filter((name) => lock.skills[name].kit),
867
+ ]);
700
868
  const extraNames = new Set(extra.items.map((item) => item.name));
701
869
  for (const name of names) {
702
870
  if (!shared.has(name) && !extraNames.has(name) && !extra.omit.includes(name)) {
@@ -708,7 +876,6 @@ function remove(flags, rest) {
708
876
  if (shared.has(name) && !extra.omit.includes(name)) extra.omit.push(name);
709
877
  }
710
878
  writeExtra(flags, extra);
711
- const lock = readLock(flags);
712
879
  const ours = names.filter((name) => lock.skills[name]);
713
880
  const agents = chooseAgents(manifest, flags, { pick: false, lock });
714
881
  heading("remove", flags, agents);
@@ -734,7 +901,8 @@ function printSkill(skill, width, extra) {
734
901
  const mark = extra.omit?.includes(skill.name) ? yellow("omitted ") : skill.optional ? dim("optional") : green("kept ");
735
902
  const credit = [skill.author, skill.license].filter(Boolean).join(", ");
736
903
  say(`${mark} ${skill.name.padEnd(width)} ${dim(credit)}`);
737
- if (skill.why) say(` ${skill.why}`);
904
+ const why = skill.why ?? (skill.kit ? `Every skill ${skill.author} publishes, kept current on update.` : "");
905
+ if (why) say(` ${why}`);
738
906
  }
739
907
 
740
908
  function list(flags) {
@@ -758,9 +926,10 @@ function list(flags) {
758
926
  const { command, rest, flags } = parseArgs(process.argv.slice(2));
759
927
  if (flags.version) console.log(readJson(join(root, "package.json")).version);
760
928
  else if (flags.help || command === "help") console.log(help);
761
- else if (command === "init") init(flags);
929
+ else if (command === "init") await init(flags);
762
930
  else if (command === "add") add(flags, rest);
763
931
  else if (command === "remove") remove(flags, rest);
764
- else if (command === "update") update(flags);
932
+ else if (command === "update") await update(flags);
765
933
  else if (command === "list") list(flags);
934
+ else if (command === "router") process.stdout.write(kitRouter());
766
935
  else fail(`Unknown command: ${command}\n\n${help}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jonandev/longbeard",
3
- "version": "0.5.2",
3
+ "version": "0.8.0",
4
4
  "description": "Designs like an Art director. Codes like a senior.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -40,6 +40,8 @@
40
40
  "node": ">=18"
41
41
  },
42
42
  "scripts": {
43
- "longbeard": "node ./bin/long-beard.js"
43
+ "longbeard": "node ./bin/long-beard.js",
44
+ "router": "node ./bin/long-beard.js router > AGENTS.md",
45
+ "test": "node --test"
44
46
  }
45
47
  }
@@ -2,12 +2,14 @@
2
2
  name: design-md
3
3
  description: >
4
4
  Use when building or changing UI and the project has a DESIGN.md, or when
5
- they confirmed writing or updating the brand file after a hunt. Follow that
6
- file. Write or update DESIGN.md only from the adaptation they confirmed
7
- after a hunt — colour, type, control, what we take, what we change, and
8
- leave. Do not copy a reference’s exact palette or faces. Do not invent a
9
- look they did not accept. If they asked to design or define direction and
10
- there is no DESIGN.md and no Figma, that is design-reference-hunt first.
5
+ they confirmed writing or updating the brand file. Follow that file. Write
6
+ or update DESIGN.md only from what they confirmed: the adaptation after a
7
+ hunt, or decisions they approved on a rendered prototype (with the reason,
8
+ the date, and a contrast check). DESIGN.md names ideas, never sources or
9
+ .design paths. Do not copy a reference’s exact palette or faces. Do not
10
+ invent a look they did not accept. If they asked to design or define
11
+ direction and there is no DESIGN.md and no Figma, that is
12
+ design-reference-hunt first.
11
13
  ---
12
14
 
13
15
  # DESIGN.md
@@ -16,37 +18,47 @@ The project's `DESIGN.md` is the durable look. Coding follows it when it exists.
16
18
 
17
19
  ## Follow
18
20
 
19
- If the file exists, read it before writing UI. Use its colour, type, spacing, control, and components the way that file states them.
21
+ If the file exists, read it before writing UI. Use its colour, type, spacing, control, behaviour, and components the way that file states them.
20
22
 
21
23
  They asked to **hunt**, **define direction**, or find references → load `design-reference-hunt`. Do not rewrite this file until they confirm after that pass.
22
24
 
23
25
  ## Write or update (only on confirm)
24
26
 
25
- Write or change `DESIGN.md` only when they said yes to persisting the adaptation (after a whole-look leading pick, or after accepting a later hunt). Do not invent hexes, faces, or controls. Do not copy the leading card’s `colour` or `type` into the brand. Take the adaptation from:
27
+ Write or change `DESIGN.md` only when they said yes to persisting the adaptation (after a whole-look leading pick, or after accepting a later hunt), or approved a decision on a rendered prototype (below). Do not invent hexes, faces, or controls. Do not copy the leading card’s `colour` or `type` into the brand. Take the adaptation from:
26
28
 
27
- - `.design/board.md` **Read this** (`take`, `change`, `colour`, `type`, `control`, `leave`), or
28
- - `.design/hunts/<slug>/note.md` when the change is a later pass they accepted
29
+ - `.design/board.md` **Read this** (`take`, `change`, `ownable`, `colour`, `type`, `control`, `behaviour`, `leave`, `gaps`), or
30
+ - `.design/hunts/<slug>/board.md` **Read this** when the change is a later pass they accepted
29
31
 
30
- `.design/moodboard.html` is the references. Do not read it as the brand.
32
+ `.design/moodboard.html` is the references. Do not read it as the brand: the brand is **Read this**.
31
33
 
32
- If **Read this** has no `take`, `change`, `colour`, or `type`, stop and send it back to the hunt. Do not fill those in here.
34
+ If a whole-look **Read this** has no `take`, `change`, `colour`, or `type`, or has no `ownable`, stop and send it back to the hunt. Do not fill those in here.
33
35
 
34
36
  If neither file exists, ask which reference to follow. Do not guess.
35
37
 
36
38
  Refuse to write a colour palette whose text/background pairs have not been through contrast check. On a board from `design-reference-hunt`, **Read this** `contrast` lists each adapted pair with ratio and verdict (`scripts/contrast.mjs`). Body and small text need 4.5:1; large text and non-text marks need 3:1. If pairs are missing or any still FAIL, send the board back — do not write failing hexes into `DESIGN.md`.
37
39
 
40
+ **Ideas, not sources.** `DESIGN.md` is usually committed, and often public; `.design/` is not. It never names a product, site, studio, or designer the hunt looked at, never cites a `.design/` path, and its contrast notes name our tokens, not a reference's colour. The board's card names and its `leave` line name sources, which is fine there. Turn each into the idea before it crosses: “a quiet reading page, light and dark”, not the product it came from; “a bright brand accent”, not whose.
41
+
42
+ ## Decisions approved on a prototype
43
+
44
+ Most of a design is made after the direction, on rendered screens: the controls, the text sizes, the navigation, the states. When they approve one of those decisions on a rendered prototype, it may go into `DESIGN.md` without a hunt. Write what was approved, the reason they gave, and the date, under **Decisions**. Every new or changed colour token — a surface, a pressed state, a selection, a focus ring, a faint control — goes through the hunt skill's `scripts/contrast.mjs` first, with the same thresholds. An `ownable` element marked unconfirmed is confirmed here, once they have seen it rendered, or replaced.
45
+
46
+ ## The file
47
+
38
48
  Expand the adaptation into a short brand file a builder can follow without the shots open:
39
49
 
40
50
  ```markdown
41
51
  # Design
42
52
 
53
+ To see it working: <prototype path, once there is one>. This file wins where they differ.
54
+
43
55
  ## Direction
44
- - leads: <card name>
45
- - also: <card name, or none>
46
- - from: .design/board.md | .design/hunts/<slug>/note.md
47
- - take: <from Read this>
56
+ - leads: <the idea that leads, in our words>
57
+ - also: <other ideas they liked, in our words, or none>
58
+ - draws on: <what we learn from them: a layout, a temperature, a kind of picture>
48
59
  - change: <the twist>
49
- - leave: <their name, their exact colours, their exact faces, and the rest>
60
+ - ownable: <the one concrete element from the project’s own identity; “unconfirmed” until seen rendered>
61
+ - leave: <ideas we do not use, in our words: “a bright brand accent”, never a product's name>
50
62
 
51
63
  ## Colour
52
64
  - <adapted hex>: <where it sits — ground, text, accent, control fill only if the shot fills one>
@@ -60,11 +72,20 @@ Expand the adaptation into a short brand file a builder can follow without the s
60
72
  ## Layout
61
73
  - <what we take that still belongs on this topic. Form cards: layout or component only, not their type or colours>
62
74
 
75
+ ## Behaviour
76
+ - <how the page moves, pages, fades, or reveals. Omit the section when Read this says none>
77
+
63
78
  ## Imagery
64
79
  - <what the pictures are, if any>
65
80
 
81
+ ## Gaps
82
+ - <screens with no strong reference, from Read this. A builder treats these as open, not as solved by a borrowed pattern. A prototype closes them>
83
+
84
+ ## Decisions
85
+ - <date>: <what they approved on the prototype> — <the reason they gave>
86
+
66
87
  ## Do not
67
- - <the leave line>
88
+ - <the leave line, as ideas>
68
89
  ```
69
90
 
70
91
  A **later hunt** they accepted: update only the sections that pass changes (often Layout, sometimes Control). Keep colour and type unless they explicitly accepted a change to those. Say in chat what you changed.