@luanpdd/kit-mcp 1.10.0 → 1.11.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/gates/ai-prompt-stability.md +120 -0
- package/gates/legacy-refactor-safety.md +178 -0
- package/gates/observability-coverage.md +151 -0
- package/gates/release-pipeline-policy.md +132 -0
- package/kit/COMANDOS.md +15 -0
- package/kit/agents/ai-mutation-tester.md +298 -0
- package/kit/agents/cascading-failures-auditor.md +306 -0
- package/kit/agents/executor.md +13 -0
- package/kit/agents/legacy-characterizer.md +378 -0
- package/kit/agents/load-shedding-instrumenter.md +297 -0
- package/kit/agents/observability-coverage-auditor.md +325 -0
- package/kit/agents/omm-auditor.md +47 -0
- package/kit/agents/payload-capture-instrumenter.md +283 -0
- package/kit/agents/planner.md +29 -0
- package/kit/agents/prr-conductor.md +8 -0
- package/kit/agents/refactor-safety-auditor.md +414 -0
- package/kit/agents/release-pipeline-auditor.md +360 -0
- package/kit/agents/seam-finder.md +367 -0
- package/kit/agents/shotgun-surgery-detector.md +359 -0
- package/kit/agents/storytelling-analyst.md +309 -0
- package/kit/agents/supabase-edge-fn-writer.md +12 -0
- package/kit/agents/verifier.md +30 -0
- package/kit/commands/auditar-cascading.md +111 -0
- package/kit/commands/auditar-marco.md +44 -1
- package/kit/commands/auditar-observabilidade-cobertura.md +183 -0
- package/kit/commands/auditar-refactor.md +219 -0
- package/kit/commands/auditar-release.md +109 -0
- package/kit/commands/capturar-payloads.md +193 -0
- package/kit/commands/caracterizar-prompt.md +195 -0
- package/kit/commands/caracterizar.md +212 -0
- package/kit/commands/concluir-marco.md +41 -1
- package/kit/commands/detectar-duplicacao.md +197 -0
- package/kit/commands/discutir-fase.md +41 -0
- package/kit/commands/encontrar-seams.md +136 -0
- package/kit/commands/forense.md +40 -1
- package/kit/commands/legacy.md +263 -0
- package/kit/commands/load-shedding.md +117 -0
- package/kit/commands/observabilidade.md +2 -0
- package/kit/commands/refactor-seguro.md +321 -0
- package/kit/commands/sre.md +3 -0
- package/kit/commands/storytelling.md +179 -0
- package/kit/skills/_shared-legacy/glossary.md +389 -0
- package/kit/skills/_shared-sre/glossary.md +139 -0
- package/kit/skills/ai-prompt-characterization/SKILL.md +335 -0
- package/kit/skills/cascading-failures/SKILL.md +307 -0
- package/kit/skills/four-golden-signals/SKILL.md +17 -0
- package/kit/skills/hermetic-builds/SKILL.md +323 -0
- package/kit/skills/legacy-api-only-applications/SKILL.md +358 -0
- package/kit/skills/legacy-characterization-tests/SKILL.md +330 -0
- package/kit/skills/legacy-effect-analysis/SKILL.md +331 -0
- package/kit/skills/legacy-extract-class/SKILL.md +203 -0
- package/kit/skills/legacy-monster-methods/SKILL.md +444 -0
- package/kit/skills/legacy-programming-by-difference/SKILL.md +252 -0
- package/kit/skills/legacy-seams-and-test-harness/SKILL.md +460 -0
- package/kit/skills/legacy-shotgun-surgery/SKILL.md +286 -0
- package/kit/skills/legacy-sprout-wrap-techniques/SKILL.md +434 -0
- package/kit/skills/legacy-storytelling-naked-crc/SKILL.md +270 -0
- package/kit/skills/llm-as-dependency/SKILL.md +436 -0
- package/kit/skills/load-shedding-graceful-degradation/SKILL.md +396 -0
- package/kit/skills/pre-refactor-characterization/SKILL.md +421 -0
- package/kit/skills/release-engineering/SKILL.md +367 -0
- package/kit/skills/retry-strategies/SKILL.md +372 -0
- package/package.json +2 -2
package/kit/commands/forense.md
CHANGED
|
@@ -135,4 +135,43 @@ Wheel of Misfortune: postmortem vira treino de novos engineers (cap 15)
|
|
|
135
135
|
**Cultura blameless é não-negociável:** o postmortem foca em **sistema** (controles ausentes, signals não monitorados, escalation paths frágeis), nunca em **pessoas** ("dev X esqueceu de testar"). Anti-pattern blame culture é explicitamente prevenido pelo template de `postmortem-writer` (cap 15 — *No postmortem left unreviewed*).
|
|
136
136
|
|
|
137
137
|
**REQ:** INT-FW-V2-01.
|
|
138
|
-
</sre_integration>
|
|
138
|
+
</sre_integration>
|
|
139
|
+
|
|
140
|
+
<legacy_refactor_integration>
|
|
141
|
+
**Forensics em failure de refactor (Suíte Legacy):**
|
|
142
|
+
|
|
143
|
+
Se o forense identifica root cause como "regressão silenciosa pós-refactor", consulta automaticamente artefatos da Suíte Legacy:
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
Falha pós-refactor detectada
|
|
147
|
+
↓
|
|
148
|
+
/forense "<descrição>" ← diagnóstico
|
|
149
|
+
↓ se root cause = refactor regression
|
|
150
|
+
forensics agent lê:
|
|
151
|
+
- .planning/REFACTOR-SAFETY.md (qual veredito do gate? GO? GO-OVERRIDE?)
|
|
152
|
+
- tests/characterization/<file_stem>/ (existia? rodou verde antes do refactor?)
|
|
153
|
+
- REFACTOR-SAFETY-<file_stem>.md (audit retroativo)
|
|
154
|
+
↓
|
|
155
|
+
/postmortem --incident "<one-liner>" --legacy-refactor ← consulta extra
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Lessons learned canônicas para regression em refactor (cap 23 Feathers):**
|
|
159
|
+
|
|
160
|
+
| Cause root | Lesson learned canônica |
|
|
161
|
+
|---|---|
|
|
162
|
+
| Refactor sem characterization tests | Aplicar gate `legacy-refactor-safety` em modo blocking; sem char = "edit and pray" |
|
|
163
|
+
| Char tests existiam mas line cov apenas (não behavioral) | Habilitar mutation testing no gate; line cov 80% pode mascarar 30% mutation kill |
|
|
164
|
+
| Override usado sem ticket válido | Validar tickets em `/auditar-marco` opt-in; tickets > 90 dias = bloquear novos overrides |
|
|
165
|
+
| Snapshots não-revisados, congelaram bugs | `/caracterizar` deve emitir warning de revisão obrigatória; PR review verifica leitura |
|
|
166
|
+
| Mudança comportamental misturada com refactor | Single-goal editing (cap 22 Feathers); separar PRs |
|
|
167
|
+
|
|
168
|
+
Action items P0 sugeridos em postmortem de regression refactor:
|
|
169
|
+
1. Habilitar `workflow.legacy_refactor_gate_blocking = true`
|
|
170
|
+
2. Adicionar mutation testing à CI para arquivos legacy
|
|
171
|
+
3. Auditar overrides ainda abertos via `/auditar-marco`
|
|
172
|
+
4. Treinar equipe via Wheel of Misfortune com este caso
|
|
173
|
+
|
|
174
|
+
**Skill canônica:** [`pre-refactor-characterization`](../skills/pre-refactor-characterization/SKILL.md), [`legacy-characterization-tests`](../skills/legacy-characterization-tests/SKILL.md)
|
|
175
|
+
|
|
176
|
+
**REQ:** INT-LEGACY-FW-02.
|
|
177
|
+
</legacy_refactor_integration>
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: legacy
|
|
3
|
+
description: Orquestrador da Suíte Legacy Code (Feathers) — dispatch para agents (legacy-characterizer, seam-finder, refactor-safety-auditor) com sinônimos PT/EN. 4ª suíte da família após /supabase, /observabilidade, /sre.
|
|
4
|
+
argument-hint: "<subcomando> [args...]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Bash
|
|
9
|
+
- Grep
|
|
10
|
+
- Glob
|
|
11
|
+
- Task
|
|
12
|
+
- AskUserQuestion
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<objective>
|
|
16
|
+
Orquestrador único da Suíte Legacy Code — quarta suíte da família após [`/supabase`](./supabase.md) (v1.8), [`/observabilidade`](./observabilidade.md) (v1.9) e [`/sre`](./sre.md) (v1.10). Recebe subcomando + args, faz dispatch via `Task(subagent_type=...)` para o agent correto. **Único ponto de chain de agents legacy** (anti-pitfall A10 mantido — agents permanecem função pura).
|
|
17
|
+
|
|
18
|
+
**Subcomandos cobrem capítulos do livro Feathers:**
|
|
19
|
+
- `caracterizar` — characterization tests (cap 13 + 23)
|
|
20
|
+
- `encontrar-seams` — dependency-breaking via cap 25
|
|
21
|
+
- `auditar-refactor` — gate canônico pre-refactor (cap 1 — cover-and-modify)
|
|
22
|
+
- `refactor` — orquestrador completo de refactor (chain de tudo acima + execução)
|
|
23
|
+
|
|
24
|
+
**Cria/Atualiza:** o que cada agent invocado cria (characterization tests, SEAM-ANALYSIS.md, REFACTOR-SAFETY.md).
|
|
25
|
+
|
|
26
|
+
**Após:** o usuário tem o output do agent (suite de tests + análise de seams + veredito do gate + execução de refactor).
|
|
27
|
+
</objective>
|
|
28
|
+
|
|
29
|
+
<execution_context>
|
|
30
|
+
Skills consultadas pelos agents: [`kit/skills/legacy-characterization-tests/SKILL.md`](../skills/legacy-characterization-tests/SKILL.md), [`kit/skills/legacy-seams-and-test-harness/SKILL.md`](../skills/legacy-seams-and-test-harness/SKILL.md), [`kit/skills/legacy-sprout-wrap-techniques/SKILL.md`](../skills/legacy-sprout-wrap-techniques/SKILL.md), [`kit/skills/legacy-effect-analysis/SKILL.md`](../skills/legacy-effect-analysis/SKILL.md), [`kit/skills/legacy-monster-methods/SKILL.md`](../skills/legacy-monster-methods/SKILL.md), [`kit/skills/pre-refactor-characterization/SKILL.md`](../skills/pre-refactor-characterization/SKILL.md) + glossário em [`kit/skills/_shared-legacy/glossary.md`](../skills/_shared-legacy/glossary.md).
|
|
31
|
+
|
|
32
|
+
Agents disponíveis:
|
|
33
|
+
- [`legacy-characterizer`](../agents/legacy-characterizer.md) — gera characterization tests
|
|
34
|
+
- [`seam-finder`](../agents/seam-finder.md) — analisa seams + recomenda dependency-breaking
|
|
35
|
+
- [`refactor-safety-auditor`](../agents/refactor-safety-auditor.md) — gate canônico (BLOCK/WARN/GO/GO-OVERRIDE)
|
|
36
|
+
</execution_context>
|
|
37
|
+
|
|
38
|
+
<context>
|
|
39
|
+
**Argumentos:** `$ARGUMENTS` — primeiro token é o subcomando; restante é passado para o agent como prompt.
|
|
40
|
+
|
|
41
|
+
**Subcomandos suportados (sinônimos PT-BR/EN):**
|
|
42
|
+
|
|
43
|
+
| Subcomando | Sinônimos | Comando subjacente | Cap livro |
|
|
44
|
+
|---|---|---|---|
|
|
45
|
+
| `caracterizar` | `characterize`, `char`, `gen-tests` | `/caracterizar` | 13 + 23 |
|
|
46
|
+
| `encontrar-seams` | `find-seams`, `seams`, `break-deps` | `/encontrar-seams` | 25 |
|
|
47
|
+
| `auditar-refactor` | `audit-refactor`, `audit`, `gate` | `/auditar-refactor` | 1 + 13 |
|
|
48
|
+
| `refactor` | `refactor-seguro`, `refactor-safe`, `refator` | `/refactor-seguro` | (chain — todos) |
|
|
49
|
+
| `capturar-payloads` | `capture`, `capture-payloads` | `/capturar-payloads` | (modernização) |
|
|
50
|
+
| `caracterizar-prompt` | `char-prompt`, `prompt-char` | `/caracterizar-prompt` | (modernização) |
|
|
51
|
+
| `storytelling` | `story`, `story-do-codigo` | `/storytelling` | 16-17 (modernização IA) |
|
|
52
|
+
| `detectar-duplicacao` | `dup`, `shotgun`, `detect-duplicates` | `/detectar-duplicacao` | 21 (modernização IA) |
|
|
53
|
+
| `audit-coverage` | `cobertura`, `coverage-audit` | `/auditar-observabilidade-cobertura` | (modernização cross-suite) |
|
|
54
|
+
| `help` | `ajuda`, `?` | exibe esta tabela inline | — |
|
|
55
|
+
|
|
56
|
+
**Roteamento de flags por subcomando:**
|
|
57
|
+
|
|
58
|
+
- `caracterizar <target_file>` — flags `--symbol --min-inputs --gap-fill --fixtures-dir --no-mutation`
|
|
59
|
+
- `encontrar-seams <target_file>` — flags `--symbol --prefer --output`
|
|
60
|
+
- `auditar-refactor <target_file>` — flags `--change-kind --mode --ticket --reason`
|
|
61
|
+
- `refactor <target_file>` — flags `--mode (full|sprout|safe-extract|override) --ticket --reason --skip-seams --skip-characterize --symbol`
|
|
62
|
+
|
|
63
|
+
**Exemplos:**
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
/legacy caracterizar src/orders/handler.ts # characterization tests
|
|
67
|
+
/legacy seams supabase/functions/webhook/index.ts # análise de seams
|
|
68
|
+
/legacy auditar-refactor src/api/v1/orders.ts # gate antes de PR de refactor
|
|
69
|
+
/legacy refactor src/orders/handler.ts # chain completo
|
|
70
|
+
/legacy refactor src/orders/handler.ts --mode=sprout # adicionar feature sem tocar legado
|
|
71
|
+
/legacy help # exibe tabela de subcomandos
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Quando este orquestrador é o caminho:**
|
|
75
|
+
- User quer dispatch único para legacy concerns
|
|
76
|
+
- Equipe usa também outras suítes (/sre, /supabase) e prefere namespace consistente
|
|
77
|
+
- Workflow integrado quer "legacy refactor" como capability nomeada
|
|
78
|
+
</context>
|
|
79
|
+
|
|
80
|
+
<process>
|
|
81
|
+
|
|
82
|
+
## 1. Parsear subcomando
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
SUBCMD=$(echo "$ARGUMENTS" | awk '{print $1}')
|
|
86
|
+
ARGS=$(echo "$ARGUMENTS" | cut -d' ' -f2-)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Se `$ARGUMENTS` for vazio ou `SUBCMD` for `help`/`ajuda`/`?`:** exibir tabela de subcomandos inline + exemplo de uso. Sair.
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
LEGACY SUITE — orquestrador
|
|
93
|
+
|
|
94
|
+
Subcomandos:
|
|
95
|
+
caracterizar gen characterization tests (cap 13 + 23)
|
|
96
|
+
sinônimos: characterize, char, gen-tests
|
|
97
|
+
uso: /legacy caracterizar <file> [opções]
|
|
98
|
+
|
|
99
|
+
encontrar-seams análise de dependency-breaking (cap 25)
|
|
100
|
+
sinônimos: find-seams, seams, break-deps
|
|
101
|
+
uso: /legacy seams <file> [opções]
|
|
102
|
+
|
|
103
|
+
auditar-refactor gate canônico antes de refactor
|
|
104
|
+
sinônimos: audit-refactor, audit, gate
|
|
105
|
+
uso: /legacy gate <file> [opções]
|
|
106
|
+
|
|
107
|
+
refactor chain completo (seams → char → audit → execução)
|
|
108
|
+
sinônimos: refactor-seguro, refactor-safe, refator
|
|
109
|
+
uso: /legacy refactor <file> [--mode=full|sprout|safe-extract|override]
|
|
110
|
+
|
|
111
|
+
Workflow recomendado:
|
|
112
|
+
1. /legacy auditar-refactor <file> (descobrir veredito do gate)
|
|
113
|
+
2. SE BLOCK: /legacy refactor <file> (chain completo) OR --mode=sprout
|
|
114
|
+
3. SE GO: refactor manual com confiança
|
|
115
|
+
|
|
116
|
+
Material-fonte: Working Effectively with Legacy Code — Feathers, 2004
|
|
117
|
+
ISBN 978-0-13-117705-5
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## 2. Resolver sinônimos para subcomando canônico
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
caracterizar, characterize, char, gen-tests → /caracterizar
|
|
124
|
+
encontrar-seams, find-seams, seams, break-deps → /encontrar-seams
|
|
125
|
+
auditar-refactor, audit-refactor, audit, gate → /auditar-refactor
|
|
126
|
+
refactor, refactor-seguro, refactor-safe, refator → /refactor-seguro
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Se subcomando não resolve:** exibir erro inline com lista de subcomandos válidos. Sair.
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
✗ Subcomando desconhecido: '<SUBCMD>'
|
|
133
|
+
|
|
134
|
+
Subcomandos válidos:
|
|
135
|
+
caracterizar → gen characterization tests
|
|
136
|
+
encontrar-seams → análise de dependency-breaking
|
|
137
|
+
auditar-refactor → gate pre-refactor
|
|
138
|
+
refactor → chain completo (seams + char + audit + exec)
|
|
139
|
+
|
|
140
|
+
Uso: /legacy <subcomando> <args...>
|
|
141
|
+
Exemplo: /legacy refactor src/orders/handler.ts
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## 3. Dispatch — caminhos por subcomando
|
|
145
|
+
|
|
146
|
+
### 3a. `caracterizar` → `/caracterizar` (que invoca `legacy-characterizer`)
|
|
147
|
+
|
|
148
|
+
```text
|
|
149
|
+
Comando equivalente:
|
|
150
|
+
/caracterizar ${ARGS}
|
|
151
|
+
|
|
152
|
+
Não há agent direto — orquestrador delega para o comando file.
|
|
153
|
+
Em IDEs sem support a slash-command-routing, dispatch direto:
|
|
154
|
+
|
|
155
|
+
Task(
|
|
156
|
+
subagent_type="legacy-characterizer",
|
|
157
|
+
prompt="
|
|
158
|
+
${ARGS}
|
|
159
|
+
|
|
160
|
+
Aplicar skill legacy-characterization-tests. Gerar characterization tests cobrindo 7 grupos canônicos de equivalência. Output: tests/characterization/<file_stem>/ + warning de revisão obrigatória dos snapshots.
|
|
161
|
+
"
|
|
162
|
+
)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 3b. `encontrar-seams` → `/encontrar-seams` (que invoca `seam-finder`)
|
|
166
|
+
|
|
167
|
+
```text
|
|
168
|
+
Comando equivalente:
|
|
169
|
+
/encontrar-seams ${ARGS}
|
|
170
|
+
|
|
171
|
+
Dispatch direto:
|
|
172
|
+
Task(
|
|
173
|
+
subagent_type="seam-finder",
|
|
174
|
+
prompt="
|
|
175
|
+
${ARGS}
|
|
176
|
+
|
|
177
|
+
Aplicar skill legacy-seams-and-test-harness. Mapear deps bloqueantes, identificar tipos de seam disponíveis, recomendar técnica do cap 25 com menor custo. Output: .planning/SEAM-ANALYSIS.md.
|
|
178
|
+
"
|
|
179
|
+
)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 3c. `auditar-refactor` → `/auditar-refactor` (que invoca `refactor-safety-auditor`)
|
|
183
|
+
|
|
184
|
+
```text
|
|
185
|
+
Comando equivalente:
|
|
186
|
+
/auditar-refactor ${ARGS}
|
|
187
|
+
|
|
188
|
+
Dispatch direto:
|
|
189
|
+
Task(
|
|
190
|
+
subagent_type="refactor-safety-auditor",
|
|
191
|
+
prompt="
|
|
192
|
+
${ARGS}
|
|
193
|
+
|
|
194
|
+
Aplicar skill pre-refactor-characterization. Coletar evidências (linhas, contrato externo, coverage, mutation kill). Aplicar matriz de decisão (3 critérios canônicos). Output: .planning/REFACTOR-SAFETY.md com veredito GO/BLOCK/WARN/GO-OVERRIDE.
|
|
195
|
+
"
|
|
196
|
+
)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 3d. `refactor` → `/refactor-seguro` (orquestrador interno)
|
|
200
|
+
|
|
201
|
+
```text
|
|
202
|
+
Comando equivalente:
|
|
203
|
+
/refactor-seguro ${ARGS}
|
|
204
|
+
|
|
205
|
+
Não dispatch direto para agent — refactor-seguro é ele próprio orquestrador
|
|
206
|
+
que chama os 3 agents em sequência conforme mode escolhido.
|
|
207
|
+
|
|
208
|
+
Re-encaminhar via:
|
|
209
|
+
/refactor-seguro ${ARGS}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## 4. Sugestões de chains comuns (pós-output)
|
|
213
|
+
|
|
214
|
+
Após dispatch, orquestrador pode sugerir chains comuns:
|
|
215
|
+
|
|
216
|
+
| Subcomando rodado | Chain natural |
|
|
217
|
+
|---|---|
|
|
218
|
+
| `caracterizar` | `/legacy auditar-refactor <same>` (verificar se gate libera) |
|
|
219
|
+
| `encontrar-seams` | aplicar técnicas + `/legacy caracterizar <same>` (após break-deps) |
|
|
220
|
+
| `auditar-refactor` (BLOCK) | `/legacy refactor <same> --mode=full` OR `--mode=sprout` |
|
|
221
|
+
| `auditar-refactor` (GO) | refactor manual + suite verde após cada commit |
|
|
222
|
+
| `refactor` (concluído) | `/instrumentar-fase` (v1.9) + `/prr <same>` (v1.10) |
|
|
223
|
+
|
|
224
|
+
## 5. Cross-suite — links para outras suítes
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
═══════════════════════════════════════════════════════════
|
|
228
|
+
LEGACY SUITE · cross-references com outras suítes
|
|
229
|
+
═══════════════════════════════════════════════════════════
|
|
230
|
+
|
|
231
|
+
Suíte Observabilidade (v1.9):
|
|
232
|
+
/instrumentar-fase — bundle telemetria com refactor (ODD)
|
|
233
|
+
/burn-rate-status — monitor SLO durante refactor
|
|
234
|
+
/investigar-producao — Core Analysis Loop se regression em prod
|
|
235
|
+
|
|
236
|
+
Suíte SRE (v1.10):
|
|
237
|
+
/prr — Production Readiness Review pós-refactor
|
|
238
|
+
/golden-signals — instrumentar 4 signals em código refatorado
|
|
239
|
+
/postmortem — após incident pós-refactor
|
|
240
|
+
|
|
241
|
+
Suíte Supabase (v1.8):
|
|
242
|
+
/supabase edge — supabase-edge-fn-writer já gera código testável
|
|
243
|
+
/supabase architect — design considera testabilidade upfront
|
|
244
|
+
|
|
245
|
+
Fluxo Framework:
|
|
246
|
+
/discutir-fase — detecta refactor intent + sugere /legacy automaticamente
|
|
247
|
+
/planejar-fase — plan-checker bloqueia plano se task=refactor sem char
|
|
248
|
+
/executar-fase — executor invoca refactor-safety-auditor antes de tocar arquivo flagged
|
|
249
|
+
/auditar-marco — gate legacy-refactor-safety opt-in
|
|
250
|
+
/forense — postmortems pós-refactor consultam REFACTOR-SAFETY.md
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
</process>
|
|
254
|
+
|
|
255
|
+
<success_criteria>
|
|
256
|
+
- [ ] Subcomando resolvido (4 subcomandos × seus sinônimos)
|
|
257
|
+
- [ ] Dispatch via comando-arquivo direto OR via Task(subagent_type=...) — único ponto de chain (anti-pitfall A10)
|
|
258
|
+
- [ ] Subcomando inválido → mensagem clara com lista de 4 subcomandos válidos
|
|
259
|
+
- [ ] Subcomando `help`/`ajuda`/`?` → exibe tabela inline com 5 linhas (4 + help)
|
|
260
|
+
- [ ] Args após subcomando passam transparentemente para o agent/comando
|
|
261
|
+
- [ ] Sugestões de chains comuns na tabela final (5 chains documentadas)
|
|
262
|
+
- [ ] Cross-references com Suítes Observabilidade, SRE, Supabase + fluxo framework
|
|
263
|
+
</success_criteria>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: load-shedding
|
|
3
|
+
description: Invoca load-shedding-instrumenter — aplica patches de load shedding em Edge Function/handler HTTP (concurrency limit, queue bound + drop policy, deadline-aware, server-side rate limit, slow start). Cap 22 livro Google SRE.
|
|
4
|
+
argument-hint: "<target_path> [--max-concurrent N] [--queue-max-size N] [--patterns ...]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- Bash
|
|
10
|
+
- Grep
|
|
11
|
+
- Glob
|
|
12
|
+
- Task
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<objective>
|
|
16
|
+
Aplicar **patches de load shedding** em Edge Function ou handler HTTP, instrumentando defesas server-side: concurrency limit + queue bound + deadline-aware + rate limit + slow start. Invoca o agente [`load-shedding-instrumenter`](../agents/load-shedding-instrumenter.md) que aplica skill [`load-shedding-graceful-degradation`](../skills/load-shedding-graceful-degradation/SKILL.md).
|
|
17
|
+
|
|
18
|
+
**Cria/Atualiza:**
|
|
19
|
+
- Patches no `target_path`
|
|
20
|
+
- `supabase/functions/_shared/load-shedder.ts` (se não existe)
|
|
21
|
+
- `supabase/functions/_shared/token-bucket.ts` (se rate-limit aplicado)
|
|
22
|
+
|
|
23
|
+
**Após:** handler retorna 503 + Retry-After quando saturated, em vez de aceitar e cair. Defesa central contra cascade.
|
|
24
|
+
</objective>
|
|
25
|
+
|
|
26
|
+
<context>
|
|
27
|
+
**Argumentos:**
|
|
28
|
+
- `<target_path>` — arquivo a instrumentar (Edge Function ou handler HTTP) — OBRIGATÓRIO
|
|
29
|
+
- `--max-concurrent N` — concurrency limit (default: 1000)
|
|
30
|
+
- `--queue-max-size N` — queue bound (default: 10000)
|
|
31
|
+
- `--patterns <list>` — subset de `[concurrency-limit, queue-bound, deadline-aware, rate-limit, slow-start]` (default: aplicáveis)
|
|
32
|
+
|
|
33
|
+
**Exemplos:**
|
|
34
|
+
```
|
|
35
|
+
/load-shedding supabase/functions/process-orders/index.ts
|
|
36
|
+
/load-shedding src/handlers/webhook.ts --max-concurrent 500
|
|
37
|
+
/load-shedding supabase/functions/api/index.ts --patterns concurrency-limit,deadline-aware
|
|
38
|
+
```
|
|
39
|
+
</context>
|
|
40
|
+
|
|
41
|
+
<process>
|
|
42
|
+
|
|
43
|
+
## 1. Parsear argumentos
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
TARGET_PATH=$(echo "$ARGUMENTS" | awk '{print $1}')
|
|
47
|
+
MAX_CONCURRENT=$(echo "$ARGUMENTS" | grep -oE -- '--max-concurrent [0-9]+' | awk '{print $2}')
|
|
48
|
+
QUEUE_MAX_SIZE=$(echo "$ARGUMENTS" | grep -oE -- '--queue-max-size [0-9]+' | awk '{print $2}')
|
|
49
|
+
PATTERNS=$(echo "$ARGUMENTS" | grep -oE -- '--patterns [^ ]+' | awk '{print $2}')
|
|
50
|
+
|
|
51
|
+
[ -z "$MAX_CONCURRENT" ] && MAX_CONCURRENT=1000
|
|
52
|
+
[ -z "$QUEUE_MAX_SIZE" ] && QUEUE_MAX_SIZE=10000
|
|
53
|
+
|
|
54
|
+
if [ -z "$TARGET_PATH" ]; then
|
|
55
|
+
echo "ERROR: target_path obrigatório"
|
|
56
|
+
exit 1
|
|
57
|
+
fi
|
|
58
|
+
[ ! -f "$TARGET_PATH" ] && { echo "ERROR: arquivo não encontrado"; exit 1; }
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 2. Dispatch para `load-shedding-instrumenter`
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
Task(
|
|
65
|
+
subagent_type="load-shedding-instrumenter",
|
|
66
|
+
prompt="
|
|
67
|
+
target_path: ${TARGET_PATH}
|
|
68
|
+
max_concurrent: ${MAX_CONCURRENT}
|
|
69
|
+
queue_max_size: ${QUEUE_MAX_SIZE}
|
|
70
|
+
${PATTERNS:+patterns: ${PATTERNS}}
|
|
71
|
+
|
|
72
|
+
Aplicar skill load-shedding-graceful-degradation. Patches:
|
|
73
|
+
1. Concurrency limit + 503 graceful (LoadShedder em _shared)
|
|
74
|
+
2. Deadline-aware handler (x-deadline-ms header parsing)
|
|
75
|
+
3. Queue bound + drop oldest (FIFO drop)
|
|
76
|
+
4. Server-side rate limit (token bucket per-client)
|
|
77
|
+
5. Slow start state machine (5 min ramp em recovery)
|
|
78
|
+
|
|
79
|
+
Verify compilação verde após patches. Output curto com lista de patches aplicados.
|
|
80
|
+
"
|
|
81
|
+
)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## 3. Pós-output
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
═══════════════════════════════════════════════════════════
|
|
88
|
+
framework ► LOAD-SHEDDING ▸ ${TARGET_PATH}
|
|
89
|
+
═══════════════════════════════════════════════════════════
|
|
90
|
+
|
|
91
|
+
[output do agent]
|
|
92
|
+
|
|
93
|
+
## Próximos passos
|
|
94
|
+
|
|
95
|
+
1. **Smoke local:** `deno task serve` ou `npm run dev`, request 200 OK
|
|
96
|
+
2. **Stress test:** rampar tráfego acima de --max-concurrent, verificar 503 + Retry-After
|
|
97
|
+
3. **Game day:** simular dep down, verificar graceful degradation
|
|
98
|
+
4. **/golden-signals <fn>** (v1.10) — instrumentar saturation gauge para acionar load shed
|
|
99
|
+
5. **/caracterizar <fn>** (v1.12) — characterization tests pós-patches
|
|
100
|
+
|
|
101
|
+
## Cross-suite
|
|
102
|
+
|
|
103
|
+
- /auditar-cascading (v1.11) — caller-side defesas complementam
|
|
104
|
+
- /golden-signals (v1.10) — Saturation gauge é trigger
|
|
105
|
+
- /prr (v1.10) — Axe 4 consume
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
</process>
|
|
109
|
+
|
|
110
|
+
<success_criteria>
|
|
111
|
+
- [ ] target_path obrigatório
|
|
112
|
+
- [ ] `load-shedding-instrumenter` invocado via Task
|
|
113
|
+
- [ ] Patches aplicados com Edit
|
|
114
|
+
- [ ] Compilação verde verificada
|
|
115
|
+
- [ ] Output forwarded
|
|
116
|
+
- [ ] Cross-references com /auditar-cascading, /golden-signals, /caracterizar
|
|
117
|
+
</success_criteria>
|
|
@@ -38,6 +38,7 @@ Agents disponíveis: `kit/agents/observability-instrumenter.md` (Phase 30), `kit
|
|
|
38
38
|
| `slo` | `definir-slo`, `slo-engineer` | `slo-engineer` |
|
|
39
39
|
| `burn-rate` | `burn`, `burn-rate-forecaster`, `forecast` | `burn-rate-forecaster` |
|
|
40
40
|
| `omm` | `auditar`, `audit`, `maturity` | `omm-auditor` |
|
|
41
|
+
| `audit-coverage` | `cobertura`, `coverage` | `observability-coverage-auditor` (v1.12 cross-suite) |
|
|
41
42
|
| `help` | `ajuda`, `?` | exibe esta tabela inline |
|
|
42
43
|
</context>
|
|
43
44
|
|
|
@@ -60,6 +61,7 @@ investigar, investigate, incident → incident-investigator
|
|
|
60
61
|
slo, definir-slo, slo-engineer → slo-engineer
|
|
61
62
|
burn-rate, burn, burn-rate-forecaster, forecast → burn-rate-forecaster
|
|
62
63
|
omm, auditar, audit, maturity → omm-auditor
|
|
64
|
+
audit-coverage, cobertura, coverage → observability-coverage-auditor (v1.12 — cross-suite com Legacy)
|
|
63
65
|
```
|
|
64
66
|
|
|
65
67
|
**Se subcomando não resolve:** exibir erro inline com lista de subcomandos válidos. Sair.
|