@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.
- package/README.md +1 -1
- package/bin/cli.js +2 -2
- package/bin/mcp.js +6 -6
- package/bin/ui.js +74 -74
- package/gates/ai-prompt-stability.md +120 -120
- package/gates/budget-description.md +68 -68
- package/gates/confidence.md +29 -29
- package/gates/dependency-check.md +33 -33
- package/gates/dept-cycle-prevention.md +179 -179
- package/gates/golden-signals-coverage.md +133 -133
- package/gates/legacy-refactor-safety.md +178 -178
- package/gates/multi-tenant-rls-coverage.md +102 -102
- package/gates/no-personal-uuid.md +72 -72
- package/gates/obs-agents-mcp-supabase.md +86 -86
- package/gates/obs-skills-frontmatter.md +76 -76
- package/gates/observability-coverage.md +151 -151
- package/gates/omm-no-regression.md +83 -83
- package/gates/postmortem-template-required.md +127 -127
- package/gates/prr-checklist-coverage.md +128 -128
- package/gates/regression.md +32 -32
- package/gates/release-pipeline-policy.md +132 -132
- package/gates/secrets-scan.md +33 -33
- package/gates/service-role-not-in-user-facing.md +113 -113
- package/gates/skill-must-include.md +71 -71
- package/gates/sync-idempotent.md +62 -62
- package/gates/verify-phase-goal.md +34 -34
- package/kit/agents/designer-ui.md +216 -216
- package/kit/agents/workflow-generator.md +537 -0
- package/kit/commands/adicionar-backlog.md +1 -1
- package/kit/commands/adicionar-fase.md +1 -1
- package/kit/commands/adicionar-tarefa.md +1 -1
- package/kit/commands/auditar-observabilidade.md +103 -103
- package/kit/commands/auditar-toil.md +129 -129
- package/kit/commands/caracterizar-prompt.md +195 -195
- package/kit/commands/criar-workflow.md +158 -0
- package/kit/commands/definir-perfil.md +1 -1
- package/kit/commands/definir-slo.md +108 -108
- package/kit/commands/fio.md +1 -1
- package/kit/commands/golden-signals.md +142 -142
- package/kit/commands/instrumentar-fase.md +200 -200
- package/kit/commands/investigar-producao.md +162 -162
- package/kit/commands/observabilidade.md +118 -118
- package/kit/commands/postmortem.md +179 -179
- package/kit/commands/prr.md +205 -205
- package/kit/commands/publicar-rapido.md +207 -207
- package/kit/commands/risk-budget.md +220 -220
- package/kit/commands/sre.md +230 -230
- package/kit/file-manifest.json +5 -2
- package/kit/framework/references/output-style.md +22 -22
- package/kit/hooks/post-apply-migration.js +199 -199
- package/kit/hooks/sidecar-tool-publisher.js +210 -210
- package/kit/skills/_shared-dados-distribuidos/glossary.md +224 -224
- package/kit/skills/_shared-legacy/glossary.md +389 -389
- package/kit/skills/_shared-multi-tenant/glossary.md +186 -186
- package/kit/skills/_shared-observability/glossary.md +396 -396
- package/kit/skills/_shared-sre/glossary.md +712 -712
- package/kit/skills/_shared-supabase/glossary.md +234 -234
- package/kit/skills/blameless-postmortems/SKILL.md +340 -340
- package/kit/skills/burn-rate-alerting/SKILL.md +258 -258
- package/kit/skills/cascading-failures/SKILL.md +311 -311
- package/kit/skills/core-analysis-loop/SKILL.md +352 -352
- package/kit/skills/distributed-tracing/SKILL.md +362 -362
- package/kit/skills/dynamic-workflow-authoring/SKILL.md +327 -0
- package/kit/skills/eliminating-toil/SKILL.md +243 -243
- package/kit/skills/event-based-slos/SKILL.md +296 -296
- package/kit/skills/four-golden-signals/SKILL.md +314 -314
- package/kit/skills/hermetic-builds/SKILL.md +323 -323
- package/kit/skills/legacy-monster-methods/SKILL.md +444 -444
- package/kit/skills/llm-as-dependency/SKILL.md +436 -436
- package/kit/skills/load-shedding-graceful-degradation/SKILL.md +396 -396
- package/kit/skills/observability-driven-development/SKILL.md +315 -315
- package/kit/skills/observability-maturity-model/SKILL.md +222 -222
- package/kit/skills/opentelemetry-standard/SKILL.md +351 -351
- package/kit/skills/production-readiness-review/SKILL.md +305 -305
- package/kit/skills/release-engineering/SKILL.md +367 -367
- package/kit/skills/retry-strategies/SKILL.md +372 -372
- package/kit/skills/sre-risk-management/SKILL.md +221 -221
- package/kit/skills/structured-events/SKILL.md +265 -265
- package/kit/skills/supabase-cron-queues/SKILL.md +275 -275
- package/kit/skills/supabase-database-functions/SKILL.md +332 -332
- package/kit/skills/supabase-declarative-schema/SKILL.md +183 -183
- package/kit/skills/supabase-pgvector-rag/SKILL.md +253 -253
- package/kit/skills/supabase-postgres-style/SKILL.md +138 -138
- package/kit/skills/supabase-storage/SKILL.md +234 -234
- package/kit/skills/telemetry-pipelines/SKILL.md +259 -259
- package/kit/skills/telemetry-sampling/SKILL.md +256 -256
- package/kit/skills/ui-anti-padroes-ia/SKILL.md +261 -261
- package/kit/skills/ui-contexto-produto/SKILL.md +248 -248
- package/kit/skills/ui-cor-estrategia/SKILL.md +213 -213
- package/kit/skills/ui-critica-auditoria/SKILL.md +260 -260
- package/kit/skills/ui-motion-funcional/SKILL.md +264 -264
- package/kit/skills/ui-ritmo-espacial/SKILL.md +259 -259
- package/kit/skills/ui-tipografia/SKILL.md +211 -211
- package/package.json +1 -1
- package/src/cli/index.js +1114 -1114
- package/src/cli/render.js +194 -194
- package/src/cli/upgrade-check.js +135 -135
- package/src/core/error-redaction.js +76 -76
- package/src/core/failures.js +153 -153
- package/src/core/gate-runner.js +205 -205
- package/src/core/gates.js +82 -82
- package/src/core/logger.js +170 -170
- package/src/core/manifest-verify.js +174 -174
- package/src/core/metrics.js +268 -268
- package/src/core/notify.js +60 -60
- package/src/core/path-safety.js +141 -141
- package/src/core/replays.js +120 -120
- package/src/core/ui.js +185 -185
- package/src/mcp-server/install.js +149 -149
- package/src/mcp-server/roots.js +124 -124
- package/src/ui/auto-spawn.js +113 -113
- package/src/ui/browser.js +78 -78
- package/src/ui/client.js +130 -130
- package/src/ui/events.js +65 -65
- package/src/ui/lockfile.js +191 -191
- package/src/ui/port.js +67 -67
- package/src/ui/server.js +547 -547
- package/src/ui/wrapper.js +129 -129
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: definir-slo
|
|
3
|
-
description: Invoca slo-engineer para gerar SLO.md + SQL materialização SLI events. Aplica skill event-based-slos. Default 30d sliding window, target ≤ 99.95%.
|
|
4
|
-
argument-hint: "<feature> [--target 99.9] [--owner email]"
|
|
5
|
-
allowed-tools:
|
|
6
|
-
- Read
|
|
7
|
-
- Write
|
|
8
|
-
- Bash
|
|
9
|
-
- Task
|
|
10
|
-
- AskUserQuestion
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
<objective>
|
|
14
|
-
Definir um SLO event-based para uma feature/jornada do usuário. Invoca o agente [`slo-engineer`](../agents/slo-engineer.md) que aplica a skill [`event-based-slos`](../skills/event-based-slos/SKILL.md) — SLI event-based, sliding window 30d, target ≤ 99.95%, owner nomeado, materialização em Postgres.
|
|
15
|
-
|
|
16
|
-
**Cria/Atualiza:**
|
|
17
|
-
- `.planning/slos/<slo_name>.md` — definição canônica do SLO
|
|
18
|
-
- `supabase/migrations/<timestamp>_create_sli_<slo_name>.sql` — view materializada SLI
|
|
19
|
-
|
|
20
|
-
**Após:** SLO está em `draft` status. Próximo passo: `/burn-rate-status <slo_name>` para validar baseline; após 1+ semana, promover de `draft` → `test_channel` → `primary`.
|
|
21
|
-
</objective>
|
|
22
|
-
|
|
23
|
-
<context>
|
|
24
|
-
**Argumentos:** `$ARGUMENTS` — primeiro token é a feature/jornada (ex: `checkout`, `login`, `bulk-orders`); restante são flags.
|
|
25
|
-
|
|
26
|
-
**Flags:**
|
|
27
|
-
- `--target <percent>` — target % do SLO (default: agent sugere baseado em criticality, sempre ≤ 99.95%)
|
|
28
|
-
- `--owner <email>` — owner do SLO (default: AskUserQuestion)
|
|
29
|
-
- `--window <duration>` — sliding window (default: `30d`)
|
|
30
|
-
|
|
31
|
-
**Pré-requisito (Full mode):** projeto Supabase configurado, schema `observability` com tabela de events (Phase 31 supabase-architect projeta isso).
|
|
32
|
-
</context>
|
|
33
|
-
|
|
34
|
-
<process>
|
|
35
|
-
|
|
36
|
-
## 1. Parsear argumentos
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
FEATURE=$(echo "$ARGUMENTS" | awk '{print $1}')
|
|
40
|
-
TARGET=$(echo "$ARGUMENTS" | grep -oE -- '--target [0-9.]+' | awk '{print $2}')
|
|
41
|
-
OWNER=$(echo "$ARGUMENTS" | grep -oE -- '--owner [^ ]+' | awk '{print $2}')
|
|
42
|
-
WINDOW=$(echo "$ARGUMENTS" | grep -oE -- '--window [^ ]+' | awk '{print $2}')
|
|
43
|
-
|
|
44
|
-
[ -z "$FEATURE" ] && {
|
|
45
|
-
echo "Uso: /definir-slo <feature> [--target N] [--owner email]"
|
|
46
|
-
exit 1
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
[ -z "$WINDOW" ] && WINDOW="30d"
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## 2. Detectar `supabase/config.toml`
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
PROJECT_ID=""
|
|
56
|
-
if [ -f supabase/config.toml ]; then
|
|
57
|
-
PROJECT_ID=$(grep -E '^project_id\s*=' supabase/config.toml | sed 's/.*= *"\(.*\)".*/\1/' | head -1)
|
|
58
|
-
fi
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## 3. Dispatch para `slo-engineer`
|
|
62
|
-
|
|
63
|
-
```text
|
|
64
|
-
Task(
|
|
65
|
-
subagent_type="slo-engineer",
|
|
66
|
-
prompt="
|
|
67
|
-
feature: ${FEATURE}
|
|
68
|
-
${TARGET:+target: ${TARGET}}
|
|
69
|
-
${OWNER:+owner: ${OWNER}}
|
|
70
|
-
window: ${WINDOW}
|
|
71
|
-
${PROJECT_ID:+project_id: ${PROJECT_ID}}
|
|
72
|
-
|
|
73
|
-
Aplicar skill event-based-slos. Gerar:
|
|
74
|
-
1. .planning/slos/<slo_name>.md (SLO definition canônico)
|
|
75
|
-
2. supabase/migrations/<timestamp>_create_sli_<slo_name>.sql (materialized view + pg_cron refresh)
|
|
76
|
-
|
|
77
|
-
Se target > 99.95%, recusar e explicar — métrica informativa, não SLO.
|
|
78
|
-
Se Full mode (mcp__supabase disponível), apply_migration; senão, output text.
|
|
79
|
-
"
|
|
80
|
-
)
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## 4. Pós-output
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
═══════════════════════════════════════════════════════════
|
|
87
|
-
framework ► DEFINIR-SLO ▸ {slo_name}
|
|
88
|
-
═══════════════════════════════════════════════════════════
|
|
89
|
-
|
|
90
|
-
[output do slo-engineer — ver Step 8 do agent]
|
|
91
|
-
|
|
92
|
-
## Próximos passos
|
|
93
|
-
1. `/burn-rate-status {slo_name}` — checar baseline atual
|
|
94
|
-
2. Após 1+ semana validando que SLO detecta incidents reais:
|
|
95
|
-
- Editar `.planning/slos/{slo_name}.md` → status: `test_channel` → `primary`
|
|
96
|
-
3. Configurar alerts (page + ticket) — invocar `burn-rate-forecaster` ou config manual
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
</process>
|
|
100
|
-
|
|
101
|
-
<success_criteria>
|
|
102
|
-
- [ ] FEATURE parseado de $ARGUMENTS
|
|
103
|
-
- [ ] `slo-engineer` invocado via Task
|
|
104
|
-
- [ ] `.planning/slos/<slo_name>.md` criado
|
|
105
|
-
- [ ] Migration SQL criada (Full mode applied; Offline mode escrita)
|
|
106
|
-
- [ ] Target ≤ 99.95% enforced
|
|
107
|
-
- [ ] Owner registrado (via flag ou AskUserQuestion)
|
|
108
|
-
</success_criteria>
|
|
1
|
+
---
|
|
2
|
+
name: definir-slo
|
|
3
|
+
description: Invoca slo-engineer para gerar SLO.md + SQL materialização SLI events. Aplica skill event-based-slos. Default 30d sliding window, target ≤ 99.95%.
|
|
4
|
+
argument-hint: "<feature> [--target 99.9] [--owner email]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Bash
|
|
9
|
+
- Task
|
|
10
|
+
- AskUserQuestion
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<objective>
|
|
14
|
+
Definir um SLO event-based para uma feature/jornada do usuário. Invoca o agente [`slo-engineer`](../agents/slo-engineer.md) que aplica a skill [`event-based-slos`](../skills/event-based-slos/SKILL.md) — SLI event-based, sliding window 30d, target ≤ 99.95%, owner nomeado, materialização em Postgres.
|
|
15
|
+
|
|
16
|
+
**Cria/Atualiza:**
|
|
17
|
+
- `.planning/slos/<slo_name>.md` — definição canônica do SLO
|
|
18
|
+
- `supabase/migrations/<timestamp>_create_sli_<slo_name>.sql` — view materializada SLI
|
|
19
|
+
|
|
20
|
+
**Após:** SLO está em `draft` status. Próximo passo: `/burn-rate-status <slo_name>` para validar baseline; após 1+ semana, promover de `draft` → `test_channel` → `primary`.
|
|
21
|
+
</objective>
|
|
22
|
+
|
|
23
|
+
<context>
|
|
24
|
+
**Argumentos:** `$ARGUMENTS` — primeiro token é a feature/jornada (ex: `checkout`, `login`, `bulk-orders`); restante são flags.
|
|
25
|
+
|
|
26
|
+
**Flags:**
|
|
27
|
+
- `--target <percent>` — target % do SLO (default: agent sugere baseado em criticality, sempre ≤ 99.95%)
|
|
28
|
+
- `--owner <email>` — owner do SLO (default: AskUserQuestion)
|
|
29
|
+
- `--window <duration>` — sliding window (default: `30d`)
|
|
30
|
+
|
|
31
|
+
**Pré-requisito (Full mode):** projeto Supabase configurado, schema `observability` com tabela de events (Phase 31 supabase-architect projeta isso).
|
|
32
|
+
</context>
|
|
33
|
+
|
|
34
|
+
<process>
|
|
35
|
+
|
|
36
|
+
## 1. Parsear argumentos
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
FEATURE=$(echo "$ARGUMENTS" | awk '{print $1}')
|
|
40
|
+
TARGET=$(echo "$ARGUMENTS" | grep -oE -- '--target [0-9.]+' | awk '{print $2}')
|
|
41
|
+
OWNER=$(echo "$ARGUMENTS" | grep -oE -- '--owner [^ ]+' | awk '{print $2}')
|
|
42
|
+
WINDOW=$(echo "$ARGUMENTS" | grep -oE -- '--window [^ ]+' | awk '{print $2}')
|
|
43
|
+
|
|
44
|
+
[ -z "$FEATURE" ] && {
|
|
45
|
+
echo "Uso: /definir-slo <feature> [--target N] [--owner email]"
|
|
46
|
+
exit 1
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
[ -z "$WINDOW" ] && WINDOW="30d"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 2. Detectar `supabase/config.toml`
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
PROJECT_ID=""
|
|
56
|
+
if [ -f supabase/config.toml ]; then
|
|
57
|
+
PROJECT_ID=$(grep -E '^project_id\s*=' supabase/config.toml | sed 's/.*= *"\(.*\)".*/\1/' | head -1)
|
|
58
|
+
fi
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 3. Dispatch para `slo-engineer`
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
Task(
|
|
65
|
+
subagent_type="slo-engineer",
|
|
66
|
+
prompt="
|
|
67
|
+
feature: ${FEATURE}
|
|
68
|
+
${TARGET:+target: ${TARGET}}
|
|
69
|
+
${OWNER:+owner: ${OWNER}}
|
|
70
|
+
window: ${WINDOW}
|
|
71
|
+
${PROJECT_ID:+project_id: ${PROJECT_ID}}
|
|
72
|
+
|
|
73
|
+
Aplicar skill event-based-slos. Gerar:
|
|
74
|
+
1. .planning/slos/<slo_name>.md (SLO definition canônico)
|
|
75
|
+
2. supabase/migrations/<timestamp>_create_sli_<slo_name>.sql (materialized view + pg_cron refresh)
|
|
76
|
+
|
|
77
|
+
Se target > 99.95%, recusar e explicar — métrica informativa, não SLO.
|
|
78
|
+
Se Full mode (mcp__supabase disponível), apply_migration; senão, output text.
|
|
79
|
+
"
|
|
80
|
+
)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 4. Pós-output
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
═══════════════════════════════════════════════════════════
|
|
87
|
+
framework ► DEFINIR-SLO ▸ {slo_name}
|
|
88
|
+
═══════════════════════════════════════════════════════════
|
|
89
|
+
|
|
90
|
+
[output do slo-engineer — ver Step 8 do agent]
|
|
91
|
+
|
|
92
|
+
## Próximos passos
|
|
93
|
+
1. `/burn-rate-status {slo_name}` — checar baseline atual
|
|
94
|
+
2. Após 1+ semana validando que SLO detecta incidents reais:
|
|
95
|
+
- Editar `.planning/slos/{slo_name}.md` → status: `test_channel` → `primary`
|
|
96
|
+
3. Configurar alerts (page + ticket) — invocar `burn-rate-forecaster` ou config manual
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
</process>
|
|
100
|
+
|
|
101
|
+
<success_criteria>
|
|
102
|
+
- [ ] FEATURE parseado de $ARGUMENTS
|
|
103
|
+
- [ ] `slo-engineer` invocado via Task
|
|
104
|
+
- [ ] `.planning/slos/<slo_name>.md` criado
|
|
105
|
+
- [ ] Migration SQL criada (Full mode applied; Offline mode escrita)
|
|
106
|
+
- [ ] Target ≤ 99.95% enforced
|
|
107
|
+
- [ ] Owner registrado (via flag ou AskUserQuestion)
|
|
108
|
+
</success_criteria>
|
package/kit/commands/fio.md
CHANGED
|
@@ -1,142 +1,142 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: golden-signals
|
|
3
|
-
description: Invoca golden-signals-instrumenter para serviço/Edge Function/fase — instrumenta 4 golden signals OTel (Latency histogram, Traffic counter, Errors counter, Saturation gauge).
|
|
4
|
-
argument-hint: "<target> [--service <name>] [--saturation <resource>] [--runtime <node|deno|python>]"
|
|
5
|
-
allowed-tools:
|
|
6
|
-
- Read
|
|
7
|
-
- Write
|
|
8
|
-
- Bash
|
|
9
|
-
- Grep
|
|
10
|
-
- Glob
|
|
11
|
-
- Task
|
|
12
|
-
- AskUserQuestion
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
<objective>
|
|
16
|
-
Instrumentar um serviço/Edge Function/fase com os **4 golden signals** do cap 6 do livro Google SRE — Latency (histogram bucketed), Traffic (counter), Errors (counter por `error.type`), Saturation (gauge resource-specific). Invoca o agente [`golden-signals-instrumenter`](../agents/golden-signals-instrumenter.md) que aplica a skill [`four-golden-signals`](../skills/four-golden-signals/SKILL.md).
|
|
17
|
-
|
|
18
|
-
**Cria/Atualiza:**
|
|
19
|
-
- Patches OTel nos arquivos do `<target>` (Latency + Traffic + Errors + Saturation)
|
|
20
|
-
- `GOLDEN-SIGNALS.md` por target com tabela de instrumentação aplicada (output do agent)
|
|
21
|
-
|
|
22
|
-
**Após:** os 4 signals estão instrumentados e o user pode rodar smoke local para verificar histogram/counter/gauge no backend OTel.
|
|
23
|
-
</objective>
|
|
24
|
-
|
|
25
|
-
<context>
|
|
26
|
-
**Argumentos:** `$ARGUMENTS` — primeiro token é o `<target>` (path de arquivo, diretório de service, ou número de fase como `38`); restante são flags.
|
|
27
|
-
|
|
28
|
-
**Flags:**
|
|
29
|
-
- `--service <name>` — nome canônico do serviço (default: deriva de `package.json#name` ou diretório)
|
|
30
|
-
- `--saturation <resource>` — recurso de saturation (`db_connection_pool` | `cache_memory` | `queue_depth` | `concurrency_limit` | `cpu_load` | `egress_bandwidth`); se omitido, agent infere via heurística
|
|
31
|
-
- `--runtime <node|deno|python>` — runtime; se omitido, detecta via `package.json`/`deno.json`/`pyproject.toml`
|
|
32
|
-
|
|
33
|
-
**Exemplos:**
|
|
34
|
-
```
|
|
35
|
-
/golden-signals src/orders/handler.ts # 1 arquivo
|
|
36
|
-
/golden-signals supabase/functions/process-emails # 1 Edge Function
|
|
37
|
-
/golden-signals 38 # todos os arquivos modificados pela Phase 38
|
|
38
|
-
/golden-signals src/api --service orders-api --saturation db_connection_pool
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
**Pré-requisito:** OTel SDK pode estar ausente — agent flagga deps necessárias no output. Caller decide instalar.
|
|
42
|
-
</context>
|
|
43
|
-
|
|
44
|
-
<process>
|
|
45
|
-
|
|
46
|
-
## 1. Parsear argumentos
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
TARGET=$(echo "$ARGUMENTS" | awk '{print $1}')
|
|
50
|
-
SERVICE=$(echo "$ARGUMENTS" | grep -oE -- '--service [^ ]+' | awk '{print $2}')
|
|
51
|
-
SATURATION=$(echo "$ARGUMENTS" | grep -oE -- '--saturation [^ ]+' | awk '{print $2}')
|
|
52
|
-
RUNTIME=$(echo "$ARGUMENTS" | grep -oE -- '--runtime [^ ]+' | awk '{print $2}')
|
|
53
|
-
|
|
54
|
-
if [ -z "$TARGET" ]; then
|
|
55
|
-
echo "Uso: /golden-signals <target> [--service N] [--saturation R] [--runtime RT]"
|
|
56
|
-
echo "Exemplos:"
|
|
57
|
-
echo " /golden-signals src/orders/handler.ts"
|
|
58
|
-
echo " /golden-signals supabase/functions/process-emails"
|
|
59
|
-
echo " /golden-signals 38 # todos arquivos da Phase 38"
|
|
60
|
-
exit 1
|
|
61
|
-
fi
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## 2. Resolver target → lista de target_files
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
# PT-BR: 3 modos de resolução
|
|
68
|
-
if [[ "$TARGET" =~ ^[0-9]+$ ]]; then
|
|
69
|
-
# Modo fase — extrai files_modified de PLAN.md(s) da Phase $TARGET
|
|
70
|
-
PHASE_STATE=$(node "./.claude/framework/bin/tools.cjs" init phase-op "$TARGET")
|
|
71
|
-
PHASE_DIR=$(echo "$PHASE_STATE" | jq -r .phase_dir)
|
|
72
|
-
if [ "$PHASE_DIR" = "null" ] || [ ! -d "$PHASE_DIR" ]; then
|
|
73
|
-
echo "Fase $TARGET ainda não foi planejada."
|
|
74
|
-
exit 1
|
|
75
|
-
fi
|
|
76
|
-
TARGET_FILES=$(grep -rh "^ - " "$PHASE_DIR"/*-PLAN-*.md | grep -oE '[a-zA-Z0-9_/.-]+\.(ts|js|py|deno|sql)' | sort -u | tr '\n' ' ')
|
|
77
|
-
elif [ -d "$TARGET" ]; then
|
|
78
|
-
# Modo diretório — todos arquivos relevantes (.ts, .js, .py)
|
|
79
|
-
TARGET_FILES=$(find "$TARGET" -type f \( -name "*.ts" -o -name "*.js" -o -name "*.py" \) | tr '\n' ' ')
|
|
80
|
-
elif [ -f "$TARGET" ]; then
|
|
81
|
-
# Modo arquivo único
|
|
82
|
-
TARGET_FILES="$TARGET"
|
|
83
|
-
else
|
|
84
|
-
echo "Erro: target '$TARGET' não é arquivo, diretório ou número de fase válido."
|
|
85
|
-
exit 1
|
|
86
|
-
fi
|
|
87
|
-
|
|
88
|
-
if [ -z "$TARGET_FILES" ]; then
|
|
89
|
-
echo "Nenhum arquivo encontrado para target '$TARGET'."
|
|
90
|
-
exit 0
|
|
91
|
-
fi
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## 3. Dispatch para `golden-signals-instrumenter`
|
|
95
|
-
|
|
96
|
-
```text
|
|
97
|
-
Task(
|
|
98
|
-
subagent_type="golden-signals-instrumenter",
|
|
99
|
-
prompt="
|
|
100
|
-
target_files: ${TARGET_FILES}
|
|
101
|
-
${SERVICE:+service_name: ${SERVICE}}
|
|
102
|
-
${RUNTIME:+runtime: ${RUNTIME}}
|
|
103
|
-
${SATURATION:+saturation_resource: ${SATURATION}}
|
|
104
|
-
|
|
105
|
-
Aplicar skill four-golden-signals. Gerar patches OTel para os 4 signals em cada arquivo:
|
|
106
|
-
1. Latency: histogram com explicitBucketBoundaries exponencial, dimension result=success|error
|
|
107
|
-
2. Traffic: counter incrementado antes de processar request
|
|
108
|
-
3. Errors: counter por error_type enum (5-15 valores; NÃO error.message)
|
|
109
|
-
4. Saturation: ObservableGauge do recurso mais escasso (callback lê estado real)
|
|
110
|
-
|
|
111
|
-
Validar 6 checks no Step 3 do agent (latency separado success/error, error_type enum, etc.).
|
|
112
|
-
Output: tabela de patches gerados + GOLDEN-SIGNALS.md por target.
|
|
113
|
-
"
|
|
114
|
-
)
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
## 4. Pós-output
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
═══════════════════════════════════════════════════════════
|
|
121
|
-
framework ► GOLDEN-SIGNALS ▸ ${TARGET}
|
|
122
|
-
═══════════════════════════════════════════════════════════
|
|
123
|
-
|
|
124
|
-
[output do golden-signals-instrumenter — ver Step 4 do agent]
|
|
125
|
-
|
|
126
|
-
## Próximos passos
|
|
127
|
-
1. Smoke local — enviar request e verificar histogram/counter/gauge no backend OTel
|
|
128
|
-
2. Cross-ref: rodar `/instrumentar-fase ${TARGET}` se spans/wide events ainda ausentes (complementar)
|
|
129
|
-
3. Após validar baseline, definir SLO event-based: `/observabilidade slo <feature>`
|
|
130
|
-
4. PRR antes de production: `/prr --service ${SERVICE:-<name>}`
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
</process>
|
|
134
|
-
|
|
135
|
-
<success_criteria>
|
|
136
|
-
- [ ] `<target>` parseado de $ARGUMENTS (arquivo, diretório, ou número de fase)
|
|
137
|
-
- [ ] `target_files` resolvido para lista não-vazia (3 modos suportados)
|
|
138
|
-
- [ ] `golden-signals-instrumenter` invocado via `Task(subagent_type=...)`
|
|
139
|
-
- [ ] Patches aplicados em todos os arquivos do target (4 signals cada)
|
|
140
|
-
- [ ] Output forwarded transparentemente do agent (sem post-processing)
|
|
141
|
-
- [ ] Próximos passos sugerem cross-ref para `/instrumentar-fase`, `/observabilidade slo`, `/prr`
|
|
142
|
-
</success_criteria>
|
|
1
|
+
---
|
|
2
|
+
name: golden-signals
|
|
3
|
+
description: Invoca golden-signals-instrumenter para serviço/Edge Function/fase — instrumenta 4 golden signals OTel (Latency histogram, Traffic counter, Errors counter, Saturation gauge).
|
|
4
|
+
argument-hint: "<target> [--service <name>] [--saturation <resource>] [--runtime <node|deno|python>]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Bash
|
|
9
|
+
- Grep
|
|
10
|
+
- Glob
|
|
11
|
+
- Task
|
|
12
|
+
- AskUserQuestion
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<objective>
|
|
16
|
+
Instrumentar um serviço/Edge Function/fase com os **4 golden signals** do cap 6 do livro Google SRE — Latency (histogram bucketed), Traffic (counter), Errors (counter por `error.type`), Saturation (gauge resource-specific). Invoca o agente [`golden-signals-instrumenter`](../agents/golden-signals-instrumenter.md) que aplica a skill [`four-golden-signals`](../skills/four-golden-signals/SKILL.md).
|
|
17
|
+
|
|
18
|
+
**Cria/Atualiza:**
|
|
19
|
+
- Patches OTel nos arquivos do `<target>` (Latency + Traffic + Errors + Saturation)
|
|
20
|
+
- `GOLDEN-SIGNALS.md` por target com tabela de instrumentação aplicada (output do agent)
|
|
21
|
+
|
|
22
|
+
**Após:** os 4 signals estão instrumentados e o user pode rodar smoke local para verificar histogram/counter/gauge no backend OTel.
|
|
23
|
+
</objective>
|
|
24
|
+
|
|
25
|
+
<context>
|
|
26
|
+
**Argumentos:** `$ARGUMENTS` — primeiro token é o `<target>` (path de arquivo, diretório de service, ou número de fase como `38`); restante são flags.
|
|
27
|
+
|
|
28
|
+
**Flags:**
|
|
29
|
+
- `--service <name>` — nome canônico do serviço (default: deriva de `package.json#name` ou diretório)
|
|
30
|
+
- `--saturation <resource>` — recurso de saturation (`db_connection_pool` | `cache_memory` | `queue_depth` | `concurrency_limit` | `cpu_load` | `egress_bandwidth`); se omitido, agent infere via heurística
|
|
31
|
+
- `--runtime <node|deno|python>` — runtime; se omitido, detecta via `package.json`/`deno.json`/`pyproject.toml`
|
|
32
|
+
|
|
33
|
+
**Exemplos:**
|
|
34
|
+
```
|
|
35
|
+
/golden-signals src/orders/handler.ts # 1 arquivo
|
|
36
|
+
/golden-signals supabase/functions/process-emails # 1 Edge Function
|
|
37
|
+
/golden-signals 38 # todos os arquivos modificados pela Phase 38
|
|
38
|
+
/golden-signals src/api --service orders-api --saturation db_connection_pool
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Pré-requisito:** OTel SDK pode estar ausente — agent flagga deps necessárias no output. Caller decide instalar.
|
|
42
|
+
</context>
|
|
43
|
+
|
|
44
|
+
<process>
|
|
45
|
+
|
|
46
|
+
## 1. Parsear argumentos
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
TARGET=$(echo "$ARGUMENTS" | awk '{print $1}')
|
|
50
|
+
SERVICE=$(echo "$ARGUMENTS" | grep -oE -- '--service [^ ]+' | awk '{print $2}')
|
|
51
|
+
SATURATION=$(echo "$ARGUMENTS" | grep -oE -- '--saturation [^ ]+' | awk '{print $2}')
|
|
52
|
+
RUNTIME=$(echo "$ARGUMENTS" | grep -oE -- '--runtime [^ ]+' | awk '{print $2}')
|
|
53
|
+
|
|
54
|
+
if [ -z "$TARGET" ]; then
|
|
55
|
+
echo "Uso: /golden-signals <target> [--service N] [--saturation R] [--runtime RT]"
|
|
56
|
+
echo "Exemplos:"
|
|
57
|
+
echo " /golden-signals src/orders/handler.ts"
|
|
58
|
+
echo " /golden-signals supabase/functions/process-emails"
|
|
59
|
+
echo " /golden-signals 38 # todos arquivos da Phase 38"
|
|
60
|
+
exit 1
|
|
61
|
+
fi
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## 2. Resolver target → lista de target_files
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# PT-BR: 3 modos de resolução
|
|
68
|
+
if [[ "$TARGET" =~ ^[0-9]+$ ]]; then
|
|
69
|
+
# Modo fase — extrai files_modified de PLAN.md(s) da Phase $TARGET
|
|
70
|
+
PHASE_STATE=$(node "./.claude/framework/bin/tools.cjs" init phase-op "$TARGET")
|
|
71
|
+
PHASE_DIR=$(echo "$PHASE_STATE" | jq -r .phase_dir)
|
|
72
|
+
if [ "$PHASE_DIR" = "null" ] || [ ! -d "$PHASE_DIR" ]; then
|
|
73
|
+
echo "Fase $TARGET ainda não foi planejada."
|
|
74
|
+
exit 1
|
|
75
|
+
fi
|
|
76
|
+
TARGET_FILES=$(grep -rh "^ - " "$PHASE_DIR"/*-PLAN-*.md | grep -oE '[a-zA-Z0-9_/.-]+\.(ts|js|py|deno|sql)' | sort -u | tr '\n' ' ')
|
|
77
|
+
elif [ -d "$TARGET" ]; then
|
|
78
|
+
# Modo diretório — todos arquivos relevantes (.ts, .js, .py)
|
|
79
|
+
TARGET_FILES=$(find "$TARGET" -type f \( -name "*.ts" -o -name "*.js" -o -name "*.py" \) | tr '\n' ' ')
|
|
80
|
+
elif [ -f "$TARGET" ]; then
|
|
81
|
+
# Modo arquivo único
|
|
82
|
+
TARGET_FILES="$TARGET"
|
|
83
|
+
else
|
|
84
|
+
echo "Erro: target '$TARGET' não é arquivo, diretório ou número de fase válido."
|
|
85
|
+
exit 1
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
if [ -z "$TARGET_FILES" ]; then
|
|
89
|
+
echo "Nenhum arquivo encontrado para target '$TARGET'."
|
|
90
|
+
exit 0
|
|
91
|
+
fi
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 3. Dispatch para `golden-signals-instrumenter`
|
|
95
|
+
|
|
96
|
+
```text
|
|
97
|
+
Task(
|
|
98
|
+
subagent_type="golden-signals-instrumenter",
|
|
99
|
+
prompt="
|
|
100
|
+
target_files: ${TARGET_FILES}
|
|
101
|
+
${SERVICE:+service_name: ${SERVICE}}
|
|
102
|
+
${RUNTIME:+runtime: ${RUNTIME}}
|
|
103
|
+
${SATURATION:+saturation_resource: ${SATURATION}}
|
|
104
|
+
|
|
105
|
+
Aplicar skill four-golden-signals. Gerar patches OTel para os 4 signals em cada arquivo:
|
|
106
|
+
1. Latency: histogram com explicitBucketBoundaries exponencial, dimension result=success|error
|
|
107
|
+
2. Traffic: counter incrementado antes de processar request
|
|
108
|
+
3. Errors: counter por error_type enum (5-15 valores; NÃO error.message)
|
|
109
|
+
4. Saturation: ObservableGauge do recurso mais escasso (callback lê estado real)
|
|
110
|
+
|
|
111
|
+
Validar 6 checks no Step 3 do agent (latency separado success/error, error_type enum, etc.).
|
|
112
|
+
Output: tabela de patches gerados + GOLDEN-SIGNALS.md por target.
|
|
113
|
+
"
|
|
114
|
+
)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## 4. Pós-output
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
═══════════════════════════════════════════════════════════
|
|
121
|
+
framework ► GOLDEN-SIGNALS ▸ ${TARGET}
|
|
122
|
+
═══════════════════════════════════════════════════════════
|
|
123
|
+
|
|
124
|
+
[output do golden-signals-instrumenter — ver Step 4 do agent]
|
|
125
|
+
|
|
126
|
+
## Próximos passos
|
|
127
|
+
1. Smoke local — enviar request e verificar histogram/counter/gauge no backend OTel
|
|
128
|
+
2. Cross-ref: rodar `/instrumentar-fase ${TARGET}` se spans/wide events ainda ausentes (complementar)
|
|
129
|
+
3. Após validar baseline, definir SLO event-based: `/observabilidade slo <feature>`
|
|
130
|
+
4. PRR antes de production: `/prr --service ${SERVICE:-<name>}`
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
</process>
|
|
134
|
+
|
|
135
|
+
<success_criteria>
|
|
136
|
+
- [ ] `<target>` parseado de $ARGUMENTS (arquivo, diretório, ou número de fase)
|
|
137
|
+
- [ ] `target_files` resolvido para lista não-vazia (3 modos suportados)
|
|
138
|
+
- [ ] `golden-signals-instrumenter` invocado via `Task(subagent_type=...)`
|
|
139
|
+
- [ ] Patches aplicados em todos os arquivos do target (4 signals cada)
|
|
140
|
+
- [ ] Output forwarded transparentemente do agent (sem post-processing)
|
|
141
|
+
- [ ] Próximos passos sugerem cross-ref para `/instrumentar-fase`, `/observabilidade slo`, `/prr`
|
|
142
|
+
</success_criteria>
|