@luanpdd/kit-mcp 1.7.0 → 1.9.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 +101 -0
- package/README.md +39 -1
- package/gates/agent-no-recursive-dispatch.md +48 -0
- package/gates/budget-description.md +68 -0
- package/gates/no-personal-uuid.md +72 -0
- package/gates/obs-agents-mcp-supabase.md +86 -0
- package/gates/obs-skills-frontmatter.md +76 -0
- package/gates/omm-no-regression.md +83 -0
- package/gates/skill-must-include.md +71 -0
- package/gates/sync-idempotent.md +62 -0
- package/kit/agents/burn-rate-forecaster.md +160 -0
- package/kit/agents/codebase-mapper.md +1 -1
- package/kit/agents/executor.md +17 -0
- package/kit/agents/incident-investigator.md +245 -0
- package/kit/agents/observability-instrumenter.md +200 -0
- package/kit/agents/omm-auditor.md +199 -0
- package/kit/agents/planner.md +35 -0
- package/kit/agents/project-researcher.md +1 -1
- package/kit/agents/schema-checker.md +4 -4
- package/kit/agents/slo-engineer.md +224 -0
- package/kit/agents/supabase-architect.md +166 -0
- package/kit/agents/supabase-auth-bootstrapper.md +315 -0
- package/kit/agents/supabase-edge-fn-writer.md +207 -0
- package/kit/agents/supabase-migration-writer.md +174 -0
- package/kit/agents/supabase-realtime-implementer.md +275 -0
- package/kit/agents/supabase-rls-writer.md +235 -0
- package/kit/agents/supabase-storage-implementer.md +258 -0
- package/kit/agents/user-profiler.md +1 -1
- package/kit/agents/verifier.md +1 -1
- package/kit/commands/auditar-marco.md +22 -1
- package/kit/commands/auditar-observabilidade.md +103 -0
- package/kit/commands/burn-rate-status.md +140 -0
- package/kit/commands/concluir-marco.md +19 -1
- package/kit/commands/definir-slo.md +108 -0
- package/kit/commands/depurar.md +17 -0
- package/kit/commands/discutir-fase.md +26 -0
- package/kit/commands/fazer.md +15 -0
- package/kit/commands/forense.md +20 -1
- package/kit/commands/instrumentar-fase.md +200 -0
- package/kit/commands/investigar-producao.md +162 -0
- package/kit/commands/observabilidade.md +116 -0
- package/kit/commands/planejar-fase.md +20 -0
- package/kit/commands/supabase.md +148 -0
- package/kit/commands/verificar-trabalho.md +26 -0
- package/kit/framework/workflows/discuss-phase.md +19 -0
- package/kit/framework/workflows/plan-phase.md +25 -0
- package/kit/skills/_shared-observability/glossary.md +396 -0
- package/kit/skills/_shared-supabase/glossary.md +180 -0
- package/kit/skills/burn-rate-alerting/SKILL.md +258 -0
- package/kit/skills/core-analysis-loop/SKILL.md +352 -0
- package/kit/skills/distributed-tracing/SKILL.md +362 -0
- package/kit/skills/event-based-slos/SKILL.md +274 -0
- package/kit/skills/observability-driven-development/SKILL.md +315 -0
- package/kit/skills/observability-maturity-model/SKILL.md +222 -0
- package/kit/skills/opentelemetry-standard/SKILL.md +351 -0
- package/kit/skills/structured-events/SKILL.md +265 -0
- package/kit/skills/supabase-auth-ssr/SKILL.md +260 -0
- package/kit/skills/supabase-cron-queues/SKILL.md +266 -0
- package/kit/skills/supabase-database-functions/SKILL.md +247 -0
- package/kit/skills/supabase-declarative-schema/SKILL.md +183 -0
- package/kit/skills/supabase-edge-functions/SKILL.md +242 -0
- package/kit/skills/supabase-migrations/SKILL.md +175 -0
- package/kit/skills/supabase-pgvector-rag/SKILL.md +253 -0
- package/kit/skills/supabase-postgres-style/SKILL.md +138 -0
- package/kit/skills/supabase-realtime/SKILL.md +236 -0
- package/kit/skills/supabase-rls-policies/SKILL.md +185 -0
- package/kit/skills/supabase-storage/SKILL.md +234 -0
- package/kit/skills/telemetry-pipelines/SKILL.md +259 -0
- package/kit/skills/telemetry-sampling/SKILL.md +256 -0
- package/package.json +1 -1
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: supabase-storage-implementer
|
|
3
|
+
description: Configura Supabase Storage — buckets públicos vs privados, signed URLs, RLS sobre storage.objects com path multi-tenant, image transforms, alerta egress.
|
|
4
|
+
tools: Read, Write, Edit, Bash, Grep, Glob, mcp__supabase__execute_sql
|
|
5
|
+
color: orange
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Você é o storage-implementer Supabase. Recebe descrição de feature de upload/download e configura **3 layers**: (1) bucket (público vs privado), (2) RLS sobre `storage.objects` com path multi-tenant, (3) código client-side de upload/signed URL.
|
|
9
|
+
|
|
10
|
+
## Compatibilidade
|
|
11
|
+
|
|
12
|
+
| IDE | Tier | Capability |
|
|
13
|
+
|---|---|---|
|
|
14
|
+
| Claude Code (com Supabase MCP) | **Full** | Aplica RLS via `mcp__supabase__execute_sql` |
|
|
15
|
+
| Cursor (com Supabase MCP) | **Full** | Idem |
|
|
16
|
+
| Codex | **Partial** | Escreve SQL em migration; user aplica manualmente |
|
|
17
|
+
| Gemini CLI | **Partial** | Idem |
|
|
18
|
+
| Windsurf, Antigravity, Copilot, Trae | **Offline-only** | Apenas escreve SQL + código client; user aplica |
|
|
19
|
+
|
|
20
|
+
## Por que existe
|
|
21
|
+
|
|
22
|
+
Storage parece simples mas tem armadilhas: bucket privado sem RLS = qualquer authenticated lê tudo; path sem tenant prefix = users sobrescrevem arquivos uns dos outros; egress sem cache = custo explode em produção. Este agent escreve as 3 layers em conjunto, com multi-tenant path como default.
|
|
23
|
+
|
|
24
|
+
## Inputs esperados (do caller)
|
|
25
|
+
|
|
26
|
+
- `feature_name`: descrição (ex: "avatar de usuário", "documentos privados", "imagens de perfil públicas")
|
|
27
|
+
- `bucket_name`: nome do bucket (kebab-case, ex: `private-uploads`, `public-avatars`)
|
|
28
|
+
- `privacy`: `private` (default) | `public`
|
|
29
|
+
- `tenant_pattern`: `per_user` (default — `<auth.uid()>/<file>`) | `per_org` (`<org_id>/<file>`) | `none` (apenas public buckets)
|
|
30
|
+
- (Opcional) `image_transforms`: `true` para habilitar transformations (Pro+ plan)
|
|
31
|
+
- (Opcional) `max_file_size_mb`: 6 (default — limite normal); se > 6, configura TUS
|
|
32
|
+
|
|
33
|
+
## Passos
|
|
34
|
+
|
|
35
|
+
### Step 0 — Preflight
|
|
36
|
+
|
|
37
|
+
Detectar MCP. Se indisponível, modo offline.
|
|
38
|
+
|
|
39
|
+
### Step 1 — Decidir privacy + alert
|
|
40
|
+
|
|
41
|
+
Default: `private`. Se caller pede `public`, alerte sobre egress:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
⚠ Bucket público — atenção a egress billing.
|
|
45
|
+
|
|
46
|
+
Cada download é cobrado. Para reduzir custo:
|
|
47
|
+
- cacheControl alto no upload (1 ano para assets imutáveis)
|
|
48
|
+
- versionar arquivos (hero-v2.jpg) em vez de overwrite (CDN cache stale)
|
|
49
|
+
- considerar Smart CDN configurado
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Step 2 — Criar bucket (live mode)
|
|
53
|
+
|
|
54
|
+
**Live mode (com MCP):**
|
|
55
|
+
|
|
56
|
+
```sql
|
|
57
|
+
-- via execute_sql
|
|
58
|
+
insert into storage.buckets (id, name, public, file_size_limit, allowed_mime_types)
|
|
59
|
+
values (
|
|
60
|
+
'<bucket_name>',
|
|
61
|
+
'<bucket_name>',
|
|
62
|
+
<true|false>, -- public flag
|
|
63
|
+
<max_file_size_mb> * 1024 * 1024, -- bytes
|
|
64
|
+
null -- ou array de mime types: '{image/jpeg,image/png}'::text[]
|
|
65
|
+
);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Offline mode:** instrua user a criar via Dashboard ou CLI:
|
|
69
|
+
```
|
|
70
|
+
1. Dashboard: Storage → New bucket → <bucket_name> → toggle public conforme needed
|
|
71
|
+
2. ou: supabase storage create <bucket_name>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Step 3 — RLS sobre `storage.objects` (apenas privado)
|
|
75
|
+
|
|
76
|
+
Para buckets privados com `tenant_pattern=per_user`:
|
|
77
|
+
|
|
78
|
+
```sql
|
|
79
|
+
-- 4 policies granulares + multi-tenant path isolation
|
|
80
|
+
create policy "<bucket>_users_read_own"
|
|
81
|
+
on storage.objects for select to authenticated
|
|
82
|
+
using (
|
|
83
|
+
bucket_id = '<bucket_name>'
|
|
84
|
+
and (storage.foldername(name))[1] = (select auth.uid())::text
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
create policy "<bucket>_users_insert_own"
|
|
88
|
+
on storage.objects for insert to authenticated
|
|
89
|
+
with check (
|
|
90
|
+
bucket_id = '<bucket_name>'
|
|
91
|
+
and (storage.foldername(name))[1] = (select auth.uid())::text
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
create policy "<bucket>_users_update_own"
|
|
95
|
+
on storage.objects for update to authenticated
|
|
96
|
+
using (
|
|
97
|
+
bucket_id = '<bucket_name>'
|
|
98
|
+
and (storage.foldername(name))[1] = (select auth.uid())::text
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
create policy "<bucket>_users_delete_own"
|
|
102
|
+
on storage.objects for delete to authenticated
|
|
103
|
+
using (
|
|
104
|
+
bucket_id = '<bucket_name>'
|
|
105
|
+
and (storage.foldername(name))[1] = (select auth.uid())::text
|
|
106
|
+
);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Para `tenant_pattern=per_org`, troque `(select auth.uid())::text` por extração de `org_id` do JWT:
|
|
110
|
+
```sql
|
|
111
|
+
and (storage.foldername(name))[1] = any(
|
|
112
|
+
array(select jsonb_array_elements_text((select auth.jwt()->'app_metadata'->'orgs')))
|
|
113
|
+
)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Step 4 — Código client (upload)
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
// PT-BR: upload com path multi-tenant
|
|
120
|
+
import { createClient } from '@/utils/supabase/client'
|
|
121
|
+
|
|
122
|
+
export async function upload<Feature>(file: File, filename: string) {
|
|
123
|
+
const supabase = createClient()
|
|
124
|
+
const { data: { user } } = await supabase.auth.getUser()
|
|
125
|
+
if (!user) throw new Error('not authenticated')
|
|
126
|
+
|
|
127
|
+
// PT-BR: path = <user.id>/<filename> (multi-tenant isolation)
|
|
128
|
+
const path = `${user.id}/${filename}`
|
|
129
|
+
|
|
130
|
+
const { data, error } = await supabase.storage
|
|
131
|
+
.from('<bucket_name>')
|
|
132
|
+
.upload(path, file, {
|
|
133
|
+
cacheControl: <privacy === 'public' ? '31536000' : '3600'>,
|
|
134
|
+
upsert: true,
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
if (error) throw error
|
|
138
|
+
return data.path
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Step 5 — Código client (signed URL para privado)
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
export async function getSigned<Feature>Url(path: string, expiresIn = 3600) {
|
|
146
|
+
const supabase = createClient()
|
|
147
|
+
const { data, error } = await supabase.storage
|
|
148
|
+
.from('<bucket_name>')
|
|
149
|
+
.createSignedUrl(path, expiresIn)
|
|
150
|
+
if (error) throw error
|
|
151
|
+
return data.signedUrl
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Step 6 — Image transforms (se habilitado)
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
// PT-BR: signed URL com transformação inline (Pro+ plan)
|
|
159
|
+
const { data } = await supabase.storage
|
|
160
|
+
.from('<bucket_name>')
|
|
161
|
+
.createSignedUrl(`${user.id}/avatar.jpg`, 3600, {
|
|
162
|
+
transform: { width: 200, height: 200, resize: 'cover' },
|
|
163
|
+
})
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Step 7 — TUS resumable (se max_file_size_mb > 6)
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
import * as tus from 'npm:tus-js-client'
|
|
170
|
+
|
|
171
|
+
export async function uploadLarge(file: File, path: string) {
|
|
172
|
+
const supabase = createClient()
|
|
173
|
+
const { data, error } = await supabase.storage
|
|
174
|
+
.from('<bucket_name>')
|
|
175
|
+
.createSignedUploadUrl(path)
|
|
176
|
+
if (error) throw error
|
|
177
|
+
|
|
178
|
+
return new Promise((resolve, reject) => {
|
|
179
|
+
const upload = new tus.Upload(file, {
|
|
180
|
+
endpoint: data.signedUrl,
|
|
181
|
+
headers: { authorization: `Bearer ${data.token}` },
|
|
182
|
+
chunkSize: 6 * 1024 * 1024, // 6 MB chunks
|
|
183
|
+
onError: reject,
|
|
184
|
+
onSuccess: () => resolve(upload.url),
|
|
185
|
+
})
|
|
186
|
+
upload.start()
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Step 8 — Output
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
═══════════════════════════════════════════════════════════
|
|
195
|
+
STORAGE IMPLEMENTATION · <feature_name>
|
|
196
|
+
═══════════════════════════════════════════════════════════
|
|
197
|
+
|
|
198
|
+
Bucket: <bucket_name> (<privacy>)
|
|
199
|
+
Tenant pattern: <per_user | per_org>
|
|
200
|
+
Max file size: <max_mb> MB <(TUS habilitado se > 6)>
|
|
201
|
+
|
|
202
|
+
═══════════════════════════════════════════════════════════
|
|
203
|
+
3 LAYERS GERADAS
|
|
204
|
+
═══════════════════════════════════════════════════════════
|
|
205
|
+
|
|
206
|
+
Layer 1 — Bucket creation:
|
|
207
|
+
<SQL para storage.buckets ou instrução Dashboard>
|
|
208
|
+
|
|
209
|
+
Layer 2 — RLS sobre storage.objects (granular + multi-tenant path):
|
|
210
|
+
<SQL com 4 policies>
|
|
211
|
+
|
|
212
|
+
Layer 3 — Client code (upload + signed URL):
|
|
213
|
+
<code TS>
|
|
214
|
+
|
|
215
|
+
═══════════════════════════════════════════════════════════
|
|
216
|
+
ALERTAS
|
|
217
|
+
═══════════════════════════════════════════════════════════
|
|
218
|
+
- <egress alert se public>
|
|
219
|
+
- <image transforms requer Pro+ plan>
|
|
220
|
+
- <TUS para uploads > 6 MB se aplicável>
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Anti-patterns prevenidos
|
|
224
|
+
|
|
225
|
+
- Path sem tenant prefix → SEMPRE `<auth.uid()>/<file>`
|
|
226
|
+
- Bucket privado sem RLS → SEMPRE 4 policies granulares
|
|
227
|
+
- `getPublicUrl` em bucket privado → SEMPRE `createSignedUrl` em código
|
|
228
|
+
- Overwrite de arquivo público → ALERTA + sugestão de versionamento
|
|
229
|
+
- Upload > 6 MB sem TUS → SEMPRE configura TUS quando applicable
|
|
230
|
+
|
|
231
|
+
## Notas de futuro
|
|
232
|
+
|
|
233
|
+
- **Vector Buckets / Analytics Buckets** ainda alpha em 2026-05-06 — não detalhar
|
|
234
|
+
- **Smart CDN** para egress optimization — fora deste agent (config no Dashboard)
|
|
235
|
+
|
|
236
|
+
## Observabilidade integrada
|
|
237
|
+
|
|
238
|
+
Upload events são quentes em custo (egress + storage) e em UX (lentidão de upload = abandono). Instrumentar SEMPRE.
|
|
239
|
+
|
|
240
|
+
1. **Span por upload/download** (skill [`structured-events`](../skills/structured-events/SKILL.md)) com atributos:
|
|
241
|
+
- `bucket.name`, `bucket.public` (bool)
|
|
242
|
+
- `file.size_bytes`, `file.mime_type`, `file.path`
|
|
243
|
+
- `operation`: `upload` | `download` | `signed_url` | `delete`
|
|
244
|
+
- `result.success`, `error.type` (enum: `quota_exceeded`, `unauthorized`, `mime_blocked`, `size_exceeded`, `network`)
|
|
245
|
+
- `duration_ms`, `transfer.bytes_per_second` (calculado)
|
|
246
|
+
- `user.id`, `tenant_id` (do `auth.uid()`)
|
|
247
|
+
2. **Sampling** (skill [`telemetry-sampling`](../skills/telemetry-sampling/SKILL.md) *Phase 34*): 100% errors, 100% uploads > 10 MB (cardinalidade baixa, valor alto), 5% baseline para downloads pequenos (alto volume).
|
|
248
|
+
3. **Audit log** para uploads em buckets sensíveis (`audit_log` table com `actor`, `op`, `resource`, `geo`, `user_agent`).
|
|
249
|
+
|
|
250
|
+
**Output adicionado:** seção "## Observability hooks" com snippet de upload/download wrapper.
|
|
251
|
+
|
|
252
|
+
## Ver também
|
|
253
|
+
|
|
254
|
+
- [supabase-storage](../skills/supabase-storage/SKILL.md) — base de conhecimento canônica
|
|
255
|
+
- [supabase-rls-writer](./supabase-rls-writer.md) — invocar para policies adicionais
|
|
256
|
+
- [supabase-auth-ssr](../skills/supabase-auth-ssr/SKILL.md) — usuário autenticado obtém `auth.uid()`
|
|
257
|
+
- [structured-events](../skills/structured-events/SKILL.md) — campos canônicos para upload/download events
|
|
258
|
+
- [telemetry-sampling](../skills/telemetry-sampling/SKILL.md) *(Phase 34)* — head-based sampling por size_bytes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: user-profiler
|
|
3
|
-
description: Analisa
|
|
3
|
+
description: Analisa sessões em 8 dimensões comportamentais para produzir perfil do dev pontuado com confiança e evidências. Invocado por workflows de orquestração de perfil.
|
|
4
4
|
tools: Read
|
|
5
5
|
color: magenta
|
|
6
6
|
---
|
package/kit/agents/verifier.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: verifier
|
|
3
|
-
description: Verifica
|
|
3
|
+
description: Verifica atingimento do objetivo da fase via análise reversa. Checa se codebase entrega o prometido, não só task completion. Cria VERIFICATION.md.
|
|
4
4
|
tools: Read, Write, Bash, Grep, Glob
|
|
5
5
|
color: green
|
|
6
6
|
# hooks:
|
|
@@ -33,4 +33,25 @@ Glob: .planning/phases/*/*-VERIFICATION.md
|
|
|
33
33
|
<process>
|
|
34
34
|
Execute o workflow audit-milestone de @./.claude/framework/workflows/audit-milestone.md do início ao fim.
|
|
35
35
|
Preserve todos os checkpoints do workflow (determinação de escopo, leitura de verificações, checagem de integração, cobertura de requisitos, roteamento).
|
|
36
|
-
</process>
|
|
36
|
+
</process>
|
|
37
|
+
|
|
38
|
+
<observability_integration>
|
|
39
|
+
**OMM scoring (v1.9 — INT-FW-04):**
|
|
40
|
+
|
|
41
|
+
Quando `workflow.audit_milestone_omm = true` (default), o workflow inclui passo OMM scoring:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
Skill(skill="framework:auditar-observabilidade")
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
O comando `/auditar-observabilidade` invoca o agente [`omm-auditor`](../agents/omm-auditor.md) que pontua as 5 capacidades (resiliência, qualidade, complexidade, cadência, comportamento) contra o marco anterior. O OMM-REPORT.md gerado é incluído como anexo no MILESTONE-AUDIT.md.
|
|
48
|
+
|
|
49
|
+
Resultado de regression OMM:
|
|
50
|
+
- **0 regressions:** audit aprovado
|
|
51
|
+
- **1+ regressions, blocking=false:** warn explícito; audit aprovado com nota
|
|
52
|
+
- **1+ regressions, blocking=true (`workflow.omm_no_regression=true`):** audit fail → user escolha entre fix lacunas ou aceitar
|
|
53
|
+
|
|
54
|
+
Skill consultada: [`observability-maturity-model`](../skills/observability-maturity-model/SKILL.md).
|
|
55
|
+
|
|
56
|
+
**REQ:** INT-FW-04.
|
|
57
|
+
</observability_integration>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: auditar-observabilidade
|
|
3
|
+
description: Invoca omm-auditor para gerar OMM-REPORT.md scored. 5 capacidades com trend vs marco anterior. Action items priorizados P0-P3.
|
|
4
|
+
argument-hint: "[--previous <marco>] [--ci]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Bash
|
|
9
|
+
- Task
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<objective>
|
|
13
|
+
Gerar OMM-REPORT.md com snapshot scored das 5 capacidades de observabilidade. Aplica skill [`observability-maturity-model`](../skills/observability-maturity-model/SKILL.md) — sintomas qualitativos doing well/poorly por capacidade.
|
|
14
|
+
|
|
15
|
+
**Cria/Atualiza:**
|
|
16
|
+
- `.planning/OMM-REPORT.md` — snapshot atual
|
|
17
|
+
- (Em `/concluir-marco`) `.planning/milestones/<v>/OMM-REPORT.md` — snapshot arquivado
|
|
18
|
+
|
|
19
|
+
**Após:** time tem 5 scores + trend + action items priorizados.
|
|
20
|
+
</objective>
|
|
21
|
+
|
|
22
|
+
<context>
|
|
23
|
+
**Argumentos:** `$ARGUMENTS`
|
|
24
|
+
|
|
25
|
+
**Flags:**
|
|
26
|
+
- `--previous <marco>` — comparar com marco específico (default: detecta automaticamente do MILESTONES.md)
|
|
27
|
+
- `--ci` — modo CI: exit code 0 se OK, 1 se regression em qualquer capacidade
|
|
28
|
+
|
|
29
|
+
**Quando rodar:**
|
|
30
|
+
- Manualmente para snapshot informal
|
|
31
|
+
- Em `/auditar-marco` (audit pre-conclusion) — Phase 35 INT-FW-04
|
|
32
|
+
- Em `/concluir-marco` (gate de regression) — Phase 35 INT-FW-05
|
|
33
|
+
</context>
|
|
34
|
+
|
|
35
|
+
<process>
|
|
36
|
+
|
|
37
|
+
## 1. Parsear argumentos
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
PREVIOUS=$(echo "$ARGUMENTS" | grep -oE -- '--previous [^ ]+' | awk '{print $2}')
|
|
41
|
+
CI_MODE=$(echo "$ARGUMENTS" | grep -c -- '--ci' || true)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 2. Detectar previous milestone
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
if [ -z "$PREVIOUS" ]; then
|
|
48
|
+
# PT-BR: extrair último concluído de MILESTONES.md
|
|
49
|
+
PREVIOUS=$(grep -E '^### v[0-9.]+\b' .planning/MILESTONES.md | head -2 | tail -1 | grep -oE 'v[0-9.]+')
|
|
50
|
+
fi
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 3. Dispatch para `omm-auditor`
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
Task(
|
|
57
|
+
subagent_type="omm-auditor",
|
|
58
|
+
prompt="
|
|
59
|
+
${PREVIOUS:+previous_milestone: ${PREVIOUS}}
|
|
60
|
+
mode: ${CI_MODE:+ci}snapshot
|
|
61
|
+
|
|
62
|
+
Gerar OMM-REPORT.md com:
|
|
63
|
+
1. Score 1-5 por capacidade (5 capacidades)
|
|
64
|
+
2. Trend vs ${PREVIOUS:-último marco}
|
|
65
|
+
3. Action items priorizados P0-P3
|
|
66
|
+
4. Regression alerts (se alguma capacidade regrediu)
|
|
67
|
+
5. Comparação por marco
|
|
68
|
+
"
|
|
69
|
+
)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 4. Pós-output
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
═══════════════════════════════════════════════════════════
|
|
76
|
+
framework ► AUDITAR-OBSERVABILIDADE
|
|
77
|
+
═══════════════════════════════════════════════════════════
|
|
78
|
+
|
|
79
|
+
[output do omm-auditor — snapshot inline]
|
|
80
|
+
|
|
81
|
+
OMM-REPORT.md: .planning/OMM-REPORT.md
|
|
82
|
+
|
|
83
|
+
${CI_MODE:+## CI Mode}
|
|
84
|
+
${CI_MODE:+Exit code: 0 (OK) / 1 (regression detectada)}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 5. Modo `--ci`
|
|
88
|
+
|
|
89
|
+
Se `--ci` setado:
|
|
90
|
+
- Parse OMM-REPORT.md para detectar regression alerts
|
|
91
|
+
- Se ≥ 1 regression → exit 1 (CI fails)
|
|
92
|
+
- Senão → exit 0 (OK)
|
|
93
|
+
|
|
94
|
+
</process>
|
|
95
|
+
|
|
96
|
+
<success_criteria>
|
|
97
|
+
- [ ] omm-auditor invocado via Task
|
|
98
|
+
- [ ] OMM-REPORT.md gerado em `.planning/OMM-REPORT.md`
|
|
99
|
+
- [ ] 5 capacidades scored
|
|
100
|
+
- [ ] Trend calculado vs `--previous` ou auto-detectado
|
|
101
|
+
- [ ] Action items P0-P3 listados
|
|
102
|
+
- [ ] Modo `--ci` exit code apropriado se regression
|
|
103
|
+
</success_criteria>
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: burn-rate-status
|
|
3
|
+
description: Tabela de burn rate por SLO — % budget gasto, ETA exhaustão, ação (page/ticket/warn/ok). Rodável manualmente ou em /loop. Aplica skill burn-rate-alerting.
|
|
4
|
+
argument-hint: "[<slo_name>] [--lookahead 4h] [--baseline 1h]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Bash
|
|
8
|
+
- Task
|
|
9
|
+
- Glob
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<objective>
|
|
13
|
+
Snapshot de burn rate para 1 SLO (se especificado) ou TODOS os SLOs definidos. Aplica skill [`burn-rate-alerting`](../skills/burn-rate-alerting/SKILL.md) — fórmula `burn_rate = error_rate / (1 - target)`, lookahead ≤ 4× baseline.
|
|
14
|
+
|
|
15
|
+
**Cria/Atualiza:** nada — comando read-only.
|
|
16
|
+
|
|
17
|
+
**Após:** o user vê tabela com status (PAGE / TICKET / WARN / OK) e pode escolher invocar `/investigar-producao` se há burn ativo.
|
|
18
|
+
</objective>
|
|
19
|
+
|
|
20
|
+
<context>
|
|
21
|
+
**Argumentos:** `$ARGUMENTS` — opcional `<slo_name>` para 1 SLO; sem args = todos.
|
|
22
|
+
|
|
23
|
+
**Flags:**
|
|
24
|
+
- `--lookahead <duration>` — janela predictive (default: `4h` para short-term)
|
|
25
|
+
- `--baseline <duration>` — janela base (default: `1h`)
|
|
26
|
+
- `--format <table|json>` — output format (default: `table`)
|
|
27
|
+
|
|
28
|
+
**Combinações canônicas:**
|
|
29
|
+
- short-term: lookahead 4h, baseline 1h (page-tier)
|
|
30
|
+
- long-term: lookahead 3d, baseline 18h (ticket-tier)
|
|
31
|
+
|
|
32
|
+
**Loop pattern:** rodar este comando via skill `loop` com intervalo 5min para monitoramento contínuo.
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
/loop 5m /burn-rate-status
|
|
36
|
+
```
|
|
37
|
+
</context>
|
|
38
|
+
|
|
39
|
+
<process>
|
|
40
|
+
|
|
41
|
+
## 1. Parsear argumentos
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
SLO_NAME=$(echo "$ARGUMENTS" | awk '{print $1}' | grep -v '^--' || true)
|
|
45
|
+
LOOKAHEAD=$(echo "$ARGUMENTS" | grep -oE -- '--lookahead [^ ]+' | awk '{print $2}')
|
|
46
|
+
BASELINE=$(echo "$ARGUMENTS" | grep -oE -- '--baseline [^ ]+' | awk '{print $2}')
|
|
47
|
+
FORMAT=$(echo "$ARGUMENTS" | grep -oE -- '--format [^ ]+' | awk '{print $2}')
|
|
48
|
+
|
|
49
|
+
[ -z "$LOOKAHEAD" ] && LOOKAHEAD="4h"
|
|
50
|
+
[ -z "$BASELINE" ] && BASELINE="1h"
|
|
51
|
+
[ -z "$FORMAT" ] && FORMAT="table"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 2. Listar SLOs
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
if [ -n "$SLO_NAME" ]; then
|
|
58
|
+
SLO_FILES=(".planning/slos/${SLO_NAME}.md")
|
|
59
|
+
else
|
|
60
|
+
SLO_FILES=(.planning/slos/*.md)
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
if [ ${#SLO_FILES[@]} -eq 0 ] || [ ! -f "${SLO_FILES[0]}" ]; then
|
|
64
|
+
echo "Nenhum SLO definido. Rode /definir-slo <feature> primeiro."
|
|
65
|
+
exit 0
|
|
66
|
+
fi
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 3. Para cada SLO, dispatch para `burn-rate-forecaster`
|
|
70
|
+
|
|
71
|
+
Para cada `SLO_FILE`:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
SLO_NAME=$(basename "$SLO_FILE" .md)
|
|
75
|
+
TARGET=$(grep -oE 'Target.*[0-9.]+' "$SLO_FILE" | head -1 | grep -oE '[0-9.]+')
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
Task(
|
|
80
|
+
subagent_type="burn-rate-forecaster",
|
|
81
|
+
prompt="
|
|
82
|
+
slo_name: ${SLO_NAME}
|
|
83
|
+
target: ${TARGET}
|
|
84
|
+
lookahead: ${LOOKAHEAD}
|
|
85
|
+
baseline: ${BASELINE}
|
|
86
|
+
|
|
87
|
+
Calcular burn rate atual + ETA + status (PAGE/TICKET/WARN/OK).
|
|
88
|
+
Output formato compatível com tabela mestra.
|
|
89
|
+
"
|
|
90
|
+
)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 4. Agregar resultados em tabela
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
═══════════════════════════════════════════════════════════
|
|
97
|
+
framework ► BURN-RATE-STATUS ▸ {timestamp}
|
|
98
|
+
═══════════════════════════════════════════════════════════
|
|
99
|
+
|
|
100
|
+
| SLO | Target | Window | Budget gasto | Burn rate | ETA exhaustão | Status | Ação |
|
|
101
|
+
|---|---|---|---|---|---|---|---|
|
|
102
|
+
| checkout_success | 99.9% | 30d | 23% | 1.4× | 12d | OK | informativo |
|
|
103
|
+
| login_success | 99.95% | 30d | 78% | 8.0× | 4h | **PAGE** | invocar /investigar-producao |
|
|
104
|
+
| search_latency | 99% | 30d | 15% | 0.7× | — | OK | — |
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## 5. Sugerir próximas ações
|
|
108
|
+
|
|
109
|
+
Se algum SLO em status PAGE ou TICKET:
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
## ⚠ SLOs em alerta:
|
|
113
|
+
1. login_success — burn rate 8.0×, ETA 4h
|
|
114
|
+
→ /investigar-producao "login_success burn rate = 8.0× às {timestamp}"
|
|
115
|
+
|
|
116
|
+
## SLOs em WARN (>= 80% gasto):
|
|
117
|
+
- (nenhum)
|
|
118
|
+
|
|
119
|
+
## SLOs OK:
|
|
120
|
+
- 2 SLOs em compliance saudável
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## 6. Modo `/loop`
|
|
124
|
+
|
|
125
|
+
Se chamado dentro de `/loop`, comportamento idempotente:
|
|
126
|
+
- Não acumular state entre invocações (snapshot fresh)
|
|
127
|
+
- Output curto se nada mudou (apenas status; sem repetir tabela completa em todo loop)
|
|
128
|
+
- Acionar AskUserQuestion APENAS quando status muda de OK → WARN/TICKET/PAGE (transição)
|
|
129
|
+
|
|
130
|
+
</process>
|
|
131
|
+
|
|
132
|
+
<success_criteria>
|
|
133
|
+
- [ ] $ARGUMENTS parseados (SLO opcional + flags)
|
|
134
|
+
- [ ] SLOs descobertos via glob `.planning/slos/*.md`
|
|
135
|
+
- [ ] `burn-rate-forecaster` invocado para cada SLO
|
|
136
|
+
- [ ] Tabela agregada em formato consistente
|
|
137
|
+
- [ ] Status enum: PAGE / TICKET / WARN / OK
|
|
138
|
+
- [ ] Sugestões de próximas ações para SLOs em alerta
|
|
139
|
+
- [ ] Idempotente (rodável em /loop sem acúmulo)
|
|
140
|
+
</success_criteria>
|
|
@@ -133,4 +133,22 @@ Saída: Milestone arquivado (roadmap + requisitos), PROJECT.md evoluído, tag gi
|
|
|
133
133
|
- **Resumo de uma linha:** Milestone colapsado no ROADMAP.md deve ser uma única linha com link
|
|
134
134
|
- **Eficiência de contexto:** Arquivo mantém ROADMAP.md e REQUIREMENTS.md com tamanho constante por milestone
|
|
135
135
|
- **Novos requisitos:** Próximo milestone começa com `/novo-marco` que inclui definição de requisitos
|
|
136
|
-
</critical_rules>
|
|
136
|
+
</critical_rules>
|
|
137
|
+
|
|
138
|
+
<observability_integration>
|
|
139
|
+
**OMM no-regression gate (v1.9 — INT-FW-05):**
|
|
140
|
+
|
|
141
|
+
Quando `workflow.complete_milestone_omm_gate = true` (default), o workflow inclui passo OMM regression check antes de arquivar:
|
|
142
|
+
|
|
143
|
+
1. Procurar `.planning/OMM-REPORT.md` atual. Se ausente: rodar `/auditar-observabilidade` primeiro.
|
|
144
|
+
2. Comparar scores das 5 capacidades com `.planning/milestones/<previous>/OMM-REPORT.md`.
|
|
145
|
+
3. Se alguma capacidade regrediu E `workflow.omm_no_regression = true`: BLOQUEAR conclusion.
|
|
146
|
+
4. Se regression detectada mas `workflow.omm_no_regression = false`: WARN explícito; user decide entre aceitar ou pausar.
|
|
147
|
+
5. OMM-REPORT.md final é arquivado em `.planning/milestones/v<version>/OMM-REPORT.md`.
|
|
148
|
+
|
|
149
|
+
Gate executável: `gates/omm-no-regression.md`.
|
|
150
|
+
|
|
151
|
+
Skill consultada: [`observability-maturity-model`](../skills/observability-maturity-model/SKILL.md).
|
|
152
|
+
|
|
153
|
+
**REQ:** INT-FW-05.
|
|
154
|
+
</observability_integration>
|
|
@@ -0,0 +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>
|