@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,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: postmortem
|
|
3
|
+
description: Invoca postmortem-writer — modo --from-investigation <id> (lê v1.9 trail) ou --incident "<descrição>" standalone; produz postmortem blameless 9 seções.
|
|
4
|
+
argument-hint: "(--from-investigation <id> | --incident \"<descrição>\") [--severity SEV1|SEV2|SEV3]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Bash
|
|
9
|
+
- Grep
|
|
10
|
+
- Glob
|
|
11
|
+
- Task
|
|
12
|
+
- AskUserQuestion
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<objective>
|
|
16
|
+
Gerar **postmortem blameless** de 9 seções (cap 15 do livro Google SRE) — Summary, Impact, Root Causes, Trigger, Resolution, Detection, Action Items, Lessons Learned, Timeline UTC. Invoca o agente [`postmortem-writer`](../agents/postmortem-writer.md) que aplica a skill [`blameless-postmortems`](../skills/blameless-postmortems/SKILL.md) — cultura blameless ("foco em sistema/processo, NÃO em pessoas"), action items SMART, "no postmortem left unreviewed".
|
|
17
|
+
|
|
18
|
+
**Cria/Atualiza:**
|
|
19
|
+
- `.planning/postmortems/<id>.md` — postmortem blameless completo
|
|
20
|
+
|
|
21
|
+
**Após:** o user tem postmortem revisável + action items concretos. Phase 40 INT-FW-V2-01 chained do `/forense` automaticamente após Core Analysis Loop fechar.
|
|
22
|
+
</objective>
|
|
23
|
+
|
|
24
|
+
<context>
|
|
25
|
+
**Argumentos:** `$ARGUMENTS` — comando suporta **2 modos mutuamente exclusivos**.
|
|
26
|
+
|
|
27
|
+
**Modo A: `--from-investigation <id>` (preferido — continuação de v1.9)**
|
|
28
|
+
|
|
29
|
+
Lê `.planning/investigations/<id>.md` produzido pelo [`incident-investigator`](../agents/incident-investigator.md) (v1.9 — Core Analysis Loop). Extrai automaticamente: trigger, root cause, hipóteses validadas, action items. Campos faltantes (impact quantificado, severity, autores) são perguntados via `AskUserQuestion`.
|
|
30
|
+
|
|
31
|
+
**Modo B: `--incident "<descrição>"` (standalone)**
|
|
32
|
+
|
|
33
|
+
Para postmortem sem investigation prévia (incident menor, near-miss, lições retrospectivas). Agent gera template e usa `AskUserQuestion` para 9 perguntas guiadas — uma por seção canônica.
|
|
34
|
+
|
|
35
|
+
**Flags adicionais:**
|
|
36
|
+
- `--severity <SEV1|SEV2|SEV3>` — severity do incident (default: AskUserQuestion)
|
|
37
|
+
- `--output <path>` — caminho do postmortem (default: `.planning/postmortems/<id>.md` — id auto-gerado)
|
|
38
|
+
|
|
39
|
+
**Exemplos:**
|
|
40
|
+
```
|
|
41
|
+
/postmortem --from-investigation incident-2026-05-06-1432-checkout-burn # Modo A
|
|
42
|
+
/postmortem --incident "checkout SLO burn às 14:32 — RCA N+1 query orders" --severity SEV2 # Modo B
|
|
43
|
+
/postmortem --incident "near-miss: deploy bloqueou 2min antes do PR-1234" # near-miss
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Pré-requisito (Modo A):** arquivo `.planning/investigations/<id>.md` existe (criado por `/investigar-producao` ou `/forense`).
|
|
47
|
+
</context>
|
|
48
|
+
|
|
49
|
+
<process>
|
|
50
|
+
|
|
51
|
+
## 1. Parsear argumentos (2 modos)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
INV_ID=$(echo "$ARGUMENTS" | grep -oE -- '--from-investigation [^ ]+' | awk '{print $2}')
|
|
55
|
+
INCIDENT=$(echo "$ARGUMENTS" | grep -oE -- '--incident "[^"]+"' | sed 's/--incident //; s/^"//; s/"$//')
|
|
56
|
+
SEVERITY=$(echo "$ARGUMENTS" | grep -oE -- '--severity [^ ]+' | awk '{print $2}')
|
|
57
|
+
OUTPUT_PATH=$(echo "$ARGUMENTS" | grep -oE -- '--output [^ ]+' | awk '{print $2}')
|
|
58
|
+
|
|
59
|
+
# PT-BR: validar mutuamente exclusivos
|
|
60
|
+
if [ -n "$INV_ID" ] && [ -n "$INCIDENT" ]; then
|
|
61
|
+
echo "✗ Erro: --from-investigation e --incident são mutuamente exclusivos. Escolha um."
|
|
62
|
+
exit 1
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
# PT-BR: se nenhum dos 2 → AskUserQuestion (Modo C — interativo)
|
|
66
|
+
if [ -z "$INV_ID" ] && [ -z "$INCIDENT" ]; then
|
|
67
|
+
# Listar investigations recentes para sugestão
|
|
68
|
+
RECENT_INVS=$(ls -t .planning/investigations/*.md 2>/dev/null | head -5 | while read f; do basename "$f" .md; done | tr '\n' ',')
|
|
69
|
+
# AskUserQuestion: "Modo? Continuar de investigation existente OU postmortem standalone?"
|
|
70
|
+
# Opções: Continuar de <ID> (uma por investigation recente) | Standalone (texto livre)
|
|
71
|
+
echo "ℹ Sem flag explícita. Use --from-investigation <id> ou --incident \"<descrição>\"."
|
|
72
|
+
[ -n "$RECENT_INVS" ] && echo " Investigations recentes: $RECENT_INVS"
|
|
73
|
+
exit 1
|
|
74
|
+
fi
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 2. Validar pré-requisitos por modo
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
mkdir -p .planning/postmortems
|
|
81
|
+
|
|
82
|
+
# PT-BR: Modo A — investigation file precisa existir
|
|
83
|
+
if [ -n "$INV_ID" ]; then
|
|
84
|
+
INV_FILE=".planning/investigations/${INV_ID}.md"
|
|
85
|
+
if [ ! -f "$INV_FILE" ]; then
|
|
86
|
+
echo "✗ Investigation $INV_ID não existe. Liste com: ls .planning/investigations/"
|
|
87
|
+
echo " Para postmortem standalone: /postmortem --incident \"<descrição>\""
|
|
88
|
+
exit 1
|
|
89
|
+
fi
|
|
90
|
+
# PT-BR: derivar postmortem id do investigation_id
|
|
91
|
+
POSTMORTEM_ID="$INV_ID"
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
# PT-BR: Modo B — gerar postmortem id automaticamente
|
|
95
|
+
if [ -n "$INCIDENT" ]; then
|
|
96
|
+
DATE=$(date -u +%Y-%m-%d-%H%M)
|
|
97
|
+
SLUG=$(echo "$INCIDENT" | tr ' ' '-' | tr -cd 'a-zA-Z0-9-' | head -c 30 | sed 's/-$//')
|
|
98
|
+
POSTMORTEM_ID="postmortem-${DATE}-${SLUG}"
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# PT-BR: default output_path (override via --output)
|
|
102
|
+
[ -z "$OUTPUT_PATH" ] && OUTPUT_PATH=".planning/postmortems/${POSTMORTEM_ID}.md"
|
|
103
|
+
|
|
104
|
+
# PT-BR: idempotência — não sobrescrever postmortem existente sem confirmar
|
|
105
|
+
if [ -f "$OUTPUT_PATH" ]; then
|
|
106
|
+
echo "⚠ Postmortem $OUTPUT_PATH já existe."
|
|
107
|
+
echo " Use --output <novo-path> ou rm $OUTPUT_PATH antes de re-rodar."
|
|
108
|
+
exit 1
|
|
109
|
+
fi
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## 3. Listar postmortems recentes (UX)
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# PT-BR: contexto — postmortems anteriores para correlacionar lessons learned
|
|
116
|
+
ls -t .planning/postmortems/*.md 2>/dev/null | head -3 | while read f; do
|
|
117
|
+
ID=$(basename "$f" .md)
|
|
118
|
+
DATE=$(grep -m1 '\*\*Date:\*\*' "$f" 2>/dev/null | sed 's/.*Date:\*\* //' || echo "?")
|
|
119
|
+
printf " %s — %s\n" "$ID" "$DATE"
|
|
120
|
+
done
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## 4. Dispatch para `postmortem-writer`
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
Task(
|
|
127
|
+
subagent_type="postmortem-writer",
|
|
128
|
+
prompt="
|
|
129
|
+
${INV_ID:+investigation_id: ${INV_ID}}
|
|
130
|
+
${INCIDENT:+incident_description: ${INCIDENT}}
|
|
131
|
+
${SEVERITY:+severity: ${SEVERITY}}
|
|
132
|
+
output_path: ${OUTPUT_PATH}
|
|
133
|
+
postmortem_id: ${POSTMORTEM_ID}
|
|
134
|
+
|
|
135
|
+
Aplicar skill blameless-postmortems. Modo:
|
|
136
|
+
${INV_ID:+- Modo A: ler .planning/investigations/${INV_ID}.md, extrair trigger/root_cause/hipóteses/action_items automaticamente; perguntar via AskUserQuestion apenas campos faltantes (impact quantificado, severity, autores).}
|
|
137
|
+
${INCIDENT:+- Modo B: gerar template; perguntar via AskUserQuestion 9 questões guiadas — uma por seção canônica (Summary, Impact, Root Causes, Trigger, Resolution, Detection, Action Items, Lessons Learned, Timeline).}
|
|
138
|
+
|
|
139
|
+
Padrões obrigatórios:
|
|
140
|
+
- Foco em sistema/processo (NUNCA em pessoas) — anti-pattern blame culture
|
|
141
|
+
- Action items SMART (Specific, Measurable, Assignable, Realistic, Time-bound)
|
|
142
|
+
- Timeline em UTC sempre
|
|
143
|
+
- Impact quantificado (# usuários, duração, SLO budget consumido, revenue se aplicável)
|
|
144
|
+
- 9 seções canônicas obrigatórias (skip = inválido)
|
|
145
|
+
"
|
|
146
|
+
)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## 5. Pós-output
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
═══════════════════════════════════════════════════════════
|
|
153
|
+
framework ► POSTMORTEM ▸ ${POSTMORTEM_ID}
|
|
154
|
+
═══════════════════════════════════════════════════════════
|
|
155
|
+
|
|
156
|
+
[output do postmortem-writer — ver Step 6 do agent]
|
|
157
|
+
|
|
158
|
+
## Estado salvo
|
|
159
|
+
.planning/postmortems/${POSTMORTEM_ID}.md
|
|
160
|
+
|
|
161
|
+
## Próximos passos
|
|
162
|
+
1. Revisar o postmortem com o time — "no postmortem left unreviewed"
|
|
163
|
+
2. Distribuir para reviewer SRE OU par externo (anti-pattern: auto-review)
|
|
164
|
+
3. Action items entram no roadmap (`/adicionar-tarefa` ou `/adicionar-fase`)
|
|
165
|
+
4. Se PRR for próximo passo de production-readiness: `/prr --service <name>`
|
|
166
|
+
5. Cross-ref OMM: postmortems alimentam Capacidade 5 (Incident Response) — `/observabilidade omm`
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
</process>
|
|
170
|
+
|
|
171
|
+
<success_criteria>
|
|
172
|
+
- [ ] `--from-investigation <id>` E `--incident "<text>"` parseados (mutuamente exclusivos)
|
|
173
|
+
- [ ] Modo A: arquivo `.planning/investigations/<id>.md` validado existe antes de dispatch
|
|
174
|
+
- [ ] Modo B: postmortem_id auto-gerado a partir de date + slug
|
|
175
|
+
- [ ] Idempotência: não sobrescreve postmortem existente sem `--output` explícito
|
|
176
|
+
- [ ] `postmortem-writer` invocado via `Task(subagent_type=...)` com prompt completo (modo + 9 seções + padrões)
|
|
177
|
+
- [ ] `.planning/postmortems/<id>.md` criado pelo agent
|
|
178
|
+
- [ ] Próximos passos sugerem cross-ref para `/prr`, `/observabilidade omm`, `/adicionar-tarefa`
|
|
179
|
+
</success_criteria>
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: prr
|
|
3
|
+
description: Invoca prr-conductor — Production Readiness Review scored em 6 axes (cap 32); modos --service <name> ou --feature <desc>; offline fallback se MCP ausente.
|
|
4
|
+
argument-hint: "(--service <name> | --feature \"<desc>\") [--engagement simple|early|platform] [--reviewer @sre]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Bash
|
|
9
|
+
- Grep
|
|
10
|
+
- Glob
|
|
11
|
+
- Task
|
|
12
|
+
- AskUserQuestion
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<objective>
|
|
16
|
+
Conduzir **Production Readiness Review** (PRR — cap 32 do livro Google SRE) para serviço/feature antes de production. Invoca o agente [`prr-conductor`](../agents/prr-conductor.md) que aplica a skill [`production-readiness-review`](../skills/production-readiness-review/SKILL.md) — checklist canônico **6 axes** + **3 engagement models** + handoff dev→SRE.
|
|
17
|
+
|
|
18
|
+
**6 axes obrigatórios** (pular um = aprovação inválida):
|
|
19
|
+
1. System Architecture — design, dependencies, blast radius, isolation
|
|
20
|
+
2. Instrumentation/Metrics/Monitoring — 4 golden signals, SLOs, alerting
|
|
21
|
+
3. Emergency Response — runbooks, on-call, rollback, communication
|
|
22
|
+
4. Capacity Planning — load testing, scaling, headroom
|
|
23
|
+
5. Change Management — canary, feature flags, rollback < 60s
|
|
24
|
+
6. Performance — latency budgets, throughput, optimization
|
|
25
|
+
|
|
26
|
+
**Cria/Atualiza:**
|
|
27
|
+
- `.planning/prr/<service>.md` (Modo A) OR `.planning/prr/feature-<slug>.md` (Modo B) — PRR-REPORT.md scored
|
|
28
|
+
|
|
29
|
+
**Após:** o user tem decisão `Approved` / `Approved with conditions` / `Blocked` + lista canônica de P0 items por axe + reviewer signature. Phase 40 INT-FW-V2-02 integra `/concluir-marco` com gate PRR opcional.
|
|
30
|
+
</objective>
|
|
31
|
+
|
|
32
|
+
<context>
|
|
33
|
+
**Argumentos:** `$ARGUMENTS` — comando suporta **2 modos mutuamente exclusivos**.
|
|
34
|
+
|
|
35
|
+
**Modo A: `--service <name>` (audit de serviço existente)**
|
|
36
|
+
|
|
37
|
+
Para serviços já em production OU prestes a entrar — agent lê schema (Supabase MCP), Edge Functions code, SLOs definidos (`.planning/slos/`), advisors. Output: `.planning/prr/<service>.md`.
|
|
38
|
+
|
|
39
|
+
**Modo B: `--feature <description>` (audit pré-launch)**
|
|
40
|
+
|
|
41
|
+
Para feature em design/dev — agent lê design docs, SLOs propostos, código WIP. Output: `.planning/prr/feature-<slug>.md`.
|
|
42
|
+
|
|
43
|
+
**Engagement models (cap 32):**
|
|
44
|
+
- `simple` — outage cost < $1k/min OR internal tool — 4-8h, 1 sessão
|
|
45
|
+
- `early` — outage cost $1k-100k/min OR customer-facing — semanas, SRE no design
|
|
46
|
+
- `platform` — outage cost > $100k/min OR built on Frameworks/SRE Platform — PRR é confirmação
|
|
47
|
+
|
|
48
|
+
**Flags:**
|
|
49
|
+
- `--engagement <simple|early|platform>` — engagement model (default: AskUserQuestion baseado em outage cost)
|
|
50
|
+
- `--reviewer <@handle>` — handle do reviewer SRE (default: AskUserQuestion — **NUNCA pode ser team dev**, anti-pattern auto-PRR)
|
|
51
|
+
- `--outage-cost <usd>` — custo de outage por minuto (default: AskUserQuestion para escolher engagement)
|
|
52
|
+
- `--output <path>` — caminho do output (override de default canônico)
|
|
53
|
+
|
|
54
|
+
**Exemplos:**
|
|
55
|
+
```
|
|
56
|
+
/prr --service orders-api # Modo A — defaults
|
|
57
|
+
/prr --service orders-api --engagement early --reviewer @ops-lead # Modo A com config
|
|
58
|
+
/prr --feature "RAG sobre documentos privados" --reviewer @sre # Modo B
|
|
59
|
+
/prr --service edge-process-emails --engagement simple # Edge Function simples
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Pré-requisito (Full mode):** projeto Supabase configurado, `mcp__supabase__*` disponível. Modo offline funciona com fallback graceful (filesystem only — itens MCP-dependentes ficam `EVIDENCE_PENDING_MCP`).
|
|
63
|
+
</context>
|
|
64
|
+
|
|
65
|
+
<process>
|
|
66
|
+
|
|
67
|
+
## 1. Parsear argumentos (2 modos)
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
SERVICE=$(echo "$ARGUMENTS" | grep -oE -- '--service [^ ]+' | awk '{print $2}')
|
|
71
|
+
FEATURE=$(echo "$ARGUMENTS" | grep -oE -- '--feature "[^"]+"' | sed 's/--feature //; s/^"//; s/"$//')
|
|
72
|
+
ENGAGEMENT=$(echo "$ARGUMENTS" | grep -oE -- '--engagement [^ ]+' | awk '{print $2}')
|
|
73
|
+
REVIEWER=$(echo "$ARGUMENTS" | grep -oE -- '--reviewer [^ ]+' | awk '{print $2}')
|
|
74
|
+
OUTAGE_COST=$(echo "$ARGUMENTS" | grep -oE -- '--outage-cost [^ ]+' | awk '{print $2}')
|
|
75
|
+
OUTPUT_PATH=$(echo "$ARGUMENTS" | grep -oE -- '--output [^ ]+' | awk '{print $2}')
|
|
76
|
+
|
|
77
|
+
# PT-BR: validar mutuamente exclusivos
|
|
78
|
+
if [ -n "$SERVICE" ] && [ -n "$FEATURE" ]; then
|
|
79
|
+
echo "✗ Erro: --service e --feature são mutuamente exclusivos. Escolha um."
|
|
80
|
+
exit 1
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
# PT-BR: nenhum dos 2 → erro com sugestão
|
|
84
|
+
if [ -z "$SERVICE" ] && [ -z "$FEATURE" ]; then
|
|
85
|
+
echo "✗ Forneça --service <name> OU --feature \"<descrição>\""
|
|
86
|
+
echo " Exemplos:"
|
|
87
|
+
echo " /prr --service orders-api"
|
|
88
|
+
echo " /prr --feature \"RAG sobre documentos privados\""
|
|
89
|
+
exit 1
|
|
90
|
+
fi
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 2. Resolver output_path + idempotência
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
if [ -n "$SERVICE" ]; then
|
|
97
|
+
[ -z "$OUTPUT_PATH" ] && OUTPUT_PATH=".planning/prr/${SERVICE}.md"
|
|
98
|
+
else
|
|
99
|
+
SLUG=$(echo "$FEATURE" | tr ' ' '-' | tr -cd 'a-zA-Z0-9-' | head -c 30 | sed 's/-$//')
|
|
100
|
+
[ -z "$OUTPUT_PATH" ] && OUTPUT_PATH=".planning/prr/feature-${SLUG}.md"
|
|
101
|
+
fi
|
|
102
|
+
mkdir -p "$(dirname "$OUTPUT_PATH")"
|
|
103
|
+
|
|
104
|
+
# PT-BR: PRR pode ser re-PRR (após mudança grande) — informar mas permitir
|
|
105
|
+
if [ -f "$OUTPUT_PATH" ]; then
|
|
106
|
+
LAST_DATE=$(grep -m1 '**Date:**' "$OUTPUT_PATH" 2>/dev/null | sed 's/.*Date:\*\* //' || echo "?")
|
|
107
|
+
echo "ℹ PRR-REPORT.md anterior detectado ($LAST_DATE) em $OUTPUT_PATH."
|
|
108
|
+
echo " Re-PRR válido (após mudança grande, incident, ou anual). Continuando — vai sobrescrever."
|
|
109
|
+
fi
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## 3. Detectar `supabase/config.toml` (Full mode)
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
PROJECT_ID=""
|
|
116
|
+
if [ -f supabase/config.toml ]; then
|
|
117
|
+
PROJECT_ID=$(grep -E '^project_id\s*=' supabase/config.toml | sed 's/.*= *"\(.*\)".*/\1/' | head -1)
|
|
118
|
+
echo "✓ project_id detectado: $PROJECT_ID (Full mode com MCP Supabase)"
|
|
119
|
+
else
|
|
120
|
+
echo "ℹ Sem supabase/config.toml — agent pode rodar em modo offline (fallback graceful)"
|
|
121
|
+
fi
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 4. AskUserQuestion — engagement model + reviewer
|
|
125
|
+
|
|
126
|
+
Se `--engagement` não fornecido E `--outage-cost` ausente:
|
|
127
|
+
|
|
128
|
+
> **AskUserQuestion**
|
|
129
|
+
> header: "PRR Engagement Model"
|
|
130
|
+
> question: "Qual custo estimado de outage para este target?"
|
|
131
|
+
> options:
|
|
132
|
+
> - "< $1k/min OR internal tool → Simple PRR (4-8h, 1 sessão)"
|
|
133
|
+
> - "$1k-100k/min OR customer-facing → Early Engagement (semanas, SRE no design)"
|
|
134
|
+
> - "> $100k/min OR built on platform → Frameworks/Platform (PRR é confirmação)"
|
|
135
|
+
|
|
136
|
+
Se `--reviewer` não fornecido (anti-pattern auto-PRR):
|
|
137
|
+
|
|
138
|
+
> **AskUserQuestion**
|
|
139
|
+
> header: "PRR Reviewer (anti auto-PRR)"
|
|
140
|
+
> question: "Quem é o reviewer? Reviewer DEVE ser SRE OU par externo ao time dev (anti-pattern: time dev faz auto-PRR — confirmation bias)."
|
|
141
|
+
> options: (texto livre — handle/email)
|
|
142
|
+
|
|
143
|
+
## 5. Dispatch para `prr-conductor`
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
Task(
|
|
147
|
+
subagent_type="prr-conductor",
|
|
148
|
+
prompt="
|
|
149
|
+
${SERVICE:+service_name: ${SERVICE}}
|
|
150
|
+
${FEATURE:+feature_description: ${FEATURE}}
|
|
151
|
+
output_path: ${OUTPUT_PATH}
|
|
152
|
+
${ENGAGEMENT:+engagement_model: ${ENGAGEMENT}}
|
|
153
|
+
${REVIEWER:+reviewer: ${REVIEWER}}
|
|
154
|
+
${OUTAGE_COST:+outage_cost_per_min: ${OUTAGE_COST}}
|
|
155
|
+
${PROJECT_ID:+project_id: ${PROJECT_ID}}
|
|
156
|
+
|
|
157
|
+
Aplicar skill production-readiness-review. Audit em 6 axes (todos obrigatórios — pular = inválido):
|
|
158
|
+
1. System Architecture — design, dependencies, blast radius, isolation, single points of failure
|
|
159
|
+
2. Instrumentation/Metrics/Monitoring — 4 golden signals, SLOs definidos, alerting com burn rates
|
|
160
|
+
3. Emergency Response — runbooks atualizados, on-call rotation, rollback < 60s, communication plan
|
|
161
|
+
4. Capacity Planning — load testing recente, scaling docs, headroom % atual vs peak
|
|
162
|
+
5. Change Management — canary deployment, feature flags, rollback drills
|
|
163
|
+
6. Performance — latency p50/p95/p99 vs budget, throughput vs target, optimization headroom
|
|
164
|
+
|
|
165
|
+
Padrão obrigatório: cada item evidence-based (NÃO 'acreditamos que está pronto' — exigir query/log/runbook/test).
|
|
166
|
+
Modo offline: se MCP ausente, declarar [MODO OFFLINE] e marcar items MCP-dependentes EVIDENCE_PENDING_MCP.
|
|
167
|
+
Output: PRR-REPORT.md com scoring 0-5 por axe + status Pass/Pass with gaps/Fail + decisão Approved/Approved with conditions/Blocked + reviewer signature + Re-PRR triggers.
|
|
168
|
+
"
|
|
169
|
+
)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## 6. Pós-output
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
═══════════════════════════════════════════════════════════
|
|
176
|
+
framework ► PRR ▸ ${SERVICE:-feature-${SLUG}}
|
|
177
|
+
═══════════════════════════════════════════════════════════
|
|
178
|
+
|
|
179
|
+
[output do prr-conductor — ver Step 3 do agent]
|
|
180
|
+
|
|
181
|
+
## Estado salvo
|
|
182
|
+
${OUTPUT_PATH}
|
|
183
|
+
|
|
184
|
+
## Próximos passos
|
|
185
|
+
1. Reviewer (`${REVIEWER}`) precisa assinar — anti-pattern: rubber stamp sem ler evidence
|
|
186
|
+
2. P0 items são bloqueadores; P1 items são conditions; P2 items são monitoramento
|
|
187
|
+
3. Re-PRR triggers (anual, mudança arquitetural grande, incident SEV1+) — agendar
|
|
188
|
+
4. Se status `Approved` → liberar para production; se `Blocked` → fechar P0s antes de re-submit
|
|
189
|
+
5. Cross-ref OMM: PRR alimenta Capacidade 4 (Production Readiness) — `/observabilidade omm`
|
|
190
|
+
6. Phase 40 INT-FW-V2-02: `/concluir-marco` pode exigir PRR `Approved` se `workflow.complete_milestone_prr_gate=true`
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
</process>
|
|
194
|
+
|
|
195
|
+
<success_criteria>
|
|
196
|
+
- [ ] `--service <name>` E `--feature "<desc>"` parseados (mutuamente exclusivos)
|
|
197
|
+
- [ ] Modo A: output canônico `.planning/prr/<service>.md` (override via `--output`)
|
|
198
|
+
- [ ] Modo B: output canônico `.planning/prr/feature-<slug>.md` (slug auto-gerado)
|
|
199
|
+
- [ ] Re-PRR não-bloqueante (informa mas permite — re-PRR é válido após mudança grande)
|
|
200
|
+
- [ ] `supabase/config.toml` detectado para passar `project_id` (Full mode)
|
|
201
|
+
- [ ] AskUserQuestion para engagement model (se ausente) E reviewer (se ausente — anti auto-PRR)
|
|
202
|
+
- [ ] `prr-conductor` invocado via `Task(subagent_type=...)` com prompt completo (6 axes literalmente + modo offline)
|
|
203
|
+
- [ ] Output forwarded transparentemente do agent
|
|
204
|
+
- [ ] Próximos passos sugerem cross-ref para `/observabilidade omm`, `/concluir-marco`, P0/P1/P2 priorização
|
|
205
|
+
</success_criteria>
|