@create-ui/cli 0.5.1 → 0.5.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.
- package/README.md +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/skills/createui/SKILL.md +1 -1
- package/dist/skills/createui/contributing.md +1 -1
- package/dist/skills/createui/customization.md +4 -4
- package/dist/skills/createui/evals/evals.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**Design faster. Build cleaner. Scale with one design system.**
|
|
6
6
|
|
|
7
|
-
A modern design code system
|
|
7
|
+
A modern design code system built on React 19, Tailwind CSS v4, and Radix UI. Components are copied into your project, so you own every line. One unified system, many themes.
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/@create-ui/cli)
|
|
10
10
|
[](https://www.npmjs.com/package/@create-ui/cli)
|
package/dist/index.js
CHANGED
|
@@ -89,5 +89,5 @@ args = ["${se}", "mcp"]`),o.break(),o.info("3. Restart Codex to load the MCP ser
|
|
|
89
89
|
`).map(R=>{if(R.trim().startsWith("import "))return R;let S=R;return S=S.replace(/\b(asChild\s*\?\s*)Slot(\s*:)/g,"$1__SLOT_PLACEHOLDER__$2"),S=S.replace(/\bReact\.ComponentProps<typeof\s+Slot>/g,"React.ComponentProps<typeof __SLOT_PLACEHOLDER__>"),S=S.replace(/\bComponentProps<typeof\s+Slot>/g,"ComponentProps<typeof __SLOT_PLACEHOLDER__>"),S=S.replace(/(<\/?)Slot(\s*\/?>)/g,"$1__SLOT_PLACEHOLDER__$2"),S=S.replace(/\bSlot\b/g,(H,F,W)=>{let ge=W.substring(0,F),Ue=(ge.match(/"/g)||[]).length,cn=(ge.match(/'/g)||[]).length;return Ue%2!==0||cn%2!==0?H:"__SLOT_PLACEHOLDER__"}),S=S.replace(/__SLOT_PLACEHOLDER__/g,"SlotPrimitive.Slot"),S}).join(`
|
|
90
90
|
`));let h=Array.from(new Set(i));return {content:c,replacedPackages:h}}async function Ur(e){let t={};if(!x.existsSync(e.cwd)||!x.existsSync(E__default.resolve(e.cwd,"package.json")))return t["1"]=true,{errors:t,config:null};if(!x.existsSync(E__default.resolve(e.cwd,"components.json")))return t["3"]=true,{errors:t,config:null};try{let r=await f(e.cwd);return {errors:t,config:r}}catch{o.break(),o.error(`An invalid ${a$1.info("components.json")} file was found at ${a$1.info(e.cwd)}.
|
|
91
91
|
Before you can run a migration, you must create a valid ${a$1.info("components.json")} file by running the ${a$1.info("init")} command.`),o.error(`Learn more at ${a$1.info("https://createui.co/docs/components-json")}.`),o.break(),process.exit(1);}}var Br=[{name:"icons",description:"migrate your ui components to a different icon library."},{name:"radix",description:"migrate to radix-ui."}],to=z.object({cwd:z.string(),list:z.boolean(),yes:z.boolean(),migration:z.string().refine(e=>e&&Br.some(t=>t.name===e),{message:"You must specify a valid migration. Run `createui migrate --list` to see available migrations."}).optional()}),Gr=new Command().name("migrate").description("run a migration.").argument("[migration]","the migration to run.").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-l, --list","list all migrations.",false).option("-y, --yes","skip confirmation prompt.",false).action(async(e,t)=>{try{let r=to.parse({cwd:E__default.resolve(t.cwd),migration:e,list:t.list,yes:t.yes});if(r.list||!r.migration){o.info("Available migrations:");for(let o$1 of Br)o.info(`- ${o$1.name}: ${o$1.description}`);return}if(!r.migration)throw new Error("You must specify a migration. Run `createui migrate --list` to see available migrations.");let{errors:n,config:i}=await Ur(r);if(n["1"]||n["3"])throw new Error("No `components.json` file found. Ensure you are at the root of your project.");if(!i)throw new Error("Something went wrong reading your `components.json` file. Please ensure you have a valid `components.json` file.");r.migration==="icons"&&await Mr(i),r.migration==="radix"&&await Wr(i,{yes:r.yes});}catch(r){o.break(),Q(r);}});async function Jr(e){let t={},r={cwd:e.cwd,registryFile:E__default.resolve(e.cwd,e.registryFile),outputDir:E__default.resolve(e.cwd,e.outputDir)};if(!x.existsSync(r.registryFile))return t["13"]=true,{errors:t,resolvePaths:null,config:null};if(!x.existsSync(E__default.resolve(e.cwd,"components.json")))return t["3"]=true,{errors:t,resolvePaths:null,config:null};await x.mkdir(r.outputDir,{recursive:true});try{let n=await f(e.cwd);return {errors:t,config:n,resolvePaths:r}}catch{o.break(),o.error(`An invalid ${a$1.info("components.json")} file was found at ${a$1.info(e.cwd)}.
|
|
92
|
-
Before you can build the registry, you must create a valid ${a$1.info("components.json")} file by running the ${a$1.info("init")} command.`),o.break(),process.exit(1);}}var no=z.object({cwd:z.string(),registryFile:z.string(),outputDir:z.string(),verbose:z.boolean().optional().default(false)}),Kr=new Command().name("registry:build").description("builds the registry [EXPERIMENTAL]").argument("[registry]","path to registry.json file","./registry.json").option("-o, --output <path>","destination directory for json files","./public/r").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-v, --verbose","verbose output").action(async(e,t)=>{await io({cwd:E.resolve(t.cwd),registryFile:e,outputDir:t.output,verbose:t.verbose});});async function io(e){try{let t=no.parse(e),[{errors:r,resolvePaths:n,config:i},o$2]=await Promise.all([Jr(t),m(t.cwd)]);(r["3"]||!i||!o$2)&&(o.error(`A ${a$1.info("components.json")} file is required to build the registry. Run ${a$1.info("createui init")} to create one.`),o.break(),process.exit(1)),(r["13"]||!n)&&(o.error(`We could not find a registry file at ${a$1.info(E.resolve(t.cwd,t.registryFile))}.`),o.break(),process.exit(1));let s=await J.readFile(n.registryFile,"utf-8"),c=o$1.safeParse(JSON.parse(s));c.success||(o.error(`Invalid registry file found at ${a$1.info(n.registryFile)}.`),o.break(),process.exit(1));let a=p("Building registry..."),l=await oo(c.data,i,o$2);for(let m of l.items)m.files=m.files?.filter((p,u,h)=>u===h.findIndex(g=>g.path===p.path)),m.dependencies&&(m.dependencies=m.dependencies.filter((p,u,h)=>u===h.findIndex(g=>g===p)));for(let m of l.items){if(!m.files)continue;a.start(`Building ${m.name}...`),m.$schema="https://createui.co/schema/registry-item.json";for(let u of m.files){let h=E.resolve(n.cwd,u.path);try{if(!(await J.stat(h)).isFile())continue;u.content=await J.readFile(h,"utf-8");}catch(g){console.error("Error reading file in registry build:",h,g);continue}}let p=n$1.safeParse(m);if(!p.success){o.error(`Invalid registry item found for ${a$1.info(m.name)}.`);continue}await J.writeFile(E.resolve(n.outputDir,`${p.data.name}.json`),JSON.stringify(p.data,null,2));}if(await J.copyFile(n.registryFile,E.resolve(n.outputDir,"registry.json")),a.succeed("Building registry."),t.verbose){p(`The registry has ${a$1.info(l.items.length.toString())} items:`).succeed();for(let m of l.items){o.log(` - ${m.name} (${a$1.info(m.type)})`);for(let p of m.files??[])o.log(` - ${p.path}`);}}}catch(t){o.break(),Q(t);}}async function oo(e,t,r){for(let n of e.items)if(n.files?.length)for(let i of n.files){let o=await D(i.path,t,r);o.files=o.files?.filter(s=>s.path!==i.path),o.files&&n.files.push(...o.files),o.dependencies&&(n.dependencies=n.dependencies?n.dependencies.concat(o.dependencies):o.dependencies);}return e}var Yr=new Command().name("registry:mcp").description("starts the registry MCP server [DEPRECATED]").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).action(async()=>{o.warn(`The ${a$1.info("createui registry:mcp")} command is deprecated. Use the ${a$1.info("createui mcp")} command instead.`),o.break();});var co=z.object({cwd:z.string(),query:z.string().optional(),limit:z.number().optional(),offset:z.number().optional()}),Xr=new Command().name("search").alias("list").description("search items from registries").argument("<registries...>","the registry names or urls to search items from. Names must be prefixed with @.").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-q, --query <query>","query string").option("-l, --limit <number>","maximum number of items to display per registry","100").option("-o, --offset <number>","number of items to skip","0").action(async(e,t)=>{try{let r=co.parse({cwd:E__default.resolve(t.cwd),query:t.query,limit:t.limit?parseInt(t.limit,10):void 0,offset:t.offset?parseInt(t.offset,10):void 0});await L(r.cwd);let n=k({resolvedPaths:{cwd:r.cwd}}),i=G(n),o=E__default.resolve(r.cwd,"components.json");if(x.existsSync(o)){let a$1=await x.readJson(o),l=a.partial().parse(a$1);i=G({...n,...l});}let s=i;try{let a=await f(r.cwd);a&&(s=G(a));}catch{}let c=await a$3(e,{query:r.query,limit:r.limit,offset:r.offset,config:s});console.log(JSON.stringify(c,null,2)),process.exit(0);}catch(r){Q(r);}});var en="createui",Pt={claude:{label:"Claude Code",dir:E__default.join(".claude","skills")},gemini:{label:"Gemini CLI",dir:E__default.join(".gemini","skills")},codex:{label:"OpenAI Codex",dir:E__default.join(".agents","skills")},agents:{label:"Agent Skills standard (.agents/skills)",dir:E__default.join(".agents","skills")}},uo=z.object({cwd:z.string(),client:z.enum(["claude","gemini","codex","agents"]),project:z.boolean(),path:z.string().optional(),force:z.boolean(),yes:z.boolean()});function go(){let e=E__default.dirname(fileURLToPath(import.meta.url));return E__default.join(e,"skills",en)}var tn=new Command().name("skill").description("install the Create UI agent skill for your AI coding agent").option("--client <client>",`the agent to install for (${Object.keys(Pt).join(", ")}).`,"claude").option("--project","install into the project instead of your home directory.",false).option("-p, --path <path>","install into an explicit skills directory (for other agents).").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-f, --force","overwrite an existing skill installation.",false).option("-y, --yes","skip the overwrite confirmation prompt.",false).action(async e=>{try{let t=uo.parse({...e}),r=E__default.resolve(t.cwd),n=go();existsSync(n)||(o.error(`Could not find the bundled Create UI skill at ${a$1.info(n)}.`),o.error("Please update createui to the latest version and try again."),process.exit(1));let i,o$1;if(t.path)i=E__default.resolve(r,t.path),o$1="custom path";else {let a=Pt[t.client],l=t.project?r:ot.homedir();i=E__default.join(l,a.dir),o$1=`${a.label}, ${t.project?"project":"personal"}`;}let s=E__default.join(i,en);if(existsSync(s)&&!t.force&&!t.yes){let{overwrite:a}=await Le({type:"confirm",name:"overwrite",message:`The Create UI skill already exists at ${a$1.info(s)}. Overwrite?`,initial:!1});a||(o.info("Skill installation cancelled."),process.exit(0));}let c=p(`Installing the Create UI skill (${o$1})...`).start();await x.ensureDir(i),await x.copy(n,s,{overwrite:!0,filter:a=>!a.endsWith(".DS_Store")}),c.succeed(`Installed the Create UI skill (${o$1}).`),o.break(),o.success(`Skill installed at ${a$1.info(s)}`),o.break(),t.path?(o.log("Point your AI agent at this folder (or import it from your agent's"),o.log(`rules file, e.g. ${a$1.info("AGENTS.md")} or ${a$1.info(".cursor/rules")}). Then try asking:`)):o.log(`${Pt[t.client].label} loads it automatically \u2014 no restart needed. Try asking:`),o.log(` ${a$1.info('"Add a Create UI login form"')}`),!t.path&&!t.project&&(o.break(),o.log(`Tip: run ${a$1.info(`createui skill --client ${t.client} --project`)} inside a repo to commit the skill for your whole team.`)),o.break();}catch(t){Q(t);}});var wo=z.object({cwd:z.string()}),sn=new Command().name("view").description("view items from the registry").argument("<items...>","the item names or URLs to view").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).action(async(e,t)=>{try{let r=wo.parse({cwd:E__default.resolve(t.cwd)});await L(r.cwd);let n=G({}),i=E__default.resolve(r.cwd,"components.json");if(x.existsSync(i)){let c=await x.readJson(i),a$1=a.partial().parse(c);n=G(a$1);}let o=n;try{let c=await f(r.cwd);c&&(o=G(c));}catch{}let s=await S(e,{config:o});console.log(JSON.stringify(s,null,2)),process.exit(0);}catch(r){Q(r);}});var an={version:"0.5.
|
|
92
|
+
Before you can build the registry, you must create a valid ${a$1.info("components.json")} file by running the ${a$1.info("init")} command.`),o.break(),process.exit(1);}}var no=z.object({cwd:z.string(),registryFile:z.string(),outputDir:z.string(),verbose:z.boolean().optional().default(false)}),Kr=new Command().name("registry:build").description("builds the registry [EXPERIMENTAL]").argument("[registry]","path to registry.json file","./registry.json").option("-o, --output <path>","destination directory for json files","./public/r").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-v, --verbose","verbose output").action(async(e,t)=>{await io({cwd:E.resolve(t.cwd),registryFile:e,outputDir:t.output,verbose:t.verbose});});async function io(e){try{let t=no.parse(e),[{errors:r,resolvePaths:n,config:i},o$2]=await Promise.all([Jr(t),m(t.cwd)]);(r["3"]||!i||!o$2)&&(o.error(`A ${a$1.info("components.json")} file is required to build the registry. Run ${a$1.info("createui init")} to create one.`),o.break(),process.exit(1)),(r["13"]||!n)&&(o.error(`We could not find a registry file at ${a$1.info(E.resolve(t.cwd,t.registryFile))}.`),o.break(),process.exit(1));let s=await J.readFile(n.registryFile,"utf-8"),c=o$1.safeParse(JSON.parse(s));c.success||(o.error(`Invalid registry file found at ${a$1.info(n.registryFile)}.`),o.break(),process.exit(1));let a=p("Building registry..."),l=await oo(c.data,i,o$2);for(let m of l.items)m.files=m.files?.filter((p,u,h)=>u===h.findIndex(g=>g.path===p.path)),m.dependencies&&(m.dependencies=m.dependencies.filter((p,u,h)=>u===h.findIndex(g=>g===p)));for(let m of l.items){if(!m.files)continue;a.start(`Building ${m.name}...`),m.$schema="https://createui.co/schema/registry-item.json";for(let u of m.files){let h=E.resolve(n.cwd,u.path);try{if(!(await J.stat(h)).isFile())continue;u.content=await J.readFile(h,"utf-8");}catch(g){console.error("Error reading file in registry build:",h,g);continue}}let p=n$1.safeParse(m);if(!p.success){o.error(`Invalid registry item found for ${a$1.info(m.name)}.`);continue}await J.writeFile(E.resolve(n.outputDir,`${p.data.name}.json`),JSON.stringify(p.data,null,2));}if(await J.copyFile(n.registryFile,E.resolve(n.outputDir,"registry.json")),a.succeed("Building registry."),t.verbose){p(`The registry has ${a$1.info(l.items.length.toString())} items:`).succeed();for(let m of l.items){o.log(` - ${m.name} (${a$1.info(m.type)})`);for(let p of m.files??[])o.log(` - ${p.path}`);}}}catch(t){o.break(),Q(t);}}async function oo(e,t,r){for(let n of e.items)if(n.files?.length)for(let i of n.files){let o=await D(i.path,t,r);o.files=o.files?.filter(s=>s.path!==i.path),o.files&&n.files.push(...o.files),o.dependencies&&(n.dependencies=n.dependencies?n.dependencies.concat(o.dependencies):o.dependencies);}return e}var Yr=new Command().name("registry:mcp").description("starts the registry MCP server [DEPRECATED]").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).action(async()=>{o.warn(`The ${a$1.info("createui registry:mcp")} command is deprecated. Use the ${a$1.info("createui mcp")} command instead.`),o.break();});var co=z.object({cwd:z.string(),query:z.string().optional(),limit:z.number().optional(),offset:z.number().optional()}),Xr=new Command().name("search").alias("list").description("search items from registries").argument("<registries...>","the registry names or urls to search items from. Names must be prefixed with @.").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-q, --query <query>","query string").option("-l, --limit <number>","maximum number of items to display per registry","100").option("-o, --offset <number>","number of items to skip","0").action(async(e,t)=>{try{let r=co.parse({cwd:E__default.resolve(t.cwd),query:t.query,limit:t.limit?parseInt(t.limit,10):void 0,offset:t.offset?parseInt(t.offset,10):void 0});await L(r.cwd);let n=k({resolvedPaths:{cwd:r.cwd}}),i=G(n),o=E__default.resolve(r.cwd,"components.json");if(x.existsSync(o)){let a$1=await x.readJson(o),l=a.partial().parse(a$1);i=G({...n,...l});}let s=i;try{let a=await f(r.cwd);a&&(s=G(a));}catch{}let c=await a$3(e,{query:r.query,limit:r.limit,offset:r.offset,config:s});console.log(JSON.stringify(c,null,2)),process.exit(0);}catch(r){Q(r);}});var en="createui",Pt={claude:{label:"Claude Code",dir:E__default.join(".claude","skills")},gemini:{label:"Gemini CLI",dir:E__default.join(".gemini","skills")},codex:{label:"OpenAI Codex",dir:E__default.join(".agents","skills")},agents:{label:"Agent Skills standard (.agents/skills)",dir:E__default.join(".agents","skills")}},uo=z.object({cwd:z.string(),client:z.enum(["claude","gemini","codex","agents"]),project:z.boolean(),path:z.string().optional(),force:z.boolean(),yes:z.boolean()});function go(){let e=E__default.dirname(fileURLToPath(import.meta.url));return E__default.join(e,"skills",en)}var tn=new Command().name("skill").description("install the Create UI agent skill for your AI coding agent").option("--client <client>",`the agent to install for (${Object.keys(Pt).join(", ")}).`,"claude").option("--project","install into the project instead of your home directory.",false).option("-p, --path <path>","install into an explicit skills directory (for other agents).").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-f, --force","overwrite an existing skill installation.",false).option("-y, --yes","skip the overwrite confirmation prompt.",false).action(async e=>{try{let t=uo.parse({...e}),r=E__default.resolve(t.cwd),n=go();existsSync(n)||(o.error(`Could not find the bundled Create UI skill at ${a$1.info(n)}.`),o.error("Please update createui to the latest version and try again."),process.exit(1));let i,o$1;if(t.path)i=E__default.resolve(r,t.path),o$1="custom path";else {let a=Pt[t.client],l=t.project?r:ot.homedir();i=E__default.join(l,a.dir),o$1=`${a.label}, ${t.project?"project":"personal"}`;}let s=E__default.join(i,en);if(existsSync(s)&&!t.force&&!t.yes){let{overwrite:a}=await Le({type:"confirm",name:"overwrite",message:`The Create UI skill already exists at ${a$1.info(s)}. Overwrite?`,initial:!1});a||(o.info("Skill installation cancelled."),process.exit(0));}let c=p(`Installing the Create UI skill (${o$1})...`).start();await x.ensureDir(i),await x.copy(n,s,{overwrite:!0,filter:a=>!a.endsWith(".DS_Store")}),c.succeed(`Installed the Create UI skill (${o$1}).`),o.break(),o.success(`Skill installed at ${a$1.info(s)}`),o.break(),t.path?(o.log("Point your AI agent at this folder (or import it from your agent's"),o.log(`rules file, e.g. ${a$1.info("AGENTS.md")} or ${a$1.info(".cursor/rules")}). Then try asking:`)):o.log(`${Pt[t.client].label} loads it automatically \u2014 no restart needed. Try asking:`),o.log(` ${a$1.info('"Add a Create UI login form"')}`),!t.path&&!t.project&&(o.break(),o.log(`Tip: run ${a$1.info(`createui skill --client ${t.client} --project`)} inside a repo to commit the skill for your whole team.`)),o.break();}catch(t){Q(t);}});var wo=z.object({cwd:z.string()}),sn=new Command().name("view").description("view items from the registry").argument("<items...>","the item names or URLs to view").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).action(async(e,t)=>{try{let r=wo.parse({cwd:E__default.resolve(t.cwd)});await L(r.cwd);let n=G({}),i=E__default.resolve(r.cwd,"components.json");if(x.existsSync(i)){let c=await x.readJson(i),a$1=a.partial().parse(c);n=G(a$1);}let o=n;try{let c=await f(r.cwd);c&&(o=G(c));}catch{}let s=await S(e,{config:o});console.log(JSON.stringify(s,null,2)),process.exit(0);}catch(r){Q(r);}});var an={version:"0.5.2"};process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function xo(){let e=new Command().name("createui").description("add items from registries to your project").version(an.version,"-v, --version","display the version number");e.addCommand(yr).addCommand(Nr).addCommand(Ir).addCommand(Fr).addCommand(sn).addCommand(Xr).addCommand(Gr).addCommand(Ar).addCommand(jr).addCommand(xt).addCommand(tn),e.addCommand(Kr).addCommand(Yr),e.parse();}xo();//# sourceMappingURL=index.js.map
|
|
93
93
|
//# sourceMappingURL=index.js.map
|