untitledui 0.1.53 → 0.1.54

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.
Files changed (2) hide show
  1. package/dist/index.mjs +17 -17
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{Command as J2}from"commander";import W1 from"async-retry";import A from"chalk";import{Command as d1}from"commander";import{execa as N0}from"execa";import*as C from"fs";import L0 from"ora";import h1 from"os";import*as k from"path";import p from"prompts";import{Project as f1}from"ts-morph";import r0 from"node-fetch";import{Readable as N1,pipeline as D1}from"stream";import{x as y1}from"tar";import{promisify as A1}from"util";var _1=A1(D1);async function i0(z,B){try{let Z=await v1(B);await _1(Z,y1({cwd:z,strip:1}))}catch(Z){throw new Error(`Failed to download or extract repository from API: ${Z instanceof Error?Z.message:Z}`)}}async function v1(z){let B=`https://www.untitledui.com/react/api/download-repo?template=${z.template}`;try{let Z=await r0(B,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/octet-stream"}});if(Z.status===403||Z.status===404)throw new Error("Repository not found");if(!Z.ok)throw new Error(`Failed to download from API. Status: ${Z.status} ${Z.statusText}`);if(!Z.body)throw new Error("Response body is empty");return N1.from(Z.body)}catch(Z){throw new Error(`Error downloading tarball: ${Z instanceof Error?Z.message:Z}`)}}async function b0(z){let B=`https://www.untitledui.com/react/api/validate-key?key=${z}`;try{return(await r0(B)).status===200}catch{return!1}}import E1 from"node-fetch";var n0={invalid_key:"Invalid key provided",no_components_found:"No components found",no_components_provided:"No components provided"};async function M0(z,B,Z){let q=B.map((U)=>{if(U.includes("modals/"))if(U.includes("-modal"))return U;else return U+"-modal";return U});try{let U=await E1("https://www.untitledui.com/react/api/components",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({type:z,components:q,key:Z})});if(!U.ok)console.log(n0?.[U.statusText]||n0.no_components_found),process.exit(1);return await U.json()}catch(U){return null}}import T0 from"node-fetch";var $0={invalid_key:"Invalid key provided",no_components_found:"No components found",no_components_provided:"No components provided"};async function p0(z,B=""){let Z=`https://www.untitledui.com/react/api/components/list?key=${B}&type=${z}`;try{let $=await T0(Z),q=await $.json();if(!$.ok)console.log($0?.[$.statusText]||$0.no_components_found),process.exit(1);if(!q?.components?.length)return null;return q}catch($){return console.error($),null}}async function o0(z,B="",Z){let $=`https://www.untitledui.com/react/api/components/list?key=${B}&type=${z}&subfolders=${Z.join(",")}`;try{let q=await T0($);if(!q.ok)console.log($0?.[q.statusText]||$0.no_components_found),process.exit(1);let U=await q.json();if(!U?.components?.length)return null;return U}catch(q){return console.error(q),null}}async function t0(z=""){let B=`https://www.untitledui.com/react/api/components/list?key=${z}`;try{let Z=await T0(B);if(!Z.ok)console.log($0?.[Z.statusText]||$0.no_components_found),process.exit(1);let $=await Z.json();if(!$?.types?.length)return null;return $}catch(Z){return console.error(Z),null}}import u0 from"fast-glob";import*as G0 from"fs";import*as c from"path";import{Project as P1}from"ts-morph";import{loadConfig as Y1}from"tsconfig-paths";import T1 from"prettier";async function e0(z,B="typescript"){try{return await T1.format(z,{parser:B,printWidth:160,tabWidth:4})}catch(Z){return console.error("Error formatting with Prettier:",Z),z}}import h from"chalk";import r from"fast-glob";import*as m from"fs";import*as f from"path";import{loadConfig as j0}from"tsconfig-paths";import z1 from"fs";import u1 from"path";function B1(z=""){let B=u1.join(z,"package.json");if(!z1.existsSync(B))return null;else return JSON.parse(z1.readFileSync(B,"utf-8"))}import S1 from"path";import{createMatchPath as w1}from"tsconfig-paths";function Q1(z,B){let Z=S1.posix.join(z,"index"),$=w1(B.absoluteBaseUrl,B.paths)(Z,void 0,()=>!0,[".ts",".tsx",".jsx",".js",".css"]);if($)return $.split("/").slice(0,-1).join("/");else return}var g=["**/node_modules/**",".next","public","dist","build"],H0=!1,Z1={"next-app":"Next.js (App)","next-pages":"Next.js (Pages)",vite:"Vite",other:"Other"};async function n(z){let B=m.existsSync(f.resolve(z,"src")),Z=m.existsSync(f.resolve(z,`${B?"src/":""}app`)),[$,q,U,L,M]=await Promise.all([r.glob("**/{next,vite,astro}.config.*|gatsby-config.*",{cwd:z,deep:2,ignore:g}),x1(z),C1(z),k1(z),B1(z)]),K=m.existsSync(f.resolve(z,"components.json")),V=null;if(K)V=JSON.parse(m.readFileSync(f.resolve(z,"components.json"),"utf-8"));let b=r.sync(["**/**/theme.css"],{cwd:z,absolute:!0,onlyFiles:!0,ignore:g}),j=b?.[0]&&m.readFileSync(b[0],"utf-8").match(/(--color-brand+-\d{1,3}):\s*(rgb\([^)]+\))/g)?.[1]||void 0,I={tailwind:{config:U||void 0,brandColor:j?.replace(/--color-([^-]+(?:-[^-]+)?)-\d+:.*/,"$1")||void 0},examples:V?.examples||void 0,aliases:V?.aliases||L||{},paths:await F1(V?.aliases||{})||{},isTsx:q,isSrcDir:B,isAppDir:Z,isComponentsJson:!!K,framework:"other"};if($.find((G)=>G.startsWith("next.config."))?.length)return I.framework=Z?"next-app":"next-pages",I;else if($.find((G)=>G.startsWith("vite.config."))?.length)return I.framework="vite",I;else if(Object.keys(M?.dependencies||{}).includes("react"))return I.framework="next-pages",I;else if($?.length||m.existsSync(f.resolve(z,"package.json")))return I.framework="other",I;return null}async function x1(z){return(await r.glob("tsconfig.*",{cwd:z,deep:2,ignore:g})).length>0}async function F1(z){let B={},Z=[],$=Object.entries(z).filter(([,K])=>K);if($.length===0)return null;let q=process.cwd(),L=j0(q).resultType==="success",M=await $1(q);if(!M){if(!H0){if(H0=!0,process.stdout.write("\r\x1B[K"),L)console.log(h.yellow(`
2
+ import{Command as J3}from"commander";import W1 from"async-retry";import A from"chalk";import{Command as d1}from"commander";import{execa as N0}from"execa";import*as C from"fs";import L0 from"ora";import h1 from"os";import*as k from"path";import p from"prompts";import{Project as f1}from"ts-morph";import r0 from"node-fetch";import{Readable as N1,pipeline as D1}from"stream";import{x as y1}from"tar";import{promisify as A1}from"util";var v1=A1(D1);async function i0(z,B){try{let Z=await _1(B);await v1(Z,y1({cwd:z,strip:1}))}catch(Z){throw new Error(`Failed to download or extract repository from API: ${Z instanceof Error?Z.message:Z}`)}}async function _1(z){let B=`https://www.untitledui.com/react/api/download-repo?template=${z.template}`;try{let Z=await r0(B,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/octet-stream"}});if(Z.status===403||Z.status===404)throw new Error("Repository not found");if(!Z.ok)throw new Error(`Failed to download from API. Status: ${Z.status} ${Z.statusText}`);if(!Z.body)throw new Error("Response body is empty");return N1.from(Z.body)}catch(Z){throw new Error(`Error downloading tarball: ${Z instanceof Error?Z.message:Z}`)}}async function b0(z){let B=`https://www.untitledui.com/react/api/validate-key?key=${z}`;try{return(await r0(B)).status===200}catch{return!1}}import E1 from"node-fetch";var n0={invalid_key:"Invalid key provided",no_components_found:"No components found",no_components_provided:"No components provided"};async function M0(z,B,Z){let q=B.map((U)=>{if(U.includes("modals/"))if(U.includes("-modal"))return U;else return U+"-modal";return U});try{let U=await E1("https://www.untitledui.com/react/api/components",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({type:z,components:q,key:Z})});if(!U.ok)console.log(n0?.[U.statusText]||n0.no_components_found),process.exit(1);return await U.json()}catch(U){return null}}import T0 from"node-fetch";var $0={invalid_key:"Invalid key provided",no_components_found:"No components found",no_components_provided:"No components provided"};async function p0(z,B=""){let Z=`https://www.untitledui.com/react/api/components/list?key=${B}&type=${z}`;try{let $=await T0(Z),q=await $.json();if(!$.ok)console.log($0?.[$.statusText]||$0.no_components_found),process.exit(1);if(!q?.components?.length)return null;return q}catch($){return console.error($),null}}async function o0(z,B="",Z){let $=`https://www.untitledui.com/react/api/components/list?key=${B}&type=${z}&subfolders=${Z.join(",")}`;try{let q=await T0($);if(!q.ok)console.log($0?.[q.statusText]||$0.no_components_found),process.exit(1);let U=await q.json();if(!U?.components?.length)return null;return U}catch(q){return console.error(q),null}}async function t0(z=""){let B=`https://www.untitledui.com/react/api/components/list?key=${z}`;try{let Z=await T0(B);if(!Z.ok)console.log($0?.[Z.statusText]||$0.no_components_found),process.exit(1);let $=await Z.json();if(!$?.types?.length)return null;return $}catch(Z){return console.error(Z),null}}import u0 from"fast-glob";import*as G0 from"fs";import*as c from"path";import{Project as P1}from"ts-morph";import{loadConfig as Y1}from"tsconfig-paths";import T1 from"prettier";async function e0(z,B="typescript"){try{return await T1.format(z,{parser:B,printWidth:160,tabWidth:4})}catch(Z){return console.error("Error formatting with Prettier:",Z),z}}import h from"chalk";import r from"fast-glob";import*as m from"fs";import*as f from"path";import{loadConfig as j0}from"tsconfig-paths";import z1 from"fs";import u1 from"path";function B1(z=""){let B=u1.join(z,"package.json");if(!z1.existsSync(B))return null;else return JSON.parse(z1.readFileSync(B,"utf-8"))}import S1 from"path";import{createMatchPath as w1}from"tsconfig-paths";function Q1(z,B){let Z=S1.posix.join(z,"index"),$=w1(B.absoluteBaseUrl,B.paths)(Z,void 0,()=>!0,[".ts",".tsx",".jsx",".js",".css"]);if($)return $.split("/").slice(0,-1).join("/");else return}var g=["**/node_modules/**",".next","public","dist","build"],H0=!1,Z1={"next-app":"Next.js (App)","next-pages":"Next.js (Pages)",vite:"Vite",other:"Other"};async function n(z){let B=m.existsSync(f.resolve(z,"src")),Z=m.existsSync(f.resolve(z,`${B?"src/":""}app`)),[$,q,U,L,M]=await Promise.all([r.glob("**/{next,vite,astro}.config.*|gatsby-config.*",{cwd:z,deep:2,ignore:g}),x1(z),C1(z),k1(z),B1(z)]),K=m.existsSync(f.resolve(z,"components.json")),V=null;if(K)V=JSON.parse(m.readFileSync(f.resolve(z,"components.json"),"utf-8"));let b=r.sync(["**/**/theme.css"],{cwd:z,absolute:!0,onlyFiles:!0,ignore:g}),j=b?.[0]&&m.readFileSync(b[0],"utf-8").match(/(--color-brand+-\d{1,3}):\s*(rgb\([^)]+\))/g)?.[1]||void 0,I={tailwind:{config:U||void 0,brandColor:j?.replace(/--color-([^-]+(?:-[^-]+)?)-\d+:.*/,"$1")||void 0},examples:V?.examples||void 0,aliases:V?.aliases||L||{},paths:await F1(V?.aliases||{})||{},isTsx:q,isSrcDir:B,isAppDir:Z,isComponentsJson:!!K,framework:"other"};if($.find((G)=>G.startsWith("next.config."))?.length)return I.framework=Z?"next-app":"next-pages",I;else if($.find((G)=>G.startsWith("vite.config."))?.length)return I.framework="vite",I;else if(Object.keys(M?.dependencies||{}).includes("react"))return I.framework="next-pages",I;else if($?.length||m.existsSync(f.resolve(z,"package.json")))return I.framework="other",I;return null}async function x1(z){return(await r.glob("tsconfig.*",{cwd:z,deep:2,ignore:g})).length>0}async function F1(z){let B={},Z=[],$=Object.entries(z).filter(([,K])=>K);if($.length===0)return null;let q=process.cwd(),L=j0(q).resultType==="success",M=await $1(q);if(!M){if(!H0){if(H0=!0,process.stdout.write("\r\x1B[K"),L)console.log(h.yellow(`
3
3
  ⚠ Could not resolve path aliases from components.json - no paths configured in tsconfig.json.`));else console.log(h.yellow(`
4
4
  ⚠ Could not resolve path aliases from components.json - tsconfig.json not found.`));console.log(h.dim(` The following aliases will be used for imports but files will be placed in default locations:
5
5
  `)),$.forEach(([K,V])=>{console.log(h.dim(` ${K}: ${V}`))}),console.log(h.dim(`
@@ -8,13 +8,13 @@ import{Command as J2}from"commander";import W1 from"async-retry";import A from"c
8
8
  ⚠ Could not resolve the following path aliases from tsconfig.json:`)),Z.forEach((K)=>{console.log(h.dim(` ${K}`))}),console.log(h.dim(`
9
9
  These aliases will be used for imports but files will be placed in default locations.`)),console.log(h.dim(` To fix this, add matching paths to your tsconfig.json.
10
10
  `));return B}async function $1(z){let[B,Z]=await Promise.all([r.glob("next.config.*",{cwd:z,deep:1,ignore:g}),r.glob("vite.config.*",{cwd:z,deep:1,ignore:g})]),$=B.length>0,q=Z.length>0,U=null;if($)U=j0(z);else if(q){if(U=j0(z),U?.resultType==="failed"||!Object.keys(U.paths||{}).length){let L=await r.glob(["tsconfig.app.*","*/tsconfig.app.*"],{cwd:z,deep:1,onlyFiles:!0,absolute:!0,ignore:g}),[M]=L;if(M)try{let V=function(I){return I.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"").replace(/,(\s*[}\]])/g,"$1")},K=m.readFileSync(M,"utf-8"),b=V(K),j=JSON.parse(b);if(j.compilerOptions?.paths)U={resultType:"success",paths:j?.compilerOptions?.paths,baseUrl:j.compilerOptions.baseUrl||".",configFileAbsolutePath:M,absoluteBaseUrl:f.resolve(z,j.compilerOptions.baseUrl||".")}}catch{}}}else U=j0(z);if(!U||U?.resultType==="failed"||!Object.keys(U.paths).length)return null;return U}async function C1(z){let B=await r.glob("tailwind.config.*",{cwd:z,deep:2,ignore:g});if(!B.length)return null;return B[0]}async function k1(z){let B=await $1(z);if(!B)return null;let Z={},$={app:/\/?app\/\*$/,components:/\/?components\/\*$/,utils:/\/?utils\/\*$/,styles:/\/?styles\/\*$/,hooks:/\/?hooks\/\*$/,src:/^(\.\/src\/\*|\.\/\*|\/src\/\*|src\/\*|\/\*|\*)$/};for(let[q,U]of Object.entries(B.paths)){let L=q.replace(/\/\*$/,"/");for(let[M,K]of Object.entries($))if(U.some((V)=>K.test(V))){Z[M]=L;break}}return Z||null}function Y0(z,B){let Z=Y1(z),$=u0.sync(["tailwind.config.*","**/globals.css","package.json"],{cwd:z,deep:4,absolute:!0,onlyFiles:!0,ignore:g}),q=u0.sync("**/{layout,_app,main}.tsx",{cwd:B?c.posix.join(z,B):z,deep:4,absolute:!0,onlyFiles:!0,ignore:g});return{tailwindFile:$.find((L)=>L.includes("tailwind.config.")),cssFile:$.find((L)=>L.includes("globals.css")),packageJson:$.find((L)=>L.includes("package.json")),tsConfig:Z?.resultType==="success"?Z?.configFileAbsolutePath:void 0,layoutFile:q.find((L)=>L.includes("layout")),appFile:q.find((L)=>L.includes("_app")),mainFile:q.find((L)=>L.includes("main"))}}function q0(z,B,Z={}){if(z.startsWith("@/components/")){if(Z?.components)return z.replace(/^@\/components\//,c.posix.join(Z.components,"/"));if(B)return z.replace(/^@\/components\//,c.posix.join("@",B,"/"))}if(z.startsWith("@/app/")&&Z?.app)return z.replace(/^@\/app\//,c.posix.join(Z.app,"/"));if(z.startsWith("@/utils/")&&Z?.utils)return z.replace(/^@\/utils\//,c.posix.join(Z.utils,"/"));if(z.startsWith("@/hooks/")&&Z?.hooks)return z.replace(/^@\/hooks\//,c.posix.join(Z.hooks,"/"));if(z.startsWith("@/styles/")&&Z?.styles)return z.replace(/^@\/styles\//,c.posix.join(Z.styles,"/"));if(z.startsWith("@/")&&Z?.src)return z.replace(/^@\//,c.posix.join(Z.src,"/"));return z}async function q1(z,B,Z="@/*"){let $=await Y1(z);if($?.resultType==="failed")return null;let q={};if(!Object.keys($.paths).length){$.paths={[Z]:[`./${B?"src/":""}*`]},q.src=Z.replace(/\/\*$/,"");let U=await G0.promises.readFile($.configFileAbsolutePath,"utf-8"),L,M=/(?:\/\/\s*)?"paths":\s*\{(?:[^{}]|\{[^}]*\})*\}/;if(!M.test(U))L=U.replace(/"compilerOptions":\s*{/,`"compilerOptions": {
11
- "paths": ${JSON.stringify($.paths)},`);else L=U.replace(M,`"paths": ${JSON.stringify($.paths)}`);let V=new P1,b=await e0(L,"json");return V.createSourceFile($.configFileAbsolutePath,b,{overwrite:!0}),await V.save(),q}return q||null}function X1(z){let B=u0.sync(["vite.config.*"],{cwd:z,absolute:!0,onlyFiles:!0,ignore:g})?.[0];if(!B)return!1;try{let Z=G0.readFileSync(B,"utf-8");return O1(Z)}catch{return!1}}function O1(z){let B=z.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"");if(!["tailwindcss","@tailwindcss/vite","tailwind("].some((U)=>B.includes(U)))return!1;return["plugins:","postcss:","css:"].some((U)=>B.includes(U))}var g1=["npm","config","user","agent"].join("_");function F(){let z=process.env[g1]||"";if(z.startsWith("yarn"))return"yarn";if(z.startsWith("pnpm"))return"pnpm";if(z.startsWith("bun"))return"bun";return"npm"}function X0(){switch(F()){case"yarn":return"yarn";case"pnpm":return"pnpx";case"bun":return"bunx";default:return"npx"}}function U1(){switch(F()){case"yarn":return"yarn dev";case"pnpm":return"pnpm dev";case"bun":return"bun dev";default:return"npm run dev"}}function I0(z){return z.replace(/^[ \t]*\/\/\s*(TODO:|collapse-(start|end)).*\r?\n?|[ \t]*{\s*\/\*\s*(TODO:|collapse-(start|end)).*?\*\/\s*}\r?\n?/gm,"")}import l from"path";function R0(z,B,Z){let $=z.replace(/^(components|utils|hooks|styles)\//,"");if(z.includes("components")&&B?.components)return l.relative(process.cwd(),l.posix.join(B.components,$));if(z.includes("utils")&&B?.utils)return l.relative(process.cwd(),l.posix.join(B.utils,$));if(z.includes("hooks")&&B?.hooks)return l.relative(process.cwd(),l.posix.join(B.hooks,$));if(z.includes("styles")&&B?.styles)return l.relative(process.cwd(),l.posix.join(B.styles,$));return l.posix.join(Z?"src":"",$)}var m1=k.join(h1.homedir(),".untitledui"),o=k.join(m1,"config.json"),W={components:[],path:"",type:void 0,license:""};if(C.existsSync(o)){let z=JSON.parse(C.readFileSync(o,"utf-8"));W.license=z.license}var U0=(z)=>{if(z.aborted)process.stdout.write("\x1B[?25h"),process.stdout.write(`
12
- `),process.exit(1)},K1=new d1().name("add").description("add a component to your project").argument("[components...]","the components to add").option("-a, --all","add all available components",!1).option("-o, --overwrite","overwrite existing files.",!1).option("-p, --path <path>","the path to add the component to.").option("-d, --dir <directory>","the directory where the project is located.").option("-t, --type <base|marketing|shared-assets|application|foundations>","the type of the component to add.").option("--include-all-components","automatically include all base components without prompting.",!1).option("-y, --yes","non-interactive mode - use defaults for all prompts (for AI agents/CI).",!1).action(async(z,B)=>{if(z)W.components=z;if(B){if(W.all=B.all,W.dir=B.dir,W.path=B.path,W.overwrite=B.overwrite,W.includeAllComponents=B.includeAllComponents,W.license=B.license||W.license,W.yes=B.yes,B.yes)W.includeAllComponents=!0,W.overwrite=!0}try{await S0(W)}catch(Z){console.error(A.red(Z))}});async function S0(z){if(z)W={...W,...z};let B=L0().start(),Z=k.posix.join(process.cwd(),W.dir||"");if(!C.existsSync(k.resolve(Z,"package.json")))B.warn("This command should be run in a project directory."),process.exit(1);let q=await n(Z);if(W.license){if(!await b0(W.license))B.fail("Invalid license key"),process.exit(1);if(!C.existsSync(o)){let H=k.dirname(o);C.mkdirSync(H,{recursive:!0}),C.writeFileSync(o,JSON.stringify({license:W.license},null,2))}if(JSON.parse(C.readFileSync(o,"utf-8")).license!==W.license)C.writeFileSync(o,JSON.stringify({license:W.license},null,2),"utf-8")}B.stop();let U=[];if(W.components.length){let Q=await M0(W.type,W.components,W.license);if(Q&&Q.pro&&Q.pro.length>0){if(console.log(),Q.pro.length===1){let X=Q.pro[0]?.split("/")[1]||Q.pro[0];console.log(A.yellow(`\uD83D\uDD12 The ${A.cyan(X)} component requires PRO access.`))}else console.log(A.yellow("\uD83D\uDD12 The following components require PRO access:")),Q.pro.forEach((X)=>{let H=X?.split("/")[1]||X;console.log(` • ${A.cyan(H)}`)});console.log(),console.log("To access PRO components:"),console.log(` ${A.green("→")} If you've already purchased: ${A.cyan(`${X0()} untitledui@latest login`)}`),console.log(` ${A.green("→")} To purchase PRO components: ${A.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1)}if(!Q?.components.length)console.log("No components found"),process.exit(1);U.push(...Q.components)}if(!W?.type&&!W?.components.length){if(W.yes)console.log(A.red("Error: In non-interactive mode (--yes), you must specify components as arguments.")),process.exit(1);let Q=await t0(W.license);if(!Q)console.log("No component types found"),process.exit(1);let X=await p({type:"select",name:"type",onState:U0,message:`What type of ${A.cyan("component")} are you adding?`,choices:Q?.types.map((H)=>({title:H,value:H}))});W.type=X.type}if(!W?.path&&!q?.paths?.components)if(W.yes)W.path="components";else{let Q=await p({type:"text",name:"path",onState:U0,message:`Where would you like to add the ${A.cyan("components")}?`,initial:"components"});W.path=Q.path}if(W?.path&&q&&q.paths)q.paths.components=k.posix.join(q?.isSrcDir?"src":"",W.path);if(q&&!Object.keys(q?.aliases).length){let Q="@/*";if(!W.yes){let X=/^[^*"]+\/\*\s*$/;Q=(await p({type:"text",name:"aliasPrefix",onState:U0,initial:"@/*",message:`What is the ${A.cyan("import alias")} for your project?`,validate:(T)=>X.test(T)?!0:"Import alias must follow the pattern <prefix>/*"}))?.aliasPrefix}q.aliases=await q1(Z,q?.isSrcDir,Q)}if(!W?.components.length){if(W.yes)console.log(A.red("Error: In non-interactive mode (--yes), you must specify components as arguments.")),process.exit(1);let Q=await p0(W?.type,W.license);if(!Q)console.log("No components found"),process.exit(1);let X=await p({type:"multiselect",name:"components",onState:U0,message:`Which ${A.cyan("components")} would you like to add?`,choices:Q?.components?.map((D)=>({title:D?.name+(D?.count?` (${D?.count} variants)`:"")||"example",value:D||"example",selected:W.components.includes(D.name)})),instructions:!1,hint:"- Space to select. Return to submit"});if(!X.components||!X.components.length)console.log("No option selected. Exiting..."),process.exit(1);let H=X.components.filter((D)=>D?.type==="file").map((D)=>D.name),T=X.components.filter((D)=>D?.type==="dir").map((D)=>D.name),_=[];if(T.length){let D=await o0(W?.type,W.license,T);if(D&&D.components.length)for(let R of D.components){let[u,E]=Object.entries(R)[0]||[],P=await p({type:"select",name:"component",onState:U0,message:`Which ${A.cyan("variant")} from ${A.cyan(u)} would you like to add?`,choices:E?.map((O)=>({title:O?.name.replace(/-modal/g,"")||"example",value:O?.name||"example",selected:W.components.includes(O.name)})),instructions:!1,hint:"- Space to select. Return to submit"});if(!P.component)console.log("No variant selected for "+A.cyan(u));_.push(u+"/"+P.component)}else console.log("No variants found")}W.components=[..._,...H]}if(!W.components?.length)B.warn("No components selected. Exiting."),process.exit(1);let L=Y0(Z),M=new Set,K=new Set,V=new Set,b=new f1({tsConfigFilePath:L?.tsConfig});if(B.start(),W.type&&W.components.length){let Q=await M0(W.type,W.components,W.license);if(!Q?.components.length)console.log("No components found"),process.exit(1);U.push(...Q.components)}let j=new Set;if(U.forEach((Q)=>{Q?.components?.forEach((X)=>{j.add({name:X.name,path:X.path})})}),B.stop(),j.size){let Q=Array.from(j).filter((X)=>!C.existsSync(k.posix.join(Z,`${q?.isSrcDir?"src":""}`,X?.path?.replace(/components\//,W.path+"/"))));if(Q?.length)if(W.includeAllComponents)W.baseComponents=Q.map((X)=>X.name);else{let X=await p({type:"multiselect",name:"baseComponents",onState:U0,message:"Select which base components you want to add",choices:Q.map((H)=>({title:H?.name,value:H?.name,selected:!0})),instructions:!1,hint:"- Space to select. Return to submit"});if(W.baseComponents=X.baseComponents,!Q.length&&!X.baseComponents?.length)B.warn("No components selected")}}if(B.start(),W?.baseComponents?.length){let Q=await M0("",W.baseComponents,W.license);if(!Q||!Q?.components.length)console.log("No base components found");else U.push(...Q.components)}B.stop();let I=new Set;for(let Q of U){let X=L0(`Adding ${Q.name}...`).start(),H=Q.files;Q?.dependencies?.forEach((_)=>K.add(_)),Q?.devDependencies?.forEach((_)=>V.add(_));let T=!1;try{for(let{path:_,code:D}of H||[]){let R=k.posix.join(Z,R0(_,q?.paths,q?.isSrcDir)),u=q?.framework==="vite"?D.replace(`"use client";
11
+ "paths": ${JSON.stringify($.paths)},`);else L=U.replace(M,`"paths": ${JSON.stringify($.paths)}`);let V=new P1,b=await e0(L,"json");return V.createSourceFile($.configFileAbsolutePath,b,{overwrite:!0}),await V.save(),q}return q||null}function X1(z){let B=u0.sync(["vite.config.*"],{cwd:z,absolute:!0,onlyFiles:!0,ignore:g})?.[0];if(!B)return!1;try{let Z=G0.readFileSync(B,"utf-8");return O1(Z)}catch{return!1}}function O1(z){let B=z.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"");if(!["tailwindcss","@tailwindcss/vite","tailwind("].some((U)=>B.includes(U)))return!1;return["plugins:","postcss:","css:"].some((U)=>B.includes(U))}var g1=["npm","config","user","agent"].join("_");function F(){let z=process.env[g1]||"";if(z.startsWith("yarn"))return"yarn";if(z.startsWith("pnpm"))return"pnpm";if(z.startsWith("bun"))return"bun";return"npm"}function X0(){switch(F()){case"yarn":return"yarn";case"pnpm":return"pnpx";case"bun":return"bunx";default:return"npx"}}function U1(){switch(F()){case"yarn":return"yarn dev";case"pnpm":return"pnpm dev";case"bun":return"bun dev";default:return"npm run dev"}}function I0(z){return z.replace(/^[ \t]*\/\/\s*(TODO:|collapse-(start|end)).*\r?\n?|[ \t]*{\s*\/\*\s*(TODO:|collapse-(start|end)).*?\*\/\s*}\r?\n?/gm,"")}import l from"path";function R0(z,B,Z){let $=z.replace(/^(components|utils|hooks|styles)\//,"");if(z.includes("components")&&B?.components)return l.relative(process.cwd(),l.posix.join(B.components,$));if(z.includes("utils")&&B?.utils)return l.relative(process.cwd(),l.posix.join(B.utils,$));if(z.includes("hooks")&&B?.hooks)return l.relative(process.cwd(),l.posix.join(B.hooks,$));if(z.includes("styles")&&B?.styles)return l.relative(process.cwd(),l.posix.join(B.styles,$));return l.posix.join(Z?"src":"",z)}var m1=k.join(h1.homedir(),".untitledui"),o=k.join(m1,"config.json"),W={components:[],path:"",type:void 0,license:""};if(C.existsSync(o)){let z=JSON.parse(C.readFileSync(o,"utf-8"));W.license=z.license}var U0=(z)=>{if(z.aborted)process.stdout.write("\x1B[?25h"),process.stdout.write(`
12
+ `),process.exit(1)},K1=new d1().name("add").description("add a component to your project").argument("[components...]","the components to add").option("-a, --all","add all available components",!1).option("-o, --overwrite","overwrite existing files.",!1).option("-p, --path <path>","the path to add the component to.").option("-d, --dir <directory>","the directory where the project is located.").option("-t, --type <base|marketing|shared-assets|application|foundations>","the type of the component to add.").option("--include-all-components","automatically include all base components without prompting.",!1).option("-y, --yes","non-interactive mode - use defaults for all prompts (for AI agents/CI).",!1).action(async(z,B)=>{if(z)W.components=z;if(B){if(W.all=B.all,W.dir=B.dir,W.path=B.path,W.overwrite=B.overwrite,W.includeAllComponents=B.includeAllComponents,W.license=B.license||W.license,W.yes=B.yes,B.yes)W.includeAllComponents=!0,W.overwrite=!0}try{await S0(W)}catch(Z){console.error(A.red(Z))}});async function S0(z){if(z)W={...W,...z};let B=L0().start(),Z=k.posix.join(process.cwd(),W.dir||"");if(!C.existsSync(k.resolve(Z,"package.json")))B.warn("This command should be run in a project directory."),process.exit(1);let q=await n(Z);if(W.license){if(!await b0(W.license))B.fail("Invalid license key"),process.exit(1);if(!C.existsSync(o)){let H=k.dirname(o);C.mkdirSync(H,{recursive:!0}),C.writeFileSync(o,JSON.stringify({license:W.license},null,2))}if(JSON.parse(C.readFileSync(o,"utf-8")).license!==W.license)C.writeFileSync(o,JSON.stringify({license:W.license},null,2),"utf-8")}B.stop();let U=[];if(W.components.length){let Q=await M0(W.type,W.components,W.license);if(Q&&Q.pro&&Q.pro.length>0){if(console.log(),Q.pro.length===1){let X=Q.pro[0]?.split("/")[1]||Q.pro[0];console.log(A.yellow(`\uD83D\uDD12 The ${A.cyan(X)} component requires PRO access.`))}else console.log(A.yellow("\uD83D\uDD12 The following components require PRO access:")),Q.pro.forEach((X)=>{let H=X?.split("/")[1]||X;console.log(` • ${A.cyan(H)}`)});console.log(),console.log("To access PRO components:"),console.log(` ${A.green("→")} If you've already purchased: ${A.cyan(`${X0()} untitledui@latest login`)}`),console.log(` ${A.green("→")} To purchase PRO components: ${A.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1)}if(!Q?.components.length)console.log("No components found"),process.exit(1);U.push(...Q.components)}if(!W?.type&&!W?.components.length){if(W.yes)console.log(A.red("Error: In non-interactive mode (--yes), you must specify components as arguments.")),process.exit(1);let Q=await t0(W.license);if(!Q)console.log("No component types found"),process.exit(1);let X=await p({type:"select",name:"type",onState:U0,message:`What type of ${A.cyan("component")} are you adding?`,choices:Q?.types.map((H)=>({title:H,value:H}))});W.type=X.type}if(!W?.path&&!q?.paths?.components)if(W.yes)W.path="components";else{let Q=await p({type:"text",name:"path",onState:U0,message:`Where would you like to add the ${A.cyan("components")}?`,initial:"components"});W.path=Q.path}if(W?.path&&q&&q.paths)q.paths.components=k.posix.join(q?.isSrcDir?"src":"",W.path);if(q&&!Object.keys(q?.aliases).length){let Q="@/*";if(!W.yes){let X=/^[^*"]+\/\*\s*$/;Q=(await p({type:"text",name:"aliasPrefix",onState:U0,initial:"@/*",message:`What is the ${A.cyan("import alias")} for your project?`,validate:(T)=>X.test(T)?!0:"Import alias must follow the pattern <prefix>/*"}))?.aliasPrefix}q.aliases=await q1(Z,q?.isSrcDir,Q)}if(!W?.components.length){if(W.yes)console.log(A.red("Error: In non-interactive mode (--yes), you must specify components as arguments.")),process.exit(1);let Q=await p0(W?.type,W.license);if(!Q)console.log("No components found"),process.exit(1);let X=await p({type:"multiselect",name:"components",onState:U0,message:`Which ${A.cyan("components")} would you like to add?`,choices:Q?.components?.map((D)=>({title:D?.name+(D?.count?` (${D?.count} variants)`:"")||"example",value:D||"example",selected:W.components.includes(D.name)})),instructions:!1,hint:"- Space to select. Return to submit"});if(!X.components||!X.components.length)console.log("No option selected. Exiting..."),process.exit(1);let H=X.components.filter((D)=>D?.type==="file").map((D)=>D.name),T=X.components.filter((D)=>D?.type==="dir").map((D)=>D.name),v=[];if(T.length){let D=await o0(W?.type,W.license,T);if(D&&D.components.length)for(let R of D.components){let[u,E]=Object.entries(R)[0]||[],P=await p({type:"select",name:"component",onState:U0,message:`Which ${A.cyan("variant")} from ${A.cyan(u)} would you like to add?`,choices:E?.map((O)=>({title:O?.name.replace(/-modal/g,"")||"example",value:O?.name||"example",selected:W.components.includes(O.name)})),instructions:!1,hint:"- Space to select. Return to submit"});if(!P.component)console.log("No variant selected for "+A.cyan(u));v.push(u+"/"+P.component)}else console.log("No variants found")}W.components=[...v,...H]}if(!W.components?.length)B.warn("No components selected. Exiting."),process.exit(1);let L=Y0(Z),M=new Set,K=new Set,V=new Set,b=new f1({tsConfigFilePath:L?.tsConfig});if(B.start(),W.type&&W.components.length){let Q=await M0(W.type,W.components,W.license);if(!Q?.components.length)console.log("No components found"),process.exit(1);U.push(...Q.components)}let j=new Set;if(U.forEach((Q)=>{Q?.components?.forEach((X)=>{j.add({name:X.name,path:X.path})})}),B.stop(),j.size){let Q=Array.from(j).filter((X)=>!C.existsSync(k.posix.join(Z,`${q?.isSrcDir?"src":""}`,X?.path?.replace(/components\//,W.path+"/"))));if(Q?.length)if(W.includeAllComponents)W.baseComponents=Q.map((X)=>X.name);else{let X=await p({type:"multiselect",name:"baseComponents",onState:U0,message:"Select which base components you want to add",choices:Q.map((H)=>({title:H?.name,value:H?.name,selected:!0})),instructions:!1,hint:"- Space to select. Return to submit"});if(W.baseComponents=X.baseComponents,!Q.length&&!X.baseComponents?.length)B.warn("No components selected")}}if(B.start(),W?.baseComponents?.length){let Q=await M0("",W.baseComponents,W.license);if(!Q||!Q?.components.length)console.log("No base components found");else U.push(...Q.components)}B.stop();let I=new Set;for(let Q of U){let X=L0(`Adding ${Q.name}...`).start(),H=Q.files;Q?.dependencies?.forEach((v)=>K.add(v)),Q?.devDependencies?.forEach((v)=>V.add(v));let T=!1;try{for(let{path:v,code:D}of H||[]){let R=k.posix.join(Z,R0(v,q?.paths,q?.isSrcDir)),u=q?.framework==="vite"?D.replace(`"use client";
13
13
 
14
- `,""):D,E=I0(u),P=k.dirname(R);if(C.existsSync(R)&&!W.overwrite&&!I.has(R)){if(C.readFileSync(R,"utf-8")!==E)M.add({code:E,path:R}),T=!0}else if(!I.has(R)){C.mkdirSync(P,{recursive:!0}),C.writeFileSync(R,E),I.add(R);let O=b.addSourceFileAtPath(k.resolve(R));O.getImportDeclarations().forEach((s)=>{let s0=s.getModuleSpecifierValue();s.setModuleSpecifier(q0(s0,W.path,q?.aliases))}),await O.save()}}if(T)X.warn(`Some files of ${A.yellow(Q.name)} already exist`);else X.succeed(`${A.green(Q.name)} is added successfully`)}catch(_){X.fail(`
15
- Failed to add the component ${A.red(Q.name)}`),console.error(A.red(_)),process.exit(1)}}if(M.size&&!W?.overwrite){console.log(`
14
+ `,""):D,E=I0(u),P=k.dirname(R);if(C.existsSync(R)&&!W.overwrite&&!I.has(R)){if(C.readFileSync(R,"utf-8")!==E)M.add({code:E,path:R}),T=!0}else if(!I.has(R)){C.mkdirSync(P,{recursive:!0}),C.writeFileSync(R,E),I.add(R);let O=b.addSourceFileAtPath(k.resolve(R));O.getImportDeclarations().forEach((s)=>{let s0=s.getModuleSpecifierValue();s.setModuleSpecifier(q0(s0,W.path,q?.aliases))}),await O.save()}}if(T)X.warn(`Some files of ${A.yellow(Q.name)} already exist`);else X.succeed(`${A.green(Q.name)} is added successfully`)}catch(v){X.fail(`
15
+ Failed to add the component ${A.red(Q.name)}`),console.error(A.red(v)),process.exit(1)}}if(M.size&&!W?.overwrite){console.log(`
16
16
  Following files already exist in the directory.`),M.forEach((X)=>{console.log(A.green(`- ${k.relative(Z,X.path)}`))});let Q=!1;if(W.yes)Q=!0;else{let X=await p({type:"confirm",name:"overwrite",message:"Do you want to overwrite the existing files?",initial:!0});if(X.overwrite===void 0)console.log(`
17
- Use ${A.cyan("--overwrite")} or ${A.cyan("-o")} flag to overwrite existing files, or run with ${A.cyan("node")} instead of ${A.cyan("bun")}.`),process.exit(1);Q=X.overwrite}if(Q){let X=L0("Overwriting files").start();M.forEach((H)=>{let T=b.addSourceFileAtPath(k.resolve(H.path));T.replaceWithText(H.code),T.getImportDeclarations().forEach((_)=>{let D=_.getModuleSpecifierValue();_.setModuleSpecifier(q0(D,W.path,q?.aliases))}),T.saveSync()}),X.succeed("Files are overwritten")}}let G=F();if(K?.size){let Q=L0("Installing component dependencies").start();await W1(()=>N0(G,[G==="npm"?"install":"add",...K],{cwd:Z}).catch(async(X)=>{if(X.message.includes("peer"))Q.warn("Component dependencies conflict detected. Retrying with --legacy-peer-deps..."),Q.start("Installing component dependencies with --legacy-peer-deps flag"),await N0(G,[G==="npm"?"install":"add",...K,"--legacy-peer-deps"],{cwd:Z})}),{retries:1}),Q.succeed("Component dependencies are installed")}if(V?.size){let Q=L0("Installing component devDependencies").start();await W1(()=>N0(G,[G==="npm"?"install":"add","-D",...V],{cwd:Z}).catch(async(X)=>{if(X.message.includes("peer"))Q.warn("Component devDependencies conflict detected. Retrying with --legacy-peer-deps..."),Q.start("Installing component devDependencies with --legacy-peer-deps flag"),await N0(G,[G==="npm"?"install":"add","-D",...V,"--legacy-peer-deps"],{cwd:Z})}),{retries:1}),Q.succeed("Component devDependencies are installed")}if(W.message!==void 0){if(W.message)console.log(W.message);return}process.exit(0)}import F0 from"chalk";import{Command as s1}from"commander";import*as a from"fs";import r1 from"http";import i1 from"open";import n1 from"ora";import p1 from"os";import*as k0 from"path";import{URL as o1}from"url";import*as D0 from"fs";import*as t from"path";import{fileURLToPath as c1}from"url";var l1=c1(import.meta.url),w0=t.dirname(l1);function a1(){let z=[t.join(w0,"..","templates","auth-template.html"),t.join(w0,"templates","auth-template.html"),t.join(process.cwd(),"node_modules","untitledui","templates","auth-template.html"),t.join(w0,"..","..","templates","auth-template.html")];for(let B of z)if(D0.existsSync(B))return B;throw new Error("Auth template file not found. Please ensure the CLI package is properly installed.")}function L1(){try{let z=a1();return D0.readFileSync(z,"utf-8")}catch(z){return console.warn("Warning: Using fallback auth template. Some styling may be missing."),`<!doctype html>
17
+ Use ${A.cyan("--overwrite")} or ${A.cyan("-o")} flag to overwrite existing files, or run with ${A.cyan("node")} instead of ${A.cyan("bun")}.`),process.exit(1);Q=X.overwrite}if(Q){let X=L0("Overwriting files").start();M.forEach((H)=>{let T=b.addSourceFileAtPath(k.resolve(H.path));T.replaceWithText(H.code),T.getImportDeclarations().forEach((v)=>{let D=v.getModuleSpecifierValue();v.setModuleSpecifier(q0(D,W.path,q?.aliases))}),T.saveSync()}),X.succeed("Files are overwritten")}}let G=F();if(K?.size){let Q=L0("Installing component dependencies").start();await W1(()=>N0(G,[G==="npm"?"install":"add",...K],{cwd:Z}).catch(async(X)=>{if(X.message.includes("peer"))Q.warn("Component dependencies conflict detected. Retrying with --legacy-peer-deps..."),Q.start("Installing component dependencies with --legacy-peer-deps flag"),await N0(G,[G==="npm"?"install":"add",...K,"--legacy-peer-deps"],{cwd:Z})}),{retries:1}),Q.succeed("Component dependencies are installed")}if(V?.size){let Q=L0("Installing component devDependencies").start();await W1(()=>N0(G,[G==="npm"?"install":"add","-D",...V],{cwd:Z}).catch(async(X)=>{if(X.message.includes("peer"))Q.warn("Component devDependencies conflict detected. Retrying with --legacy-peer-deps..."),Q.start("Installing component devDependencies with --legacy-peer-deps flag"),await N0(G,[G==="npm"?"install":"add","-D",...V,"--legacy-peer-deps"],{cwd:Z})}),{retries:1}),Q.succeed("Component devDependencies are installed")}if(W.message!==void 0){if(W.message)console.log(W.message);return}process.exit(0)}import F0 from"chalk";import{Command as s1}from"commander";import*as a from"fs";import r1 from"http";import i1 from"open";import n1 from"ora";import p1 from"os";import*as k0 from"path";import{URL as o1}from"url";import*as D0 from"fs";import*as t from"path";import{fileURLToPath as c1}from"url";var l1=c1(import.meta.url),w0=t.dirname(l1);function a1(){let z=[t.join(w0,"..","templates","auth-template.html"),t.join(w0,"templates","auth-template.html"),t.join(process.cwd(),"node_modules","untitledui","templates","auth-template.html"),t.join(w0,"..","..","templates","auth-template.html")];for(let B of z)if(D0.existsSync(B))return B;throw new Error("Auth template file not found. Please ensure the CLI package is properly installed.")}function L1(){try{let z=a1();return D0.readFileSync(z,"utf-8")}catch(z){return console.warn("Warning: Using fallback auth template. Some styling may be missing."),`<!doctype html>
18
18
  <html lang="en">
19
19
  <head>
20
20
  <meta charset="UTF-8" />
@@ -63,27 +63,27 @@ Use ${A.cyan("--overwrite")} or ${A.cyan("-o")} flag to overwrite existing files
63
63
  </html>`}}function V1(){return L1().replace("{{TITLE}}","Authentication successful").replace("{{HEADING}}","Authentication successful").replace("{{DESCRIPTION}}","You can now close this tab and return to your terminal.").replace("{{AUTO_CLOSE_SCRIPT}}","<script>setTimeout(() => window.close(), 10000);</script>")}function y0(z){return L1().replace("{{TITLE}}","Authentication failed").replace("{{HEADING}}","Authentication failed").replace("{{DESCRIPTION}}",z).replace("{{AUTO_CLOSE_SCRIPT}}","")}var C0=k0.join(p1.homedir(),".untitledui"),x0=k0.join(C0,"config.json"),J1=new s1().name("login").description("authenticate with Untitled UI to access PRO components").action(async()=>{let z=n1("Starting authentication...").start();try{await t1(z),z.succeed("Authentication completed successfully!"),console.log(F0.green(`
64
64
  ✨ You can now access PRO components with the CLI!`)),process.exit(0)}catch(B){z.fail(`Authentication failed: ${B instanceof Error?B.message:B}`),process.exit(1)}});async function t1(z){return new Promise((B,Z)=>{let $=r1.createServer((q,U)=>{let L=new o1(q.url,"http://localhost");if(L.pathname==="/callback"){let M=L.searchParams.get("apiKey"),K=L.searchParams.get("error");if(K){U.writeHead(400,{"Content-Type":"text/html"}),U.end(y0(decodeURIComponent(K))),$.close(),Z(new Error(decodeURIComponent(K)));return}if(!M){U.writeHead(400,{"Content-Type":"text/html"}),U.end(y0("No Access Token received")),$.close(),Z(new Error("No Access Token received"));return}try{e1(M),U.writeHead(200,{"Content-Type":"text/html"}),U.end(V1()),$.close(),B()}catch(V){U.writeHead(500,{"Content-Type":"text/html"}),U.end(y0("Failed to save authentication data")),$.close(),Z(V)}}else U.writeHead(404),U.end("Not found")});$.listen(0,"localhost",()=>{let L=`https://www.untitledui.com/react/api/cli-auth?port=${$.address().port}`;z.text="Opening browser for authentication...",i1(L).catch((M)=>{console.log(F0.yellow(`
65
65
  Failed to open browser automatically: ${M.message}`)),console.log(F0.cyan(`Please manually open: ${L}
66
- `))}),z.text="Waiting for authentication in browser..."}),setTimeout(()=>{$.close(),Z(new Error("Authentication timeout. Please try again."))},300000)})}function e1(z){if(!a.existsSync(C0))a.mkdirSync(C0,{recursive:!0});let B={};if(a.existsSync(x0))try{B=JSON.parse(a.readFileSync(x0,"utf-8"))}catch{B={}}B.license=z,a.writeFileSync(x0,JSON.stringify(B,null,2),"utf-8")}import c0 from"async-retry";import J from"chalk";import{Command as X2}from"commander";import{execa as E0}from"execa";import*as x from"fs";import J0 from"ora";import U2 from"os";import*as y from"path";import B0 from"prompts";import{Project as W2}from"ts-morph";import z2 from"node-fetch";async function W0(z,B){try{let $=await z2("https://www.untitledui.com/react/api/components/example",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({example:z,key:B})});if(!$.ok){if($.status===401||$.status===403)return{type:"error",status:$.status,message:"PRO access required"};return console.error(`API error: ${$.status} - ${$.statusText}`),null}return await $.json()}catch($){return console.error($?.message||"Error fetching example data."),null}}import V0 from"async-retry";import w from"chalk";import{Command as B2}from"commander";import{execa as e}from"execa";import h0 from"fast-glob";import S from"fs";import K0 from"ora";import Q2 from"os";import*as v from"path";import v0 from"prompts";import{Project as Z2}from"ts-morph";import{fileURLToPath as $2}from"url";import*as A0 from"fs";import*as b1 from"path";function P0(z,B){let Z=b1.join(z,"package.json");if(!A0.existsSync(Z))return B;let $=JSON.parse(A0.readFileSync(Z,"utf-8")),q={...$.dependencies,...$.devDependencies},U=[];for(let L of B){let M=q[L];if(!M){U.push(L);continue}if(L==="tailwindcss"){let K=M.match(/\d+/);if((K?parseInt(K[0],10):0)<4)U.push(L)}}return U}import O0 from"chalk";import*as i from"fs";import*as _0 from"path";function g0(z){if(!i.existsSync(_0.resolve(z)))console.log(O0.red(`Error: CSS file not found at ${z}`)),process.exit(1);let B=i.readFileSync(_0.resolve(z),"utf-8"),Z=/(--color-[a-zA-Z-]+-\d{1,3}):\s*(rgb\([^)]+\))/g,$={},q;while((q=Z.exec(B))!==null)if(q[1]&&q[2])$[q[1]]=q[2];return $}function d0(z,B,Z){let $=_0.resolve(Z);if(!i.existsSync($)){console.log(O0.red(`Error: CSS file not found at ${$}`));return}let q=i.readFileSync($,"utf-8"),U=g0(Z),L={},M={};for(let[V,b]of Object.entries(U))if(V.startsWith(`--color-${z}-`)){let j=V.replace(`--color-${z}-`,"");L[j]=V}else if(V.startsWith(`--color-${B}-`)){let j=V.replace(`--color-${B}-`,"");M[j]=b}let K=!1;for(let[V,b]of Object.entries(L))if(M[V]){let j=M[V],I=new RegExp(`(${b}):\\s*rgb\\([^)]*\\);?`,"g");if(I.test(q))q=q.replace(I,`$1: ${j};`),K=!0;else console.log(O0.yellow(`No match found for ${b}`))}if(K)i.writeFileSync($,q,"utf-8")}var Y2=$2(import.meta.url),M1=v.dirname(Y2),q2=v.join(Q2.homedir(),".untitledui"),z0=v.join(q2,"config.json"),j1="vite",G1="nextjs",H1={[G1]:"Next.js",[j1]:"Vite"},d="",N={color:"",template:"",framework:void 0};if(S.existsSync(z0)){let z=JSON.parse(S.readFileSync(z0,"utf-8"));N.license=z.license}var f0=(z)=>{if(z.aborted)process.stdout.write("\x1B[?25h"),process.stdout.write(`
67
- `),process.exit(1)},I1=new B2().name("init").description("initialize a new project or adjust an existing one").argument("[directory]").usage("[directory] [options]").helpOption("-h, --help","display this help message.").option("--vite","initialize a Vite project.",!1).option("--nextjs","initialize a Next.js project.",!1).option("-o, --overwrite","overwrite existing files.",!1).option("--colors-list","show the colors list.",!1).option("-c, --color <color-name>","specify a color for the project.").action(async(z,B)=>{if(z)d=z;if(B){if(N.color=B.color,N.template=B.template,N.overwrite=B.overwrite,N.colorsList=B.colorsList,N.license=B.license||N.license,N.vite=B.vite,N.nextjs=B.nextjs,B.vite)N.framework=j1;if(B.nextjs)N.framework=G1}try{await m0(B),process.exit(0)}catch(Z){console.error(w.red(Z)),process.exit(1)}});async function m0(z,B=null){let Z=process.cwd(),$=S.existsSync(v.resolve(Z,"package.json")),q=v.resolve(v.join(M1,"../config/styles","theme.css")),U=g0(q??""),L=Array.from(new Set(Object.keys(U).map((b)=>b?.split("--color-")?.[1]?.replace(/-\d{1,3}/,"")))),M=K0().start(),K=await n(Z);if(N.license){if(!S.existsSync(z0)){let j=v.dirname(z0);S.mkdirSync(j,{recursive:!0}),S.writeFileSync(z0,JSON.stringify({license:N.license},null,2))}if(JSON.parse(S.readFileSync(z0,"utf-8")).license!==N.license)S.writeFileSync(z0,JSON.stringify({license:N.license},null,2))}if(!$){if(M.stop(),!d){let j=await v0({onState:f0,type:"text",name:"path",message:"What is your project named?",initial:"untitled-ui"});if(typeof j.path==="string")d=j.path.trim()}if(B)B.projectPath=d;let b=S.existsSync(v.resolve(v.posix.join(Z,d,"package.json")));if(S.existsSync(v.resolve(v.posix.join(Z,d)))&&b)M.fail(w.red("Directory already exists!")),process.exit(1);if(N.vite&&N.nextjs||!N.framework){let j=await v0({type:"select",name:"framework",onState:f0,message:`Which ${w.cyan("framework")} would you like to use?`,choices:Object.entries(H1).map(([I,G])=>({title:G,value:I}))});N.framework=j.framework}M.succeed("Framework is selected: "+w.green(H1[N.framework]))}else if(K?.framework==="other")M.fail("Unsupported project framework"),console.log(`Please refer to the documentation ${w.cyan("https://www.untitled.com/docs")} for supported frameworks or proceed with manual installation.`),process.exit(1);else if(K?.framework.startsWith("next")||K?.framework.startsWith("vite"))if(!B&&!K.tailwind.brandColor)M.succeed(w.yellow(`Detected ${Z1[K.framework]} project, proceeding with the setup...`));else M.stop();if(N.colorsList||!N.color&&!K?.tailwind.brandColor){let b=await v0({type:"select",name:"color",onState:f0,initial:z.color??"",message:`Which ${w.cyan("color")} would you like to use as the ${w.cyanBright("brand")} color?`,choices:L.map((j)=>({title:j,value:j}))});if(N.color=b.color,N.colorsList&&K)K.tailwind.brandColor=b.color}let V=v.posix.join(Z,d||"");if(d&&!$){let b=v.resolve(d);console.log(`
66
+ `))}),z.text="Waiting for authentication in browser..."}),setTimeout(()=>{$.close(),Z(new Error("Authentication timeout. Please try again."))},300000)})}function e1(z){if(!a.existsSync(C0))a.mkdirSync(C0,{recursive:!0});let B={};if(a.existsSync(x0))try{B=JSON.parse(a.readFileSync(x0,"utf-8"))}catch{B={}}B.license=z,a.writeFileSync(x0,JSON.stringify(B,null,2),"utf-8")}import c0 from"async-retry";import J from"chalk";import{Command as X3}from"commander";import{execa as E0}from"execa";import*as x from"fs";import J0 from"ora";import U3 from"os";import*as y from"path";import B0 from"prompts";import{Project as W3}from"ts-morph";import z3 from"node-fetch";async function W0(z,B){try{let $=await z3("https://www.untitledui.com/react/api/components/example",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({example:z,key:B})});if(!$.ok){if($.status===401||$.status===403)return{type:"error",status:$.status,message:"PRO access required"};return console.error(`API error: ${$.status} - ${$.statusText}`),null}return await $.json()}catch($){return console.error($?.message||"Error fetching example data."),null}}import V0 from"async-retry";import w from"chalk";import{Command as B3}from"commander";import{execa as e}from"execa";import h0 from"fast-glob";import S from"fs";import K0 from"ora";import Q3 from"os";import*as _ from"path";import _0 from"prompts";import{Project as Z3}from"ts-morph";import{fileURLToPath as $3}from"url";import*as A0 from"fs";import*as b1 from"path";function P0(z,B){let Z=b1.join(z,"package.json");if(!A0.existsSync(Z))return B;let $=JSON.parse(A0.readFileSync(Z,"utf-8")),q={...$.dependencies,...$.devDependencies},U=[];for(let L of B){let M=q[L];if(!M){U.push(L);continue}if(L==="tailwindcss"){let K=M.match(/\d+/);if((K?parseInt(K[0],10):0)<4)U.push(L)}}return U}import O0 from"chalk";import*as i from"fs";import*as v0 from"path";function g0(z){if(!i.existsSync(v0.resolve(z)))console.log(O0.red(`Error: CSS file not found at ${z}`)),process.exit(1);let B=i.readFileSync(v0.resolve(z),"utf-8"),Z=/(--color-[a-zA-Z-]+-\d{1,3}):\s*(rgb\([^)]+\))/g,$={},q;while((q=Z.exec(B))!==null)if(q[1]&&q[2])$[q[1]]=q[2];return $}function d0(z,B,Z){let $=v0.resolve(Z);if(!i.existsSync($)){console.log(O0.red(`Error: CSS file not found at ${$}`));return}let q=i.readFileSync($,"utf-8"),U=g0(Z),L={},M={};for(let[V,b]of Object.entries(U))if(V.startsWith(`--color-${z}-`)){let j=V.replace(`--color-${z}-`,"");L[j]=V}else if(V.startsWith(`--color-${B}-`)){let j=V.replace(`--color-${B}-`,"");M[j]=b}let K=!1;for(let[V,b]of Object.entries(L))if(M[V]){let j=M[V],I=new RegExp(`(${b}):\\s*rgb\\([^)]*\\);?`,"g");if(I.test(q))q=q.replace(I,`$1: ${j};`),K=!0;else console.log(O0.yellow(`No match found for ${b}`))}if(K)i.writeFileSync($,q,"utf-8")}var Y3=$3(import.meta.url),M1=_.dirname(Y3),q3=_.join(Q3.homedir(),".untitledui"),z0=_.join(q3,"config.json"),j1="vite",G1="nextjs",H1={[G1]:"Next.js",[j1]:"Vite"},d="",N={color:"",template:"",framework:void 0};if(S.existsSync(z0)){let z=JSON.parse(S.readFileSync(z0,"utf-8"));N.license=z.license}var f0=(z)=>{if(z.aborted)process.stdout.write("\x1B[?25h"),process.stdout.write(`
67
+ `),process.exit(1)},I1=new B3().name("init").description("initialize a new project or adjust an existing one").argument("[directory]").usage("[directory] [options]").helpOption("-h, --help","display this help message.").option("--vite","initialize a Vite project.",!1).option("--nextjs","initialize a Next.js project.",!1).option("-o, --overwrite","overwrite existing files.",!1).option("--colors-list","show the colors list.",!1).option("-c, --color <color-name>","specify a color for the project.").action(async(z,B)=>{if(z)d=z;if(B){if(N.color=B.color,N.template=B.template,N.overwrite=B.overwrite,N.colorsList=B.colorsList,N.license=B.license||N.license,N.vite=B.vite,N.nextjs=B.nextjs,B.vite)N.framework=j1;if(B.nextjs)N.framework=G1}try{await m0(B),process.exit(0)}catch(Z){console.error(w.red(Z)),process.exit(1)}});async function m0(z,B=null){let Z=process.cwd(),$=S.existsSync(_.resolve(Z,"package.json")),q=_.resolve(_.join(M1,"../config/styles","theme.css")),U=g0(q??""),L=Array.from(new Set(Object.keys(U).map((b)=>b?.split("--color-")?.[1]?.replace(/-\d{1,3}/,"")))),M=K0().start(),K=await n(Z);if(N.license){if(!S.existsSync(z0)){let j=_.dirname(z0);S.mkdirSync(j,{recursive:!0}),S.writeFileSync(z0,JSON.stringify({license:N.license},null,2))}if(JSON.parse(S.readFileSync(z0,"utf-8")).license!==N.license)S.writeFileSync(z0,JSON.stringify({license:N.license},null,2))}if(!$){if(M.stop(),!d){let j=await _0({onState:f0,type:"text",name:"path",message:"What is your project named?",initial:"untitled-ui"});if(typeof j.path==="string")d=j.path.trim()}if(B)B.projectPath=d;let b=S.existsSync(_.resolve(_.posix.join(Z,d,"package.json")));if(S.existsSync(_.resolve(_.posix.join(Z,d)))&&b)M.fail(w.red("Directory already exists!")),process.exit(1);if(N.vite&&N.nextjs||!N.framework){let j=await _0({type:"select",name:"framework",onState:f0,message:`Which ${w.cyan("framework")} would you like to use?`,choices:Object.entries(H1).map(([I,G])=>({title:G,value:I}))});N.framework=j.framework}M.succeed("Framework is selected: "+w.green(H1[N.framework]))}else if(K?.framework==="other")M.fail("Unsupported project framework"),console.log(`Please refer to the documentation ${w.cyan("https://www.untitled.com/docs")} for supported frameworks or proceed with manual installation.`),process.exit(1);else if(K?.framework.startsWith("next")||K?.framework.startsWith("vite"))if(!B&&!K.tailwind.brandColor)M.succeed(w.yellow(`Detected ${Z1[K.framework]} project, proceeding with the setup...`));else M.stop();if(N.colorsList||!N.color&&!K?.tailwind.brandColor){let b=await _0({type:"select",name:"color",onState:f0,initial:z.color??"",message:`Which ${w.cyan("color")} would you like to use as the ${w.cyanBright("brand")} color?`,choices:L.map((j)=>({title:j,value:j}))});if(N.color=b.color,N.colorsList&&K)K.tailwind.brandColor=b.color}let V=_.posix.join(Z,d||"");if(d&&!$){let b=_.resolve(d);console.log(`
68
68
  Creating a new project in ${w.blue(d)}`);let j=K0("Downloading and extracting the repository...").start();try{S.mkdirSync(b,{recursive:!0}),await V0(()=>i0(b,{template:N.framework}),{retries:2}),j.succeed("Files are downloaded and extracted successfully!");let I=K0({text:"Installing dependencies..."}).start(),G=h0.sync(["**/styles/theme.css"],{cwd:b,absolute:!0,onlyFiles:!0})[0];if(d0("brand",N.color||"",G??""),await V0(()=>e(F(),["install"],{cwd:V}).catch(async(Q)=>{if(Q.message.includes("peer"))I.warn("Dependency conflict detected. Retrying with --legacy-peer-deps..."),I.start("Installing dependencies with --legacy-peer-deps flag"),await e(F(),["install","--legacy-peer-deps"],{cwd:V})}),{retries:1}),await V0(()=>e("git",["init"],{cwd:V}),{retries:1}),I.succeed("Dependencies are installed"),!B)console.log(`
69
69
  Your project is ready, to get started run the following commands:
70
70
 
71
71
  cd ${w.cyan(d)}
72
72
  ${w.cyan(U1())}`)}catch(I){if(j.fail(w.red(`
73
73
  Failed to download and extract the repository`)),I instanceof Error)console.error(I.message);else console.error(`
74
- `);S.rmdirSync(b,{recursive:!0}),process.exit(1)}}else{let b=K0(),j=new Set,I=K?.examples||"",G=Y0(Z,I),Q=v.resolve(v.join(M1,"../config")),X=h0.sync(["**"],{cwd:Q,onlyFiles:!0,ignore:g}),H=P0(Z,["tailwindcss","tailwindcss-animate","@tailwindcss/typography","tailwindcss-react-aria-components"]),T=P0(Z,["@tailwindcss/postcss","postcss"]);if(!B&&!K?.tailwind.brandColor)b.start("Copying files to the project directory");if(X.forEach((R)=>{let u=R.includes("postcss.config"),E=v.posix.join(v.posix.join(Q),R),P=v.posix.join(Z,u?R:R0(R,K?.paths,K?.isSrcDir));if(S.existsSync(P)){if(N?.overwrite)S.copyFileSync(E,P);else{let O=S.readFileSync(P,"utf-8"),s=S.readFileSync(E,"utf-8");if(O!==s){if(R.endsWith("theme.css")&&K?.tailwind.brandColor)return;j.add({targetFile:P,sourceFile:E})}}return}S.mkdirSync(v.dirname(P),{recursive:!0}),S.writeFileSync(P,""),S.copyFileSync(E,P)}),b.stop(),j.size&&!N?.overwrite){if(console.log(`
75
- `),b.fail("Following files already exist in the directory."),j.forEach((u)=>{console.log(`- ${w.green(u.targetFile)}`)}),(await v0({type:"confirm",name:"overwrite",message:"Do you want to overwrite the existing files?",initial:!0})).overwrite){let u=K0("Overwriting files").start();j.forEach((E)=>{S.copyFileSync(E.sourceFile,E.targetFile)}),u.succeed("Files are overwritten")}}if(G?.tailwindFile)console.log(`
74
+ `);S.rmdirSync(b,{recursive:!0}),process.exit(1)}}else{let b=K0(),j=new Set,I=K?.examples||"",G=Y0(Z,I),Q=_.resolve(_.join(M1,"../config")),X=h0.sync(["**"],{cwd:Q,onlyFiles:!0,ignore:g}),H=P0(Z,["tailwindcss","tailwindcss-animate","@tailwindcss/typography","tailwindcss-react-aria-components"]),T=P0(Z,["@tailwindcss/postcss","postcss"]);if(!B&&!K?.tailwind.brandColor)b.start("Copying files to the project directory");if(X.forEach((R)=>{let u=R.includes("postcss.config"),E=_.posix.join(_.posix.join(Q),R),P=_.posix.join(Z,u?R:R0(R,K?.paths,K?.isSrcDir));if(S.existsSync(P)){if(N?.overwrite)S.copyFileSync(E,P);else{let O=S.readFileSync(P,"utf-8"),s=S.readFileSync(E,"utf-8");if(O!==s){if(R.endsWith("theme.css")&&K?.tailwind.brandColor)return;j.add({targetFile:P,sourceFile:E})}}return}S.mkdirSync(_.dirname(P),{recursive:!0}),S.writeFileSync(P,""),S.copyFileSync(E,P)}),b.stop(),j.size&&!N?.overwrite){if(console.log(`
75
+ `),b.fail("Following files already exist in the directory."),j.forEach((u)=>{console.log(`- ${w.green(u.targetFile)}`)}),(await _0({type:"confirm",name:"overwrite",message:"Do you want to overwrite the existing files?",initial:!0})).overwrite){let u=K0("Overwriting files").start();j.forEach((E)=>{S.copyFileSync(E.sourceFile,E.targetFile)}),u.succeed("Files are overwritten")}}if(G?.tailwindFile)console.log(`
76
76
  Tailwind config file exists in the project directory. You can add it to your globals.css as follows:`),console.log(`
77
- ${w.cyan(`@config "../${K?.isSrcDir?"../":""}${v.relative(Z,G.tailwindFile)}";`)}
77
+ ${w.cyan(`@config "../${K?.isSrcDir?"../":""}${_.relative(Z,G.tailwindFile)}";`)}
78
78
  `);if(K?.framework==="vite"){if(!X1(Z))console.log(`
79
79
  Tailwind CSS is not configured in your Vite project. Please refer to the documentation ${w.cyan("https://www.untitled.com/react/integrations/vite")} for manual installation.
80
- `)}let _=G?.layoutFile||G?.appFile||K?.framework==="vite"&&G?.mainFile||"";if(_){let u=new Z2({tsConfigFilePath:v.resolve(G?.tsConfig||"")}).addSourceFileAtPath(v.resolve(_)),E="styles/globals.css";if(!u.getImportDeclarations().some((O)=>{let s=O.getModuleSpecifierValue();return/(?:styles\/)?globals\.css$/.test(s)})){let O=K?.aliases?.styles||K?.aliases?.src||"",s=K?.aliases?.styles?`${O}globals.css`:`${O}styles/globals.css`;u.addImportDeclaration({moduleSpecifier:s})}u.saveSync()}let D=h0.sync(["**/theme.css"],{cwd:Z,absolute:!0,onlyFiles:!0,ignore:g});if(!D?.length)return b.fail(`Failed to copy ${w.cyan("theme.css")} file.
80
+ `)}let v=G?.layoutFile||G?.appFile||K?.framework==="vite"&&G?.mainFile||"";if(v){let u=new Z3({tsConfigFilePath:_.resolve(G?.tsConfig||"")}).addSourceFileAtPath(_.resolve(v)),E="styles/globals.css";if(!u.getImportDeclarations().some((O)=>{let s=O.getModuleSpecifierValue();return/(?:styles\/)?globals\.css$/.test(s)})){let O=K?.aliases?.styles||K?.aliases?.src||"",s=K?.aliases?.styles?`${O}globals.css`:`${O}styles/globals.css`;u.addImportDeclaration({moduleSpecifier:s})}u.saveSync()}let D=h0.sync(["**/theme.css"],{cwd:Z,absolute:!0,onlyFiles:!0,ignore:g});if(!D?.length)return b.fail(`Failed to copy ${w.cyan("theme.css")} file.
81
81
  Ensure that the ${w.cyan("theme.css")} file exists in the project directory under your ${w.yellow("styles")} folder.`);if((N.color||!K?.tailwind.brandColor)&&d0("brand",N.color||"brand",D[0]??""),H.length||T.length){let R=K0().start("Installing dependencies");H.length&&await V0(()=>e(F(),[F()==="npm"?"install":"add",...H],{cwd:V}).catch(async(u)=>{if(u.message.includes("peer"))R.warn("Dependency conflict detected. Retrying with --legacy-peer-deps..."),R.start("Installing dependencies with --legacy-peer-deps flag"),await e(F(),[F()==="npm"?"install":"add",...H,"--legacy-peer-deps"],{cwd:V})}),{retries:1}),T.length&&await V0(()=>e(F(),[F()==="npm"?"install":"add","-D",...T],{cwd:V}).catch(async(u)=>{if(u.message.includes("peer"))R.warn("DevDependency conflict detected. Retrying with --legacy-peer-deps..."),R.start("Installing dependencies with --legacy-peer-deps flag"),await e(F(),[F()==="npm"?"install":"add","-D",...T,"--legacy-peer-deps"],{cwd:V})}),{retries:1}),R.succeed("Dependencies are installed")}if(!B&&!K?.tailwind.brandColor)b.succeed(w.green("Project setup is completed!"));if(B&&$){M.stop(),b.stop();return}else console.log(`
82
- Your project is ready, you can now start adding components.`)}}var K2=y.join(U2.homedir(),".untitledui"),Z0=y.join(K2,"config.json"),Y={path:"",example:"",license:"",components:[]},l0={};if(x.existsSync(Z0)){let z=JSON.parse(x.readFileSync(Z0,"utf-8"));Y.license=z.license}var Q0=(z)=>{if(z.aborted)process.stdout.write("\x1B[?25h"),process.stdout.write(`
83
- `),process.exit(1)},R1=new X2().name("example").description("add an example to the project").argument("[example]","the example to add").option("-o, --overwrite","overwrite existing files.",!1).option("-p, --path <path>","the path to add the components to.").option("-e, --example-path <example-path>","the path to add the example file to.").option("--include-all-components","automatically include all components from the example without prompting.",!1).option("-y, --yes","non-interactive mode - use defaults for all prompts (for AI agents/CI).",!1).action(async(z,B)=>{if(z)Y.example=z;if(B){if(Y.path=B.path,Y.overwrite=B.overwrite,Y.examplePath=B.examplePath,Y.includeAllComponents=B.includeAllComponents,Y.yes=B.yes,Y.license=B.license||Y.license,B.yes)Y.includeAllComponents=!0,Y.overwrite=!0}try{await m0(B,l0),await L2()}catch(Z){console.error(J.red(Z))}});async function L2(){let z=J0().start(),B=y.posix.join(process.cwd(),l0?.projectPath||"");if(!x.existsSync(y.posix.join(y.resolve(B,"package.json"))))z.warn("This command should be run in a project directory."),process.exit(1);let $=await n(B);if(Y.license){if(!await b0(Y.license))z.fail("Invalid license key"),process.exit(1);if(!x.existsSync(Z0)){let H=y.dirname(Z0);x.mkdirSync(H,{recursive:!0}),x.writeFileSync(Z0,JSON.stringify({license:Y.license},null,2))}if(JSON.parse(x.readFileSync(Z0,"utf-8")).license!==Y.license)x.writeFileSync(Z0,JSON.stringify({license:Y.license},null,2),"utf-8")}if(z.stop(),!Y.example){if(Y.yes)console.error(J.red("Error: Example name is required in non-interactive mode.")),console.log(`Usage: ${J.cyan("npx untitledui example <example-name> --yes")}`),console.log(`Example: ${J.cyan("npx untitledui example dashboards-01/01 --yes")}`),process.exit(1);let Q=await B0({type:"select",name:"example",onState:Q0,message:"Select which type of example you want to add",choices:[{title:"Application",value:"application"},{title:"Marketing",value:"marketing"}]});Y.example=Q.example}let q=null;if(Y.example){let Q=await W0(Y.example,Y.license);if(Q?.type==="error"&&(Q.status===401||Q.status===403))console.log(),console.log(J.yellow(`\uD83D\uDD12 The ${J.cyan(Y.example)} example requires PRO access.`)),console.log(),console.log("To access PRO examples:"),console.log(` ${J.green("→")} If you've already purchased: ${J.cyan(`${X0()} untitledui@latest login`)}`),console.log(` ${J.green("→")} To purchase PRO examples: ${J.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1);if(Q?.type==="directory"){if(Y.yes)if(Q.results.length>0)Y.example=Q.results[0],console.log(J.yellow(`Auto-selecting: ${Y.example}`)),Q=await W0(Y.example,Y.license);else console.error(J.red("Error: No examples found in directory.")),process.exit(1);else{let X=await B0({type:"select",name:"example",onState:Q0,message:`Select a folder or file in "${Y.example}"`,choices:Q.results.map((H)=>({title:H,value:H}))});if(!X.example)return;Y.example=X.example,Q=await W0(X.example,Y.license)}if(Q?.type==="error"&&(Q.status===401||Q.status===403))console.log(),console.log(J.yellow(`\uD83D\uDD12 The ${J.cyan(Y.example)} example requires PRO access.`)),console.log(),console.log("To access PRO examples:"),console.log(` ${J.green("→")} If you've already purchased: ${J.cyan(`${X0()} untitledui@latest login`)}`),console.log(` ${J.green("→")} To purchase PRO examples: ${J.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1)}if(Q?.type==="json-files"){if(Y.yes)if(Q.results.length>0)Y.example=`${Y.example}/${Q.results[0]}`,console.log(J.yellow(`Auto-selecting: ${Y.example}`)),Q=await W0(Y.example,Y.license);else console.error(J.red("Error: No example files found.")),process.exit(1);else{let X=await B0({type:"select",name:"example",onState:Q0,message:`Select which example you want to add from "${Y.example}"`,choices:Q.results.map((H)=>({title:H,value:`${Y.example}/${H}`}))});if(!X.example)return;Y.example=X.example,Q=await W0(X.example,Y.license)}if(Q?.type==="error"&&(Q.status===401||Q.status===403))console.log(),console.log(J.yellow(`\uD83D\uDD12 The ${J.cyan(Y.example)} example requires PRO access.`)),console.log(),console.log("To access PRO examples:"),console.log(` ${J.green("→")} If you've already purchased: ${J.cyan(`${X0()} untitledui@latest login`)}`),console.log(` ${J.green("→")} To purchase PRO examples: ${J.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1)}if(Q?.type==="json-file")q=Q.content}if(!q)z.fail("No example found"),process.exit(1);let U=$?.examples||"";if(U){let Q=await n(y.posix.join(B,U));if(Q)$={...Q,aliases:$?.aliases||{}};Y.examplePath=U}if(!Y?.examplePath){let Q=$?.isAppDir?"app":"pages",X=$?.isSrcDir?y.posix.join("src",Q):Q;if(Y.yes)Y.examplePath=X,console.log(J.yellow(`Using default example path: ${X}`));else{let H=await B0({type:"text",name:"examplePath",onState:Q0,message:`Where would you like to add the ${J.cyan(Y?.example)} example?`,initial:X});Y.examplePath=H.examplePath}}if(Y.examplePath&&!x.existsSync(y.posix.join(B,Y.examplePath)))x.mkdirSync(y.posix.join(B,Y.examplePath),{recursive:!0}),console.log(J.green(`Created directory ${Y.examplePath}`));if(!Y?.path&&!$?.paths?.components)if(Y.yes)Y.path="components",console.log(J.yellow("Using default components path: components"));else{let Q=await B0({type:"text",name:"path",onState:Q0,message:`Where would you like to add the ${J.cyan("components")}?`,initial:"components"});Y.path=Q.path}if(Y?.path&&$?.paths&&!$.paths.components)$.paths.components=y.posix.join($?.isSrcDir?"src":"",Y.path);if(!Y?.path&&$?.paths?.components)Y.path=$.paths.components.replace(/^src\//,"");let L=q.components.filter((Q)=>!x.existsSync(y.posix.join(B,`${$?.isSrcDir?"src":""}`,Q?.path?.replace(/components\//,Y.path+"/"))));if(L?.length)if(Y.includeAllComponents)Y.components=L.map((Q)=>Q.name);else{let Q=await B0({type:"multiselect",name:"components",onState:Q0,message:`Select which components you want to add from ${J.cyan(q.name)} example`,choices:L.map((X)=>({title:X?.name,value:X?.name,selected:!0})),instructions:!1,hint:"- Space to select. Return to submit"});if(Y.components=Q.components,!L.length&&!Q.components?.length)z.warn("No components selected")}let M=Y0(B),K=new Set,V=new W2({tsConfigFilePath:M?.tsConfig}),b=J0(`Adding ${Y?.example}...`).start(),j="",I=new Set(q.components.filter((Q)=>Y.components?.includes(Q.name)).map((Q)=>y.dirname(Q.path)));try{for(let{path:Q,code:X}of q.files||[]){let H=y.dirname(Q);if(Array.from(I).some((E)=>H===E||H.startsWith(E+"/")))continue;let _=y.posix.join(B,`${$?.isSrcDir?"src":""}`,Q.replace(/components\//,Y.path+"/")),D=$?.framework==="vite"?X.replace(`"use client";
82
+ Your project is ready, you can now start adding components.`)}}var K3=y.join(U3.homedir(),".untitledui"),Z0=y.join(K3,"config.json"),Y={path:"",example:"",license:"",components:[]},l0={};if(x.existsSync(Z0)){let z=JSON.parse(x.readFileSync(Z0,"utf-8"));Y.license=z.license}var Q0=(z)=>{if(z.aborted)process.stdout.write("\x1B[?25h"),process.stdout.write(`
83
+ `),process.exit(1)},R1=new X3().name("example").description("add an example to the project").argument("[example]","the example to add").option("-o, --overwrite","overwrite existing files.",!1).option("-p, --path <path>","the path to add the components to.").option("-e, --example-path <example-path>","the path to add the example file to.").option("--include-all-components","automatically include all components from the example without prompting.",!1).option("-y, --yes","non-interactive mode - use defaults for all prompts (for AI agents/CI).",!1).action(async(z,B)=>{if(z)Y.example=z;if(B){if(Y.path=B.path,Y.overwrite=B.overwrite,Y.examplePath=B.examplePath,Y.includeAllComponents=B.includeAllComponents,Y.yes=B.yes,Y.license=B.license||Y.license,B.yes)Y.includeAllComponents=!0,Y.overwrite=!0}try{await m0(B,l0),await L3()}catch(Z){console.error(J.red(Z))}});async function L3(){let z=J0().start(),B=y.posix.join(process.cwd(),l0?.projectPath||"");if(!x.existsSync(y.posix.join(y.resolve(B,"package.json"))))z.warn("This command should be run in a project directory."),process.exit(1);let $=await n(B);if(Y.license){if(!await b0(Y.license))z.fail("Invalid license key"),process.exit(1);if(!x.existsSync(Z0)){let H=y.dirname(Z0);x.mkdirSync(H,{recursive:!0}),x.writeFileSync(Z0,JSON.stringify({license:Y.license},null,2))}if(JSON.parse(x.readFileSync(Z0,"utf-8")).license!==Y.license)x.writeFileSync(Z0,JSON.stringify({license:Y.license},null,2),"utf-8")}if(z.stop(),!Y.example){if(Y.yes)console.error(J.red("Error: Example name is required in non-interactive mode.")),console.log(`Usage: ${J.cyan("npx untitledui example <example-name> --yes")}`),console.log(`Example: ${J.cyan("npx untitledui example dashboards-01/01 --yes")}`),process.exit(1);let Q=await B0({type:"select",name:"example",onState:Q0,message:"Select which type of example you want to add",choices:[{title:"Application",value:"application"},{title:"Marketing",value:"marketing"}]});Y.example=Q.example}let q=null;if(Y.example){let Q=await W0(Y.example,Y.license);if(Q?.type==="error"&&(Q.status===401||Q.status===403))console.log(),console.log(J.yellow(`\uD83D\uDD12 The ${J.cyan(Y.example)} example requires PRO access.`)),console.log(),console.log("To access PRO examples:"),console.log(` ${J.green("→")} If you've already purchased: ${J.cyan(`${X0()} untitledui@latest login`)}`),console.log(` ${J.green("→")} To purchase PRO examples: ${J.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1);if(Q?.type==="directory"){if(Y.yes)if(Q.results.length>0)Y.example=Q.results[0]||"",console.log(J.yellow(`Auto-selecting: ${Y.example}`)),Q=await W0(Y.example,Y.license);else console.error(J.red("Error: No examples found in directory.")),process.exit(1);else{let X=await B0({type:"select",name:"example",onState:Q0,message:`Select a folder or file in "${Y.example}"`,choices:Q.results.map((H)=>({title:H,value:H}))});if(!X.example)return;Y.example=X.example,Q=await W0(X.example,Y.license)}if(Q?.type==="error"&&(Q.status===401||Q.status===403))console.log(),console.log(J.yellow(`\uD83D\uDD12 The ${J.cyan(Y.example)} example requires PRO access.`)),console.log(),console.log("To access PRO examples:"),console.log(` ${J.green("→")} If you've already purchased: ${J.cyan(`${X0()} untitledui@latest login`)}`),console.log(` ${J.green("→")} To purchase PRO examples: ${J.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1)}if(Q?.type==="json-files"){if(Y.yes)if(Q.results.length>0)Y.example=`${Y.example}/${Q.results[0]}`,console.log(J.yellow(`Auto-selecting: ${Y.example}`)),Q=await W0(Y.example,Y.license);else console.error(J.red("Error: No example files found.")),process.exit(1);else{let X=await B0({type:"select",name:"example",onState:Q0,message:`Select which example you want to add from "${Y.example}"`,choices:Q.results.map((H)=>({title:H,value:`${Y.example}/${H}`}))});if(!X.example)return;Y.example=X.example,Q=await W0(X.example,Y.license)}if(Q?.type==="error"&&(Q.status===401||Q.status===403))console.log(),console.log(J.yellow(`\uD83D\uDD12 The ${J.cyan(Y.example)} example requires PRO access.`)),console.log(),console.log("To access PRO examples:"),console.log(` ${J.green("→")} If you've already purchased: ${J.cyan(`${X0()} untitledui@latest login`)}`),console.log(` ${J.green("→")} To purchase PRO examples: ${J.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1)}if(Q?.type==="json-file")q=Q.content}if(!q)z.fail("No example found"),process.exit(1);let U=$?.examples||"";if(U){let Q=await n(y.posix.join(B,U));if(Q)$={...Q,aliases:$?.aliases||{}};Y.examplePath=U}if(!Y?.examplePath){let Q=$?.isAppDir?"app":"pages",X=$?.isSrcDir?y.posix.join("src",Q):Q;if(Y.yes)Y.examplePath=X,console.log(J.yellow(`Using default example path: ${X}`));else{let H=await B0({type:"text",name:"examplePath",onState:Q0,message:`Where would you like to add the ${J.cyan(Y?.example)} example?`,initial:X});Y.examplePath=H.examplePath}}if(Y.examplePath&&!x.existsSync(y.posix.join(B,Y.examplePath)))x.mkdirSync(y.posix.join(B,Y.examplePath),{recursive:!0}),console.log(J.green(`Created directory ${Y.examplePath}`));if(!Y?.path&&!$?.paths?.components)if(Y.yes)Y.path="components",console.log(J.yellow("Using default components path: components"));else{let Q=await B0({type:"text",name:"path",onState:Q0,message:`Where would you like to add the ${J.cyan("components")}?`,initial:"components"});Y.path=Q.path}if(Y?.path&&$?.paths&&!$.paths.components)$.paths.components=y.posix.join($?.isSrcDir?"src":"",Y.path);if(!Y?.path&&$?.paths?.components)Y.path=$.paths.components.replace(/^src\//,"");let L=q.components.filter((Q)=>!x.existsSync(y.posix.join(B,`${$?.isSrcDir?"src":""}`,Q?.path?.replace(/components\//,Y.path+"/"))));if(L?.length)if(Y.includeAllComponents)Y.components=L.map((Q)=>Q.name);else{let Q=await B0({type:"multiselect",name:"components",onState:Q0,message:`Select which components you want to add from ${J.cyan(q.name)} example`,choices:L.map((X)=>({title:X?.name,value:X?.name,selected:!0})),instructions:!1,hint:"- Space to select. Return to submit"});if(Y.components=Q.components,!L.length&&!Q.components?.length)z.warn("No components selected")}let M=Y0(B),K=new Set,V=new W3({tsConfigFilePath:M?.tsConfig}),b=J0(`Adding ${Y?.example}...`).start(),j="",I=new Set(q.components.filter((Q)=>Y.components?.includes(Q.name)).map((Q)=>y.dirname(Q.path)));try{for(let{path:Q,code:X}of q.files||[]){let H=y.dirname(Q);if(Array.from(I).some((E)=>H===E||H.startsWith(E+"/")))continue;let v=y.posix.join(B,`${$?.isSrcDir?"src":""}`,Q.replace(/components\//,Y.path+"/")),D=$?.framework==="vite"?X.replace(`"use client";
84
84
 
85
- `,""):X,R=I0(D);if(Q.includes("examples")){let E=y.basename(Q);_=y.posix.join(B,Y?.examplePath??"",E),j=y.posix.join(Y?.examplePath??"",E)}let u=y.dirname(_);if(x.existsSync(_)&&!Y.overwrite){if(x.readFileSync(_,"utf-8")!==R)K.add({code:R,path:_})}else{x.mkdirSync(u,{recursive:!0}),x.writeFileSync(_,R);let E=V.addSourceFileAtPath(y.resolve(_));E.getImportDeclarations().forEach((P)=>{let O=P.getModuleSpecifierValue();P.setModuleSpecifier(q0(O,Y.path,$?.aliases))}),await E.save()}}if(K.size)b.warn(`Some files of ${J.yellow(Y?.example)} already exist`);else b.succeed(`${J.green(Y?.example)} is added successfully`)}catch(Q){b.fail(`
85
+ `,""):X,R=I0(D);if(Q.includes("examples")){let E=y.basename(Q);v=y.posix.join(B,Y?.examplePath??"",E),j=y.posix.join(Y?.examplePath??"",E)}let u=y.dirname(v);if(x.existsSync(v)&&!Y.overwrite){if(x.readFileSync(v,"utf-8")!==R)K.add({code:R,path:v})}else{x.mkdirSync(u,{recursive:!0}),x.writeFileSync(v,R);let E=V.addSourceFileAtPath(y.resolve(v));E.getImportDeclarations().forEach((P)=>{let O=P.getModuleSpecifierValue();P.setModuleSpecifier(q0(O,Y.path,$?.aliases))}),await E.save()}}if(K.size)b.warn(`Some files of ${J.yellow(Y?.example)} already exist`);else b.succeed(`${J.green(Y?.example)} is added successfully`)}catch(Q){b.fail(`
86
86
  Failed to add the component ${J.red(Y?.example)}`),console.error(J.red(Q)),process.exit(1)}if(K.size&&!Y?.overwrite){console.log(`
87
87
  Following files already exist in the directory.`),K.forEach((X)=>{console.log(J.green(`- ${y.relative(B,X.path)}`))});let Q=!1;if(Y.yes)Q=!0,console.log(J.yellow("Auto-overwriting existing files (--yes mode)"));else{let X=await B0({type:"confirm",name:"overwrite",onState:Q0,message:"Do you want to overwrite the existing files?",initial:!0});if(X.overwrite===void 0)console.log(`
88
- Use ${J.cyan("--overwrite")} or ${J.cyan("-o")} flag to overwrite existing files, or run with ${J.cyan("node")} instead of ${J.cyan("bun")}.`),process.exit(1);Q=X.overwrite}if(Q){let X=J0("Overwriting files").start();K.forEach((H)=>{let T=V.addSourceFileAtPath(y.resolve(H.path));T.replaceWithText(H.code),T.getImportDeclarations().forEach((_)=>{let D=_.getModuleSpecifierValue();_.setModuleSpecifier(q0(D,Y.path,$?.aliases))}),T.saveSync()}),X.succeed("Files are overwritten")}}let G=F();if(q?.dependencies?.length){let Q=J0("Installing example dependencies").start();await c0(()=>E0(G,[G==="npm"?"install":"add",...q.dependencies],{cwd:B}).catch(async(X)=>{if(X.message.includes("peer"))Q.warn("Dependency conflict detected. Retrying with --legacy-peer-deps..."),Q.start("Installing dependencies with --legacy-peer-deps flag"),await E0(G,[G==="npm"?"install":"add",...q.dependencies,"--legacy-peer-deps"],{cwd:B})}),{retries:1}),Q.succeed("Example dependencies are installed")}if(q?.devDependencies?.length){let Q=J0("Installing example devDependencies").start();await c0(()=>E0(G,[G==="npm"?"install":"add","-D",...q.devDependencies],{cwd:B}).catch(async(X)=>{if(X.message.includes("peer"))Q.warn("DevDependency conflict detected. Retrying with --legacy-peer-deps..."),Q.start("Installing devDependencies with --legacy-peer-deps flag"),await E0(G,[G==="npm"?"install":"add","-D",...q.devDependencies,"--legacy-peer-deps"],{cwd:B})}),{retries:1}),Q.succeed("Example devDependencies are installed")}if(Y?.components?.length)await c0(()=>S0({components:Y.components,dir:l0?.projectPath||"",path:Y.path,message:""}),{retries:1});console.log(`
89
- \uD83C\uDF89 Example ${J.green(Y.example)} has been added to ${J.green(j)}`),process.exit(0)}var a0={name:"untitledui",version:"0.1.52",main:"dist/index.mjs",description:"The Untitled UI CLI tool helps you quickly scaffold projects with Untitled UI React and add components and page examples to your existing projects with an interactive interface in seconds.",type:"module",publishConfig:{access:"public"},scripts:{test:'echo "Error: no test specified" && exit 1',dev:"bun build --entrypoints ./index.ts --entry-naming=[name].mjs --outdir=dist --target=node --minify --packages=external --env=inline --define=process.env.API_URL=http://localhost:3000/react/api --watch",build:"bun build --entrypoints ./index.ts --entry-naming=[name].mjs --outdir=dist --target=node --minify --packages=external --env=inline --define=process.env.API_URL=https://www.untitledui.com/react/api","publish:npm":"bun run build && npm publish --access public",start:"node dist/index.mjs"},bugs:{url:"https://github.com/untitleduico/react/issues"},homepage:"https://github.com/untitleduico/react#readme",keywords:["untitledui","untitled-ui","untitledui","untitledui-cli","untitledui-react","untitledui-components","untitledui-examples","untitledui-vite","untitledui-nextjs","cli","tailwindcss","nextjs","react","components","examples","vite"],files:["dist","config","templates","README.md"],author:{name:"Untitled UI",url:"https://www.untitledui.com/react"},contributors:[{name:"Dilshod Turobov",url:"https://x.com/deebovv"},{name:"Jordan Hughes",url:"https://x.com/jordanphughes"}],license:"MIT",bin:{untitledui:"dist/index.mjs"},exports:"./dist/index.mjs",dependencies:{"async-retry":"^1.3.3",chalk:"^5.6.2",commander:"^13.1.0",execa:"^7.2.0","fast-glob":"^3.3.3","node-fetch":"^3.3.2",open:"^10.2.0",ora:"^8.2.0",prettier:"^3.7.4",prompts:"^2.4.2",tar:"^7.5.2","ts-morph":"^25.0.1","tsconfig-paths":"^4.2.0","update-check":"^1.5.4"},devDependencies:{"@types/async-retry":"^1.4.9","@types/prompts":"^2.4.9","@types/tar":"^6.1.13","type-fest":"^4.41.0",typescript:"^5.9.3"}};process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function b2(){let z=new J2().name(a0.name).version(a0.version);z.addCommand(I1).addCommand(K1).addCommand(R1).addCommand(J1),z.parse()}b2();
88
+ Use ${J.cyan("--overwrite")} or ${J.cyan("-o")} flag to overwrite existing files, or run with ${J.cyan("node")} instead of ${J.cyan("bun")}.`),process.exit(1);Q=X.overwrite}if(Q){let X=J0("Overwriting files").start();K.forEach((H)=>{let T=V.addSourceFileAtPath(y.resolve(H.path));T.replaceWithText(H.code),T.getImportDeclarations().forEach((v)=>{let D=v.getModuleSpecifierValue();v.setModuleSpecifier(q0(D,Y.path,$?.aliases))}),T.saveSync()}),X.succeed("Files are overwritten")}}let G=F();if(q?.dependencies?.length){let Q=J0("Installing example dependencies").start();await c0(()=>E0(G,[G==="npm"?"install":"add",...q.dependencies],{cwd:B}).catch(async(X)=>{if(X.message.includes("peer"))Q.warn("Dependency conflict detected. Retrying with --legacy-peer-deps..."),Q.start("Installing dependencies with --legacy-peer-deps flag"),await E0(G,[G==="npm"?"install":"add",...q.dependencies,"--legacy-peer-deps"],{cwd:B})}),{retries:1}),Q.succeed("Example dependencies are installed")}if(q?.devDependencies?.length){let Q=J0("Installing example devDependencies").start();await c0(()=>E0(G,[G==="npm"?"install":"add","-D",...q.devDependencies],{cwd:B}).catch(async(X)=>{if(X.message.includes("peer"))Q.warn("DevDependency conflict detected. Retrying with --legacy-peer-deps..."),Q.start("Installing devDependencies with --legacy-peer-deps flag"),await E0(G,[G==="npm"?"install":"add","-D",...q.devDependencies,"--legacy-peer-deps"],{cwd:B})}),{retries:1}),Q.succeed("Example devDependencies are installed")}if(Y?.components?.length)await c0(()=>S0({components:Y.components,dir:l0?.projectPath||"",path:Y.path,message:""}),{retries:1});console.log(`
89
+ \uD83C\uDF89 Example ${J.green(Y.example)} has been added to ${J.green(j)}`),process.exit(0)}var a0={name:"untitledui",version:"0.1.53",main:"dist/index.mjs",description:"The Untitled UI CLI tool helps you quickly scaffold projects with Untitled UI React and add components and page examples to your existing projects with an interactive interface in seconds.",type:"module",publishConfig:{access:"public"},scripts:{test:'echo "Error: no test specified" && exit 1',dev:"bun build --entrypoints ./index.ts --entry-naming=[name].mjs --outdir=dist --target=node --minify --packages=external --env=inline --define=process.env.API_URL=http://localhost:3000/react/api --watch",build:"bun build --entrypoints ./index.ts --entry-naming=[name].mjs --outdir=dist --target=node --minify --packages=external --env=inline --define=process.env.API_URL=https://www.untitledui.com/react/api","publish:npm":"bun run build && npm publish --access public",start:"node dist/index.mjs"},bugs:{url:"https://github.com/untitleduico/react/issues"},homepage:"https://github.com/untitleduico/react#readme",keywords:["untitledui","untitled-ui","untitledui","untitledui-cli","untitledui-react","untitledui-components","untitledui-examples","untitledui-vite","untitledui-nextjs","cli","tailwindcss","nextjs","react","components","examples","vite"],files:["dist","config","templates","README.md"],author:{name:"Untitled UI",url:"https://www.untitledui.com/react"},contributors:[{name:"Dilshod Turobov",url:"https://x.com/deebovv"},{name:"Jordan Hughes",url:"https://x.com/jordanphughes"}],license:"MIT",bin:{untitledui:"dist/index.mjs"},exports:"./dist/index.mjs",dependencies:{"async-retry":"^1.3.3",chalk:"^5.6.2",commander:"^13.1.0",execa:"^7.2.0","fast-glob":"^3.3.3","node-fetch":"^3.3.2",open:"^10.2.0",ora:"^8.2.0",prettier:"^3.7.4",prompts:"^2.4.2",tar:"^7.5.2","ts-morph":"^25.0.1","tsconfig-paths":"^4.2.0","update-check":"^1.5.4"},devDependencies:{"@types/async-retry":"^1.4.9","@types/prompts":"^2.4.9","@types/tar":"^6.1.13","type-fest":"^4.41.0",typescript:"^5.9.3"}};process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function b3(){let z=new J3().name(a0.name).version(a0.version);z.addCommand(I1).addCommand(K1).addCommand(R1).addCommand(J1),z.parse()}b3();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "untitledui",
3
- "version": "0.1.53",
3
+ "version": "0.1.54",
4
4
  "main": "dist/index.mjs",
5
5
  "description": "The Untitled UI CLI tool helps you quickly scaffold projects with Untitled UI React and add components and page examples to your existing projects with an interactive interface in seconds.",
6
6
  "type": "module",