@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,151 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: observability-coverage
|
|
3
|
+
stage: pre-milestone-close
|
|
4
|
+
blocking: false
|
|
5
|
+
description: Valida que ≥ X% das Edge Functions têm 4 golden signals + SLO + burn alert + characterization. Default threshold 70%. Opt-in via workflow.observability_coverage_threshold.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Observability coverage gate (cross-suite)
|
|
9
|
+
|
|
10
|
+
**When to run:** pre-milestone-close (consultive default; blocking se `workflow.observability_coverage_threshold > 0`).
|
|
11
|
+
|
|
12
|
+
**Skills canônicas:** [`four-golden-signals`](../kit/skills/four-golden-signals/SKILL.md), [`event-based-slos`](../kit/skills/event-based-slos/SKILL.md), [`burn-rate-alerting`](../kit/skills/burn-rate-alerting/SKILL.md), [`legacy-characterization-tests`](../kit/skills/legacy-characterization-tests/SKILL.md)
|
|
13
|
+
|
|
14
|
+
**Agent invocado:** [`observability-coverage-auditor`](../kit/agents/observability-coverage-auditor.md)
|
|
15
|
+
|
|
16
|
+
## Check
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
#!/usr/bin/env bash
|
|
20
|
+
# PT-BR: validar cobertura cross-suite de Edge Functions
|
|
21
|
+
set -e
|
|
22
|
+
|
|
23
|
+
# threshold do gate
|
|
24
|
+
THRESHOLD=70
|
|
25
|
+
if [ -f ".planning/config.json" ] && command -v jq >/dev/null; then
|
|
26
|
+
CFG=$(jq -r '.workflow.observability_coverage_threshold // empty' .planning/config.json 2>/dev/null)
|
|
27
|
+
[ -n "$CFG" ] && [ "$CFG" != "null" ] && THRESHOLD=$CFG
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# se threshold = 0, gate skip (opt-in)
|
|
31
|
+
if [ "$THRESHOLD" -eq 0 ]; then
|
|
32
|
+
echo "INFO: workflow.observability_coverage_threshold=0 — gate skip (opt-in não habilitado)."
|
|
33
|
+
exit 0
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# enumerar Edge Functions
|
|
37
|
+
NUM_EDGE_FNS=$(find supabase/functions -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l)
|
|
38
|
+
if [ "$NUM_EDGE_FNS" -eq 0 ]; then
|
|
39
|
+
echo "INFO: nenhuma Edge Function detectada — gate skip."
|
|
40
|
+
exit 0
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# contar Edge Functions cobertas em cada dimensão
|
|
44
|
+
COVERED_SIGNALS=0
|
|
45
|
+
COVERED_SLO=0
|
|
46
|
+
COVERED_BURN=0
|
|
47
|
+
COVERED_CHAR=0
|
|
48
|
+
|
|
49
|
+
for fn_dir in $(find supabase/functions -mindepth 1 -maxdepth 1 -type d 2>/dev/null); do
|
|
50
|
+
FN_NAME=$(basename "$fn_dir")
|
|
51
|
+
FN_FILE="$fn_dir/index.ts"
|
|
52
|
+
[ ! -f "$FN_FILE" ] && continue
|
|
53
|
+
|
|
54
|
+
# 4 golden signals
|
|
55
|
+
HAS_LATENCY=$(grep -qE "createHistogram|histogram.*ms|latency_histogram" "$FN_FILE" && echo true || echo false)
|
|
56
|
+
HAS_TRAFFIC=$(grep -qE "createCounter.*requests|http_requests_total|trafficCounter" "$FN_FILE" && echo true || echo false)
|
|
57
|
+
HAS_ERRORS=$(grep -qE "createCounter.*errors|http_errors_total|error_type" "$FN_FILE" && echo true || echo false)
|
|
58
|
+
HAS_SAT=$(grep -qE "createObservableGauge|connection_pool|queue_depth" "$FN_FILE" && echo true || echo false)
|
|
59
|
+
if [ "$HAS_LATENCY" = "true" ] && [ "$HAS_TRAFFIC" = "true" ] && [ "$HAS_ERRORS" = "true" ] && [ "$HAS_SAT" = "true" ]; then
|
|
60
|
+
COVERED_SIGNALS=$((COVERED_SIGNALS + 1))
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
# SLO
|
|
64
|
+
if [ -f ".planning/slos/$FN_NAME.md" ] || ([ -f ".planning/SLO.md" ] && grep -q "$FN_NAME" ".planning/SLO.md"); then
|
|
65
|
+
COVERED_SLO=$((COVERED_SLO + 1))
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
# Burn alert
|
|
69
|
+
if grep -rq "$FN_NAME" .planning/burn-rate-alerts.md .planning/SLO.md 2>/dev/null; then
|
|
70
|
+
COVERED_BURN=$((COVERED_BURN + 1))
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
# Characterization
|
|
74
|
+
for chardir in tests/characterization test/characterization __tests__/characterization; do
|
|
75
|
+
if find "$chardir" -path "*$FN_NAME*" 2>/dev/null | head -1 | grep -q .; then
|
|
76
|
+
COVERED_CHAR=$((COVERED_CHAR + 1))
|
|
77
|
+
break
|
|
78
|
+
fi
|
|
79
|
+
done
|
|
80
|
+
done
|
|
81
|
+
|
|
82
|
+
# computar percentages
|
|
83
|
+
PCT_SIGNALS=$((COVERED_SIGNALS * 100 / NUM_EDGE_FNS))
|
|
84
|
+
PCT_SLO=$((COVERED_SLO * 100 / NUM_EDGE_FNS))
|
|
85
|
+
PCT_BURN=$((COVERED_BURN * 100 / NUM_EDGE_FNS))
|
|
86
|
+
PCT_CHAR=$((COVERED_CHAR * 100 / NUM_EDGE_FNS))
|
|
87
|
+
|
|
88
|
+
# avg
|
|
89
|
+
PCT_AVG=$(( (PCT_SIGNALS + PCT_SLO + PCT_BURN + PCT_CHAR) / 4 ))
|
|
90
|
+
|
|
91
|
+
echo ""
|
|
92
|
+
echo "observability-coverage gate — threshold: ${THRESHOLD}%"
|
|
93
|
+
echo ""
|
|
94
|
+
echo " 4 Golden Signals: ${COVERED_SIGNALS}/${NUM_EDGE_FNS} (${PCT_SIGNALS}%)"
|
|
95
|
+
echo " SLO definido: ${COVERED_SLO}/${NUM_EDGE_FNS} (${PCT_SLO}%)"
|
|
96
|
+
echo " Burn rate alert: ${COVERED_BURN}/${NUM_EDGE_FNS} (${PCT_BURN}%)"
|
|
97
|
+
echo " Characterization tests: ${COVERED_CHAR}/${NUM_EDGE_FNS} (${PCT_CHAR}%)"
|
|
98
|
+
echo ""
|
|
99
|
+
echo " Avg coverage: ${PCT_AVG}%"
|
|
100
|
+
echo ""
|
|
101
|
+
|
|
102
|
+
# decisão
|
|
103
|
+
if [ "$PCT_AVG" -ge "$THRESHOLD" ]; then
|
|
104
|
+
echo "✓ Avg ≥ threshold (${PCT_AVG}% ≥ ${THRESHOLD}%). Gate aprovado."
|
|
105
|
+
exit 0
|
|
106
|
+
fi
|
|
107
|
+
|
|
108
|
+
echo "⚠ Avg < threshold (${PCT_AVG}% < ${THRESHOLD}%)."
|
|
109
|
+
echo ""
|
|
110
|
+
echo "Próximas ações:"
|
|
111
|
+
echo " /auditar-observabilidade-cobertura (vê detalhes + top 5 críticas)"
|
|
112
|
+
echo " /golden-signals <fn> (instrumentar 4 signals)"
|
|
113
|
+
echo " /definir-slo <fn> (define SLO event-based)"
|
|
114
|
+
echo " /caracterizar <fn> (characterization tests)"
|
|
115
|
+
echo ""
|
|
116
|
+
|
|
117
|
+
# blocking se threshold > 0 e não atingido
|
|
118
|
+
if [ "$THRESHOLD" -gt 0 ]; then
|
|
119
|
+
exit 1
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
exit 0
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Configuração
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"workflow": {
|
|
130
|
+
"observability_coverage_threshold": 70
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Default:** `0` (skip — opt-in). Recomendação:
|
|
136
|
+
- Projetos < 6 meses: 50 (consultive)
|
|
137
|
+
- Projetos 6-12 meses: 70
|
|
138
|
+
- Projetos > 12 meses ou tier-1 production: 80+
|
|
139
|
+
|
|
140
|
+
## Quando NÃO rodar
|
|
141
|
+
|
|
142
|
+
- Projeto sem Edge Functions (puro frontend/backend stateless)
|
|
143
|
+
- Projeto recém-criado (< 1 mês) — distribuição de Edge Functions ainda imatura
|
|
144
|
+
- Greenfield onde Edge Functions estão sendo escritas em paralelo a milestones
|
|
145
|
+
|
|
146
|
+
## Ver também
|
|
147
|
+
|
|
148
|
+
- [`observability-coverage-auditor`](../kit/agents/observability-coverage-auditor.md) — agent canônico
|
|
149
|
+
- [`/auditar-observabilidade-cobertura`](../kit/commands/auditar-observabilidade-cobertura.md) — comando dedicado
|
|
150
|
+
- [`omm-no-regression`](./omm-no-regression.md) — gate análogo da Suíte Observabilidade
|
|
151
|
+
- [`golden-signals-coverage`](./golden-signals-coverage.md) — gate específico apenas para golden signals
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: postmortem-template-required
|
|
3
|
+
stage: pre-conclude
|
|
4
|
+
blocking: true
|
|
5
|
+
description: Bloqueia /concluir-marco se há investigação em .planning/investigations/ sem postmortem correspondente em .planning/postmortems/. "No postmortem left unreviewed" (cap 15).
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Postmortem template required gate
|
|
9
|
+
|
|
10
|
+
**When to run:** pre-conclude (blocking — milestone NÃO arquiva até cada incident ter postmortem blameless).
|
|
11
|
+
|
|
12
|
+
## Check
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
#!/usr/bin/env bash
|
|
16
|
+
# PT-BR: validar que cada investigação em .planning/investigations/ tem postmortem em .planning/postmortems/.
|
|
17
|
+
# Match por basename (sem extensão .md). Investigations com Status: INCONCLUSIVE são exceção.
|
|
18
|
+
# Bash 3.2-portable (macOS default).
|
|
19
|
+
set -e
|
|
20
|
+
|
|
21
|
+
INV_DIR=".planning/investigations"
|
|
22
|
+
PM_DIR=".planning/postmortems"
|
|
23
|
+
|
|
24
|
+
# PT-BR: se não há investigations, gate passa com INFO
|
|
25
|
+
if [ ! -d "$INV_DIR" ]; then
|
|
26
|
+
echo "INFO: $INV_DIR não existe — projeto sem incidents registrados. Gate skipped."
|
|
27
|
+
exit 0
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# PT-BR: listar investigations (single-file *.md OR subdir com STATE.md)
|
|
31
|
+
INVESTIGATIONS=""
|
|
32
|
+
|
|
33
|
+
# PT-BR: pattern A — .planning/investigations/<id>.md (single file)
|
|
34
|
+
SINGLE_FILES=$(find "$INV_DIR" -maxdepth 1 -type f -name "*.md" 2>/dev/null || true)
|
|
35
|
+
if [ -n "$SINGLE_FILES" ]; then
|
|
36
|
+
INVESTIGATIONS="$INVESTIGATIONS
|
|
37
|
+
$SINGLE_FILES"
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
# PT-BR: pattern B — .planning/investigations/<id>/STATE.md (subdir state)
|
|
41
|
+
SUBDIR_STATES=$(find "$INV_DIR" -mindepth 2 -maxdepth 2 -type f -name "STATE.md" 2>/dev/null || true)
|
|
42
|
+
if [ -n "$SUBDIR_STATES" ]; then
|
|
43
|
+
INVESTIGATIONS="$INVESTIGATIONS
|
|
44
|
+
$SUBDIR_STATES"
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
# PT-BR: filtrar linhas vazias
|
|
48
|
+
INVESTIGATIONS=$(echo "$INVESTIGATIONS" | grep -v "^$" || true)
|
|
49
|
+
|
|
50
|
+
if [ -z "$INVESTIGATIONS" ]; then
|
|
51
|
+
echo "INFO: $INV_DIR vazio — sem incidents registrados. Gate skipped."
|
|
52
|
+
exit 0
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
# PT-BR: para cada investigation, extrair <id> e checar postmortem correspondente
|
|
56
|
+
MISSING=0
|
|
57
|
+
MISSING_LIST=""
|
|
58
|
+
OLDIFS="$IFS"
|
|
59
|
+
IFS='
|
|
60
|
+
'
|
|
61
|
+
for inv_path in $INVESTIGATIONS; do
|
|
62
|
+
[ -z "$inv_path" ] && continue
|
|
63
|
+
[ ! -f "$inv_path" ] && continue
|
|
64
|
+
|
|
65
|
+
# PT-BR: extrair <id> — basename sem .md OU dirname se for STATE.md em subdir
|
|
66
|
+
base=$(basename "$inv_path")
|
|
67
|
+
if [ "$base" = "STATE.md" ]; then
|
|
68
|
+
# pattern B — id é o nome do subdir parent
|
|
69
|
+
id=$(basename "$(dirname "$inv_path")")
|
|
70
|
+
else
|
|
71
|
+
# pattern A — id é basename sem .md
|
|
72
|
+
id="${base%.md}"
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
# PT-BR: se investigation tem Status: INCONCLUSIVE (sem root cause), pular
|
|
76
|
+
if grep -qiE "^Status:.*INCONCLUSIVE|^.*Status.*INCONCLUSIVE" "$inv_path" 2>/dev/null; then
|
|
77
|
+
echo "INFO: investigation '$id' marcada INCONCLUSIVE — sem root cause, postmortem não exigido."
|
|
78
|
+
continue
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
# PT-BR: postmortem esperado em .planning/postmortems/<id>.md
|
|
82
|
+
pm_path="$PM_DIR/$id.md"
|
|
83
|
+
if [ ! -f "$pm_path" ]; then
|
|
84
|
+
MISSING=$((MISSING + 1))
|
|
85
|
+
MISSING_LIST="$MISSING_LIST $id"
|
|
86
|
+
fi
|
|
87
|
+
done
|
|
88
|
+
IFS="$OLDIFS"
|
|
89
|
+
|
|
90
|
+
if [ "$MISSING" -eq 0 ]; then
|
|
91
|
+
echo "PASS: todas as investigações têm postmortem correspondente em $PM_DIR/"
|
|
92
|
+
exit 0
|
|
93
|
+
else
|
|
94
|
+
echo "FAIL: $MISSING investigação(ões) sem postmortem em $PM_DIR/:$MISSING_LIST"
|
|
95
|
+
echo "Sugestão: rodar /postmortem --from-investigation <id> para cada item ausente."
|
|
96
|
+
echo "Cross-ref: kit/skills/blameless-postmortems/SKILL.md + kit/agents/postmortem-writer.md"
|
|
97
|
+
echo "Princípio canônico: 'No postmortem left unreviewed' (cap 15 livro Google SRE)."
|
|
98
|
+
exit 1
|
|
99
|
+
fi
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Verdict
|
|
103
|
+
|
|
104
|
+
- **passed** — todas investigations têm postmortem correspondente OR investigations marcadas INCONCLUSIVE OR diretório `.planning/investigations/` ausente
|
|
105
|
+
- **block** — pelo menos 1 investigation sem postmortem em `.planning/postmortems/`
|
|
106
|
+
|
|
107
|
+
## Why
|
|
108
|
+
|
|
109
|
+
O livro Google SRE (cap 15 — *Postmortem Culture: Learning from Failure*) define como princípio canônico **"no postmortem left unreviewed"**: cada incident significativo (registrado como investigação via `/forense` + `incident-investigator` v1.9) deve gerar postmortem blameless documentando *o que aprendemos* e *o que mudaremos*.
|
|
110
|
+
|
|
111
|
+
Sem este gate, milestones arquivam com investigations órfãs — root cause foi diagnosticado mas aprendizado organizacional perdeu-se (anti-pattern hero culture: "fixei o bug, vamos seguir"). Gate força a chain canônica entre v1.9 (Core Analysis Loop diagnostica) e v1.10 (postmortem documenta).
|
|
112
|
+
|
|
113
|
+
Cross-ref agent canônico: [`postmortem-writer`](../kit/agents/postmortem-writer.md) (Phase 37 / AGCORE-SRE-03). Skill: [`blameless-postmortems`](../kit/skills/blameless-postmortems/SKILL.md) (Phase 36 / SKFD-SRE-04). Comando: `/postmortem --from-investigation <id>` (Phase 38 / CMD-SRE-03). Chain documentado em `kit/commands/forense.md` bloco `<sre_integration>` (Plan 40-01 / INT-FW-V2-01).
|
|
114
|
+
|
|
115
|
+
## REQ
|
|
116
|
+
|
|
117
|
+
QA-SRE-02.
|
|
118
|
+
|
|
119
|
+
## Configuração
|
|
120
|
+
|
|
121
|
+
Gate é **blocking** por default (cultura SRE blameless é não-negociável uma vez instituída). Para tornar warn-only durante adoption inicial:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
node ./.claude/framework/bin/tools.cjs config-set workflow.postmortem_required_warn true
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
(Nota: implementação do toggle warn-only é deferida — gate atual lê apenas presença/ausência de pares investigation↔postmortem, não consulta config.)
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: prr-checklist-coverage
|
|
3
|
+
stage: pre-verify
|
|
4
|
+
blocking: true
|
|
5
|
+
description: Valida que cada PRR-REPORT.md em .planning/prr/ cobre os 6 axes canonicos (System Architecture/Instrumentation/Emergency/Capacity/Change/Performance — cap 32 livro Google SRE).
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# PRR checklist coverage gate
|
|
9
|
+
|
|
10
|
+
**When to run:** pre-verify (blocking — PRR sem 6 axes = aprovação inválida).
|
|
11
|
+
|
|
12
|
+
## Check
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
#!/usr/bin/env bash
|
|
16
|
+
# PT-BR: validar que cada PRR-REPORT.md em .planning/prr/**/*.md cobre os 6 axes do PRR.
|
|
17
|
+
# Match por palavra-chave em heading H2 (case-insensitive). Pular um axe = aprovação inválida.
|
|
18
|
+
# Bash 3.2-portable (macOS default).
|
|
19
|
+
set -e
|
|
20
|
+
|
|
21
|
+
PRR_DIR=".planning/prr"
|
|
22
|
+
|
|
23
|
+
# PT-BR: se não há PRR reports, gate passa com INFO
|
|
24
|
+
if [ ! -d "$PRR_DIR" ]; then
|
|
25
|
+
echo "INFO: $PRR_DIR não existe — projeto sem PRR reports. Gate skipped."
|
|
26
|
+
exit 0
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# PT-BR: listar todos os *.md em .planning/prr/ recursivamente
|
|
30
|
+
PRR_FILES=$(find "$PRR_DIR" -type f -name "*.md" 2>/dev/null || true)
|
|
31
|
+
PRR_FILES=$(echo "$PRR_FILES" | grep -v "^$" || true)
|
|
32
|
+
|
|
33
|
+
if [ -z "$PRR_FILES" ]; then
|
|
34
|
+
echo "INFO: $PRR_DIR vazio — sem PRR reports. Gate skipped."
|
|
35
|
+
exit 0
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# PT-BR: para cada PRR report, validar que cobre os 6 axes
|
|
39
|
+
VIOLATIONS=0
|
|
40
|
+
OLDIFS="$IFS"
|
|
41
|
+
IFS='
|
|
42
|
+
'
|
|
43
|
+
for prr_file in $PRR_FILES; do
|
|
44
|
+
[ -z "$prr_file" ] && continue
|
|
45
|
+
[ ! -f "$prr_file" ] && continue
|
|
46
|
+
|
|
47
|
+
# PT-BR: extrair headings H2 (case-insensitive)
|
|
48
|
+
H2=$(grep -E "^## " "$prr_file" 2>/dev/null || true)
|
|
49
|
+
|
|
50
|
+
# PT-BR: 6 axes — match em palavras-chave (qualquer variante aceitável)
|
|
51
|
+
AXE_MISSING=""
|
|
52
|
+
|
|
53
|
+
# Axe 1: System Architecture
|
|
54
|
+
if ! echo "$H2" | grep -qiE "system.*architecture|architecture"; then
|
|
55
|
+
AXE_MISSING="$AXE_MISSING Axe1(SystemArchitecture)"
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
# Axe 2: Instrumentation / Metrics / Monitoring
|
|
59
|
+
if ! echo "$H2" | grep -qiE "instrumentation|metrics|monitoring"; then
|
|
60
|
+
AXE_MISSING="$AXE_MISSING Axe2(Instrumentation)"
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
# Axe 3: Emergency Response
|
|
64
|
+
if ! echo "$H2" | grep -qiE "emergency.*response|emergency"; then
|
|
65
|
+
AXE_MISSING="$AXE_MISSING Axe3(EmergencyResponse)"
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
# Axe 4: Capacity Planning
|
|
69
|
+
if ! echo "$H2" | grep -qiE "capacity.*planning|capacity"; then
|
|
70
|
+
AXE_MISSING="$AXE_MISSING Axe4(CapacityPlanning)"
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
# Axe 5: Change Management
|
|
74
|
+
if ! echo "$H2" | grep -qiE "change.*management|change"; then
|
|
75
|
+
AXE_MISSING="$AXE_MISSING Axe5(ChangeManagement)"
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
# Axe 6: Performance
|
|
79
|
+
if ! echo "$H2" | grep -qiE "performance"; then
|
|
80
|
+
AXE_MISSING="$AXE_MISSING Axe6(Performance)"
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
if [ -n "$AXE_MISSING" ]; then
|
|
84
|
+
echo "FAIL: $prr_file — axes ausentes:$AXE_MISSING"
|
|
85
|
+
VIOLATIONS=$((VIOLATIONS + 1))
|
|
86
|
+
fi
|
|
87
|
+
done
|
|
88
|
+
IFS="$OLDIFS"
|
|
89
|
+
|
|
90
|
+
if [ "$VIOLATIONS" -eq 0 ]; then
|
|
91
|
+
total=$(echo "$PRR_FILES" | wc -l | tr -d ' ')
|
|
92
|
+
echo "PASS: $total PRR-REPORT(s) cobrem os 6 axes canônicos"
|
|
93
|
+
exit 0
|
|
94
|
+
else
|
|
95
|
+
echo "FAIL: $VIOLATIONS PRR-REPORT(s) com axes ausentes"
|
|
96
|
+
echo "Sugestão: rodar /sre prr <service> ou /prr para regenerar com template canônico (6 axes obrigatórios)."
|
|
97
|
+
echo "Cross-ref: kit/skills/production-readiness-review/SKILL.md + kit/agents/prr-conductor.md"
|
|
98
|
+
echo "Princípio canônico: 'Pular um axe = aprovação inválida' (cap 32 livro Google SRE)."
|
|
99
|
+
exit 1
|
|
100
|
+
fi
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Verdict
|
|
104
|
+
|
|
105
|
+
- **passed** — cada PRR-REPORT.md em `.planning/prr/**/*.md` tem H2 cobrindo os 6 axes (System Architecture / Instrumentation / Emergency Response / Capacity Planning / Change Management / Performance) OR diretório `.planning/prr/` ausente
|
|
106
|
+
- **block** — pelo menos 1 PRR-REPORT.md com axe(s) ausente(s)
|
|
107
|
+
|
|
108
|
+
## Why
|
|
109
|
+
|
|
110
|
+
O livro Google SRE (cap 32 — *Evolving SRE Engagement Model*) define **6 axes canônicos** do Production Readiness Review. A skill `production-readiness-review` (Phase 36 / SKFD-SRE-05) declara como regra absoluta: *"Pular um axe = aprovação inválida (lacuna oculta vira incident em 6 meses)"*.
|
|
111
|
+
|
|
112
|
+
Sem este gate, PRRs apressados podem omitir axes "menos relevantes" (anti-pattern documentado na skill); gaps em Change Management ou Capacity Planning não detectados em PRR viram incidents em produção meses depois. Gate força padrão canônico — cada `PRR-REPORT.md` cobrindo os 6 axes integralmente, mesmo que items dentro de um axe sejam N/A para o serviço (justificativa explícita no item, não no axe).
|
|
113
|
+
|
|
114
|
+
Cross-ref agent canônico: [`prr-conductor`](../kit/agents/prr-conductor.md) (Phase 37 / AGCORE-SRE-04). Skill: [`production-readiness-review`](../kit/skills/production-readiness-review/SKILL.md) (Phase 36 / SKFD-SRE-05). Comando: `/prr --service <name>` ou `/prr --feature <description>` (Phase 38 / CMD-SRE-04).
|
|
115
|
+
|
|
116
|
+
## REQ
|
|
117
|
+
|
|
118
|
+
QA-SRE-03.
|
|
119
|
+
|
|
120
|
+
## Configuração
|
|
121
|
+
|
|
122
|
+
Gate é **blocking** por default. Para tornar warn-only durante adoption inicial:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
node ./.claude/framework/bin/tools.cjs config-set workflow.prr_checklist_coverage_warn true
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
(Nota: implementação do toggle warn-only é deferida — gate atual não consulta config.)
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: release-pipeline-policy
|
|
3
|
+
stage: pre-milestone-close
|
|
4
|
+
blocking: false
|
|
5
|
+
description: Valida release pipeline scored ≥ X/30 (default 20 = ADEQUATE) em hermeticidade + reprodutibilidade + policy enforcement. Opt-in via workflow.complete_milestone_release_pipeline_gate. Cap 8 livro Google SRE.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Release pipeline policy gate
|
|
9
|
+
|
|
10
|
+
**When to run:** pre-milestone-close (consultive default; blocking se `workflow.complete_milestone_release_pipeline_gate=true`).
|
|
11
|
+
|
|
12
|
+
**Skill canônica:** [`release-engineering`](../kit/skills/release-engineering/SKILL.md) + [`hermetic-builds`](../kit/skills/hermetic-builds/SKILL.md)
|
|
13
|
+
|
|
14
|
+
**Agent invocado:** [`release-pipeline-auditor`](../kit/agents/release-pipeline-auditor.md)
|
|
15
|
+
|
|
16
|
+
## Check
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
#!/usr/bin/env bash
|
|
20
|
+
# PT-BR: validar release pipeline scored >= threshold
|
|
21
|
+
set -e
|
|
22
|
+
|
|
23
|
+
# threshold do gate
|
|
24
|
+
THRESHOLD=20 # default: ADEQUATE
|
|
25
|
+
GATE_BLOCKING=false
|
|
26
|
+
|
|
27
|
+
if [ -f ".planning/config.json" ] && command -v jq >/dev/null; then
|
|
28
|
+
CFG=$(jq -r '.workflow.complete_milestone_release_pipeline_gate // empty' .planning/config.json 2>/dev/null)
|
|
29
|
+
if [ "$CFG" = "true" ]; then
|
|
30
|
+
GATE_BLOCKING=true
|
|
31
|
+
fi
|
|
32
|
+
CFG_THRESH=$(jq -r '.workflow.release_pipeline_threshold // empty' .planning/config.json 2>/dev/null)
|
|
33
|
+
[ -n "$CFG_THRESH" ] && [ "$CFG_THRESH" != "null" ] && THRESHOLD=$CFG_THRESH
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# se não opt-in, gate skip
|
|
37
|
+
if [ "$GATE_BLOCKING" = false ] && [ -z "$RELEASE_PIPELINE_POLICY_FORCE" ]; then
|
|
38
|
+
echo "INFO: release-pipeline-policy gate is opt-in (workflow.complete_milestone_release_pipeline_gate=false). Skip."
|
|
39
|
+
exit 0
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# ler RELEASE-AUDIT.md OR delegar via Task se ausente/stale
|
|
43
|
+
AUDIT_FILE=".planning/RELEASE-AUDIT.md"
|
|
44
|
+
SCORE=""
|
|
45
|
+
|
|
46
|
+
if [ -f "$AUDIT_FILE" ]; then
|
|
47
|
+
# check se fresh (≤ 30 dias)
|
|
48
|
+
if [ "$(uname)" = "Darwin" ]; then
|
|
49
|
+
AUDIT_DATE=$(stat -f %m "$AUDIT_FILE")
|
|
50
|
+
else
|
|
51
|
+
AUDIT_DATE=$(stat -c %Y "$AUDIT_FILE")
|
|
52
|
+
fi
|
|
53
|
+
AGE_DAYS=$(( ($(date +%s) - AUDIT_DATE) / 86400 ))
|
|
54
|
+
|
|
55
|
+
if [ "$AGE_DAYS" -gt 30 ]; then
|
|
56
|
+
echo "⚠ RELEASE-AUDIT.md stale (${AGE_DAYS}d). Re-rodar /auditar-release antes de close."
|
|
57
|
+
[ "$GATE_BLOCKING" = true ] && exit 1
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# parse score
|
|
61
|
+
SCORE=$(grep -oE "Score:\*\*\s*[0-9]+/30" "$AUDIT_FILE" | grep -oE "[0-9]+" | head -1)
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
if [ -z "$SCORE" ]; then
|
|
65
|
+
echo "⚠ RELEASE-AUDIT.md ausente OR sem score parseável."
|
|
66
|
+
echo "Rode: /auditar-release (gera relatório fresh)"
|
|
67
|
+
[ "$GATE_BLOCKING" = true ] && exit 1
|
|
68
|
+
exit 0
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
echo ""
|
|
72
|
+
echo "release-pipeline-policy gate — threshold: ${THRESHOLD}/30"
|
|
73
|
+
echo " RELEASE-AUDIT.md score: ${SCORE}/30"
|
|
74
|
+
echo ""
|
|
75
|
+
|
|
76
|
+
# decisão
|
|
77
|
+
if [ "$SCORE" -ge "$THRESHOLD" ]; then
|
|
78
|
+
if [ "$SCORE" -ge 25 ]; then
|
|
79
|
+
echo "✓ ROBUST (≥ 25/30) — milestone arquivável."
|
|
80
|
+
else
|
|
81
|
+
echo "✓ ADEQUATE (20-24) — milestone arquivável com warnings."
|
|
82
|
+
fi
|
|
83
|
+
exit 0
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
if [ "$SCORE" -lt 15 ]; then
|
|
87
|
+
echo "✗ BROKEN (< 15/30) — pipeline não pode ser fonte de verdade. ESCALAR."
|
|
88
|
+
elif [ "$SCORE" -lt 20 ]; then
|
|
89
|
+
echo "✗ FRAGILE (15-19/30) — gaps significativos."
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
echo ""
|
|
93
|
+
echo "Próximas ações:"
|
|
94
|
+
echo " 1. Aplicar top 5 fixes do RELEASE-AUDIT.md"
|
|
95
|
+
echo " 2. Re-rodar /auditar-release"
|
|
96
|
+
echo " 3. Re-tentar /concluir-marco após score >= ${THRESHOLD}"
|
|
97
|
+
echo ""
|
|
98
|
+
|
|
99
|
+
[ "$GATE_BLOCKING" = true ] && exit 1
|
|
100
|
+
exit 0
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Configuração
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"workflow": {
|
|
108
|
+
"complete_milestone_release_pipeline_gate": false,
|
|
109
|
+
"release_pipeline_threshold": 20
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Default:** `complete_milestone_release_pipeline_gate=false` (opt-in). Threshold 20 = ADEQUATE; promove para 25 (ROBUST) em projetos tier-1.
|
|
115
|
+
|
|
116
|
+
## Quando NÃO rodar
|
|
117
|
+
|
|
118
|
+
- Projeto < 6 meses (pipeline ainda imatura)
|
|
119
|
+
- Releases manuais (sem CI/CD complexo)
|
|
120
|
+
- Solo dev side project
|
|
121
|
+
- Projeto puramente experimental
|
|
122
|
+
|
|
123
|
+
## Ver também
|
|
124
|
+
|
|
125
|
+
- [`release-pipeline-auditor`](../kit/agents/release-pipeline-auditor.md) — agent canônico
|
|
126
|
+
- [`/auditar-release`](../kit/commands/auditar-release.md) — comando dedicado
|
|
127
|
+
- [`hermetic-builds`](../kit/skills/hermetic-builds/SKILL.md)
|
|
128
|
+
- [`release-engineering`](../kit/skills/release-engineering/SKILL.md)
|
|
129
|
+
- [`prr-checklist-coverage`](./prr-checklist-coverage.md) — gate análogo PRR (v1.10)
|
|
130
|
+
- [`legacy-refactor-safety`](./legacy-refactor-safety.md) — gate análogo Legacy (v1.12)
|
|
131
|
+
|
|
132
|
+
*Material-fonte: cap 8 livro Google SRE.*
|
package/kit/COMANDOS.md
CHANGED
|
@@ -112,6 +112,21 @@
|
|
|
112
112
|
| `/definir-perfil` | Altera o perfil de modelo para os agentes framework (quality/balanced/budget/inherit) |
|
|
113
113
|
| `/configuracoes` | Configura os toggles de workflow framework e perfil de modelo |
|
|
114
114
|
|
|
115
|
+
## Suíte Legacy Code (Feathers + modernizações IA/Supabase 2026)
|
|
116
|
+
|
|
117
|
+
| Comando | O que faz |
|
|
118
|
+
|---------|-----------|
|
|
119
|
+
| `/legacy <subcomando>` | Orquestrador único — dispatch para agents da suíte (10 subcomandos com sinônimos PT/EN) |
|
|
120
|
+
| `/caracterizar` | Gera characterization tests (cap 13) — golden snapshots cobrindo 7 grupos de equivalência |
|
|
121
|
+
| `/encontrar-seams` | Identifica seams (cap 25) e recomenda técnica de dependency-breaking |
|
|
122
|
+
| `/auditar-refactor` | Gate canônico — coleta evidências e retorna veredito GO/BLOCK/WARN/GO-OVERRIDE |
|
|
123
|
+
| `/refactor-seguro` | Chain canônico — seams → caracterizar → auditar → executar; modos full/sprout/safe-extract/override |
|
|
124
|
+
| `/capturar-payloads` | Instrumenta Edge Function Supabase para captura de payloads reais via mcp__supabase__get_logs (modernização) |
|
|
125
|
+
| `/caracterizar-prompt` | Characterization de prompts/tools LLM com temperature=0 + seed fixo (modernização IA) |
|
|
126
|
+
| `/storytelling` | IA gera mental model + naked CRC + extract candidates (cap 16-17 + modernização IA) |
|
|
127
|
+
| `/detectar-duplicacao` | Shotgun surgery cross-codebase via embeddings + jscpd (cap 21 + modernização IA) |
|
|
128
|
+
| `/auditar-observabilidade-cobertura` | Audit X/N Edge Functions com signals + SLO + burn alert + char (cross-suite) |
|
|
129
|
+
|
|
115
130
|
## Utilitários
|
|
116
131
|
|
|
117
132
|
| Comando | O que faz |
|