arckode-ui 0.1.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/LICENSE +21 -0
- package/README.md +170 -0
- package/dist/analyzer-Ctnj3WTI.js +424 -0
- package/dist/cli.js +581 -0
- package/dist/index.js +507 -0
- package/dist/router-DhUDyb8s.js +129 -0
- package/dist/vite.js +366 -0
- package/package.json +67 -0
- package/skills/analyzer/SKILL.md +128 -0
- package/skills/cli/SKILL.md +109 -0
- package/skills/compiler/SKILL.md +122 -0
- package/skills/components/SKILL.md +233 -0
- package/skills/runtime/SKILL.md +145 -0
- package/skills/testing/SKILL.md +169 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as a from "node:fs";
|
|
3
|
+
import * as n from "node:path";
|
|
4
|
+
import { a as C } from "./analyzer-Ctnj3WTI.js";
|
|
5
|
+
import { s as j } from "./router-DhUDyb8s.js";
|
|
6
|
+
const E = `import { defineConfig } from 'vite'
|
|
7
|
+
import { arkcodeUi } from 'arckode-ui/vite'
|
|
8
|
+
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
plugins: [arkcodeUi()],
|
|
11
|
+
})
|
|
12
|
+
`, x = `{
|
|
13
|
+
"compilerOptions": {
|
|
14
|
+
"target": "ESNext",
|
|
15
|
+
"module": "ESNext",
|
|
16
|
+
"moduleResolution": "bundler",
|
|
17
|
+
"strict": true,
|
|
18
|
+
"lib": ["ESNext", "DOM"],
|
|
19
|
+
"skipLibCheck": true
|
|
20
|
+
},
|
|
21
|
+
"include": ["src"]
|
|
22
|
+
}
|
|
23
|
+
`, S = (e) => `{
|
|
24
|
+
"name": "${e}",
|
|
25
|
+
"version": "0.0.1",
|
|
26
|
+
"type": "module",
|
|
27
|
+
"scripts": {
|
|
28
|
+
"dev": "vite",
|
|
29
|
+
"build": "vite build",
|
|
30
|
+
"preview": "vite preview"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"arckode-ui": "latest"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"typescript": "^5.4.0",
|
|
37
|
+
"vite": "^5.4.0",
|
|
38
|
+
"tailwindcss": "^3.4.0",
|
|
39
|
+
"autoprefixer": "^10.4.0",
|
|
40
|
+
"postcss": "^8.4.0"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`, P = `/** @type {import('tailwindcss').Config} */
|
|
44
|
+
export default {
|
|
45
|
+
content: [
|
|
46
|
+
'./index.html',
|
|
47
|
+
'./src/**/*.{ark,ts}',
|
|
48
|
+
],
|
|
49
|
+
theme: {
|
|
50
|
+
extend: {},
|
|
51
|
+
},
|
|
52
|
+
plugins: [],
|
|
53
|
+
}
|
|
54
|
+
`, N = `export default {
|
|
55
|
+
plugins: {
|
|
56
|
+
tailwindcss: {},
|
|
57
|
+
autoprefixer: {},
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
`, A = `@tailwind base;
|
|
61
|
+
@tailwind components;
|
|
62
|
+
@tailwind utilities;
|
|
63
|
+
`, I = `node_modules/
|
|
64
|
+
dist/
|
|
65
|
+
.env
|
|
66
|
+
.env.local
|
|
67
|
+
`, L = `<template>
|
|
68
|
+
<div class="home-page">
|
|
69
|
+
<h1>Bienvenido a {{ props.title }}</h1>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<script lang="ts">
|
|
74
|
+
import { defineComponent, signal } from 'arckode-ui'
|
|
75
|
+
|
|
76
|
+
export default defineComponent({
|
|
77
|
+
name: 'HomePage',
|
|
78
|
+
|
|
79
|
+
props: {},
|
|
80
|
+
|
|
81
|
+
emits: [],
|
|
82
|
+
|
|
83
|
+
setup(props, { emit }) {
|
|
84
|
+
return {
|
|
85
|
+
state: {},
|
|
86
|
+
computed: {},
|
|
87
|
+
actions: {},
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
|
+
<\/script>
|
|
92
|
+
|
|
93
|
+
<style scoped>
|
|
94
|
+
.home-page {}
|
|
95
|
+
</style>
|
|
96
|
+
`, T = `<template>
|
|
97
|
+
<div class="min-h-screen bg-white">
|
|
98
|
+
<slot />
|
|
99
|
+
</div>
|
|
100
|
+
</template>
|
|
101
|
+
|
|
102
|
+
<script lang="ts">
|
|
103
|
+
import { defineComponent } from 'arckode-ui'
|
|
104
|
+
import '../styles/global.css'
|
|
105
|
+
|
|
106
|
+
export default defineComponent({
|
|
107
|
+
name: 'RootLayout',
|
|
108
|
+
|
|
109
|
+
props: {},
|
|
110
|
+
|
|
111
|
+
emits: [],
|
|
112
|
+
|
|
113
|
+
setup(props, { emit }) {
|
|
114
|
+
return {
|
|
115
|
+
state: {},
|
|
116
|
+
computed: {},
|
|
117
|
+
actions: {},
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
})
|
|
121
|
+
<\/script>
|
|
122
|
+
`;
|
|
123
|
+
function _(e, t = {}) {
|
|
124
|
+
const s = t.cwd ?? process.cwd(), o = n.join(s, e), i = [
|
|
125
|
+
// Pages
|
|
126
|
+
{ path: n.join(o, "src", "pages", "index.ark"), content: L },
|
|
127
|
+
{ path: n.join(o, "src", "pages", "_layout.ark"), content: T },
|
|
128
|
+
// Empty dirs represented by .gitkeep
|
|
129
|
+
{ path: n.join(o, "src", "components", "ui", ".gitkeep"), content: "" },
|
|
130
|
+
{ path: n.join(o, "src", "components", "features", ".gitkeep"), content: "" },
|
|
131
|
+
{ path: n.join(o, "src", "stores", ".gitkeep"), content: "" },
|
|
132
|
+
{ path: n.join(o, "src", "services", ".gitkeep"), content: "" },
|
|
133
|
+
{ path: n.join(o, "src", "types", ".gitkeep"), content: "" },
|
|
134
|
+
{ path: n.join(o, "src", "shared", "helpers", ".gitkeep"), content: "" },
|
|
135
|
+
{ path: n.join(o, "src", "shared", "constants", ".gitkeep"), content: "" },
|
|
136
|
+
// Public
|
|
137
|
+
{ path: n.join(o, "public", ".gitkeep"), content: "" },
|
|
138
|
+
// Styles — Tailwind entry point
|
|
139
|
+
{ path: n.join(o, "src", "styles", "global.css"), content: A },
|
|
140
|
+
// Config files
|
|
141
|
+
{ path: n.join(o, "vite.config.ts"), content: E },
|
|
142
|
+
{ path: n.join(o, "tsconfig.json"), content: x },
|
|
143
|
+
{ path: n.join(o, "tailwind.config.js"), content: P },
|
|
144
|
+
{ path: n.join(o, "postcss.config.js"), content: N },
|
|
145
|
+
{ path: n.join(o, "package.json"), content: S(e) },
|
|
146
|
+
{ path: n.join(o, ".gitignore"), content: I }
|
|
147
|
+
];
|
|
148
|
+
if (!t.dryRun) {
|
|
149
|
+
if (a.existsSync(o))
|
|
150
|
+
throw new h(
|
|
151
|
+
`El directorio "${o}" ya existe. Confirmá si querés continuar.`
|
|
152
|
+
);
|
|
153
|
+
for (const r of i) {
|
|
154
|
+
const c = n.dirname(r.path);
|
|
155
|
+
a.existsSync(c) || a.mkdirSync(c, { recursive: !0 }), a.writeFileSync(r.path, r.content, "utf-8");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return { projectDir: o, files: i };
|
|
159
|
+
}
|
|
160
|
+
class h extends Error {
|
|
161
|
+
constructor(t) {
|
|
162
|
+
super(t), this.name = "NewProjectError";
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function O(e) {
|
|
166
|
+
const t = u(e);
|
|
167
|
+
return `<template>
|
|
168
|
+
<div class="${t}">
|
|
169
|
+
<!-- template aquí -->
|
|
170
|
+
</div>
|
|
171
|
+
</template>
|
|
172
|
+
|
|
173
|
+
<script lang="ts">
|
|
174
|
+
import { defineComponent, signal, computed } from 'arckode-ui'
|
|
175
|
+
|
|
176
|
+
export default defineComponent({
|
|
177
|
+
name: '${e}',
|
|
178
|
+
|
|
179
|
+
props: {
|
|
180
|
+
// definir props aquí
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
emits: [],
|
|
184
|
+
|
|
185
|
+
setup(props, { emit }) {
|
|
186
|
+
// 1. signals
|
|
187
|
+
// 2. computed
|
|
188
|
+
// 3. lifecycle hooks
|
|
189
|
+
// 4. watch
|
|
190
|
+
// 5. actions
|
|
191
|
+
|
|
192
|
+
return {
|
|
193
|
+
state: {},
|
|
194
|
+
computed: {},
|
|
195
|
+
actions: {},
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
})
|
|
199
|
+
<\/script>
|
|
200
|
+
|
|
201
|
+
<style scoped>
|
|
202
|
+
.${t} {
|
|
203
|
+
}
|
|
204
|
+
</style>
|
|
205
|
+
`;
|
|
206
|
+
}
|
|
207
|
+
function R(e) {
|
|
208
|
+
const s = (e.split("/").pop() ?? e).replace(/[\[\]\.]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, ""), o = v(s) + "Page", i = u(o);
|
|
209
|
+
return `<template>
|
|
210
|
+
<div class="${i}">
|
|
211
|
+
<!-- template aquí -->
|
|
212
|
+
</div>
|
|
213
|
+
</template>
|
|
214
|
+
|
|
215
|
+
<script lang="ts">
|
|
216
|
+
import { defineComponent, signal, computed } from 'arckode-ui'
|
|
217
|
+
|
|
218
|
+
export default defineComponent({
|
|
219
|
+
name: '${o}',
|
|
220
|
+
|
|
221
|
+
props: {},
|
|
222
|
+
|
|
223
|
+
emits: [],
|
|
224
|
+
|
|
225
|
+
setup(props, { emit }) {
|
|
226
|
+
// 1. signals
|
|
227
|
+
// 2. computed
|
|
228
|
+
// 3. lifecycle hooks
|
|
229
|
+
// 4. watch
|
|
230
|
+
// 5. actions
|
|
231
|
+
|
|
232
|
+
return {
|
|
233
|
+
state: {},
|
|
234
|
+
computed: {},
|
|
235
|
+
actions: {},
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
})
|
|
239
|
+
<\/script>
|
|
240
|
+
|
|
241
|
+
<style scoped>
|
|
242
|
+
.${i} {
|
|
243
|
+
}
|
|
244
|
+
</style>
|
|
245
|
+
`;
|
|
246
|
+
}
|
|
247
|
+
function G(e) {
|
|
248
|
+
return `import { defineStore, signal, computed } from 'arckode-ui'
|
|
249
|
+
|
|
250
|
+
export const ${`use${m(e)}Store`} = defineStore('${e}', {
|
|
251
|
+
state: {
|
|
252
|
+
// signals aquí
|
|
253
|
+
},
|
|
254
|
+
|
|
255
|
+
getters: {
|
|
256
|
+
// computed aquí
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
actions: {
|
|
260
|
+
// funciones aquí
|
|
261
|
+
},
|
|
262
|
+
})
|
|
263
|
+
`;
|
|
264
|
+
}
|
|
265
|
+
function z(e) {
|
|
266
|
+
const t = `${m(e)}Service`, s = u(e);
|
|
267
|
+
return `import { createService } from 'arckode-ui'
|
|
268
|
+
|
|
269
|
+
export const ${t} = createService({
|
|
270
|
+
baseUrl: '/api/${s}s',
|
|
271
|
+
|
|
272
|
+
// async getById(id: string) {
|
|
273
|
+
// return this.get(\`/\${id}\`)
|
|
274
|
+
// },
|
|
275
|
+
})
|
|
276
|
+
`;
|
|
277
|
+
}
|
|
278
|
+
function F(e) {
|
|
279
|
+
const t = `${v(e)}Layout`, s = u(t);
|
|
280
|
+
return `<template>
|
|
281
|
+
<div class="${s}">
|
|
282
|
+
<slot />
|
|
283
|
+
</div>
|
|
284
|
+
</template>
|
|
285
|
+
|
|
286
|
+
<script lang="ts">
|
|
287
|
+
import { defineComponent } from 'arckode-ui'
|
|
288
|
+
|
|
289
|
+
export default defineComponent({
|
|
290
|
+
name: '${t}',
|
|
291
|
+
|
|
292
|
+
props: {},
|
|
293
|
+
|
|
294
|
+
emits: [],
|
|
295
|
+
|
|
296
|
+
setup(props, { emit }) {
|
|
297
|
+
return {
|
|
298
|
+
state: {},
|
|
299
|
+
computed: {},
|
|
300
|
+
actions: {},
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
})
|
|
304
|
+
<\/script>
|
|
305
|
+
|
|
306
|
+
<style scoped>
|
|
307
|
+
.${s} {
|
|
308
|
+
}
|
|
309
|
+
</style>
|
|
310
|
+
`;
|
|
311
|
+
}
|
|
312
|
+
function u(e) {
|
|
313
|
+
return e.replace(/([A-Z])/g, (t, s) => s === 0 ? t.toLowerCase() : `-${t.toLowerCase()}`).replace(/^-/, "");
|
|
314
|
+
}
|
|
315
|
+
function m(e) {
|
|
316
|
+
return e && e.charAt(0).toUpperCase() + e.slice(1);
|
|
317
|
+
}
|
|
318
|
+
function v(e) {
|
|
319
|
+
return e.split(/[-_\s]+/).map((t) => m(t)).join("");
|
|
320
|
+
}
|
|
321
|
+
const D = {
|
|
322
|
+
c: "component",
|
|
323
|
+
p: "page",
|
|
324
|
+
s: "store",
|
|
325
|
+
sv: "service",
|
|
326
|
+
l: "layout",
|
|
327
|
+
component: "component",
|
|
328
|
+
page: "page",
|
|
329
|
+
store: "store",
|
|
330
|
+
service: "service",
|
|
331
|
+
layout: "layout"
|
|
332
|
+
};
|
|
333
|
+
function q(e) {
|
|
334
|
+
return D[e] ?? null;
|
|
335
|
+
}
|
|
336
|
+
function g(e) {
|
|
337
|
+
return /^[A-Z][A-Za-z0-9]*$/.test(e);
|
|
338
|
+
}
|
|
339
|
+
function U(e) {
|
|
340
|
+
return /^[a-z][A-Za-z0-9]*$/.test(e);
|
|
341
|
+
}
|
|
342
|
+
function V(e, t) {
|
|
343
|
+
return n.join(e, "src", "components", "features", `${t}.ark`);
|
|
344
|
+
}
|
|
345
|
+
function W(e, t) {
|
|
346
|
+
return n.join(e, "src", "pages", `${t}.ark`);
|
|
347
|
+
}
|
|
348
|
+
function M(e, t) {
|
|
349
|
+
return n.join(e, "src", "stores", `${t}.store.ts`);
|
|
350
|
+
}
|
|
351
|
+
function K(e, t) {
|
|
352
|
+
const s = t.charAt(0).toLowerCase() + t.slice(1);
|
|
353
|
+
return n.join(e, "src", "services", `${s}.service.ts`);
|
|
354
|
+
}
|
|
355
|
+
function Y(e, t) {
|
|
356
|
+
return n.join(e, "src", "pages", t, "_layout.ark");
|
|
357
|
+
}
|
|
358
|
+
function Z(e, t, s = {}) {
|
|
359
|
+
const o = s.cwd ?? process.cwd(), i = q(e);
|
|
360
|
+
if (i === null)
|
|
361
|
+
throw new p(
|
|
362
|
+
`UNKNOWN_GENERATE_TYPE: tipo "${e}" desconocido. Tipos válidos: component (c), page (p), store (s), service (sv), layout (l)`
|
|
363
|
+
);
|
|
364
|
+
if (i === "component" && !g(t))
|
|
365
|
+
throw new p(
|
|
366
|
+
`INVALID_COMPONENT_NAME: "${t}" debe ser PascalCase (ej: UserCard)`
|
|
367
|
+
);
|
|
368
|
+
if (i === "store" && !U(t))
|
|
369
|
+
throw new p(
|
|
370
|
+
`INVALID_STORE_NAME: "${t}" debe ser camelCase singular (ej: cart)`
|
|
371
|
+
);
|
|
372
|
+
if (i === "service" && !g(t))
|
|
373
|
+
throw new p(
|
|
374
|
+
`INVALID_SERVICE_NAME: "${t}" debe ser PascalCase (ej: Product)`
|
|
375
|
+
);
|
|
376
|
+
let r, c;
|
|
377
|
+
switch (i) {
|
|
378
|
+
case "component":
|
|
379
|
+
r = V(o, t), c = O(t);
|
|
380
|
+
break;
|
|
381
|
+
case "page":
|
|
382
|
+
r = W(o, t), c = R(t);
|
|
383
|
+
break;
|
|
384
|
+
case "store":
|
|
385
|
+
r = M(o, t), c = G(t);
|
|
386
|
+
break;
|
|
387
|
+
case "service": {
|
|
388
|
+
r = K(o, t), c = z(t);
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
391
|
+
case "layout":
|
|
392
|
+
r = Y(o, t), c = F(t);
|
|
393
|
+
break;
|
|
394
|
+
}
|
|
395
|
+
if (!s.dryRun) {
|
|
396
|
+
const l = n.dirname(r);
|
|
397
|
+
if (a.existsSync(l) || a.mkdirSync(l, { recursive: !0 }), a.existsSync(r))
|
|
398
|
+
throw new p(
|
|
399
|
+
`FILE_ALREADY_EXISTS: "${r}" ya existe. Eliminalo o elige otro nombre.`
|
|
400
|
+
);
|
|
401
|
+
a.writeFileSync(r, c, "utf-8");
|
|
402
|
+
}
|
|
403
|
+
return { filePath: r, content: c };
|
|
404
|
+
}
|
|
405
|
+
class p extends Error {
|
|
406
|
+
constructor(t) {
|
|
407
|
+
super(t), this.name = "GenerateCLIError";
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function y(e) {
|
|
411
|
+
if (!a.existsSync(e)) return [];
|
|
412
|
+
const t = [], s = a.readdirSync(e, { withFileTypes: !0 });
|
|
413
|
+
for (const o of s) {
|
|
414
|
+
const i = n.join(e, o.name);
|
|
415
|
+
o.isDirectory() ? t.push(...y(i)) : o.isFile() && (o.name.endsWith(".ark") || o.name.endsWith(".store.ts") || o.name.endsWith(".service.ts")) && t.push(i);
|
|
416
|
+
}
|
|
417
|
+
return t;
|
|
418
|
+
}
|
|
419
|
+
function B(e = {}) {
|
|
420
|
+
const t = e.cwd ?? process.cwd(), s = n.join(t, "src"), o = y(s);
|
|
421
|
+
let i = 0, r = 0;
|
|
422
|
+
const c = [];
|
|
423
|
+
for (const l of o) {
|
|
424
|
+
const k = a.readFileSync(l, "utf-8"), d = C(k), w = n.relative(t, l), $ = d.filter((f) => f.severity === "error").length, b = d.filter((f) => f.severity === "warning").length;
|
|
425
|
+
i += $, r += b, c.push({ path: w, violations: d });
|
|
426
|
+
}
|
|
427
|
+
return {
|
|
428
|
+
totalFiles: o.length,
|
|
429
|
+
errors: i,
|
|
430
|
+
warnings: r,
|
|
431
|
+
files: c
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
function J(e) {
|
|
435
|
+
const t = [];
|
|
436
|
+
t.push(`Analizando ${e.totalFiles} archivos...`), t.push("");
|
|
437
|
+
for (const s of e.files)
|
|
438
|
+
if (s.violations.length === 0)
|
|
439
|
+
t.push(`✅ ${s.path} — sin violaciones`);
|
|
440
|
+
else
|
|
441
|
+
for (const o of s.violations) {
|
|
442
|
+
const i = o.severity === "error" ? "❌" : "⚠️ ";
|
|
443
|
+
t.push(`${i} ${s.path}:${o.line}`), t.push(` ${o.code}: ${o.message}`), t.push("");
|
|
444
|
+
}
|
|
445
|
+
return t.push(""), t.push(
|
|
446
|
+
`Resultado: ${e.errors} error${e.errors !== 1 ? "es" : ""}, ${e.warnings} warning${e.warnings !== 1 ? "s" : ""}, ${e.totalFiles - e.files.filter((s) => s.violations.length > 0).length} archivos OK`
|
|
447
|
+
), t.join(`
|
|
448
|
+
`);
|
|
449
|
+
}
|
|
450
|
+
function H(e) {
|
|
451
|
+
return JSON.stringify(
|
|
452
|
+
{
|
|
453
|
+
errors: e.errors,
|
|
454
|
+
warnings: e.warnings,
|
|
455
|
+
files: e.files
|
|
456
|
+
},
|
|
457
|
+
null,
|
|
458
|
+
2
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
function X(e = {}) {
|
|
462
|
+
const t = e.cwd ?? process.cwd(), s = n.join(t, "src", "pages");
|
|
463
|
+
return a.existsSync(s) ? { routes: j(s), pagesDir: s } : { routes: [], pagesDir: s };
|
|
464
|
+
}
|
|
465
|
+
function Q(e) {
|
|
466
|
+
if (e.routes.length === 0)
|
|
467
|
+
return `No se encontraron rutas en ${e.pagesDir}`;
|
|
468
|
+
const t = ["Rutas detectadas:"], s = Math.max(...e.routes.map((r) => r.path.length)), o = e.routes.filter((r) => !r.isLayout && !r.isError), i = e.routes.filter((r) => r.isLayout || r.isError);
|
|
469
|
+
for (const r of [...o, ...i]) {
|
|
470
|
+
const c = r.isLayout ? " [layout]" : r.isError ? " [error]" : "", l = r.path.padEnd(s);
|
|
471
|
+
t.push(` ${l} → src/pages/${r.filePath}${c}`);
|
|
472
|
+
}
|
|
473
|
+
return t.join(`
|
|
474
|
+
`);
|
|
475
|
+
}
|
|
476
|
+
function ee(e) {
|
|
477
|
+
const t = [], s = {};
|
|
478
|
+
for (let o = 0; o < e.length; o++) {
|
|
479
|
+
const i = e[o];
|
|
480
|
+
if (i.startsWith("--")) {
|
|
481
|
+
const r = i.slice(2), c = e[o + 1];
|
|
482
|
+
c && !c.startsWith("--") ? (s[r] = c, o++) : s[r] = !0;
|
|
483
|
+
} else
|
|
484
|
+
t.push(i);
|
|
485
|
+
}
|
|
486
|
+
return { args: t, flags: s };
|
|
487
|
+
}
|
|
488
|
+
function te(e) {
|
|
489
|
+
const t = e[0];
|
|
490
|
+
t || (console.error("Error: ark new <nombre> — falta el nombre del proyecto"), process.exit(1));
|
|
491
|
+
try {
|
|
492
|
+
const s = _(t);
|
|
493
|
+
console.log(`
|
|
494
|
+
✅ Proyecto "${t}" creado en ${s.projectDir}
|
|
495
|
+
`), console.log("Próximos pasos:"), console.log(` cd ${t} && bun install && bun dev
|
|
496
|
+
`);
|
|
497
|
+
} catch (s) {
|
|
498
|
+
s instanceof h ? console.error(`Error: ${s.message}`) : console.error(s), process.exit(1);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
function oe(e) {
|
|
502
|
+
const [t, s] = e;
|
|
503
|
+
t || (console.error("Error: ark generate <tipo> <nombre>"), console.error("Tipos: component (c), page (p), store (s), service (sv), layout (l)"), process.exit(1)), s || (console.error(`Error: ark generate ${t} <nombre> — falta el nombre`), process.exit(1));
|
|
504
|
+
try {
|
|
505
|
+
const o = Z(t, s);
|
|
506
|
+
console.log(`✅ Generado: ${o.filePath}`);
|
|
507
|
+
} catch (o) {
|
|
508
|
+
o instanceof p ? console.error(`Error: ${o.message}`) : console.error(o), process.exit(1);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
function se(e) {
|
|
512
|
+
const t = e.json === !0;
|
|
513
|
+
try {
|
|
514
|
+
const s = B();
|
|
515
|
+
console.log(t ? H(s) : J(s)), s.errors > 0 && process.exit(1);
|
|
516
|
+
} catch (s) {
|
|
517
|
+
console.error(s), process.exit(1);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
function re() {
|
|
521
|
+
try {
|
|
522
|
+
const e = X();
|
|
523
|
+
console.log(Q(e));
|
|
524
|
+
} catch (e) {
|
|
525
|
+
console.error(e), process.exit(1);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
function ne() {
|
|
529
|
+
console.log(`
|
|
530
|
+
ark — Arckode UI CLI
|
|
531
|
+
|
|
532
|
+
Comandos:
|
|
533
|
+
ark new <nombre> Crea un nuevo proyecto
|
|
534
|
+
ark generate <tipo> <nombre> Genera un archivo (alias: ark g)
|
|
535
|
+
ark analyze [--json] Analiza violaciones en archivos .ark
|
|
536
|
+
ark routes Lista rutas detectadas en src/pages/
|
|
537
|
+
ark dev [--port 3000] [--host] Servidor de desarrollo (via Vite)
|
|
538
|
+
ark build [--mode production] Compila para producción (via Vite)
|
|
539
|
+
|
|
540
|
+
Tipos de generate:
|
|
541
|
+
component (c) → src/components/features/<NombrePascal>.ark
|
|
542
|
+
page (p) → src/pages/<nombre>.ark
|
|
543
|
+
store (s) → src/stores/<nombre>.store.ts
|
|
544
|
+
service (sv) → src/services/<nombre>.service.ts
|
|
545
|
+
layout (l) → src/pages/<nombre>/_layout.ark
|
|
546
|
+
`);
|
|
547
|
+
}
|
|
548
|
+
function ie(e = process.argv.slice(2)) {
|
|
549
|
+
const { args: t, flags: s } = ee(e), o = t[0], i = t.slice(1);
|
|
550
|
+
switch (o) {
|
|
551
|
+
case "new":
|
|
552
|
+
te(i);
|
|
553
|
+
break;
|
|
554
|
+
case "generate":
|
|
555
|
+
case "g":
|
|
556
|
+
oe(i);
|
|
557
|
+
break;
|
|
558
|
+
case "analyze":
|
|
559
|
+
se(s);
|
|
560
|
+
break;
|
|
561
|
+
case "routes":
|
|
562
|
+
re();
|
|
563
|
+
break;
|
|
564
|
+
case "dev":
|
|
565
|
+
case "build":
|
|
566
|
+
console.error(`Comando "${o}" requiere Vite. Corré directamente: bun ${o}`), process.exit(1);
|
|
567
|
+
break;
|
|
568
|
+
case "help":
|
|
569
|
+
case "--help":
|
|
570
|
+
case "-h":
|
|
571
|
+
case void 0:
|
|
572
|
+
ne();
|
|
573
|
+
break;
|
|
574
|
+
default:
|
|
575
|
+
console.error(`Error: comando desconocido "${o}". Corré "ark --help" para ver los comandos disponibles.`), process.exit(1);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
ie();
|
|
579
|
+
export {
|
|
580
|
+
ie as main
|
|
581
|
+
};
|