spec-first-copilot 0.6.0-beta.9 → 0.7.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 +252 -167
- package/bin/cli.js +70 -70
- package/lib/init.js +92 -92
- package/lib/update.js +132 -132
- package/package.json +1 -1
- package/templates/.ai/memory/napkin.md +68 -68
- package/templates/.github/CHANGELOG.md +121 -0
- package/templates/.github/adapters/SETUP.md +314 -314
- package/templates/.github/adapters/confluence.md +295 -295
- package/templates/.github/adapters/errors.md +234 -234
- package/templates/.github/adapters/filesystem.md +353 -353
- package/templates/.github/adapters/interface.md +301 -301
- package/templates/.github/adapters/naming.md +241 -241
- package/templates/.github/adapters/registry.md +244 -244
- package/templates/.github/agents/backend-coder.md +14 -14
- package/templates/.github/agents/db-coder.md +165 -165
- package/templates/.github/agents/doc-writer.md +66 -53
- package/templates/.github/agents/frontend-coder.md +5 -5
- package/templates/.github/agents/infra-coder.md +341 -341
- package/templates/.github/agents/reviewer.md +6 -6
- package/templates/.github/agents/security-reviewer.md +153 -153
- package/templates/.github/copilot-instructions.md +272 -262
- package/templates/.github/instructions/docs.instructions.md +147 -145
- package/templates/.github/instructions/sensitive-files.instructions.md +32 -32
- package/templates/.github/rules.md +229 -229
- package/templates/.github/scripts/bootstrap-confluence.js +289 -223
- package/templates/.github/skills/sf-design/SKILL.md +161 -216
- package/templates/.github/skills/sf-dev/SKILL.md +204 -351
- package/templates/.github/skills/sf-discovery/SKILL.md +415 -414
- package/templates/.github/skills/sf-extract/SKILL.md +225 -249
- package/templates/.github/skills/sf-load/SKILL.md +296 -295
- package/templates/.github/skills/sf-mcp/SKILL.md +386 -385
- package/templates/.github/skills/sf-merge-docs/SKILL.md +152 -100
- package/templates/.github/skills/sf-plan/SKILL.md +152 -128
- package/templates/.github/skills/sf-publish/SKILL.md +144 -143
- package/templates/.github/skills/sf-session-finish/SKILL.md +93 -120
- package/templates/.github/skills/sf-start/SKILL.md +192 -145
- package/templates/.github/templates/estrutura/apiContracts.template.md +160 -159
- package/templates/.github/templates/estrutura/architecture.template.md +169 -168
- package/templates/.github/templates/estrutura/conventions.template.md +214 -212
- package/templates/.github/templates/estrutura/decisions.template.md +107 -107
- package/templates/.github/templates/estrutura/domain.template.md +161 -160
- package/templates/.github/templates/feature/PRD.template.md +279 -286
- package/templates/.github/templates/feature/Progresso.template.md +141 -141
- package/templates/.github/templates/feature/TRD.template.md +358 -0
- package/templates/.github/templates/feature/context.template.md +89 -48
- package/templates/.github/templates/feature/extract-log.template.md +49 -39
- package/templates/.github/templates/feature/projetos.template.yaml +79 -79
- package/templates/.github/templates/global/progresso_global.template.md +59 -57
- package/templates/.github/templates/specs/brief.template.md +66 -59
- package/templates/.github/templates/specs/contracts.template.md +147 -141
- package/templates/.github/templates/specs/scenarios.template.md +125 -117
- package/templates/.github/templates/specs/tasks.template.md +65 -63
- package/templates/_gitignore +35 -35
- package/templates/sfw.config.yml.example +147 -147
- package/templates/.github/templates/feature/backlog-extraido.template.md +0 -156
- package/templates/.github/templates/feature/sdd.template.md +0 -559
|
@@ -1,351 +1,204 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sf-dev
|
|
3
|
-
description: |
|
|
4
|
-
Desenvolvimento. Implementa tasks com loop implement/test/review.
|
|
5
|
-
Trigger: /sf-dev
|
|
6
|
-
author: GustavoMaritan
|
|
7
|
-
version: 1.0.0
|
|
8
|
-
date: 2026-04-08
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/
|
|
22
|
-
/
|
|
23
|
-
/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
|
35
|
-
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
-
|
|
164
|
-
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
-
|
|
171
|
-
- Se
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
#### 3d. Commit (no repo do serviço)
|
|
208
|
-
- Working directory: `projetos/{repo_path}/`
|
|
209
|
-
- `git add` + `git commit -m "tipo(TASK-ID): descrição curta"`
|
|
210
|
-
- Commit acontece no repo do serviço, NÃO no projeto-base
|
|
211
|
-
- Corpo opcional se Senior Coder tomou decisão (mini-ADR)
|
|
212
|
-
|
|
213
|
-
#### 3e. Review
|
|
214
|
-
- Spawn Reviewer (Sonnet) com: código + testes + quality gate checklist
|
|
215
|
-
- Se APROVADO → marcar task `- [x]`, atualizar Progresso.md
|
|
216
|
-
- Se REPROVADO → agente recebe problemas, corrige, volta pro 3b
|
|
217
|
-
- Limite: **3 reprovações** → escalar pro usuário
|
|
218
|
-
|
|
219
|
-
### 4. Validação por fase
|
|
220
|
-
Ao concluir todas tasks de uma fase:
|
|
221
|
-
- Rodar testes integration da área (scenarios.md → estratégia de testes)
|
|
222
|
-
- Se falhou → identificar causa, corrigir no código da task afetada, recommit
|
|
223
|
-
- Se passou → avançar pra próxima fase
|
|
224
|
-
|
|
225
|
-
### 5. Security Review (cross-area)
|
|
226
|
-
Ao concluir todas tasks de todas áreas, ANTES dos testes E2E:
|
|
227
|
-
- Spawn Security Reviewer (Opus) com: todo código produzido + specs/{nome}/contracts.md (endpoints/auth) + docs/conventions.md
|
|
228
|
-
- Audita 6 categorias: Auth, AuthZ, Injeção, Dados Sensíveis, Headers, Banco
|
|
229
|
-
- Se findings CRÍTICO ou ALTO:
|
|
230
|
-
- Identificar área responsável (BACK, FRONT, DB, INFRA)
|
|
231
|
-
- Coder da área corrige → recommit
|
|
232
|
-
- Security Reviewer reavalia apenas os findings
|
|
233
|
-
- Se aprovado → prosseguir para E2E
|
|
234
|
-
- Limite: **2 tentativas** → escalar pro usuário
|
|
235
|
-
|
|
236
|
-
### 6. Validação por feature
|
|
237
|
-
Ao concluir security review com aprovação:
|
|
238
|
-
- Rodar testes E2E (cada CA de `specs/{nome}/scenarios.md` deve ter teste correspondente)
|
|
239
|
-
- Se falhou:
|
|
240
|
-
- Identificar qual CA falhou
|
|
241
|
-
- Mapear pra task/área responsável
|
|
242
|
-
- Criar fix inline (não cria nova task)
|
|
243
|
-
- Rodar E2E de novo
|
|
244
|
-
- Se passou → prosseguir para /sf-merge-docs
|
|
245
|
-
|
|
246
|
-
### 7. Finalizar fase — PR + ambiente ON
|
|
247
|
-
Ao concluir todos testes da fase:
|
|
248
|
-
|
|
249
|
-
1. **Atualizar Progresso.md** com status da fase
|
|
250
|
-
2. **Push da branch** em cada repo afetado:
|
|
251
|
-
```bash
|
|
252
|
-
cd projetos/{repo_path}
|
|
253
|
-
git push origin feature/{nome}_fase{N}
|
|
254
|
-
```
|
|
255
|
-
3. **Abrir PR** em cada repo com template detalhado (ver `rules.md` → Template de PR):
|
|
256
|
-
- Tasks concluídas, testes passando, como testar manualmente
|
|
257
|
-
- Usar `gh pr create`
|
|
258
|
-
4. **Deixar ambiente local rodando**:
|
|
259
|
-
- `docker compose up -d` (infra)
|
|
260
|
-
- `dotnet run` / `npm run dev` (apps)
|
|
261
|
-
- Informar URLs ao usuário
|
|
262
|
-
5. **PARAR e aguardar** — o usuário testa manualmente e aprova o PR
|
|
263
|
-
- O agente NUNCA faz merge — merge é manual pelo usuário
|
|
264
|
-
- Se o usuário pedir ajustes → corrigir na mesma branch, push, atualizar PR
|
|
265
|
-
|
|
266
|
-
### 8. Após merge (quando usuário confirmar)
|
|
267
|
-
```bash
|
|
268
|
-
# Em cada repo afetado:
|
|
269
|
-
cd projetos/{repo_path}
|
|
270
|
-
git checkout main
|
|
271
|
-
git pull origin main
|
|
272
|
-
git branch -d feature/{nome}_fase{N}
|
|
273
|
-
git remote prune origin
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
### 9. /sf-merge-docs automático
|
|
277
|
-
|
|
278
|
-
Após E2E aprovado, executar `/sf-merge-docs $ARGUMENTS`:
|
|
279
|
-
- Aplica SDD §11 (ADDED/MODIFIED/REMOVED) em `docs/`
|
|
280
|
-
- Em first_run: merge é idempotente (docs/ já criado pelo /sf-design — conteúdo bate)
|
|
281
|
-
- Em feature: aplica deltas reais, atualiza catálogos e matrizes
|
|
282
|
-
- Ver `.github/skills/sf-merge-docs/SKILL.md` pros detalhes
|
|
283
|
-
|
|
284
|
-
> `/sf-merge-docs` continua callable manualmente se precisar re-aplicar.
|
|
285
|
-
|
|
286
|
-
### 10. Atualizar `.context.md`
|
|
287
|
-
```yaml
|
|
288
|
-
status: "dev_in_progress" # durante execução
|
|
289
|
-
# ou
|
|
290
|
-
status: "dev_done" # todas fases + integration + security + E2E + /sf-merge-docs
|
|
291
|
-
ultima_skill: "/sf-dev"
|
|
292
|
-
atualizado_em: "{{ISO_DATETIME}}"
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
---
|
|
296
|
-
|
|
297
|
-
## Limites de retry
|
|
298
|
-
|
|
299
|
-
| Nível | Limite | Ação ao exceder |
|
|
300
|
-
|-------|--------|-----------------|
|
|
301
|
-
| Test loop (unit) | 5 tentativas por task | Parar, reportar erro persistente |
|
|
302
|
-
| Review loop | 3 reprovações por task | Parar, escalar pro usuário |
|
|
303
|
-
| Integration fix | 3 tentativas por fase | Parar, reportar ao usuário |
|
|
304
|
-
| Security fix | 2 tentativas por feature | Parar, escalar findings não resolvidos |
|
|
305
|
-
| E2E fix | 3 tentativas por feature | Parar, reportar ao usuário |
|
|
306
|
-
|
|
307
|
-
Mensagem de escalação:
|
|
308
|
-
```
|
|
309
|
-
⚠️ Task {ID} não passou após {N} tentativas.
|
|
310
|
-
Problemas persistentes:
|
|
311
|
-
1. ...
|
|
312
|
-
2. ...
|
|
313
|
-
Ação necessária: revisar SDD ou intervir manualmente.
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
---
|
|
317
|
-
|
|
318
|
-
## Saídas
|
|
319
|
-
|
|
320
|
-
| Saída | Descrição |
|
|
321
|
-
|-------|-----------|
|
|
322
|
-
| Código implementado | Em `projetos/{repo}/` — arquivos criados/modificados conforme tasks |
|
|
323
|
-
| Testes | Unit + integration + E2E nos repos correspondentes |
|
|
324
|
-
| Commits | 1 commit por task no repo do serviço: `tipo(TASK-ID): descrição` |
|
|
325
|
-
| Branches | `feature/{nome}` criado em cada repo afetado |
|
|
326
|
-
| `workspace/Output/{nome}/Progresso.md` | Tasks marcadas como concluídas (no projeto-base) |
|
|
327
|
-
| `Progresso.md` | Atualizado com status real (no projeto-base) |
|
|
328
|
-
| `progresso.md` (global) | Atualizado (no projeto-base) |
|
|
329
|
-
| `.context.md` | Status atualizado (no projeto-base) |
|
|
330
|
-
|
|
331
|
-
## Pós-condições
|
|
332
|
-
- Todas tasks concluídas = status `dev_done`
|
|
333
|
-
- Quality gate aprovado em cada task
|
|
334
|
-
- Integration tests passam por fase
|
|
335
|
-
- Security Review aprovado (zero findings CRÍTICO/ALTO)
|
|
336
|
-
- E2E tests passam por feature (todos CAs do `specs/{nome}/scenarios.md`)
|
|
337
|
-
- Merge-delta aplicado automaticamente (features) — docs/ atualizado
|
|
338
|
-
|
|
339
|
-
## Erros
|
|
340
|
-
|
|
341
|
-
| Erro | Ação |
|
|
342
|
-
|------|------|
|
|
343
|
-
| Nome não informado | Parar, mostrar exemplo |
|
|
344
|
-
| Status anterior a plan_done | Parar, sugerir skill correspondente |
|
|
345
|
-
| Dependência não concluída | Parar, listar dependências pendentes |
|
|
346
|
-
| Test loop excedeu limite | Parar, reportar erro + stack trace |
|
|
347
|
-
| Review excedeu 3 tentativas | Parar, escalar com lista de problemas |
|
|
348
|
-
| Integration/E2E persistente | Parar, reportar CAs que falharam |
|
|
349
|
-
| SDD ambíguo | Parar, reportar ambiguidade |
|
|
350
|
-
| --task com ID inexistente | Parar, listar tasks disponíveis |
|
|
351
|
-
| --area com área inexistente | Parar, listar áreas disponíveis |
|
|
1
|
+
---
|
|
2
|
+
name: sf-dev
|
|
3
|
+
description: |
|
|
4
|
+
Desenvolvimento. Implementa tasks com loop implement/test/review.
|
|
5
|
+
Trigger: /sf-dev
|
|
6
|
+
author: GustavoMaritan
|
|
7
|
+
version: 1.0.0
|
|
8
|
+
date: 2026-04-08
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# /sf-dev $ARGUMENTS
|
|
12
|
+
|
|
13
|
+
Skill atômica de execução. Implementa tasks em loop até quality gate aprovado.
|
|
14
|
+
$ARGUMENTS = nome (ex: feat_mvp)
|
|
15
|
+
Flags opcionais: --fase 1 (RECOMENDADO) | --area banco | --task BACK-003
|
|
16
|
+
|
|
17
|
+
## Agents por área (perfis em `.github/agents/`)
|
|
18
|
+
|
|
19
|
+
| Área | Agente | Stack | Modelo |
|
|
20
|
+
|------|--------|-------|--------|
|
|
21
|
+
| DB | DB Coder | PostgreSQL 16 | Sonnet (S/M) / Opus (L) |
|
|
22
|
+
| BACK | Backend Coder | .NET 8 / C# | Sonnet (S/M) / Opus (L) |
|
|
23
|
+
| FRONT | Frontend Coder | React + Fusion | Sonnet (S/M) / Opus (L) |
|
|
24
|
+
| INFRA | Infra Coder | Docker | Sonnet (S/M) / Opus (L) |
|
|
25
|
+
| DOC | Doc Writer | — | Sonnet |
|
|
26
|
+
| Todas | Reviewer | — | Sonnet |
|
|
27
|
+
| Todas | Security Reviewer | — | Opus |
|
|
28
|
+
|
|
29
|
+
Agente selecionado pelo prefixo: BACK-* → Backend Coder, DB-* → DB Coder, etc.
|
|
30
|
+
Ler o perfil do agente em `.github/agents/` antes de implementar.
|
|
31
|
+
|
|
32
|
+
## Pré-condições
|
|
33
|
+
|
|
34
|
+
| # | Validação | Se falhar |
|
|
35
|
+
|---|-----------|-----------|
|
|
36
|
+
| 1 | $ARGUMENTS informado | Parar |
|
|
37
|
+
| 2 | `.context.md` com status `plan_done` ou `dev_in_progress` | Se anterior → "/sf-plan primeiro" |
|
|
38
|
+
| 3 | `specs/{nome}/tasks.md` e `workspace/Output/{nome}/Progresso.md` existem | Parar |
|
|
39
|
+
| 4 | `specs/{nome}/` populado (brief, contracts, scenarios, tasks) | Parar — "/sf-design não rodou" |
|
|
40
|
+
| 5 | `rules.md` existe | Parar |
|
|
41
|
+
| 6 | `projetos.yaml` existe | Parar → "Execute /sf-design primeiro" |
|
|
42
|
+
| 7 | Infra local rodando (`docker compose ps` → healthy) | Parar → "Suba a infra: `docker compose up -d`" |
|
|
43
|
+
|
|
44
|
+
## Fluxo de execução
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
╔═══════════════════════════════════════════════╗
|
|
48
|
+
║ LOOP POR TASK ║
|
|
49
|
+
║ ║
|
|
50
|
+
║ 1. Selecionar agente pela área ║
|
|
51
|
+
║ 2. Ler perfil do agente (.github/agents/) ║
|
|
52
|
+
║ 3. Implementar código + testes unit ║
|
|
53
|
+
║ 4. Rodar testes unit ║
|
|
54
|
+
║ → Falhou? Corrigir → volta pro 4 ║
|
|
55
|
+
║ → 5 falhas? Parar, reportar ║
|
|
56
|
+
║ 5. Rodar lint ║
|
|
57
|
+
║ → Falhou? Corrigir → volta pro 5 ║
|
|
58
|
+
║ 6. Commit: tipo(TASK-ID): descrição ║
|
|
59
|
+
║ 7. Review (quality gate) ║
|
|
60
|
+
║ → Reprovado? Corrigir → volta pro 4 ║
|
|
61
|
+
║ → 3 reprovações? Escalar pro usuário ║
|
|
62
|
+
║ 8. Marcar task concluída ✅ ║
|
|
63
|
+
╚═══════════════════════════════════════════════╝
|
|
64
|
+
↓ (todas tasks da fase)
|
|
65
|
+
╔═══════════════════════════════════════════════╗
|
|
66
|
+
║ VALIDAÇÃO POR FASE ║
|
|
67
|
+
║ 1. Rodar testes integration da área ║
|
|
68
|
+
║ → Falhou? Fix → loop (max 3) ║
|
|
69
|
+
╚═══════════════════════════════════════════════╝
|
|
70
|
+
↓ (tudo concluído)
|
|
71
|
+
╔═══════════════════════════════════════════════╗
|
|
72
|
+
║ SECURITY REVIEW (cross-area) ║
|
|
73
|
+
║ 1. Security Reviewer audita todo código ║
|
|
74
|
+
║ → CRÍTICO/ALTO? Coder corrige → re-audit ║
|
|
75
|
+
║ → 2 falhas? Escalar pro usuário ║
|
|
76
|
+
║ 2. Aprovado → prosseguir para E2E ║
|
|
77
|
+
╚═══════════════════════════════════════════════╝
|
|
78
|
+
↓ (security aprovado)
|
|
79
|
+
╔═══════════════════════════════════════════════╗
|
|
80
|
+
║ VALIDAÇÃO POR FEATURE ║
|
|
81
|
+
║ 1. Rodar E2E (scenarios.md — CAs) ║
|
|
82
|
+
║ → Falhou? Identificar → fix → loop (max 3)║
|
|
83
|
+
║ 2. Tudo passou? → prosseguir ║
|
|
84
|
+
╚═══════════════════════════════════════════════╝
|
|
85
|
+
↓ (E2E aprovado, só features)
|
|
86
|
+
╔═══════════════════════════════════════════════╗
|
|
87
|
+
║ MERGE-DOCS (automático, só features) ║
|
|
88
|
+
║ 1. Ler PRD + TRD aprovados ║
|
|
89
|
+
║ 2. Diff semântico vs docs/ atual ║
|
|
90
|
+
║ 3. Aplicar ADDED/MODIFIED em docs/ ║
|
|
91
|
+
║ 4. Registrar changelog em cada doc alterado ║
|
|
92
|
+
║ 5. dev_done → done ✅ ║
|
|
93
|
+
╚═══════════════════════════════════════════════╝
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Multi-repo + Git Workflow
|
|
97
|
+
|
|
98
|
+
### Contexto inicial
|
|
99
|
+
- Ler `projetos.yaml` → mapeamento área → repo → path local
|
|
100
|
+
- Validar que repos em `projetos/` existem (se não, INFRA-001 ainda não rodou)
|
|
101
|
+
|
|
102
|
+
### Passo 1 — Verificar working tree (OBRIGATÓRIO)
|
|
103
|
+
Em cada repo afetado: `git status`
|
|
104
|
+
- Se working tree sujo → sugerir commit ou stash antes de prosseguir
|
|
105
|
+
- NUNCA começar a codar com working tree sujo
|
|
106
|
+
|
|
107
|
+
### INFRA-001 (setup — primeira execução)
|
|
108
|
+
No setup, INFRA-001 cria/clona os repos:
|
|
109
|
+
- Ler `projetos.yaml` → para cada repo:
|
|
110
|
+
- Se `existing: true` → `git clone {repo} projetos/{name}`
|
|
111
|
+
- Se `existing: false` → criar repo (`gh repo create {repo} --private`) + clone
|
|
112
|
+
- Criar estrutura base em cada repo (conforme stack)
|
|
113
|
+
|
|
114
|
+
### Passo 2 — Branch por fase (NUNCA na main)
|
|
115
|
+
Para cada repo afetado por esta fase:
|
|
116
|
+
```bash
|
|
117
|
+
cd projetos/{repo_path}
|
|
118
|
+
git checkout main && git pull origin main
|
|
119
|
+
git checkout -b feature/{nome}_fase{N}
|
|
120
|
+
```
|
|
121
|
+
- NUNCA desenvolver direto na main
|
|
122
|
+
|
|
123
|
+
## Implementação por task
|
|
124
|
+
|
|
125
|
+
1. **Navegar**: ler campo `Repo:` da task → `cd projetos/{repo_path}/`
|
|
126
|
+
2. **Ler**: task completa + `specs/{nome}/brief.md` + `contracts.md` + `scenarios.md` (NUNCA ler PRD/TRD direto — só as projeções em specs/) + perfil do agente + `.github/rules.md`
|
|
127
|
+
3. **Implementar**: código nos arquivos listados (caminhos relativos ao repo)
|
|
128
|
+
4. **Testar**: testes unit nos arquivos de teste listados na task
|
|
129
|
+
5. **Commit**: no repo do serviço — `tipo(TASK-ID): descrição curta`
|
|
130
|
+
6. **Review**: quality gate (compilar, testes, lint, conformidade com specs/, convenções)
|
|
131
|
+
|
|
132
|
+
## Quality gate (Reviewer)
|
|
133
|
+
|
|
134
|
+
| Check | Critério |
|
|
135
|
+
|-------|----------|
|
|
136
|
+
| Compila | Sem erros |
|
|
137
|
+
| Testes unit | Passam |
|
|
138
|
+
| Lint | Limpo |
|
|
139
|
+
| Conformidade spec | Contratos, tipos, regras conforme `specs/{nome}/contracts.md` |
|
|
140
|
+
| Convenções | rules.md respeitado |
|
|
141
|
+
| Sem TODOs | Injustificados |
|
|
142
|
+
| Sem secrets | Hardcoded |
|
|
143
|
+
| Arquivos corretos | Só os listados na task modificados |
|
|
144
|
+
|
|
145
|
+
## Limites de retry
|
|
146
|
+
|
|
147
|
+
| Nível | Limite | Ação ao exceder |
|
|
148
|
+
|-------|--------|-----------------|
|
|
149
|
+
| Test unit | 5 por task | Parar, reportar |
|
|
150
|
+
| Review | 3 por task | Escalar pro usuário |
|
|
151
|
+
| Integration | 3 por fase | Parar, reportar |
|
|
152
|
+
| Security | 2 por feature | Escalar findings não resolvidos |
|
|
153
|
+
| E2E | 3 por feature | Parar, reportar |
|
|
154
|
+
|
|
155
|
+
## Passo 3 — Ao terminar fase: PR + ambiente ON
|
|
156
|
+
|
|
157
|
+
1. Atualizar Progresso.md com status da fase
|
|
158
|
+
2. Push da branch em cada repo: `git push origin feature/{nome}_fase{N}`
|
|
159
|
+
3. Abrir PR com template detalhado (ver rules.md → Template de PR):
|
|
160
|
+
- Tasks concluídas, testes passando, como testar manualmente
|
|
161
|
+
- `gh pr create`
|
|
162
|
+
4. Deixar ambiente local rodando:
|
|
163
|
+
- `docker compose up -d` (infra)
|
|
164
|
+
- `dotnet run` / `npm run dev` (apps nos repos)
|
|
165
|
+
- Informar URLs ao usuário
|
|
166
|
+
5. **PARAR e aguardar** — merge é MANUAL pelo usuário
|
|
167
|
+
|
|
168
|
+
## Passo 4 — Aguardar aprovação
|
|
169
|
+
|
|
170
|
+
- O agente NUNCA faz merge
|
|
171
|
+
- Se o usuário pedir ajustes → corrigir na mesma branch, push, atualizar PR
|
|
172
|
+
|
|
173
|
+
## Passo 5 — Após merge (quando usuário confirmar)
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
cd projetos/{repo_path}
|
|
177
|
+
git checkout main && git pull origin main
|
|
178
|
+
git branch -d feature/{nome}_fase{N}
|
|
179
|
+
git remote prune origin
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Merge-Docs automático (só features)
|
|
183
|
+
|
|
184
|
+
Após E2E aprovado, SE `.context.md → first_run=false`:
|
|
185
|
+
|
|
186
|
+
1. Chamar inline `/sf-merge-docs {nome}` (ver `.github/skills/sf-merge-docs/SKILL.md`)
|
|
187
|
+
2. Integrator (Opus) faz diff semântico entre PRD+TRD aprovados e docs/ atual
|
|
188
|
+
3. Aplica ADDED/MODIFIED em cada doc afetado
|
|
189
|
+
4. Registra changelog em cada doc alterado
|
|
190
|
+
5. Valida consistência cross-doc (reporta, não bloqueia)
|
|
191
|
+
|
|
192
|
+
Se `first_run=true` → **pular** merge-docs automático (docs/ já foi criado pelo /sf-design).
|
|
193
|
+
|
|
194
|
+
Se `/sf-merge-docs` falhar → reportar mas não derrubar `/sf-dev`. User pode re-rodar manual.
|
|
195
|
+
|
|
196
|
+
> `/sf-merge-docs` continua existindo como command atômico pra re-execução manual.
|
|
197
|
+
> Mesma semântica sempre — idempotente, não duplica conteúdo.
|
|
198
|
+
|
|
199
|
+
## Atualizar `.context.md`
|
|
200
|
+
```yaml
|
|
201
|
+
status: "dev_in_progress" # durante
|
|
202
|
+
status: "dev_done" # ao final das tasks (antes do merge-docs)
|
|
203
|
+
status: "done" # após merge-docs aplicado (ou pulado em first_run)
|
|
204
|
+
```
|