elsabro 7.4.0 → 7.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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ELSABRO v7.4.0
1
+ # ELSABRO v7.5.0
2
2
 
3
3
  **Tu asistente AI para crear apps increibles** — Orquestacion de agentes con flow engine, checkpointing, ejecucion paralela y skill auto-discovery.
4
4
 
@@ -338,6 +338,7 @@ rm -rf .elsabro .planning
338
338
 
339
339
  | Version | Milestone | Cambio Principal |
340
340
  |---------|-----------|-----------------|
341
+ | 7.5.0 | M7+ | Skill gate enforcement, 5-layer enforcement, Agent Teams review, plan verification gate |
341
342
  | 7.4.0 | M7+ | Skill invocation protocol, review gate enforcement, auto-sync hook, 47 nodos, 399 tests |
342
343
  | 7.3.2 | M7 | Validation errors/warnings separation, case-insensitive hasCriticalIssues |
343
344
  | 7.3.1 | M7 | PR #1: 23 critical fixes, skill auto-install hooks, deprecated teams bypass |
package/bin/install.js CHANGED
@@ -422,6 +422,77 @@ async function install() {
422
422
  }
423
423
  }
424
424
 
425
+ // Install review-gate hooks in settings.json
426
+ // These hooks enforce code review before git commit/push
427
+ if (!settings.hooks) {
428
+ settings.hooks = {};
429
+ }
430
+
431
+ // PostToolUse: Set review-pending flag when code is modified
432
+ const reviewGateSetHook = {
433
+ type: 'command',
434
+ command: 'input=$(cat); file=$(echo "$input" | jq -r \'.tool_input.file_path // "unknown"\' 2>/dev/null); if [ -f "$CLAUDE_PROJECT_DIR/hooks/review-gate.sh" ]; then bash "$CLAUDE_PROJECT_DIR/hooks/review-gate.sh" set "$file" 2>/dev/null; fi; exit 0'
435
+ };
436
+
437
+ // PreToolUse: Block git commit/push if review is pending
438
+ const reviewGateCheckHook = {
439
+ type: 'command',
440
+ command: 'input=$(cat); cmd=$(echo "$input" | jq -r \'.tool_input.command // ""\' 2>/dev/null); if echo "$cmd" | grep -qE \'git commit|git push\'; then if [ -f "$CLAUDE_PROJECT_DIR/hooks/review-gate.sh" ]; then bash "$CLAUDE_PROJECT_DIR/hooks/review-gate.sh" check; exit $?; fi; fi; exit 0'
441
+ };
442
+
443
+ // Merge PostToolUse hooks: remove any stale review-gate entries, then add correct one
444
+ if (!settings.hooks.PostToolUse || !Array.isArray(settings.hooks.PostToolUse)) {
445
+ settings.hooks.PostToolUse = [];
446
+ }
447
+ // Remove existing review-gate entries (any matcher) to avoid duplicates
448
+ const prevPostCount = settings.hooks.PostToolUse.length;
449
+ settings.hooks.PostToolUse = settings.hooks.PostToolUse.filter(entry =>
450
+ !(entry.hooks && entry.hooks.some(h => h.command && h.command.includes('review-gate.sh')))
451
+ );
452
+ // Add canonical review-gate entry with correct matcher
453
+ settings.hooks.PostToolUse.push({
454
+ matcher: 'Write|Edit',
455
+ hooks: [reviewGateSetHook]
456
+ });
457
+ const verb1 = prevPostCount > settings.hooks.PostToolUse.length ? 'actualizado' : 'instalado';
458
+ console.log(` ${green}✓${reset} Review gate (PostToolUse) ${verb1}`);
459
+
460
+ // Merge PreToolUse hooks: remove any stale review-gate entries, then add correct one
461
+ if (!settings.hooks.PreToolUse || !Array.isArray(settings.hooks.PreToolUse)) {
462
+ settings.hooks.PreToolUse = [];
463
+ }
464
+ // Remove existing review-gate entries (any matcher) to avoid duplicates
465
+ const prevPreCount = settings.hooks.PreToolUse.length;
466
+ settings.hooks.PreToolUse = settings.hooks.PreToolUse.filter(entry =>
467
+ !(entry.hooks && entry.hooks.some(h => h.command && h.command.includes('review-gate.sh')))
468
+ );
469
+ // Add canonical review-gate entry with correct matcher and exit $? fix
470
+ settings.hooks.PreToolUse.push({
471
+ matcher: 'Bash',
472
+ hooks: [reviewGateCheckHook]
473
+ });
474
+ const verb2 = prevPreCount > settings.hooks.PreToolUse.length ? 'actualizado' : 'instalado';
475
+ console.log(` ${green}✓${reset} Review gate (PreToolUse) ${verb2}`);
476
+
477
+ // Install skill-gate hooks in settings.json
478
+ // These hooks enforce skill discovery before code changes (only when ELSABRO mode is active)
479
+ const skillGateCheckHook = {
480
+ type: 'command',
481
+ command: 'if [ -f "$CLAUDE_PROJECT_DIR/hooks/skill-gate.sh" ]; then bash "$CLAUDE_PROJECT_DIR/hooks/skill-gate.sh" check; exit $?; fi; exit 0'
482
+ };
483
+
484
+ // Merge PreToolUse hooks for skill-gate: remove stale entries, then add correct one
485
+ const prevSkillGateCount = settings.hooks.PreToolUse.length;
486
+ settings.hooks.PreToolUse = settings.hooks.PreToolUse.filter(entry =>
487
+ !(entry.hooks && entry.hooks.some(h => h.command && h.command.includes('skill-gate.sh')))
488
+ );
489
+ settings.hooks.PreToolUse.push({
490
+ matcher: 'Write|Edit',
491
+ hooks: [skillGateCheckHook]
492
+ });
493
+ const verb3 = prevSkillGateCount > settings.hooks.PreToolUse.length ? 'actualizado' : 'instalado';
494
+ console.log(` ${green}✓${reset} Skill gate (PreToolUse) ${verb3}`);
495
+
425
496
  // Add version tracking
426
497
  settings.elsabro = {
427
498
  version: pkg.version,
@@ -10,6 +10,9 @@ allowed-tools:
10
10
  - Grep
11
11
  - WebSearch
12
12
  - Task
13
+ - TeamCreate
14
+ - TeamDelete
15
+ - SendMessage
13
16
  - AskUserQuestion
14
17
  - mcp__plugin_context7_context7__*
15
18
  argument-hint: "[descripción del problema]"
@@ -133,25 +136,51 @@ El debugger actualizará el archivo de sesión con:
133
136
  - Fix implementado
134
137
  - Verificación realizada
135
138
 
136
- ## Paso 5: Code Review (OBLIGATORIO)
139
+ ## Paso 5: Code Review (OBLIGATORIO - Agent Teams LITE)
137
140
 
138
- **REGLA:** Después de implementar cualquier fix, SIEMPRE ejecutar code review antes de reportar al usuario.
139
-
140
- ```
141
- Task(pr-review-toolkit:code-reviewer):
142
- Revisa los cambios del fix aplicado.
143
- Busca bugs, code smells, seguridad.
144
- Archivos modificados: [lista de archivos cambiados]
145
- ```
146
-
147
- Si el review encuentra issues, corregir ANTES de reportar al usuario.
141
+ **REGLA:** Después de implementar cualquier fix, SIEMPRE ejecutar code review con Agent Teams antes de reportar al usuario.
148
142
 
149
143
  ```javascript
144
+ // Crear team de review LITE (3 agentes esenciales)
145
+ TeamCreate({ team_name: "elsabro-review-lite", description: "Quick review - 3 agentes especializados" })
146
+
147
+ // Lanzar 3 teammates en paralelo (UN SOLO MENSAJE)
148
+ Task({
149
+ subagent_type: "pr-review-toolkit:code-reviewer",
150
+ team_name: "elsabro-review-lite",
151
+ name: "quality-reviewer",
152
+ model: "sonnet",
153
+ prompt: "Review code quality of the fix: bugs, code smells, naming, patterns. Focus on modified files. DO NOT ask questions."
154
+ })
155
+ Task({
156
+ subagent_type: "pr-review-toolkit:silent-failure-hunter",
157
+ team_name: "elsabro-review-lite",
158
+ name: "failure-hunter",
159
+ model: "sonnet",
160
+ prompt: "Review fix for silent failures, error handling gaps, dangerous fallbacks. Focus on modified files. DO NOT ask questions."
161
+ })
162
+ Task({
163
+ subagent_type: "pr-review-toolkit:pr-test-analyzer",
164
+ team_name: "elsabro-review-lite",
165
+ name: "test-analyzer",
166
+ model: "sonnet",
167
+ prompt: "Analyze test coverage for the fix: edge cases, regression tests needed. Focus on modified files. DO NOT ask questions."
168
+ })
169
+
170
+ // Consolidar hallazgos. Si issues criticos > 0: fix y re-review
171
+ // Shutdown team
172
+ for (const name of ["quality-reviewer", "failure-hunter", "test-analyzer"]) {
173
+ SendMessage({ type: "shutdown_request", recipient: name, content: "Review complete" })
174
+ }
175
+ TeamDelete()
176
+
150
177
  // MARCAR: code review pasó (para code_review_gate en siguiente_paso)
151
178
  state.current_flow.code_review_passed = true;
152
179
  Write(".elsabro/state.json", JSON.stringify(state, null, 2));
153
180
  ```
154
181
 
182
+ Si alguno de los 3 reviewers encuentra issues criticos, corregir y re-review ANTES de reportar al usuario.
183
+
155
184
  ## Paso 6: Verificar con Usuario
156
185
 
157
186
  Una vez el debugger reporta fix:
@@ -177,18 +206,27 @@ Para verificar:
177
206
  ```
178
207
  ¿Se implementó un fix (modo find_and_fix)?
179
208
 
180
- ├─ SÍ → ¿Se ejecutó code review (Paso 5)?
209
+ ├─ SÍ → ¿Se ejecutó code review con Agent Teams LITE (Paso 5)?
181
210
  │ │
182
211
  │ ├─ NO → EJECUTAR AHORA:
183
- │ │ Task(pr-review-toolkit:code-reviewer)
184
- │ │ Si issues > 0: fix y re-review
185
- │ │ Solo cuando issues == 0: continuar
212
+ │ │ TeamCreate("elsabro-review-lite")
213
+ │ │ + 3 teammates: quality-reviewer, failure-hunter, test-analyzer
214
+ │ │ Consolidar hallazgos
215
+ │ │ Si issues criticos > 0: fix y re-review
216
+ │ │ Solo cuando issues == 0: shutdown + TeamDelete + continuar
186
217
  │ │
187
- │ └─ SÍ, issues == 0 → Continuar
218
+ │ └─ SÍ, issues == 0, team deleted → Continuar
188
219
 
189
220
  └─ NO (solo find_root_cause_only) → Continuar (no aplica)
190
221
  ```
191
222
 
223
+ **Agent Teams LITE — 3 Reviewers:**
224
+ | Teammate | Plugin | Foco |
225
+ |----------|--------|------|
226
+ | quality-reviewer | pr-review-toolkit:code-reviewer | bugs, patterns, naming |
227
+ | failure-hunter | pr-review-toolkit:silent-failure-hunter | error handling, fallbacks |
228
+ | test-analyzer | pr-review-toolkit:pr-test-analyzer | coverage, edge cases |
229
+
192
230
  **VIOLACIÓN CRÍTICA**: Reportar fix sin code review = ABORTAR OPERACIÓN
193
231
  </code_review_gate>
194
232
 
@@ -34,6 +34,78 @@ vive en el engine y en `flows/development-flow.json`. Este archivo solo define e
34
34
  Leer `.elsabro/state.json` siguiendo el protocolo de @references/state-sync.md.
35
35
  Verificar flujo en progreso. Actualizar phase a "stepping".
36
36
 
37
+ ### Skill Discovery Gate (OBLIGATORIO)
38
+
39
+ Antes de cualquier otra accion, verificar que skill discovery fue ejecutado:
40
+
41
+ ```javascript
42
+ // GATE: Verificar skill discovery antes de ejecutar
43
+ const skillGateResult = Bash('bash hooks/skill-gate.sh status');
44
+ const skillGate = JSON.parse(skillGateResult);
45
+
46
+ if (skillGate.elsabro_active && !skillGate.done) {
47
+ // Skill discovery no ejecutado — ejecutar ahora
48
+ output("Ejecutando skill discovery antes de continuar...");
49
+ state.context = state.context || {};
50
+ try {
51
+ const discoveryResult = Bash(`bash ./hooks/skill-discovery.sh "${inputs.task || args}" "medium"`, { timeout: 30000 });
52
+ try {
53
+ state.context.available_skills = JSON.parse(discoveryResult).recommended || [];
54
+ } catch (e) {
55
+ output("Warning: skill-discovery devolvio JSON invalido, continuando sin skills");
56
+ state.context.available_skills = [];
57
+ }
58
+ } catch (e) {
59
+ output("Warning: skill-discovery fallo, continuando sin skills");
60
+ state.context.available_skills = [];
61
+ }
62
+ Write(".elsabro/state.json", JSON.stringify(state, null, 2));
63
+ Bash('bash hooks/skill-gate.sh set "execute"');
64
+ }
65
+ ```
66
+
67
+ ### Plan Verification (OBLIGATORIO)
68
+
69
+ Antes de ejecutar CUALQUIER codigo, verificar que existe un plan aprobado:
70
+
71
+ ```javascript
72
+ // GATE: No ejecutar sin plan previo
73
+ state.context = state.context || {};
74
+ const planFile = state.context.plan_file;
75
+ const hasPlan = planFile && fs.existsSync(planFile);
76
+ const hasPlanInPlanning = fs.readdirSync('.planning/').some(f => f.endsWith('-PLAN.md'));
77
+
78
+ if (!hasPlan && !hasPlanInPlanning) {
79
+ // No hay plan — forzar planificacion primero
80
+ output("⚠ No se encontro plan de implementacion.");
81
+ output("→ Ejecuta /elsabro:plan primero, o usa EnterPlanMode para crear un plan.");
82
+ output("→ ELSABRO requiere un plan aprobado antes de ejecutar codigo.");
83
+
84
+ // Ofrecer opciones al usuario
85
+ const answer = AskUserQuestion({
86
+ questions: [{
87
+ question: "No hay plan de implementacion. ¿Que deseas hacer?",
88
+ header: "Plan Check",
89
+ options: [
90
+ { label: "Crear plan ahora (Recomendado)", description: "Entra a plan mode para disenar la implementacion" },
91
+ { label: "Continuar sin plan", description: "Solo para tareas triviales - se registra como excepcion" }
92
+ ],
93
+ multiSelect: false
94
+ }]
95
+ });
96
+
97
+ if (answer.includes("Crear plan")) {
98
+ EnterPlanMode();
99
+ return; // Exit execute — se reanuda despues de aprobar plan
100
+ }
101
+
102
+ // Usuario eligio continuar sin plan — registrar excepcion
103
+ state.context.plan_skipped = true;
104
+ state.context.plan_skip_reason = "user_override";
105
+ Write(".elsabro/state.json", JSON.stringify(state, null, 2));
106
+ }
107
+ ```
108
+
37
109
  ```bash
38
110
  FLOW="flows/development-flow.json"
39
111
  TASK="[descripcion de la tarea del usuario]"
@@ -548,15 +620,166 @@ Cuando el loop retorna `{ finished: true }`:
548
620
  - Establecer `suggested_next: "verify-work"`
549
621
  2. Actualizar `.elsabro/context.md` con resumen legible
550
622
 
623
+ <code_review_gate>
624
+ ## 5.1. Code Review Gate (OBLIGATORIO - NO NEGOCIABLE)
625
+
626
+ **ANTES de mostrar resultado o ofrecer commit, VERIFICAR:**
627
+
628
+ ```
629
+ ¿Se escribió/modificó código durante la ejecución?
630
+
631
+ ├─ SÍ → ¿Se ejecutó code review (parallel_review node)?
632
+ │ │
633
+ │ ├─ NO → EJECUTAR AHORA con Agent Teams FULL (5 agentes):
634
+ │ │ 1. bash hooks/review-gate.sh set (si no esta activo)
635
+ │ │ 2. TeamCreate("elsabro-review") + 5 teammates especializados
636
+ │ │ 3. Consolidar hallazgos de los 5 reviewers
637
+ │ │ 4. Si issues criticos > 0: fix y re-review (max 3 iteraciones)
638
+ │ │ 5. Solo cuando issues criticos == 0: bash hooks/review-gate.sh clear
639
+ │ │ 6. SendMessage(shutdown_request) x5 + TeamDelete()
640
+ │ │ 7. Continuar
641
+ │ │
642
+ │ └─ SÍ, issues == 0, gate cleared → Continuar
643
+
644
+ └─ NO → Continuar (no aplica)
645
+ ```
646
+
647
+ ```javascript
648
+ // Verificacion programatica del review gate
649
+ const gateStatus = Bash("bash hooks/review-gate.sh status");
650
+ const gate = JSON.parse(gateStatus);
651
+
652
+ state.current_flow = state.current_flow || {};
653
+
654
+ if (gate.pending) {
655
+ // Hay codigo modificado sin review — EJECUTAR REVIEW con Agent Teams FULL
656
+ state.current_flow.code_written = true;
657
+ output("⚠ Review gate activo: " + gate.count + " archivo(s) sin revisar");
658
+ output("→ Lanzando Agent Teams FULL review (5 agentes especializados)...");
659
+
660
+ // 1. Crear team de review
661
+ TeamCreate({ team_name: "elsabro-review", description: "Code review team - 5 agentes especializados" })
662
+
663
+ // 2. Lanzar 5 teammates en paralelo (UN SOLO MENSAJE con multiples Task calls)
664
+ Task({
665
+ subagent_type: "pr-review-toolkit:code-reviewer",
666
+ team_name: "elsabro-review",
667
+ name: "quality-reviewer",
668
+ model: "sonnet",
669
+ prompt: "Review code quality: naming conventions, design patterns, DRY, SOLID principles. Focus on recently modified files. DO NOT ask questions. Report only high-confidence issues."
670
+ })
671
+ Task({
672
+ subagent_type: "feature-dev:code-reviewer",
673
+ team_name: "elsabro-review",
674
+ name: "security-reviewer",
675
+ model: "sonnet",
676
+ prompt: "Review security: OWASP top 10, injection vulnerabilities, XSS, secrets exposure, token handling, input validation. Focus on recently modified files. DO NOT ask questions. Report only high-confidence issues."
677
+ })
678
+ Task({
679
+ subagent_type: "pr-review-toolkit:pr-test-analyzer",
680
+ team_name: "elsabro-review",
681
+ name: "test-analyzer",
682
+ model: "sonnet",
683
+ prompt: "Analyze test coverage: missing tests, edge cases, happy/error paths, test quality. Focus on recently modified files. DO NOT ask questions. Report only critical gaps."
684
+ })
685
+ Task({
686
+ subagent_type: "pr-review-toolkit:silent-failure-hunter",
687
+ team_name: "elsabro-review",
688
+ name: "performance-reviewer",
689
+ model: "sonnet",
690
+ prompt: "Review for silent failures, N+1 queries, memory leaks, inadequate error handling, dangerous fallback behavior. Focus on recently modified files. DO NOT ask questions. Report only high-confidence issues."
691
+ })
692
+ Task({
693
+ subagent_type: "pr-review-toolkit:type-design-analyzer",
694
+ team_name: "elsabro-review",
695
+ name: "type-analyzer",
696
+ model: "sonnet",
697
+ prompt: "Analyze type design: encapsulation, invariant expression, null safety, interface correctness. Focus on recently modified files. DO NOT ask questions. Report only high-confidence issues."
698
+ })
699
+
700
+ // 3. Consolidar resultados — esperar que todos terminen
701
+ // Agregar hallazgos de cada reviewer al reporte consolidado
702
+ // Si ANY reviewer reporta issues criticos: fix y re-review (max 3 iteraciones)
703
+
704
+ // 4. Shutdown team
705
+ for (const name of ["quality-reviewer", "security-reviewer", "test-analyzer", "performance-reviewer", "type-analyzer"]) {
706
+ SendMessage({ type: "shutdown_request", recipient: name, content: "Review complete" })
707
+ }
708
+ TeamDelete()
709
+
710
+ // 5. Si review pasa sin issues criticos, limpiar gate y setear flag
711
+ Bash("bash hooks/review-gate.sh clear");
712
+ state.current_flow.code_review_passed = true;
713
+ Write(".elsabro/state.json", JSON.stringify(state, null, 2));
714
+ }
715
+ ```
716
+
717
+ **Donde se setean los flags:**
718
+ - `state.current_flow.code_written = true` — se setea aqui (5.1) cuando review-gate.sh detecta archivos pendientes, y tambien por el PostToolUse hook al hacer Write/Edit
719
+ - `state.current_flow.code_review_passed = true` — se setea aqui (5.1) despues de que los 5 reviewers pasan sin issues criticos y el gate se limpia
720
+
721
+ **Agent Teams FULL — 5 Reviewers:**
722
+ | Teammate | Plugin | Foco |
723
+ |----------|--------|------|
724
+ | quality-reviewer | pr-review-toolkit:code-reviewer | naming, patterns, DRY, SOLID |
725
+ | security-reviewer | feature-dev:code-reviewer | OWASP, injection, secrets |
726
+ | test-analyzer | pr-review-toolkit:pr-test-analyzer | coverage, edge cases |
727
+ | performance-reviewer | pr-review-toolkit:silent-failure-hunter | silent failures, N+1, memory |
728
+ | type-analyzer | pr-review-toolkit:type-design-analyzer | types, encapsulation, null safety |
729
+
730
+ **VIOLACIÓN CRÍTICA**: Reportar resultado o ofrecer commit sin code review = ABORTAR OPERACIÓN
731
+ </code_review_gate>
732
+
733
+ <siguiente_paso>
551
734
  ## 6. Siguiente Paso
552
735
 
553
- **Gate checks** (por referencia a @references/enforcement-rules.md):
554
- - Rule 7: Si se escribio codigo -> code review debe haber pasado (el flow lo garantiza via parallel_review)
555
- - Rule 8: Si se usaron 2+ agentes -> Agent Teams debe haberse usado (callbacks.js lo garantiza)
736
+ Al completar la ejecucion, verificar gates programaticamente antes de sugerir siguiente paso:
737
+
738
+ ```javascript
739
+ // GATE CHECK: Enforcement estricto antes de cerrar
740
+ state.current_flow = state.current_flow || {};
741
+
742
+ // Cross-check: review-gate.sh es la fuente de verdad para codigo pendiente
743
+ const gateStatus = Bash("bash hooks/review-gate.sh status");
744
+ const gate = JSON.parse(gateStatus);
745
+
746
+ // Si review-gate tiene archivos pendientes, code_written DEBE estar seteado
747
+ if (gate.pending && !state.current_flow.code_written) {
748
+ state.current_flow.code_written = true; // Auto-fix inconsistencia
749
+ }
750
+
751
+ // Flags verificados
752
+ const codeWritten = state.current_flow.code_written === true;
753
+ const codeReviewPassed = state.current_flow.code_review_passed === true;
754
+
755
+ // Rule 7: Si se escribio codigo, code review DEBE haber pasado
756
+ if (codeWritten && !codeReviewPassed) {
757
+ // VIOLACIÓN CRÍTICA — NO proceder. Volver a code_review_gate.
758
+ output("⛔ CRITICAL: Code written without review. Execute section 5.1 first.");
759
+ output("→ Volver a Code Review Gate (seccion 5.1) antes de continuar.");
760
+ return; // Bloquea — no se puede llegar a suggested_next sin review
761
+ }
762
+
763
+ // Rule 7b: Double-check con review-gate.sh (fuente de verdad del sistema)
764
+ if (gate.pending) {
765
+ output("⛔ REVIEW GATE PENDING: " + gate.count + " file(s) sin revisar.");
766
+ output("→ Ejecutar code review y bash hooks/review-gate.sh clear primero.");
767
+ return; // Bloquea — gate aun activo
768
+ }
769
+
770
+ // Rule 8: Si se usaron 2+ agentes, Agent Teams debe haberse usado
771
+ // (callbacks.js lo garantiza, pero verificamos por seguridad)
772
+
773
+ // Todo limpio — establecer siguiente paso
774
+ state.suggested_next = "verify-work";
775
+ Write(".elsabro/state.json", JSON.stringify(state, null, 2));
776
+ ```
556
777
 
778
+ Mostrar al usuario:
557
779
  ```
558
780
  Siguiente Paso
559
781
 
560
- -> /elsabro:verify-work -- verificar el trabajo completado
561
- -> /elsabro:progress -- ver el progreso general del proyecto
782
+ /elsabro:verify-work verificar el trabajo completado
783
+ /elsabro:progress ver el progreso general del proyecto
562
784
  ```
785
+ </siguiente_paso>
@@ -1,6 +1,18 @@
1
1
  ---
2
2
  name: quick
3
3
  description: Modo de ejecución rápida para tareas simples - mínima ceremonia, máxima velocidad
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Edit
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - Task
12
+ - TeamCreate
13
+ - TeamDelete
14
+ - SendMessage
15
+ - AskUserQuestion
4
16
  sync:
5
17
  reads: [".elsabro/state.json"]
6
18
  writes: [".elsabro/state.json", ".elsabro/context.md"]
@@ -126,9 +138,11 @@ ELSABRO: [Ejecuta en <30 segundos]
126
138
  4. Verify (10 seg)
127
139
  └─ Correr tests afectados
128
140
 
129
- 5. Code Review (OBLIGATORIO)
130
- └─ Task(pr-review-toolkit:code-reviewer) sobre archivos modificados
131
- └─ Si hay issues: fix antes de reportar
141
+ 5. Code Review (OBLIGATORIO - Agent Teams LITE)
142
+ └─ TeamCreate("elsabro-review-lite") + 3 teammates especializados
143
+ └─ quality-reviewer + failure-hunter + test-analyzer (en paralelo)
144
+ └─ Consolidar hallazgos. Si issues criticos: fix y re-review
145
+ └─ SendMessage(shutdown_request) x3 + TeamDelete()
132
146
  └─ Si issues == 0: state.current_flow.code_review_passed = true ← MARCAR
133
147
 
134
148
  6. Report
@@ -141,7 +155,7 @@ ELSABRO: [Ejecuta en <30 segundos]
141
155
  1. **Max 2 preguntas** - Si necesitas más info, usa `/elsabro:plan`
142
156
  2. **Max 3 archivos** - Si afecta más, usa flujo normal
143
157
  3. **Auto-test** - Siempre corre tests relacionados
144
- 4. **Auto-review** - SIEMPRE ejecutar code review con `Task(pr-review-toolkit:code-reviewer)` después de escribir código
158
+ 4. **Auto-review** - SIEMPRE ejecutar code review con Agent Teams LITE (3 agentes) después de escribir código
145
159
  5. **No docs** - Skip documentación para velocidad
146
160
  6. **Offer commit** - Siempre pregunta si commitear
147
161
 
@@ -177,18 +191,27 @@ Task({
177
191
  ```
178
192
  ¿Se escribió/modificó código?
179
193
 
180
- ├─ SÍ → ¿Se ejecutó code review (Paso 5)?
194
+ ├─ SÍ → ¿Se ejecutó code review con Agent Teams LITE (Paso 5)?
181
195
  │ │
182
196
  │ ├─ NO → EJECUTAR AHORA:
183
- │ │ Task(pr-review-toolkit:code-reviewer)
184
- │ │ Si issues > 0: fix y re-review
185
- │ │ Solo cuando issues == 0: continuar
197
+ │ │ TeamCreate("elsabro-review-lite")
198
+ │ │ + 3 teammates: quality-reviewer, failure-hunter, test-analyzer
199
+ │ │ Consolidar hallazgos
200
+ │ │ Si issues criticos > 0: fix y re-review
201
+ │ │ Solo cuando issues == 0: shutdown + TeamDelete + continuar
186
202
  │ │
187
- │ └─ SÍ, issues == 0 → Continuar
203
+ │ └─ SÍ, issues == 0, team deleted → Continuar
188
204
 
189
205
  └─ NO → Continuar (no aplica)
190
206
  ```
191
207
 
208
+ **Agent Teams LITE — 3 Reviewers:**
209
+ | Teammate | Plugin | Foco |
210
+ |----------|--------|------|
211
+ | quality-reviewer | pr-review-toolkit:code-reviewer | bugs, patterns, naming |
212
+ | failure-hunter | pr-review-toolkit:silent-failure-hunter | error handling, fallbacks |
213
+ | test-analyzer | pr-review-toolkit:pr-test-analyzer | coverage, edge cases |
214
+
192
215
  **VIOLACIÓN CRÍTICA**: Reportar resultado sin code review = ABORTAR OPERACIÓN
193
216
  </code_review_gate>
194
217
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "description": "ELSABRO Hooks Configuration v3.3 (hook config version) for ELSABRO v7.3.2 - Agent Teams + Blocking Review + Skill Discovery + Persistent Mode + Auto-Sync",
4
- "version": "3.3.0",
3
+ "description": "ELSABRO Hooks Configuration v3.5 (hook config version) for ELSABRO v7.4.0 - Agent Teams + Blocking Review + Skill Discovery + Skill Gate + Persistent Mode + Auto-Sync + Review Gate Enforcement",
4
+ "version": "3.5.0",
5
5
 
6
6
  "hooks": {
7
7
  "PreFlow": [
@@ -40,10 +40,34 @@
40
40
  "command": "./hooks/lint-check.sh",
41
41
  "timeout": 10000,
42
42
  "enabled": true
43
+ },
44
+ {
45
+ "id": "review-gate-set",
46
+ "name": "review-gate-set",
47
+ "description": "Activa review-pending flag cuando se modifica codigo. Bloquea git commit hasta que pase code review.",
48
+ "matcher": "Write|Edit",
49
+ "command": "input=$(cat); file=$(echo \"$input\" | jq -r '.tool_input.file_path // \"unknown\"' 2>/dev/null); if [ -f \"$CLAUDE_PROJECT_DIR/hooks/review-gate.sh\" ]; then bash \"$CLAUDE_PROJECT_DIR/hooks/review-gate.sh\" set \"$file\" 2>/dev/null; fi; exit 0",
50
+ "timeout": 5000,
51
+ "enabled": true,
52
+ "errorPolicy": "continue",
53
+ "settingsJsonHook": true,
54
+ "settingsJsonNote": "Este hook se instala en ~/.claude/settings.json via install.js"
43
55
  }
44
56
  ],
45
57
 
46
58
  "PreToolUse": [
59
+ {
60
+ "id": "skill-gate-check",
61
+ "name": "skill-gate-check",
62
+ "description": "Bloquea Write/Edit si skill discovery no se ejecuto. Solo activo cuando ELSABRO mode esta on.",
63
+ "matcher": "Write|Edit",
64
+ "command": "if [ -f \"$CLAUDE_PROJECT_DIR/hooks/skill-gate.sh\" ]; then bash \"$CLAUDE_PROJECT_DIR/hooks/skill-gate.sh\" check; exit $?; fi; exit 0",
65
+ "timeout": 5000,
66
+ "enabled": true,
67
+ "errorPolicy": "block",
68
+ "settingsJsonHook": true,
69
+ "settingsJsonNote": "Este hook se instala en ~/.claude/settings.json via install.js. Solo bloquea cuando elsabro_mode=true en state.json."
70
+ },
47
71
  {
48
72
  "id": "confirm-destructive",
49
73
  "name": "confirm-destructive",
@@ -53,6 +77,19 @@
53
77
  "command": "./hooks/confirm-destructive.sh",
54
78
  "timeout": 60000,
55
79
  "enabled": true
80
+ },
81
+ {
82
+ "id": "review-gate-check",
83
+ "name": "review-gate-check",
84
+ "description": "Bloquea git commit/push si hay review pendiente. Propaga exit code de review-gate.sh check.",
85
+ "matcher": "Bash",
86
+ "pattern": "git commit|git push",
87
+ "command": "input=$(cat); cmd=$(echo \"$input\" | jq -r '.tool_input.command // \"\"' 2>/dev/null); if echo \"$cmd\" | grep -qE 'git commit|git push'; then if [ -f \"$CLAUDE_PROJECT_DIR/hooks/review-gate.sh\" ]; then bash \"$CLAUDE_PROJECT_DIR/hooks/review-gate.sh\" check; exit $?; fi; fi; exit 0",
88
+ "timeout": 5000,
89
+ "enabled": true,
90
+ "errorPolicy": "block",
91
+ "settingsJsonHook": true,
92
+ "settingsJsonNote": "Este hook se instala en ~/.claude/settings.json via install.js. CRITICO: exit $? propaga el exit code de review-gate.sh"
56
93
  }
57
94
  ],
58
95
 
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env bash
2
+ # skill-gate.sh - ELSABRO Skill Discovery Gate Hook
3
+ #
4
+ # Enforces that skill discovery runs before any code changes.
5
+ # Only active when ELSABRO mode is on (elsabro_mode: true in state.json).
6
+ #
7
+ # Usage:
8
+ # After skill discovery: bash ./hooks/skill-gate.sh set
9
+ # PreToolUse (Write/Edit): bash ./hooks/skill-gate.sh check
10
+ # New session start: bash ./hooks/skill-gate.sh clear
11
+ # Query status: bash ./hooks/skill-gate.sh status
12
+ #
13
+ # Flag file: .elsabro/.skill-discovery-done
14
+ # This file tracks whether skill discovery was executed in the current session.
15
+
16
+ set -euo pipefail
17
+
18
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
19
+ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
20
+ ELSABRO_DIR="${PROJECT_ROOT}/.elsabro"
21
+ FLAG_FILE="${ELSABRO_DIR}/.skill-discovery-done"
22
+ STATE_FILE="${ELSABRO_DIR}/state.json"
23
+
24
+ # Colors for stderr
25
+ RED='\033[0;31m'
26
+ GREEN='\033[0;32m'
27
+ YELLOW='\033[1;33m'
28
+ NC='\033[0m'
29
+ PREFIX="[ELSABRO:skill-gate]"
30
+
31
+ ensure_dir() {
32
+ mkdir -p "$ELSABRO_DIR" 2>/dev/null || true
33
+ }
34
+
35
+ # Check if ELSABRO mode is active
36
+ is_elsabro_active() {
37
+ if [[ ! -f "$STATE_FILE" ]]; then
38
+ return 1
39
+ fi
40
+ local mode
41
+ mode=$(grep -o '"elsabro_mode"[[:space:]]*:[[:space:]]*true' "$STATE_FILE" 2>/dev/null || true)
42
+ [[ -n "$mode" ]]
43
+ }
44
+
45
+ cmd_set() {
46
+ ensure_dir
47
+ local timestamp
48
+ timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
49
+ local task_desc
50
+ task_desc=$(printf '%s' "${2:-session}" | tr -cd '[:alnum:]/._ -')
51
+ echo "$timestamp|$task_desc" > "$FLAG_FILE"
52
+ echo -e "${GREEN}${PREFIX}${NC} Skill discovery completed ($task_desc)" >&2
53
+ }
54
+
55
+ cmd_check() {
56
+ # Only enforce if ELSABRO is active
57
+ if ! is_elsabro_active; then
58
+ exit 0
59
+ fi
60
+
61
+ if [[ -f "$FLAG_FILE" ]]; then
62
+ echo -e "${GREEN}${PREFIX}${NC} OK: Skill discovery done" >&2
63
+ exit 0
64
+ fi
65
+
66
+ echo -e "${YELLOW}${PREFIX}${NC} WARNING: Skill discovery not executed yet" >&2
67
+ echo -e "${YELLOW}${PREFIX}${NC} Run: bash hooks/skill-discovery.sh \"[task]\" \"medium\"" >&2
68
+ echo -e "${YELLOW}${PREFIX}${NC} Then: bash hooks/skill-gate.sh set" >&2
69
+ # Exit 1 to block the operation
70
+ exit 1
71
+ }
72
+
73
+ cmd_clear() {
74
+ if [[ -f "$FLAG_FILE" ]]; then
75
+ rm -f "$FLAG_FILE"
76
+ echo -e "${GREEN}${PREFIX}${NC} Skill gate cleared (new session)" >&2
77
+ else
78
+ echo -e "${GREEN}${PREFIX}${NC} No skill discovery flag to clear" >&2
79
+ fi
80
+ }
81
+
82
+ cmd_status() {
83
+ local elsabro_active="false"
84
+ if is_elsabro_active; then
85
+ elsabro_active="true"
86
+ fi
87
+
88
+ if [[ -f "$FLAG_FILE" ]]; then
89
+ local content
90
+ content=$(cat "$FLAG_FILE" 2>/dev/null || echo "unknown")
91
+ echo "{\"done\":true,\"elsabro_active\":$elsabro_active,\"last_run\":\"$content\"}"
92
+ else
93
+ echo "{\"done\":false,\"elsabro_active\":$elsabro_active}"
94
+ fi
95
+ }
96
+
97
+ # Main
98
+ case "${1:-status}" in
99
+ set) cmd_set "$@" ;;
100
+ check) cmd_check ;;
101
+ clear) cmd_clear ;;
102
+ status) cmd_status ;;
103
+ *)
104
+ echo "Usage: skill-gate.sh {set|check|clear|status}" >&2
105
+ exit 1
106
+ ;;
107
+ esac
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elsabro",
3
- "version": "7.4.0",
3
+ "version": "7.5.0",
4
4
  "description": "Sistema de desarrollo AI-powered para Claude Code - BMAD Method Integration, Spec-Driven Development, Party Mode, Next Step Suggestions, Stitch UI Design, Agent Teams, blocking code review, orquestación avanzada con flows declarativos",
5
5
  "bin": {
6
6
  "elsabro": "bin/install.js",
@@ -151,41 +151,68 @@ fs.appendFile('.planning/TODOS.md', '- [ ] Fix validation bug');
151
151
 
152
152
  ---
153
153
 
154
- ### 7. Code Review OBLIGATORIO Después de Escribir Código
154
+ ### 7. Code Review con Agent Teams OBLIGATORIO Después de Escribir Código
155
155
 
156
- **PROHIBIDO**: Completar un comando que escribe/modifica código sin ejecutar code review.
156
+ **PROHIBIDO**: Completar un comando que escribe/modifica código sin ejecutar code review con Agent Teams.
157
157
 
158
- **OBLIGATORIO**: Después de cualquier operación que crea o modifica archivos de código, ejecutar `Task(pr-review-toolkit:code-reviewer)` sobre los archivos cambiados.
158
+ **OBLIGATORIO**: Después de cualquier operación que crea o modifica archivos de código, ejecutar code review usando Agent Teams con agentes especializados en paralelo.
159
159
 
160
160
  **Aplica a**: `execute`, `quick`, `debug` (modo find_and_fix), `new` (cuando genera código)
161
161
 
162
+ **Dos Tiers de Review:**
163
+
164
+ | Tier | Comandos | Agentes | Team Name |
165
+ |------|----------|---------|-----------|
166
+ | FULL | execute | 5 (quality, security, tests, performance, types) | elsabro-review |
167
+ | LITE | quick, debug, new | 3 (quality, failures, tests) | elsabro-review-lite |
168
+
162
169
  **Secuencia:**
163
170
  ```
164
171
  1. Escribir/modificar código
165
172
  2. Correr tests
166
- 3. Task(pr-review-toolkit:code-reviewer) sobre archivos cambiados ← OBLIGATORIO
167
- 4. Si hay issues: corregir y re-review
168
- 5. Solo entonces: reportar al usuario / ofrecer commit
173
+ 3. TeamCreate + N teammates especializados en paralelo ← OBLIGATORIO
174
+ 4. Consolidar hallazgos de todos los reviewers
175
+ 5. Si hay issues criticos: corregir y re-review (max 3 iteraciones)
176
+ 6. SendMessage(shutdown_request) xN + TeamDelete()
177
+ 7. Solo entonces: reportar al usuario / ofrecer commit
169
178
  ```
170
179
 
171
- **Ejemplo correcto:**
180
+ **Ejemplo correcto (FULL — execute):**
181
+ ```javascript
182
+ // Después de implementar feature
183
+ TeamCreate({ team_name: "elsabro-review", description: "5-agent review team" })
184
+
185
+ // 5 teammates en paralelo (UN SOLO MENSAJE)
186
+ Task({ subagent_type: "pr-review-toolkit:code-reviewer", team_name: "elsabro-review", name: "quality-reviewer", model: "sonnet", prompt: "..." })
187
+ Task({ subagent_type: "feature-dev:code-reviewer", team_name: "elsabro-review", name: "security-reviewer", model: "sonnet", prompt: "..." })
188
+ Task({ subagent_type: "pr-review-toolkit:pr-test-analyzer", team_name: "elsabro-review", name: "test-analyzer", model: "sonnet", prompt: "..." })
189
+ Task({ subagent_type: "pr-review-toolkit:silent-failure-hunter", team_name: "elsabro-review", name: "performance-reviewer", model: "sonnet", prompt: "..." })
190
+ Task({ subagent_type: "pr-review-toolkit:type-design-analyzer", team_name: "elsabro-review", name: "type-analyzer", model: "sonnet", prompt: "..." })
191
+
192
+ // Consolidar → fix si criticos → shutdown → TeamDelete
193
+ ```
194
+
195
+ **Ejemplo correcto (LITE — quick/debug):**
172
196
  ```javascript
173
- // Después de implementar fix
174
- Task({
175
- subagent_type: "pr-review-toolkit:code-reviewer",
176
- description: "Code review de cambios",
177
- prompt: "Revisa los cambios en [archivos]. Busca bugs, code smells, seguridad."
178
- })
179
- // Si cleancontinuar
180
- // Si issues → fix → re-review
197
+ TeamCreate({ team_name: "elsabro-review-lite", description: "3-agent review team" })
198
+
199
+ Task({ subagent_type: "pr-review-toolkit:code-reviewer", team_name: "elsabro-review-lite", name: "quality-reviewer", ... })
200
+ Task({ subagent_type: "pr-review-toolkit:silent-failure-hunter", team_name: "elsabro-review-lite", name: "failure-hunter", ... })
201
+ Task({ subagent_type: "pr-review-toolkit:pr-test-analyzer", team_name: "elsabro-review-lite", name: "test-analyzer", ... })
202
+
203
+ // Consolidar fix si criticos shutdown → TeamDelete
181
204
  ```
182
205
 
183
206
  **Ejemplo INCORRECTO:**
184
207
  ```
185
- # VIOLACIÓN: Ofrecer commit sin code review
208
+ # VIOLACIÓN 1: Ofrecer commit sin code review
186
209
  Edit(file...)
187
210
  Bash("npm test")
188
211
  "¿Commit? (y/n)" # ← Falta code review
212
+
213
+ # VIOLACIÓN 2: Code review sin Agent Teams (single agent)
214
+ Task({ subagent_type: "pr-review-toolkit:code-reviewer", prompt: "..." })
215
+ # ← Viola Rule 8: 1 solo agente, sin TeamCreate
189
216
  ```
190
217
 
191
218
  ---