@luanpdd/kit-mcp 1.9.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/CHANGELOG.md +86 -0
- package/README.md +58 -0
- package/gates/ai-prompt-stability.md +120 -0
- package/gates/golden-signals-coverage.md +133 -0
- package/gates/legacy-refactor-safety.md +178 -0
- package/gates/observability-coverage.md +151 -0
- package/gates/postmortem-template-required.md +127 -0
- package/gates/prr-checklist-coverage.md +128 -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/golden-signals-instrumenter.md +241 -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 +99 -0
- package/kit/agents/payload-capture-instrumenter.md +283 -0
- package/kit/agents/planner.md +29 -0
- package/kit/agents/postmortem-writer.md +282 -0
- package/kit/agents/prr-conductor.md +296 -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-architect.md +49 -0
- package/kit/agents/supabase-edge-fn-writer.md +114 -0
- package/kit/agents/supabase-migration-writer.md +80 -0
- package/kit/agents/supabase-storage-implementer.md +156 -0
- package/kit/agents/toil-auditor.md +277 -0
- package/kit/agents/verifier.md +30 -0
- package/kit/commands/auditar-cascading.md +111 -0
- package/kit/commands/auditar-marco.md +124 -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/auditar-toil.md +129 -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 +95 -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 +103 -1
- package/kit/commands/golden-signals.md +142 -0
- 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/postmortem.md +179 -0
- package/kit/commands/prr.md +205 -0
- package/kit/commands/refactor-seguro.md +321 -0
- package/kit/commands/risk-budget.md +220 -0
- package/kit/commands/sre.md +230 -0
- package/kit/commands/storytelling.md +179 -0
- package/kit/skills/_shared-legacy/glossary.md +389 -0
- package/kit/skills/_shared-sre/glossary.md +712 -0
- package/kit/skills/ai-prompt-characterization/SKILL.md +335 -0
- package/kit/skills/blameless-postmortems/SKILL.md +340 -0
- package/kit/skills/cascading-failures/SKILL.md +307 -0
- package/kit/skills/eliminating-toil/SKILL.md +243 -0
- package/kit/skills/event-based-slos/SKILL.md +22 -0
- package/kit/skills/four-golden-signals/SKILL.md +314 -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/production-readiness-review/SKILL.md +305 -0
- package/kit/skills/release-engineering/SKILL.md +367 -0
- package/kit/skills/retry-strategies/SKILL.md +372 -0
- package/kit/skills/sre-risk-management/SKILL.md +221 -0
- package/package.json +2 -2
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sre
|
|
3
|
+
description: Orquestrador da Suíte SRE (v1.10) — dispatch para agents (golden-signals-instrumenter, toil-auditor, postmortem-writer, prr-conductor) com sinônimos PT/EN.
|
|
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 SRE (v1.10) — terceiro orquestrador da família após [`/supabase`](./supabase.md) (v1.8) e [`/observabilidade`](./observabilidade.md) (v1.9). Recebe subcomando + args, faz dispatch via `Task(subagent_type=...)` para o agent SRE correto. **Único ponto de chain de agents SRE** (anti-pitfall A10 mantido — agents permanecem função pura).
|
|
17
|
+
|
|
18
|
+
**Subcomandos cobrem cap 3, 5, 6, 15, 32 do livro Google SRE:**
|
|
19
|
+
- `golden-signals` — 4 signals universais (cap 6)
|
|
20
|
+
- `auditar-toil`/`audit-toil` — eliminating toil (cap 5)
|
|
21
|
+
- `postmortem` — blameless postmortem (cap 15)
|
|
22
|
+
- `prr` — Production Readiness Review (cap 32)
|
|
23
|
+
- `risk-budget`/`budget` — risk continuum (cap 3)
|
|
24
|
+
|
|
25
|
+
**Cria/Atualiza:** o que cada agent invocado cria (patches OTel, TOIL-AUDIT.md, postmortem, PRR-REPORT.md, snapshot risk-budget).
|
|
26
|
+
|
|
27
|
+
**Após:** o usuário tem o output do agent (instrumentação aplicada, audit, postmortem revisável, PRR scored, ou snapshot de budget).
|
|
28
|
+
</objective>
|
|
29
|
+
|
|
30
|
+
<execution_context>
|
|
31
|
+
Skills consultadas pelos agents (Phase 36): [`kit/skills/sre-risk-management/SKILL.md`](../skills/sre-risk-management/SKILL.md), [`kit/skills/four-golden-signals/SKILL.md`](../skills/four-golden-signals/SKILL.md), [`kit/skills/eliminating-toil/SKILL.md`](../skills/eliminating-toil/SKILL.md), [`kit/skills/blameless-postmortems/SKILL.md`](../skills/blameless-postmortems/SKILL.md), [`kit/skills/production-readiness-review/SKILL.md`](../skills/production-readiness-review/SKILL.md) + glossário em [`kit/skills/_shared-sre/glossary.md`](../skills/_shared-sre/glossary.md).
|
|
32
|
+
|
|
33
|
+
Agents disponíveis (Phase 37):
|
|
34
|
+
- [`golden-signals-instrumenter`](../agents/golden-signals-instrumenter.md) — AGCORE-SRE-01
|
|
35
|
+
- [`toil-auditor`](../agents/toil-auditor.md) — AGCORE-SRE-02
|
|
36
|
+
- [`postmortem-writer`](../agents/postmortem-writer.md) — AGCORE-SRE-03
|
|
37
|
+
- [`prr-conductor`](../agents/prr-conductor.md) — AGCORE-SRE-04
|
|
38
|
+
|
|
39
|
+
**Subcomando `risk-budget`** é caso especial — comando direto (Plan 05 não usa agent); orquestrador delega aplicando skill [`sre-risk-management`](../skills/sre-risk-management/SKILL.md) inline ou re-encaminhando para `/risk-budget`.
|
|
40
|
+
</execution_context>
|
|
41
|
+
|
|
42
|
+
<context>
|
|
43
|
+
**Argumentos:** `$ARGUMENTS` — primeiro token é o subcomando; restante é passado para o agent como prompt.
|
|
44
|
+
|
|
45
|
+
**Subcomandos suportados (sinônimos PT-BR/EN):**
|
|
46
|
+
|
|
47
|
+
| Subcomando | Sinônimos | Agent dispatched | Cap livro |
|
|
48
|
+
|---|---|---|---|
|
|
49
|
+
| `golden-signals` | `signals`, `4signals`, `golden` | `golden-signals-instrumenter` | 6 |
|
|
50
|
+
| `auditar-toil` | `audit-toil`, `toil`, `auditar` | `toil-auditor` | 5 |
|
|
51
|
+
| `postmortem` | `pm`, `post-mortem` | `postmortem-writer` | 15 |
|
|
52
|
+
| `prr` | `production-readiness`, `readiness-review` | `prr-conductor` | 32 |
|
|
53
|
+
| `risk-budget` | `budget`, `risk`, `continuum` | (comando direto — `/risk-budget`) | 3 |
|
|
54
|
+
| `cascading` | `cascade`, `cascading-failures`, `auditar-cascading` | `cascading-failures-auditor` | 22 (v1.11) |
|
|
55
|
+
| `load-shedding` | `shed`, `load-shed`, `loadshedding` | `load-shedding-instrumenter` | 22 (v1.11) |
|
|
56
|
+
| `release` | `auditar-release`, `release-audit`, `pipeline` | `release-pipeline-auditor` | 8 (v1.11) |
|
|
57
|
+
| `help` | `ajuda`, `?` | exibe esta tabela inline | — |
|
|
58
|
+
|
|
59
|
+
**Roteamento de flags por subcomando:**
|
|
60
|
+
|
|
61
|
+
- `golden-signals <target>` — args passados como `<target>` + flags `--service` `--saturation` `--runtime`
|
|
62
|
+
- `auditar-toil` — flags `--time-window` `--team-size` `--output` `--runbooks-paths`
|
|
63
|
+
- `postmortem` — flags **mutuamente exclusivas** `--from-investigation <id>` OU `--incident "<desc>"` + `--severity`
|
|
64
|
+
- `prr` — flags **mutuamente exclusivas** `--service <name>` OU `--feature "<desc>"` + `--engagement` `--reviewer`
|
|
65
|
+
- `risk-budget` — `[<slo_name>]` opcional + `--format` `--explain`
|
|
66
|
+
|
|
67
|
+
**Exemplos:**
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
/sre golden-signals supabase/functions/process-emails # instrumentar Edge Function
|
|
71
|
+
/sre auditar-toil --time-window 6m # audit toil últimos 6 meses
|
|
72
|
+
/sre postmortem --from-investigation incident-2026-05-06-1432-checkout-burn # continuação de v1.9
|
|
73
|
+
/sre prr --service orders-api --reviewer @sre-lead # PRR de serviço existente
|
|
74
|
+
/sre risk-budget checkout_success --explain # budget + sabedoria 99.99% inline
|
|
75
|
+
/sre help # exibe tabela de subcomandos
|
|
76
|
+
```
|
|
77
|
+
</context>
|
|
78
|
+
|
|
79
|
+
<process>
|
|
80
|
+
|
|
81
|
+
## 1. Parsear subcomando
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
SUBCMD=$(echo "$ARGUMENTS" | awk '{print $1}')
|
|
85
|
+
ARGS=$(echo "$ARGUMENTS" | cut -d' ' -f2-)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Se `$ARGUMENTS` for vazio ou `SUBCMD` for `help`/`ajuda`/`?`:** exibir tabela de subcomandos inline + exemplo de uso. Sair.
|
|
89
|
+
|
|
90
|
+
## 2. Resolver sinônimos para agent canônico
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
golden-signals, signals, 4signals, golden → golden-signals-instrumenter
|
|
94
|
+
auditar-toil, audit-toil, toil, auditar → toil-auditor
|
|
95
|
+
postmortem, pm, post-mortem → postmortem-writer
|
|
96
|
+
prr, production-readiness, readiness-review → prr-conductor
|
|
97
|
+
risk-budget, budget, risk, continuum → (comando direto — /risk-budget)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Se subcomando não resolve:** exibir erro inline com lista de subcomandos válidos. Sair.
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
✗ Subcomando desconhecido: '<SUBCMD>'
|
|
104
|
+
|
|
105
|
+
Subcomandos válidos:
|
|
106
|
+
golden-signals → instrumentar 4 signals OTel (Latency/Traffic/Errors/Saturation)
|
|
107
|
+
auditar-toil → audit toil priorizado P0/P1/P2 + esforço de automação
|
|
108
|
+
postmortem → postmortem blameless 9 seções (--from-investigation OU --incident)
|
|
109
|
+
prr → Production Readiness Review 6 axes (--service OU --feature)
|
|
110
|
+
risk-budget → error budget vs risk continuum + sabedoria 99.99%
|
|
111
|
+
|
|
112
|
+
Uso: /sre <subcomando> <args...>
|
|
113
|
+
Exemplo: /sre prr --service orders-api
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## 3. Detectar `supabase/config.toml` (passar `project_id` para agents que usam MCP)
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
PROJECT_ID=""
|
|
120
|
+
if [ -f supabase/config.toml ]; then
|
|
121
|
+
PROJECT_ID=$(grep -E '^project_id\s*=' supabase/config.toml | sed 's/.*= *"\(.*\)".*/\1/' | head -1)
|
|
122
|
+
fi
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Apenas `prr-conductor` usa `mcp__supabase__*` — outros 3 agents não precisam de `project_id` (instrumentação/audit/postmortem são filesystem only).
|
|
126
|
+
|
|
127
|
+
## 4. Dispatch — caminhos por subcomando
|
|
128
|
+
|
|
129
|
+
### 4a. `golden-signals` → `golden-signals-instrumenter`
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
Task(
|
|
133
|
+
subagent_type="golden-signals-instrumenter",
|
|
134
|
+
prompt="
|
|
135
|
+
${ARGS}
|
|
136
|
+
|
|
137
|
+
Aplicar skill four-golden-signals. Gerar patches OTel para os 4 signals (Latency: histogram bucketed; Traffic: counter; Errors: counter por error.type; Saturation: gauge resource-specific).
|
|
138
|
+
"
|
|
139
|
+
)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 4b. `auditar-toil` → `toil-auditor`
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
Task(
|
|
146
|
+
subagent_type="toil-auditor",
|
|
147
|
+
prompt="
|
|
148
|
+
project_root: .
|
|
149
|
+
output_path: .planning/TOIL-AUDIT.md
|
|
150
|
+
${ARGS}
|
|
151
|
+
|
|
152
|
+
Aplicar skill eliminating-toil. Scan git log + scripts + runbooks; aplicar 6 critérios canônicos; priorizar P0/P1/P2; estimar esforço de automação L0-L4.
|
|
153
|
+
"
|
|
154
|
+
)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 4c. `postmortem` → `postmortem-writer`
|
|
158
|
+
|
|
159
|
+
Validar mutuamente exclusivos (`--from-investigation` E `--incident` ambos = ERROR; nenhum = AskUserQuestion sugerido).
|
|
160
|
+
|
|
161
|
+
```text
|
|
162
|
+
Task(
|
|
163
|
+
subagent_type="postmortem-writer",
|
|
164
|
+
prompt="
|
|
165
|
+
${ARGS}
|
|
166
|
+
|
|
167
|
+
Aplicar skill blameless-postmortems. Modo conforme flag (--from-investigation lê investigation v1.9; --incident standalone com 9 perguntas guiadas). 9 seções obrigatórias: Summary, Impact, Root Causes, Trigger, Resolution, Detection, Action Items, Lessons Learned, Timeline UTC. Foco em sistema/processo (NUNCA pessoas).
|
|
168
|
+
"
|
|
169
|
+
)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 4d. `prr` → `prr-conductor`
|
|
173
|
+
|
|
174
|
+
Validar mutuamente exclusivos (`--service` E `--feature` ambos = ERROR; nenhum = ERROR com sugestão). Se `--reviewer` ausente: AskUserQuestion (anti-pattern auto-PRR).
|
|
175
|
+
|
|
176
|
+
```text
|
|
177
|
+
Task(
|
|
178
|
+
subagent_type="prr-conductor",
|
|
179
|
+
prompt="
|
|
180
|
+
${ARGS}
|
|
181
|
+
${PROJECT_ID:+project_id: ${PROJECT_ID}}
|
|
182
|
+
|
|
183
|
+
Aplicar skill production-readiness-review. Audit em 6 axes (System Architecture, Instrumentation, Emergency Response, Capacity Planning, Change Management, Performance) — todos obrigatórios. Engagement model conforme outage cost. Modo offline fallback graceful.
|
|
184
|
+
"
|
|
185
|
+
)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### 4e. `risk-budget` → comando direto `/risk-budget`
|
|
189
|
+
|
|
190
|
+
Caso especial — não há agent. Re-encaminhar via shell ou aplicar skill `sre-risk-management` direto.
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# PT-BR: invocar comando /risk-budget passando args
|
|
194
|
+
# Em Claude Code, isso é equivalente a executar o comando file diretamente
|
|
195
|
+
# (orquestrador apenas valida sinônimo e delega)
|
|
196
|
+
/risk-budget ${ARGS}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Alternativa inline (se não há shell call): orquestrador lê `.planning/slos/*.md`, mapeia para tabela continuum (skill `sre-risk-management` Pattern 1), exibe tabela com status (OPTIMAL/OVER-SPEC/UNDER-SPEC/BUDGET-EXHAUSTED).
|
|
200
|
+
|
|
201
|
+
## 5. Output
|
|
202
|
+
|
|
203
|
+
Output do agent (ou do comando direto risk-budget) é o output do orquestrador. Sem post-processing — agent já formata estruturado.
|
|
204
|
+
|
|
205
|
+
## 6. Sugestões de chains comuns (pós-output)
|
|
206
|
+
|
|
207
|
+
Após dispatch, orquestrador pode sugerir chains comuns:
|
|
208
|
+
|
|
209
|
+
| Subcomando rodado | Chain natural |
|
|
210
|
+
|---|---|
|
|
211
|
+
| `golden-signals` | `/sre prr --service <same>` (validar production-readiness) |
|
|
212
|
+
| `auditar-toil` | `/observabilidade omm` (alimentar OMM Capacidade 3) |
|
|
213
|
+
| `postmortem` | `/sre prr --service <affected>` OR `/observabilidade omm` (Capacidade 5 Incident Response) |
|
|
214
|
+
| `prr` | (se Approved) deploy; (se Blocked) fechar P0s e re-PRR |
|
|
215
|
+
| `risk-budget` | `/burn-rate-status` (live forecast) OR `/sre postmortem --incident "..."` se BUDGET-EXHAUSTED |
|
|
216
|
+
|
|
217
|
+
</process>
|
|
218
|
+
|
|
219
|
+
<success_criteria>
|
|
220
|
+
- [ ] Subcomando resolvido para agent canônico (5 subcomandos × seus sinônimos)
|
|
221
|
+
- [ ] `project_id` extraído de `supabase/config.toml` se presente (apenas relevante para `prr`)
|
|
222
|
+
- [ ] Dispatch via `Task(subagent_type=...)` — único ponto de chain (anti-pitfall A10)
|
|
223
|
+
- [ ] Subcomando `risk-budget` delega para comando direto `/risk-budget` (não usa Task)
|
|
224
|
+
- [ ] Subcomando `postmortem` valida `--from-investigation` E `--incident` mutuamente exclusivos antes de dispatch
|
|
225
|
+
- [ ] Subcomando `prr` valida `--service` E `--feature` mutuamente exclusivos + AskUserQuestion para reviewer (anti auto-PRR)
|
|
226
|
+
- [ ] Subcomando inválido → mensagem clara com lista de 5 subcomandos válidos
|
|
227
|
+
- [ ] Subcomando `help`/`ajuda`/`?` → exibe tabela inline com 6 linhas (5 + help)
|
|
228
|
+
- [ ] Args após subcomando passam transparentemente para o agent
|
|
229
|
+
- [ ] Sugestões de chains comuns na tabela final (5 chains documentadas)
|
|
230
|
+
</success_criteria>
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: storytelling
|
|
3
|
+
description: Invoca storytelling-analyst — IA gera mental model de codebase desconhecido (story 5 frases + inventário + naked CRC + responsibility hot spots + extract candidates). Modernização cap 16-17 Feathers para era IA.
|
|
4
|
+
argument-hint: "<target_dir_or_file> [--depth deep|shallow] [--include-tests] [--output PATH]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Bash
|
|
8
|
+
- Grep
|
|
9
|
+
- Glob
|
|
10
|
+
- Task
|
|
11
|
+
- Write
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<objective>
|
|
15
|
+
Gerar **mental model de codebase desconhecido** via IA — story em 5 frases + inventário de classes/funções + naked CRC sketch + responsibility hot spots + extract candidates priorizados. Invoca o agente [`storytelling-analyst`](../agents/storytelling-analyst.md) que aplica a skill [`legacy-storytelling-naked-crc`](../skills/legacy-storytelling-naked-crc/SKILL.md) — caps 16-17 do livro Feathers + modernização IA primeiro draft.
|
|
16
|
+
|
|
17
|
+
**Cria/Atualiza:**
|
|
18
|
+
- `.planning/storytelling/<module-slug>.md` — relatório com story + inventário + CRC + hot spots
|
|
19
|
+
|
|
20
|
+
**Após:** o user reduz tempo de comprehension de codebase desconhecido de 4-8h (leitura cega manual) para 30 min (revisão informada de IA primeiro draft). Pré-requisito recomendado para `/encontrar-seams` ou `/refactor-seguro` em código novo.
|
|
21
|
+
</objective>
|
|
22
|
+
|
|
23
|
+
<context>
|
|
24
|
+
**Argumentos:**
|
|
25
|
+
- `<target_dir_or_file>` — diretório ou arquivo a analisar — OBRIGATÓRIO
|
|
26
|
+
- `--depth deep|shallow` — `shallow` = só story + inventário; `deep` = + CRC + hot spots + extract candidates (default: deep)
|
|
27
|
+
- `--include-tests` — incluir tests no scope (default: false; distinção comportamento prod vs harness)
|
|
28
|
+
- `--max-lines N` — limite de leitura (default: 1500; agent quebra em chunks se maior)
|
|
29
|
+
- `--output PATH` — caminho do output (default: `.planning/storytelling/<slug>.md`)
|
|
30
|
+
|
|
31
|
+
**Exemplos:**
|
|
32
|
+
```
|
|
33
|
+
/storytelling src/orders/ # diretório completo
|
|
34
|
+
/storytelling src/orders/OrderService.ts # arquivo específico
|
|
35
|
+
/storytelling src/orders/ --depth=shallow # rápido — só story + inventário
|
|
36
|
+
/storytelling src/orders/ --include-tests # incluir tests no scope
|
|
37
|
+
/storytelling supabase/functions/process-payments/ # Edge Function module
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Quando este comando é o caminho:**
|
|
41
|
+
- Você herdou módulo desconhecido (onboarding, transferência, post-acquisition)
|
|
42
|
+
- Vai modificar código que não conhece
|
|
43
|
+
- Pré-requisito de `/encontrar-seams` ou `/refactor-seguro`
|
|
44
|
+
- Precisa identificar candidates de extract class antes de planejar refactor
|
|
45
|
+
- Code review onde reviewer não conhece o módulo
|
|
46
|
+
|
|
47
|
+
**Quando NÃO é o caminho:**
|
|
48
|
+
- Codebase < 200 linhas — leitura direta é mais rápida
|
|
49
|
+
- Você já trabalhou no módulo nas últimas 2 semanas — mental model fresco
|
|
50
|
+
- Mudança trivial (typo, comment) — overhead > valor
|
|
51
|
+
</context>
|
|
52
|
+
|
|
53
|
+
<process>
|
|
54
|
+
|
|
55
|
+
## 1. Parsear argumentos
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
TARGET=$(echo "$ARGUMENTS" | awk '{print $1}')
|
|
59
|
+
DEPTH=$(echo "$ARGUMENTS" | grep -oE -- '--depth[= ][^ ]+' | sed 's/--depth[= ]//')
|
|
60
|
+
MAX_LINES=$(echo "$ARGUMENTS" | grep -oE -- '--max-lines [0-9]+' | awk '{print $2}')
|
|
61
|
+
OUTPUT_PATH=$(echo "$ARGUMENTS" | grep -oE -- '--output [^ ]+' | awk '{print $2}')
|
|
62
|
+
INCLUDE_TESTS=false
|
|
63
|
+
echo "$ARGUMENTS" | grep -qE -- '--include-tests' && INCLUDE_TESTS=true
|
|
64
|
+
|
|
65
|
+
[ -z "$DEPTH" ] && DEPTH="deep"
|
|
66
|
+
[ -z "$MAX_LINES" ] && MAX_LINES=1500
|
|
67
|
+
|
|
68
|
+
if [ -z "$TARGET" ]; then
|
|
69
|
+
echo "ERROR: target obrigatório (arquivo ou diretório)"
|
|
70
|
+
exit 1
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
if [ ! -e "$TARGET" ]; then
|
|
74
|
+
echo "ERROR: target não encontrado: $TARGET"
|
|
75
|
+
exit 1
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
# auto-output path
|
|
79
|
+
if [ -z "$OUTPUT_PATH" ]; then
|
|
80
|
+
SLUG=$(basename "$(realpath "$TARGET")" | sed 's/[^a-zA-Z0-9]/-/g')
|
|
81
|
+
OUTPUT_PATH=".planning/storytelling/${SLUG}.md"
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
mkdir -p "$(dirname "$OUTPUT_PATH")"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 2. Detectar tamanho
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
if [ -f "$TARGET" ]; then
|
|
91
|
+
TOTAL_LINES=$(wc -l < "$TARGET")
|
|
92
|
+
elif [ -d "$TARGET" ]; then
|
|
93
|
+
TOTAL_LINES=$(find "$TARGET" -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.py" -o -name "*.java" -o -name "*.go" \) ! -path "*node_modules*" -exec cat {} + 2>/dev/null | wc -l)
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
if [ "$TOTAL_LINES" -gt "$MAX_LINES" ]; then
|
|
97
|
+
echo "ℹ Target tem $TOTAL_LINES linhas (> $MAX_LINES). Agent vai chunkar análise."
|
|
98
|
+
fi
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 3. Dispatch para `storytelling-analyst`
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
Task(
|
|
105
|
+
subagent_type="storytelling-analyst",
|
|
106
|
+
prompt="
|
|
107
|
+
target: ${TARGET}
|
|
108
|
+
depth: ${DEPTH}
|
|
109
|
+
output_path: ${OUTPUT_PATH}
|
|
110
|
+
max_lines: ${MAX_LINES}
|
|
111
|
+
include_tests: ${INCLUDE_TESTS}
|
|
112
|
+
|
|
113
|
+
Aplicar skill legacy-storytelling-naked-crc. Etapas:
|
|
114
|
+
1. Inventário inicial (listar files + classes/funções top-level)
|
|
115
|
+
2. Leitura + síntese — produzir story em ≤ 5 frases
|
|
116
|
+
3. Inventário canônico (tabela com responsabilidade primária + cluster)
|
|
117
|
+
4. (depth=deep) Naked CRC sketch ASCII
|
|
118
|
+
5. (depth=deep) Responsibility hot spots — classes fazendo > 3 coisas distintas
|
|
119
|
+
6. (depth=deep) Abstrações ausentes (sugestões)
|
|
120
|
+
7. (depth=deep) Extract class candidates priorizados
|
|
121
|
+
8. Gotchas / surpresas
|
|
122
|
+
9. Próximas ações sugeridas (effect sketch, /caracterizar, /refactor-seguro)
|
|
123
|
+
10. Output: .planning/storytelling/<slug>.md
|
|
124
|
+
|
|
125
|
+
PRINCÍPIO: você É a IA primeiro draft. Não busque perfeição — busque utilidade. Seja honesto sobre incertezas.
|
|
126
|
+
"
|
|
127
|
+
)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## 4. Pós-output
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
═══════════════════════════════════════════════════════════
|
|
134
|
+
framework ► STORYTELLING ▸ ${OUTPUT_PATH}
|
|
135
|
+
═══════════════════════════════════════════════════════════
|
|
136
|
+
|
|
137
|
+
[output do storytelling-analyst]
|
|
138
|
+
|
|
139
|
+
## ⚠ Validação obrigatória
|
|
140
|
+
|
|
141
|
+
Esta análise é PRIMEIRA PASSADA por IA. Erros possíveis:
|
|
142
|
+
- Relações alucinadas (LLM "viu" colaborador que não existe)
|
|
143
|
+
- Hot spots inflated (cluster coeso marcado como hot spot)
|
|
144
|
+
- Sugestões fora de escopo (extract candidate com 2-week effort marcado como 3h)
|
|
145
|
+
|
|
146
|
+
Cross-check OBRIGATÓRIO antes de basear decisões:
|
|
147
|
+
1. **Spot-check 3-5 funções aleatórias** contra inventário (existem? responsabilidade descrita está correta?)
|
|
148
|
+
2. **Confirmar colaboradores** existem (grep no codebase pelos nomes mencionados)
|
|
149
|
+
3. **Validar hot spots** contra leitura humana (são realmente "fazendo demais"?)
|
|
150
|
+
4. **Refinar story** se necessário; versão final em ${OUTPUT_PATH} é HUMANA, IA é primeiro draft
|
|
151
|
+
|
|
152
|
+
## Próximos passos
|
|
153
|
+
|
|
154
|
+
1. Validar story (5-15 min)
|
|
155
|
+
2. Se vai modificar: `/encontrar-seams ${TARGET}` (se arquivo) ou `/storytelling <sub-target>` (refinar para sub-módulo)
|
|
156
|
+
3. Se vai refactorar: `/refactor-seguro ${TARGET}` (chain canônico)
|
|
157
|
+
4. Se vai extrair: revisar extract candidates — `/legacy refactor` por candidate
|
|
158
|
+
5. Se há shotgun surgery em outros módulos relacionados: `/detectar-duplicacao src/`
|
|
159
|
+
|
|
160
|
+
## Cross-suite
|
|
161
|
+
|
|
162
|
+
- **/encontrar-seams** (v1.12) — story informa onde existem deps externas
|
|
163
|
+
- **/caracterizar** (v1.12) — story prioriza qual hot spot caracterizar primeiro
|
|
164
|
+
- **/refactor-seguro** (v1.12) — chain canônico após storytelling
|
|
165
|
+
- **/detectar-duplicacao** (v1.12) — shotgun across módulos relacionados
|
|
166
|
+
- **/mapear-codebase** (framework v1.7+) — comando análogo mais geral; storytelling complementa com narrativa
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
</process>
|
|
170
|
+
|
|
171
|
+
<success_criteria>
|
|
172
|
+
- [ ] $ARGUMENTS parseados (target obrigatório)
|
|
173
|
+
- [ ] Tamanho detectado e chunking ativado se necessário
|
|
174
|
+
- [ ] `storytelling-analyst` invocado via Task com depth resolvido
|
|
175
|
+
- [ ] Output forwarded transparentemente
|
|
176
|
+
- [ ] Warning de validação manual obrigatória emitido
|
|
177
|
+
- [ ] Próximos passos sugerem encontrar-seams, caracterizar, refactor-seguro
|
|
178
|
+
- [ ] Cross-references com /detectar-duplicacao, /mapear-codebase, /caracterizar
|
|
179
|
+
</success_criteria>
|