@draekien/create-d9-app 0.0.2 → 0.0.3
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/package.json +2 -1
- package/templates/base/.agents/skills/shadcn/SKILL.md +295 -0
- package/templates/base/.agents/skills/shadcn/agents/openai.yml +5 -0
- package/templates/base/.agents/skills/shadcn/assets/shadcn-small.png +0 -0
- package/templates/base/.agents/skills/shadcn/assets/shadcn.png +0 -0
- package/templates/base/.agents/skills/shadcn/assets/showcase/color-pair.tsx +126 -0
- package/templates/base/.agents/skills/shadcn/assets/showcase/preview-states.css +14 -0
- package/templates/base/.agents/skills/shadcn/assets/showcase/state-matrix.tsx +72 -0
- package/templates/base/.agents/skills/shadcn/cli.md +290 -0
- package/templates/base/.agents/skills/shadcn/customization.md +211 -0
- package/templates/base/.agents/skills/shadcn/design-system-page.md +268 -0
- package/templates/base/.agents/skills/shadcn/design-system.md +386 -0
- package/templates/base/.agents/skills/shadcn/evals/evals.json +126 -0
- package/templates/base/.agents/skills/shadcn/mcp.md +105 -0
- package/templates/base/.agents/skills/shadcn/registry.md +277 -0
- package/templates/base/.agents/skills/shadcn/rules/base-vs-radix.md +306 -0
- package/templates/base/.agents/skills/shadcn/rules/chat.md +250 -0
- package/templates/base/.agents/skills/shadcn/rules/composition.md +213 -0
- package/templates/base/.agents/skills/shadcn/rules/forms.md +192 -0
- package/templates/base/.agents/skills/shadcn/rules/icons.md +101 -0
- package/templates/base/.agents/skills/shadcn/rules/styling.md +185 -0
- package/templates/base/.agents/skills/shadcn/scripts/showcase-coverage.mjs +53 -0
- package/templates/base/.claude/rules/components.md +11 -0
- package/templates/base/.claude/rules/generated-files.md +11 -0
- package/templates/base/.claude/rules/testing.md +13 -0
- package/templates/base/.claude/rules/typescript.md +29 -0
- package/templates/base/.claude/skills/shadcn/SKILL.md +295 -0
- package/templates/base/.claude/skills/shadcn/agents/openai.yml +5 -0
- package/templates/base/.claude/skills/shadcn/assets/shadcn-small.png +0 -0
- package/templates/base/.claude/skills/shadcn/assets/shadcn.png +0 -0
- package/templates/base/.claude/skills/shadcn/assets/showcase/color-pair.tsx +126 -0
- package/templates/base/.claude/skills/shadcn/assets/showcase/preview-states.css +14 -0
- package/templates/base/.claude/skills/shadcn/assets/showcase/state-matrix.tsx +72 -0
- package/templates/base/.claude/skills/shadcn/cli.md +290 -0
- package/templates/base/.claude/skills/shadcn/customization.md +211 -0
- package/templates/base/.claude/skills/shadcn/design-system-page.md +268 -0
- package/templates/base/.claude/skills/shadcn/design-system.md +386 -0
- package/templates/base/.claude/skills/shadcn/evals/evals.json +126 -0
- package/templates/base/.claude/skills/shadcn/mcp.md +105 -0
- package/templates/base/.claude/skills/shadcn/registry.md +277 -0
- package/templates/base/.claude/skills/shadcn/rules/base-vs-radix.md +306 -0
- package/templates/base/.claude/skills/shadcn/rules/chat.md +250 -0
- package/templates/base/.claude/skills/shadcn/rules/composition.md +213 -0
- package/templates/base/.claude/skills/shadcn/rules/forms.md +192 -0
- package/templates/base/.claude/skills/shadcn/rules/icons.md +101 -0
- package/templates/base/.claude/skills/shadcn/rules/styling.md +185 -0
- package/templates/base/.claude/skills/shadcn/scripts/showcase-coverage.mjs +53 -0
- package/templates/base/AGENTS.md +9 -1
- package/templates/base/skills-lock.json +11 -0
- package/templates/tools/biome/.biome/catch-binding-unknown.grit +7 -0
- package/templates/tools/biome/.biome/effect-cleanup.grit +5 -2
- package/templates/tools/biome/.biome/handler-naming.grit +19 -6
- package/templates/tools/biome/.biome/no-class-error-boundary.grit +11 -0
- package/templates/tools/biome/.biome/no-direct-component-call.grit +20 -0
- package/templates/tools/biome/.biome/no-fetch-in-handler.grit +12 -0
- package/templates/tools/biome/.biome/no-impure-render.grit +7 -2
- package/templates/tools/biome/.biome/no-query-client-in-render.grit +4 -1
- package/templates/tools/biome/.biome/no-state-mutation.grit +19 -0
- package/templates/tools/biome/.biome/no-try-around-jsx.grit +6 -2
- package/templates/tools/biome/.biome/use-assert-never.grit +6 -0
- package/templates/tools/biome/biome.json +41 -3
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skill_name": "shadcn",
|
|
3
|
+
"evals": [
|
|
4
|
+
{
|
|
5
|
+
"id": 1,
|
|
6
|
+
"prompt": "I'm building a Next.js app with shadcn/ui (base-nova preset, lucide icons). Create a settings form component with fields for: full name, email address, and notification preferences (email, SMS, push notifications as toggle options). Add validation states for required fields.",
|
|
7
|
+
"expected_output": "A React component using FieldGroup, Field, ToggleGroup, data-invalid/aria-invalid validation, gap-* spacing, and semantic colors.",
|
|
8
|
+
"files": [],
|
|
9
|
+
"expectations": [
|
|
10
|
+
"Uses FieldGroup and Field components for form layout instead of raw div with space-y",
|
|
11
|
+
"Uses Switch for independent on/off notification toggles (not looping Button with manual active state)",
|
|
12
|
+
"Uses data-invalid on Field and aria-invalid on the input control for validation states",
|
|
13
|
+
"Uses gap-* (e.g. gap-4, gap-6) instead of space-y-* or space-x-* for spacing",
|
|
14
|
+
"Uses semantic color tokens (e.g. bg-background, text-muted-foreground, text-destructive) instead of raw colors like bg-red-500",
|
|
15
|
+
"No manual dark: color overrides"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": 2,
|
|
20
|
+
"prompt": "Create a dialog component for editing a user profile. It should have the user's avatar at the top, input fields for name and bio, and Save/Cancel buttons with appropriate icons. Using shadcn/ui with radix-nova preset and tabler icons.",
|
|
21
|
+
"expected_output": "A React component with DialogTitle, Avatar+AvatarFallback, data-icon on icon buttons, no icon sizing classes, tabler icon imports.",
|
|
22
|
+
"files": [],
|
|
23
|
+
"expectations": [
|
|
24
|
+
"Includes DialogTitle for accessibility (visible or with sr-only class)",
|
|
25
|
+
"Avatar component includes AvatarFallback",
|
|
26
|
+
"Icons on buttons use the data-icon attribute (data-icon=\"inline-start\" or data-icon=\"inline-end\")",
|
|
27
|
+
"No sizing classes on icons inside components (no size-4, w-4, h-4, etc.)",
|
|
28
|
+
"Uses tabler icons (@tabler/icons-react) instead of lucide-react",
|
|
29
|
+
"Uses asChild for custom triggers (radix preset)"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": 3,
|
|
34
|
+
"prompt": "Create a dashboard component that shows 4 stat cards in a grid. Each card has a title, large number, percentage change badge, and a loading skeleton state. Using shadcn/ui with base-nova preset and lucide icons.",
|
|
35
|
+
"expected_output": "A React component with full Card composition, Skeleton for loading, Badge for changes, semantic colors, gap-* spacing.",
|
|
36
|
+
"files": [],
|
|
37
|
+
"expectations": [
|
|
38
|
+
"Uses full Card composition with CardHeader, CardTitle, CardContent (not dumping everything into CardContent)",
|
|
39
|
+
"Uses Skeleton component for loading placeholders instead of custom animate-pulse divs",
|
|
40
|
+
"Uses Badge component for percentage change instead of custom styled spans",
|
|
41
|
+
"Uses semantic color tokens instead of raw color values like bg-green-500 or text-red-600",
|
|
42
|
+
"Uses gap-* instead of space-y-* or space-x-* for spacing",
|
|
43
|
+
"Uses size-* when width and height are equal instead of separate w-* h-*"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": 4,
|
|
48
|
+
"prompt": "I'm building a Next.js app with shadcn/ui (base-nova preset, lucide icons). Build a chat conversation view: a scrollable thread of messages from two different people, each with an avatar, sender name, timestamp, and message bubble. A couple of messages include an image attachment and a PDF file attachment, and there's a 'Today' divider separating the days.",
|
|
49
|
+
"expected_output": "A React component composing MessageScroller, Message, Bubble, Attachment, and Marker from the registry instead of hand-rolled bubble/divider/attachment markup.",
|
|
50
|
+
"files": [],
|
|
51
|
+
"expectations": [
|
|
52
|
+
"Uses MessageScroller (MessageScrollerProvider, MessageScrollerViewport, MessageScrollerContent, MessageScrollerItem) for the scrollable thread instead of a raw overflow-y-auto div or ScrollArea",
|
|
53
|
+
"Wraps each row in MessageScrollerItem inside MessageScrollerContent",
|
|
54
|
+
"Uses Message with MessageAvatar/MessageContent/MessageHeader for row layout instead of custom flex divs",
|
|
55
|
+
"Uses Bubble + BubbleContent for the message surface instead of a styled div with bg-muted/bg-primary",
|
|
56
|
+
"Uses Attachment (AttachmentMedia, AttachmentContent, AttachmentTitle, AttachmentDescription) for the file and image attachments instead of Item or a custom card",
|
|
57
|
+
"Uses Marker (variant=\"separator\") for the 'Today' divider instead of Separator plus a centered label",
|
|
58
|
+
"Uses semantic color tokens and gap-* spacing; no raw colors like bg-emerald-500 and no space-y-*",
|
|
59
|
+
"Includes \"use client\" when the component uses state or event handlers (isRSC)"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"id": 5,
|
|
64
|
+
"prompt": "Using shadcn/ui (base-nova preset, lucide icons), build a streaming AI chat UI. The assistant's reply streams in while it generates, the view auto-scrolls to follow the latest content but stops following if the user scrolls up to read earlier messages, a 'jump to latest' button appears when the user has scrolled away from the bottom, and a subtle 'thinking…' shimmer shows while the model is generating.",
|
|
65
|
+
"expected_output": "A React component that delegates scroll/anchor behavior to MessageScroller and uses MessageScrollerButton for jump-to-latest and the shimmer utility for the thinking indicator — no hand-rolled scroll logic or custom shimmer keyframes.",
|
|
66
|
+
"files": [],
|
|
67
|
+
"expectations": [
|
|
68
|
+
"Uses MessageScroller with MessageScrollerProvider (autoScroll) and scrollAnchor on message items for the stick-to-bottom/follow behavior instead of a custom useStickToBottom hook or ResizeObserver/scrollTop wiring",
|
|
69
|
+
"Uses MessageScrollerButton for the jump-to-latest control instead of a hand-built conditional button driven by manual scroll-position state",
|
|
70
|
+
"Uses the shimmer utility class for the 'thinking…' indicator instead of a custom @keyframes or bg-clip-text gradient animation",
|
|
71
|
+
"Wraps each message row in MessageScrollerItem inside MessageScrollerContent",
|
|
72
|
+
"Uses Message + Bubble + BubbleContent for the conversation rows instead of hand-rolled bubble divs",
|
|
73
|
+
"Uses semantic color tokens and gap-* spacing; includes \"use client\" (isRSC)"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"id": 6,
|
|
78
|
+
"prompt": "Build me a design system using preset b0. Use the DESIGN.md in this folder (a productivity-app spec: white canvas, #0075DE primary, 8px buttons, 12px cards, multi-layer soft shadows, 2px blue focus outline with 2px offset).",
|
|
79
|
+
"expected_output": "A new Vite app created with init --preset b0 --template vite, every component installed, a design system page that renders all of them, and the DESIGN.md tokens mapped onto the shadcn theme.",
|
|
80
|
+
"files": [],
|
|
81
|
+
"expectations": [
|
|
82
|
+
"Creates the app with init --preset b0 --template vite --name <app> and passes the preset code through without decoding it",
|
|
83
|
+
"Installs every component with add --all and reports the component count from disk",
|
|
84
|
+
"Reads the DESIGN.md Do's and Don'ts and Known Gaps before editing the theme",
|
|
85
|
+
"Maps DESIGN.md colors onto shadcn variables in the existing tailwindCssFile and registers extra tokens in @theme inline instead of creating a new CSS file",
|
|
86
|
+
"Pins the radius scale in @theme inline and overrides the shadow scale with the documented multi-layer shadows",
|
|
87
|
+
"Implements the 2px outline focus with an offset instead of keeping the default ring",
|
|
88
|
+
"Changes field control heights together with the button height",
|
|
89
|
+
"Renders every installed component on the design system page and runs the coverage check",
|
|
90
|
+
"Verifies in a browser: typecheck, no console errors, page loads at the top, no horizontal overflow",
|
|
91
|
+
"Shows color roles as surface/foreground pairs with measured contrast ratios",
|
|
92
|
+
"Shows a variant × state matrix for Button with hover, focus, active and disabled pinned via data-preview",
|
|
93
|
+
"Renders do/don't pairs for rules from the DESIGN.md"
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"id": 7,
|
|
98
|
+
"prompt": "Create a Next.js design system app called editorial from preset b0 and apply this DESIGN.md: cream canvas #faf9f5, coral primary #cc785c that darkens only on press, licensed serif display (substitute Cormorant Garamond), Inter body, dark #181715 product surfaces, 40px buttons and inputs.",
|
|
99
|
+
"expected_output": "A Next.js app with all components, serif display type utilities, coral primary with an active-only darker state, dark bands scoped with the dark class, and a showcase page covering every component.",
|
|
100
|
+
"files": [],
|
|
101
|
+
"expectations": [
|
|
102
|
+
"Uses --template next with --preset b0 and --name editorial",
|
|
103
|
+
"Installs the documented font substitutes from Fontsource instead of linking licensed fonts",
|
|
104
|
+
"Defines type-* utilities for the display scale with serif family, weight 400-500 and negative tracking, instead of --text-* theme keys",
|
|
105
|
+
"Uses active: rather than hover: for the primary darker state, per the DESIGN.md",
|
|
106
|
+
"Raises button and input heights to 40px across button, input, input-group, select and related controls",
|
|
107
|
+
"Uses className=\"dark\" on sections or cards to render dark product surfaces with the same components",
|
|
108
|
+
"Avoids the cmdk mount scroll jump on the inline Command example",
|
|
109
|
+
"Reports deliberate deviations from the DESIGN.md (font substitutes, kept hover, derived values)"
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"id": 8,
|
|
114
|
+
"prompt": "Create a new design system using shadcn and the following DESIGN.md. <DESIGN.md: editorial cream canvas, coral primary, 40px controls, 12px cards, 16px hero container, pill badges, shadows rare, generous 32px card padding>",
|
|
115
|
+
"expected_output": "A new app scaffolded without a preset code by picking a style that matches the DESIGN.md geometry, then themed, with a full design system page.",
|
|
116
|
+
"files": [],
|
|
117
|
+
"expectations": [
|
|
118
|
+
"Does not ask for or invent a preset code; passes --base base --preset <style> so init doesn't stop at an interactive prompt",
|
|
119
|
+
"Picks a style matching the DESIGN.md geometry (e.g. maia for generous spacing and 12px+ cards, or sera for editorial serif type) and states the reason in one line",
|
|
120
|
+
"Passes --no-monorepo and --template vite (or next when asked)",
|
|
121
|
+
"Installs all components and builds the design system page per design-system-page.md",
|
|
122
|
+
"Reports contrast pairs below 4.5:1, including the DESIGN.md's own primary/on-primary pair if it fails"
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# shadcn MCP Server
|
|
2
|
+
|
|
3
|
+
The CLI includes an MCP server that lets AI assistants search, browse, view, and install items from registries.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
shadcn mcp # start the MCP server (stdio)
|
|
11
|
+
shadcn mcp init # write config for your editor
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Editor config files:
|
|
15
|
+
|
|
16
|
+
| Editor | Config file |
|
|
17
|
+
| ----------- | ------------------------------- |
|
|
18
|
+
| Claude Code | `.mcp.json` |
|
|
19
|
+
| Cursor | `.cursor/mcp.json` |
|
|
20
|
+
| VS Code | `.vscode/mcp.json` |
|
|
21
|
+
| OpenCode | `opencode.json` |
|
|
22
|
+
| Codex | `~/.codex/config.toml` (manual) |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Tools
|
|
27
|
+
|
|
28
|
+
> **Tip:** MCP tools handle registry operations (search, view, install). For project configuration (aliases, framework, Tailwind version), use `npx shadcn@latest info` — there is no MCP equivalent.
|
|
29
|
+
|
|
30
|
+
### `shadcn:get_project_registries`
|
|
31
|
+
|
|
32
|
+
Returns registry names from `components.json`. Errors if no `components.json` exists.
|
|
33
|
+
|
|
34
|
+
**Input:** none
|
|
35
|
+
|
|
36
|
+
### `shadcn:list_items_in_registries`
|
|
37
|
+
|
|
38
|
+
Lists all items from one or more registries. Registries can be configured
|
|
39
|
+
namespaces such as `@acme`, public GitHub sources such as `owner/repo`, or
|
|
40
|
+
registry catalog URLs. Omit `registries` to list from every registry configured
|
|
41
|
+
in `components.json`.
|
|
42
|
+
|
|
43
|
+
**Input:** `registries` (string[], optional — omit for all configured), `types` (string[], optional — e.g. `["ui", "block"]`), `limit` (number, optional, defaults to 100), `offset` (number, optional)
|
|
44
|
+
|
|
45
|
+
### `shadcn:search_items_in_registries`
|
|
46
|
+
|
|
47
|
+
Fuzzy search across registries. Registries can be configured namespaces, public
|
|
48
|
+
GitHub sources, or registry catalog URLs. Omit `registries` to search every
|
|
49
|
+
registry configured in `components.json` — e.g. "find me a hero" across all
|
|
50
|
+
configured registries.
|
|
51
|
+
|
|
52
|
+
**Input:** `registries` (string[], optional — omit for all configured), `query` (string), `types` (string[], optional — e.g. `["ui", "block"]`), `limit` (number, optional, defaults to 100), `offset` (number, optional)
|
|
53
|
+
|
|
54
|
+
### `shadcn:view_items_in_registries`
|
|
55
|
+
|
|
56
|
+
View item details including full file contents.
|
|
57
|
+
|
|
58
|
+
**Input:** `items` (string[]) — e.g.
|
|
59
|
+
`["@shadcn/button", "@shadcn/card", "owner/repo/item"]`
|
|
60
|
+
|
|
61
|
+
### `shadcn:get_item_examples_from_registries`
|
|
62
|
+
|
|
63
|
+
Find usage examples and demos with source code. Omit `registries` to search
|
|
64
|
+
every registry configured in `components.json`.
|
|
65
|
+
|
|
66
|
+
**Input:** `registries` (string[], optional — omit for all configured), `query` (string) — e.g. `"accordion-demo"`, `"button example"`
|
|
67
|
+
|
|
68
|
+
### `shadcn:get_add_command_for_items`
|
|
69
|
+
|
|
70
|
+
Returns the CLI install command.
|
|
71
|
+
|
|
72
|
+
**Input:** `items` (string[]) — e.g. `["@shadcn/button"]`
|
|
73
|
+
|
|
74
|
+
### `shadcn:get_audit_checklist`
|
|
75
|
+
|
|
76
|
+
Returns a checklist for verifying components (imports, deps, lint, TypeScript).
|
|
77
|
+
|
|
78
|
+
**Input:** none
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Configuring Registries
|
|
83
|
+
|
|
84
|
+
Namespaced and authenticated registries are set in `components.json`. The
|
|
85
|
+
`@shadcn` registry is always built-in. Public GitHub registries can also be used
|
|
86
|
+
directly as `owner/repo` registry sources when the repository has a root
|
|
87
|
+
`registry.json`; they do not need `components.json` configuration.
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"registries": {
|
|
92
|
+
"@acme": "https://acme.com/r/{name}.json",
|
|
93
|
+
"@private": {
|
|
94
|
+
"url": "https://private.com/r/{name}.json",
|
|
95
|
+
"headers": { "Authorization": "Bearer ${MY_TOKEN}" }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
- Names must start with `@`.
|
|
102
|
+
- URLs must contain `{name}`.
|
|
103
|
+
- `${VAR}` references are resolved from environment variables.
|
|
104
|
+
|
|
105
|
+
Community registry index: `https://ui.shadcn.com/r/registries.json`
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# Registry Authoring and Addresses
|
|
2
|
+
|
|
3
|
+
Use this reference when the user wants to create, fix, publish, or reason about
|
|
4
|
+
a shadcn registry.
|
|
5
|
+
|
|
6
|
+
## Mental Model
|
|
7
|
+
|
|
8
|
+
A registry has two forms:
|
|
9
|
+
|
|
10
|
+
- **Source registry**: an authored `registry.json` in a project or repository.
|
|
11
|
+
It may use `include` and file paths that point at source files.
|
|
12
|
+
- **Built registry**: generated JSON files served to CLI consumers, usually
|
|
13
|
+
from `public/r`. Use `npx shadcn@latest build` to create this form.
|
|
14
|
+
|
|
15
|
+
The CLI installer consumes registry item payloads. A source registry is a way to
|
|
16
|
+
author those payloads from real files.
|
|
17
|
+
|
|
18
|
+
Registry items are not limited to React components. They can distribute
|
|
19
|
+
components, hooks, utilities, design tokens, pages, config files, docs, rules,
|
|
20
|
+
workflows, templates, MCP files, and other project files.
|
|
21
|
+
|
|
22
|
+
## Root `registry.json`
|
|
23
|
+
|
|
24
|
+
The root registry file should define registry metadata and either `items` or
|
|
25
|
+
`include`.
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"$schema": "https://ui.shadcn.com/schema/registry.json",
|
|
30
|
+
"name": "acme",
|
|
31
|
+
"homepage": "https://acme.com",
|
|
32
|
+
"items": [
|
|
33
|
+
{
|
|
34
|
+
"name": "absolute-url",
|
|
35
|
+
"type": "registry:lib",
|
|
36
|
+
"title": "Absolute URL",
|
|
37
|
+
"description": "A utility to turn any path into an absolute URL.",
|
|
38
|
+
"files": [
|
|
39
|
+
{
|
|
40
|
+
"path": "lib/absolute-url.ts",
|
|
41
|
+
"type": "registry:lib"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Root registry rules:
|
|
50
|
+
|
|
51
|
+
- Root `registry.json` must include `name` and `homepage`.
|
|
52
|
+
- `items` is an array of registry item definitions.
|
|
53
|
+
- `include` may be used to split the source registry into multiple files.
|
|
54
|
+
- Included registry files may omit `name` and `homepage`.
|
|
55
|
+
|
|
56
|
+
## Include
|
|
57
|
+
|
|
58
|
+
Use `include` to keep large registries modular.
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"$schema": "https://ui.shadcn.com/schema/registry.json",
|
|
63
|
+
"name": "acme",
|
|
64
|
+
"homepage": "https://acme.com",
|
|
65
|
+
"include": ["registry/ui/registry.json", "registry/blocks/registry.json"]
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Include rules:
|
|
70
|
+
|
|
71
|
+
- Include paths are relative to the `registry.json` that declares them.
|
|
72
|
+
- Include paths must explicitly point to a `registry.json` file.
|
|
73
|
+
- Do not use remote URLs, absolute paths, or parent traversal (`..`).
|
|
74
|
+
- Item file paths are relative to the registry file that declares the item.
|
|
75
|
+
- Duplicate item names fail across the resolved registry.
|
|
76
|
+
|
|
77
|
+
Example included file:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"items": [
|
|
82
|
+
{
|
|
83
|
+
"name": "button",
|
|
84
|
+
"type": "registry:ui",
|
|
85
|
+
"files": [
|
|
86
|
+
{
|
|
87
|
+
"path": "button.tsx",
|
|
88
|
+
"type": "registry:ui"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
If this file is at `registry/ui/registry.json`, then `button.tsx` is read from
|
|
97
|
+
`registry/ui/button.tsx`, and the built item path is emitted relative to the
|
|
98
|
+
root registry.
|
|
99
|
+
|
|
100
|
+
## Item Definitions
|
|
101
|
+
|
|
102
|
+
Common item fields:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"name": "login-form",
|
|
107
|
+
"type": "registry:block",
|
|
108
|
+
"title": "Login Form",
|
|
109
|
+
"description": "A login form with email and password fields.",
|
|
110
|
+
"dependencies": ["zod"],
|
|
111
|
+
"registryDependencies": ["button", "input", "label"],
|
|
112
|
+
"files": [
|
|
113
|
+
{
|
|
114
|
+
"path": "blocks/login-form.tsx",
|
|
115
|
+
"type": "registry:block"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"cssVars": {
|
|
119
|
+
"light": {
|
|
120
|
+
"brand": "oklch(0.62 0.18 250)"
|
|
121
|
+
},
|
|
122
|
+
"dark": {
|
|
123
|
+
"brand": "oklch(0.72 0.16 250)"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Important fields:
|
|
130
|
+
|
|
131
|
+
- `name`: the installable item name. It is not necessarily a file path.
|
|
132
|
+
- `type`: one of the registry item types, such as `registry:ui`,
|
|
133
|
+
`registry:block`, `registry:lib`, `registry:hook`, `registry:file`,
|
|
134
|
+
`registry:page`, `registry:theme`, `registry:style`, `registry:font`, or
|
|
135
|
+
`registry:item`.
|
|
136
|
+
- `files`: source files copied or generated by the item.
|
|
137
|
+
- `dependencies`: npm runtime dependencies.
|
|
138
|
+
- `devDependencies`: npm development dependencies.
|
|
139
|
+
- `registryDependencies`: other registry items required by this item.
|
|
140
|
+
- `cssVars`, `css`, `tailwind`, `envVars`, and `docs`: optional install-time
|
|
141
|
+
additions.
|
|
142
|
+
|
|
143
|
+
File rules:
|
|
144
|
+
|
|
145
|
+
- File paths are relative to the declaring `registry.json`.
|
|
146
|
+
- `registry:file` and `registry:page` files require a `target`.
|
|
147
|
+
- Do not use remote file URLs in source registry file paths.
|
|
148
|
+
- Keep source files copy-pasteable: no hidden app-only imports.
|
|
149
|
+
|
|
150
|
+
## Registry Dependencies
|
|
151
|
+
|
|
152
|
+
`registryDependencies` entries are item addresses, not file paths.
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
{
|
|
156
|
+
"name": "login-form",
|
|
157
|
+
"type": "registry:block",
|
|
158
|
+
"registryDependencies": ["button", "@acme/input", "acme/ui/card#v1.2.0"],
|
|
159
|
+
"files": [
|
|
160
|
+
{
|
|
161
|
+
"path": "blocks/login-form.tsx",
|
|
162
|
+
"type": "registry:block"
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Dependency rules:
|
|
169
|
+
|
|
170
|
+
- Bare names such as `"button"` mean official shadcn items.
|
|
171
|
+
- Bare names never mean same-registry or same-repository items.
|
|
172
|
+
- Namespaced dependencies use `@namespace/item-name`.
|
|
173
|
+
- GitHub dependencies use `owner/repo/item-name`.
|
|
174
|
+
- Pin GitHub dependencies with `owner/repo/item-name#ref` when needed.
|
|
175
|
+
- Refs are not inherited. If `owner/repo/foo#v2` depends on `bar` from the same
|
|
176
|
+
repo at `v2`, write `owner/repo/bar#v2`.
|
|
177
|
+
- Do not use relative dependencies such as `"./bar"`.
|
|
178
|
+
|
|
179
|
+
## Address Schemes
|
|
180
|
+
|
|
181
|
+
When reasoning about a registry item string, classify it first.
|
|
182
|
+
|
|
183
|
+
| Address | Scheme | Meaning |
|
|
184
|
+
| ----------------------------------- | --------- | ------------------------------------------------------------ |
|
|
185
|
+
| `button` | shadcn | Official shadcn item named `button`. |
|
|
186
|
+
| `@acme/button` | namespace | Item `button` from configured registry `@acme`. |
|
|
187
|
+
| `@acme/ui/button` | namespace | Item `ui/button` from configured registry `@acme`. |
|
|
188
|
+
| `https://example.com/r/button.json` | url | Built registry item JSON at that URL. |
|
|
189
|
+
| `./button.json` | file | Built registry item JSON on disk. |
|
|
190
|
+
| `acme/ui/button` | github | Item `button` from GitHub repo `acme/ui`. |
|
|
191
|
+
| `acme/ui/forms/login#main` | github | Item `forms/login` from GitHub repo `acme/ui` at ref `main`. |
|
|
192
|
+
|
|
193
|
+
For namespace and GitHub addresses, slashful item names are allowed and are item
|
|
194
|
+
names, not file paths. Addresses ending in `.json` keep file-address
|
|
195
|
+
precedence, so `acme/ui/data/schema.json` is treated as a file path, not a
|
|
196
|
+
GitHub item address.
|
|
197
|
+
|
|
198
|
+
## GitHub Registries
|
|
199
|
+
|
|
200
|
+
A public GitHub repository can act as a source registry when it has a root
|
|
201
|
+
`registry.json`.
|
|
202
|
+
|
|
203
|
+
```txt
|
|
204
|
+
owner/repo/item-name[#ref]
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Rules:
|
|
208
|
+
|
|
209
|
+
- The first two path segments are GitHub owner and repo.
|
|
210
|
+
- All remaining path segments are the registry item name.
|
|
211
|
+
- The source entrypoint is always root `registry.json`.
|
|
212
|
+
- GitHub registries are source registries consumed directly by the CLI. They do
|
|
213
|
+
not require `shadcn build` or generated item JSON files.
|
|
214
|
+
- `include` follows the same source-registry rules as local registries.
|
|
215
|
+
- Currently, GitHub addresses support public `github.com` repositories only.
|
|
216
|
+
- Private repos and GitHub Enterprise require explicit product decisions.
|
|
217
|
+
|
|
218
|
+
When implementing GitHub registry fetching, resolve refs to a commit SHA before
|
|
219
|
+
reading source files. Do not read moving refs directly from
|
|
220
|
+
`raw.githubusercontent.com`, because branch-like refs can be cached for several
|
|
221
|
+
minutes.
|
|
222
|
+
|
|
223
|
+
Preferred flow:
|
|
224
|
+
|
|
225
|
+
```txt
|
|
226
|
+
owner/repo[#ref]
|
|
227
|
+
-> resolve ref with git ls-remote
|
|
228
|
+
-> commit SHA
|
|
229
|
+
-> read https://raw.githubusercontent.com/{owner}/{repo}/{sha}/registry.json
|
|
230
|
+
-> read includes and item files from the same SHA
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
This keeps a command on one consistent repository snapshot.
|
|
234
|
+
|
|
235
|
+
Full 40-character commit SHAs are already stable and can be used directly.
|
|
236
|
+
Branches, tags, and short refs require Git so the CLI can resolve them to a
|
|
237
|
+
commit SHA first.
|
|
238
|
+
|
|
239
|
+
## Build and Verify
|
|
240
|
+
|
|
241
|
+
Use the CLI to build source registries:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
npx shadcn@latest build
|
|
245
|
+
npx shadcn@latest build registry.json --output public/r
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Use CLI commands to inspect the result:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
npx shadcn@latest list @acme
|
|
252
|
+
npx shadcn@latest search @acme -q "login"
|
|
253
|
+
npx shadcn@latest view @acme/login-form
|
|
254
|
+
npx shadcn@latest add @acme/login-form --dry-run
|
|
255
|
+
npx shadcn@latest registry validate ./registry.json
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Use GitHub addresses directly for public GitHub registries:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
npx shadcn@latest list owner/repo
|
|
262
|
+
npx shadcn@latest search owner/repo -q "login"
|
|
263
|
+
npx shadcn@latest view owner/repo/item
|
|
264
|
+
npx shadcn@latest add owner/repo/item --dry-run
|
|
265
|
+
npx shadcn@latest registry validate owner/repo
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
When working on registry implementation in the shadcn/ui codebase:
|
|
269
|
+
|
|
270
|
+
- Keep address parsing pure and testable.
|
|
271
|
+
- Do not add side effects to validators.
|
|
272
|
+
- Preserve existing behavior for official shadcn, namespace, URL, and file
|
|
273
|
+
schemes.
|
|
274
|
+
- Add tests for address parsing, source loading, dependency resolution, list,
|
|
275
|
+
search, view, and add paths.
|
|
276
|
+
- Prefer small source-reader abstractions over a plugin system until there are
|
|
277
|
+
multiple real providers.
|