elsabro 2.1.0 → 2.2.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 (46) hide show
  1. package/commands/elsabro/add-phase.md +17 -0
  2. package/commands/elsabro/add-todo.md +111 -53
  3. package/commands/elsabro/audit-milestone.md +19 -0
  4. package/commands/elsabro/check-todos.md +210 -31
  5. package/commands/elsabro/complete-milestone.md +20 -1
  6. package/commands/elsabro/debug.md +19 -0
  7. package/commands/elsabro/discuss-phase.md +18 -1
  8. package/commands/elsabro/execute.md +288 -12
  9. package/commands/elsabro/insert-phase.md +18 -1
  10. package/commands/elsabro/list-phase-assumptions.md +17 -0
  11. package/commands/elsabro/new-milestone.md +19 -0
  12. package/commands/elsabro/new.md +19 -0
  13. package/commands/elsabro/pause-work.md +19 -0
  14. package/commands/elsabro/plan-milestone-gaps.md +20 -1
  15. package/commands/elsabro/plan.md +264 -36
  16. package/commands/elsabro/progress.md +203 -79
  17. package/commands/elsabro/quick.md +19 -0
  18. package/commands/elsabro/remove-phase.md +17 -0
  19. package/commands/elsabro/research-phase.md +18 -1
  20. package/commands/elsabro/resume-work.md +19 -0
  21. package/commands/elsabro/start.md +365 -98
  22. package/commands/elsabro/verify-work.md +109 -5
  23. package/package.json +1 -1
  24. package/references/SYSTEM_INDEX.md +241 -0
  25. package/references/command-flow.md +352 -0
  26. package/references/enforcement-rules.md +331 -0
  27. package/references/error-handling-instructions.md +26 -12
  28. package/references/state-sync.md +381 -0
  29. package/references/task-dispatcher.md +388 -0
  30. package/references/tasks-integration.md +380 -0
  31. package/skills/api-microservice.md +765 -0
  32. package/skills/api-setup.md +76 -3
  33. package/skills/auth-setup.md +46 -6
  34. package/skills/chrome-extension.md +584 -0
  35. package/skills/cicd-setup.md +1206 -0
  36. package/skills/cli-tool.md +884 -0
  37. package/skills/database-setup.md +41 -5
  38. package/skills/desktop-app.md +1351 -0
  39. package/skills/expo-app.md +35 -2
  40. package/skills/full-stack-app.md +543 -0
  41. package/skills/mobile-app.md +813 -0
  42. package/skills/nextjs-app.md +33 -2
  43. package/skills/payments-setup.md +76 -1
  44. package/skills/saas-starter.md +639 -0
  45. package/skills/sentry-setup.md +41 -7
  46. package/skills/testing-setup.md +1218 -0
@@ -0,0 +1,381 @@
1
+ # ELSABRO State Synchronization
2
+
3
+ ## PROTOCOLO DE SINCRONIZACIÓN DE ESTADO
4
+
5
+ Este documento define cómo todos los comandos ELSABRO deben sincronizarse con el estado compartido en `.elsabro/state.json`.
6
+
7
+ ---
8
+
9
+ ## REGLA FUNDAMENTAL
10
+
11
+ **Todo comando DEBE:**
12
+ 1. LEER `.elsabro/state.json` al iniciar
13
+ 2. VERIFICAR si hay flujo en progreso
14
+ 3. ACTUALIZAR estado al cambiar de fase
15
+ 4. ESCRIBIR estado al completar
16
+
17
+ **NO HAY EXCEPCIONES.**
18
+
19
+ ---
20
+
21
+ ## CÓDIGO DE SINCRONIZACIÓN (Copiar a cada comando)
22
+
23
+ ### Al Iniciar (OBLIGATORIO)
24
+
25
+ ```javascript
26
+ // SYNC: Leer estado existente
27
+ const stateFile = ".elsabro/state.json";
28
+ let state = null;
29
+
30
+ try {
31
+ state = Read(stateFile);
32
+ state = JSON.parse(state);
33
+ } catch {
34
+ // Primera vez - crear estado inicial
35
+ state = {
36
+ version: "1.0.0",
37
+ created_at: new Date().toISOString(),
38
+ updated_at: new Date().toISOString(),
39
+ current_flow: null,
40
+ context: {},
41
+ history: [],
42
+ pending_tasks: [],
43
+ blocked_on: null
44
+ };
45
+ }
46
+
47
+ // SYNC: Verificar flujo en progreso
48
+ if (state.current_flow && state.current_flow.command !== "[ESTE_COMANDO]") {
49
+ // Advertir al usuario
50
+ AskUserQuestion({
51
+ questions: [{
52
+ question: `Hay un flujo de "${state.current_flow.command}" en progreso. ¿Qué quieres hacer?`,
53
+ header: "Flujo",
54
+ options: [
55
+ { label: "Continuar ese flujo", description: "Retomar donde lo dejaste" },
56
+ { label: "Empezar este comando", description: "Pausar el anterior y empezar este" }
57
+ ],
58
+ multiSelect: false
59
+ }]
60
+ });
61
+ }
62
+
63
+ // SYNC: Marcar inicio de este comando
64
+ state.current_flow = {
65
+ command: "[ESTE_COMANDO]",
66
+ phase: "initializing",
67
+ started_at: new Date().toISOString()
68
+ };
69
+ state.updated_at = new Date().toISOString();
70
+ Write(stateFile, JSON.stringify(state, null, 2));
71
+ ```
72
+
73
+ ### Al Cambiar de Fase (OBLIGATORIO)
74
+
75
+ ```javascript
76
+ // SYNC: Actualizar fase
77
+ state.current_flow.phase = "[NUEVA_FASE]";
78
+ state.updated_at = new Date().toISOString();
79
+ Write(stateFile, JSON.stringify(state, null, 2));
80
+ ```
81
+
82
+ ### Al Completar (OBLIGATORIO)
83
+
84
+ ```javascript
85
+ // SYNC: Registrar en historial
86
+ state.history.push({
87
+ command: "[ESTE_COMANDO]",
88
+ completed_at: new Date().toISOString(),
89
+ result: "[resultado]",
90
+ artifact: "[path a archivo generado o null]"
91
+ });
92
+
93
+ // SYNC: Limpiar flujo actual
94
+ state.current_flow = null;
95
+ state.updated_at = new Date().toISOString();
96
+
97
+ // SYNC: Sugerir siguiente comando
98
+ state.suggested_next = "[siguiente_comando_sugerido]";
99
+
100
+ Write(stateFile, JSON.stringify(state, null, 2));
101
+ ```
102
+
103
+ ---
104
+
105
+ ## FASES POR COMANDO
106
+
107
+ ### /elsabro:start
108
+ ```
109
+ Fases: initializing → detecting_context → greeting → transitioning → done
110
+ ```
111
+
112
+ ### /elsabro:plan
113
+ ```
114
+ Fases: initializing → exploring → researching → planning → validating → done
115
+ ```
116
+
117
+ ### /elsabro:execute
118
+ ```
119
+ Fases: initializing → exploring → executing_wave_N → verifying → done
120
+ ```
121
+
122
+ ### /elsabro:verify-work
123
+ ```
124
+ Fases: initializing → verifying → aggregating → done
125
+ ```
126
+
127
+ ### /elsabro:debug
128
+ ```
129
+ Fases: initializing → diagnosing → fixing → verifying → done
130
+ ```
131
+
132
+ ### /elsabro:quick
133
+ ```
134
+ Fases: initializing → executing → done
135
+ ```
136
+
137
+ ---
138
+
139
+ ## CONTEXTO QUE CADA COMANDO DEBE PASAR
140
+
141
+ ### start → plan
142
+ ```json
143
+ {
144
+ "project_type": "greenfield | brownfield | continuation",
145
+ "tech_stack": ["detectado"],
146
+ "user_intent": "add_feature | fix_bug | refactor | understand"
147
+ }
148
+ ```
149
+
150
+ ### start → new
151
+ ```json
152
+ {
153
+ "project_type": "greenfield",
154
+ "selected_skill": "full-stack-app | mobile-app | etc",
155
+ "user_level": "beginner | intermediate | advanced"
156
+ }
157
+ ```
158
+
159
+ ### plan → execute
160
+ ```json
161
+ {
162
+ "plan_file": ".planning/01-PLAN.md",
163
+ "phases": [1, 2, 3],
164
+ "tech_stack": ["verificado con Context7"],
165
+ "ready_for_execution": true
166
+ }
167
+ ```
168
+
169
+ ### execute → verify-work
170
+ ```json
171
+ {
172
+ "changed_files": ["src/auth.ts", "src/api/login.ts"],
173
+ "commits": ["abc123", "def456"],
174
+ "tests_added": ["tests/auth.test.ts"],
175
+ "phase_completed": 1
176
+ }
177
+ ```
178
+
179
+ ### verify-work → (complete)
180
+ ```json
181
+ {
182
+ "verification_result": "PASS | FAIL | PARTIAL",
183
+ "ready_for_merge": true,
184
+ "report_path": ".planning/VERIFICATION-REPORT.md"
185
+ }
186
+ ```
187
+
188
+ ### debug → execute
189
+ ```json
190
+ {
191
+ "root_cause": "descripción del problema",
192
+ "fix_approach": "plan de corrección",
193
+ "affected_files": ["archivos a modificar"]
194
+ }
195
+ ```
196
+
197
+ ---
198
+
199
+ ## TRANSICIONES VÁLIDAS
200
+
201
+ ```
202
+ start → new ✓
203
+ start → plan ✓
204
+ start → debug ✓
205
+ start → quick ✓
206
+
207
+ new → plan ✓
208
+ new → execute ✗ (necesita plan)
209
+
210
+ plan → execute ✓
211
+ plan → plan ✓ (refinar)
212
+
213
+ execute → verify ✓
214
+ execute → execute ✓ (continuar)
215
+
216
+ verify → execute ✓ (fix gaps)
217
+ verify → done ✓
218
+
219
+ debug → execute ✓
220
+ debug → plan ✓ (fix complejo)
221
+
222
+ quick → verify ✓
223
+ quick → done ✓
224
+ ```
225
+
226
+ ---
227
+
228
+ ## ACTUALIZACIÓN DE context.md
229
+
230
+ Después de cada comando, actualizar `.elsabro/context.md` para humanos:
231
+
232
+ ```markdown
233
+ # Estado Actual del Proyecto
234
+
235
+ **Última actualización**: [timestamp]
236
+ **Comando actual**: [current_flow.command o "ninguno"]
237
+ **Fase**: [current_flow.phase o "completado"]
238
+
239
+ ## Contexto del Proyecto
240
+ - **Tipo**: [context.project_type]
241
+ - **Stack**: [context.tech_stack]
242
+ - **Feature actual**: [context.current_feature]
243
+
244
+ ## Historial Reciente
245
+ 1. [history[-1].command] - [history[-1].result] ([timestamp])
246
+ 2. [history[-2].command] - [history[-2].result] ([timestamp])
247
+ 3. [history[-3].command] - [history[-3].result] ([timestamp])
248
+
249
+ ## Siguiente Paso Sugerido
250
+ [suggested_next o inferir de context]
251
+
252
+ ## Para Continuar
253
+ ```bash
254
+ # Si hay flujo en progreso
255
+ /elsabro:start # Te preguntará si continuar
256
+
257
+ # Si empezar algo nuevo
258
+ /elsabro:[comando] # Empezar directamente
259
+ ```
260
+ ```
261
+
262
+ ---
263
+
264
+ ## RECUPERACIÓN DE ESTADO
265
+
266
+ ### Si el usuario vuelve después de pausa
267
+
268
+ 1. Leer `.elsabro/state.json`
269
+ 2. Si `current_flow !== null`:
270
+ - Mostrar qué estaba haciendo
271
+ - Ofrecer continuar o empezar nuevo
272
+ 3. Si `current_flow === null`:
273
+ - Mostrar historial reciente
274
+ - Sugerir siguiente paso basado en `suggested_next`
275
+
276
+ ### Si `.elsabro/state.json` está corrupto
277
+
278
+ 1. Intentar leer `.elsabro/context.md` para contexto
279
+ 2. Si falla, empezar fresh pero advertir al usuario
280
+ 3. Crear backup del archivo corrupto
281
+
282
+ ### Si hay cambios sin commit
283
+
284
+ 1. Detectar con `git status`
285
+ 2. Advertir al usuario
286
+ 3. Ofrecer:
287
+ - Continuar donde lo dejó
288
+ - Guardar cambios (commit)
289
+ - Descartar cambios
290
+
291
+ ---
292
+
293
+ ## CHECKLIST DE SINCRONIZACIÓN
294
+
295
+ Cada comando debe verificar antes de completar:
296
+
297
+ - [ ] `state.json` leído al inicio
298
+ - [ ] Flujo en progreso verificado
299
+ - [ ] `current_flow` actualizado al iniciar
300
+ - [ ] `current_flow.phase` actualizado en cada cambio
301
+ - [ ] `history` actualizado al completar
302
+ - [ ] `current_flow` limpiado al completar
303
+ - [ ] `suggested_next` establecido
304
+ - [ ] `context.md` actualizado
305
+ - [ ] Contexto relevante pasado al siguiente comando
306
+
307
+ ---
308
+
309
+ ## EJEMPLO COMPLETO: Flow de Feature Nueva
310
+
311
+ ```
312
+ # Usuario ejecuta /elsabro:start
313
+
314
+ 1. start lee state.json (vacío o existente)
315
+ 2. start detecta: brownfield
316
+ 3. Usuario elige: "Agregar funcionalidad"
317
+ 4. start actualiza state.json:
318
+ {
319
+ current_flow: { command: "start", phase: "transitioning" },
320
+ context: { user_intent: "add_feature", project_type: "brownfield" }
321
+ }
322
+ 5. start invoca /elsabro:plan con contexto
323
+
324
+ # /elsabro:plan toma control
325
+
326
+ 6. plan lee state.json → ve que viene de start
327
+ 7. plan actualiza: current_flow: { command: "plan", phase: "exploring" }
328
+ 8. plan ejecuta exploración (HAIKU x3)
329
+ 9. plan actualiza: current_flow.phase: "researching"
330
+ 10. plan crea RESEARCH.md y PLAN.md
331
+ 11. plan actualiza: current_flow.phase: "validating"
332
+ 12. plan valida el plan
333
+ 13. plan actualiza state.json:
334
+ {
335
+ current_flow: null,
336
+ context: { ...existing, plan_file: ".planning/01-PLAN.md", ready_for_execution: true },
337
+ history: [..., { command: "plan", result: "created", artifact: ".planning/01-PLAN.md" }],
338
+ suggested_next: "execute"
339
+ }
340
+ 14. plan sugiere al usuario: "¿Ejecutar? → /elsabro:execute 1"
341
+
342
+ # /elsabro:execute toma control
343
+
344
+ 15. execute lee state.json → ve plan_file y ready_for_execution
345
+ 16. execute actualiza: current_flow: { command: "execute", phase: "exploring" }
346
+ 17. execute explora (HAIKU x3)
347
+ 18. execute actualiza: current_flow.phase: "executing_wave_1"
348
+ 19. execute implementa (OPUS x2)
349
+ 20. execute actualiza: current_flow.phase: "verifying"
350
+ 21. execute verifica (OPUS x3)
351
+ 22. execute actualiza state.json:
352
+ {
353
+ current_flow: null,
354
+ context: { ...existing, changed_files: [...], commits: [...] },
355
+ history: [..., { command: "execute", result: "completed", artifact: null }],
356
+ suggested_next: "verify-work"
357
+ }
358
+
359
+ # /elsabro:verify-work finaliza
360
+
361
+ 23. verify lee state.json → ve changed_files y commits
362
+ 24. verify ejecuta verificación (OPUS x3)
363
+ 25. verify actualiza state.json:
364
+ {
365
+ current_flow: null,
366
+ context: { ...existing, verification_result: "PASS" },
367
+ history: [..., { command: "verify-work", result: "PASS" }],
368
+ suggested_next: null // Feature completa
369
+ }
370
+ 26. verify muestra: "¡Listo para merge!"
371
+ ```
372
+
373
+ ---
374
+
375
+ ## NOTAS DE IMPLEMENTACIÓN
376
+
377
+ 1. **Atomic Writes**: Usar Write con JSON completo, no edits parciales
378
+ 2. **Timestamps ISO**: Siempre usar `new Date().toISOString()`
379
+ 3. **Contexto Acumulativo**: Cada comando agrega contexto, nunca reemplaza
380
+ 4. **History Limitado**: Mantener últimos 20 entries, archivar resto
381
+ 5. **Backup Diario**: Crear `.elsabro/history/YYYY-MM-DD.json` con estado del día