shadcn-registries
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseshadcn Registries
shadcn 注册表
Agent Workflow (MANDATORY)
Agent 工作流程(强制要求)
Before registry configuration, use :
TeamCreate- fuse-ai-pilot:explore-codebase - Find existing components.json
- fuse-ai-pilot:research-expert - Verify latest CLI options via Context7
After: Run fuse-ai-pilot:sniper for validation.
在配置注册表之前,请使用:
TeamCreate- fuse-ai-pilot:explore-codebase - 查找现有的components.json文件
- fuse-ai-pilot:research-expert - 通过Context7验证最新的CLI选项
完成后:运行fuse-ai-pilot:sniper进行验证。
Overview
概述
| Registry | Primitives | Style |
|---|---|---|
| Radix UI | |
| Base UI | |
| Custom | Any | Custom |
| 注册表 | 基础组件 | 样式 |
|---|---|---|
| Radix UI | |
| Base UI | |
| 自定义 | 任意 | 自定义 |
Critical Rules
重要规则
- ALWAYS detect PM before any CLI command (use {runner})
- ALWAYS consult MCP before adding components
- NEVER mix registries in same project
- KEEP components.json in sync with actual primitive
- USE CLI for adding components, never manual copy
- 始终在执行任何CLI命令前检测包管理器(使用{runner})
- 始终在添加组件前咨询MCP
- 切勿在同一项目中混合使用不同注册表
- 保持components.json与实际基础组件同步
- 使用CLI添加组件,切勿手动复制
Architecture
项目结构
project/
├── components.json # shadcn/ui configuration
├── components/ui/ # Generated components
└── lib/utils.ts # Utility functions (cn)-> See registry-setup.md for complete setup
project/
├── components.json # shadcn/ui 配置文件
├── components/ui/ # 生成的组件
└── lib/utils.ts # 工具函数(cn)-> 完整设置请参见registry-setup.md
CLI Commands
CLI 命令
ALWAYS use detected package manager (run first).
= | | |
shadcn-detection{runner}bunxnpxpnpm dlxyarn dlxbash
undefined始终使用检测到的包管理器(先运行)。
= | | |
shadcn-detection{runner}bunxnpxpnpm dlxyarn dlxbash
undefinedInitialize
初始化
{runner} shadcn@latest init
{runner} shadcn@latest init --style new-york
{runner} shadcn@latest init
{runner} shadcn@latest init --style new-york
Add components (default registry = Radix)
添加组件(默认注册表 = Radix)
{runner} shadcn@latest add button dialog select
{runner} shadcn@latest add button dialog select
Add from Base UI registry
从Base UI注册表添加组件
{runner} shadcn@latest add --registry=basecn button dialog
undefined{runner} shadcn@latest add --registry=basecn button dialog
undefinedMCP (MANDATORY)
MCP(强制要求)
mcp__shadcn__search_items_in_registries -> find component
mcp__shadcn__get_add_command_for_items -> get exact CLI commandmcp__shadcn__search_items_in_registries -> 查找组件
mcp__shadcn__get_add_command_for_items -> 获取精确的CLI命令components.json Structure
components.json 结构
json
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"tailwind": { "config": "tailwind.config.ts", "css": "app/globals.css" },
"aliases": { "components": "@/components", "utils": "@/lib/utils" }
}-> See registry-config.md for full schema
json
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"tailwind": { "config": "tailwind.config.ts", "css": "app/globals.css" },
"aliases": { "components": "@/components", "utils": "@/lib/utils" }
}-> 完整Schema请参见registry-config.md
Reference Guide
参考指南
Concepts
概念
| Topic | Reference | When to Consult |
|---|---|---|
| Registry Config | registry-config.md | Setting up components.json |
| 主题 | 参考文档 | 查阅时机 |
|---|---|---|
| 注册表配置 | registry-config.md | 设置components.json时 |
Templates
模板
| Template | When to Use |
|---|---|
| registry-setup.md | Initial project setup |
| 模板 | 使用场景 |
|---|---|
| registry-setup.md | 项目初始设置时 |
Best Practices
最佳实践
DO
建议
- Use MCP to check registry before adding
- Keep components.json in sync with actual primitive
- Use CLI for adding, not manual copy
- 添加组件前使用MCP检查注册表
- 保持components.json与实际基础组件同步
- 使用CLI添加组件,而非手动复制
DON'T
禁忌
- Mix registries in same project
- Edit component internals without checking registry source
- Skip components.json configuration
- 在同一项目中混合使用不同注册表
- 未检查注册表源的情况下编辑组件内部代码
- 跳过components.json配置