create-lexy 0.3.1 → 0.5.0
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/assets/r/accordion.json +1 -1
- package/assets/r/alert-dialog.json +1 -1
- package/assets/r/app-accordion.json +1 -1
- package/assets/r/app-dialog.json +1 -1
- package/assets/r/app-header-bar.json +1 -1
- package/assets/r/app-sidebar.json +1 -1
- package/assets/r/avatar.json +1 -1
- package/assets/r/badge.json +1 -1
- package/assets/r/breadcrumb.json +1 -1
- package/assets/r/button-group.json +1 -1
- package/assets/r/button.json +1 -1
- package/assets/r/calendar.json +1 -1
- package/assets/r/card.json +1 -1
- package/assets/r/chart.json +1 -1
- package/assets/r/checkbox.json +1 -1
- package/assets/r/combobox.json +1 -1
- package/assets/r/command.json +1 -1
- package/assets/r/confirmacion.json +1 -1
- package/assets/r/counter-badge.json +1 -1
- package/assets/r/crm-app-layout.json +1 -1
- package/assets/r/crm-desk.json +1 -1
- package/assets/r/crm-detalle-caso.json +1 -1
- package/assets/r/date-picker.json +1 -1
- package/assets/r/dialog.json +1 -1
- package/assets/r/dropdown-menu.json +1 -1
- package/assets/r/empty.json +1 -1
- package/assets/r/feature-card.json +1 -1
- package/assets/r/form.json +1 -1
- package/assets/r/header-bar.json +1 -1
- package/assets/r/intake-wizard.json +1 -1
- package/assets/r/label.json +1 -1
- package/assets/r/login.json +1 -1
- package/assets/r/logo.json +1 -1
- package/assets/r/menubar.json +1 -1
- package/assets/r/navigation-menu.json +1 -1
- package/assets/r/pagination.json +1 -1
- package/assets/r/popover.json +1 -1
- package/assets/r/profile-card.json +1 -1
- package/assets/r/progress.json +1 -1
- package/assets/r/radio-group.json +1 -1
- package/assets/r/scroll-area.json +1 -1
- package/assets/r/searchbox.json +1 -1
- package/assets/r/select.json +1 -1
- package/assets/r/separator.json +1 -1
- package/assets/r/sheet.json +1 -1
- package/assets/r/sidebar.json +1 -1
- package/assets/r/skeleton.json +1 -1
- package/assets/r/slider.json +1 -1
- package/assets/r/snippet.json +1 -1
- package/assets/r/spinner.json +1 -1
- package/assets/r/status-dot.json +1 -1
- package/assets/r/switch.json +1 -1
- package/assets/r/table.json +1 -1
- package/assets/r/tabs.json +1 -1
- package/assets/r/tag.json +1 -1
- package/assets/r/textarea.json +1 -1
- package/assets/r/toaster.json +1 -1
- package/assets/r/tooltip.json +1 -1
- package/assets/r/tree.json +1 -1
- package/dist/index.js +219 -53
- package/package.json +1 -1
package/assets/r/tooltip.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"path": "components/base/Tooltip.tsx",
|
|
14
14
|
"type": "registry:ui",
|
|
15
15
|
"target": "components/base/Tooltip.tsx",
|
|
16
|
-
"content": "import * as
|
|
16
|
+
"content": "import * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils/cn\";\n\nconst TooltipProvider = TooltipPrimitive.Provider;\nconst Tooltip = TooltipPrimitive.Root;\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 overflow-hidden rounded bg-foreground px-3 py-1.5 text-xs text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n />\n </TooltipPrimitive.Portal>\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };\n"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"path": "components/base/Tooltip.md",
|
package/assets/r/tree.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"path": "components/base/Tree.tsx",
|
|
12
12
|
"type": "registry:ui",
|
|
13
13
|
"target": "components/base/Tree.tsx",
|
|
14
|
-
"content": "import * as React from \"react\";\n\nimport { cn } from \"@/lib/utils/cn\";\n\nconst DepthCtx = React.createContext(0);\n\nconst svgProps = {\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: \"2\",\n strokeLinecap: \"round\" as const,\n strokeLinejoin: \"round\" as const,\n};\n\nexport
|
|
14
|
+
"content": "import * as React from \"react\";\n\nimport { cn } from \"@/lib/utils/cn\";\n\nconst DepthCtx = React.createContext(0);\n\nconst svgProps = {\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: \"2\",\n strokeLinecap: \"round\" as const,\n strokeLinejoin: \"round\" as const,\n};\n\nexport type TreeProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport function Tree({ className, ...props }: TreeProps) {\n return (\n <div\n role=\"tree\"\n className={cn(\"w-full rounded-lg border border-border bg-background p-1\", className)}\n {...props}\n />\n );\n}\n\nexport interface TreeItemProps extends React.HTMLAttributes<HTMLDivElement> {\n label: React.ReactNode;\n kind?: \"folder\" | \"file\";\n defaultExpanded?: boolean;\n /** Sub-ítems anidados (solo tiene efecto en kind=\"folder\"). */\n children?: React.ReactNode;\n}\n\nconst TreeItem = React.forwardRef<HTMLDivElement, TreeItemProps>(function TreeItem(\n { label, kind = \"file\", defaultExpanded = false, children, className, ...props },\n ref,\n) {\n const depth = React.useContext(DepthCtx);\n const [expanded, setExpanded] = React.useState(defaultExpanded);\n const isFolder = kind === \"folder\";\n const hasChildren = Boolean(children);\n\n return (\n <div\n ref={ref}\n role=\"treeitem\"\n aria-expanded={isFolder ? expanded : undefined}\n aria-selected={false}\n className={className}\n {...props}\n >\n <div\n onClick={() => isFolder && setExpanded((value) => !value)}\n onKeyDown={(event) => {\n if (!isFolder) return;\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n setExpanded((value) => !value);\n }\n }}\n role={isFolder ? \"button\" : undefined}\n tabIndex={isFolder ? 0 : undefined}\n style={{ paddingLeft: depth * 16 + 8 }}\n className={cn(\n \"flex h-8 items-center gap-1.5 rounded pr-2 text-sm text-foreground transition-colors hover:bg-primary/15 hover:text-primary\",\n isFolder && \"cursor-pointer\",\n )}\n >\n {isFolder ? (\n <>\n <svg\n className={cn(\n \"h-4 w-4 flex-shrink-0 text-muted-foreground transition-transform\",\n expanded && \"rotate-90\",\n )}\n {...svgProps}\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n {expanded ? (\n <svg className=\"h-4 w-4 flex-shrink-0 text-primary\" {...svgProps}>\n <path d=\"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2\" />\n </svg>\n ) : (\n <svg className=\"h-4 w-4 flex-shrink-0 text-primary\" {...svgProps}>\n <path d=\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z\" />\n </svg>\n )}\n </>\n ) : (\n <>\n <span className=\"w-4 flex-shrink-0\" />\n <svg className=\"h-4 w-4 flex-shrink-0 text-muted-foreground\" {...svgProps}>\n <path d=\"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\" />\n <path d=\"M14 2v4a2 2 0 0 0 2 2h4\" />\n </svg>\n </>\n )}\n <span className=\"truncate\">{label}</span>\n </div>\n {isFolder && expanded && hasChildren && (\n <DepthCtx.Provider value={depth + 1}>\n <div role=\"group\">{children}</div>\n </DepthCtx.Provider>\n )}\n </div>\n );\n});\n\nTree.Item = TreeItem;\n\nexport { TreeItem };\n"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"path": "components/base/Tree.md",
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{readFileSync as
|
|
3
|
-
`)};import
|
|
4
|
-
`);if(process.stdout.isTTY&&process.stdin.isTTY){let l=await
|
|
2
|
+
import{readFileSync as Et}from"fs";import ke from"path";import{fileURLToPath as It}from"url";import{Command as Lt}from"commander";import kt from"picocolors";import{spawn as De}from"child_process";import K from"fs/promises";import B from"path";import{confirm as Me,isCancel as qe,spinner as fe}from"@clack/prompts";import h from"picocolors";import Y from"path";var Fe=(e,t)=>t.architecture!=="feature"?e:e.replace(/from ["']@\/lib\/utils\/cn["']/g,'from "@/shared/lib/utils/cn"').replace(/from ["']@\/components\/base\//g,'from "@/shared/components/base/'),Te=[["components/base/",e=>e.paths.components],["views/",e=>e.paths.views],["hooks/",e=>e.paths.hooks],["lib/",e=>e.paths.lib]],P=(e,t)=>e.files.filter(o=>typeof o.content=="string").map(o=>{let n=Te.find(([s])=>o.path.startsWith(s));return{relPath:n?Y.posix.join(n[1](t),o.path.slice(n[0].length)):Y.posix.join(t.paths.components,Y.posix.basename(o.path)),content:Fe(o.content,t)}});import ie from"fs/promises";import Se from"path";var ae=e=>Se.join(e,".lexy"),k=async e=>{let t;try{t=await ie.readFile(ae(e),"utf-8")}catch{throw new Error("No se encontr\xF3 el archivo .lexy. \xBFEst\xE1s en la ra\xEDz de un proyecto Lexy? (cr\xE9alo con `npx create-lexy create`)")}let o=JSON.parse(t);if(!o.paths?.components)throw new Error("El .lexy no tiene paths.components \u2014 archivo corrupto o de una versi\xF3n incompatible.");return o.installed??={},o},ce=async(e,t)=>{await ie.writeFile(ae(e),JSON.stringify(t,null,2)+`
|
|
3
|
+
`)};import M from"fs/promises";import Re from"os";import $ from"path";import{fileURLToPath as Oe}from"url";var le="@lexydesign/registry",O=`https://cdn.jsdelivr.net/npm/${le}`,Ae=8e3,H=$.resolve($.dirname(Oe(import.meta.url)),"../assets"),Ne=$.join(Re.homedir(),".cache","create-lexy","registry"),U=async e=>{let t=await fetch(e,{signal:AbortSignal.timeout(Ae)});if(!t.ok){let o=new Error(`HTTP ${t.status} al pedir ${e}`);throw o.status=t.status,o}return await t.json()},pe=async e=>{try{return JSON.parse(await M.readFile($.join(H,"r",e),"utf-8"))}catch{return null}},X=async()=>{try{return(await M.readFile($.join(H,"registry-version"),"utf-8")).trim()}catch{return"bundle"}},R=null,J=async()=>{if(R)return R;try{R=(await U(`https://registry.npmjs.org/${le}/latest`)).version}catch{try{R=(await U(`${O}@latest/package.json`)).version}catch{R=await X()}}return R},x=async(e,t)=>{let o=e.replace(/^@lexy\//,""),n=t??await J(),r=$.join(Ne,n,`${o}.json`);try{return{item:JSON.parse(await M.readFile(r,"utf-8")),version:n,source:"cache"}}catch{}try{let s=await U(`${O}@${n}/r/${o}.json`);return await M.mkdir($.dirname(r),{recursive:!0}),await M.writeFile(r,JSON.stringify(s)),{item:s,version:n,source:"cdn"}}catch(s){if(s.status===404)throw new Error(`El componente "${o}" no existe en el registry (versi\xF3n ${n}). Mira el cat\xE1logo con \`create-lexy view --list\`.`);let i=await pe(`${o}.json`);if(i)return{item:i,version:await X(),source:"bundle"};throw new Error(`No se pudo alcanzar el registry (\xBFsin red?) y "${o}" tampoco est\xE1 en el bundle local del CLI.`)}},de=async()=>{try{let e=await J();return{index:await U(`${O}@${e}/r/registry.json`),version:e,source:"cdn"}}catch{let e=await pe("registry.json");if(e)return{index:e,version:await X(),source:"bundle"};throw new Error("No se pudo alcanzar el registry ni leer el bundle local del CLI.")}},me=$.join(H,"theme/lexy-theme.css"),ue=$.join(H,"fonts");var _e=(e,t)=>new Promise((o,n)=>{De("pnpm",["add",...e],{cwd:t,stdio:"ignore",shell:!0}).on("close",s=>s===0?o():n(new Error(`pnpm add fall\xF3 con c\xF3digo ${s}`)))}),ze=async e=>{try{return await K.readFile(e,"utf-8")}catch{return null}},ge=async(e,t)=>{let o=process.cwd(),n=await k(o),r=fe();r.start("Resolviendo componentes en el registry...");let s=new Map,i=async a=>{let l=a.toLowerCase().replace(/^@lexy\//,"");if(s.has(l))return;let f=await x(l);s.set(l,f);for(let b of f.item.registryDependencies??[])await i(b)};try{for(let a of e)await i(a)}catch(a){throw r.stop(h.red("No se pudo resolver el pedido.")),a}let p=new Map;for(let[a,{item:l}]of s){let f=[];for(let b of P(l,n)){let L=await ze(B.join(o,b.relPath));f.push({...b,status:L===null?"new":L===b.content?"same":"differs"})}p.set(a,f)}let c=Array.from(p.values()).flat().filter(a=>a.status==="differs");if(r.stop(`Resueltos: ${Array.from(s.keys()).join(", ")}`),c.length>0&&!t.overwrite){let a=c.map(l=>` ${l.relPath}`).join(`
|
|
4
|
+
`);if(process.stdout.isTTY&&process.stdin.isTTY){let l=await Me({message:`Estos archivos existen con cambios locales y ser\xE1n sobrescritos:
|
|
5
5
|
${a}
|
|
6
|
-
\xBFContinuar?`});if(
|
|
6
|
+
\xBFContinuar?`});if(qe(l)||l!==!0){console.log(h.yellow("Operaci\xF3n cancelada \u2014 nada fue modificado.")),process.exitCode=1;return}}else{console.error(h.red(`Estos archivos existen con cambios locales:
|
|
7
7
|
`)+a+h.dim(`
|
|
8
|
-
Usa --overwrite para sobrescribirlos.`)),process.exitCode=1;return}}for(let[a,l]of
|
|
8
|
+
Usa --overwrite para sobrescribirlos.`)),process.exitCode=1;return}}for(let[a,l]of p){let{item:f,version:b,source:L}=s.get(a);for(let y of l){if(y.status==="same")continue;let C=B.join(o,y.relPath);await K.mkdir(B.dirname(C),{recursive:!0}),await K.writeFile(C,y.content)}n.installed[f.name]=b;let V=e.map(y=>y.toLowerCase()).includes(a)?"":h.dim(" (dependencia)"),D=L==="bundle"?h.yellow(" [bundle local \u2014 sin red]"):"";console.log(h.green(`${h.bold(f.title??f.name)} instalado`)+V+h.cyan(` \u2192 ${n.paths.components}/`)+D);for(let y of l){let C=y.status==="same"?h.dim(" (sin cambios)"):"";console.log(h.dim(` ${y.relPath}${C}`))}}await ce(o,n);let d=new Set;for(let{item:a}of s.values())for(let l of a.dependencies??[])d.add(l);let m=JSON.parse(await K.readFile(B.join(o,"package.json"),"utf-8")),g={...m.dependencies,...m.devDependencies},z=a=>{let l=a.lastIndexOf("@");return l>0?a.slice(0,l):a},u=Array.from(d).filter(a=>!g[z(a)]);if(u.length>0)if(t.install===!1)console.log(h.yellow(`Dependencias pendientes (inst\xE1lalas t\xFA): ${u.join(", ")}`));else{let a=fe();a.start(`Instalando dependencias: ${u.join(", ")}...`),await _e(u,o),a.stop("Dependencias instaladas.")}};import{spawn as ut}from"child_process";import{note as ft,outro as gt,spinner as yt}from"@clack/prompts";import v from"picocolors";import{cancel as Ve,intro as Ue,isCancel as He,select as he,text as Je}from"@clack/prompts";import xe from"picocolors";var Q=[{value:"screen",label:"Una pantalla o flujo corto",hint:"landing, formulario, demo \u2014 sin navegaci\xF3n entre secciones",architecture:"layer"},{value:"app",label:"Una app con secciones y navegaci\xF3n",hint:"dashboard, listados, detalle \u2014 varias vistas con router",architecture:"feature"}],ye=e=>Q.find(t=>t.value===e).architecture;var Be=`
|
|
9
9
|
###### ######
|
|
10
10
|
##::+#### ####+::##
|
|
11
11
|
#-..:+################+:..:#
|
|
@@ -20,33 +20,105 @@ Usa --overwrite para sobrescribirlos.`)),process.exitCode=1;return}}for(let[a,l]
|
|
|
20
20
|
...........:====:...........
|
|
21
21
|
......................
|
|
22
22
|
..............
|
|
23
|
-
`,
|
|
24
|
-
${
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
import
|
|
23
|
+
`,Z=e=>{He(e)&&(Ve("Operaci\xF3n cancelada por el usuario."),process.exit(0))},we=async e=>{console.clear(),Ue(`${xe.cyan(Be)}
|
|
24
|
+
${xe.bold(" Bienvenido al generador de proyectos Lexy")}`);let t=e;if(!t){let r=await Je({message:"\xBFCu\xE1l es el nombre de tu proyecto?",placeholder:"lexy-app",validate:s=>{if(!s||s.trim()==="")return"El nombre es obligatorio.";if(!/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(s))return"El nombre debe estar en min\xFAsculas, sin espacios ni caracteres especiales."}});Z(r),t=r}let o=await he({message:"\xBFPara qui\xE9n es este proyecto?",options:[{label:"Clientes de Lexy",value:"cliente",hint:"Producto de cara al cliente final"},{label:"Equipo interno / CRM",value:"crm",hint:"Herramienta densa para el equipo Lexy"},{label:"Ambos o a\xFAn no lo s\xE9",value:"mixto",hint:"Se decide por pantalla m\xE1s adelante"}],initialValue:"mixto"});Z(o);let n=await he({message:"\xBFC\xF3mo es lo que vas a construir?",options:Q.map(r=>({label:r.label,value:r.value,hint:r.hint})),initialValue:"app"});return Z(n),{projectName:t,architecture:ye(n),world:o}};import E from"fs/promises";import I from"path";var Ke={feature:["src/app","src/features","src/shared/assets","src/shared/components/base","src/shared/hooks","src/shared/services","src/shared/lib","src/shared/types"],layer:["src/assets","src/components/base","src/hooks","src/services","src/lib","src/types","src/views","src/stores"]},Ge="10.33.3",We=e=>{let t=e.architecture==="feature"?{"react-router":"^7.9.0"}:{};return JSON.stringify({name:e.projectName,private:!0,version:"0.0.0",type:"module",packageManager:`pnpm@${Ge}`,scripts:{dev:"vite",build:"tsc -b && vite build",preview:"vite preview",lint:"eslint .",format:"prettier --write ."},dependencies:{clsx:"^2.1.1",react:"^19.2.6","react-dom":"^19.2.6",...t,"tailwind-merge":"^3.3.1"},devDependencies:{"@babel/core":"^7.29.7","@eslint/js":"^10.0.1","@rolldown/plugin-babel":"^0.2.3","@tailwindcss/vite":"^4.3.0","@types/babel__core":"^7.20.5","@types/node":"^24.12.3","@types/react":"^19.2.14","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.0.1","babel-plugin-react-compiler":"^1.0.0",eslint:"^10.4.1","eslint-plugin-jsx-a11y":"^6.10.2","eslint-plugin-react-hooks":"^7.1.1","eslint-plugin-simple-import-sort":"^13.0.0",globals:"^17.6.0",prettier:"^3.8.4",tailwindcss:"^4.3.0",terser:"^5.48.0",typescript:"~5.9.3","typescript-eslint":"^8.61.0",vite:"^8.0.12"}},null,2)+`
|
|
25
|
+
`},Ye=`import path from "node:path";
|
|
26
|
+
|
|
27
|
+
import babel from "@rolldown/plugin-babel";
|
|
28
28
|
import tailwindcss from "@tailwindcss/vite";
|
|
29
|
+
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
|
|
30
|
+
import { defineConfig } from "vite";
|
|
29
31
|
|
|
30
32
|
export default defineConfig({
|
|
31
|
-
plugins: [
|
|
33
|
+
plugins: [
|
|
34
|
+
react(),
|
|
35
|
+
// React Compiler: memoizaci\xF3n autom\xE1tica. En Vite 8 (Rolldown) el plugin de
|
|
36
|
+
// React es oxc, as\xED que el compilador corre como preset de babel aparte.
|
|
37
|
+
babel({ presets: [reactCompilerPreset()] }),
|
|
38
|
+
tailwindcss(),
|
|
39
|
+
],
|
|
32
40
|
resolve: {
|
|
33
41
|
alias: {
|
|
34
42
|
"@": path.resolve(import.meta.dirname, "./src"),
|
|
35
43
|
},
|
|
36
44
|
},
|
|
45
|
+
build: {
|
|
46
|
+
// Limpieza mandatoria en producci\xF3n (biblia): sin console ni debugger en
|
|
47
|
+
// el bundle. Vite 8 (Rolldown) ignora esbuild.drop; se hace en el
|
|
48
|
+
// minificador.
|
|
49
|
+
minify: "terser",
|
|
50
|
+
terserOptions: {
|
|
51
|
+
compress: { drop_console: true, drop_debugger: true },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
37
54
|
});
|
|
38
|
-
`,
|
|
55
|
+
`,Xe=`import js from "@eslint/js";
|
|
56
|
+
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
57
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
|
58
|
+
import simpleImportSort from "eslint-plugin-simple-import-sort";
|
|
59
|
+
import globals from "globals";
|
|
60
|
+
import tseslint from "typescript-eslint";
|
|
61
|
+
|
|
62
|
+
export default tseslint.config(
|
|
63
|
+
{ ignores: ["dist"] },
|
|
64
|
+
{
|
|
65
|
+
files: ["**/*.{ts,tsx}"],
|
|
66
|
+
extends: [
|
|
67
|
+
js.configs.recommended,
|
|
68
|
+
tseslint.configs.recommended,
|
|
69
|
+
reactHooks.configs.flat.recommended,
|
|
70
|
+
jsxA11y.flatConfigs.recommended,
|
|
71
|
+
],
|
|
72
|
+
plugins: {
|
|
73
|
+
"simple-import-sort": simpleImportSort,
|
|
74
|
+
},
|
|
75
|
+
languageOptions: {
|
|
76
|
+
globals: globals.browser,
|
|
77
|
+
},
|
|
78
|
+
rules: {
|
|
79
|
+
"simple-import-sort/imports": "error",
|
|
80
|
+
"simple-import-sort/exports": "error",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
);
|
|
84
|
+
`,Qe=`{
|
|
85
|
+
"printWidth": 100
|
|
86
|
+
}
|
|
87
|
+
`,Ze=`pnpm-lock.yaml
|
|
88
|
+
src/lexy-theme.css
|
|
89
|
+
public/fonts/
|
|
90
|
+
dist/
|
|
91
|
+
`,et=`name: CI
|
|
92
|
+
|
|
93
|
+
on:
|
|
94
|
+
push:
|
|
95
|
+
branches: [main]
|
|
96
|
+
pull_request:
|
|
97
|
+
|
|
98
|
+
jobs:
|
|
99
|
+
ci:
|
|
100
|
+
runs-on: ubuntu-latest
|
|
101
|
+
steps:
|
|
102
|
+
- uses: actions/checkout@v4
|
|
103
|
+
- uses: pnpm/action-setup@v4
|
|
104
|
+
- uses: actions/setup-node@v4
|
|
105
|
+
with:
|
|
106
|
+
node-version: 22
|
|
107
|
+
cache: pnpm
|
|
108
|
+
- run: pnpm install --frozen-lockfile
|
|
109
|
+
- run: pnpm lint
|
|
110
|
+
- run: pnpm exec prettier --check .
|
|
111
|
+
- run: pnpm build
|
|
112
|
+
- run: pnpm audit --audit-level high
|
|
113
|
+
`,tt=`{
|
|
39
114
|
"files": [],
|
|
40
|
-
"references": [
|
|
41
|
-
{ "path": "./tsconfig.app.json" },
|
|
42
|
-
{ "path": "./tsconfig.node.json" }
|
|
43
|
-
],
|
|
115
|
+
"references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }],
|
|
44
116
|
"compilerOptions": {
|
|
45
117
|
"baseUrl": ".",
|
|
46
118
|
"paths": { "@/*": ["./src/*"] }
|
|
47
119
|
}
|
|
48
120
|
}
|
|
49
|
-
`,
|
|
121
|
+
`,ot=`{
|
|
50
122
|
"compilerOptions": {
|
|
51
123
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
52
124
|
"target": "ES2022",
|
|
@@ -70,7 +142,7 @@ export default defineConfig({
|
|
|
70
142
|
},
|
|
71
143
|
"include": ["src"]
|
|
72
144
|
}
|
|
73
|
-
`,
|
|
145
|
+
`,rt=`{
|
|
74
146
|
"compilerOptions": {
|
|
75
147
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
76
148
|
"target": "ES2023",
|
|
@@ -87,7 +159,7 @@ export default defineConfig({
|
|
|
87
159
|
},
|
|
88
160
|
"include": ["vite.config.ts"]
|
|
89
161
|
}
|
|
90
|
-
`,
|
|
162
|
+
`,nt=e=>`<!doctype html>
|
|
91
163
|
<html lang="es">
|
|
92
164
|
<head>
|
|
93
165
|
<meta charset="UTF-8" />
|
|
@@ -99,41 +171,73 @@ export default defineConfig({
|
|
|
99
171
|
<script type="module" src="/src/main.tsx"></script>
|
|
100
172
|
</body>
|
|
101
173
|
</html>
|
|
102
|
-
`,
|
|
174
|
+
`,st=`@import "tailwindcss";
|
|
103
175
|
@import "./lexy-theme.css";
|
|
104
|
-
`,
|
|
176
|
+
`,it=e=>e.architecture==="feature"?`import "./index.css";
|
|
177
|
+
|
|
178
|
+
import { StrictMode } from "react";
|
|
179
|
+
import { createRoot } from "react-dom/client";
|
|
180
|
+
import { BrowserRouter } from "react-router";
|
|
181
|
+
|
|
182
|
+
import { App } from "./app/App";
|
|
183
|
+
|
|
184
|
+
createRoot(document.getElementById("root")!).render(
|
|
185
|
+
<StrictMode>
|
|
186
|
+
<BrowserRouter>
|
|
187
|
+
<App />
|
|
188
|
+
</BrowserRouter>
|
|
189
|
+
</StrictMode>,
|
|
190
|
+
);
|
|
191
|
+
`:`import "./index.css";
|
|
192
|
+
|
|
193
|
+
import { StrictMode } from "react";
|
|
105
194
|
import { createRoot } from "react-dom/client";
|
|
106
|
-
|
|
107
|
-
import { App } from "
|
|
195
|
+
|
|
196
|
+
import { App } from "./views/App";
|
|
108
197
|
|
|
109
198
|
createRoot(document.getElementById("root")!).render(
|
|
110
199
|
<StrictMode>
|
|
111
200
|
<App />
|
|
112
201
|
</StrictMode>,
|
|
113
202
|
);
|
|
114
|
-
`,
|
|
115
|
-
return (
|
|
116
|
-
<main className="flex min-h-screen items-center justify-center bg-background text-foreground">
|
|
203
|
+
`,be=` <main className="flex min-h-screen items-center justify-center bg-background text-foreground">
|
|
117
204
|
<div className="text-center">
|
|
118
205
|
<h1 className="text-2xl font-semibold">Proyecto Lexy listo</h1>
|
|
119
206
|
<p className="mt-2 text-sm text-muted-foreground">
|
|
120
207
|
Trae tu primer componente: <code>npx create-lexy add button</code>
|
|
121
208
|
</p>
|
|
122
209
|
</div>
|
|
123
|
-
</main
|
|
210
|
+
</main>`,at=e=>e.architecture==="feature"?`import { Route, Routes } from "react-router";
|
|
211
|
+
|
|
212
|
+
const Home = () => {
|
|
213
|
+
return (
|
|
214
|
+
${be}
|
|
215
|
+
);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export const App = () => {
|
|
219
|
+
return (
|
|
220
|
+
<Routes>
|
|
221
|
+
<Route path="/" element={<Home />} />
|
|
222
|
+
</Routes>
|
|
223
|
+
);
|
|
224
|
+
};
|
|
225
|
+
`:`export const App = () => {
|
|
226
|
+
return (
|
|
227
|
+
${be}
|
|
124
228
|
);
|
|
125
229
|
};
|
|
126
|
-
`,
|
|
230
|
+
`,ct=`import { type ClassValue, clsx } from "clsx";
|
|
127
231
|
import { twMerge } from "tailwind-merge";
|
|
128
232
|
|
|
129
233
|
export function cn(...inputs: ClassValue[]) {
|
|
130
234
|
return twMerge(clsx(inputs));
|
|
131
235
|
}
|
|
132
|
-
`,
|
|
236
|
+
`,lt=`node_modules/
|
|
133
237
|
dist/
|
|
134
238
|
*.log
|
|
135
239
|
.env
|
|
136
|
-
`,
|
|
240
|
+
`,pt=e=>`# ${e.projectName}
|
|
137
241
|
|
|
138
242
|
Proyecto Lexy (React + Vite + TS + theme Lexy). Los componentes viven en tu proyecto: m\xEDralos con \`view\`, inst\xE1lalos con \`add\`, ed\xEDtalos con libertad.
|
|
139
243
|
|
|
@@ -143,31 +247,93 @@ npx create-lexy view button # ver un componente antes de instalarlo
|
|
|
143
247
|
npx create-lexy add button # instalarlo (local y editable)
|
|
144
248
|
npx create-lexy doctor # divergencia con el registry
|
|
145
249
|
\`\`\`
|
|
146
|
-
`,
|
|
147
|
-
`},
|
|
148
|
-
`),await
|
|
250
|
+
`,dt=e=>{let o=e.architecture==="feature"?"@/shared":"@";return JSON.stringify({$schema:"https://ui.shadcn.com/schema.json",style:"new-york",rsc:!1,tsx:!0,tailwind:{config:"",css:"src/index.css",baseColor:"neutral",cssVariables:!0},aliases:{components:`${o}/components`,ui:`${o}/components/base`,utils:`${o}/lib/utils/cn`,lib:`${o}/lib`,hooks:`${o}/hooks`},registries:{"@lexy":`${O}@latest/r/{name}.json`}},null,2)+`
|
|
251
|
+
`},mt=e=>{let t=e.architecture==="feature";return{version:"2.0.0",generatedAt:new Date().toISOString(),architecture:e.architecture,world:e.world,registry:{package:"@lexydesign/registry",cdn:O},componentImportPattern:t?"@/shared/components/base/{Component}":"@/components/base/{Component}",paths:{components:t?"src/shared/components/base":"src/components/base",hooks:t?"src/shared/hooks":"src/hooks",services:t?"src/shared/services":"src/services",lib:t?"src/shared/lib":"src/lib",views:t?"src/features":"src/views"},installed:{}}},ve=async(e,t)=>{let o=["package.json","src","index.html",".lexy"],n=[];for(let c of o)try{await E.access(I.join(t,c)),n.push(c)}catch{}if(n.length>0)throw new Error(`El directorio actual ya contiene archivos de un proyecto (${n.join(", ")}). Ejecuta el comando dentro de una carpeta vac\xEDa.`);for(let c of Ke[e.architecture])await E.mkdir(I.join(t,c),{recursive:!0});let r=(c,d)=>E.writeFile(I.join(t,c),d);await r("package.json",We(e)),await r("vite.config.ts",Ye),await r("tsconfig.json",tt),await r("tsconfig.app.json",ot),await r("tsconfig.node.json",rt),await r("eslint.config.js",Xe),await r(".prettierrc",Qe),await r(".prettierignore",Ze),await E.mkdir(I.join(t,".github/workflows"),{recursive:!0}),await r(".github/workflows/ci.yml",et),await r("index.html",nt(e)),await r(".gitignore",lt),await r("README.md",pt(e)),await r("src/index.css",st),await r("src/main.tsx",it(e));let s=e.architecture==="feature"?"src/app":"src/views";await r(`${s}/App.tsx`,at(e));let i=mt(e);await r(".lexy",JSON.stringify(i,null,2)+`
|
|
252
|
+
`),await r("components.json",dt(e)),await E.copyFile(me,I.join(t,"src/lexy-theme.css")),await E.mkdir(I.join(t,"public/fonts"),{recursive:!0}),await E.cp(ue,I.join(t,"public/fonts"),{recursive:!0});let p=I.join(t,i.paths.lib,"utils");await E.mkdir(p,{recursive:!0}),await E.writeFile(I.join(p,"cn.ts"),ct)};var ht=["feature","layer"],xt=["cliente","crm","mixto"],wt=e=>new Promise((t,o)=>{ut("pnpm",["install"],{cwd:e,stdio:"ignore",shell:!0}).on("close",r=>r===0?t():o(new Error(`pnpm install fall\xF3 con c\xF3digo ${r}`)))}),je=async(e,t)=>{let o;!!(e&&t.type)?(ht.includes(t.type)||(console.error(v.red(`Error: la arquitectura "${t.type}" no es v\xE1lida. Usa "feature" o "layer".`)),process.exit(1)),t.world&&!xt.includes(t.world)&&(console.error(v.red(`Error: el mundo "${t.world}" no es v\xE1lido. Usa "cliente", "crm" o "mixto".`)),process.exit(1)),t.world||console.warn(v.yellow('Aviso: sin --world; se asume "mixto". ')+v.dim("Pasa --world cliente|crm para fijar densidad y voz desde el inicio.")),o={projectName:e,architecture:t.type,world:t.world??"mixto"},console.log(v.blue("Modo automatizado detectado. Saltando interfaz interactiva..."))):o=await we(e),ft(`Nombre: ${o.projectName}
|
|
149
253
|
Arquitectura: ${o.architecture}
|
|
150
|
-
Mundo: ${o.world}`,"Configuraci\xF3n de Proyecto");let
|
|
151
|
-
|
|
152
|
-
`)+
|
|
153
|
-
`)+
|
|
154
|
-
`)+
|
|
155
|
-
`),
|
|
156
|
-
`),
|
|
157
|
-
`)};var
|
|
158
|
-
${
|
|
159
|
-
`));let
|
|
254
|
+
Mundo: ${o.world}`,"Configuraci\xF3n de Proyecto");let r=yt();r.start("Construyendo tu proyecto...");let s=process.cwd();try{await ve(o,s)}catch(i){throw r.stop(v.red("No se pudo crear el proyecto.")),i}t.install!==!1&&(r.message("Instalando dependencias base..."),await wt(s)),r.stop("\xA1Proyecto construido con \xE9xito!"),gt(v.green(`Todo listo en el directorio actual
|
|
255
|
+
|
|
256
|
+
`)+v.dim(`Siguientes pasos:
|
|
257
|
+
`)+v.cyan(` pnpm dev
|
|
258
|
+
`)+v.cyan(" npx create-lexy add button"))};import bt from"fs/promises";import vt from"path";import F from"picocolors";import ee from"picocolors";var q=(e,t)=>{let o=e.split(`
|
|
259
|
+
`),n=t.split(`
|
|
260
|
+
`),r=o.length,s=n.length,i=Array.from({length:r+1},()=>new Array(s+1).fill(0));for(let m=r-1;m>=0;m--)for(let g=s-1;g>=0;g--)i[m][g]=o[m]===n[g]?i[m+1][g+1]+1:Math.max(i[m+1][g],i[m][g+1]);let p=[],c=0,d=0;for(;c<r&&d<s;)o[c]===n[d]?(p.push({type:"same",text:o[c]}),c++,d++):i[c+1][d]>=i[c][d+1]?p.push({type:"del",text:o[c++]}):p.push({type:"add",text:n[d++]});for(;c<r;)p.push({type:"del",text:o[c++]});for(;d<s;)p.push({type:"add",text:n[d++]});return p},G=e=>e.some(t=>t.type!=="same"),Ce=(e,t=3)=>{if(!G(e))return null;let o=new Array(e.length).fill(!1);e.forEach((s,i)=>{if(s.type!=="same")for(let p=Math.max(0,i-t);p<=Math.min(e.length-1,i+t);p++)o[p]=!0});let n=[],r=!1;for(let s=0;s<e.length;s++){if(!o[s]){r||(n.push(ee.dim(" \u22EF")),r=!0);continue}r=!1;let i=e[s];i.type==="same"?n.push(` ${i.text}`):i.type==="del"?n.push(ee.red(`- ${i.text}`)):n.push(ee.green(`+ ${i.text}`))}return n.join(`
|
|
261
|
+
`)};var Pe=async e=>{let t=process.cwd(),o=await k(t),n=e.toLowerCase(),{item:r,version:s}=await x(n),i=o.installed[n];console.log(F.bold(`
|
|
262
|
+
${r.title??n}`)+F.dim(` \xB7 instalado con registry@${i??"?"} \xB7 vigente registry@${s}
|
|
263
|
+
`));let p=!1;for(let c of P(r,o)){let d=await bt.readFile(vt.join(t,c.relPath),"utf-8").catch(()=>null);if(d===null){console.log(F.red(`\u2717 ${c.relPath} no existe localmente`)+F.dim(` \u2014 cr\xE9alo con \`create-lexy add ${n}\``)),p=!0;continue}let m=Ce(q(d,c.content));m===null?console.log(F.green(`\u2713 ${c.relPath}`)+F.dim(" sin diferencias")):(p=!0,console.log(F.yellow(`\xB1 ${c.relPath}`)+F.dim(" (\u2212 local \xB7 + registry)")),console.log(m))}p&&(process.exitCode=1)};import A from"fs/promises";import S from"path";import j from"picocolors";var $e=async e=>{let t=process.cwd(),o=0,n=u=>console.log(j.green(" \u2713 ")+u),r=u=>console.log(j.yellow(" \u2022 ")+u),s=(u,a)=>{o=1,console.log(j.red(" \u2717 ")+u),a&&console.log(j.dim(` \u2192 ${a}`))};console.log(j.bold(`
|
|
160
264
|
Diagn\xF3stico del proyecto Lexy
|
|
161
|
-
`));let i;try{i=await
|
|
162
|
-
Sin componentes instalados a\xFAn (create-lexy add <nombre>).`));else{let
|
|
163
|
-
Componentes instalados (registry vigente: ${
|
|
164
|
-
`));for(let[a,l]of z){let
|
|
265
|
+
`));let i;try{i=await k(t),n(`.lexy v\xE1lido (arquitectura ${i.architecture}${i.world?`, mundo ${i.world}`:""})`)}catch(u){return s(u.message),1}await A.access(S.join(t,"src/lexy-theme.css")).then(()=>!0,()=>!1)?n("theme presente (src/lexy-theme.css)"):s("falta src/lexy-theme.css","re-cr\xE9alo desde un proyecto nuevo o copia el theme del registry");let c=S.join(i.paths.lib,"utils/cn.ts");await A.access(S.join(t,c)).then(()=>!0,()=>!1)?n(`helper cn presente (${c})`):s(`falta el helper cn (${c})`);let m=S.join(t,"ai/lexy-ai-manifest.json"),g=await A.readFile(m,"utf-8").catch(()=>null);if(g===null)console.log(j.dim(" \xB7 capa de IA no instalada (npx @lexydesign/ai install) \u2014 opcional"));else try{let u=JSON.parse(g),a=u.files??[],l=[];for(let f of a)await A.access(S.join(t,f)).then(()=>!0,()=>!1)||l.push(f);l.length>0?s(`capa de IA ${u.aiVersion??"?"} incompleta \u2014 faltan ${l.length} archivo(s) (${l.slice(0,3).join(", ")}${l.length>3?", \u2026":""})`,"npx @lexydesign/ai install"):n(`capa de IA ${u.aiVersion??"?"} completa (${a.length} archivos)`)}catch{s("ai/lexy-ai-manifest.json no es JSON v\xE1lido","regenera con `npx @lexydesign/ai install`")}let z=Object.entries(i.installed);if(z.length===0)console.log(j.dim(`
|
|
266
|
+
Sin componentes instalados a\xFAn (create-lexy add <nombre>).`));else{let u=await J();console.log(j.bold(`
|
|
267
|
+
Componentes instalados (registry vigente: ${u})
|
|
268
|
+
`));for(let[a,l]of z){let f;try{f=await x(a)}catch(y){s(`${a}: ${y.message}`);continue}let b=P(f.item,i),L=[],V=!1;for(let y of b){let C=await A.readFile(S.join(t,y.relPath),"utf-8").catch(()=>null);C===null?L.push(y.relPath):G(q(C,y.content))&&(V=!0)}if(L.length>0){s(`${a}: archivos faltantes (${L.join(", ")})`,`create-lexy add ${a}`);continue}if(!V){n(`${a} al d\xEDa (${f.version})`);continue}let D=!0;if(l&&l!==f.version)try{let y=await x(a,l),C=P(y.item,i);D=!1;for(let ne of C){let se=await A.readFile(S.join(t,ne.relPath),"utf-8").catch(()=>null);(se===null||G(q(se,ne.content)))&&(D=!0)}}catch{}D?e.strict?s(`${a}: editado localmente (difiere del registry vigente)`,`create-lexy diff ${a}`):r(`${a}: editado localmente \u2014 divergencia deliberada (m\xEDrala con \`create-lexy diff ${a}\`)`):s(`${a}: desactualizado (instalado con ${l}, vigente ${f.version})`,`create-lexy diff ${a} \xB7 create-lexy add ${a} --overwrite`)}}return console.log(o===0?j.green(`
|
|
165
269
|
Todo en orden.
|
|
166
|
-
`):
|
|
270
|
+
`):j.red(`
|
|
167
271
|
Hay problemas que atender (exit 1).
|
|
168
|
-
`)),o};import
|
|
272
|
+
`)),o};import te from"fs/promises";import Ee from"path";import{note as jt,outro as Ct}from"@clack/prompts";import oe from"picocolors";var W="LEXY-KICKOFF.md",Pt=`# Kickoff de proyecto Lexy \u2014 protocolo de entrevista
|
|
273
|
+
|
|
274
|
+
> **Para el agente (Claude Code):** este archivo es tu guion. La persona que
|
|
275
|
+
> tienes enfrente es **dise\xF1adora, no programadora**: no le preguntes por
|
|
276
|
+
> tecnolog\xEDa (arquitectura, router, layered/feature) \u2014 preg\xFAntale por la **forma
|
|
277
|
+
> de lo que quiere construir**. Conduce t\xFA la conversaci\xF3n; al final ejecutas el
|
|
278
|
+
> CLI por ella. Cuando termines, **borra este archivo**.
|
|
279
|
+
|
|
280
|
+
## 1. Entrevista (en lenguaje de producto, no t\xE9cnico)
|
|
281
|
+
|
|
282
|
+
Conversa hasta tener claridad real. No dispares todas las preguntas de golpe:
|
|
283
|
+
hazlas de a poco, repregunta y resume lo que entendiste. Cubre:
|
|
284
|
+
|
|
285
|
+
- **Qu\xE9 es** \u2014 en una o dos frases, \xBFqu\xE9 producto es y qu\xE9 problema resuelve?
|
|
286
|
+
- **Para qui\xE9n es** \u2014 \xBFlo usan **clientes de Lexy** (personas en un tr\xE1mite
|
|
287
|
+
legal, mundo *cliente*: calma, una idea por pantalla) o el **equipo interno /
|
|
288
|
+
CRM** (abogados trabajando, mundo *CRM*: densidad, escaneabilidad)? \xBFAmbos?
|
|
289
|
+
- **Forma del producto** \u2014 \xBFes **una pantalla o flujo corto** (una landing, un
|
|
290
|
+
formulario, una demo) o **una app con varias secciones y navegaci\xF3n** (un
|
|
291
|
+
dashboard, listados, vistas de detalle)?
|
|
292
|
+
- **Pantallas y flujos clave** \u2014 \xBFqu\xE9 vistas importan y qu\xE9 hace la persona en
|
|
293
|
+
cada una? \xBFC\xF3mo se mueve entre ellas?
|
|
294
|
+
- **Datos y referencias** \u2014 \xBFqu\xE9 datos maneja? \xBFHay un Figma, capturas o un
|
|
295
|
+
producto de referencia que mande sobre composiciones gen\xE9ricas?
|
|
296
|
+
|
|
297
|
+
## 2. Traducir las respuestas a flags (no se lo muestres a la persona)
|
|
298
|
+
|
|
299
|
+
| Lo que dijo la persona | Flag |
|
|
300
|
+
|---|---|
|
|
301
|
+
| Para clientes de Lexy | \`--world cliente\` |
|
|
302
|
+
| Para el equipo interno / CRM | \`--world crm\` |
|
|
303
|
+
| Para ambos o a\xFAn no est\xE1 claro | \`--world mixto\` |
|
|
304
|
+
| Una pantalla o flujo corto | \`--type layer\` |
|
|
305
|
+
| Una app con secciones y navegaci\xF3n | \`--type feature\` |
|
|
306
|
+
|
|
307
|
+
Elige tambi\xE9n un **nombre de proyecto** en kebab-case (min\xFAsculas, sin espacios),
|
|
308
|
+
derivado de lo que construye (ej. \`intake-divorcios\`, \`crm-casos\`).
|
|
309
|
+
|
|
310
|
+
## 3. Ejecutar (t\xFA, el agente \u2014 no la persona)
|
|
311
|
+
|
|
312
|
+
En **esta misma carpeta vac\xEDa**, corre:
|
|
313
|
+
|
|
314
|
+
\`\`\`bash
|
|
315
|
+
npx create-lexy create <nombre> --type <layer|feature> --world <cliente|crm|mixto>
|
|
316
|
+
npx @lexydesign/ai install
|
|
317
|
+
\`\`\`
|
|
318
|
+
|
|
319
|
+
## 4. Volcar la entrevista en el brief vivo
|
|
320
|
+
|
|
321
|
+
Abre \`ai/PROJECT-CONTEXT.md\` (lo cre\xF3 \`@lexydesign/ai install\`) y compl\xE9talo
|
|
322
|
+
con lo que recopilaste: **qu\xE9 se construye**, **para qui\xE9n**, **pantallas y
|
|
323
|
+
flujos clave**, **referencias** y **decisiones/restricciones** ya tomadas. Ese
|
|
324
|
+
archivo es el plan inicial del proyecto y la memoria de las pr\xF3ximas sesiones.
|
|
325
|
+
|
|
326
|
+
## 5. Cerrar
|
|
327
|
+
|
|
328
|
+
Borra este archivo (\`${W}\`): su trabajo termin\xF3. Conf\xEDrmale a la
|
|
329
|
+
persona que su proyecto est\xE1 listo y prop\xF3n el primer paso concreto
|
|
330
|
+
(p. ej. "\xBFDise\xF1amos la pantalla de inicio?").
|
|
331
|
+
`,Ie=async e=>{let t=process.cwd();for(let r of["package.json",".lexy"])if(await te.access(Ee.join(t,r)).then(()=>!0,()=>!1))throw new Error(`El directorio actual ya contiene un proyecto (${r}). \`kickoff\` es para empezar de cero en una carpeta vac\xEDa.`);let o=Ee.join(t,W);if(await te.access(o).then(()=>!0,()=>!1)&&!e.force)throw new Error(`${W} ya existe. Usa --force para regenerarlo.`);await te.writeFile(o,Pt),jt(`Se cre\xF3 ${oe.cyan(W)} en esta carpeta.
|
|
332
|
+
|
|
333
|
+
Abre la carpeta con Claude Code y di: `+oe.bold("\xABay\xFAdame a arrancar mi proyecto Lexy\xBB")+`.
|
|
334
|
+
El agente te entrevistar\xE1 y montar\xE1 el proyecto por ti.`,"Kickoff listo"),Ct(oe.green("Sin flags, sin prompts t\xE9cnicos \u2014 solo conversa con el agente."))};import $t from"fs/promises";import re from"path";import w from"picocolors";var _=e=>console.log(w.bold(w.cyan(`
|
|
169
335
|
\u2500\u2500 ${e} \u2500\u2500
|
|
170
|
-
`))),
|
|
171
|
-
${i.items.length} componente(s). Instala con: create-lexy add <nombre>`));return}let o=e.toLowerCase();if(t.installed){let i=process.cwd(),
|
|
172
|
-
`),console.log(w.dim("tipo: ")+
|
|
173
|
-
Error: `)+t.message),process.exit(1)}};
|
|
336
|
+
`))),Le=async(e,t)=>{if(t.list||!e){let{index:i,version:p,source:c}=await de();_(`Cat\xE1logo Lexy \xB7 @lexydesign/registry@${p}${c==="bundle"?" (bundle local)":""}`);for(let d of i.items)console.log(` ${w.bold(d.name.padEnd(20))} ${w.dim(d.description??"")}`);console.log(w.dim(`
|
|
337
|
+
${i.items.length} componente(s). Instala con: create-lexy add <nombre>`));return}let o=e.toLowerCase();if(t.installed){let i=process.cwd(),p=await k(i),c=p.installed[o];if(!c){console.error(w.red(`"${o}" no figura como instalado en .lexy. Inst\xE1lalo con \`create-lexy add ${o}\`.`)),process.exitCode=1;return}let{item:d}=await x(o,c).catch(()=>x(o));_(`${d.title??o} \xB7 copia local (instalado con registry@${c})`);for(let m of P(d,p)){let g=await $t.readFile(re.join(i,m.relPath),"utf-8").catch(()=>null);_(g===null?`${m.relPath} (FALTANTE)`:m.relPath),g!==null&&console.log(g)}return}let{item:n,version:r,source:s}=await x(o);_(`${n.title??n.name} \xB7 @lexydesign/registry@${r}${s==="bundle"?" (bundle local)":""}`),n.description&&console.log(n.description+`
|
|
338
|
+
`),console.log(w.dim("tipo: ")+n.type),console.log(w.dim("deps npm: ")+((n.dependencies??[]).join(", ")||"\u2014")),console.log(w.dim("deps registry: ")+((n.registryDependencies??[]).join(", ")||"\u2014")),console.log(w.dim("archivos: ")+n.files.map(i=>re.posix.basename(i.path)).join(", ")),console.log(w.dim("instalar: ")+`create-lexy add ${n.name}`);for(let i of n.files)typeof i.content=="string"&&(_(re.posix.basename(i.path)),console.log(i.content))};var Ft=ke.dirname(It(import.meta.url)),Tt=JSON.parse(Et(ke.join(Ft,"../package.json"),"utf-8")),T=new Lt,N=e=>async()=>{try{await e()}catch(t){console.error(kt.red(`
|
|
339
|
+
Error: `)+t.message),process.exit(1)}};T.name("create-lexy").description("CLI del Lexy Design System: crea proyectos y trae componentes a demanda.\nLos componentes viven en tu proyecto \u2014 m\xEDralos con `view`, inst\xE1lalos con `add`, ed\xEDtalos con libertad.").version(Tt.version);T.command("create",{isDefault:!0}).alias("init").description("Crea un proyecto Lexy vac\xEDo (React + Vite + TS + theme); los componentes llegan con `add`").argument("[project-name]","Nombre del proyecto").option("-t, --type <architecture>","Arquitectura (feature o layer) \u2014 activa el modo no interactivo").option("-w, --world <world>","Mundo de dise\xF1o (cliente, crm o mixto)").option("--no-install","No correr pnpm install al final").action((e,t)=>N(()=>je(e,t))());T.command("kickoff").description("Deja un .md de entrevista para que el agente conduzca el arranque de un dise\xF1ador (carpeta vac\xEDa)").option("--force","Regenerar el .md de kickoff si ya existe").action(e=>N(()=>Ie(e))());T.command("add").description("Instala componentes del registry en tu proyecto (local y editable), con sus dependencias").argument("<components...>","Nombres en el registry (ej: button card)").option("--overwrite","Sobrescribir copias locales con cambios sin preguntar").option("--no-install","No instalar dependencias npm").action((e,t)=>N(()=>ge(e,t))());T.command("view").description("Muestra c\xF3digo + doc + metadata de un componente antes de instalarlo").argument("[component]","Nombre en el registry (sin nombre: lista el cat\xE1logo)").option("--installed","Mostrar la copia local instalada en vez de la del registry").option("--list","Listar el cat\xE1logo completo").action((e,t)=>N(()=>Le(e,t))());T.command("diff").description("Copia local vs versi\xF3n vigente del registry (exit 1 si hay diferencias)").argument("<component>","Nombre en el registry").action(e=>N(()=>Pe(e))());T.command("doctor").description("Drift de todo lo instalado contra el registry (solo lectura; exit 1 con problemas)").option("--strict","Las ediciones locales tambi\xE9n hacen fallar").action(e=>N(async()=>{process.exitCode=await $e(e)})());T.parse(process.argv);
|