@jonandev/longbeard 0.11.2 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +4 -5
- package/CHANGELOG.md +72 -0
- package/README.md +64 -43
- package/beard.json +124 -28
- package/bin/long-beard.js +171 -36
- package/package.json +1 -1
- package/skills/design/SKILL.md +51 -126
- package/skills/design-brief/SKILL.md +146 -0
- package/skills/design-brief/references/graphic.md +59 -0
- package/skills/design-check/SKILL.md +27 -11
- package/skills/design-check/references/design-rules.md +21 -7
- package/skills/design-check/scripts/capture.mjs +121 -37
- package/skills/design-check/scripts/contrast.mjs +23 -9
- package/skills/design-check/scripts/rules.mjs +613 -0
- package/skills/design-check/scripts/screen-contrast.mjs +428 -0
- package/skills/design-check/scripts/tokens.mjs +346 -0
- package/skills/design-content/SKILL.md +118 -0
- package/skills/design-content/scripts/contact-sheet.mjs +259 -0
- package/skills/design-content/scripts/pictures.mjs +197 -0
- package/skills/design-direction/SKILL.md +115 -200
- package/skills/design-direction/references/controls.md +58 -0
- package/skills/{design → design-direction}/references/design-rules.md +21 -7
- package/skills/design-direction/references/five-second.md +47 -0
- package/skills/design-direction/references/full-build.md +19 -0
- package/skills/design-direction/references/graphic.md +35 -0
- package/skills/design-direction/references/grid.md +114 -0
- package/skills/design-direction/references/library.md +75 -0
- package/skills/design-direction/references/screen-template.html +233 -0
- package/skills/design-direction/references/subject.md +33 -0
- package/skills/design-direction/scripts/capture.mjs +121 -37
- package/skills/design-direction/scripts/contact-sheet.mjs +18 -7
- package/skills/design-direction/scripts/fonts.mjs +276 -0
- package/skills/design-direction/scripts/layout-diff.mjs +118 -0
- package/skills/design-direction/scripts/measure.mjs +1728 -0
- package/skills/design-direction/scripts/moodboard.mjs +123 -32
- package/skills/design-direction/scripts/picture-cast.mjs +270 -0
- package/skills/design-direction/scripts/pictures.mjs +197 -0
- package/skills/design-direction/scripts/screen-contrast.mjs +428 -0
- package/skills/design-direction/scripts/sheet.mjs +67 -0
- package/skills/design-direction/scripts/subject-colours.mjs +410 -0
- package/skills/design-families/SKILL.md +138 -0
- package/skills/design-families/scripts/contact-sheet.mjs +259 -0
- package/skills/design-families/scripts/families.mjs +606 -0
- package/skills/design-families/scripts/measure.mjs +1728 -0
- package/skills/design-families/scripts/moodboard.mjs +467 -0
- package/skills/design-families/scripts/tag.mjs +289 -0
- package/skills/design-figma/SKILL.md +69 -0
- package/skills/design-figma/references/graphic.md +26 -0
- package/skills/design-identity/SKILL.md +134 -0
- package/skills/design-identity/references/graphic.md +8 -0
- package/skills/design-identity/references/identity-board.html +140 -0
- package/skills/{design → design-identity}/scripts/capture.mjs +121 -37
- package/skills/design-identity/scripts/colours.mjs +213 -0
- package/skills/design-identity/scripts/contrast.mjs +41 -0
- package/skills/design-identity/scripts/fonts.mjs +276 -0
- package/skills/design-identity/scripts/measure.mjs +1728 -0
- package/skills/design-identity/scripts/sheet.mjs +67 -0
- package/skills/design-identity/scripts/subject-colours.mjs +410 -0
- package/skills/design-moodboard/SKILL.md +184 -0
- package/skills/design-moodboard/references/graphic.md +25 -0
- package/skills/{design-direction → design-moodboard}/references/sources.md +21 -11
- package/skills/design-moodboard/scripts/capture.mjs +893 -0
- package/skills/design-moodboard/scripts/contact-sheet.mjs +259 -0
- package/skills/design-moodboard/scripts/crops.mjs +256 -0
- package/skills/design-moodboard/scripts/dribbble-cards.mjs +418 -0
- package/skills/design-moodboard/scripts/families.mjs +606 -0
- package/skills/design-moodboard/scripts/group.mjs +221 -0
- package/skills/design-moodboard/scripts/measure.mjs +1728 -0
- package/skills/design-moodboard/scripts/moodboard.mjs +467 -0
- package/skills/{design-direction → design-moodboard}/scripts/picker.mjs +121 -20
- package/skills/design-moodboard/scripts/pictures.mjs +197 -0
- package/skills/design-moodboard/scripts/tag.mjs +289 -0
- package/skills/design-prototype/SKILL.md +149 -0
- package/skills/design-prototype/references/design-md-template.md +82 -0
- package/skills/design-prototype/references/design-rules.md +203 -0
- package/skills/design-prototype/references/five-second.md +47 -0
- package/skills/design-prototype/references/graphic.md +27 -0
- package/skills/design-prototype/scripts/capture.mjs +893 -0
- package/skills/design-prototype/scripts/contrast.mjs +41 -0
- package/skills/design-prototype/scripts/links.mjs +308 -0
- package/skills/design-prototype/scripts/pictures.mjs +197 -0
- package/skills/design-prototype/scripts/rules.mjs +613 -0
- package/skills/design-prototype/scripts/screen-contrast.mjs +428 -0
- package/skills/design-prototype/scripts/sheet.mjs +67 -0
- package/skills/design-prototype/scripts/tokens.mjs +346 -0
- package/skills/design-wordmark/SKILL.md +65 -0
- package/skills/design-wordmark/scripts/capture.mjs +893 -0
- package/skills/design-wordmark/scripts/sheet.mjs +67 -0
- package/skills/framework-skills/SKILL.md +71 -0
- package/skills/idea/SKILL.md +13 -7
- package/skills/idea/references/graphic.md +64 -0
- package/skills/design/references/design-md-template.md +0 -58
- package/skills/design/scripts/contrast.mjs +0 -27
- package/skills/design-direction/scripts/dribbble-cards.mjs +0 -356
package/bin/long-beard.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
readdirSync,
|
|
11
11
|
readFileSync,
|
|
12
12
|
readSync,
|
|
13
|
+
realpathSync,
|
|
13
14
|
rmSync,
|
|
14
15
|
statSync,
|
|
15
16
|
writeFileSync,
|
|
@@ -37,8 +38,8 @@ The catalog is beard.json. The command is longbeard, via npx in the project.
|
|
|
37
38
|
npx longbeard list
|
|
38
39
|
npx longbeard --version
|
|
39
40
|
|
|
40
|
-
npx longbeard init [--global] [--all] [--skill add-on] [--no-addons] [--yes] [--agent cursor]
|
|
41
|
-
npx longbeard update [--global] [--all] [--skill add-on] [--force] [--yes]
|
|
41
|
+
npx longbeard init [--design | --full] [--global] [--all] [--skill add-on] [--no-addons] [--yes] [--agent cursor]
|
|
42
|
+
npx longbeard update [--full] [--global] [--all] [--skill add-on] [--force] [--yes]
|
|
42
43
|
npx longbeard add <source> --skill <name> --author <name> --why <text> [--when text]
|
|
43
44
|
npx longbeard remove <name>
|
|
44
45
|
|
|
@@ -51,6 +52,10 @@ add in a project writes beard.local.json (an extra, not a second kit). remove om
|
|
|
51
52
|
init lists the add-ons in a terminal, some already ticked. --all takes every add-on; --skill takes one; --no-addons takes none.
|
|
52
53
|
Each of those skips the list. An add-on you took stays and refreshes on update.
|
|
53
54
|
--agent skips the agent list and installs for that tool. Repeat it.
|
|
55
|
+
init asks, in a terminal, whether you want the whole pipeline or design only. --design is the answer for design only: the
|
|
56
|
+
brief, the design skills, design-check and the Figma skills, with a router of just those stages. --full is the whole pipeline.
|
|
57
|
+
Without either, a first init in a terminal asks, and one that cannot ask installs the whole pipeline.
|
|
58
|
+
beard-lock.json records a design-only install, and update keeps to it. init --full or update --full adds the rest.
|
|
54
59
|
--force replaces local edits of skills this command installed, and removes edited ones the catalog dropped.
|
|
55
60
|
--yes skips prompts and uses the catalog agents (cursor, claude-code) and, on a first init, the ticked add-ons.
|
|
56
61
|
This does not install marketplace plugins or replace Cursor or Claude commands.
|
|
@@ -77,9 +82,10 @@ function say(text = "") {
|
|
|
77
82
|
|
|
78
83
|
function heading(title, flags, agents) {
|
|
79
84
|
const where = flags.global ? "this machine" : "this project";
|
|
85
|
+
const shape = flags.shape && flags.shape !== "full" ? ` · ${curated().shapes?.[flags.shape]?.label ?? flags.shape}` : "";
|
|
80
86
|
say();
|
|
81
87
|
say(bold("Long Beard"));
|
|
82
|
-
say(dim(`${title} · ${where} · ${agents.join(", ")}`));
|
|
88
|
+
say(dim(`${title} · ${where}${shape} · ${agents.join(", ")}`));
|
|
83
89
|
say();
|
|
84
90
|
}
|
|
85
91
|
|
|
@@ -137,6 +143,20 @@ function writeJson(file, value) {
|
|
|
137
143
|
writeFileSync(file, `${JSON.stringify(value, null, 2)}\n`);
|
|
138
144
|
}
|
|
139
145
|
|
|
146
|
+
// A skill name becomes a folder name and, on Windows, part of a shell line. Only
|
|
147
|
+
// lowercase letters, digits and hyphens get that far, and never a leading hyphen.
|
|
148
|
+
function isSkillName(name) {
|
|
149
|
+
return typeof name === "string" && /^[a-z0-9][a-z0-9-]*$/.test(name);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function checkNames(names, where) {
|
|
153
|
+
for (const name of names) {
|
|
154
|
+
if (!isSkillName(name)) {
|
|
155
|
+
fail(`${where} has "${name}", which is not a skill name. Use lowercase letters, digits and hyphens.`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
140
160
|
function parseArgs(argv) {
|
|
141
161
|
const flags = {
|
|
142
162
|
global: false,
|
|
@@ -145,6 +165,8 @@ function parseArgs(argv) {
|
|
|
145
165
|
yes: false,
|
|
146
166
|
optional: false,
|
|
147
167
|
noAddons: false,
|
|
168
|
+
design: false,
|
|
169
|
+
full: false,
|
|
148
170
|
agents: [],
|
|
149
171
|
skill: [],
|
|
150
172
|
why: "",
|
|
@@ -161,6 +183,8 @@ function parseArgs(argv) {
|
|
|
161
183
|
else if (arg === "--yes" || arg === "-y") flags.yes = true;
|
|
162
184
|
else if (arg === "--optional") flags.optional = true;
|
|
163
185
|
else if (arg === "--no-addons") flags.noAddons = true;
|
|
186
|
+
else if (arg === "--design") flags.design = true;
|
|
187
|
+
else if (arg === "--full") flags.full = true;
|
|
164
188
|
else if (arg === "--help" || arg === "-h") flags.help = true;
|
|
165
189
|
else if (arg === "--version" || arg === "-V") flags.version = true;
|
|
166
190
|
else if (arg === "--agent" || arg === "-a") flags.agents.push(take(argv, ++i, arg));
|
|
@@ -208,7 +232,9 @@ function lockFile(flags, forWrite = false) {
|
|
|
208
232
|
}
|
|
209
233
|
|
|
210
234
|
function curated() {
|
|
211
|
-
|
|
235
|
+
const manifest = readJson(curatedFile);
|
|
236
|
+
checkNames(catalog(manifest).map((item) => item.name), "beard.json");
|
|
237
|
+
return manifest;
|
|
212
238
|
}
|
|
213
239
|
|
|
214
240
|
function catalog(manifest) {
|
|
@@ -224,7 +250,9 @@ function extraState(flags) {
|
|
|
224
250
|
const file = extraFile(flags);
|
|
225
251
|
if (!existsSync(file)) return { items: [], omit: [] };
|
|
226
252
|
const data = readJson(file);
|
|
227
|
-
|
|
253
|
+
const state = { items: data.items ?? data.skills ?? [], omit: data.omit ?? [] };
|
|
254
|
+
checkNames([...state.items.map((item) => item.name), ...state.omit], file);
|
|
255
|
+
return state;
|
|
228
256
|
}
|
|
229
257
|
|
|
230
258
|
function writeExtra(flags, state) {
|
|
@@ -273,6 +301,7 @@ async function fetchKit(item) {
|
|
|
273
301
|
.map((entry) => entry.path.match(/^skills\/([^/]+)\/SKILL\.md$/)?.[1])
|
|
274
302
|
.filter(Boolean);
|
|
275
303
|
if (names.length === 0) fail(`${cannot}: ${repo} lists no skills.`);
|
|
304
|
+
checkNames(names, `The ${item.name} kit's list`);
|
|
276
305
|
return names;
|
|
277
306
|
}
|
|
278
307
|
|
|
@@ -298,13 +327,79 @@ function knownAddons(flags) {
|
|
|
298
327
|
}
|
|
299
328
|
}
|
|
300
329
|
|
|
330
|
+
// An install is the whole pipeline, or a shape beard.json names: the items it
|
|
331
|
+
// lists (and what they suggest, through `via`), the add-ons it offers, and its
|
|
332
|
+
// own stages. A lock with no shape is the whole pipeline.
|
|
333
|
+
function shapeOf(flags) {
|
|
334
|
+
return flags.shape ?? readLock(flags).shape;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function shapeDef(manifest, name) {
|
|
338
|
+
if (name === "full") return null;
|
|
339
|
+
const def = manifest.shapes?.[name];
|
|
340
|
+
if (!def) fail(`${name} is not an install shape in beard.json.`);
|
|
341
|
+
return def;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// The shape's add-ons are the only ones it offers. Naming one with --skill still takes it.
|
|
345
|
+
function shapeKeeps(manifest, name) {
|
|
346
|
+
const def = shapeDef(manifest, name);
|
|
347
|
+
if (!def) return () => true;
|
|
348
|
+
const listed = new Set(def.items);
|
|
349
|
+
return (item) => (item.optional ? (def.addons ?? []).includes(item.name) : listed.has(item.name) || listed.has(item.via));
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function shapeStages(manifest, name) {
|
|
353
|
+
const def = shapeDef(manifest, name);
|
|
354
|
+
const stages = manifest.stages ?? [];
|
|
355
|
+
if (!def) return stages;
|
|
356
|
+
return Object.entries(def.stages).map(([stage, skills]) => ({ ...stages.find((one) => one.name === stage), skills }));
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// --design and --full say which; without either, an install keeps the shape its lock records.
|
|
360
|
+
function resolveShape(flags) {
|
|
361
|
+
if (flags.design && flags.full) fail("--design and --full are opposites. Pass one.");
|
|
362
|
+
const lock = readLock(flags);
|
|
363
|
+
if (flags.design) {
|
|
364
|
+
if (Object.keys(lock.skills).length > 0 && lock.shape === "full") {
|
|
365
|
+
fail("This has the whole pipeline already. --design is for a project that has not run init, and --full is how a design-only install grows.");
|
|
366
|
+
}
|
|
367
|
+
return "design";
|
|
368
|
+
}
|
|
369
|
+
return flags.full ? "full" : lock.shape;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// One question, asked on a first init in a terminal, when neither flag answered it.
|
|
373
|
+
function askShape(manifest, flags) {
|
|
374
|
+
if (flags.design || flags.full || flags.yes || !process.stdin.isTTY || existsSync(lockFile(flags))) return;
|
|
375
|
+
const names = Object.keys(manifest.shapes ?? {});
|
|
376
|
+
if (names.length === 0) return;
|
|
377
|
+
const shape = manifest.shapes[names[0]];
|
|
378
|
+
say(bold(`${shape.label}, or the whole pipeline?`));
|
|
379
|
+
say(" 1 The whole pipeline: idea, design, architecture, plan and build");
|
|
380
|
+
say(` 2 ${shape.label}: ${shape.hint}`);
|
|
381
|
+
for (;;) {
|
|
382
|
+
say(dim("Choose 1 or 2. Enter is 1."));
|
|
383
|
+
const buf = Buffer.alloc(80);
|
|
384
|
+
const answer = buf.toString("utf8", 0, readStdin(buf)).trim().toLowerCase();
|
|
385
|
+
if (answer === "" || answer === "1") return;
|
|
386
|
+
if (answer === "2") {
|
|
387
|
+
flags.design = true;
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
301
393
|
function chosen(flags) {
|
|
302
394
|
const manifest = curated();
|
|
303
395
|
const extra = extraState(flags);
|
|
304
396
|
const omitted = new Set(extra.omit);
|
|
305
|
-
|
|
397
|
+
const shape = shapeOf(flags);
|
|
398
|
+
const keeps = shapeKeeps(manifest, shape);
|
|
399
|
+
// An add-on comes with --all (the ones this shape offers), with --skill <name>, or because you took it before.
|
|
306
400
|
const installed = readLock(flags).skills;
|
|
307
|
-
const wanted = (item) =>
|
|
401
|
+
const wanted = (item) =>
|
|
402
|
+
item.optional ? (flags.all && keeps(item)) || flags.skill.includes(item.name) || Boolean(installed[item.name]) : keeps(item);
|
|
308
403
|
const shared = catalog(manifest).filter((item) => wanted(item) && !omitted.has(item.name));
|
|
309
404
|
const seen = new Set(shared.map((item) => item.name));
|
|
310
405
|
const extras = extra.items.filter((item) => !seen.has(item.name) && !omitted.has(item.name));
|
|
@@ -416,9 +511,11 @@ function chooseAddons(flags) {
|
|
|
416
511
|
if (flags.all || flags.noAddons || flags.skill.length) return [];
|
|
417
512
|
const taken = readLock(flags).skills;
|
|
418
513
|
const omitted = new Set(extraState(flags).omit);
|
|
419
|
-
const
|
|
514
|
+
const keeps = shapeKeeps(curated(), shapeOf(flags));
|
|
515
|
+
const open = catalog(curated()).filter((item) => item.optional && keeps(item) && !taken[item.name] && !omitted.has(item.name));
|
|
420
516
|
if (open.length === 0) return [];
|
|
421
|
-
|
|
517
|
+
// A design-only install never decided the add-ons the whole pipeline ticks, so growing it is a first answer.
|
|
518
|
+
const first = !existsSync(lockFile(flags)) || flags.widening;
|
|
422
519
|
const ticked = first ? open.filter((item) => item.preselected).map((item) => item.name) : [];
|
|
423
520
|
if (flags.yes || !process.stdin.isTTY) return ticked;
|
|
424
521
|
const rows = open.map((item) => ({ name: item.name, label: item.name, detail: item.hint ?? item.when ?? "" }));
|
|
@@ -511,17 +608,22 @@ function agentHas(name, agent, global) {
|
|
|
511
608
|
|
|
512
609
|
function readLock(flags) {
|
|
513
610
|
const file = lockFile(flags);
|
|
514
|
-
if (!existsSync(file)) return { version: 1, skills: {} };
|
|
611
|
+
if (!existsSync(file)) return { version: 1, shape: "full", skills: {} };
|
|
612
|
+
let data;
|
|
515
613
|
try {
|
|
516
|
-
|
|
517
|
-
return { version: 1, skills: data.skills ?? {} };
|
|
614
|
+
data = readJson(file);
|
|
518
615
|
} catch {
|
|
519
|
-
return { version: 1, skills: {} };
|
|
616
|
+
return { version: 1, shape: "full", skills: {} };
|
|
520
617
|
}
|
|
618
|
+
const skills = data.skills ?? {};
|
|
619
|
+
checkNames(Object.keys(skills), file);
|
|
620
|
+
return { version: 1, shape: data.shape ?? "full", skills };
|
|
521
621
|
}
|
|
522
622
|
|
|
623
|
+
// The shape is written only when it is not the whole pipeline, so an older lock reads the same.
|
|
523
624
|
function writeLock(flags, lock) {
|
|
524
|
-
|
|
625
|
+
const shape = lock.shape && lock.shape !== "full" ? { shape: lock.shape } : {};
|
|
626
|
+
writeJson(lockFile(flags, true), { version: 1, ...shape, skills: lock.skills });
|
|
525
627
|
}
|
|
526
628
|
|
|
527
629
|
function packageVersion() {
|
|
@@ -564,23 +666,28 @@ function folderHash(dir) {
|
|
|
564
666
|
|
|
565
667
|
// The skills CLI can only update what it can fetch. A kit skill lives in this
|
|
566
668
|
// package, so update copies it here instead of reporting "up to date" over a
|
|
567
|
-
// stale file.
|
|
669
|
+
// stale file. Returns the folders it copied and the links it left alone. A link
|
|
670
|
+
// into this package is current by itself; any other link is the owner's, and
|
|
671
|
+
// that skill is not current until what it points at is refreshed.
|
|
568
672
|
function copyLocalSkill(name, agents, global) {
|
|
569
673
|
const from = join(root, "skills", name);
|
|
570
|
-
|
|
571
|
-
|
|
674
|
+
const done = { copied: [], linked: [], held: [], missing: false };
|
|
675
|
+
if (!existsSync(join(from, "SKILL.md"))) return { ...done, missing: true };
|
|
572
676
|
for (const dir of new Set(agents.map((agent) => agentDir(agent, global)))) {
|
|
573
677
|
const to = join(dir, name);
|
|
574
678
|
if (existsSync(to)) {
|
|
575
|
-
// A link already points
|
|
576
|
-
if (lstatSync(to).isSymbolicLink())
|
|
679
|
+
// A link already points somewhere. Replacing it would pin a copy.
|
|
680
|
+
if (lstatSync(to).isSymbolicLink()) {
|
|
681
|
+
(realpathSync(to) === realpathSync(from) ? done.linked : done.held).push(to);
|
|
682
|
+
continue;
|
|
683
|
+
}
|
|
577
684
|
rmSync(to, { recursive: true, force: true });
|
|
578
685
|
}
|
|
579
686
|
mkdirSync(dirname(to), { recursive: true });
|
|
580
687
|
cpSync(from, to, { recursive: true });
|
|
581
|
-
copied
|
|
688
|
+
done.copied.push(to);
|
|
582
689
|
}
|
|
583
|
-
return
|
|
690
|
+
return done;
|
|
584
691
|
}
|
|
585
692
|
|
|
586
693
|
function skillFolders(name, agents, global) {
|
|
@@ -604,22 +711,29 @@ function locallyEdited(name, entry, agents, global) {
|
|
|
604
711
|
return folders.some((folder) => statSync(join(folder, "SKILL.md")).mtimeMs > installed + 2000);
|
|
605
712
|
}
|
|
606
713
|
|
|
607
|
-
function generateRouter(items, manifest = curated()) {
|
|
608
|
-
const stages = manifest
|
|
714
|
+
function generateRouter(items, manifest = curated(), shape = "full") {
|
|
715
|
+
const stages = shapeStages(manifest, shape);
|
|
716
|
+
const keeps = shapeKeeps(manifest, shape);
|
|
609
717
|
const staged = new Set(stages.flatMap((stage) => stage.skills));
|
|
610
718
|
const line = (when, name, why) => (why?.trim() ? `- ${when}: ${name}. ${why.trim()}` : `- ${when}: ${name}`);
|
|
611
719
|
const helpers = items.filter((item) => kind(item) === "skill").flatMap((item) => {
|
|
612
720
|
if (item.kit) return (item.routes ?? []).map((route) => line(route.when, route.skill, route.why));
|
|
613
|
-
|
|
721
|
+
// A skill the stage's own skill suggests (the design-* family, through design) needs no line of its own.
|
|
722
|
+
if (staged.has(item.name) || item.via) return [];
|
|
614
723
|
return [line(item.when?.trim() || item.name, item.name, item.why)];
|
|
615
724
|
});
|
|
616
725
|
const have = new Set(items.map((item) => item.name));
|
|
617
726
|
// A preselected add-on was decided at init, so it is never offered again.
|
|
618
|
-
const addons = catalog(manifest).filter((item) => item.optional && !item.preselected && !have.has(item.name));
|
|
727
|
+
const addons = catalog(manifest).filter((item) => item.optional && keeps(item) && !item.preselected && !have.has(item.name));
|
|
619
728
|
const rows = stages.map((stage) => `| ${stage.name} | ${stage.when} | ${stage.skills.join(" → ")} | ${stage.writes} |`);
|
|
620
729
|
const offer = addons.length
|
|
621
|
-
? `\nAdd-ons, offered once when needed (\`npx longbeard update --skill <name>\`): ${addons.map((item) => (item.hint ? `${item.name} (${item.hint})` : item.name)).join(", ")}
|
|
730
|
+
? `\nAdd-ons, offered once when needed (\`npx longbeard update --skill <name>\`): ${addons.map((item) => (item.hint ? `${item.name} (${item.hint})` : item.name)).join(", ")}.\n`
|
|
622
731
|
: "";
|
|
732
|
+
// A shape says its own two paragraphs: the whole pipeline's name stages and skills it may not have.
|
|
733
|
+
const notes = shapeDef(manifest, shape)?.notes ?? [
|
|
734
|
+
"Each stage offers the next; start it on yes. A skill you can't load: they type /<name>. No UI: skip Design. A graphic ends at Figma. A feature with a brief: grill-with-docs for new terms, else grilling, then Plan.",
|
|
735
|
+
"UI tickets link their Ready Figma frame. UI work follows DESIGN.md and that frame; a mismatch is a bug.",
|
|
736
|
+
];
|
|
623
737
|
return `# Long Beard
|
|
624
738
|
|
|
625
739
|
The project's own code, conventions, and DESIGN.md win. Load only what the task needs.
|
|
@@ -628,9 +742,7 @@ The project's own code, conventions, and DESIGN.md win. Load only what the task
|
|
|
628
742
|
|---|---|---|---|
|
|
629
743
|
${rows.join("\n")}
|
|
630
744
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
UI tickets link their Ready Figma frame. UI work follows DESIGN.md and that frame; a mismatch is a bug.
|
|
745
|
+
${notes.join("\n\n")}
|
|
634
746
|
|
|
635
747
|
${helpers.join("\n")}
|
|
636
748
|
${offer}
|
|
@@ -640,8 +752,10 @@ Write so a person can use the reply in one read. End with what you did not check
|
|
|
640
752
|
|
|
641
753
|
// AGENTS.md in this repository is this output, without the optional skills.
|
|
642
754
|
// `npm run router` rewrites it; `npm test` fails when the two drift.
|
|
643
|
-
function kitRouter() {
|
|
644
|
-
|
|
755
|
+
function kitRouter(shape = "full") {
|
|
756
|
+
const manifest = curated();
|
|
757
|
+
const keeps = shapeKeeps(manifest, shape);
|
|
758
|
+
return generateRouter(catalog(manifest).filter((item) => !item.optional && keeps(item)), manifest, shape);
|
|
645
759
|
}
|
|
646
760
|
|
|
647
761
|
function pointerWrites(flags, agents) {
|
|
@@ -730,7 +844,7 @@ function upsertBlock(file, block) {
|
|
|
730
844
|
}
|
|
731
845
|
|
|
732
846
|
function writePointers(flags, skills) {
|
|
733
|
-
const text = generateRouter(skills);
|
|
847
|
+
const text = generateRouter(skills, curated(), shapeOf(flags));
|
|
734
848
|
if (flags.global) {
|
|
735
849
|
const dir = join(homedir(), ".longbeard");
|
|
736
850
|
mkdirSync(dir, { recursive: true });
|
|
@@ -771,11 +885,16 @@ async function init(flags) {
|
|
|
771
885
|
requireProject(flags);
|
|
772
886
|
knownAddons(flags);
|
|
773
887
|
const agents = chooseAgents(curated(), flags, { pick: true, lock: readLock(flags) });
|
|
888
|
+
askShape(curated(), flags);
|
|
889
|
+
const was = readLock(flags).shape;
|
|
890
|
+
flags.shape = resolveShape(flags);
|
|
891
|
+
flags.widening = was !== "full" && flags.shape === "full";
|
|
774
892
|
flags.skill.push(...chooseAddons(flags));
|
|
775
893
|
const { extra, items, later, ...picked } = chosen(flags);
|
|
776
894
|
const skills = await expandKits(picked.skills, extra.omit);
|
|
777
895
|
const classified = classify(skills, agents, flags);
|
|
778
896
|
classified.later = later;
|
|
897
|
+
classified.lock.shape = flags.shape;
|
|
779
898
|
plan("init", flags, agents, classified);
|
|
780
899
|
confirmWrite(flags, classified.writes);
|
|
781
900
|
if (classified.missing.length > 0) say(dim("Installing…"));
|
|
@@ -786,17 +905,22 @@ async function init(flags) {
|
|
|
786
905
|
green("Done."),
|
|
787
906
|
`${classified.missing.length} installed, ${classified.theirs.length + classified.ours.length + classified.edited.length} already there.`,
|
|
788
907
|
flags.global ? "Skills are available in every project on this machine. A copy of the note is in ~/.longbeard/AGENTS.md." : "Wrote the AGENTS.md block and beard-lock.json.",
|
|
908
|
+
...(flags.shape === "full" ? [] : [`${curated().shapes[flags.shape].label}. The design skills end in Figma, so connect Figma in your agent. npx longbeard init --full adds the rest.`]),
|
|
789
909
|
]);
|
|
790
910
|
}
|
|
791
911
|
|
|
792
912
|
async function update(flags) {
|
|
793
913
|
requireProject(flags);
|
|
794
914
|
knownAddons(flags);
|
|
915
|
+
// update keeps to the shape its lock records. --full is how a design-only install grows.
|
|
916
|
+
if (flags.design) fail("update keeps the shape init chose. init --design is for a project that has not run init.");
|
|
917
|
+
flags.shape = resolveShape(flags);
|
|
795
918
|
const { manifest, extra, items, later, ...picked } = chosen(flags);
|
|
796
919
|
const agents = chooseAgents(manifest, flags, { pick: false, lock: readLock(flags) });
|
|
797
920
|
const skills = await expandKits(picked.skills, extra.omit);
|
|
798
921
|
const classified = classify(skills, agents, flags);
|
|
799
922
|
classified.later = later;
|
|
923
|
+
classified.lock.shape = flags.shape;
|
|
800
924
|
// A skill nothing lists any more leaves, unless you edited it: the catalog
|
|
801
925
|
// dropped it, or its kit's author stopped publishing it. Listed means the
|
|
802
926
|
// whole catalog, so an add-on installed with --all stays without it.
|
|
@@ -829,10 +953,19 @@ async function update(flags) {
|
|
|
829
953
|
? local
|
|
830
954
|
: local.filter((skill) => (classified.lock.skills[skill.name]?.version ?? "") !== here);
|
|
831
955
|
let copied = 0;
|
|
956
|
+
// A stale skill that was not copied is not current, so the lock keeps what it had.
|
|
957
|
+
const notCurrent = new Set();
|
|
832
958
|
if (stale.length > 0 || theirs.length > 0) say(dim("Refreshing…"));
|
|
833
959
|
for (const skill of stale) {
|
|
834
960
|
const was = classified.lock.skills[skill.name]?.version || "unknown";
|
|
835
|
-
|
|
961
|
+
const done = copyLocalSkill(skill.name, skill.agentsNeed ?? agents, flags.global);
|
|
962
|
+
if (done.missing || done.held.length > 0) notCurrent.add(skill);
|
|
963
|
+
if (done.missing) continue;
|
|
964
|
+
for (const folder of done.held) say(yellow(` ${skill.name} left as it is: ${folder} is a link to ${realpathSync(folder)}. Refresh what it points at.`));
|
|
965
|
+
if (done.copied.length === 0) {
|
|
966
|
+
if (done.held.length === 0) say(dim(` ${skill.name} ${here}, linked to this package`));
|
|
967
|
+
continue;
|
|
968
|
+
}
|
|
836
969
|
copied += 1;
|
|
837
970
|
say(was === here ? ` ${skill.name} ${here}, replaced` : ` ${skill.name} ${was} → ${here}`);
|
|
838
971
|
}
|
|
@@ -846,9 +979,10 @@ async function update(flags) {
|
|
|
846
979
|
else args.push("--project");
|
|
847
980
|
runSkills(args);
|
|
848
981
|
}
|
|
849
|
-
|
|
982
|
+
const current = refresh.filter((skill) => !notCurrent.has(skill));
|
|
983
|
+
if (current.length > 0) remember(readLock(flags), flags, current, agents);
|
|
850
984
|
writePointers(flags, items);
|
|
851
|
-
const held = flags.force ? classified.theirs.length : classified.theirs.length + classified.edited.length;
|
|
985
|
+
const held = (flags.force ? classified.theirs.length : classified.theirs.length + classified.edited.length) + notCurrent.size;
|
|
852
986
|
finish([
|
|
853
987
|
green("Done."),
|
|
854
988
|
`${classified.missing.length} installed, ${copied + theirs.length} refreshed, ${drop.length} retired, ${held} left as they are.`,
|
|
@@ -862,6 +996,7 @@ function add(flags, rest) {
|
|
|
862
996
|
if (!source || flags.skill.length === 0 || !flags.author || !flags.why) {
|
|
863
997
|
fail(`add needs a source, --skill, --author, and --why.\n\n${help}`);
|
|
864
998
|
}
|
|
999
|
+
checkNames(flags.skill, "--skill");
|
|
865
1000
|
if (inRepository() && !flags.global) {
|
|
866
1001
|
const manifest = curated();
|
|
867
1002
|
const items = catalog(manifest);
|
|
@@ -994,5 +1129,5 @@ else if (command === "add") add(flags, rest);
|
|
|
994
1129
|
else if (command === "remove") remove(flags, rest);
|
|
995
1130
|
else if (command === "update") await update(flags);
|
|
996
1131
|
else if (command === "list") list(flags);
|
|
997
|
-
else if (command === "router") process.stdout.write(kitRouter());
|
|
1132
|
+
else if (command === "router") process.stdout.write(kitRouter(flags.design ? "design" : "full"));
|
|
998
1133
|
else fail(`Unknown command: ${command}\n\n${help}`);
|