@luanpdd/kit-mcp 1.34.0 → 1.36.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.
Files changed (118) hide show
  1. package/README.md +1 -1
  2. package/bin/cli.js +2 -2
  3. package/bin/mcp.js +6 -6
  4. package/bin/ui.js +74 -74
  5. package/gates/ai-prompt-stability.md +120 -120
  6. package/gates/budget-description.md +68 -68
  7. package/gates/confidence.md +29 -29
  8. package/gates/dependency-check.md +33 -33
  9. package/gates/dept-cycle-prevention.md +179 -179
  10. package/gates/golden-signals-coverage.md +133 -133
  11. package/gates/legacy-refactor-safety.md +178 -178
  12. package/gates/multi-tenant-rls-coverage.md +102 -102
  13. package/gates/no-personal-uuid.md +72 -72
  14. package/gates/obs-agents-mcp-supabase.md +86 -86
  15. package/gates/obs-skills-frontmatter.md +76 -76
  16. package/gates/observability-coverage.md +151 -151
  17. package/gates/omm-no-regression.md +83 -83
  18. package/gates/postmortem-template-required.md +127 -127
  19. package/gates/prr-checklist-coverage.md +128 -128
  20. package/gates/regression.md +32 -32
  21. package/gates/release-pipeline-policy.md +132 -132
  22. package/gates/secrets-scan.md +33 -33
  23. package/gates/service-role-not-in-user-facing.md +113 -113
  24. package/gates/skill-must-include.md +71 -71
  25. package/gates/sync-idempotent.md +62 -62
  26. package/gates/verify-phase-goal.md +34 -34
  27. package/kit/agents/designer-ui.md +216 -216
  28. package/kit/agents/workflow-generator.md +537 -0
  29. package/kit/commands/adicionar-backlog.md +1 -1
  30. package/kit/commands/adicionar-fase.md +1 -1
  31. package/kit/commands/adicionar-tarefa.md +1 -1
  32. package/kit/commands/auditar-observabilidade.md +103 -103
  33. package/kit/commands/auditar-toil.md +129 -129
  34. package/kit/commands/caracterizar-prompt.md +195 -195
  35. package/kit/commands/criar-workflow.md +158 -0
  36. package/kit/commands/definir-perfil.md +1 -1
  37. package/kit/commands/definir-slo.md +108 -108
  38. package/kit/commands/fio.md +1 -1
  39. package/kit/commands/golden-signals.md +142 -142
  40. package/kit/commands/instrumentar-fase.md +200 -200
  41. package/kit/commands/investigar-producao.md +162 -162
  42. package/kit/commands/observabilidade.md +118 -118
  43. package/kit/commands/postmortem.md +179 -179
  44. package/kit/commands/prr.md +205 -205
  45. package/kit/commands/publicar-rapido.md +207 -207
  46. package/kit/commands/risk-budget.md +220 -220
  47. package/kit/commands/sre.md +230 -230
  48. package/kit/file-manifest.json +5 -2
  49. package/kit/framework/references/output-style.md +22 -22
  50. package/kit/hooks/post-apply-migration.js +199 -199
  51. package/kit/hooks/sidecar-tool-publisher.js +210 -210
  52. package/kit/skills/_shared-dados-distribuidos/glossary.md +224 -224
  53. package/kit/skills/_shared-legacy/glossary.md +389 -389
  54. package/kit/skills/_shared-multi-tenant/glossary.md +186 -186
  55. package/kit/skills/_shared-observability/glossary.md +396 -396
  56. package/kit/skills/_shared-sre/glossary.md +712 -712
  57. package/kit/skills/_shared-supabase/glossary.md +234 -234
  58. package/kit/skills/blameless-postmortems/SKILL.md +340 -340
  59. package/kit/skills/burn-rate-alerting/SKILL.md +258 -258
  60. package/kit/skills/cascading-failures/SKILL.md +311 -311
  61. package/kit/skills/core-analysis-loop/SKILL.md +352 -352
  62. package/kit/skills/distributed-tracing/SKILL.md +362 -362
  63. package/kit/skills/dynamic-workflow-authoring/SKILL.md +327 -0
  64. package/kit/skills/eliminating-toil/SKILL.md +243 -243
  65. package/kit/skills/event-based-slos/SKILL.md +296 -296
  66. package/kit/skills/four-golden-signals/SKILL.md +314 -314
  67. package/kit/skills/hermetic-builds/SKILL.md +323 -323
  68. package/kit/skills/legacy-monster-methods/SKILL.md +444 -444
  69. package/kit/skills/llm-as-dependency/SKILL.md +436 -436
  70. package/kit/skills/load-shedding-graceful-degradation/SKILL.md +396 -396
  71. package/kit/skills/observability-driven-development/SKILL.md +315 -315
  72. package/kit/skills/observability-maturity-model/SKILL.md +222 -222
  73. package/kit/skills/opentelemetry-standard/SKILL.md +351 -351
  74. package/kit/skills/production-readiness-review/SKILL.md +305 -305
  75. package/kit/skills/release-engineering/SKILL.md +367 -367
  76. package/kit/skills/retry-strategies/SKILL.md +372 -372
  77. package/kit/skills/sre-risk-management/SKILL.md +221 -221
  78. package/kit/skills/structured-events/SKILL.md +265 -265
  79. package/kit/skills/supabase-cron-queues/SKILL.md +275 -275
  80. package/kit/skills/supabase-database-functions/SKILL.md +332 -332
  81. package/kit/skills/supabase-declarative-schema/SKILL.md +183 -183
  82. package/kit/skills/supabase-pgvector-rag/SKILL.md +253 -253
  83. package/kit/skills/supabase-postgres-style/SKILL.md +138 -138
  84. package/kit/skills/supabase-storage/SKILL.md +234 -234
  85. package/kit/skills/telemetry-pipelines/SKILL.md +259 -259
  86. package/kit/skills/telemetry-sampling/SKILL.md +256 -256
  87. package/kit/skills/ui-anti-padroes-ia/SKILL.md +261 -261
  88. package/kit/skills/ui-contexto-produto/SKILL.md +248 -248
  89. package/kit/skills/ui-cor-estrategia/SKILL.md +213 -213
  90. package/kit/skills/ui-critica-auditoria/SKILL.md +260 -260
  91. package/kit/skills/ui-motion-funcional/SKILL.md +264 -264
  92. package/kit/skills/ui-ritmo-espacial/SKILL.md +259 -259
  93. package/kit/skills/ui-tipografia/SKILL.md +211 -211
  94. package/package.json +1 -1
  95. package/src/cli/index.js +1114 -1114
  96. package/src/cli/render.js +194 -194
  97. package/src/cli/upgrade-check.js +135 -135
  98. package/src/core/error-redaction.js +76 -76
  99. package/src/core/failures.js +153 -153
  100. package/src/core/gate-runner.js +205 -205
  101. package/src/core/gates.js +82 -82
  102. package/src/core/logger.js +170 -170
  103. package/src/core/manifest-verify.js +174 -174
  104. package/src/core/metrics.js +268 -268
  105. package/src/core/notify.js +60 -60
  106. package/src/core/path-safety.js +141 -141
  107. package/src/core/replays.js +120 -120
  108. package/src/core/ui.js +185 -185
  109. package/src/mcp-server/install.js +149 -149
  110. package/src/mcp-server/roots.js +124 -124
  111. package/src/ui/auto-spawn.js +113 -113
  112. package/src/ui/browser.js +78 -78
  113. package/src/ui/client.js +130 -130
  114. package/src/ui/events.js +65 -65
  115. package/src/ui/lockfile.js +191 -191
  116. package/src/ui/port.js +67 -67
  117. package/src/ui/server.js +547 -547
  118. package/src/ui/wrapper.js +129 -129
@@ -1,76 +1,76 @@
1
- ---
2
- id: obs-skills-frontmatter
3
- stage: pre-verify
4
- blocking: true
5
- description: Valida que skills observability têm frontmatter completo (name + description ≤ 200 chars) e seções obrigatórias do template.
6
- ---
7
-
8
- # Observability skills frontmatter gate
9
-
10
- **When to run:** pre-verify.
11
-
12
- ## Check
13
-
14
- ```bash
15
- #!/usr/bin/env bash
16
- # PT-BR: validar que cada skill em kit/skills/{structured-events,distributed-tracing,opentelemetry-standard,core-analysis-loop,observability-driven-development,event-based-slos,burn-rate-alerting,telemetry-sampling,telemetry-pipelines,observability-maturity-model}/SKILL.md
17
- # tem frontmatter completo + seções obrigatórias.
18
- # Portable bash 3.2+ (macOS default).
19
- set -e
20
-
21
- VIOLATIONS=0
22
- SKILLS="structured-events distributed-tracing opentelemetry-standard core-analysis-loop observability-driven-development event-based-slos burn-rate-alerting telemetry-sampling telemetry-pipelines observability-maturity-model"
23
-
24
- for skill in $SKILLS; do
25
- file="kit/skills/$skill/SKILL.md"
26
- if [ ! -f "$file" ]; then
27
- echo "FAIL: $file — skill ausente"
28
- VIOLATIONS=$((VIOLATIONS + 1))
29
- continue
30
- fi
31
-
32
- # PT-BR: frontmatter name presente
33
- if ! grep -qE '^name:' "$file"; then
34
- echo "FAIL: $file — frontmatter 'name:' ausente"
35
- VIOLATIONS=$((VIOLATIONS + 1))
36
- fi
37
-
38
- # PT-BR: frontmatter description presente
39
- if ! grep -qE '^description:' "$file"; then
40
- echo "FAIL: $file — frontmatter 'description:' ausente"
41
- VIOLATIONS=$((VIOLATIONS + 1))
42
- else
43
- desc=$(grep -E '^description:' "$file" | head -1 | sed 's/description: //')
44
- len=${#desc}
45
- if [ "$len" -gt 200 ]; then
46
- echo "FAIL: $file — description=$len chars (limite 200, anti-pitfall A2)"
47
- VIOLATIONS=$((VIOLATIONS + 1))
48
- fi
49
- fi
50
-
51
- # PT-BR: 4+ seções H2 (Quando usar, Regras absolutas, Patterns canônicos, Anti-patterns OU Verificação)
52
- h2_count=$(grep -cE '^## ' "$file")
53
- if [ "$h2_count" -lt 4 ]; then
54
- echo "FAIL: $file — só $h2_count seções H2 (mínimo 4 — Quando usar, Regras absolutas, Patterns canônicos, Anti-patterns/Verificação)"
55
- VIOLATIONS=$((VIOLATIONS + 1))
56
- fi
57
- done
58
-
59
- if [ "$VIOLATIONS" -eq 0 ]; then
60
- echo "PASS: 10 skills observability com frontmatter completo + 4+ seções H2"
61
- exit 0
62
- else
63
- echo "FAIL: $VIOLATIONS violação(ões)"
64
- exit 1
65
- fi
66
- ```
67
-
68
- ## Why
69
-
70
- - Skills sem `description` não aparecem em `listKit` (LLM não acha o trigger)
71
- - `description > 200 chars` infla CLAUDE.md desnecessariamente (anti-pitfall A2)
72
- - Skills sem template fixo geram outputs inconsistentes — gate força padrão.
73
-
74
- ## REQ
75
-
76
- QA-01.
1
+ ---
2
+ id: obs-skills-frontmatter
3
+ stage: pre-verify
4
+ blocking: true
5
+ description: Valida que skills observability têm frontmatter completo (name + description ≤ 200 chars) e seções obrigatórias do template.
6
+ ---
7
+
8
+ # Observability skills frontmatter gate
9
+
10
+ **When to run:** pre-verify.
11
+
12
+ ## Check
13
+
14
+ ```bash
15
+ #!/usr/bin/env bash
16
+ # PT-BR: validar que cada skill em kit/skills/{structured-events,distributed-tracing,opentelemetry-standard,core-analysis-loop,observability-driven-development,event-based-slos,burn-rate-alerting,telemetry-sampling,telemetry-pipelines,observability-maturity-model}/SKILL.md
17
+ # tem frontmatter completo + seções obrigatórias.
18
+ # Portable bash 3.2+ (macOS default).
19
+ set -e
20
+
21
+ VIOLATIONS=0
22
+ SKILLS="structured-events distributed-tracing opentelemetry-standard core-analysis-loop observability-driven-development event-based-slos burn-rate-alerting telemetry-sampling telemetry-pipelines observability-maturity-model"
23
+
24
+ for skill in $SKILLS; do
25
+ file="kit/skills/$skill/SKILL.md"
26
+ if [ ! -f "$file" ]; then
27
+ echo "FAIL: $file — skill ausente"
28
+ VIOLATIONS=$((VIOLATIONS + 1))
29
+ continue
30
+ fi
31
+
32
+ # PT-BR: frontmatter name presente
33
+ if ! grep -qE '^name:' "$file"; then
34
+ echo "FAIL: $file — frontmatter 'name:' ausente"
35
+ VIOLATIONS=$((VIOLATIONS + 1))
36
+ fi
37
+
38
+ # PT-BR: frontmatter description presente
39
+ if ! grep -qE '^description:' "$file"; then
40
+ echo "FAIL: $file — frontmatter 'description:' ausente"
41
+ VIOLATIONS=$((VIOLATIONS + 1))
42
+ else
43
+ desc=$(grep -E '^description:' "$file" | head -1 | sed 's/description: //')
44
+ len=${#desc}
45
+ if [ "$len" -gt 200 ]; then
46
+ echo "FAIL: $file — description=$len chars (limite 200, anti-pitfall A2)"
47
+ VIOLATIONS=$((VIOLATIONS + 1))
48
+ fi
49
+ fi
50
+
51
+ # PT-BR: 4+ seções H2 (Quando usar, Regras absolutas, Patterns canônicos, Anti-patterns OU Verificação)
52
+ h2_count=$(grep -cE '^## ' "$file")
53
+ if [ "$h2_count" -lt 4 ]; then
54
+ echo "FAIL: $file — só $h2_count seções H2 (mínimo 4 — Quando usar, Regras absolutas, Patterns canônicos, Anti-patterns/Verificação)"
55
+ VIOLATIONS=$((VIOLATIONS + 1))
56
+ fi
57
+ done
58
+
59
+ if [ "$VIOLATIONS" -eq 0 ]; then
60
+ echo "PASS: 10 skills observability com frontmatter completo + 4+ seções H2"
61
+ exit 0
62
+ else
63
+ echo "FAIL: $VIOLATIONS violação(ões)"
64
+ exit 1
65
+ fi
66
+ ```
67
+
68
+ ## Why
69
+
70
+ - Skills sem `description` não aparecem em `listKit` (LLM não acha o trigger)
71
+ - `description > 200 chars` infla CLAUDE.md desnecessariamente (anti-pitfall A2)
72
+ - Skills sem template fixo geram outputs inconsistentes — gate força padrão.
73
+
74
+ ## REQ
75
+
76
+ QA-01.
@@ -1,151 +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
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
@@ -1,83 +1,83 @@
1
- ---
2
- id: omm-no-regression
3
- stage: pre-conclude
4
- blocking: false
5
- description: Valida que nenhuma das 5 capacidades OMM regrediu vs marco anterior. Rodável em /concluir-marco. Não-bloqueante (warn) por default; configurável via workflow.omm_no_regression.
6
- ---
7
-
8
- # OMM no-regression gate
9
-
10
- **When to run:** pre-conclude (antes de `/concluir-marco` arquivar marco).
11
-
12
- ## Check
13
-
14
- ```bash
15
- #!/usr/bin/env bash
16
- # PT-BR: validar que OMM-REPORT.md atual não tem capacidade regredida vs marco anterior.
17
- # Estratégia: comparar scores no OMM-REPORT.md atual vs último arquivado.
18
- set -e
19
-
20
- CURRENT=".planning/OMM-REPORT.md"
21
-
22
- if [ ! -f "$CURRENT" ]; then
23
- echo "WARN: $CURRENT ausente — rodar /auditar-observabilidade primeiro. Pulando gate."
24
- exit 0
25
- fi
26
-
27
- # PT-BR: encontrar OMM-REPORT.md anterior em milestones arquivados
28
- PREVIOUS=$(find .planning/milestones -name "OMM-REPORT.md" -type f 2>/dev/null | sort -r | head -1)
29
-
30
- if [ -z "$PREVIOUS" ] || [ ! -f "$PREVIOUS" ]; then
31
- echo "INFO: sem OMM-REPORT anterior arquivado (primeiro marco com OMM). Pulando regression check."
32
- exit 0
33
- fi
34
-
35
- # PT-BR: extrair scores do OMM-REPORT.md atual e anterior
36
- # Formato esperado: "| 1 | Resiliência | 3 | ... |"
37
-
38
- REGRESSIONS=0
39
- for cap in 1 2 3 4 5; do
40
- current_score=$(grep -E "^\| $cap \| " "$CURRENT" 2>/dev/null | awk -F'|' '{print $4}' | tr -d ' ' | head -1)
41
- previous_score=$(grep -E "^\| $cap \| " "$PREVIOUS" 2>/dev/null | awk -F'|' '{print $4}' | tr -d ' ' | head -1)
42
-
43
- if [ -z "$current_score" ] || [ -z "$previous_score" ]; then
44
- continue
45
- fi
46
-
47
- if [ "$current_score" -lt "$previous_score" ]; then
48
- cap_name=$(grep -E "^\| $cap \| " "$CURRENT" | awk -F'|' '{print $3}' | xargs)
49
- echo "REGRESSION: Capacidade $cap ($cap_name) regrediu de $previous_score → $current_score"
50
- REGRESSIONS=$((REGRESSIONS + 1))
51
- fi
52
- done
53
-
54
- if [ "$REGRESSIONS" -eq 0 ]; then
55
- echo "PASS: nenhuma das 5 capacidades OMM regrediu vs $PREVIOUS"
56
- exit 0
57
- else
58
- echo "WARN: $REGRESSIONS capacidade(s) regredida(s)"
59
- # PT-BR: blocking=false por default. Para tornar bloqueante:
60
- # workflow.omm_no_regression=true
61
- if [ "$(node ./.claude/framework/bin/tools.cjs config-get workflow.omm_no_regression 2>/dev/null || echo false)" = "true" ]; then
62
- exit 1
63
- fi
64
- exit 0
65
- fi
66
- ```
67
-
68
- ## Why
69
-
70
- OMM regression alerta o time que algo deteriorou apesar do esforço do marco. Sem este gate, regressions silenciam e accumulate como tech debt invisível.
71
-
72
- Default não-bloqueante para evitar ruído inicial; flag `workflow.omm_no_regression=true` opt-in quando time confiante.
73
-
74
- ## REQ
75
-
76
- QA-03 + INT-FW-04 + INT-FW-05.
77
-
78
- ## Configuração
79
-
80
- ```bash
81
- # PT-BR: tornar bloqueante (recomendado depois de 2-3 marcos consecutivos sem regression)
82
- node ./.claude/framework/bin/tools.cjs config-set workflow.omm_no_regression true
83
- ```
1
+ ---
2
+ id: omm-no-regression
3
+ stage: pre-conclude
4
+ blocking: false
5
+ description: Valida que nenhuma das 5 capacidades OMM regrediu vs marco anterior. Rodável em /concluir-marco. Não-bloqueante (warn) por default; configurável via workflow.omm_no_regression.
6
+ ---
7
+
8
+ # OMM no-regression gate
9
+
10
+ **When to run:** pre-conclude (antes de `/concluir-marco` arquivar marco).
11
+
12
+ ## Check
13
+
14
+ ```bash
15
+ #!/usr/bin/env bash
16
+ # PT-BR: validar que OMM-REPORT.md atual não tem capacidade regredida vs marco anterior.
17
+ # Estratégia: comparar scores no OMM-REPORT.md atual vs último arquivado.
18
+ set -e
19
+
20
+ CURRENT=".planning/OMM-REPORT.md"
21
+
22
+ if [ ! -f "$CURRENT" ]; then
23
+ echo "WARN: $CURRENT ausente — rodar /auditar-observabilidade primeiro. Pulando gate."
24
+ exit 0
25
+ fi
26
+
27
+ # PT-BR: encontrar OMM-REPORT.md anterior em milestones arquivados
28
+ PREVIOUS=$(find .planning/milestones -name "OMM-REPORT.md" -type f 2>/dev/null | sort -r | head -1)
29
+
30
+ if [ -z "$PREVIOUS" ] || [ ! -f "$PREVIOUS" ]; then
31
+ echo "INFO: sem OMM-REPORT anterior arquivado (primeiro marco com OMM). Pulando regression check."
32
+ exit 0
33
+ fi
34
+
35
+ # PT-BR: extrair scores do OMM-REPORT.md atual e anterior
36
+ # Formato esperado: "| 1 | Resiliência | 3 | ... |"
37
+
38
+ REGRESSIONS=0
39
+ for cap in 1 2 3 4 5; do
40
+ current_score=$(grep -E "^\| $cap \| " "$CURRENT" 2>/dev/null | awk -F'|' '{print $4}' | tr -d ' ' | head -1)
41
+ previous_score=$(grep -E "^\| $cap \| " "$PREVIOUS" 2>/dev/null | awk -F'|' '{print $4}' | tr -d ' ' | head -1)
42
+
43
+ if [ -z "$current_score" ] || [ -z "$previous_score" ]; then
44
+ continue
45
+ fi
46
+
47
+ if [ "$current_score" -lt "$previous_score" ]; then
48
+ cap_name=$(grep -E "^\| $cap \| " "$CURRENT" | awk -F'|' '{print $3}' | xargs)
49
+ echo "REGRESSION: Capacidade $cap ($cap_name) regrediu de $previous_score → $current_score"
50
+ REGRESSIONS=$((REGRESSIONS + 1))
51
+ fi
52
+ done
53
+
54
+ if [ "$REGRESSIONS" -eq 0 ]; then
55
+ echo "PASS: nenhuma das 5 capacidades OMM regrediu vs $PREVIOUS"
56
+ exit 0
57
+ else
58
+ echo "WARN: $REGRESSIONS capacidade(s) regredida(s)"
59
+ # PT-BR: blocking=false por default. Para tornar bloqueante:
60
+ # workflow.omm_no_regression=true
61
+ if [ "$(node ./.claude/framework/bin/tools.cjs config-get workflow.omm_no_regression 2>/dev/null || echo false)" = "true" ]; then
62
+ exit 1
63
+ fi
64
+ exit 0
65
+ fi
66
+ ```
67
+
68
+ ## Why
69
+
70
+ OMM regression alerta o time que algo deteriorou apesar do esforço do marco. Sem este gate, regressions silenciam e accumulate como tech debt invisível.
71
+
72
+ Default não-bloqueante para evitar ruído inicial; flag `workflow.omm_no_regression=true` opt-in quando time confiante.
73
+
74
+ ## REQ
75
+
76
+ QA-03 + INT-FW-04 + INT-FW-05.
77
+
78
+ ## Configuração
79
+
80
+ ```bash
81
+ # PT-BR: tornar bloqueante (recomendado depois de 2-3 marcos consecutivos sem regression)
82
+ node ./.claude/framework/bin/tools.cjs config-set workflow.omm_no_regression true
83
+ ```