shadcn 0.0.0-beta.cecd1f2 → 0.0.0-beta.cf99147eb

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/README.md CHANGED
@@ -2,16 +2,34 @@
2
2
 
3
3
  A CLI for adding components to your project.
4
4
 
5
- ## Usage
5
+ ## create
6
+
7
+ Use the `create` command to create a new project. You will be taken to a website to build your custom design system and choose your framework.
8
+
9
+ ```bash
10
+ npx shadcn create
11
+ ```
12
+
13
+ ## init
6
14
 
7
15
  Use the `init` command to initialize dependencies for a new project.
8
16
 
9
- The `init` command installs dependencies, adds the `cn` util, configures `tailwind.config.js`, and CSS variables for the project.
17
+ The `init` command installs dependencies, adds the `cn` util, configures Tailwind CSS, and CSS variables for the project.
10
18
 
11
19
  ```bash
12
20
  npx shadcn init
13
21
  ```
14
22
 
23
+ ## apply
24
+
25
+ Use the `apply` command to apply a preset to an existing project.
26
+
27
+ The `apply` command overwrites the current preset configuration, reinstalls detected UI components, and updates fonts and CSS variables to match the new preset.
28
+
29
+ ```bash
30
+ npx shadcn apply --preset a2r6bw
31
+ ```
32
+
15
33
  ## add
16
34
 
17
35
  Use the `add` command to add components to your project.
@@ -40,4 +58,4 @@ Visit https://ui.shadcn.com/docs/cli to view the documentation.
40
58
 
41
59
  ## License
42
60
 
43
- Licensed under the [MIT license](https://github.com/shadcn/ui/blob/main/LICENSE.md).
61
+ Licensed under the [MIT license](https://github.com/shadcn-ui/ui/blob/main/LICENSE.md).
@@ -0,0 +1 @@
1
+ import {z as z$1}from'zod';var c=z$1.union([z$1.string().refine(e=>e.includes("{name}"),{message:"Registry URL must include {name} placeholder"}),z$1.object({url:z$1.string().refine(e=>e.includes("{name}"),{message:"Registry URL must include {name} placeholder"}),params:z$1.record(z$1.string(),z$1.string()).optional(),headers:z$1.record(z$1.string(),z$1.string()).optional()})]),l=z$1.record(z$1.string().refine(e=>e.startsWith("@"),{message:"Registry names must start with @ (e.g., @v0, @acme)"}),c),s=z$1.object({$schema:z$1.string().optional(),style:z$1.string(),rsc:z$1.coerce.boolean().default(false),tsx:z$1.coerce.boolean().default(true),tailwind:z$1.object({config:z$1.string().optional(),css:z$1.string(),baseColor:z$1.string(),cssVariables:z$1.boolean().default(true),prefix:z$1.string().default("").optional()}),iconLibrary:z$1.string().optional(),rtl:z$1.coerce.boolean().default(false).optional(),menuColor:z$1.enum(["default","inverted","default-translucent","inverted-translucent"]).default("default").optional(),menuAccent:z$1.enum(["subtle","bold"]).default("subtle").optional(),aliases:z$1.object({components:z$1.string(),utils:z$1.string(),ui:z$1.string().optional(),lib:z$1.string().optional(),hooks:z$1.string().optional()}),registries:l.optional()}).strict(),p=s.extend({resolvedPaths:z$1.object({cwd:z$1.string(),tailwindConfig:z$1.string(),tailwindCss:z$1.string(),utils:z$1.string(),components:z$1.string(),lib:z$1.string(),hooks:z$1.string(),ui:z$1.string()})}),j=z$1.record(p),o=z$1.enum(["registry:lib","registry:block","registry:component","registry:ui","registry:hook","registry:page","registry:file","registry:theme","registry:style","registry:item","registry:base","registry:font","registry:example","registry:internal"]),m=z$1.discriminatedUnion("type",[z$1.object({path:z$1.string(),content:z$1.string().optional(),type:z$1.enum(["registry:file","registry:page"]),target:z$1.string()}),z$1.object({path:z$1.string(),content:z$1.string().optional(),type:o.exclude(["registry:file","registry:page"]),target:z$1.string().optional()})]),y=z$1.object({config:z$1.object({content:z$1.array(z$1.string()).optional(),theme:z$1.record(z$1.string(),z$1.any()).optional(),plugins:z$1.array(z$1.string()).optional()}).optional()}),n=z$1.object({theme:z$1.record(z$1.string(),z$1.string()).optional(),light:z$1.record(z$1.string(),z$1.string()).optional(),dark:z$1.record(z$1.string(),z$1.string()).optional()}),a=z$1.lazy(()=>z$1.union([z$1.string(),z$1.array(z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.string())])),z$1.record(z$1.string(),a)])),d=z$1.record(z$1.string(),a),u=z$1.record(z$1.string(),z$1.string()),g=z$1.object({family:z$1.string(),provider:z$1.literal("google"),import:z$1.string(),variable:z$1.string(),weight:z$1.array(z$1.string()).optional(),subsets:z$1.array(z$1.string()).optional(),selector:z$1.string().optional(),dependency:z$1.string().optional()}),r=z$1.object({$schema:z$1.string().optional(),extends:z$1.string().optional(),name:z$1.string(),title:z$1.string().optional(),author:z$1.string().min(2).optional(),description:z$1.string().optional(),dependencies:z$1.array(z$1.string()).optional(),devDependencies:z$1.array(z$1.string()).optional(),registryDependencies:z$1.array(z$1.string()).optional(),files:z$1.array(m).optional(),tailwind:y.optional(),cssVars:n.optional(),css:d.optional(),envVars:u.optional(),meta:z$1.record(z$1.string(),z$1.any()).optional(),docs:z$1.string().optional(),categories:z$1.array(z$1.string()).optional()}),i=z$1.discriminatedUnion("type",[r.extend({type:z$1.literal("registry:base"),config:s.deepPartial().optional()}),r.extend({type:z$1.literal("registry:font"),font:g}),r.extend({type:o.exclude(["registry:base","registry:font"])})]),f=z$1.object({$schema:z$1.string().optional(),name:z$1.string().optional(),homepage:z$1.string().optional(),include:z$1.array(z$1.string()).optional(),items:z$1.array(i).optional()}).refine(e=>e.items!==void 0||e.include!==void 0,{message:"Registry must define at least one of `items` or `include`.",path:["items"]}),h=f.transform(e=>({...e,items:e.items??[]})),I=h.pipe(z$1.object({$schema:z$1.string().optional(),name:z$1.string(),homepage:z$1.string(),include:z$1.array(z$1.string()).optional(),items:z$1.array(i)})),C=z$1.array(i),R=z$1.array(z$1.object({name:z$1.string(),label:z$1.string()})),v=z$1.record(z$1.string(),z$1.record(z$1.string(),z$1.string())),V=z$1.object({inlineColors:z$1.object({light:z$1.record(z$1.string(),z$1.string()),dark:z$1.record(z$1.string(),z$1.string())}),cssVars:n,cssVarsV4:n.optional(),inlineColorsTemplate:z$1.string(),cssVarsTemplate:z$1.string()}),w=r.pick({dependencies:true,devDependencies:true,files:true,tailwind:true,cssVars:true,css:true,envVars:true,docs:true}).extend({fonts:z$1.array(r.extend({type:z$1.literal("registry:font"),font:g})).optional()}),b=z$1.object({name:z$1.string(),type:z$1.string().optional(),description:z$1.string().optional(),registry:z$1.string(),addCommandArgument:z$1.string()}),k=z$1.object({pagination:z$1.object({total:z$1.number(),offset:z$1.number(),limit:z$1.number(),hasMore:z$1.boolean()}),items:z$1.array(b)}),z=z$1.record(z$1.string().regex(/^@[a-zA-Z0-9][a-zA-Z0-9-_]*$/),z$1.string()),T=z$1.array(z$1.object({name:z$1.string(),homepage:z$1.string().optional(),url:z$1.string(),description:z$1.string().optional()})),x=z$1.object({name:z$1.string(),title:z$1.string(),description:z$1.string(),base:z$1.string(),style:z$1.string(),baseColor:z$1.string(),theme:z$1.string(),iconLibrary:z$1.string(),font:z$1.string(),rtl:z$1.coerce.boolean().default(false),menuAccent:z$1.enum(["subtle","bold"]),menuColor:z$1.enum(["default","inverted","default-translucent","inverted-translucent"]),radius:z$1.string()}),A=z$1.object({presets:z$1.array(x)});export{A,c as a,l as b,s as c,p as d,j as e,o as f,m as g,y as h,n as i,d as j,u as k,g as l,r as m,i as n,h as o,I as p,C as q,R as r,v as s,V as t,w as u,b as v,k as w,z as x,T as y,x as z};
@@ -0,0 +1,71 @@
1
+ import {La,na,j as j$1,ja,pa}from'./chunk-KUBLEZR4.js';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {ListToolsRequestSchema,CallToolRequestSchema}from'@modelcontextprotocol/sdk/types.js';import a from'dedent';import {z}from'zod';import {zodToJsonSchema}from'zod-to-json-schema';var S="shadcn@latest";async function p(n){return `${await ja(process.cwd())} ${S} ${n}`}async function f(n=process.cwd()){return {registries:(await pa(n,{useCache:false})).registries}}function y(n,t){let{query:r,registries:i}=t||{},s=n.items.map(c=>{let u=[`- ${c.name}`];return c.type&&u.push(`(${c.type})`),c.description&&u.push(`- ${c.description}`),c.registry&&u.push(`[${c.registry}]`),u.push(`
2
+ Add command: \`${p(`add ${c.addCommandArgument}`)}\``),u.join(" ")}),o=`Found ${n.pagination.total} items`;r&&(o+=` matching "${r}"`),i&&i.length>0&&(o+=` in registries ${i.join(", ")}`),o+=":";let m=`Showing items ${n.pagination.offset+1}-${Math.min(n.pagination.offset+n.pagination.limit,n.pagination.total)} of ${n.pagination.total}:`,d=`${o}
3
+
4
+ ${m}
5
+
6
+ ${s.join(`
7
+
8
+ `)}`;return n.pagination.hasMore&&(d+=`
9
+
10
+ More items available. Use offset: ${n.pagination.offset+n.pagination.limit} to see the next page.`),d}function $(n){return n.map(t=>[`## ${t.name}`,t.description?`
11
+ ${t.description}
12
+ `:"",t.type?`**Type:** ${t.type}`:"",t.files&&t.files.length>0?`**Files:** ${t.files.length} file(s)`:"",t.dependencies&&t.dependencies.length>0?`**Dependencies:** ${t.dependencies.join(", ")}`:"",t.devDependencies&&t.devDependencies.length>0?`**Dev Dependencies:** ${t.devDependencies.join(", ")}`:""].filter(Boolean).join(`
13
+ `))}function b(n,t){let r=n.map(s=>{let o=[`## Example: ${s.name}`,s.description?`
14
+ ${s.description}
15
+ `:""];return s.files?.length&&s.files.forEach(m=>{m.content&&(o.push(`### Code (${m.path}):
16
+ `),o.push("```tsx"),o.push(m.content),o.push("```"));}),o.filter(Boolean).join(`
17
+ `)});return `# Usage Examples
18
+
19
+ Found ${n.length} example${n.length>1?"s":""} matching "${t}":
20
+ `+r.join(`
21
+
22
+ ---
23
+
24
+ `)}var j=new Server({name:"shadcn",version:"1.0.0"},{capabilities:{resources:{},tools:{}}});j.setRequestHandler(ListToolsRequestSchema,async()=>({tools:[{name:"get_project_registries",description:"Get configured registry names from components.json - Returns error if no components.json exists (use init_project to create one)",inputSchema:zodToJsonSchema(z.object({}))},{name:"list_items_in_registries",description:"List items from registries (requires components.json - use init_project if missing)",inputSchema:zodToJsonSchema(z.object({registries:z.array(z.string()).describe("Array of registry names to search (e.g., ['@shadcn', '@acme'])"),limit:z.number().optional().describe("Maximum number of items to return"),offset:z.number().optional().describe("Number of items to skip for pagination")}))},{name:"search_items_in_registries",description:"Search for components in registries using fuzzy matching (requires components.json). After finding an item, use get_item_examples_from_registries to see usage examples.",inputSchema:zodToJsonSchema(z.object({registries:z.array(z.string()).describe("Array of registry names to search (e.g., ['@shadcn', '@acme'])"),query:z.string().describe("Search query string for fuzzy matching against item names and descriptions"),limit:z.number().optional().describe("Maximum number of items to return"),offset:z.number().optional().describe("Number of items to skip for pagination")}))},{name:"view_items_in_registries",description:"View detailed information about specific registry items including the name, description, type and files content. For usage examples, use get_item_examples_from_registries instead.",inputSchema:zodToJsonSchema(z.object({items:z.array(z.string()).describe("Array of item names with registry prefix (e.g., ['@shadcn/button', '@shadcn/card'])")}))},{name:"get_item_examples_from_registries",description:"Find usage examples and demos with their complete code. Search for patterns like 'accordion-demo', 'button example', 'card-demo', etc. Returns full implementation code with dependencies.",inputSchema:zodToJsonSchema(z.object({registries:z.array(z.string()).describe("Array of registry names to search (e.g., ['@shadcn', '@acme'])"),query:z.string().describe("Search query for examples (e.g., 'accordion-demo', 'button demo', 'card example', 'tooltip-demo', 'example-booking-form', 'example-hero'). Common patterns: '{item-name}-demo', '{item-name} example', 'example {item-name}'")}))},{name:"get_add_command_for_items",description:"Get the shadcn CLI add command for specific items in a registry. This is useful for adding one or more components to your project.",inputSchema:zodToJsonSchema(z.object({items:z.array(z.string()).describe("Array of items to get the add command for prefixed with the registry name (e.g., ['@shadcn/button', '@shadcn/card'])")}))},{name:"get_audit_checklist",description:"After creating new components or generating new code files, use this tool for a quick checklist to verify that everything is working as expected. Make sure to run the tool after all required steps have been completed.",inputSchema:zodToJsonSchema(z.object({}))}]}));j.setRequestHandler(CallToolRequestSchema,async n=>{try{if(!n.params.arguments)throw new Error("No tool arguments provided.");switch(n.params.name){case "get_project_registries":{let t=await f(process.cwd());return t?.registries?{content:[{type:"text",text:a`The following registries are configured in the current project:
25
+
26
+ ${Object.keys(t.registries).map(r=>`- ${r}`).join(`
27
+ `)}
28
+
29
+ You can view the items in a registry by running:
30
+ \`${await p("view @name-of-registry")}\`
31
+
32
+ For example: \`${await p("view @shadcn")}\` or \`${await p("view @shadcn @acme")}\` to view multiple registries.
33
+ `}]}:{content:[{type:"text",text:a`No components.json found or no registries configured.
34
+
35
+ To fix this:
36
+ 1. Use the \`init\` command to create a components.json file
37
+ 2. Or manually create components.json with a registries section`}]}}case "search_items_in_registries":{let r=z.object({registries:z.array(z.string()),query:z.string(),limit:z.number().optional(),offset:z.number().optional()}).parse(n.params.arguments),i=await La(r.registries,{query:r.query,limit:r.limit,offset:r.offset,config:await f(process.cwd()),useCache:!1});return i.items.length===0?{content:[{type:"text",text:a`No items found matching "${r.query}" in registries ${r.registries.join(", ")}, Try searching with a different query or registry.`}]}:{content:[{type:"text",text:y(i,{query:r.query,registries:r.registries})}]}}case "list_items_in_registries":{let r=z.object({registries:z.array(z.string()),limit:z.number().optional(),offset:z.number().optional(),cwd:z.string().optional()}).parse(n.params.arguments),i=await La(r.registries,{limit:r.limit,offset:r.offset,config:await f(process.cwd()),useCache:!1});return i.items.length===0?{content:[{type:"text",text:a`No items found in registries ${r.registries.join(", ")}.`}]}:{content:[{type:"text",text:y(i,{registries:r.registries})}]}}case "view_items_in_registries":{let r=z.object({items:z.array(z.string())}).parse(n.params.arguments),i=await na(r.items,{config:await f(process.cwd()),useCache:!1});if(i?.length===0)return {content:[{type:"text",text:a`No items found for: ${r.items.join(", ")}
38
+
39
+ Make sure the item names are correct and include the registry prefix (e.g., @shadcn/button).`}]};let s=$(i);return {content:[{type:"text",text:a`Item Details:
40
+
41
+ ${s.join(`
42
+
43
+ ---
44
+
45
+ `)}`}]}}case "get_item_examples_from_registries":{let r=z.object({query:z.string(),registries:z.array(z.string())}).parse(n.params.arguments),i=await f(),s=await La(r.registries,{query:r.query,config:i,useCache:!1});if(s.items.length===0)return {content:[{type:"text",text:a`No examples found for query "${r.query}".
46
+
47
+ Try searching with patterns like:
48
+ - "accordion-demo" for accordion examples
49
+ - "button demo" or "button example"
50
+ - Component name followed by "-demo" or "example"
51
+
52
+ You can also:
53
+ 1. Use search_items_in_registries to find all items matching your query
54
+ 2. View the main component with view_items_in_registries for inline usage documentation`}]};let o=s.items.map(d=>d.addCommandArgument),m=await na(o,{config:i,useCache:!1});return {content:[{type:"text",text:b(m,r.query)}]}}case "get_add_command_for_items":{let t=z.object({items:z.array(z.string())}).parse(n.params.arguments);return {content:[{type:"text",text:await p(`add ${t.items.join(" ")}`)}]}}case "get_audit_checklist":return {content:[{type:"text",text:a`## Component Audit Checklist
55
+
56
+ After adding or generating components, check the following common issues:
57
+
58
+ - [ ] Ensure imports are correct i.e named vs default imports
59
+ - [ ] If using next/image, ensure images.remotePatterns next.config.js is configured correctly.
60
+ - [ ] Ensure all dependencies are installed.
61
+ - [ ] Check for linting errors or warnings
62
+ - [ ] Check for TypeScript errors
63
+ - [ ] Use the Playwright MCP if available.
64
+ `}]};default:throw new Error(`Tool ${n.params.name} not found`)}}catch(t){if(t instanceof z.ZodError)return {content:[{type:"text",text:a`Invalid input parameters:
65
+ ${t.errors.map(i=>`- ${i.path.join(".")}: ${i.message}`).join(`
66
+ `)}
67
+ `}],isError:true};if(t instanceof j$1){let i=t.message;return t.suggestion&&(i+=`
68
+
69
+ \u{1F4A1} ${t.suggestion}`),t.context&&(i+=`
70
+
71
+ Context: ${JSON.stringify(t.context,null,2)}`),{content:[{type:"text",text:a`Error (${t.code}): ${i}`}],isError:true}}let r=t instanceof Error?t.message:String(t);return {content:[{type:"text",text:a`Error: ${r}`}],isError:true}}});export{j as a};
@@ -0,0 +1,2 @@
1
+ var e={lucide:{name:"lucide",title:"Lucide",packages:["lucide-react"],import:"import { ICON } from 'lucide-react'",usage:"<ICON />",export:"lucide-react"},tabler:{name:"tabler",title:"Tabler Icons",packages:["@tabler/icons-react"],import:"import { ICON } from '@tabler/icons-react'",usage:"<ICON />",export:"@tabler/icons-react"},hugeicons:{name:"hugeicons",title:"HugeIcons",packages:["@hugeicons/react","@hugeicons/core-free-icons"],import:`import { HugeiconsIcon } from '@hugeicons/react'
2
+ import { ICON } from '@hugeicons/core-free-icons';`,usage:"<HugeiconsIcon icon={ICON} strokeWidth={2} />",export:"@hugeicons/core-free-icons"},phosphor:{name:"phosphor",title:"Phosphor Icons",packages:["@phosphor-icons/react"],import:"import { ICON } from '@phosphor-icons/react'",usage:"<ICON strokeWidth={2} />",export:"@phosphor-icons/react"},remixicon:{name:"remixicon",title:"Remix Icon",packages:["@remixicon/react"],import:"import { ICON } from '@remixicon/react'",usage:"<ICON />",export:"@remixicon/react"}};export{e as a};