shadcn 4.8.1 → 4.8.2
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Ma,oa,k,ka,qa}from'./chunk-4WZLO2DO.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 ka(process.cwd())} ${S} ${n}`}async function f(n=process.cwd()){return {registries:(await qa(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
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
3
|
|
|
4
4
|
${m}
|
|
@@ -34,7 +34,7 @@ Found ${n.length} example${n.length>1?"s":""} matching "${t}":
|
|
|
34
34
|
|
|
35
35
|
To fix this:
|
|
36
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
|
|
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 Ma(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 Ma(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 oa(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
38
|
|
|
39
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
40
|
|
|
@@ -42,7 +42,7 @@ Found ${n.length} example${n.length>1?"s":""} matching "${t}":
|
|
|
42
42
|
|
|
43
43
|
---
|
|
44
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
|
|
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 Ma(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
46
|
|
|
47
47
|
Try searching with patterns like:
|
|
48
48
|
- "accordion-demo" for accordion examples
|
|
@@ -51,7 +51,7 @@ Found ${n.length} example${n.length>1?"s":""} matching "${t}":
|
|
|
51
51
|
|
|
52
52
|
You can also:
|
|
53
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
|
|
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 oa(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
55
|
|
|
56
56
|
After adding or generating components, check the following common issues:
|
|
57
57
|
|
|
@@ -64,7 +64,7 @@ Found ${n.length} example${n.length>1?"s":""} matching "${t}":
|
|
|
64
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
65
|
${t.errors.map(i=>`- ${i.path.join(".")}: ${i.message}`).join(`
|
|
66
66
|
`)}
|
|
67
|
-
`}],isError:true};if(t instanceof
|
|
67
|
+
`}],isError:true};if(t instanceof k){let i=t.message;return t.suggestion&&(i+=`
|
|
68
68
|
|
|
69
69
|
\u{1F4A1} ${t.suggestion}`),t.context&&(i+=`
|
|
70
70
|
|