@behavioral-agentic-design-system/core 0.2.1 → 0.3.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 (44) hide show
  1. package/package.json +32 -4
  2. package/scripts/bads-sync.mjs +81 -0
  3. package/scripts/build-tokens.cjs +430 -0
  4. package/src/app/font-ready.tsx +51 -0
  5. package/src/app/layout.tsx +152 -0
  6. package/src/app/page.tsx +267 -0
  7. package/src/app/preview/cards/page.tsx +8 -0
  8. package/src/app/preview/components/page.tsx +232 -0
  9. package/src/app/preview/dark-mode-client.tsx +24 -0
  10. package/src/app/preview/dashboard/page.tsx +4 -0
  11. package/src/app/preview/global-font-client.tsx +36 -0
  12. package/src/app/preview/layout.tsx +13 -0
  13. package/src/app/preview/mail/page.tsx +4 -0
  14. package/src/app/preview/pricing/page.tsx +4 -0
  15. package/src/app/preview/typography/page.tsx +11 -0
  16. package/src/app/providers.tsx +49 -0
  17. package/src/components/Foundations/Colors.stories.tsx +85 -0
  18. package/src/components/Foundations/Motion.stories.tsx +169 -0
  19. package/src/components/Foundations/Radius.stories.tsx +36 -0
  20. package/src/components/Foundations/Shadows.stories.tsx +30 -0
  21. package/src/components/Foundations/Spacing.stories.tsx +35 -0
  22. package/src/components/Foundations/Typography.stories.tsx +68 -0
  23. package/src/components/bads-update-banner.tsx +120 -0
  24. package/src/components/customize/design-controls.tsx +165 -0
  25. package/src/components/customize/font-pickers.tsx +118 -0
  26. package/src/components/customize/letter-spacing.tsx +105 -0
  27. package/src/components/customize/save-bar.tsx +379 -0
  28. package/src/components/customize/theme-io.tsx +245 -0
  29. package/src/components/customize/type-scale.tsx +134 -0
  30. package/src/components/customize-tab.tsx +502 -0
  31. package/src/components/home-tab.tsx +1227 -0
  32. package/src/components/layers-tab.tsx +225 -0
  33. package/src/components/ui/alert.tsx +5 -1
  34. package/src/hooks/use-global-design-controls.ts +117 -0
  35. package/src/hooks/use-global-mono-font.ts +73 -0
  36. package/src/hooks/use-global-primary-color.ts +544 -0
  37. package/src/hooks/use-global-sans-font.ts +98 -0
  38. package/src/hooks/use-global-serif-font.ts +77 -0
  39. package/src/hooks/use-global-theme.ts +259 -0
  40. package/src/hooks/use-global-type-scale.ts +141 -0
  41. package/src/hooks/use-sync-type-scale.ts +51 -0
  42. package/src/hooks/use-token-overrides.ts +98 -0
  43. package/src/styles.css +20 -5
  44. package/src/tokens.json +5 -5
@@ -0,0 +1,1227 @@
1
+ "use client";
2
+
3
+ import { useState } from "react";
4
+ import {
5
+ Sparkles,
6
+ Package,
7
+ Palette,
8
+ Layers,
9
+ Accessibility,
10
+ ShieldCheck,
11
+ Heart,
12
+ BookOpen,
13
+ Code2,
14
+ Box,
15
+ ArrowUpRight,
16
+ CheckCircle2,
17
+ Circle,
18
+ Type,
19
+ Ruler,
20
+ Terminal,
21
+ FileText,
22
+ Eye,
23
+ Sun,
24
+ Moon,
25
+ Zap,
26
+ Wand2,
27
+ ClipboardCopy,
28
+ Check,
29
+ FolderGit2,
30
+ Globe,
31
+ Database,
32
+ Combine,
33
+ GitCompare,
34
+ KeyRound,
35
+ } from "lucide-react";
36
+ import { brand } from "@/brand.config";
37
+ import {
38
+ Card,
39
+ CardContent,
40
+ CardDescription,
41
+ CardHeader,
42
+ CardTitle,
43
+ } from "@behavioral-agentic-design-system/core/components/ui/card";
44
+ import { Badge } from "@behavioral-agentic-design-system/core/components/ui/badge";
45
+ import { Button } from "@behavioral-agentic-design-system/core/components/ui/button";
46
+ import { Separator } from "@behavioral-agentic-design-system/core/components/ui/separator";
47
+ import { ScrollArea } from "@behavioral-agentic-design-system/core/components/ui/scroll-area";
48
+ import registry from "@/layer-5-component-registry/component-registry.json";
49
+ import tokens from "@/packages/core/src/tokens.json";
50
+ import corePkg from "@/packages/core/package.json";
51
+ import { BadsUpdateBanner } from "@behavioral-agentic-design-system/core/components/bads-update-banner";
52
+
53
+ type RegistryEntry = {
54
+ usage?: string;
55
+ props?: { variant?: string[] | string };
56
+ variants?: string[];
57
+ };
58
+
59
+ const registryMap = registry as Record<string, RegistryEntry>;
60
+ const componentNames = Object.keys(registryMap).sort();
61
+
62
+ const semanticTokenCount = Object.keys(
63
+ (tokens as { theme?: { light?: Record<string, unknown> } }).theme?.light ?? {}
64
+ ).length;
65
+
66
+ const primitiveTokenCount = Object.values(
67
+ (tokens as { color?: { primitive?: Record<string, Record<string, unknown>> } }).color
68
+ ?.primitive ?? {}
69
+ ).reduce((sum, group) => sum + Object.keys(group).length, 0);
70
+
71
+ const componentCount = componentNames.length;
72
+
73
+ const SHIPPED_LAYERS = [
74
+ {
75
+ n: "1",
76
+ name: "Brand & Voice",
77
+ note: "framework, voice, microcopy",
78
+ status: "shipped",
79
+ },
80
+ {
81
+ n: "2",
82
+ name: "Ethics & Responsibility",
83
+ note: "decision trees, anti-patterns, AI ethics",
84
+ status: "shipped",
85
+ },
86
+ {
87
+ n: "3",
88
+ name: "Foundation",
89
+ note: "primitives, motion, icons, a11y",
90
+ status: "shipped",
91
+ },
92
+ {
93
+ n: "4",
94
+ name: "Semantic Tokens",
95
+ note: "light + dark, perceptually tuned",
96
+ status: "shipped",
97
+ },
98
+ {
99
+ n: "5",
100
+ name: "Component Registry",
101
+ note: `${componentCount} components, full a11y contracts`,
102
+ status: "shipped",
103
+ },
104
+ {
105
+ n: "7",
106
+ name: "Agent Interface",
107
+ note: "rules for Cursor, Claude Code, v0",
108
+ status: "shipped",
109
+ },
110
+ {
111
+ n: "8",
112
+ name: "Documentation",
113
+ note: "static surface, generated from source",
114
+ status: "shipped",
115
+ },
116
+ {
117
+ n: "10",
118
+ name: "Enforcement",
119
+ note: "pre-commit warnings, AI fix path",
120
+ status: "shipped",
121
+ },
122
+ {
123
+ n: "11",
124
+ name: "Automate",
125
+ note: "tokens build, story coverage, rename script",
126
+ status: "shipped",
127
+ },
128
+ ] as const;
129
+
130
+ const DEFERRED_LAYERS = [
131
+ { n: "6", name: "Patterns & Rules", note: "decision trees for component picks" },
132
+ { n: "9", name: "Documentation (Advanced)", note: "search, versioning, telemetry" },
133
+ { n: "12", name: "Automate (Advanced)", note: "Figma sync, agent PRs, full a11y CI" },
134
+ ] as const;
135
+
136
+ const COMPONENT_GROUPS = [
137
+ {
138
+ title: "Inputs",
139
+ items: [
140
+ "Input",
141
+ "Textarea",
142
+ "Select",
143
+ "Checkbox",
144
+ "RadioGroup",
145
+ "Switch",
146
+ "Slider",
147
+ "Calendar",
148
+ ],
149
+ },
150
+ {
151
+ title: "Actions",
152
+ items: ["Button", "Toggle", "ToggleGroup", "DropdownMenu", "Command"],
153
+ },
154
+ {
155
+ title: "Layout",
156
+ items: ["Card", "Separator", "ScrollArea", "Resizable", "Sidebar", "Tabs"],
157
+ },
158
+ {
159
+ title: "Overlays",
160
+ items: ["Dialog", "Sheet", "Popover", "Tooltip"],
161
+ },
162
+ {
163
+ title: "Feedback",
164
+ items: ["Alert", "Badge", "Progress", "Skeleton", "Sonner", "Tag"],
165
+ },
166
+ {
167
+ title: "Data",
168
+ items: ["Avatar", "Breadcrumb", "Chart", "Label", "Table"],
169
+ },
170
+ ];
171
+
172
+ const A11Y_COMMITMENTS = [
173
+ {
174
+ label: "WCAG 2.2 AAA contrast",
175
+ detail: "7:1 body text, 4.5:1 large, 3:1 non-text",
176
+ },
177
+ {
178
+ label: "Minimum font size 14px",
179
+ detail: "tokens locked, no inline overrides",
180
+ },
181
+ {
182
+ label: "Body line-height ≥ 1.5",
183
+ detail: "SC 1.4.8 baked into the base layer",
184
+ },
185
+ {
186
+ label: "44×44px touch targets",
187
+ detail: "SC 2.5.5 Enhanced, all interactive components",
188
+ },
189
+ {
190
+ label: "Focus appearance hardened",
191
+ detail: "SC 2.4.13 — 2px offset, 3:1 ring on every surface",
192
+ },
193
+ {
194
+ label: "Reduced-motion honored globally",
195
+ detail: "every animation collapses to 0.01ms",
196
+ },
197
+ {
198
+ label: "Forced-colors safe",
199
+ detail: "border fallbacks shipped in registry",
200
+ },
201
+ {
202
+ label: "Enforced on every commit",
203
+ detail: "pnpm wcag:audit + a11y:lint block regressions",
204
+ },
205
+ ];
206
+
207
+ function MetricCard({
208
+ icon: Icon,
209
+ value,
210
+ label,
211
+ hint,
212
+ }: {
213
+ icon: typeof Sparkles;
214
+ value: string | number;
215
+ label: string;
216
+ hint?: string;
217
+ }) {
218
+ return (
219
+ <Card>
220
+ <CardHeader className="pb-2">
221
+ <div className="flex items-center justify-between">
222
+ <CardDescription className="text-sm">{label}</CardDescription>
223
+ <Icon className="h-4 w-4 text-muted-foreground" strokeWidth={1.5} />
224
+ </div>
225
+ <CardTitle className="text-4xl font-semibold tabular-nums">{value}</CardTitle>
226
+ </CardHeader>
227
+ {hint && (
228
+ <CardContent className="pt-0">
229
+ <p className="text-sm text-muted-foreground">{hint}</p>
230
+ </CardContent>
231
+ )}
232
+ </Card>
233
+ );
234
+ }
235
+
236
+ function SectionHeading({
237
+ eyebrow,
238
+ title,
239
+ description,
240
+ }: {
241
+ eyebrow?: string;
242
+ title: string;
243
+ description?: string;
244
+ }) {
245
+ return (
246
+ <header className="space-y-2 max-w-2xl">
247
+ {eyebrow && (
248
+ <p className="text-xs font-mono uppercase tracking-wider text-muted-foreground">
249
+ {eyebrow}
250
+ </p>
251
+ )}
252
+ <h2 className="text-3xl font-semibold tracking-tight">{title}</h2>
253
+ {description && (
254
+ <p className="text-base text-muted-foreground leading-relaxed">{description}</p>
255
+ )}
256
+ </header>
257
+ );
258
+ }
259
+
260
+ function CodeBlock({ children }: { children: string }) {
261
+ return (
262
+ <pre className="bg-muted text-foreground rounded-lg p-4 text-sm font-mono overflow-x-auto border">
263
+ <code>{children}</code>
264
+ </pre>
265
+ );
266
+ }
267
+
268
+ // One-shot setup prompt — pasted into a fresh Claude Code session to run the
269
+ // full onboarding (rename + brand + voice + microcopy + ethics + tokens +
270
+ // components + patterns). Mirrors prompts/setup.md so home stays in sync.
271
+ const SETUP_PROMPT = `You are setting up a fresh fork of BADS (Behavioral Agentic Design System) for a new product. The product can be anything — a personal app, a side project, an internal tool, an open-source library, or work for a client. Treat all of these the same; the "product" is whatever the user is building.
272
+
273
+ Source repo: https://github.com/matthewlarn/behavioral-agentic-design-system
274
+
275
+ If we are NOT already inside a clone of this repo (no package.json named "behavioral-agentic-design-system" or its renamed variant in cwd), ask me for a parent directory and a slug for this product (e.g. "acme", "my-app", "side-project"), then run:
276
+ git clone https://github.com/matthewlarn/behavioral-agentic-design-system.git <slug>
277
+ cd <slug>
278
+ pnpm install
279
+ If we're already inside the repo, skip the clone.
280
+
281
+ Then run the full onboarding flow, asking me for inputs as you go and committing at each step. Stay terse — no preamble, no recap, just ask the next question.
282
+
283
+ Steps to run, in order:
284
+
285
+ 1. RENAME — read CLAUDE.md's "First-Run Rename" section. If .client-identity.json doesn't exist or brand.config.ts still says name: "BADS", ask me for a Display name and slug, then run \`pnpm rename "<Name>" <slug>\`, \`pnpm install\`, \`pnpm build:tokens\`, and commit. Skip if already renamed.
286
+
287
+ 2. SOURCE DISCOVERY — ask me what already exists for this product (live site URL, existing codebase path, knowledge base, or none). Then run the matching extract prompt to gather inputs BEFORE asking for raw text:
288
+ - codebase → prompts/extract/from-codebase.md (Glob/Grep/Read)
289
+ - website → prompts/extract/from-website.md (WebFetch)
290
+ - KB → prompts/extract/from-knowledge-base.md
291
+ - all of the above → prompts/extract/from-existing-product.md (triangulates)
292
+ - none → skip extraction, fall through to direct asks below
293
+ Save artifacts to a temp file. Show me the "gaps and contradictions" artifact verbatim before proceeding — AI extracts patterns but can't tell intentional from legacy.
294
+
295
+ 3. BRAND CONTEXT — follow prompts/0-brand-context.md. If step 2 extracted artifacts, use them as inputs (don't re-ask). Otherwise ask me for marketing site URL/text, founder notes, one-liner, industry context. Fill BRIEF.md and brand.config.ts AI-brief fields. Diff, confirm, commit.
296
+
297
+ 4. VOICE — follow prompts/1-brand-voice.md. If extraction ran, the voice-signals artifact is the input — don't ask again. Otherwise ask for examples of existing copy and voice references. Fill layer-1-brand-voice/{framework,voice-and-tone,language}.md. Diff, confirm, commit.
298
+
299
+ 5. MICROCOPY — follow prompts/2-microcopy.md. If extraction ran, the microcopy-patterns artifact is the seed — fill the gaps from there. Validate JSON parses. Diff, confirm, commit.
300
+
301
+ 6. ETHICS — follow prompts/3-ethics.md. If extraction surfaced compliance signals (HIPAA strings, age gates, consent flows), pre-fill from those. Ask about any sensitive product moments still missing. Update layer-2-ethics-responsibility/. Diff, confirm, commit.
302
+
303
+ 7. TOKENS — follow prompts/4-tokens.md. If extraction ran, the visual-cues artifact already has hex values + fonts — use those. Otherwise ask for brand colors, fonts, radius preference. Update brand.config.ts colors/fonts and tokens.json, run \`pnpm build:tokens\`. Diff, confirm, commit.
304
+
305
+ 8. COMPONENT NEEDS — follow prompts/5-component-needs.md. If extraction saw a codebase, you already know which primitives the product uses and where it deviates — use that as the gap matrix seed. Otherwise ask for 2–5 wireframes or screen descriptions. Output a gap matrix. FLAG candidate new components for explicit approval — do NOT add primitives without my "yes". Apply approved variants/sizes and update stories per STORYBOOK_RULE.md.
306
+
307
+ 9. PATTERNS — follow prompts/6-patterns.md. Fill layer-6-patterns-and-rules with one recipe per surface in BRIEF.md. Diff, confirm, commit.
308
+
309
+ 10. CHROMATIC — follow prompts/chromatic.md (canonical reference: docs/chromatic-setup.md). The infra is already in this repo (chromatic.config.json, .github/workflows/chromatic.yml, package.json script + devDep). Walk me through creating a Chromatic project, copying the project token, adding it as the CHROMATIC_PROJECT_TOKEN GitHub secret, and seeding the baseline by pushing to main. Never commit, log, or echo the token. If I'd rather defer, set the CHROMATIC_ENABLED repo variable to "false" and continue.
310
+
311
+ Operating rules:
312
+ - Stop and ask if unsure. Vague answers produce generic SaaS slop.
313
+ - Never edit defaults in packages/core/src/components/ui/* — additive only (multi-tenant rule).
314
+ - Run \`pnpm build:tokens\` after any tokens.json change.
315
+ - Commit after every step, focused messages.
316
+ - Skip steps that don't apply, and tell me why.
317
+ - Read CLAUDE.md and prompts/README.md before starting.
318
+
319
+ Begin with step 1.`;
320
+
321
+ function CopyablePromptCard({
322
+ title,
323
+ description,
324
+ prompt,
325
+ icon: Icon = Wand2,
326
+ highlighted = false,
327
+ }: {
328
+ title: string;
329
+ description: string;
330
+ prompt: string;
331
+ icon?: typeof Wand2;
332
+ highlighted?: boolean;
333
+ }) {
334
+ const [copied, setCopied] = useState(false);
335
+
336
+ const handleCopy = async () => {
337
+ try {
338
+ await navigator.clipboard.writeText(prompt);
339
+ setCopied(true);
340
+ setTimeout(() => setCopied(false), 2000);
341
+ } catch {}
342
+ };
343
+
344
+ return (
345
+ <Card className={highlighted ? "border-primary/40" : undefined}>
346
+ <CardHeader>
347
+ <div className="flex items-start justify-between gap-4">
348
+ <div className="space-y-1.5 min-w-0">
349
+ <CardTitle className="text-base flex items-center gap-2">
350
+ <Icon className="h-4 w-4 shrink-0" strokeWidth={1.5} />
351
+ <span className="truncate">{title}</span>
352
+ </CardTitle>
353
+ <CardDescription>{description}</CardDescription>
354
+ </div>
355
+ <Button
356
+ type="button"
357
+ size="sm"
358
+ variant="outline"
359
+ onClick={handleCopy}
360
+ className="shrink-0 gap-1.5"
361
+ >
362
+ {copied ? (
363
+ <>
364
+ <Check className="h-3.5 w-3.5" strokeWidth={1.5} /> Copied
365
+ </>
366
+ ) : (
367
+ <>
368
+ <ClipboardCopy className="h-3.5 w-3.5" strokeWidth={1.5} /> Copy
369
+ </>
370
+ )}
371
+ </Button>
372
+ </div>
373
+ </CardHeader>
374
+ <CardContent>
375
+ <pre className="bg-muted text-foreground rounded-lg p-4 text-xs font-mono overflow-auto border max-h-64 leading-relaxed whitespace-pre-wrap">
376
+ <code>{prompt}</code>
377
+ </pre>
378
+ </CardContent>
379
+ </Card>
380
+ );
381
+ }
382
+
383
+ // Extract prompts — short, copy-pasteable bodies that mirror the inline
384
+ // prompts inside prompts/extract/*.md. The full versions in those files have
385
+ // extra "what AI is good/bad at" framing for human readers; the bodies here
386
+ // are just what gets pasted into the AI.
387
+ const EXTRACT_FROM_CODEBASE = `You have read access to a product codebase. Extract enough context to fill out a BADS brief, voice spec, and microcopy bank for it.
388
+
389
+ REPO PATH: <paste absolute path or "the current repo">
390
+
391
+ Use Glob, Grep, and Read to inspect the repo. Don't ask me — find it yourself. Stay terse, output artifacts at the end.
392
+
393
+ Read in order, weighting later signals more (in-product copy beats marketing):
394
+ 1. README.md, package.json description, /docs/*.md
395
+ 2. app/**/page.tsx (every route's user-facing copy)
396
+ 3. components/**/*.{tsx,jsx} for inline strings, button labels, empty states, errors
397
+ 4. {copy,strings,microcopy,i18n}.json
398
+ 5. tailwind.config.* / tokens.json / theme.css for colors and fonts
399
+ 6. .env.example for service hints
400
+ 7. git log --oneline -50
401
+ Skip node_modules, .next, dist, build, generated/, lock files.
402
+
403
+ Output 5 artifacts:
404
+ 1. Brand context: mission / audience / productSurfaces / differentiator / forbidden / inspiration — for BRIEF.md + brand.config.ts AI fields
405
+ 2. Voice signals: tone (sentence length, pronouns, contractions, punctuation), 5–10 voice tics quoted with file:line, tonal range (3 surfaces compared)
406
+ 3. Microcopy patterns: starter microcopy.json with REAL strings, schema matches prompts/2-microcopy.md, file:line for each
407
+ 4. Visual cues: every hex/oklch found grouped by usage, fonts in frequency order, radius/spacing values, reference apps inferred
408
+ 5. Gaps and contradictions: bullet list of what you couldn't find or felt uncertain about — this is the human's homework`;
409
+
410
+ const EXTRACT_FROM_WEBSITE = `You have web-fetching tools. Extract enough context from the URLs below to fill out a BADS brief, voice spec, and microcopy bank.
411
+
412
+ URLS:
413
+ - Primary: <paste homepage URL>
414
+ - Pricing / about / product / blog / customers (optional — find via nav if not given)
415
+
416
+ Stop at 6–8 pages total. For each: fetch rendered text, pull h1/h2/h3 hierarchy, CTA labels, body copy first para and callouts, visible hex codes / fonts / spacing.
417
+
418
+ Stay terse, don't ask me — fetch it. Output artifacts at the end.
419
+
420
+ Output 5 artifacts:
421
+ 1. Brand context: mission (homepage h1, plain English) / audience (who they talk TO, quote phrasing) / productSurfaces (from product nav + pricing features) / differentiator (sharp or "WEAK SIGNAL") / forbidden (from any "we don't" / privacy commitments) / inspiration (sites with similar feel, be specific)
422
+ 2. Voice signals: tone (sentence length, pronouns, contractions, punctuation, capitalization), 5–10 voice tics with URLs, tonal range (hero vs fine-print vs footer)
423
+ 3. Microcopy patterns: REAL strings quoted from the site, schema matches prompts/2-microcopy.md, URL for each, "TODO" for product-internal slots not on marketing
424
+ 4. Visual cues: hex/rgb values grouped by usage, fonts in load order, section spacing (tight/generous/rhythmic), photo vs illustration, reference apps with one-line why
425
+ 5. Gaps and contradictions: bullet list — marketing sites overstate; flag what the site doesn't actually tell you`;
426
+
427
+ const EXTRACT_FROM_KB = `You have access to a knowledge base (Notion / Confluence / shared drive). Extract context for a BADS brief, voice spec, and microcopy bank.
428
+
429
+ SOURCES (priority order — earlier outranks later if they disagree):
430
+ 1. Brand book / brand guide
431
+ 2. Founder memos, mission docs
432
+ 3. Product strategy, vision, OKRs
433
+ 4. Style guide / writing guide
434
+ 5. Customer personas / ICP docs
435
+ 6. Internal Slack/email archives
436
+ 7. Public site (cross-reference only)
437
+
438
+ For each doc: read fully, mark intent date, flag stale (>18mo without updates), prefer newer when sources disagree.
439
+
440
+ Stay terse. Output 5 artifacts:
441
+ 1. Brand context: same shape as other extract prompts, derived from most authoritative + recent source
442
+ 2. Voice signals: from the style guide quote rules verbatim and number them; sample 5–10 paragraphs from recent docs for tone signals; flag where rules and actual writing disagree (often actual practice is better than codified rule)
443
+ 3. Microcopy patterns: starter microcopy.json with strings quoted from docs; mark product-internal slots TODO
444
+ 4. Company outline: origin story (3–5 sentences from founder memos), what's working, what's a problem, strategy in one sentence, cultural tells (phrases that recur across docs but aren't in the formal guide)
445
+ 5. Gaps and contradictions: where docs disagree or info is missing — most important artifact`;
446
+
447
+ const EXTRACT_COMBO = `You have read access to a codebase, web-fetching tools, and a knowledge-base tool. Triangulate across all three sources. Disagreement between them is the most valuable signal — surface it explicitly.
448
+
449
+ SOURCES:
450
+ - Codebase: <absolute path or "the current repo">
451
+ - Live site: <homepage URL>
452
+ - Knowledge base: <Notion workspace name / "skip" if none>
453
+
454
+ Stay terse. Don't ask me — fetch it. Output artifacts at the end.
455
+
456
+ Read in this order, citing source for every fact:
457
+ 1. Knowledge base — most authoritative for intent
458
+ 2. Codebase — most authoritative for what's shipping
459
+ 3. Live site — most authoritative for how it's marketed
460
+
461
+ Output 6 artifacts. For each, note source(s) used + any conflict found:
462
+ 1. Brand context: mission / audience / productSurfaces / differentiator / forbidden / inspiration with [SOURCE: …] tags and conflict notes
463
+ 2. Voice signals: style guide rules (KB) + marketing voice (site samples with URLs) + product voice (codebase samples with file:line) + tonal disagreement (which to converge to, based on audience)
464
+ 3. Microcopy patterns: marketing slots from site, product slots from codebase, TODO only when no source has it
465
+ 4. Company outline: origin (KB) / shipping now (codebase + changelog) / planned (KB OKRs + roadmap) / strategy (cross-checked) / cultural tells (recur across sources)
466
+ 5. Visual cues: hex from codebase tokens + visible hex from site, fonts from both, reference apps from cross-source signals; flag any disagreement
467
+ 6. Contradictions and gaps: a table of source A vs source B with a recommendation, plus a separate list of true gaps. The most important artifact — the human reviewer's homework`;
468
+
469
+ // Chromatic wire-up prompt — paste into a Claude Code session at the repo
470
+ // root to walk through creating a Chromatic project, adding the GitHub
471
+ // secret, and seeding the first baseline. Mirrors prompts/chromatic.md.
472
+ const CHROMATIC_PROMPT = `You are wiring up Chromatic visual regression on a fresh BADS fork. The infrastructure (chromatic.config.json, .github/workflows/chromatic.yml, the \`pnpm chromatic\` script, the \`chromatic\` devDep) is already in the repo. The remaining work is human-side: create a Chromatic project, copy a token, add it as a GitHub secret, then seed the first baseline.
473
+
474
+ Read docs/chromatic-setup.md before starting — that's the canonical reference. Stay terse, no preamble.
475
+
476
+ Steps:
477
+
478
+ 1. PRECHECK
479
+ Confirm chromatic.config.json, .github/workflows/chromatic.yml, the \`chromatic\` script in package.json, and a GitHub remote (\`git remote -v\`) all exist. If any are missing, stop and tell me — don't try to recreate them blindly.
480
+
481
+ 2. CHROMATIC PROJECT (human step)
482
+ Tell me to:
483
+ - Open https://www.chromatic.com/start
484
+ - Sign in with the GitHub account that owns this repo
485
+ - Click "Add project" and pick this repo
486
+ - Copy the project token (starts with chpt_)
487
+ Wait for me to paste it back. Hold the token only in working memory — never log, echo, write, or commit it.
488
+
489
+ 3. GITHUB SECRET (human step)
490
+ Tell me to:
491
+ - Open the repo on GitHub → Settings → Secrets and variables → Actions
492
+ - New repository secret
493
+ - Name: CHROMATIC_PROJECT_TOKEN
494
+ - Value: the token I pasted
495
+ - Add secret
496
+ Wait for "done".
497
+
498
+ 4. FIRST BASELINE
499
+ Ask me which path:
500
+ (a) Push to main and let CI seed (clean tree → \`git push origin main\` → tail with \`gh run watch\` or open the Actions tab)
501
+ (b) Run locally with the token in env: \`CHROMATIC_PROJECT_TOKEN=<token> pnpm chromatic\`
502
+ Don't auto-push without explicit confirmation.
503
+
504
+ 5. VERIFY
505
+ Once the first run completes, tell me to open the Chromatic dashboard, confirm one build with N snapshots, and note that this is the rolling baseline going forward. Surface the build URL if available.
506
+
507
+ 6. HAND OFF
508
+ Remind me of the day-two flow: every PR posts a Chromatic check, accept diffs in the Chromatic UI, merges to main auto-update the baseline per autoAcceptChanges: main in chromatic.config.json. Mention the CHROMATIC_ENABLED repo variable as the kill-switch.
509
+
510
+ Operating rules:
511
+ - Do not commit, log, or echo the token.
512
+ - If precheck fails, stop and tell me what's missing.
513
+ - If the first run fails, read the troubleshooting section in docs/chromatic-setup.md.
514
+
515
+ Begin with step 1.`;
516
+
517
+ export function HomeTab() {
518
+ return (
519
+ <ScrollArea className="size-full">
520
+ {/* Entrance animation: each top-level section fades up in sequence on
521
+ first mount. Once the cards are mounted, they stay (TabsPanels
522
+ keeps the home tree alive across tab switches), so the animation
523
+ never re-runs on tab return — it's a one-shot polish on first paint. */}
524
+ <style>{`
525
+ @keyframes home-fade-up {
526
+ from { opacity: 0; transform: translateY(8px); }
527
+ to { opacity: 1; transform: translateY(0); }
528
+ }
529
+ @media (prefers-reduced-motion: no-preference) {
530
+ .home-stagger > * {
531
+ animation: home-fade-up 600ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
532
+ }
533
+ .home-stagger > *:nth-child(1) { animation-delay: 0ms; }
534
+ .home-stagger > *:nth-child(2) { animation-delay: 60ms; }
535
+ .home-stagger > *:nth-child(3) { animation-delay: 120ms; }
536
+ .home-stagger > *:nth-child(4) { animation-delay: 180ms; }
537
+ .home-stagger > *:nth-child(5) { animation-delay: 240ms; }
538
+ .home-stagger > *:nth-child(6) { animation-delay: 300ms; }
539
+ .home-stagger > *:nth-child(7) { animation-delay: 360ms; }
540
+ .home-stagger > *:nth-child(8) { animation-delay: 420ms; }
541
+ .home-stagger > *:nth-child(n+9) { animation-delay: 480ms; }
542
+ }
543
+ `}</style>
544
+ <div className="home-stagger max-w-7xl mx-auto px-8 py-12 space-y-16">
545
+ <BadsUpdateBanner />
546
+ {/* HERO */}
547
+ <section className="space-y-6">
548
+ <div className="flex items-center gap-3 flex-wrap">
549
+ <Badge variant="secondary" className="text-xs">
550
+ v{corePkg.version}
551
+ </Badge>
552
+ <Badge variant="outline" className="text-xs">
553
+ <Sun className="h-3 w-3 mr-1" strokeWidth={1.5} /> Light
554
+ </Badge>
555
+ <Badge variant="outline" className="text-xs">
556
+ <Moon className="h-3 w-3 mr-1" strokeWidth={1.5} /> Dark
557
+ </Badge>
558
+ <Badge variant="outline" className="text-xs">
559
+ <Accessibility className="h-3 w-3 mr-1" strokeWidth={1.5} /> WCAG AAA-ready
560
+ </Badge>
561
+ </div>
562
+
563
+ <div className="flex items-start gap-5">
564
+ <div className="h-16 w-16 rounded-2xl bg-primary flex items-center justify-center shrink-0 shadow-sm">
565
+ <Sparkles className="h-8 w-8 text-primary-foreground" strokeWidth={1.5} />
566
+ </div>
567
+ <div className="space-y-3">
568
+ <h1 className="text-5xl font-semibold tracking-tight">
569
+ {brand.name}{" "}
570
+ <span className="text-muted-foreground font-normal">{brand.tagline}</span>
571
+ </h1>
572
+ <p className="text-lg text-muted-foreground max-w-3xl leading-relaxed">
573
+ A complete, production-ready design system. Tokens, components, brand voice,
574
+ ethics, and accessibility — all wired together so humans and AI can build
575
+ on it without breaking the rules.
576
+ </p>
577
+ </div>
578
+ </div>
579
+
580
+ <div className="flex items-center gap-2 flex-wrap pt-2">
581
+ <Button size="sm" variant="default" className="gap-2" asChild>
582
+ <a href="#onboard">
583
+ <Wand2 className="h-4 w-4" strokeWidth={1.5} /> Onboard with AI
584
+ </a>
585
+ </Button>
586
+ <Button size="sm" variant="outline" className="gap-2" asChild>
587
+ <a href="#quickstart">
588
+ <Terminal className="h-4 w-4" strokeWidth={1.5} /> Quickstart
589
+ </a>
590
+ </Button>
591
+ <Button size="sm" variant="outline" className="gap-2" asChild>
592
+ <a href="#components">
593
+ <Package className="h-4 w-4" strokeWidth={1.5} /> Browse components
594
+ </a>
595
+ </Button>
596
+ <Button size="sm" variant="outline" className="gap-2" asChild>
597
+ <a href="#chromatic">
598
+ <GitCompare className="h-4 w-4" strokeWidth={1.5} /> Wire up Chromatic
599
+ </a>
600
+ </Button>
601
+ <Button size="sm" variant="ghost" className="gap-2" asChild>
602
+ <a href="#docs">
603
+ <BookOpen className="h-4 w-4" strokeWidth={1.5} /> Read the docs
604
+ </a>
605
+ </Button>
606
+ </div>
607
+ </section>
608
+
609
+ <Separator />
610
+
611
+ {/* METRICS */}
612
+ <section className="space-y-6">
613
+ <SectionHeading
614
+ eyebrow="What's in the box"
615
+ title="Delivered, accounted for"
616
+ description="Every number on this page is read live from the source files in this repo. If it changes, the dashboard updates."
617
+ />
618
+ <div className="grid grid-cols-2 md:grid-cols-4 gap-4">
619
+ <MetricCard
620
+ icon={Package}
621
+ value={componentCount}
622
+ label="Components"
623
+ hint="Each with full a11y contract"
624
+ />
625
+ <MetricCard
626
+ icon={Palette}
627
+ value={semanticTokenCount}
628
+ label="Semantic tokens"
629
+ hint={`${primitiveTokenCount} primitive colors`}
630
+ />
631
+ <MetricCard
632
+ icon={Layers}
633
+ value={SHIPPED_LAYERS.length}
634
+ label="Layers shipped"
635
+ hint={`${DEFERRED_LAYERS.length} deferred to v2`}
636
+ />
637
+ <MetricCard
638
+ icon={ShieldCheck}
639
+ value="AAA"
640
+ label="WCAG-ready"
641
+ hint="7:1 contrast, enforced on commit"
642
+ />
643
+ </div>
644
+ </section>
645
+
646
+ {/* THE STACK */}
647
+ <section className="space-y-6">
648
+ <SectionHeading
649
+ eyebrow="The stack"
650
+ title="Twelve layers, nine shipped"
651
+ description="A layered architecture where lower layers are the ingredients and higher layers are the recipes. v1 ships everything you need to leave the system in a good place. v2 is gated behind real signals — added only when a real problem asks for them."
652
+ />
653
+ <div className="grid md:grid-cols-2 gap-3">
654
+ {SHIPPED_LAYERS.map((layer) => (
655
+ <Card key={layer.n}>
656
+ <CardContent className="py-4 flex items-start gap-3">
657
+ <CheckCircle2
658
+ className="h-5 w-5 text-primary mt-0.5 shrink-0"
659
+ strokeWidth={1.5}
660
+ />
661
+ <div className="flex-1 min-w-0">
662
+ <div className="flex items-baseline gap-2">
663
+ <span className="text-xs font-mono text-muted-foreground">
664
+ Layer {layer.n}
665
+ </span>
666
+ <span className="font-semibold">{layer.name}</span>
667
+ </div>
668
+ <p className="text-sm text-muted-foreground mt-0.5">{layer.note}</p>
669
+ </div>
670
+ <Badge variant="secondary" className="text-xs shrink-0">
671
+ Shipped
672
+ </Badge>
673
+ </CardContent>
674
+ </Card>
675
+ ))}
676
+ </div>
677
+
678
+ <details className="group">
679
+ <summary className="text-sm text-muted-foreground cursor-pointer hover:text-foreground select-none inline-flex items-center gap-1">
680
+ Deferred to v2 ({DEFERRED_LAYERS.length})
681
+ <ArrowUpRight
682
+ className="h-3.5 w-3.5 transition-transform group-open:rotate-45"
683
+ strokeWidth={1.5}
684
+ />
685
+ </summary>
686
+ <div className="grid md:grid-cols-2 gap-3 mt-4">
687
+ {DEFERRED_LAYERS.map((layer) => (
688
+ <Card key={layer.n} className="border-dashed">
689
+ <CardContent className="py-4 flex items-start gap-3">
690
+ <Circle
691
+ className="h-5 w-5 text-muted-foreground/50 mt-0.5 shrink-0"
692
+ strokeWidth={1.5}
693
+ />
694
+ <div className="flex-1 min-w-0">
695
+ <div className="flex items-baseline gap-2">
696
+ <span className="text-xs font-mono text-muted-foreground">
697
+ Layer {layer.n}
698
+ </span>
699
+ <span className="font-semibold text-muted-foreground">
700
+ {layer.name}
701
+ </span>
702
+ </div>
703
+ <p className="text-sm text-muted-foreground mt-0.5">{layer.note}</p>
704
+ </div>
705
+ <Badge variant="outline" className="text-xs shrink-0">
706
+ v2
707
+ </Badge>
708
+ </CardContent>
709
+ </Card>
710
+ ))}
711
+ </div>
712
+ </details>
713
+ </section>
714
+
715
+ {/* BRAND SNAPSHOT */}
716
+ <section className="space-y-6">
717
+ <SectionHeading
718
+ eyebrow="Brand snapshot"
719
+ title="The visual identity"
720
+ description="Colors, type, and motion are tokenized — change one file and every component follows."
721
+ />
722
+ <div className="grid md:grid-cols-3 gap-4">
723
+ {/* Color */}
724
+ <Card>
725
+ <CardHeader>
726
+ <CardTitle className="text-base flex items-center gap-2">
727
+ <Palette className="h-4 w-4 text-muted-foreground" strokeWidth={1.5} />
728
+ Brand color
729
+ </CardTitle>
730
+ </CardHeader>
731
+ <CardContent className="space-y-3">
732
+ <div className="h-20 rounded-lg bg-primary border" />
733
+ <div className="grid grid-cols-5 gap-1.5">
734
+ <div className="aspect-square rounded bg-background border" title="background" />
735
+ <div className="aspect-square rounded bg-foreground border" title="foreground" />
736
+ <div className="aspect-square rounded bg-muted border" title="muted" />
737
+ <div className="aspect-square rounded bg-accent border" title="accent" />
738
+ <div className="aspect-square rounded bg-destructive border" title="destructive" />
739
+ </div>
740
+ <p className="text-xs text-muted-foreground">
741
+ Switchable in the Customize tab. Custom brand colors auto-shift toward AAA 7:1 if they don't already meet it.
742
+ </p>
743
+ </CardContent>
744
+ </Card>
745
+
746
+ {/* Type */}
747
+ <Card>
748
+ <CardHeader>
749
+ <CardTitle className="text-base flex items-center gap-2">
750
+ <Type className="h-4 w-4 text-muted-foreground" strokeWidth={1.5} />
751
+ Typography
752
+ </CardTitle>
753
+ </CardHeader>
754
+ <CardContent className="space-y-3">
755
+ <p className="text-2xl font-semibold leading-none">The quick brown fox</p>
756
+ <p className="text-base">Body text reads at 18px by default for comfort.</p>
757
+ <p className="text-sm font-mono text-muted-foreground">
758
+ Sans · Serif · Mono — all swappable
759
+ </p>
760
+ </CardContent>
761
+ </Card>
762
+
763
+ {/* Voice */}
764
+ <Card>
765
+ <CardHeader>
766
+ <CardTitle className="text-base flex items-center gap-2">
767
+ <Heart className="h-4 w-4 text-muted-foreground" strokeWidth={1.5} />
768
+ Voice
769
+ </CardTitle>
770
+ </CardHeader>
771
+ <CardContent className="space-y-3">
772
+ <div className="flex flex-wrap gap-1.5">
773
+ <Badge variant="secondary">Friendly</Badge>
774
+ <Badge variant="secondary">Daring</Badge>
775
+ <Badge variant="secondary">Radiant</Badge>
776
+ <Badge variant="secondary">Genuine</Badge>
777
+ </div>
778
+ <p className="text-sm text-muted-foreground italic leading-relaxed">
779
+ &ldquo;Sentence case. No exclamation points unless we mean it. Calm on
780
+ errors, brief on success.&rdquo;
781
+ </p>
782
+ <p className="text-xs font-mono text-muted-foreground">
783
+ layer-1-brand-voice/voice-and-tone.md
784
+ </p>
785
+ </CardContent>
786
+ </Card>
787
+ </div>
788
+ </section>
789
+
790
+ {/* COMPONENTS */}
791
+ <section className="space-y-6" id="components">
792
+ <SectionHeading
793
+ eyebrow="Component library"
794
+ title={`${componentCount} components, registered and documented`}
795
+ description="Every component has a purpose, prop signature, anti-patterns, and a structured a11y contract. Agents pick from this list — they never invent new ones."
796
+ />
797
+ <div className="grid md:grid-cols-2 lg:grid-cols-3 gap-4">
798
+ {COMPONENT_GROUPS.map((group) => (
799
+ <Card key={group.title}>
800
+ <CardHeader className="pb-3">
801
+ <CardTitle className="text-sm font-semibold">{group.title}</CardTitle>
802
+ </CardHeader>
803
+ <CardContent className="pt-0 flex flex-wrap gap-1.5">
804
+ {group.items
805
+ .filter((item) => componentNames.includes(item))
806
+ .map((item) => (
807
+ <Badge key={item} variant="outline" className="font-mono text-xs">
808
+ {item}
809
+ </Badge>
810
+ ))}
811
+ </CardContent>
812
+ </Card>
813
+ ))}
814
+ </div>
815
+ </section>
816
+
817
+ {/* ACCESSIBILITY */}
818
+ <section className="space-y-6">
819
+ <SectionHeading
820
+ eyebrow="Accessibility"
821
+ title="WCAG 2.2 AAA-ready, enforced at the source"
822
+ description="Accessibility is not a checklist that runs at the end. It's wired into the tokens, the registry, and the pre-commit hooks. Apps built from BADS start at the highest accessibility floor in the industry — they still need their own audit before formally claiming compliance."
823
+ />
824
+ <div className="grid md:grid-cols-2 gap-3">
825
+ {A11Y_COMMITMENTS.map((c) => (
826
+ <Card key={c.label}>
827
+ <CardContent className="py-4 flex items-start gap-3">
828
+ <Accessibility
829
+ className="h-5 w-5 text-primary mt-0.5 shrink-0"
830
+ strokeWidth={1.5}
831
+ />
832
+ <div>
833
+ <p className="font-medium text-sm">{c.label}</p>
834
+ <p className="text-sm text-muted-foreground">{c.detail}</p>
835
+ </div>
836
+ </CardContent>
837
+ </Card>
838
+ ))}
839
+ </div>
840
+ </section>
841
+
842
+ {/* ETHICS */}
843
+ <section className="space-y-6">
844
+ <SectionHeading
845
+ eyebrow="Ethics & responsibility"
846
+ title="Five principles, baked into the system"
847
+ description="Layer 2 ships decision trees, anti-pattern catalogs, and a pre-commit linter that flags confirmshame, default-opt-in toggles, and undisclosed AI-authored code."
848
+ />
849
+ <Card>
850
+ <CardContent className="py-6 grid md:grid-cols-5 gap-4">
851
+ {[
852
+ "Transparency",
853
+ "Equity",
854
+ "Privacy-First",
855
+ "Consent-Driven",
856
+ "Anti-Dark-Patterns",
857
+ ].map((principle) => (
858
+ <div key={principle} className="flex items-center gap-2">
859
+ <ShieldCheck
860
+ className="h-5 w-5 text-primary shrink-0"
861
+ strokeWidth={1.5}
862
+ />
863
+ <span className="text-sm font-medium leading-none">{principle}</span>
864
+ </div>
865
+ ))}
866
+ </CardContent>
867
+ </Card>
868
+ <p className="text-sm text-muted-foreground">
869
+ Nine anti-patterns the system refuses to ship: confirmshame, manufactured
870
+ urgency, default-opt-in marketing, friction on cancel, hidden pricing, infinite
871
+ scroll on kids&apos; surfaces, third-party trackers on kids&apos; surfaces,
872
+ non-color status indicators, and undisclosed agent-authored code.
873
+ </p>
874
+ </section>
875
+
876
+ {/* ONBOARD */}
877
+ <section className="space-y-10" id="onboard">
878
+ <SectionHeading
879
+ eyebrow="Onboard"
880
+ title="Set up your design system in one prompt"
881
+ description="Designer, engineer, founder, agency — anyone shipping a product can fork this and make it your own. Don't fill every layer by hand. Paste the prompt below into Claude Code and walk through the whole setup — name, brand context, voice, microcopy, ethics, tokens, components, patterns — guided, with a commit at every step."
882
+ />
883
+ <CopyablePromptCard
884
+ title="Run the full onboarding with one prompt"
885
+ description="Paste this into a Claude Code session at the root of this repo. Claude will walk through the rename, source discovery, brand context, voice, microcopy, ethics, tokens, components, and patterns — pausing at each step for your input."
886
+ prompt={SETUP_PROMPT}
887
+ icon={Wand2}
888
+ highlighted
889
+ />
890
+
891
+ <div className="space-y-4">
892
+ <SectionHeading
893
+ eyebrow="Or pull answers from what you already have"
894
+ title="Extract prompts"
895
+ description="If the product already exists, point AI at your existing source instead of pasting raw text. Each extract prompt outputs the same artifact shape as the main onboarding, so the agent can drop the results straight into BRIEF.md, brand.config.ts, voice docs, and tokens. Uses Claude Code's Glob / Grep / Read for codebases, WebFetch for sites, and any MCP for knowledge bases."
896
+ />
897
+ <div className="grid gap-4 lg:grid-cols-2">
898
+ <CopyablePromptCard
899
+ title="From a codebase"
900
+ description="Reads a product repo and derives brand context, voice tics, microcopy patterns, and visual cues — citing file:line for every extracted string."
901
+ prompt={EXTRACT_FROM_CODEBASE}
902
+ icon={FolderGit2}
903
+ />
904
+ <CopyablePromptCard
905
+ title="From a website"
906
+ description="Fetches a homepage + auto-discovered sub-pages. Pulls headline hierarchy, CTA labels, and visible hex codes from rendered styles. Flags weak differentiators."
907
+ prompt={EXTRACT_FROM_WEBSITE}
908
+ icon={Globe}
909
+ />
910
+ <CopyablePromptCard
911
+ title="From a knowledge base"
912
+ description="Reads Notion / Confluence / shared docs. Weights sources by recency, surfaces disagreements between brand guide and actual writing, returns a company outline."
913
+ prompt={EXTRACT_FROM_KB}
914
+ icon={Database}
915
+ />
916
+ <CopyablePromptCard
917
+ title="Triangulate all three"
918
+ description="Combo prompt for mature products. Reads codebase + site + knowledge base, surfaces contradictions explicitly as the most-important artifact (the human's homework)."
919
+ prompt={EXTRACT_COMBO}
920
+ icon={Combine}
921
+ />
922
+ </div>
923
+ </div>
924
+
925
+ <p className="text-sm text-muted-foreground">
926
+ Prefer to run individual layer prompts (voice, ethics, tokens, etc.) by hand?
927
+ Find them in <code className="font-mono text-xs">prompts/</code> with order in{" "}
928
+ <code className="font-mono text-xs">prompts/README.md</code>. Works for personal
929
+ products, internal tools, agency work, anything.
930
+ </p>
931
+ </section>
932
+
933
+ {/* CHROMATIC */}
934
+ <section className="space-y-6" id="chromatic">
935
+ <SectionHeading
936
+ eyebrow="Visual regression"
937
+ title="Wire up Chromatic"
938
+ description="Every Storybook story snapshotted on every PR — light + dark, multiple viewports, with per-story a11y captured by addon-a11y. The infrastructure is already in this fork. The only thing left is connecting it to your Chromatic project."
939
+ />
940
+ <div className="grid lg:grid-cols-3 gap-4">
941
+ <Card>
942
+ <CardHeader className="pb-3">
943
+ <CardTitle className="text-sm flex items-center gap-2">
944
+ <GitCompare className="h-4 w-4 text-muted-foreground" strokeWidth={1.5} />
945
+ 1. Create the project
946
+ </CardTitle>
947
+ </CardHeader>
948
+ <CardContent className="text-sm text-muted-foreground space-y-2">
949
+ <p>
950
+ Sign in at{" "}
951
+ <code className="font-mono text-xs text-foreground">
952
+ chromatic.com/start
953
+ </code>{" "}
954
+ with the GitHub account that owns this repo. Click{" "}
955
+ <em>Add project</em> and pick this fork. Copy the token (starts with{" "}
956
+ <code className="font-mono text-xs text-foreground">chpt_</code>).
957
+ </p>
958
+ </CardContent>
959
+ </Card>
960
+ <Card>
961
+ <CardHeader className="pb-3">
962
+ <CardTitle className="text-sm flex items-center gap-2">
963
+ <KeyRound className="h-4 w-4 text-muted-foreground" strokeWidth={1.5} />
964
+ 2. Add the secret
965
+ </CardTitle>
966
+ </CardHeader>
967
+ <CardContent className="text-sm text-muted-foreground space-y-2">
968
+ <p>
969
+ GitHub → repo → Settings → Secrets and variables → Actions → New
970
+ repository secret. Name it{" "}
971
+ <code className="font-mono text-xs text-foreground">
972
+ CHROMATIC_PROJECT_TOKEN
973
+ </code>
974
+ , paste the token, save. Don&apos;t commit it anywhere.
975
+ </p>
976
+ </CardContent>
977
+ </Card>
978
+ <Card>
979
+ <CardHeader className="pb-3">
980
+ <CardTitle className="text-sm flex items-center gap-2">
981
+ <CheckCircle2 className="h-4 w-4 text-muted-foreground" strokeWidth={1.5} />
982
+ 3. Seed the baseline
983
+ </CardTitle>
984
+ </CardHeader>
985
+ <CardContent className="text-sm text-muted-foreground space-y-2">
986
+ <p>
987
+ Push to <code className="font-mono text-xs text-foreground">main</code>{" "}
988
+ and the workflow runs automatically. Or run locally:{" "}
989
+ <code className="font-mono text-xs text-foreground">
990
+ CHROMATIC_PROJECT_TOKEN=… pnpm chromatic
991
+ </code>
992
+ . First build becomes the rolling baseline.
993
+ </p>
994
+ </CardContent>
995
+ </Card>
996
+ </div>
997
+
998
+ <CopyablePromptCard
999
+ title="Or let Claude Code wire it up"
1000
+ description="Paste this into a Claude Code session at the repo root. Claude walks through every step, pauses for the human-only parts (creating the project, adding the secret), and never logs the token."
1001
+ prompt={CHROMATIC_PROMPT}
1002
+ icon={GitCompare}
1003
+ />
1004
+
1005
+ <p className="text-sm text-muted-foreground">
1006
+ Full reference, troubleshooting, and the kill-switch (
1007
+ <code className="font-mono text-xs">CHROMATIC_ENABLED=false</code>) live in{" "}
1008
+ <code className="font-mono text-xs">docs/chromatic-setup.md</code>. The
1009
+ workflow is at{" "}
1010
+ <code className="font-mono text-xs">.github/workflows/chromatic.yml</code> and
1011
+ its config at{" "}
1012
+ <code className="font-mono text-xs">chromatic.config.json</code> — already
1013
+ tuned for{" "}
1014
+ <code className="font-mono text-xs">onlyChanged: true</code> and{" "}
1015
+ <code className="font-mono text-xs">autoAcceptChanges: main</code>.
1016
+ </p>
1017
+ </section>
1018
+
1019
+ <Separator />
1020
+
1021
+ {/* QUICKSTART */}
1022
+ <section className="space-y-6" id="quickstart">
1023
+ <SectionHeading
1024
+ eyebrow="Quickstart"
1025
+ title="Wire it up in three commands"
1026
+ description="The system is published as an npm package and consumed like any other library. Tokens, styles, and components ship together."
1027
+ />
1028
+ <div className="grid md:grid-cols-2 gap-4">
1029
+ <Card>
1030
+ <CardHeader>
1031
+ <CardTitle className="text-base flex items-center gap-2">
1032
+ <Terminal className="h-4 w-4" strokeWidth={1.5} /> 1. Install
1033
+ </CardTitle>
1034
+ </CardHeader>
1035
+ <CardContent>
1036
+ <CodeBlock>{`pnpm add ${corePkg.name}`}</CodeBlock>
1037
+ </CardContent>
1038
+ </Card>
1039
+ <Card>
1040
+ <CardHeader>
1041
+ <CardTitle className="text-base flex items-center gap-2">
1042
+ <Palette className="h-4 w-4" strokeWidth={1.5} /> 2. Import styles
1043
+ </CardTitle>
1044
+ </CardHeader>
1045
+ <CardContent>
1046
+ <CodeBlock>{`import "${corePkg.name}/styles.css";`}</CodeBlock>
1047
+ </CardContent>
1048
+ </Card>
1049
+ <Card className="md:col-span-2">
1050
+ <CardHeader>
1051
+ <CardTitle className="text-base flex items-center gap-2">
1052
+ <Code2 className="h-4 w-4" strokeWidth={1.5} /> 3. Use components
1053
+ </CardTitle>
1054
+ </CardHeader>
1055
+ <CardContent>
1056
+ <CodeBlock>{`import { Button } from "${corePkg.name}/components/ui/button";
1057
+
1058
+ export function Example() {
1059
+ return <Button>Get started</Button>;
1060
+ }`}</CodeBlock>
1061
+ </CardContent>
1062
+ </Card>
1063
+ </div>
1064
+ </section>
1065
+
1066
+ {/* DOCS */}
1067
+ <section className="space-y-6" id="docs">
1068
+ <SectionHeading
1069
+ eyebrow="Documentation"
1070
+ title="Where to look next"
1071
+ description="Everything that ships with this system is in the repo. Designers, engineers, and AI all read from the same source."
1072
+ />
1073
+ <div className="grid md:grid-cols-2 lg:grid-cols-3 gap-3">
1074
+ {[
1075
+ {
1076
+ file: "README.md",
1077
+ label: "Read me first",
1078
+ desc: "Project overview, install, scripts.",
1079
+ icon: BookOpen,
1080
+ },
1081
+ {
1082
+ file: "DESIGN.md",
1083
+ label: "Design principles",
1084
+ desc: "Visual system, layout rhythm, a11y floors.",
1085
+ icon: Eye,
1086
+ },
1087
+ {
1088
+ file: "CLAUDE.md",
1089
+ label: "AI instructions",
1090
+ desc: "How agents work in this repo. Read by Cursor + Claude Code.",
1091
+ icon: Sparkles,
1092
+ },
1093
+ {
1094
+ file: "DESIGN_SYSTEM_STACK.md",
1095
+ label: "The stack",
1096
+ desc: "All ten layers — what's shipped and what's deferred.",
1097
+ icon: Layers,
1098
+ },
1099
+ {
1100
+ file: "COMPONENT_INDEX.md",
1101
+ label: "Component index",
1102
+ desc: "Human-readable component guide.",
1103
+ icon: Package,
1104
+ },
1105
+ {
1106
+ file: "CLIENT_ONBOARDING.md",
1107
+ label: "Onboarding",
1108
+ desc: "How this system was set up for you, end to end.",
1109
+ icon: FileText,
1110
+ },
1111
+ {
1112
+ file: "docs/chromatic-setup.md",
1113
+ label: "Chromatic setup",
1114
+ desc: "Wire up visual regression on this fork. One-time, ~5 minutes.",
1115
+ icon: GitCompare,
1116
+ },
1117
+ ].map((doc) => (
1118
+ <Card key={doc.file}>
1119
+ <CardContent className="py-4 flex items-start gap-3">
1120
+ <doc.icon
1121
+ className="h-5 w-5 text-muted-foreground mt-0.5 shrink-0"
1122
+ strokeWidth={1.5}
1123
+ />
1124
+ <div className="min-w-0 flex-1">
1125
+ <p className="font-medium text-sm">{doc.label}</p>
1126
+ <p className="text-sm text-muted-foreground">{doc.desc}</p>
1127
+ <p className="text-xs font-mono text-muted-foreground mt-1.5 truncate">
1128
+ {doc.file}
1129
+ </p>
1130
+ </div>
1131
+ </CardContent>
1132
+ </Card>
1133
+ ))}
1134
+ </div>
1135
+ </section>
1136
+
1137
+ {/* WHAT TO DO NEXT */}
1138
+ <section className="space-y-6">
1139
+ <SectionHeading
1140
+ eyebrow="Handoff"
1141
+ title="What to do next"
1142
+ description="A short, ordered list. Do them in sequence — each one unlocks the next."
1143
+ />
1144
+ <Card>
1145
+ <CardContent className="py-6 space-y-5">
1146
+ {[
1147
+ {
1148
+ step: "01",
1149
+ title: "Walk the Customize tab",
1150
+ body: "Try the brand color, fonts, type scale, and density controls. Save when you find a combo you like — it writes back to tokens.json.",
1151
+ },
1152
+ {
1153
+ step: "02",
1154
+ title: "Skim the Layers tab",
1155
+ body: "Every governance doc — voice, ethics, a11y — is editable from here. Edits commit to git in one click.",
1156
+ },
1157
+ {
1158
+ step: "03",
1159
+ title: "Read CLAUDE.md and DESIGN.md",
1160
+ body: "These two files teach humans and AI how to work in the system. They're the most-read files in the repo.",
1161
+ },
1162
+ {
1163
+ step: "04",
1164
+ title: "Wire up Chromatic visual regression",
1165
+ body: "Create a Chromatic project for the fork, add the CHROMATIC_PROJECT_TOKEN GitHub secret, and let the first push to main seed the baseline. Walk-through in the Visual regression section above; full reference at docs/chromatic-setup.md.",
1166
+ },
1167
+ {
1168
+ step: "05",
1169
+ title: "Install in your product",
1170
+ body: "Use the quickstart above. The package is already published — just point your app at it.",
1171
+ },
1172
+ {
1173
+ step: "06",
1174
+ title: "Tell us when you outgrow v1",
1175
+ body: "v2 layers (search, Figma sync, agent PRs) get added when a real signal asks for them. We'll know it's time when you do.",
1176
+ },
1177
+ ].map((item) => (
1178
+ <div key={item.step} className="flex items-start gap-4">
1179
+ <div className="text-2xl font-mono font-semibold text-muted-foreground shrink-0 w-12">
1180
+ {item.step}
1181
+ </div>
1182
+ <div className="space-y-1 flex-1 min-w-0">
1183
+ <p className="font-semibold">{item.title}</p>
1184
+ <p className="text-sm text-muted-foreground leading-relaxed">
1185
+ {item.body}
1186
+ </p>
1187
+ </div>
1188
+ </div>
1189
+ ))}
1190
+ </CardContent>
1191
+ </Card>
1192
+ </section>
1193
+
1194
+ {/* FOOTER */}
1195
+ <Separator />
1196
+ <footer className="space-y-3 pb-8">
1197
+ <div className="flex items-center justify-between flex-wrap gap-4">
1198
+ <div className="flex items-center gap-2">
1199
+ <div className="h-7 w-7 rounded-md bg-primary flex items-center justify-center">
1200
+ <Sparkles className="h-4 w-4 text-primary-foreground" strokeWidth={1.5} />
1201
+ </div>
1202
+ <span className="font-semibold">{brand.name}</span>
1203
+ <Badge variant="outline" className="text-xs">
1204
+ {brand.tagline}
1205
+ </Badge>
1206
+ <Badge variant="secondary" className="text-xs font-mono">
1207
+ v{corePkg.version}
1208
+ </Badge>
1209
+ </div>
1210
+ <div className="flex items-center gap-2 text-sm text-muted-foreground">
1211
+ <Ruler className="h-4 w-4" strokeWidth={1.5} />
1212
+ <span>Built on the BADS template</span>
1213
+ <span>·</span>
1214
+ <Box className="h-4 w-4" strokeWidth={1.5} />
1215
+ <span className="font-mono">{corePkg.name}</span>
1216
+ </div>
1217
+ </div>
1218
+ <p className="text-xs text-muted-foreground">
1219
+ <Zap className="h-3 w-3 inline mr-1" strokeWidth={1.5} />
1220
+ This dashboard reads live from <span className="font-mono">tokens.json</span>{" "}
1221
+ and the component registry. Every number updates as the system evolves.
1222
+ </p>
1223
+ </footer>
1224
+ </div>
1225
+ </ScrollArea>
1226
+ );
1227
+ }