arckode-ui 0.2.0 → 0.2.1
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/CLAUDE.md.example +123 -0
- package/README.md +23 -2
- package/package.json +4 -2
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# CLAUDE.md — proyecto que usa Arckode UI
|
|
2
|
+
|
|
3
|
+
> Copiá este archivo a la raíz de tu proyecto (renómbralo a `CLAUDE.md`).
|
|
4
|
+
> Claude Code / OpenCode lo cargan automáticamente cuando trabajan en el proyecto.
|
|
5
|
+
|
|
6
|
+
## Skill obligatoria — leer ANTES de escribir código
|
|
7
|
+
|
|
8
|
+
Arckode UI distribuye un SKILL con PROTOCOLO de 4 pasos y 16 REGLAS INMUTABLES.
|
|
9
|
+
**Antes de crear/modificar cualquier `.ark` file, leer:**
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
./node_modules/arckode-ui/skills/SKILL.md
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Sub-skills específicos por área:
|
|
16
|
+
|
|
17
|
+
| Contexto | Sub-skill |
|
|
18
|
+
|----------|-----------|
|
|
19
|
+
| Escribir un `.ark`, patrones de UI (modal, form, lista) | `./node_modules/arckode-ui/skills/components/SKILL.md` |
|
|
20
|
+
| Signals, computed, watch, comunicación padre↔hijo | `./node_modules/arckode-ui/skills/runtime/SKILL.md` |
|
|
21
|
+
| Agregar regla nueva al analyzer | `./node_modules/arckode-ui/skills/analyzer/SKILL.md` |
|
|
22
|
+
| CLI `ark` y generators | `./node_modules/arckode-ui/skills/cli/SKILL.md` |
|
|
23
|
+
| Tests con vitest + happy-dom | `./node_modules/arckode-ui/skills/testing/SKILL.md` |
|
|
24
|
+
| Compiler interno (avanzado) | `./node_modules/arckode-ui/skills/compiler/SKILL.md` |
|
|
25
|
+
|
|
26
|
+
## Las 16 REGLAS INMUTABLES — referencia rápida
|
|
27
|
+
|
|
28
|
+
| # | Regla | Detecta |
|
|
29
|
+
|---|-------|---------|
|
|
30
|
+
| 1 | Toda prop DEBE tener `type` (clase nativa) | `PROP_MISSING_TYPE` |
|
|
31
|
+
| 2 | `emits` siempre kebab-case | `EMIT_CAMELCASE` |
|
|
32
|
+
| 3 | `setup()` retorna SOLO `state`, `computed`, `actions` | `SETUP_UNKNOWN_RETURN_KEY` |
|
|
33
|
+
| 4 | Handlers SIEMPRE `actions.xxx` | `HANDLER_NOT_IN_ACTIONS` |
|
|
34
|
+
| 5 | `v-for` colección siempre namespaced | `VFOR_NOT_NAMESPACED` |
|
|
35
|
+
| 6 | `v-if` con acceso namespaced (con `.`) | `VIF_NOT_NAMESPACED` |
|
|
36
|
+
| 7 | NO existe `v-model` — input controlado explícito | — |
|
|
37
|
+
| 8 | NO existe `ref()` ni `reactive()` — solo `signal()` | `REF_REACTIVE_USAGE` |
|
|
38
|
+
| 9 | NO existe `provide`/`inject` — usar `defineStore` | `PROVIDE_INJECT_USAGE` |
|
|
39
|
+
| 10 | `fetch()` PROHIBIDO en componente — usar `createService` | `DIRECT_FETCH_IN_COMPONENT` |
|
|
40
|
+
| 11 | NO lógica en directivas (`++`, ternarios) | `LOGIC_IN_TEMPLATE` |
|
|
41
|
+
| 12 | Actions como `function`, no arrow | `ARROW_FUNCTION_ACTION` |
|
|
42
|
+
| 13 | Componentes hijos PascalCase + import explícito | — |
|
|
43
|
+
| 14 | `mount(component, selector)` toma string | — |
|
|
44
|
+
| 15 | Imports SOLO de `'arckode-ui'` o `'arckode-ui/vite'` | — |
|
|
45
|
+
| 16 | Orden recomendado del `setup()` | — (convención) |
|
|
46
|
+
|
|
47
|
+
Detalle completo y ejemplos en `./node_modules/arckode-ui/skills/SKILL.md`.
|
|
48
|
+
|
|
49
|
+
## PROTOCOLO antes de codear
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
PASO 1 — IDENTIFICAR ALCANCE
|
|
53
|
+
¿1 componente nuevo? ¿modificar existente? ¿estado global? ¿servicio HTTP?
|
|
54
|
+
|
|
55
|
+
PASO 2 — VERIFICAR REGLAS (las 16 de arriba)
|
|
56
|
+
|
|
57
|
+
PASO 3 — GENERAR
|
|
58
|
+
Si es componente nuevo: copiar PLANTILLA CANÓNICA del SKILL §5
|
|
59
|
+
|
|
60
|
+
PASO 4 — VERIFICAR (NO asumir que funciona)
|
|
61
|
+
npx ark analyze → 0 errors
|
|
62
|
+
Probar en navegador
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Comandos del proyecto
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Generar archivos con plantillas válidas garantizadas
|
|
69
|
+
npx ark generate component <PascalCase>
|
|
70
|
+
npx ark generate page <name>
|
|
71
|
+
npx ark generate store <camelCase>
|
|
72
|
+
npx ark generate service <PascalCase>
|
|
73
|
+
npx ark generate layout <name>
|
|
74
|
+
|
|
75
|
+
# Análisis
|
|
76
|
+
npx ark analyze # 0 errors antes de declarar listo
|
|
77
|
+
npx ark routes # listar rutas del file-system router
|
|
78
|
+
|
|
79
|
+
# Dev / build
|
|
80
|
+
bun dev
|
|
81
|
+
bun build
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Anti-patterns más comunes (cada uno viola una regla)
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
// ❌ REGLA #4
|
|
88
|
+
@click="handleClick" → @click="actions.handleClick"
|
|
89
|
+
|
|
90
|
+
// ❌ REGLA #5
|
|
91
|
+
v-for="item in items" → v-for="item in state.items.value"
|
|
92
|
+
|
|
93
|
+
// ❌ REGLA #7
|
|
94
|
+
<input v-model="state.name"/> → :value + @input explícito
|
|
95
|
+
|
|
96
|
+
// ❌ REGLA #8
|
|
97
|
+
const x = ref(0) → signal(0)
|
|
98
|
+
|
|
99
|
+
// ❌ REGLA #11
|
|
100
|
+
@click="state.count.value++" → @click="actions.increment"
|
|
101
|
+
:class="x.value ? 'a' : 'b'" → mover a computed
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Cuando el analyzer reporta un error
|
|
105
|
+
|
|
106
|
+
Cada violation incluye campo `Fix:` con sugerencia concreta. **Leerlo y aplicarlo literal:**
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
[arckode-ui] UserCard.ark:5
|
|
110
|
+
HANDLER_NOT_IN_ACTIONS: El handler "handleClick" no está namespaced.
|
|
111
|
+
> 5 | <button @click="handleClick">
|
|
112
|
+
Fix: Reemplazar "handleClick" por "actions.handleClick" y asegurarse de
|
|
113
|
+
que la función esté declarada en setup() y exportada en el return.actions.
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Benchmark de predictabilidad
|
|
117
|
+
|
|
118
|
+
Test ciego (10 prompts × 2 variantes con Claude Sonnet):
|
|
119
|
+
- **Sin SKILL:** 30% outputs válidos
|
|
120
|
+
- **Con SKILL:** 100% outputs válidos
|
|
121
|
+
|
|
122
|
+
Por eso vale la pena cargar el SKILL antes de generar código.
|
|
123
|
+
Detalle en https://gitlab.com/underworf/arckode-ui/-/blob/main/BENCHMARK.md
|
package/README.md
CHANGED
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
# Arckode UI
|
|
2
2
|
|
|
3
|
-
Framework frontend con archivos `.ark` (Single File Components), reactividad por signals, compiler propio (Vite plugin), router file-system y analyzer estático.
|
|
3
|
+
Framework frontend con archivos `.ark` (Single File Components), reactividad por signals, compiler propio (Vite plugin), router file-system y analyzer estático con sugerencias concretas de fix.
|
|
4
4
|
|
|
5
5
|
> **Diseñado para máxima predictibilidad de output de IA.** Hay un solo camino correcto para cada problema. Para cada violation detectada, el analyzer sugiere el fix concreto.
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**Predictabilidad medida (benchmark ciego con Claude Sonnet, 10 prompts):**
|
|
8
|
+
**Sin SKILL: 30% outputs válidos · Con SKILL: 100%.** Ver [BENCHMARK.md](./BENCHMARK.md).
|
|
9
|
+
|
|
10
|
+
**Versión:** 0.2.1 — desarrollo activo
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Activar el SKILL para tu IA (Claude/OpenCode)
|
|
15
|
+
|
|
16
|
+
Después de instalar el paquete, copiá el `CLAUDE.md.example` a la raíz de tu proyecto:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
cp node_modules/arckode-ui/CLAUDE.md.example ./CLAUDE.md
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Eso hace que cualquier IA (Claude Code, OpenCode, Cursor) cargue automáticamente:
|
|
23
|
+
- El PROTOCOLO de 4 pasos antes de codear
|
|
24
|
+
- Las 16 reglas inmutables que el analyzer enforza
|
|
25
|
+
- Las plantillas canónicas
|
|
26
|
+
- Los 6 sub-skills temáticos (runtime, compiler, analyzer, cli, components, testing)
|
|
27
|
+
|
|
28
|
+
Sin este archivo, la IA improvisa. Con este archivo, **9 de cada 10 outputs pasan el analyzer al primer intento**.
|
|
8
29
|
|
|
9
30
|
---
|
|
10
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arckode-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Frontend framework con .ark SFCs, signals, file-system router y analyzer estático con sugerencias concretas de fix. Diseñado para máxima predictibilidad de output de IA.",
|
|
6
6
|
"keywords": [
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"dist",
|
|
45
45
|
"skills",
|
|
46
46
|
"README.md",
|
|
47
|
-
"LICENSE"
|
|
47
|
+
"LICENSE",
|
|
48
|
+
"CLAUDE.md.example"
|
|
48
49
|
],
|
|
49
50
|
"scripts": {
|
|
50
51
|
"build": "vite build && chmod +x dist/cli.js",
|
|
@@ -58,6 +59,7 @@
|
|
|
58
59
|
"vite": ">=5.0.0"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
62
|
+
"@anthropic-ai/sdk": "^0.98.0",
|
|
61
63
|
"@types/bun": "latest",
|
|
62
64
|
"happy-dom": "^20.9.0",
|
|
63
65
|
"typescript": "^5.4.0",
|