spec-first-copilot 0.7.0-beta.1 → 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 +560 -533
- 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 +215 -215
- package/templates/.github/agents/db-coder.md +165 -165
- package/templates/.github/agents/doc-writer.md +66 -66
- package/templates/.github/agents/frontend-coder.md +222 -222
- package/templates/.github/agents/infra-coder.md +341 -341
- package/templates/.github/agents/reviewer.md +99 -99
- package/templates/.github/agents/security-reviewer.md +153 -153
- package/templates/.github/copilot-instructions.md +272 -272
- 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 -289
- package/templates/.github/skills/sf-design/SKILL.md +161 -161
- package/templates/.github/skills/sf-dev/SKILL.md +204 -204
- package/templates/.github/skills/sf-discovery/SKILL.md +415 -415
- package/templates/.github/skills/sf-extract/SKILL.md +225 -225
- package/templates/.github/skills/sf-load/SKILL.md +296 -296
- package/templates/.github/skills/sf-mcp/SKILL.md +386 -386
- package/templates/.github/skills/sf-merge-docs/SKILL.md +152 -152
- package/templates/.github/skills/sf-plan/SKILL.md +152 -152
- package/templates/.github/skills/sf-publish/SKILL.md +144 -144
- package/templates/.github/skills/sf-session-finish/SKILL.md +93 -93
- package/templates/.github/skills/sf-start/SKILL.md +192 -192
- 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 -279
- package/templates/.github/templates/feature/Progresso.template.md +141 -141
- package/templates/.github/templates/feature/TRD.template.md +358 -358
- package/templates/.github/templates/feature/context.template.md +89 -89
- package/templates/.github/templates/feature/extract-log.template.md +49 -49
- 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 -66
- package/templates/.github/templates/specs/contracts.template.md +147 -147
- package/templates/.github/templates/specs/scenarios.template.md +125 -125
- package/templates/.github/templates/specs/tasks.template.md +65 -65
- package/templates/_gitignore +35 -35
- package/templates/sfw.config.yml.example +147 -147
|
@@ -1,212 +1,214 @@
|
|
|
1
|
-
# Convenções
|
|
2
|
-
|
|
3
|
-
> Regras transversais do sistema: autenticação, autorização, CORS, rate limiting,
|
|
4
|
-
> LGPD, auditoria, variáveis de ambiente, monitoramento, códigos de erro de domínio
|
|
5
|
-
> e versionamento de dependências. Padrões que todo código segue.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
<!--
|
|
10
|
-
=============================================================================
|
|
11
|
-
INSTRUÇÕES PARA O AGENTE (não incluir no arquivo gerado)
|
|
12
|
-
=============================================================================
|
|
13
|
-
|
|
14
|
-
PAPEL: Síntese cross-feature de regras transversais do sistema.
|
|
15
|
-
Fonte única pra "qual é o padrão de auth/authz/LGPD/logs/env vars neste projeto?".
|
|
16
|
-
Features consultam este doc pra seguir padrão; quando precisam mudar,
|
|
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
|
-
| Allowed
|
|
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
|
-
|
|
|
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
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
|
1
|
+
# Convenções
|
|
2
|
+
|
|
3
|
+
> Regras transversais do sistema: autenticação, autorização, CORS, rate limiting,
|
|
4
|
+
> LGPD, auditoria, variáveis de ambiente, monitoramento, códigos de erro de domínio
|
|
5
|
+
> e versionamento de dependências. Padrões que todo código segue.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<!--
|
|
10
|
+
=============================================================================
|
|
11
|
+
INSTRUÇÕES PARA O AGENTE (não incluir no arquivo gerado)
|
|
12
|
+
=============================================================================
|
|
13
|
+
|
|
14
|
+
PAPEL: Síntese cross-feature de regras transversais do sistema.
|
|
15
|
+
Fonte única pra "qual é o padrão de auth/authz/LGPD/logs/env vars neste projeto?".
|
|
16
|
+
Features consultam este doc pra seguir padrão; quando precisam mudar, o TRD
|
|
17
|
+
da feature traz o novo padrão e /sf-merge-docs aplica via diff semântico.
|
|
18
|
+
|
|
19
|
+
ORIGEM (first-run, via /sf-design):
|
|
20
|
+
- TRD §7 Segurança Detalhada → Autenticação, Autorização, CORS, LGPD, Rate Limiting, Auditoria
|
|
21
|
+
- TRD §5.3 Variáveis de ambiente + §1.3 Ambientes → Variáveis de Ambiente, Domínios
|
|
22
|
+
- TRD §2 §Área-Backend (convenções de rota/erro) → Códigos de Erro do Domínio (reutilizáveis)
|
|
23
|
+
- TRD §5.4 Monitoramento → Monitoramento e Observabilidade
|
|
24
|
+
- TRD §9 Decisões Técnicas (ADRs) → Alternativas Tecnológicas Descartadas, Versionamento
|
|
25
|
+
|
|
26
|
+
ATUALIZAÇÃO (feature): /sf-merge-docs faz diff semântico PRD+TRD ↔ docs/
|
|
27
|
+
e aplica ADDED/MODIFIED/REMOVED quando feature adiciona permissões,
|
|
28
|
+
papéis, dados pessoais LGPD, variáveis de ambiente, códigos de erro,
|
|
29
|
+
ou altera políticas de retenção/auditoria.
|
|
30
|
+
|
|
31
|
+
COMO GERAR (first-run):
|
|
32
|
+
1. Ler TRD §7 Segurança Detalhada — autenticação, autorização, CORS, LGPD, rate limiting
|
|
33
|
+
2. Ler TRD §5.3 Variáveis de ambiente + §1.3 Ambientes — env vars e domínios
|
|
34
|
+
3. Ler TRD §5.4 Monitoramento — logs, métricas, tracing, alertas
|
|
35
|
+
4. Ler TRD §2 §Área-Backend — convenções de rota e códigos de erro globais
|
|
36
|
+
5. Ler TRD §9 Decisões (ADRs) — alternativas descartadas e versionamento
|
|
37
|
+
6. Autenticação: método, expiração, hash, refresh strategy
|
|
38
|
+
7. Autorização: papéis e matriz de permissões (RBAC/ABAC)
|
|
39
|
+
8. LGPD: mapear TODOS dados pessoais com base legal específica
|
|
40
|
+
9. Auditoria: O QUE é logado, ONDE, POR QUANTO TEMPO
|
|
41
|
+
10. Variáveis de ambiente: NUNCA valores reais, só exemplos
|
|
42
|
+
|
|
43
|
+
O QUE NÃO VAI AQUI:
|
|
44
|
+
- Rotas, paginação, filtros, catálogo de endpoints → apiContracts.md
|
|
45
|
+
- Containers, ambientes, deploy → architecture.md
|
|
46
|
+
- Entidades, tabelas → domain.md
|
|
47
|
+
|
|
48
|
+
REGRAS:
|
|
49
|
+
- Matriz de permissões é DINÂMICA — cresce a cada feature (via /sf-merge-docs)
|
|
50
|
+
- Dados pessoais da LGPD precisam de base legal ESPECÍFICA
|
|
51
|
+
- Nunca armazenar senhas em texto plano (hash obrigatório)
|
|
52
|
+
- Secrets nunca no código — sempre variáveis de ambiente
|
|
53
|
+
- Rate limiting obrigatório em endpoints públicos (login, registro)
|
|
54
|
+
- Auditoria obrigatória para operações destrutivas
|
|
55
|
+
- Códigos de erro do domínio são globais — reutilizáveis por múltiplos endpoints
|
|
56
|
+
|
|
57
|
+
=============================================================================
|
|
58
|
+
-->
|
|
59
|
+
|
|
60
|
+
## Autenticação
|
|
61
|
+
|
|
62
|
+
| Aspecto | Implementação |
|
|
63
|
+
|---------|--------------|
|
|
64
|
+
| Método | <!-- JWT? Session? OAuth2? --> |
|
|
65
|
+
| Expiração access token | <!-- Ex: 15min --> |
|
|
66
|
+
| Refresh token | <!-- Existe? Expiração? Rotação? --> |
|
|
67
|
+
| Hash de senha | <!-- bcrypt rounds? argon2? --> |
|
|
68
|
+
| Header | <!-- Authorization: Bearer {token} --> |
|
|
69
|
+
| Armazenamento (client) | <!-- httpOnly cookie? localStorage? --> |
|
|
70
|
+
|
|
71
|
+
### Fluxo de autenticação
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
<!-- Descrever o fluxo: login → token → refresh → logout -->
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Autorização
|
|
78
|
+
|
|
79
|
+
### Modelo
|
|
80
|
+
|
|
81
|
+
| Aspecto | Decisão |
|
|
82
|
+
|---------|---------|
|
|
83
|
+
| Tipo | <!-- RBAC / ABAC / RBAC + ABAC --> |
|
|
84
|
+
| Onde é verificado | <!-- Middleware? Decorator? Service? --> |
|
|
85
|
+
| Granularidade | <!-- Por rota? Por recurso? Por campo? --> |
|
|
86
|
+
|
|
87
|
+
### Papéis
|
|
88
|
+
|
|
89
|
+
| Papel | Descrição | Herda de |
|
|
90
|
+
|-------|-----------|----------|
|
|
91
|
+
| | | <!-- Hierarquia: admin herda de user? --> |
|
|
92
|
+
|
|
93
|
+
### Matriz de Permissões
|
|
94
|
+
|
|
95
|
+
> Atualizada a cada feature via /sf-merge-docs.
|
|
96
|
+
|
|
97
|
+
| Recurso | Ação | {{role_1}} | {{role_2}} | {{role_N}} |
|
|
98
|
+
|---------|------|------------|------------|------------|
|
|
99
|
+
| | criar | | | |
|
|
100
|
+
| | ler | | | |
|
|
101
|
+
| | editar | | | |
|
|
102
|
+
| | deletar | | | |
|
|
103
|
+
|
|
104
|
+
## CORS
|
|
105
|
+
|
|
106
|
+
| Aspecto | Configuração |
|
|
107
|
+
|---------|-------------|
|
|
108
|
+
| Allowed Origins | <!-- Configurável por ambiente --> |
|
|
109
|
+
| Allowed Methods | `GET, POST, PUT, PATCH, DELETE` |
|
|
110
|
+
| Allowed Headers | `Authorization, Content-Type` |
|
|
111
|
+
| Credentials | <!-- true/false --> |
|
|
112
|
+
| Max Age | <!-- Preflight cache em segundos --> |
|
|
113
|
+
|
|
114
|
+
## Rate Limiting
|
|
115
|
+
|
|
116
|
+
| Categoria | Limite | Janela | Resposta |
|
|
117
|
+
|-----------|--------|--------|----------|
|
|
118
|
+
| Login/Registro | <!-- Ex: 5 req --> | <!-- Ex: 15min --> | 429 + Retry-After |
|
|
119
|
+
| API autenticada | <!-- Ex: 100 req --> | <!-- Ex: 1min --> | 429 + Retry-After |
|
|
120
|
+
| API pública | <!-- Ex: 30 req --> | <!-- Ex: 1min --> | 429 + Retry-After |
|
|
121
|
+
| Upload | <!-- Ex: 10 req --> | <!-- Ex: 1h --> | 429 + Retry-After |
|
|
122
|
+
|
|
123
|
+
## LGPD / Privacidade
|
|
124
|
+
|
|
125
|
+
### Dados pessoais coletados
|
|
126
|
+
|
|
127
|
+
| Dado | Base legal | Finalidade | Retenção | Criptografado? |
|
|
128
|
+
|------|-----------|------------|----------|----------------|
|
|
129
|
+
| | <!-- Consentimento / Contrato / Legítimo interesse / Obrigação legal --> | | | |
|
|
130
|
+
|
|
131
|
+
### Direitos do titular
|
|
132
|
+
|
|
133
|
+
| Direito | Implementação | Endpoint/Fluxo |
|
|
134
|
+
|---------|--------------|----------------|
|
|
135
|
+
| Acesso aos dados | | |
|
|
136
|
+
| Correção | | |
|
|
137
|
+
| Exclusão (right to be forgotten) | | <!-- Soft delete? Hard delete? Anonimização? --> |
|
|
138
|
+
| Portabilidade | | <!-- Formato de exportação? --> |
|
|
139
|
+
| Revogação de consentimento | | |
|
|
140
|
+
|
|
141
|
+
## Auditoria
|
|
142
|
+
|
|
143
|
+
| O que é logado | Quando | Onde armazena | Retenção |
|
|
144
|
+
|----------------|--------|---------------|----------|
|
|
145
|
+
| Login/Logout | sempre | | |
|
|
146
|
+
| Alteração de dados sensíveis | sempre | | |
|
|
147
|
+
| Operações destrutivas (DELETE) | sempre | | |
|
|
148
|
+
| Falhas de autenticação | sempre | | |
|
|
149
|
+
| Mudanças de permissão | sempre | | |
|
|
150
|
+
|
|
151
|
+
## Proteção de Dados em Trânsito e Repouso
|
|
152
|
+
|
|
153
|
+
| Aspecto | Implementação |
|
|
154
|
+
|---------|--------------|
|
|
155
|
+
| TLS | <!-- Versão mínima? --> |
|
|
156
|
+
| Dados sensíveis em repouso | <!-- Criptografia? Quais campos? --> |
|
|
157
|
+
| Backup | <!-- Criptografado? Frequência? --> |
|
|
158
|
+
|
|
159
|
+
## Variáveis de Ambiente
|
|
160
|
+
|
|
161
|
+
> NUNCA colocar valores reais aqui. Apenas nomes, descrição e exemplos.
|
|
162
|
+
|
|
163
|
+
| Variável | Ambientes | Obrigatória | Descrição | Exemplo |
|
|
164
|
+
|----------|-----------|-------------|-----------|---------|
|
|
165
|
+
| `DATABASE_URL` | todos | sim | Conexão com banco | `postgres://user:pass@host:5432/db` |
|
|
166
|
+
| `JWT_SECRET` | todos | sim | Chave de assinatura JWT | `sua-chave-secreta-aqui` |
|
|
167
|
+
| `NODE_ENV` | todos | sim | Ambiente atual | `development` / `production` |
|
|
168
|
+
|
|
169
|
+
## Domínios e DNS
|
|
170
|
+
|
|
171
|
+
| Domínio | Aponta para | Certificado | Gerenciado por |
|
|
172
|
+
|---------|-------------|-------------|----------------|
|
|
173
|
+
| | | <!-- Let's Encrypt? AWS ACM? --> | |
|
|
174
|
+
|
|
175
|
+
## Monitoramento e Observabilidade
|
|
176
|
+
|
|
177
|
+
| Aspecto | Ferramenta | O que monitora |
|
|
178
|
+
|---------|-----------|----------------|
|
|
179
|
+
| Logs | <!-- Ex: CloudWatch, Datadog --> | |
|
|
180
|
+
| APM | <!-- Ex: New Relic, Sentry --> | |
|
|
181
|
+
| Uptime | <!-- Ex: Pingdom, UptimeRobot --> | |
|
|
182
|
+
| Alertas | <!-- Ex: PagerDuty, Slack --> | |
|
|
183
|
+
|
|
184
|
+
## Códigos de Erro do Domínio
|
|
185
|
+
|
|
186
|
+
> Códigos reutilizáveis por múltiplos endpoints. Novos códigos são adicionados via /sf-merge-docs.
|
|
187
|
+
|
|
188
|
+
| Código | Descrição | HTTP padrão |
|
|
189
|
+
|--------|-----------|-------------|
|
|
190
|
+
| <!-- Ex: DUPLICATE_EMAIL --> | <!-- Email já cadastrado --> | <!-- 409 --> |
|
|
191
|
+
|
|
192
|
+
## Alternativas Tecnológicas Descartadas
|
|
193
|
+
|
|
194
|
+
> Decisões já tomadas. Se alguém perguntar "por que não usamos X?", a resposta está aqui.
|
|
195
|
+
|
|
196
|
+
| Tecnologia escolhida | Alternativa considerada | Por que descartamos | Ref decisão |
|
|
197
|
+
|----------------------|------------------------|---------------------|-------------|
|
|
198
|
+
| | | | |
|
|
199
|
+
|
|
200
|
+
## Convenções de Versionamento de Dependências
|
|
201
|
+
|
|
202
|
+
| Aspecto | Convenção |
|
|
203
|
+
|---------|-----------|
|
|
204
|
+
| Versionamento | <!-- Semver? Pinned? --> |
|
|
205
|
+
| Lock files | <!-- package-lock.json? yarn.lock? --> |
|
|
206
|
+
| Atualização | <!-- Dependabot? Manual? Periodicidade? --> |
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Changelog
|
|
211
|
+
|
|
212
|
+
| Data | Feature | Tipo | Descrição |
|
|
213
|
+
|------|---------|------|-----------|
|
|
214
|
+
| | | | |
|