elsabro 2.1.0 → 2.3.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.
Files changed (64) hide show
  1. package/agents/elsabro-orchestrator.md +113 -0
  2. package/commands/elsabro/add-phase.md +17 -0
  3. package/commands/elsabro/add-todo.md +111 -53
  4. package/commands/elsabro/audit-milestone.md +19 -0
  5. package/commands/elsabro/check-todos.md +210 -31
  6. package/commands/elsabro/complete-milestone.md +20 -1
  7. package/commands/elsabro/debug.md +19 -0
  8. package/commands/elsabro/discuss-phase.md +18 -1
  9. package/commands/elsabro/execute.md +511 -58
  10. package/commands/elsabro/insert-phase.md +18 -1
  11. package/commands/elsabro/list-phase-assumptions.md +17 -0
  12. package/commands/elsabro/new-milestone.md +19 -0
  13. package/commands/elsabro/new.md +19 -0
  14. package/commands/elsabro/pause-work.md +19 -0
  15. package/commands/elsabro/plan-milestone-gaps.md +20 -1
  16. package/commands/elsabro/plan.md +264 -36
  17. package/commands/elsabro/progress.md +203 -79
  18. package/commands/elsabro/quick.md +19 -0
  19. package/commands/elsabro/remove-phase.md +17 -0
  20. package/commands/elsabro/research-phase.md +18 -1
  21. package/commands/elsabro/resume-work.md +19 -0
  22. package/commands/elsabro/start.md +399 -98
  23. package/commands/elsabro/verify-work.md +138 -5
  24. package/hooks/confirm-destructive.sh +145 -0
  25. package/hooks/hooks-config.json +81 -0
  26. package/hooks/lint-check.sh +238 -0
  27. package/hooks/post-edit-test.sh +189 -0
  28. package/package.json +3 -2
  29. package/references/SYSTEM_INDEX.md +241 -0
  30. package/references/command-flow.md +352 -0
  31. package/references/enforcement-rules.md +331 -0
  32. package/references/error-contracts-tests.md +1171 -0
  33. package/references/error-contracts.md +3102 -0
  34. package/references/error-handling-instructions.md +26 -12
  35. package/references/parallel-worktrees.md +293 -0
  36. package/references/state-sync.md +381 -0
  37. package/references/task-dispatcher.md +388 -0
  38. package/references/tasks-integration.md +380 -0
  39. package/scripts/setup-parallel-worktrees.sh +319 -0
  40. package/skills/api-microservice.md +765 -0
  41. package/skills/api-setup.md +76 -3
  42. package/skills/auth-setup.md +46 -6
  43. package/skills/chrome-extension.md +584 -0
  44. package/skills/cicd-setup.md +1206 -0
  45. package/skills/cli-tool.md +884 -0
  46. package/skills/database-setup.md +41 -5
  47. package/skills/desktop-app.md +1351 -0
  48. package/skills/expo-app.md +35 -2
  49. package/skills/full-stack-app.md +543 -0
  50. package/skills/memory-update.md +207 -0
  51. package/skills/mobile-app.md +813 -0
  52. package/skills/nextjs-app.md +33 -2
  53. package/skills/payments-setup.md +76 -1
  54. package/skills/review.md +331 -0
  55. package/skills/saas-starter.md +639 -0
  56. package/skills/sentry-setup.md +41 -7
  57. package/skills/techdebt.md +289 -0
  58. package/skills/testing-setup.md +1218 -0
  59. package/skills/tutor.md +219 -0
  60. package/templates/.planning/notes/.gitkeep +0 -0
  61. package/templates/CLAUDE.md.template +48 -0
  62. package/templates/error-handling-config.json +79 -2
  63. package/templates/mistakes.md.template +52 -0
  64. package/templates/patterns.md.template +114 -0
@@ -0,0 +1,189 @@
1
+ #!/bin/bash
2
+ # post-edit-test.sh - ELSABRO Hook: Ejecuta tests automaticamente despues de editar codigo
3
+ # Uso: Este hook se ejecuta automaticamente despues de Write/Edit
4
+ # Soporta: vitest, jest, mocha, npm-test, pytest, cargo, go
5
+
6
+ set -e
7
+
8
+ # Colores para output
9
+ RED='\033[0;31m'
10
+ GREEN='\033[0;32m'
11
+ YELLOW='\033[1;33m'
12
+ BLUE='\033[0;34m'
13
+ NC='\033[0m' # No Color
14
+
15
+ # Prefijo ELSABRO
16
+ PREFIX="[ELSABRO:hook]"
17
+
18
+ # Detectar el tipo de proyecto y runner de tests
19
+ detect_test_runner() {
20
+ # Node.js / JavaScript / TypeScript
21
+ if [ -f "package.json" ]; then
22
+ if grep -q '"vitest"' package.json 2>/dev/null; then
23
+ echo "vitest"
24
+ return
25
+ fi
26
+ if grep -q '"jest"' package.json 2>/dev/null; then
27
+ echo "jest"
28
+ return
29
+ fi
30
+ if grep -q '"mocha"' package.json 2>/dev/null; then
31
+ echo "mocha"
32
+ return
33
+ fi
34
+ # Check for test script in package.json
35
+ if grep -q '"test"' package.json 2>/dev/null; then
36
+ # Verify it's not the default npm test
37
+ local test_script=$(grep -o '"test":\s*"[^"]*"' package.json | head -1)
38
+ if [[ ! "$test_script" =~ "Error: no test specified" ]]; then
39
+ echo "npm-test"
40
+ return
41
+ fi
42
+ fi
43
+ fi
44
+
45
+ # Python
46
+ if [ -f "pytest.ini" ] || [ -f "pyproject.toml" ] || [ -f "setup.py" ]; then
47
+ if command -v pytest &>/dev/null; then
48
+ echo "pytest"
49
+ return
50
+ fi
51
+ fi
52
+ if [ -d "tests" ] || [ -d "test" ]; then
53
+ if command -v pytest &>/dev/null; then
54
+ echo "pytest"
55
+ return
56
+ fi
57
+ fi
58
+
59
+ # Rust
60
+ if [ -f "Cargo.toml" ]; then
61
+ echo "cargo"
62
+ return
63
+ fi
64
+
65
+ # Go
66
+ if [ -f "go.mod" ]; then
67
+ echo "go"
68
+ return
69
+ fi
70
+
71
+ # No runner detected
72
+ echo ""
73
+ }
74
+
75
+ # Encontrar archivo de test relacionado
76
+ find_related_test() {
77
+ local file="$1"
78
+ local basename=$(basename "$file")
79
+ local dirname=$(dirname "$file")
80
+ local name_without_ext="${basename%.*}"
81
+
82
+ # Patrones comunes de archivos de test
83
+ local patterns=(
84
+ "${dirname}/${name_without_ext}.test.ts"
85
+ "${dirname}/${name_without_ext}.test.js"
86
+ "${dirname}/${name_without_ext}.spec.ts"
87
+ "${dirname}/${name_without_ext}.spec.js"
88
+ "${dirname}/__tests__/${name_without_ext}.test.ts"
89
+ "${dirname}/__tests__/${name_without_ext}.test.js"
90
+ "tests/${name_without_ext}_test.py"
91
+ "test/${name_without_ext}_test.py"
92
+ "${dirname}/test_${name_without_ext}.py"
93
+ )
94
+
95
+ for pattern in "${patterns[@]}"; do
96
+ if [ -f "$pattern" ]; then
97
+ echo "$pattern"
98
+ return
99
+ fi
100
+ done
101
+
102
+ echo ""
103
+ }
104
+
105
+ # Ejecutar tests segun el runner detectado
106
+ run_tests() {
107
+ local runner="$1"
108
+ local changed_file="$2"
109
+ local related_test=$(find_related_test "$changed_file")
110
+
111
+ case "$runner" in
112
+ vitest)
113
+ if [ -n "$related_test" ]; then
114
+ echo -e "${BLUE}$PREFIX Running vitest for related test...${NC}"
115
+ npx vitest run "$related_test" --reporter=dot --passWithNoTests 2>/dev/null
116
+ else
117
+ echo -e "${BLUE}$PREFIX Running vitest (all tests)...${NC}"
118
+ npx vitest run --reporter=dot --passWithNoTests 2>/dev/null
119
+ fi
120
+ ;;
121
+ jest)
122
+ if [ -n "$related_test" ]; then
123
+ echo -e "${BLUE}$PREFIX Running jest for related test...${NC}"
124
+ npx jest "$related_test" --bail --passWithNoTests --silent 2>/dev/null
125
+ else
126
+ echo -e "${BLUE}$PREFIX Running jest (all tests)...${NC}"
127
+ npx jest --bail --passWithNoTests --silent 2>/dev/null
128
+ fi
129
+ ;;
130
+ mocha)
131
+ echo -e "${BLUE}$PREFIX Running mocha...${NC}"
132
+ npx mocha --exit 2>/dev/null
133
+ ;;
134
+ npm-test)
135
+ echo -e "${BLUE}$PREFIX Running npm test...${NC}"
136
+ npm test --silent 2>/dev/null || true
137
+ ;;
138
+ pytest)
139
+ if [ -n "$related_test" ]; then
140
+ echo -e "${BLUE}$PREFIX Running pytest for related test...${NC}"
141
+ python -m pytest "$related_test" -x -q 2>/dev/null
142
+ else
143
+ echo -e "${BLUE}$PREFIX Running pytest (all tests)...${NC}"
144
+ python -m pytest -x -q --tb=short 2>/dev/null
145
+ fi
146
+ ;;
147
+ cargo)
148
+ echo -e "${BLUE}$PREFIX Running cargo test...${NC}"
149
+ cargo test --quiet 2>/dev/null
150
+ ;;
151
+ go)
152
+ echo -e "${BLUE}$PREFIX Running go test...${NC}"
153
+ go test ./... -v 2>/dev/null
154
+ ;;
155
+ *)
156
+ # No test runner detected
157
+ return 0
158
+ ;;
159
+ esac
160
+ }
161
+
162
+ # Main
163
+ main() {
164
+ # Archivo que fue editado (pasado como argumento por el hook)
165
+ local changed_file="${1:-}"
166
+
167
+ # Detectar runner
168
+ local runner=$(detect_test_runner)
169
+
170
+ if [ -z "$runner" ]; then
171
+ # No hay test runner, salir silenciosamente
172
+ echo -e "${YELLOW}$PREFIX No test runner detected, skipping tests${NC}"
173
+ exit 0
174
+ fi
175
+
176
+ echo -e "${YELLOW}$PREFIX Detected test runner: $runner${NC}"
177
+
178
+ # Ejecutar tests
179
+ if run_tests "$runner" "$changed_file"; then
180
+ echo -e "${GREEN}$PREFIX Tests passed${NC}"
181
+ exit 0
182
+ else
183
+ echo -e "${RED}$PREFIX Tests failed${NC}"
184
+ echo -e "${RED}$PREFIX Fix the failing tests before continuing${NC}"
185
+ exit 1
186
+ fi
187
+ }
188
+
189
+ main "$@"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elsabro",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "description": "Sistema de desarrollo AI-powered para Claude Code - El mejor asistente para crear apps sin experiencia previa",
5
5
  "bin": {
6
6
  "elsabro": "bin/install.js"
@@ -13,7 +13,8 @@
13
13
  "templates",
14
14
  "workflows",
15
15
  "references",
16
- "hooks/dist"
16
+ "hooks",
17
+ "scripts"
17
18
  ],
18
19
  "keywords": [
19
20
  "claude",
@@ -0,0 +1,241 @@
1
+ # ELSABRO System Index
2
+
3
+ ## ARQUITECTURA DEL SISTEMA
4
+
5
+ ```
6
+ ┌─────────────────────────────────────────────────────────────────────────────┐
7
+ │ ELSABRO SYSTEM │
8
+ ├─────────────────────────────────────────────────────────────────────────────┤
9
+ │ │
10
+ │ ┌──────────────────────────────────────────────────────────────────────┐ │
11
+ │ │ ENTRY POINT │ │
12
+ │ │ /elsabro:start │ │
13
+ │ │ (Orquestador Principal) │ │
14
+ │ └────────────────────────────┬─────────────────────────────────────────┘ │
15
+ │ │ │
16
+ │ ▼ │
17
+ │ ┌────────────────────────────────────────────────────────────────────────┐ │
18
+ │ │ CORE WORKFLOW │ │
19
+ │ │ ┌─────────┐ ┌─────────┐ ┌─────────────┐ ┌───────────────┐ │ │
20
+ │ │ │ :new │→ │ :plan │→ │ :execute │→ │ :verify-work │ │ │
21
+ │ │ │ (setup) │ │(design) │ │(implement) │ │ (check) │ │ │
22
+ │ │ └─────────┘ └─────────┘ └─────────────┘ └───────────────┘ │ │
23
+ │ │ ↑ │ │ │
24
+ │ │ └───── :debug ──┘ │ │
25
+ │ └────────────────────────────────────────────────────────────────────────┘ │
26
+ │ │
27
+ │ ┌────────────────────────────────────────────────────────────────────────┐ │
28
+ │ │ SHARED STATE │ │
29
+ │ │ .elsabro/state.json │ │
30
+ │ │ (Sincronización entre comandos) │ │
31
+ │ └────────────────────────────────────────────────────────────────────────┘ │
32
+ │ │
33
+ │ ┌────────────────────────────────────────────────────────────────────────┐ │
34
+ │ │ TASK DISPATCHER │ │
35
+ │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
36
+ │ │ │ HAIKU │ │ SONNET │ │ OPUS │ │ │
37
+ │ │ │ Exploración │ │ Balance │ │ Implementar │ │ │
38
+ │ │ │ (rápido) │ │ (flexible) │ │ (calidad) │ │ │
39
+ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │
40
+ │ └────────────────────────────────────────────────────────────────────────┘ │
41
+ │ │
42
+ └─────────────────────────────────────────────────────────────────────────────┘
43
+ ```
44
+
45
+ ---
46
+
47
+ ## ARCHIVOS DE REFERENCIA
48
+
49
+ ### 1. `enforcement-rules.md`
50
+ **Propósito**: Reglas NO negociables que todo comando debe seguir
51
+ **Contiene**:
52
+ - Secuencia obligatoria: TaskCreate → TaskUpdate → Task → TaskUpdate
53
+ - Mínimos de agentes por fase
54
+ - Matriz completa de todos los comandos (29 comandos)
55
+ - Políticas de paralelismo
56
+
57
+ ### 2. `state-sync.md`
58
+ **Propósito**: Protocolo de sincronización de estado entre comandos
59
+ **Contiene**:
60
+ - Código de sincronización para copiar a cada comando
61
+ - Fases por comando
62
+ - Contexto que pasa cada comando al siguiente
63
+ - Transiciones válidas entre comandos
64
+
65
+ ### 3. `command-flow.md`
66
+ **Propósito**: Flujo de navegación y estado compartido
67
+ **Contiene**:
68
+ - Diagrama de flujo principal
69
+ - Estructura de `.elsabro/state.json`
70
+ - Checkpoints entre comandos
71
+ - Recuperación de contexto
72
+
73
+ ### 4. `task-dispatcher.md`
74
+ **Propósito**: Selección automática de modelo según tipo de tarea
75
+ **Contiene**:
76
+ - Matriz modelo-tipo de tarea
77
+ - Configuración de agentes por comando
78
+ - Políticas de ejecución paralela
79
+ - Integración con Claude Code Tasks API
80
+
81
+ ### 4.1. `tasks-integration.md` (NUEVO)
82
+ **Propósito**: Integración con Claude Code Tasks API como backend único
83
+ **Contiene**:
84
+ - Arquitectura unificada (ELSABRO commands + Tasks API)
85
+ - Metadata schema para TODOs, phases, milestones
86
+ - Migración de `.planning/TODOS.md` a Tasks API
87
+ - Ejemplos de implementación para cada comando
88
+
89
+ ### 5. `error-handling-instructions.md`
90
+ **Propósito**: Manejo consistente de errores
91
+ **Contiene**:
92
+ - Clasificación (CRITICAL, HIGH, MEDIUM, LOW)
93
+ - Display visual de errores
94
+ - Políticas de retry
95
+ - Actualización de estado después de errores
96
+
97
+ ### 6. `source-hierarchy.md`
98
+ **Propósito**: Prioridad de fuentes de información
99
+ **Contiene**:
100
+ - Context7 > Docs > WebSearch > Training
101
+ - Verificación de versiones
102
+ - Proceso de research
103
+
104
+ ### 7. `token-optimization.md`
105
+ **Propósito**: Uso eficiente del contexto
106
+ **Contiene**:
107
+ - Regla del 50%
108
+ - Lazy loading
109
+ - Wave execution
110
+
111
+ ---
112
+
113
+ ## ESTADO UNIFICADO
114
+
115
+ **Archivo principal**: `.elsabro/state.json`
116
+
117
+ ```json
118
+ {
119
+ "version": "1.0.0",
120
+ "created_at": "ISO timestamp",
121
+ "updated_at": "ISO timestamp",
122
+
123
+ "current_flow": {
124
+ "command": "string",
125
+ "phase": "string",
126
+ "started_at": "ISO timestamp"
127
+ },
128
+
129
+ "context": {
130
+ "project_type": "greenfield | brownfield | continuation",
131
+ "tech_stack": ["array"],
132
+ "current_feature": "string | null"
133
+ },
134
+
135
+ "history": [
136
+ {
137
+ "command": "string",
138
+ "completed_at": "ISO timestamp",
139
+ "result": "string",
140
+ "artifact": "path | null"
141
+ }
142
+ ],
143
+
144
+ "pending_tasks": [],
145
+ "blocked_on": null,
146
+ "suggested_next": "string | null",
147
+
148
+ "errors": {
149
+ "count": 0,
150
+ "lastError": null
151
+ }
152
+ }
153
+ ```
154
+
155
+ **Archivo legible**: `.elsabro/context.md` (para humanos)
156
+
157
+ ---
158
+
159
+ ## SKILLS PROFESIONALES
160
+
161
+ | Skill | Stack | Versiones |
162
+ |-------|-------|-----------|
163
+ | `full-stack-app` | Next.js 15 + React 19 + Prisma 6 + PostgreSQL | Específicas |
164
+ | `saas-starter` | Full-stack + Stripe 2024-12-18 | Específicas |
165
+ | `mobile-app` | Expo SDK 52 + React Native | Específicas |
166
+ | `api-microservice` | Fastify + OpenAPI + Docker | Parciales |
167
+ | `chrome-extension` | Manifest V3 + Vite + TypeScript | Parciales |
168
+
169
+ ---
170
+
171
+ ## CHECKLIST DE CONSISTENCIA
172
+
173
+ Para verificar que el sistema está correctamente configurado:
174
+
175
+ ### Comandos Core
176
+ - [ ] `start.md` tiene sección `<enforcement>` y `<state_sync>`
177
+ - [ ] `plan.md` tiene sección `<state_sync>` y `dispatcher` en frontmatter
178
+ - [ ] `execute.md` tiene sección `<state_sync>` y `dispatcher` en frontmatter
179
+ - [ ] `verify-work.md` tiene sección `<state_sync>` y `dispatcher` en frontmatter
180
+
181
+ ### Referencias
182
+ - [ ] Todos los archivos usan `.elsabro/state.json` (NO `.planning/SESSION.md`)
183
+ - [ ] `enforcement-rules.md` tiene matriz para los 29 comandos
184
+ - [ ] `state-sync.md` tiene código de sincronización completo
185
+
186
+ ### Skills
187
+ - [ ] Cada skill tiene `tags` en frontmatter
188
+ - [ ] Cada skill tiene versiones específicas de tecnologías
189
+ - [ ] Cada skill tiene `<verification>` ejecutable
190
+
191
+ ---
192
+
193
+ ## FLUJO DE EJECUCIÓN TÍPICO
194
+
195
+ ```
196
+ 1. Usuario ejecuta /elsabro:start
197
+ └─ Lee .elsabro/state.json (si existe)
198
+ └─ Lanza 2 HAIKU en paralelo para detectar contexto
199
+ └─ Muestra opciones según proyecto (greenfield/brownfield/continuation)
200
+ └─ Actualiza state.json con current_flow
201
+ └─ Invoca siguiente comando con Skill tool
202
+
203
+ 2. /elsabro:plan toma control
204
+ └─ Lee state.json (contexto de start)
205
+ └─ Lanza 3 HAIKU en paralelo para explorar
206
+ └─ Lanza 1 OPUS para crear RESEARCH.md y PLAN.md
207
+ └─ Lanza 1 SONNET para validar plan
208
+ └─ Actualiza state.json (plan_file, ready_for_execution)
209
+ └─ Sugiere /elsabro:execute
210
+
211
+ 3. /elsabro:execute toma control
212
+ └─ Lee state.json (plan_file)
213
+ └─ Lanza 3 HAIKU en paralelo para explorar
214
+ └─ Lanza 2+ OPUS en paralelo para implementar (por wave)
215
+ └─ Lanza 3 OPUS en paralelo para verificar
216
+ └─ Actualiza state.json (changed_files, commits)
217
+ └─ Sugiere /elsabro:verify-work
218
+
219
+ 4. /elsabro:verify-work finaliza
220
+ └─ Lee state.json (changed_files)
221
+ └─ Lanza 3 OPUS en paralelo para verificación exhaustiva
222
+ └─ Genera VERIFICATION-REPORT.md
223
+ └─ Actualiza state.json (verification_result)
224
+ └─ Si PASS: "Listo para merge"
225
+ └─ Si FAIL: Sugiere /elsabro:execute para fix
226
+ ```
227
+
228
+ ---
229
+
230
+ ## REGLAS DE ORO
231
+
232
+ 1. **TaskCreate ANTES de cualquier acción**
233
+ 2. **TaskUpdate(in_progress) ANTES de Task()**
234
+ 3. **Tasks API como backend único** (NO duplicar con sistemas custom)
235
+ 4. **Metadata schema consistente** para type, priority, category
236
+ 5. **TaskList para sincronización** (NO archivos .md separados)
237
+ 6. **Mínimo 3 agentes HAIKU para exploración**
238
+ 7. **OPUS para implementación y verificación**
239
+ 8. **Context7 ANTES de escribir código con librerías**
240
+ 9. **Paralelismo OBLIGATORIO cuando las tareas son independientes**
241
+ 10. **Pasar contexto via Task metadata** al siguiente comando