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,159 +1,160 @@
|
|
|
1
|
-
# Contratos de API
|
|
2
|
-
|
|
3
|
-
> Padrões de endpoint, convenções de rotas, paginação, filtros, respostas de erro
|
|
4
|
-
> e catálogo global. Contratos HTTP do sistema.
|
|
5
|
-
> Autenticação detalhada e códigos de erro do domínio vivem em conventions.md.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
<!--
|
|
10
|
-
=============================================================================
|
|
11
|
-
INSTRUÇÕES PARA O AGENTE (não incluir no arquivo gerado)
|
|
12
|
-
=============================================================================
|
|
13
|
-
|
|
14
|
-
PAPEL: Síntese das convenções globais de API + catálogo de endpoints cross-feature.
|
|
15
|
-
Fonte única pra "como são as rotas, paginação, erros neste projeto?".
|
|
16
|
-
Features novas consultam este doc; novos endpoints entram no catálogo via /sf-merge-docs.
|
|
17
|
-
|
|
18
|
-
ORIGEM (first-run, via /sf-design):
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
ATUALIZAÇÃO (feature): /sf-merge-docs
|
|
23
|
-
quando feature adiciona endpoints
|
|
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
|
-
| Atualizar
|
|
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
|
-
|
|
1
|
+
# Contratos de API
|
|
2
|
+
|
|
3
|
+
> Padrões de endpoint, convenções de rotas, paginação, filtros, respostas de erro
|
|
4
|
+
> e catálogo global. Contratos HTTP do sistema.
|
|
5
|
+
> Autenticação detalhada e códigos de erro do domínio vivem em conventions.md.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<!--
|
|
10
|
+
=============================================================================
|
|
11
|
+
INSTRUÇÕES PARA O AGENTE (não incluir no arquivo gerado)
|
|
12
|
+
=============================================================================
|
|
13
|
+
|
|
14
|
+
PAPEL: Síntese das convenções globais de API + catálogo de endpoints cross-feature.
|
|
15
|
+
Fonte única pra "como são as rotas, paginação, erros neste projeto?".
|
|
16
|
+
Features novas consultam este doc; novos endpoints entram no catálogo via /sf-merge-docs.
|
|
17
|
+
|
|
18
|
+
ORIGEM (first-run, via /sf-design):
|
|
19
|
+
- TRD §2 §Área-Backend (convenções de rota) → "Padrão Geral" + "Convenções de Rotas" + "Paginação" + "Filtros" + "Respostas de Erro"
|
|
20
|
+
- TRD §2.1 Endpoints (se houver em first-run, ex: health check, auth) → "Catálogo"
|
|
21
|
+
|
|
22
|
+
ATUALIZAÇÃO (feature): /sf-merge-docs faz diff semântico PRD+TRD ↔ docs/
|
|
23
|
+
e aplica ADDED/MODIFIED/REMOVED quando feature adiciona endpoints
|
|
24
|
+
(do TRD §2.1) ao catálogo.
|
|
25
|
+
|
|
26
|
+
COMO GERAR (first-run):
|
|
27
|
+
1. Ler TRD §2 §Área-Backend — estilo, formato, versionamento, paginação, erros
|
|
28
|
+
2. Padrão geral e convenções são FIXOS após first-run — definidos uma vez
|
|
29
|
+
3. Catálogo de endpoints é DINÂMICO — cresce a cada feature via /sf-merge-docs
|
|
30
|
+
4. Formatos de paginação, filtro e resposta de erro são FIXOS
|
|
31
|
+
|
|
32
|
+
O QUE NÃO VAI AQUI:
|
|
33
|
+
- Autenticação detalhada (hash, refresh, fluxo) → conventions.md
|
|
34
|
+
- Autorização, roles, matriz de permissões → conventions.md
|
|
35
|
+
- Códigos de erro do domínio → conventions.md
|
|
36
|
+
- Rate limiting → conventions.md
|
|
37
|
+
- CORS → conventions.md
|
|
38
|
+
|
|
39
|
+
REGRAS:
|
|
40
|
+
- Convenções são LEI — todo TRD §2.1 (endpoints) deve seguir
|
|
41
|
+
- Catálogo atualizado a cada /sf-merge-docs
|
|
42
|
+
- Mudanças em convenções (raro) devem gerar registro em decisions.md
|
|
43
|
+
|
|
44
|
+
=============================================================================
|
|
45
|
+
-->
|
|
46
|
+
|
|
47
|
+
## Padrão Geral
|
|
48
|
+
|
|
49
|
+
| Aspecto | Padrão |
|
|
50
|
+
|---------|--------|
|
|
51
|
+
| Estilo | <!-- REST / GraphQL / gRPC --> |
|
|
52
|
+
| Formato | <!-- JSON / Protobuf --> |
|
|
53
|
+
| Versionamento | <!-- /api/v1/ no path? Header? --> |
|
|
54
|
+
| Content-Type | <!-- application/json --> |
|
|
55
|
+
| Encoding | <!-- UTF-8 --> |
|
|
56
|
+
|
|
57
|
+
> **Autenticação**: definida em [conventions.md → Autenticação](./conventions.md#autenticação).
|
|
58
|
+
|
|
59
|
+
## Convenções de Rotas
|
|
60
|
+
|
|
61
|
+
| Operação | Método | Rota | Exemplo |
|
|
62
|
+
|----------|--------|------|---------|
|
|
63
|
+
| Listar | GET | `/api/v1/{recurso}` | |
|
|
64
|
+
| Detalhar | GET | `/api/v1/{recurso}/:id` | |
|
|
65
|
+
| Criar | POST | `/api/v1/{recurso}` | |
|
|
66
|
+
| Atualizar completo | PUT | `/api/v1/{recurso}/:id` | |
|
|
67
|
+
| Atualizar parcial | PATCH | `/api/v1/{recurso}/:id` | |
|
|
68
|
+
| Remover/Inativar | DELETE | `/api/v1/{recurso}/:id` | |
|
|
69
|
+
|
|
70
|
+
### Convenções de nomenclatura
|
|
71
|
+
|
|
72
|
+
| Regra | Exemplo |
|
|
73
|
+
|-------|---------|
|
|
74
|
+
| Recursos no plural, kebab-case | `/api/v1/order-items` |
|
|
75
|
+
| Ações não-CRUD como sub-recurso | `/api/v1/users/:id/activate` |
|
|
76
|
+
| Filtros via query params | `/api/v1/users?status=active` |
|
|
77
|
+
| Relações aninhadas (max 2 níveis) | `/api/v1/users/:id/orders` |
|
|
78
|
+
|
|
79
|
+
## Paginação
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"data": [],
|
|
84
|
+
"meta": {
|
|
85
|
+
"page": 1,
|
|
86
|
+
"per_page": 20,
|
|
87
|
+
"total": 0,
|
|
88
|
+
"total_pages": 0
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Query params: `?page=1&per_page=20&sort=campo&order=asc`
|
|
94
|
+
|
|
95
|
+
| Parâmetro | Default | Máximo | Descrição |
|
|
96
|
+
|-----------|---------|--------|-----------|
|
|
97
|
+
| `page` | 1 | — | Página atual |
|
|
98
|
+
| `per_page` | 20 | <!-- Ex: 100 --> | Itens por página |
|
|
99
|
+
| `sort` | — | — | Campo para ordenação |
|
|
100
|
+
| `order` | `asc` | — | `asc` ou `desc` |
|
|
101
|
+
|
|
102
|
+
## Filtros
|
|
103
|
+
|
|
104
|
+
Query params: `?busca=termo&campo=valor`
|
|
105
|
+
|
|
106
|
+
| Tipo de filtro | Formato | Exemplo |
|
|
107
|
+
|----------------|---------|---------|
|
|
108
|
+
| Igualdade | `?campo=valor` | `?status=ativo` |
|
|
109
|
+
| Busca textual | `?busca=termo` | `?busca=joao` |
|
|
110
|
+
| Range de data | `?de=YYYY-MM-DD&ate=YYYY-MM-DD` | `?de=2026-01-01&ate=2026-12-31` |
|
|
111
|
+
| Múltiplos valores | `?campo=a,b,c` | `?status=ativo,pendente` |
|
|
112
|
+
|
|
113
|
+
## Respostas de Erro
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"error": {
|
|
118
|
+
"code": "ERROR_CODE",
|
|
119
|
+
"message": "Mensagem legível para o usuário",
|
|
120
|
+
"details": [
|
|
121
|
+
{ "field": "campo", "message": "Detalhe do erro" }
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Códigos HTTP
|
|
128
|
+
|
|
129
|
+
| Código | Quando usar | Exemplo |
|
|
130
|
+
|--------|-------------|---------|
|
|
131
|
+
| 200 | Sucesso (GET, PUT, PATCH) | Recurso retornado/atualizado |
|
|
132
|
+
| 201 | Criado com sucesso (POST) | Recurso criado, retorna o objeto |
|
|
133
|
+
| 204 | Sucesso sem conteúdo (DELETE) | Recurso removido |
|
|
134
|
+
| 400 | Dados inválidos (formato) | JSON malformado |
|
|
135
|
+
| 401 | Não autenticado | Token ausente ou expirado |
|
|
136
|
+
| 403 | Sem permissão | Papel sem acesso ao recurso |
|
|
137
|
+
| 404 | Recurso não encontrado | ID inexistente |
|
|
138
|
+
| 409 | Conflito (duplicidade) | Email já cadastrado |
|
|
139
|
+
| 422 | Validação de negócio falhou | CPF inválido, regra RN-XXX violada |
|
|
140
|
+
| 429 | Rate limit excedido | Muitas requisições |
|
|
141
|
+
| 500 | Erro interno | Bug não tratado |
|
|
142
|
+
|
|
143
|
+
> **Códigos de erro do domínio**: definidos em [conventions.md → Códigos de Erro do Domínio](./conventions.md#códigos-de-erro-do-domínio).
|
|
144
|
+
|
|
145
|
+
## Catálogo de Endpoints
|
|
146
|
+
|
|
147
|
+
> Atualizado a cada feature via /sf-merge-docs. Visão consolidada de todas as APIs.
|
|
148
|
+
> Pra detalhe de um endpoint específico (request/response schemas), ver TRD §2.1 do scope: `workspace/Output/{scope}/TRD.md` ou `specs/{scope}/contracts.md`.
|
|
149
|
+
|
|
150
|
+
| Método | Rota | Feature | Descrição |
|
|
151
|
+
|--------|------|---------|-----------|
|
|
152
|
+
| | | | |
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Changelog
|
|
157
|
+
|
|
158
|
+
| Data | Feature | Tipo | Descrição |
|
|
159
|
+
|------|---------|------|-----------|
|
|
160
|
+
| | | | |
|