kakaroto-config 1.0.1 → 1.0.3

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 (41) hide show
  1. package/bin/release.js +255 -0
  2. package/config/ARCHITECTURE.md +20 -26
  3. package/config/CLAUDE.md +4 -0
  4. package/config/agents/memory-sync.md +87 -19
  5. package/config/agents/test-fixer.md +24 -0
  6. package/config/agents/visual-validator.md +17 -0
  7. package/config/commands/debug/01-reproduce.md +65 -63
  8. package/config/commands/debug/02-investigate.md +40 -34
  9. package/config/commands/debug/03-fix.md +32 -45
  10. package/config/commands/debug/04-verify.md +108 -34
  11. package/config/commands/debug/05-commit.md +33 -3
  12. package/config/commands/debug/06-evaluate.md +137 -0
  13. package/config/commands/debug/playbooks/api.md +21 -0
  14. package/config/commands/debug/playbooks/backend.md +19 -0
  15. package/config/commands/debug/playbooks/infra.md +130 -0
  16. package/config/commands/debug/playbooks/integration.md +16 -0
  17. package/config/commands/debug/playbooks/job.md +19 -0
  18. package/config/commands/debug/playbooks/test.md +14 -0
  19. package/config/commands/debug/playbooks/ui.md +24 -0
  20. package/config/commands/debug/self-healing.md +99 -0
  21. package/config/commands/debug/techniques/flow-tracing.md +75 -0
  22. package/config/commands/debug/techniques/hypothesis-generation.md +30 -0
  23. package/config/commands/debug/techniques/sequential-thinking-config.md +79 -0
  24. package/config/commands/debug/templates/diagnosis-script.md +72 -0
  25. package/config/commands/debug/templates/reproduction-doc.md +60 -0
  26. package/config/commands/debug/templates/root-cause-doc.md +46 -0
  27. package/config/commands/debug/validators/criticality-gate.md +40 -0
  28. package/config/commands/debug/validators/evidence-requirements.md +48 -0
  29. package/config/commands/debug/validators/fix-permanence.md +56 -0
  30. package/config/commands/debug/validators/root-cause-validation.md +50 -0
  31. package/config/commands/debug.md +1 -1
  32. package/config/commands/feature/01-interview.md +82 -90
  33. package/config/commands/feature/02-spec.md +22 -98
  34. package/config/commands/feature/03-planner.md +81 -4
  35. package/config/commands/feature/04-implement.md +15 -8
  36. package/config/commands/feature/05-quality.md +23 -5
  37. package/config/commands/feature/06-commit.md +91 -0
  38. package/config/commands/feature/07-evaluate.md +129 -0
  39. package/config/commands/feature.md +1 -7
  40. package/config/templates/spec-template.md +92 -0
  41. package/package.json +4 -1
@@ -1,107 +1,107 @@
1
1
  # Fase 1: Reproduce
2
2
 
3
- ## Passo 1: Carregar Contexto
3
+ Responsabilidade: **ONDE** esta o bug + **COMO** reproduzir + **EVIDENCIA** concreta
4
4
 
5
- ```
6
- mcp__memory__search_nodes({ query: "config" })
7
- mcp__memory__search_nodes({ query: "<termos-do-bug>" })
8
- ```
5
+ ---
9
6
 
10
- Extrair termos relevantes de $ARGUMENTS e buscar bugs similares ja resolvidos.
7
+ ## Passo 1: Triage
11
8
 
12
- ---
9
+ Classificar o bug por keywords em $ARGUMENTS:
13
10
 
14
- ## Passo 2: Reproduzir Bug
11
+ | Categoria | Keywords |
12
+ |-----------|----------|
13
+ | Backend/Service | service, funcao, null, undefined, dados, firestore, db, retorna |
14
+ | API/Endpoint | endpoint, API, request, response, 4xx, 5xx, validation, handler |
15
+ | UI/Frontend | UI, componente, renderiza, tela, botao, estado, react, tsx |
16
+ | Job/Cron | job, cron, schedule, nao executou, analytics, executor |
17
+ | Integration | credencial, token, auth, OAuth, secret, API externa |
18
+ | Test | teste, test, falha, assertion, mock, spec |
19
+ | Infra/Deploy | VM, startup, env, terraform, deploy, container, docker, GCP, faltando |
15
20
 
16
- ### 2.1 Executar Passos
17
- Tentar reproduzir com informacoes fornecidas.
21
+ **SE** nenhuma keyword match → Default: **Backend/Service**
18
22
 
19
- ### 2.2 Documentar
20
23
  ```
21
- REPRODUCAO:
22
- - Passos: [...]
23
- - Input: [...]
24
- - Output esperado: [...]
25
- - Output real: [...]
26
- - Reproduzido: SIM/NAO
24
+ TRIAGE:
25
+ Keywords encontradas: [...]
26
+ Categoria: [Backend/API/UI/Job/Integration/Test/Infra]
27
27
  ```
28
28
 
29
29
  ---
30
30
 
31
- ## Passo 3: Verificar Estado Externo (SE web/scraping)
32
-
33
- **APENAS SE** o bug envolve: web scraping, Playwright, Puppeteer, seletores, ou interacao com paginas web externas.
34
-
35
- ### 3.1 Verificar Antes de Assumir
31
+ ## Passo 2: Carregar Contexto
36
32
 
37
33
  ```
38
- 1. mcp__playwright__browser_navigate({ url: "[URL do bug]" })
39
- 2. mcp__playwright__browser_wait_for({ time: 3 })
40
- 3. mcp__playwright__browser_snapshot({})
34
+ mcp__memory__search_nodes({ query: "config" })
35
+ mcp__memory__search_nodes({ query: "<termos-do-bug>" })
41
36
  ```
42
37
 
43
- ### 3.2 Comparar Estado Atual vs Esperado
38
+ ---
44
39
 
45
- - O que o codigo espera encontrar?
46
- - O que realmente existe na pagina?
47
- - Quais seletores existem/mudaram?
40
+ ## Passo 3: Contexto Rapido
48
41
 
49
- **PROIBIDO:** Assumir que "a pagina mudou" sem verificar.
42
+ ### 3.1 Logs de Producao
50
43
 
51
- ---
44
+ **SE** `.claude/debug-logs.json` existe e `enabled=true`:
45
+ ```bash
46
+ {valor de commands.quick}
47
+ ```
52
48
 
53
- ## Passo 4: Gate de Reproducao
49
+ ### 3.2 Exploracao Basica
54
50
 
55
- **SE** reproduziu com sucesso:
56
- - Prosseguir para Passo 5
51
+ ```
52
+ Grep: termos do bug em services/, api/, cron/, components/
53
+ Glob: arquivos com nomes relacionados
54
+ ```
57
55
 
58
- **SE NAO** reproduziu:
59
- - Usar `AskUserQuestion` para obter mais detalhes
60
- - Documentar o que foi tentado
61
- - NAO prosseguir ate reproduzir
56
+ ```
57
+ LOCALIZACAO:
58
+ Arquivos candidatos: [arquivo1.ts, arquivo2.ts]
59
+ Funcoes suspeitas: [funcao1(), funcao2()]
60
+ ```
62
61
 
63
62
  ---
64
63
 
65
- ## Passo 5: Persistir Reproducao
64
+ ## Passo 4: Executar Playbook
65
+
66
+ ACAO: Read ~/.claude/commands/debug/playbooks/{categoria}.md
67
+
68
+ | Categoria | Playbook |
69
+ |-----------|----------|
70
+ | Backend/Service | backend.md |
71
+ | API/Endpoint | api.md |
72
+ | UI/Frontend | ui.md |
73
+ | Job/Cron | job.md |
74
+ | Integration | integration.md |
75
+ | Test | test.md |
76
+ | Infra/Deploy | infra.md |
66
77
 
67
- Salvar documentacao em `.claude/debug/reproduction.md`:
78
+ ---
68
79
 
69
- ```markdown
70
- # Reproducao: [descricao curta do bug]
80
+ ## Passo 5: Criar Artefato
71
81
 
72
- **Data:** [timestamp]
73
- **Bug:** [descricao original de $ARGUMENTS]
82
+ ACAO: Read ~/.claude/commands/debug/templates/diagnosis-script.md
74
83
 
75
- ## Passos de Reproducao
76
- 1. [passo executado]
77
- 2. [passo executado]
84
+ ---
78
85
 
79
- ## Input
80
- [dados de entrada usados]
86
+ ## Passo 6: Gate de Reproducao
81
87
 
82
- ## Output Esperado
83
- [o que deveria acontecer]
88
+ ACAO: Read ~/.claude/commands/debug/validators/evidence-requirements.md
84
89
 
85
- ## Output Real
86
- [o que aconteceu - evidencia do bug]
90
+ ---
87
91
 
88
- ## Observacoes Iniciais
89
- [hipoteses formadas durante reproducao]
92
+ ## Passo 7: Persistir Reproducao
90
93
 
91
- ## Estado Externo (se aplicavel)
92
- [observacoes do Playwright/browser]
93
- ```
94
+ ACAO: Read ~/.claude/commands/debug/templates/reproduction-doc.md
94
95
 
95
96
  ---
96
97
 
97
- ## Passo 6: Checkpoint
98
+ ## Passo 8: Checkpoint
98
99
 
99
100
  ```javascript
100
101
  TodoWrite({
101
102
  todos: [
102
- { content: "Reproduce: contexto carregado", status: "completed", activeForm: "Loading context" },
103
- { content: "Reproduce: bug reproduzido", status: "completed", activeForm: "Reproducing bug" },
104
- { content: "Reproduce: reproducao persistida", status: "completed", activeForm: "Persisting reproduction" },
103
+ { content: "Reproduce: triage + playbook", status: "completed", activeForm: "Bug triaged" },
104
+ { content: "Reproduce: artefato + evidencia", status: "completed", activeForm: "Evidence collected" },
105
105
  { content: "Investigate: analisar causa raiz", status: "pending", activeForm: "Analyzing root cause" }
106
106
  ]
107
107
  })
@@ -111,8 +111,10 @@ TodoWrite({
111
111
 
112
112
  ## Output
113
113
 
114
- Bug reproduzido e documentado em `.claude/debug/reproduction.md`.
114
+ Bug reproduzido com evidencia em `.claude/debug/reproduction.md`.
115
115
 
116
116
  ---
117
+
117
118
  ## PROXIMA FASE
119
+
118
120
  ACAO OBRIGATORIA: Read ~/.claude/commands/debug/02-investigate.md
@@ -1,76 +1,80 @@
1
1
  # Fase 2: Investigate
2
2
 
3
- ## Passo 0: Context
3
+ Responsabilidade: **POR QUE** o bug acontece + **CAUSA RAIZ**
4
4
 
5
- **SE** continuacao direta de 01-reproduce (mesma sessao):
6
- Contexto ja disponivel, prosseguir.
5
+ ---
7
6
 
8
- **SE** retomando sessao interrompida:
9
- ```
10
- Read .claude/debug/reproduction.md
11
- ```
7
+ ## Principio
8
+
9
+ > Fixes corrigem LOGICA, nao filtram SINTOMAS.
10
+ > Antes de propor FILTRO/IGNORE: por que o erro e gerado em primeiro lugar?
11
+
12
+ ---
13
+
14
+ ## Passo 1: Context
15
+
16
+ **SE** continuacao direta de 01-reproduce: Contexto ja disponivel.
17
+ **SE** retomando sessao: `Read .claude/debug/reproduction.md`
12
18
 
13
19
  ---
14
20
 
15
- ## Passo 1: Explorar Codigo Relacionado
21
+ ## Passo 2: Explorar Codigo
16
22
 
17
- ### 1.1 Buscar no Codebase
18
23
  ```
19
24
  Grep: termos do bug
20
25
  Glob: arquivos com nomes relacionados
21
26
  git log --oneline --grep="fix" -- [arquivos suspeitos]
22
27
  ```
23
28
 
24
- ### 1.2 Identificar
29
+ Identificar:
25
30
  - Arquivos/funcoes envolvidos
26
31
  - Como erros sao tratados nesta area
27
32
  - Ha validacao que deveria existir?
28
- - Ha helper existente que resolve?
29
33
 
30
34
  ---
31
35
 
32
- ## Passo 2: 5 Whys (Causa Raiz)
36
+ ## Passo 3: Rastreamento de Fluxo
33
37
 
34
- Para cada "Por que?", fornecer EVIDENCIA de codigo:
38
+ **SE** bug envolve dados incorretos (null, undefined, formato invalido):
35
39
 
36
- ```
37
- ANALISE DE CAUSA RAIZ:
40
+ ACAO: Read ~/.claude/commands/debug/techniques/flow-tracing.md
38
41
 
39
- Sintoma: [o que esta acontecendo]
42
+ ---
40
43
 
41
- Por que #1: [resposta]
42
- Evidencia: [arquivo:linha] - [codigo]
44
+ ## Passo 4: Geracao de Hipoteses
43
45
 
44
- Por que #2: [resposta]
45
- Evidencia: [arquivo:linha] - [codigo]
46
+ ACAO: Read ~/.claude/commands/debug/techniques/hypothesis-generation.md
46
47
 
47
- Por que #3: [resposta]
48
- Evidencia: [arquivo:linha] - [codigo]
48
+ ---
49
49
 
50
- CAUSA RAIZ: [declaracao clara]
51
- ```
50
+ ## Passo 5: Sequential Thinking
51
+
52
+ ACAO: Read ~/.claude/commands/debug/techniques/sequential-thinking-config.md
53
+
54
+ **SE** categoria = Infra/Deploy:
55
+ Consultar secao "Fase: Investigate" em playbooks/infra.md
52
56
 
53
57
  ---
54
58
 
55
- ## Passo 3: Validar Causa Raiz
59
+ ## Passo 6: Validar Causa Raiz
56
60
 
57
- A causa raiz deve ser:
58
- - [ ] Algo que voce pode MUDAR
59
- - [ ] Suportada por evidencia de codigo
60
- - [ ] Explica TODOS os sintomas
61
+ ACAO: Read ~/.claude/commands/debug/validators/root-cause-validation.md
61
62
 
62
- **SE** nao validar: voltar ao Passo 2.
63
+ ---
64
+
65
+ ## Passo 7: Documentar Causa Raiz
66
+
67
+ ACAO: Read ~/.claude/commands/debug/templates/root-cause-doc.md
63
68
 
64
69
  ---
65
70
 
66
- ## Passo 4: Checkpoint
71
+ ## Passo 8: Checkpoint
67
72
 
68
73
  ```javascript
69
74
  TodoWrite({
70
75
  todos: [
71
76
  { content: "Reproduce: bug reproduzido", status: "completed", activeForm: "Bug reproduced" },
72
- { content: "Investigate: codigo explorado", status: "completed", activeForm: "Code explored" },
73
- { content: "Investigate: causa raiz identificada", status: "completed", activeForm: "Root cause identified" },
77
+ { content: "Investigate: causa raiz validada", status: "completed", activeForm: "Root cause validated" },
74
78
  { content: "Fix: implementar correcao", status: "pending", activeForm: "Implementing fix" }
75
79
  ]
76
80
  })
@@ -80,8 +84,10 @@ TodoWrite({
80
84
 
81
85
  ## Output
82
86
 
83
- Causa raiz documentada com evidencia.
87
+ Causa raiz documentada em `.claude/debug/root-cause.md`.
84
88
 
85
89
  ---
90
+
86
91
  ## PROXIMA FASE
92
+
87
93
  ACAO OBRIGATORIA: Read ~/.claude/commands/debug/03-fix.md
@@ -1,54 +1,45 @@
1
1
  # Fase 3: Fix
2
2
 
3
- ## Contexto
4
- Causa raiz identificada. Implementar fix de forma AUTONOMA.
3
+ Responsabilidade: Implementar fix de forma AUTONOMA.
5
4
 
6
5
  ---
7
6
 
8
- ## Passo 0: Gate de Criticidade
7
+ ## Passo 1: Validacao Pre-Fix
9
8
 
10
- ### 0.1 Identificar Paths Afetados
9
+ ### 1.1 Revisao da Categorizacao
11
10
 
12
- Extrair arquivos da causa raiz documentada na investigacao (fase 02-investigate).
11
+ Na fase Investigate voce categorizou seu fix como:
12
+ - [ ] CORRECAO DE LOGICA → Prossiga
13
+ - [ ] FILTRO/IGNORE → **PARE!** Volte para Investigate
14
+ - [ ] WORKAROUND → **PARE!** Volte para Investigate
13
15
 
14
- ### 0.2 Lista de Paths Criticos
16
+ ### 1.2 Gate para FILTRO/IGNORE
15
17
 
16
- ```
17
- PATHS_CRITICOS:
18
- - **/auth/**
19
- - **/payment/**
20
- - **/migration*/**
21
- - **/oauth*
22
- - **/credential*
23
- - **/secret*
24
- - api/middleware.ts
25
- - services/*Service.ts (core services)
26
- ```
18
+ **SE** fix envolve adicionar a lista de ignore/skip/filter:
19
+ 1. Por que o erro esta sendo gerado em primeiro lugar?
20
+ 2. Esse padrao pode aparecer em erros legitimos?
21
+ 3. Existe forma de corrigir a logica em vez de filtrar?
27
22
 
28
- ### 0.3 Decision Gate
23
+ **SE nao conseguir justificar**: Volte para 02-investigate.md
29
24
 
30
- **SE** arquivos afetados ∩ PATHS_CRITICOS **nao vazio**:
25
+ ---
31
26
 
32
- 1. Documentar fix planejado:
33
- - Causa raiz (com evidencia)
34
- - Arquivos a modificar
35
- - Mudancas propostas
36
- - Riscos identificados
27
+ ## Passo 2: Gate de Criticidade
37
28
 
38
- 2. Chamar `EnterPlanMode`
39
- - Escrever plano de fix em `.claude/plans/debug-fix-{timestamp}.md`
40
- - User aprova ou rejeita via ExitPlanMode
29
+ ACAO: Read ~/.claude/commands/debug/validators/criticality-gate.md
30
+
31
+ ---
41
32
 
42
- 3. Apos aprovacao: Prosseguir para Passo 1
33
+ ## Passo 3: Gate de Permanencia
43
34
 
44
- **SENAO** (nao critico):
45
- Prosseguir direto para Passo 1 (autonomia total)
35
+ ACAO: Read ~/.claude/commands/debug/validators/fix-permanence.md
46
36
 
47
37
  ---
48
38
 
49
- ## Passo 1: Teste de Regressao
39
+ ## Passo 4: Teste de Regressao
40
+
41
+ ### 4.1 Criar Teste que Reproduz o Bug
50
42
 
51
- ### 1.1 Criar Teste que Reproduz o Bug
52
43
  ```typescript
53
44
  describe('[contexto do bug]', () => {
54
45
  it('should [comportamento esperado]', () => {
@@ -59,7 +50,8 @@ describe('[contexto do bug]', () => {
59
50
  })
60
51
  ```
61
52
 
62
- ### 1.2 Verificar que Teste FALHA
53
+ ### 4.2 Verificar que Teste FALHA
54
+
63
55
  ```bash
64
56
  npm test -- --testPathPattern="[arquivo]"
65
57
  ```
@@ -68,9 +60,8 @@ O teste DEVE falhar antes do fix. Se passar, o teste nao reproduz o bug.
68
60
 
69
61
  ---
70
62
 
71
- ## Passo 2: Implementar Fix
63
+ ## Passo 5: Implementar Fix
72
64
 
73
- ### 2.1 Fix Minimo
74
65
  ```
75
66
  FIX:
76
67
  Arquivo: [arquivo:linha]
@@ -79,34 +70,28 @@ Depois: [codigo novo]
79
70
  Justificativa: [por que resolve a causa raiz]
80
71
  ```
81
72
 
82
- ### 2.2 Regras
73
+ Regras:
83
74
  - APENAS o necessario para resolver a causa raiz
84
75
  - NAO refatorar codigo nao relacionado
85
- - NAO adicionar features
86
76
  - Seguir patterns existentes do projeto
87
77
 
88
78
  ---
89
79
 
90
- ## Passo 3: Verificar Fix
80
+ ## Passo 6: Verificar Fix
91
81
 
92
- ### 3.1 Teste Deve Passar
93
82
  ```bash
94
83
  npm test -- --testPathPattern="[arquivo]"
95
84
  ```
96
85
 
97
- ### 3.2 Bug Nao Reproduz
98
- Executar passos originais. Bug nao deve ocorrer.
99
-
100
86
  ---
101
87
 
102
- ## Passo 4: Checkpoint
88
+ ## Passo 7: Checkpoint
103
89
 
104
90
  ```javascript
105
91
  TodoWrite({
106
92
  todos: [
107
93
  { content: "Investigate: causa raiz identificada", status: "completed", activeForm: "Root cause identified" },
108
- { content: "Fix: teste de regressao criado", status: "completed", activeForm: "Regression test created" },
109
- { content: "Fix: correcao implementada", status: "completed", activeForm: "Fix implemented" },
94
+ { content: "Fix: teste + correcao implementada", status: "completed", activeForm: "Fix implemented" },
110
95
  { content: "Verify: validar quality gates", status: "pending", activeForm: "Validating quality gates" }
111
96
  ]
112
97
  })
@@ -119,5 +104,7 @@ TodoWrite({
119
104
  Fix implementado. Teste de regressao passando.
120
105
 
121
106
  ---
107
+
122
108
  ## PROXIMA FASE
109
+
123
110
  ACAO OBRIGATORIA: Read ~/.claude/commands/debug/04-verify.md
@@ -1,81 +1,155 @@
1
1
  # Fase 4: Verify
2
2
 
3
- ## Contexto
4
- Fix implementado. Verificar e finalizar de forma AUTONOMA.
3
+ Responsabilidade: Verificar e finalizar de forma AUTONOMA.
5
4
 
6
5
  ---
7
6
 
8
7
  ## Passo 1: Quality Gates
9
8
 
10
- Rodar em sequencia:
11
9
  ```bash
12
- npm test
13
- npx tsc --noEmit
14
- npm run build
10
+ npm test && npx tsc --noEmit && npm run build
15
11
  ```
16
12
 
17
- **Se falhar:** Corrigir e rodar novamente. Nao prosseguir ate passar.
13
+ **Se falhar:** ACAO: Read ~/.claude/commands/debug/self-healing.md
18
14
 
19
15
  ---
20
16
 
21
- ## Passo 2: Verificacao Final
17
+ ## Passo 2: Re-executar Reproducao
22
18
 
23
- - [ ] Testes passam
24
- - [ ] TypeScript sem erros
25
- - [ ] Build bem-sucedido
26
- - [ ] Bug nao reproduz mais
19
+ O script de debug DEVE ser re-executado para confirmar resolucao.
20
+
21
+ ### 2.1 Executar Script
22
+
23
+ ```bash
24
+ npx tsx scripts/debug-{nome-do-bug}.ts
25
+ ```
26
+
27
+ **SE** script nao existe: `ls scripts/debug-*.ts` e executar mais recente.
28
+
29
+ ### 2.2 Comparacao de Output
30
+
31
+ | Momento | Output |
32
+ |---------|--------|
33
+ | **ANTES** (de `.claude/debug/reproduction.md`) | [output original] |
34
+ | **DEPOIS** | [output atual] |
35
+
36
+ ### 2.3 Decision Gate
37
+
38
+ **SE** output ainda mostra bug:
39
+ - Fix NAO resolveu a causa raiz
40
+ - ACAO: Read ~/.claude/commands/debug/self-healing.md
41
+
42
+ **SE** bug resolvido:
43
+ - **SE** categoria = Infra/Deploy: Consultar playbooks/infra.md
44
+ - **SENAO**: Prosseguir para 2.4
45
+
46
+ ### 2.4 Converter Script em Teste de Regressao (se aplicavel)
47
+
48
+ **SE** script retornou 0 (bug ausente) E arquivo modificado em `cron/`, `services/`, `api/`, `utils/`:
49
+
50
+ 1. Identificar arquivo de teste destino:
51
+ ```
52
+ services/foo.ts → services/foo.test.ts
53
+ cron/bar.ts → cron/bar.test.ts (ou criar)
54
+ ```
55
+
56
+ 2. Converter estrutura do script:
57
+ ```
58
+ diagnose() → describe('regression: {bug}')
59
+ // 1. Setup → beforeEach ou inline
60
+ // 2. Reproducao → it('should {comportamento correto}', ...)
61
+ // 3. Verificacao → expect(...).toBe(...)
62
+ bugPresente ? 1 : 0 → expect(bugPresente).toBe(false)
63
+ ```
64
+
65
+ 3. Adicionar ao arquivo de teste:
66
+ ```typescript
67
+ describe('regression: {descricao-do-bug}', () => {
68
+ it('should {comportamento correto apos fix}', async () => {
69
+ // [codigo adaptado do script de debug]
70
+ expect(resultado).toBe(esperado);
71
+ });
72
+ });
73
+ ```
74
+
75
+ 4. Validar: `npm test -- --filter="{arquivo}"`
76
+
77
+ **SE** bug NAO e testavel automaticamente (UI, Infra, Config):
78
+ - Pular conversao, apenas documentar em reproduction.md
79
+
80
+ **NOTA:** A conversao e recomendada, nao obrigatoria. Usar julgamento.
27
81
 
28
82
  ---
29
83
 
30
84
  ## Passo 3: Memory Sync (se bug nao-obvio)
31
85
 
32
- Se o bug foi dificil de encontrar, salvar na memory:
33
-
34
86
  ```javascript
35
87
  mcp__memory__create_entities({
36
88
  entities: [{
37
89
  name: "{prefix}:bug:{nome-descritivo}",
38
90
  entityType: "bug",
39
- observations: [
40
- "Sintoma: [...]",
41
- "Causa raiz: [...]",
42
- "Solucao: [...]",
43
- "Arquivos: [...]"
44
- ]
91
+ observations: ["Sintoma: [...]", "Causa raiz: [...]", "Solucao: [...]"]
45
92
  }]
46
93
  })
47
94
  ```
48
95
 
49
96
  ---
50
97
 
51
- ## Passo 4: Checkpoint
98
+ ## Passo 4: Cleanup
99
+
100
+ ### 4.1 Script de Debug
101
+
102
+ **SE** script foi convertido em teste (2.4):
103
+ ```bash
104
+ rm scripts/debug-{nome-do-bug}.ts # Codigo ja esta no teste
105
+ ```
106
+
107
+ **SE** script NAO foi convertido (bug nao-testavel):
108
+ ```bash
109
+ rm scripts/debug-{nome-do-bug}.ts # Documentacao fica em reproduction.md
110
+ ```
111
+
112
+ ### 4.2 Manter Documentacao
113
+
114
+ NAO deletar:
115
+ - `.claude/debug/reproduction.md`
116
+ - `.claude/debug/root-cause.md`
117
+
118
+ ### 4.3 Verificar Git Status
119
+
120
+ ```bash
121
+ git status
122
+ ```
123
+
124
+ **SE** teste de regressao foi criado: deve aparecer arquivo novo ou modificado
125
+
126
+ ---
127
+
128
+ ## Passo 5: Checkpoint
52
129
 
53
130
  ```javascript
54
131
  TodoWrite({
55
132
  todos: [
56
- { content: "Reproduce: bug reproduzido", status: "completed", activeForm: "Bug reproduced" },
57
- { content: "Investigate: causa raiz identificada", status: "completed", activeForm: "Root cause identified" },
58
133
  { content: "Fix: correcao implementada", status: "completed", activeForm: "Fix implemented" },
59
- { content: "Verify: quality gates passando", status: "completed", activeForm: "Quality gates passed" },
60
- { content: "Commit: commitar e push", status: "pending", activeForm: "Committing changes" }
134
+ { content: "Verify: quality gates + bug confirmado", status: "completed", activeForm: "Verified" },
135
+ { content: "Verify: teste de regressao (se aplicavel)", status: "completed", activeForm: "Regression test checked" },
136
+ { content: "Verify: cleanup feito", status: "completed", activeForm: "Cleanup done" },
137
+ { content: "Commit: commitar e push", status: "pending", activeForm: "Committing" }
61
138
  ]
62
139
  })
63
140
  ```
64
141
 
65
142
  ---
66
143
 
67
- ## Output
68
-
69
- Quality gates passando. Pronto para commit.
70
-
71
- ---
72
-
73
144
  ## Regras Inviolaveis
74
145
 
75
- 1. **PROIBIDO** prosseguir com testes falhando
76
- 2. **PROIBIDO** prosseguir com build falhando
77
- 3. **PROIBIDO** perguntar ao user (so reportar no final)
146
+ 1. PROIBIDO prosseguir com testes/build falhando
147
+ 2. PROIBIDO prosseguir sem re-executar script
148
+ 3. PROIBIDO mais de 3 tentativas no self-healing
149
+ 4. PROIBIDO deixar script de debug em scripts/ (converter para teste ou deletar)
78
150
 
79
151
  ---
152
+
80
153
  ## PROXIMA FASE
154
+
81
155
  ACAO OBRIGATORIA: Read ~/.claude/commands/debug/05-commit.md