@guilhermefsousa/open-spec-kit 0.1.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 +57 -0
- package/bin/open-spec-kit.js +39 -0
- package/package.json +51 -0
- package/src/commands/doctor.js +324 -0
- package/src/commands/init.js +981 -0
- package/src/commands/update.js +168 -0
- package/src/commands/validate.js +599 -0
- package/src/parsers/markdown-sections.js +271 -0
- package/src/schemas/projects.schema.js +111 -0
- package/src/schemas/spec.schema.js +643 -0
- package/templates/agents/agents/spec-hub.agent.md +99 -0
- package/templates/agents/rules/hub_structure.instructions.md +49 -0
- package/templates/agents/rules/ownership.instructions.md +138 -0
- package/templates/agents/scripts/notify-gchat.ps1 +99 -0
- package/templates/agents/scripts/notify-gchat.sh +131 -0
- package/templates/agents/skills/dev-orchestrator/SKILL.md +573 -0
- package/templates/agents/skills/discovery/SKILL.md +406 -0
- package/templates/agents/skills/setup-project/SKILL.md +452 -0
- package/templates/agents/skills/specifying-features/SKILL.md +378 -0
- package/templates/github/agents/spec-hub.agent.md +75 -0
- package/templates/github/copilot-instructions.md +102 -0
- package/templates/github/instructions/hub_structure.instructions.md +33 -0
- package/templates/github/instructions/ownership.instructions.md +45 -0
- package/templates/github/prompts/dev.prompt.md +19 -0
- package/templates/github/prompts/discovery.prompt.md +20 -0
- package/templates/github/prompts/nova-feature.prompt.md +19 -0
- package/templates/github/prompts/setup.prompt.md +18 -0
- package/templates/github/skills/dev-orchestrator/SKILL.md +9 -0
- package/templates/github/skills/discovery/SKILL.md +9 -0
- package/templates/github/skills/setup-project/SKILL.md +9 -0
- package/templates/github/skills/specifying-features/SKILL.md +9 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setup-project
|
|
3
|
+
description: "Bootstraps a new project from Confluence demands. Reads PO inputs, generates living docs (Vision, Glossary, Domain), and prepares the spec repo."
|
|
4
|
+
metadata:
|
|
5
|
+
works_on: [copilot, antigravity, claude]
|
|
6
|
+
argument-hint: "[Confluence space key] or [page ID da raiz do projeto]"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Setup Project
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Bootstrap a new project from raw PO inputs on Confluence. Generate the initial living documents and prepare the spec repo for the first feature cycle.
|
|
14
|
+
|
|
15
|
+
## Before you start
|
|
16
|
+
|
|
17
|
+
1. Read `projects.yml` — if already filled (has repos with status != template):
|
|
18
|
+
- If argument contains `--force`: proceed (will overwrite existing config and re-create missing pages)
|
|
19
|
+
- Otherwise: **stop** with message: "Projeto já configurado. Para re-executar, passe `--force` (ex: `/setup MFS --force`)."
|
|
20
|
+
2. **Resolver acesso ao Confluence** (em ordem de prioridade):
|
|
21
|
+
a. Se MCP Confluence está disponível (servidor `confluence` configurado e respondendo) → usar MCP normalmente
|
|
22
|
+
b. Se MCP NÃO está disponível, ler `.env` do diretório do projeto:
|
|
23
|
+
- Se `.env` contém `CONFLUENCE_URL`, `CONFLUENCE_USER` e `CONFLUENCE_API_TOKEN` → usar API REST direta do Confluence como fallback:
|
|
24
|
+
- Listar filhos: `GET {url}/rest/api/content/search?cql=parent={id}&limit=50` com header `Authorization: Basic base64(user:token)`
|
|
25
|
+
- Criar página: `POST {url}/rest/api/content` com body JSON `{type:"page", title, ancestors:[{id}], space:{key}, body:{storage:{value,representation:"storage"}}}`
|
|
26
|
+
- Ler conteúdo: `GET {url}/rest/api/content/{id}?expand=body.storage`
|
|
27
|
+
- Adicionar label: `POST {url}/rest/api/content/{id}/label` com body `[{prefix:"global", name:"label"}]`
|
|
28
|
+
- Se `.env` NÃO tem credenciais → **stop** com mensagem: "MCP Confluence não disponível e .env não configurado. Execute 'open-spec-kit init' primeiro."
|
|
29
|
+
3. **Resolver o argumento (space key ou page ID):**
|
|
30
|
+
a. Se `projects.yml` tem `confluence.root_page_id` → usar como page ID (NÃO pedir ao usuário)
|
|
31
|
+
b. Se `projects.yml` tem `confluence.space` → usar como space key
|
|
32
|
+
c. Se nenhum dos dois encontrado → pedir ao usuário
|
|
33
|
+
|
|
34
|
+
## Inputs
|
|
35
|
+
|
|
36
|
+
- **Argumento:** Confluence space key (ex: `GERFAT`) OR page ID of the project root (ex: `589824`)
|
|
37
|
+
- PO's raw files in `Demandas/` on Confluence (docs, PDFs, spreadsheets, screenshots — any format)
|
|
38
|
+
|
|
39
|
+
### How the argument is resolved
|
|
40
|
+
|
|
41
|
+
The setup supports two Confluence layouts:
|
|
42
|
+
|
|
43
|
+
**1 space = 1 project (simple):**
|
|
44
|
+
- Argument is a space key (ex: `MFS`, `GERFAT`)
|
|
45
|
+
- All pages are created at the space root
|
|
46
|
+
- `Demandas/` is a top-level page in the space
|
|
47
|
+
|
|
48
|
+
**1 space = N projects (multi-project):**
|
|
49
|
+
- Argument is the page ID of the project root page (ex: `589824` for "Todo App")
|
|
50
|
+
- All pages are created as children of that root page
|
|
51
|
+
- `Demandas/` is a child of the project root page
|
|
52
|
+
|
|
53
|
+
**Detection:** if the argument is numeric, treat as page ID. Otherwise, treat as space key.
|
|
54
|
+
|
|
55
|
+
## Flow
|
|
56
|
+
|
|
57
|
+
### 1. Resolve the project root
|
|
58
|
+
|
|
59
|
+
- If argument is a **space key**: project root = space root. Liste as páginas de nível superior do space.
|
|
60
|
+
- If argument is a **page ID**: project root = that page. Liste os filhos diretos dessa página.
|
|
61
|
+
|
|
62
|
+
All subsequent operations (reading Demandas, creating pages) are **relative to the project root**.
|
|
63
|
+
|
|
64
|
+
### 2. Validate prerequisites
|
|
65
|
+
|
|
66
|
+
Before doing anything, validate:
|
|
67
|
+
|
|
68
|
+
- [ ] `Demandas/` exists as child of the project root. If NOT: **stop and report error** — "Pasta Demandas/ nao encontrada. O PO precisa criar a pasta e adicionar os documentos antes de rodar /setup."
|
|
69
|
+
- [ ] `Demandas/` has at least one child page or attachment. If empty: **stop and report error** — "Demandas/ esta vazia. O PO precisa adicionar os documentos do projeto."
|
|
70
|
+
- [ ] Check if demand has label `novo`. If no label exists, add `novo` first, then proceed. Log: "Label 'novo' adicionada automaticamente."
|
|
71
|
+
|
|
72
|
+
### 3. Read everything the PO provided
|
|
73
|
+
|
|
74
|
+
Change demand label to `processando`.
|
|
75
|
+
|
|
76
|
+
Leia TODO o conteúdo em `Demandas/` sob a raiz do projeto, seguindo EXATAMENTE estes passos:
|
|
77
|
+
|
|
78
|
+
**3a. Liste TODOS os filhos diretos** da página `Demandas/`. Registre a quantidade encontrada.
|
|
79
|
+
|
|
80
|
+
**3b. Para CADA filho encontrado**, leia o conteúdo COMPLETO da página (body inteiro). NÃO pare na primeira página — leia TODAS antes de prosseguir para o passo seguinte.
|
|
81
|
+
|
|
82
|
+
**3c. Leia TODOS os attachments** de cada página (download e leitura quando possível).
|
|
83
|
+
|
|
84
|
+
**Attachment handling:**
|
|
85
|
+
- If an attachment can be read (text, markdown, etc.): read and incorporate
|
|
86
|
+
- If an attachment CANNOT be read (binary, image, PDF that MCP can't parse): register in a "Nao processados" list with filename, format, and parent page. Mark as "NAO PROCESSADO — formato nao suportado pelo MCP. Leitura manual necessaria."
|
|
87
|
+
|
|
88
|
+
**After reading, compile a structured understanding of:**
|
|
89
|
+
- What the product is and who it serves
|
|
90
|
+
- Business domain rules and flows
|
|
91
|
+
- Existing systems and integrations
|
|
92
|
+
- Key terms and concepts
|
|
93
|
+
- Stack and technology constraints
|
|
94
|
+
- Repos needed (from architecture description, or inferred from stack)
|
|
95
|
+
|
|
96
|
+
### 3b. Read Figma design context (opcional)
|
|
97
|
+
|
|
98
|
+
**Condição**: este passo SÓ executa se AMBAS as condições forem verdadeiras:
|
|
99
|
+
1. `projects.yml` tem seção `figma:` com `file_url` preenchido
|
|
100
|
+
2. O MCP Figma está disponível (servidor `figma` configurado em `.mcp.json`)
|
|
101
|
+
|
|
102
|
+
Se qualquer condição falhar, **pule silenciosamente** — não reporte erro, não peça configuração. Log: "Figma não configurado — pulando leitura de designs."
|
|
103
|
+
|
|
104
|
+
**Se disponível:**
|
|
105
|
+
1. Extraia o file key da URL em `projects.yml` → `figma.file_url`
|
|
106
|
+
- O file key é o segmento após `/design/` ou `/file/` na URL (ex: `https://www.figma.com/design/ABC123/Nome` → file key = `ABC123`)
|
|
107
|
+
2. Use `get_design_context` com o file key para obter visão geral do arquivo
|
|
108
|
+
3. Use `get_metadata` para obter a estrutura de páginas e frames do arquivo
|
|
109
|
+
4. Incorpore ao entendimento estruturado (compilado no passo 3):
|
|
110
|
+
- **Telas identificadas**: liste as páginas/frames principais do Figma — usar para enriquecer a identificação de Features (Step 4.5)
|
|
111
|
+
- **Componentes de design system**: se houver componentes reutilizáveis, registre-os — usar para enriquecer o Glossário (Step 4.2)
|
|
112
|
+
- **Fluxos visuais**: se o Figma organiza frames em fluxos (ex: "Login Flow", "Onboarding"), mapeie-os — usar para enriquecer Domínio/Fluxos (Step 4.3)
|
|
113
|
+
- **Texto visível**: labels, placeholders, mensagens de erro — usar para enriquecer Regras (validações)
|
|
114
|
+
|
|
115
|
+
**NÃO use `get_screenshot`** neste passo — o objetivo é contexto estrutural, não capturas visuais.
|
|
116
|
+
|
|
117
|
+
Ao gerar as living docs (passo 4), referencie as telas do Figma quando relevante:
|
|
118
|
+
- No **Fluxos**: "Fluxo visual no Figma: frame '{frame_name}'"
|
|
119
|
+
- Na **Visão do Produto**: mencione se o Figma contém protótipos navegáveis
|
|
120
|
+
|
|
121
|
+
**Regra**: Figma é fonte SUPLEMENTAR. Enriquece o que o PO escreveu em `Demandas/`, nunca substitui. Se o Figma mostra algo que contradiz um documento do PO, registrar como "A CONFIRMAR — divergência entre Figma e documento do PO."
|
|
122
|
+
|
|
123
|
+
### 4. Generate living docs on Confluence
|
|
124
|
+
|
|
125
|
+
Via MCP Confluence, create these pages **under the project root**, in this order.
|
|
126
|
+
|
|
127
|
+
**Prefixo de títulos (multi-project)**: quando o layout é multi-project (argumento é page ID numérico), TODOS os títulos de páginas criadas devem ser prefixados com a sigla do projeto (campo `sigla` do projects.yml). Isso evita conflito de títulos no mesmo Confluence space. A página raiz do projeto NÃO recebe prefixo (já é única por definição).
|
|
128
|
+
|
|
129
|
+
Formato dos títulos:
|
|
130
|
+
- Páginas de domínio: `{SIGLA} — Visão do Produto`, `{SIGLA} — Glossário`, etc.
|
|
131
|
+
- Features: `{SIGLA}-NNN - Nome da feature` (ex: `FT-001 - Cadastro e Autenticação`)
|
|
132
|
+
|
|
133
|
+
No layout simples (1 space = 1 project), o prefixo é opcional — não há risco de conflito.
|
|
134
|
+
|
|
135
|
+
**Emojis obrigatórios**: incluir o emoji diretamente NO TÍTULO da página (não como parâmetro separado — nem toda API/MCP suporta emoji como campo separado):
|
|
136
|
+
- `🎯 {SIGLA} — Visão do Produto`
|
|
137
|
+
- `📖 {SIGLA} — Glossário`
|
|
138
|
+
- `🏛️ {SIGLA} — Domínio`
|
|
139
|
+
- `📏 {SIGLA} — Regras`
|
|
140
|
+
- `🔀 {SIGLA} — Fluxos`
|
|
141
|
+
- `📊 {SIGLA} — Tabelas de Referência`
|
|
142
|
+
- `🔌 {SIGLA} — Integrações`
|
|
143
|
+
- `🚀 Features`
|
|
144
|
+
- `📦 Arquivados`
|
|
145
|
+
- Features de negócio: `🚀 {SIGLA}-NNN - Nome da feature`
|
|
146
|
+
- Feature de infraestrutura: `⚙️ {SIGLA}-000 - Infraestrutura e Scaffold`
|
|
147
|
+
|
|
148
|
+
**Step 4.1 — Visão do Produto** (max 1 page):
|
|
149
|
+
|
|
150
|
+
Must contain these sections:
|
|
151
|
+
- **O que e**: what the product is (1-2 paragraphs)
|
|
152
|
+
- **Para quem**: target users/personas, expanded beyond a single line
|
|
153
|
+
- **Por que existe**: business motivations
|
|
154
|
+
- **Premissas**: assumptions stated in the PO docs (copy them, don't summarize)
|
|
155
|
+
- **Escopo da v1**: what's in
|
|
156
|
+
- **Fora de escopo**: what's explicitly out
|
|
157
|
+
- **Metricas de sucesso**: if the PO defined metrics, use them. If not, write "Metricas de negocio — A CONFIRMAR. Nao definidas pelo PO." Do NOT invent metrics. Do NOT use functional test criteria as metrics.
|
|
158
|
+
- **Restricoes**: mandatory tech, environment, compliance constraints
|
|
159
|
+
|
|
160
|
+
**Step 4.2 — Glossario** (table format):
|
|
161
|
+
|
|
162
|
+
Columns: Termo | Definicao | Contexto de uso
|
|
163
|
+
|
|
164
|
+
Completeness criteria:
|
|
165
|
+
- Every domain noun mentioned in the PO documents must appear (entities, roles, states, concepts)
|
|
166
|
+
- Every technical component mentioned must appear (infrastructure, protocols, patterns)
|
|
167
|
+
- After building the glossary, **re-read the PO documents in Demandas/** and check: is there any term used more than once that is NOT in the glossary? If yes, add it.
|
|
168
|
+
|
|
169
|
+
Minimum expected terms for any project:
|
|
170
|
+
- All entities (user, task, list, etc.)
|
|
171
|
+
- All states/enums (status values, priorities, etc.)
|
|
172
|
+
- All roles/personas
|
|
173
|
+
- All infrastructure components (DB, queue, cache, etc.)
|
|
174
|
+
- Domain-specific concepts (ownership, async processing, etc.)
|
|
175
|
+
|
|
176
|
+
**Step 4.3 — Dominio/** (parent page + 4 children):
|
|
177
|
+
|
|
178
|
+
**Regras** (table format):
|
|
179
|
+
- Columns: ID | Regra | Fonte | Verificavel
|
|
180
|
+
- ID: sequential (RN-01, RN-02, ...)
|
|
181
|
+
- **Fonte**: MUST reference the PRD section the rule was extracted from (ex: "PRD §9.4 — Gerenciamento de tarefas"). This enables traceability.
|
|
182
|
+
- Verificavel: how to test this rule (concrete, not vague)
|
|
183
|
+
- Group rules by domain area (ownership, auth, entities, etc.)
|
|
184
|
+
- After writing all rules, **re-read the PO documents** looking for "deve", "nao pode", "obrigatorio", "somente", "exclusivamente" — any missed rule must be added
|
|
185
|
+
|
|
186
|
+
**Fluxos**:
|
|
187
|
+
- One section per business flow
|
|
188
|
+
- Each flow: numbered steps describing the happy path
|
|
189
|
+
- After the numbered steps, add a **Mermaid** `flowchart TD` diagram visualizing the flow. Example:
|
|
190
|
+
```mermaid
|
|
191
|
+
flowchart TD
|
|
192
|
+
A[Usuário submete formulário] --> B{Dados válidos?}
|
|
193
|
+
B -->|Sim| C[Salvar no banco]
|
|
194
|
+
B -->|Não| D[Retornar erros]
|
|
195
|
+
C --> E[Enviar confirmação]
|
|
196
|
+
```
|
|
197
|
+
- **Exceções**: after EVERY flow, list what can go wrong (error cases, edge cases, invalid inputs). Format as a bullet list under "Excecoes" heading. If no exceptions are obvious, write "Excecoes: nenhuma identificada — A CONFIRMAR."
|
|
198
|
+
- If a flow involves async processing, clearly mark the sync/async boundary
|
|
199
|
+
- **Diagrama de sequência**: se o fluxo envolve **mais de 1 componente do sistema** (ex: Frontend, BFF, API, Worker, DB, RabbitMQ), adicionar um **Mermaid `sequenceDiagram`** ALÉM do flowchart, mostrando a interação entre os componentes. O **flowchart** mostra a LÓGICA (decisões, caminhos). O **sequenceDiagram** mostra a EXECUÇÃO (quem chama quem, sync vs async). Fluxos puramente de negócio (sem interação técnica) só precisam do flowchart. Exemplo:
|
|
200
|
+
```mermaid
|
|
201
|
+
sequenceDiagram
|
|
202
|
+
participant FE as Frontend
|
|
203
|
+
participant BFF as BFF Web
|
|
204
|
+
participant API as API
|
|
205
|
+
participant DB as PostgreSQL
|
|
206
|
+
participant RMQ as RabbitMQ
|
|
207
|
+
participant WRK as Worker
|
|
208
|
+
|
|
209
|
+
FE->>BFF: POST /bills (SSO Corp token)
|
|
210
|
+
BFF->>API: POST /api/v1/bills (JWT)
|
|
211
|
+
API->>DB: INSERT bills (status: GERANDO)
|
|
212
|
+
API->>RMQ: Publish fila_nova_fatura
|
|
213
|
+
API-->>BFF: 202 Accepted
|
|
214
|
+
BFF-->>FE: 202 Accepted
|
|
215
|
+
RMQ->>WRK: Consume fila_nova_fatura
|
|
216
|
+
WRK->>DB: UPDATE bills (status: GERADA)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Tabelas de Referencia**:
|
|
220
|
+
- All enums, categories, reference data
|
|
221
|
+
- For each enum: if values are defined in the PRD, list them. If inferred, mark "A CONFIRMAR"
|
|
222
|
+
- **State transitions**: if an entity has states (ex: task status), define the valid transitions as a table: "De | Para | Permitido? | Condicao". If the PRD doesn't define transitions, create a proposed table and mark ALL rows as "A CONFIRMAR"
|
|
223
|
+
- After the table, add a **Mermaid** `stateDiagram-v2` visualizing the transitions. Example:
|
|
224
|
+
```mermaid
|
|
225
|
+
stateDiagram-v2
|
|
226
|
+
[*] --> Aberta
|
|
227
|
+
Aberta --> EmProgresso
|
|
228
|
+
EmProgresso --> Concluida
|
|
229
|
+
EmProgresso --> Bloqueada
|
|
230
|
+
Bloqueada --> EmProgresso
|
|
231
|
+
Concluida --> [*]
|
|
232
|
+
```
|
|
233
|
+
- Dashboard indicators with calculation formulas
|
|
234
|
+
|
|
235
|
+
**Integracoes**:
|
|
236
|
+
- Internal components: table with component, technology, responsibility
|
|
237
|
+
- Event flow: producer → broker → consumer → action
|
|
238
|
+
- For each event: define the minimum expected payload fields. Mark as "A CONFIRMAR — payload a definir na spec tecnica"
|
|
239
|
+
- External integrations: list or write "Nenhuma na v1"
|
|
240
|
+
|
|
241
|
+
**Step 4.4 — Structure pages:**
|
|
242
|
+
- Create `Features/` parent page under the project root if it doesn't exist
|
|
243
|
+
- Create `Arquivados/` parent page under the project root if it doesn't exist
|
|
244
|
+
|
|
245
|
+
**Step 4.5 — Create initial feature pages:**
|
|
246
|
+
|
|
247
|
+
**Step 4.5a — Feature 000 — Infraestrutura e Scaffold (obrigatória em projetos novos):**
|
|
248
|
+
|
|
249
|
+
Se `projects.yml` tem `status: inception` (projeto novo, sem repos ativos), SEMPRE criar como PRIMEIRA feature:
|
|
250
|
+
|
|
251
|
+
- Título: `⚙️ {SIGLA}-000 - Infraestrutura e Scaffold`
|
|
252
|
+
- Label: `em-discovery`
|
|
253
|
+
- Conteúdo:
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
| Campo | Valor |
|
|
257
|
+
|-------|-------|
|
|
258
|
+
| ID | {SIGLA}-000 |
|
|
259
|
+
| Depende de | — (nenhuma, esta é a base) |
|
|
260
|
+
| Complexidade | média |
|
|
261
|
+
| Repos envolvidos | {listar todos os repos de projects.yml} |
|
|
262
|
+
|
|
263
|
+
## Escopo
|
|
264
|
+
|
|
265
|
+
Criação da infraestrutura base para o projeto:
|
|
266
|
+
- Criação dos repositórios: {listar repos com nome e tipo}
|
|
267
|
+
- Pipeline de CI/CD (build, test, lint) para cada repo
|
|
268
|
+
- Docker Compose para ambiente local (todos os serviços + dependências)
|
|
269
|
+
- Script de criação do banco de dados (DDL completo)
|
|
270
|
+
- Health checks e endpoints de diagnóstico
|
|
271
|
+
- Configuração de variáveis de ambiente (.env, secrets)
|
|
272
|
+
- README com instruções de setup local
|
|
273
|
+
|
|
274
|
+
## Critério de aceite
|
|
275
|
+
|
|
276
|
+
- Todos os repos criados e acessíveis
|
|
277
|
+
- `docker-compose up` sobe o ambiente local completo
|
|
278
|
+
- Health check de cada serviço retorna 200
|
|
279
|
+
- Pipeline de CI passa em cada repo (build + tests)
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Todas as demais features ({SIGLA}-001 em diante) têm dependência implícita de {SIGLA}-000.
|
|
283
|
+
|
|
284
|
+
**Step 4.5b — Features de negócio:**
|
|
285
|
+
|
|
286
|
+
Analyze the PO documents in `Demandas/` and identify distinct features/capabilities described. For EACH feature identified:
|
|
287
|
+
|
|
288
|
+
1. Create a child page under `Features/` with title: `🚀 {SIGLA}-NNN - Nome da feature` (numbering sequential: 001, 002, ...). Ex: `🚀 FT-001 - Cadastro e Autenticação`, `🚀 TD-003 - Gerenciamento de Tarefas`
|
|
289
|
+
2. Content MUST start with a metadata table:
|
|
290
|
+
```
|
|
291
|
+
| Campo | Valor |
|
|
292
|
+
|-------|-------|
|
|
293
|
+
| ID | {SIGLA}-NNN |
|
|
294
|
+
| Depende de | {SIGLA}-000 (e outras se houver, separadas por vírgula) |
|
|
295
|
+
| Complexidade | baixa / média / alta |
|
|
296
|
+
| Repos envolvidos | {quais repos participam} |
|
|
297
|
+
```
|
|
298
|
+
Depois da tabela: 1-2 parágrafos extraídos dos documentos do PO descrevendo o que a feature faz.
|
|
299
|
+
3. Add label `em-discovery` (ready for /discovery to process)
|
|
300
|
+
|
|
301
|
+
If the PO documents describe a SINGLE monolithic system without clear feature boundaries, create ONE feature page covering the full scope and note: "Feature única — considerar quebra em sub-features durante /discovery."
|
|
302
|
+
|
|
303
|
+
This step ensures /discovery always finds a feature page to work with.
|
|
304
|
+
|
|
305
|
+
### 5. Set up the spec repo
|
|
306
|
+
|
|
307
|
+
In the local spec repo:
|
|
308
|
+
|
|
309
|
+
**Fill `projects.yml`:**
|
|
310
|
+
- Project name, domain, status, team size
|
|
311
|
+
- **Sigla**: `sigla: XX` — abreviação curta (2-4 letras) usada como prefixo nos títulos do Confluence e IDs de features. Derivar do nome do projeto (ex: FinTrack → FT, Todo → TD, CRM → CRM). Perguntar ao dev se ambíguo.
|
|
312
|
+
- Stack (from PO's docs or ask the dev)
|
|
313
|
+
- **VCS**: `vcs: github | gitlab` and `vcs_org: {org/group}` — ask the dev if not obvious from context
|
|
314
|
+
- **Repos**: detect from the PRD what repos will be needed. If the PRD mentions "API .NET", declare a `project-api` repo with stack `dotnet` and status `planned`. If it mentions "React frontend", declare a `project-front` repo with stack `nodejs` and status `planned`. Do NOT leave repos commented out — declare them with `status: planned`.
|
|
315
|
+
- External dependencies
|
|
316
|
+
- Confluence space key and root_page_id (if multi-project layout)
|
|
317
|
+
|
|
318
|
+
**Create directories:**
|
|
319
|
+
- `docs/lessons/` — vazio (usado pelo /dev para registrar surpresas)
|
|
320
|
+
- `docs/decisions/` — vazio (usado para ADRs)
|
|
321
|
+
|
|
322
|
+
**Generate `docs/architecture.md` draft:**
|
|
323
|
+
- System components (table: component, technology, responsibility)
|
|
324
|
+
- Data flow diagram — use a **Mermaid** `flowchart` block showing sync (solid arrows `-->`) and async (dotted arrows `-.->`) flows. Example:
|
|
325
|
+
```mermaid
|
|
326
|
+
flowchart LR
|
|
327
|
+
A[Client] -->|HTTP| B[API]
|
|
328
|
+
B -->|sync| C[Database]
|
|
329
|
+
B -.->|async| D[Queue]
|
|
330
|
+
D -.-> E[Worker]
|
|
331
|
+
```
|
|
332
|
+
- Data model — use a **Mermaid** `erDiagram` block for high-level entity relationships. Example:
|
|
333
|
+
```mermaid
|
|
334
|
+
erDiagram
|
|
335
|
+
Usuario ||--o{ Tarefa : possui
|
|
336
|
+
Tarefa }o--|| Status : tem
|
|
337
|
+
```
|
|
338
|
+
- Events identified (table: event, generates notification?, generates history?)
|
|
339
|
+
- Environment/infrastructure (how it runs)
|
|
340
|
+
- **Decisoes em aberto**: list ALL "A CONFIRMAR" items from all Confluence pages, ranked by impact. High impact = blocks /spec or /dev. Format:
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
| # | Decisao | Impacto | Bloqueia | Status |
|
|
344
|
+
|---|---------|---------|----------|--------|
|
|
345
|
+
| 1 | Worker separado ou parte da API? | Alto — define repos e CI | /spec | aberta |
|
|
346
|
+
| 2 | Valores do enum de Status | Medio — afeta model e validacao | /dev | aberta |
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
Status values: `aberta`, `resolvida — [decisão tomada]`. The /discovery updates this column when resolving decisions (exit gate).
|
|
350
|
+
|
|
351
|
+
Mark sections as "DRAFT — validar com o time"
|
|
352
|
+
|
|
353
|
+
### MCP failure recovery
|
|
354
|
+
|
|
355
|
+
If a Confluence page creation fails mid-flow:
|
|
356
|
+
1. Log which pages were successfully created and which failed
|
|
357
|
+
2. Save pending page creations to `docs/pending-confluence-updates.md` with: target parent page, page title, content summary, date
|
|
358
|
+
3. Report to dev: "Setup parcial — {N} de {total} páginas criadas. Páginas faltantes: {list}. Re-execute /setup para tentar criar as faltantes."
|
|
359
|
+
4. On re-execution, check if `docs/pending-confluence-updates.md` exists and attempt to apply pending operations FIRST. Also check which pages already exist (listando filhos da página-pai) and only create the missing ones — never duplicate. Remove applied entries from the file.
|
|
360
|
+
|
|
361
|
+
### 6. Self-review
|
|
362
|
+
|
|
363
|
+
Before closing the loop, the agent MUST do a self-review:
|
|
364
|
+
|
|
365
|
+
1. **Re-read the original PO documents in Demandas/** in full
|
|
366
|
+
2. **Compare against each generated page** and check:
|
|
367
|
+
- Did I miss any section of the PO documents?
|
|
368
|
+
- Did I miss any term for the glossary?
|
|
369
|
+
- Did I miss any rule?
|
|
370
|
+
- Did I miss any flow?
|
|
371
|
+
- Did I invent anything that isn't in the PO documents?
|
|
372
|
+
3. **Fix any gaps found** by updating the pages
|
|
373
|
+
4. **Report** what was added/fixed in the self-review
|
|
374
|
+
|
|
375
|
+
### 7. Close the loop
|
|
376
|
+
|
|
377
|
+
- Change demand label on Confluence: `processando` → `processado`
|
|
378
|
+
- Verify label transition happened (read back the page to confirm)
|
|
379
|
+
- If there are "Nao processados" attachments, add a comment on the demand page listing them
|
|
380
|
+
- Notify Google Chat (se `GCHAT_WEBHOOK_URL` não estiver definida, o script pula silenciosamente).
|
|
381
|
+
**Escolher o script correto para o OS:**
|
|
382
|
+
- Windows (PowerShell): `powershell -ExecutionPolicy Bypass -File ./scripts/notify-gchat.ps1`
|
|
383
|
+
- Linux/macOS (Bash): `bash ./scripts/notify-gchat.sh`
|
|
384
|
+
|
|
385
|
+
Parâmetros (iguais em ambos os scripts):
|
|
386
|
+
|
|
387
|
+
--card --title "✅ Projeto configurado" --subtitle "{project_name}" --body "📄 <b>Páginas criadas:</b>
|
|
388
|
+
• Visão do Produto
|
|
389
|
+
• Glossário ({term_count} termos)
|
|
390
|
+
• Domínio (Regras, Fluxos, Tabelas, Integrações)
|
|
391
|
+
• Features ({feature_count} identificadas)
|
|
392
|
+
• Arquivados
|
|
393
|
+
|
|
394
|
+
📊 <b>Métricas:</b>
|
|
395
|
+
• {rule_count} regras de negócio
|
|
396
|
+
• {flow_count} fluxos documentados
|
|
397
|
+
• {open_decisions_count} decisões em aberto ({high_impact_count} alto impacto)" --next "Resolver decisões de alto impacto e rodar /discovery" --button-text "Abrir Visão do Produto" --button-url "{confluence_vision_page_url}"
|
|
398
|
+
|
|
399
|
+
Substitua os valores entre `{}` pelos dados reais do contexto da execução.
|
|
400
|
+
|
|
401
|
+
## Rules
|
|
402
|
+
|
|
403
|
+
1. NEVER invent business context — everything comes from PO's documents
|
|
404
|
+
2. If something is unclear, mark it as "A CONFIRMAR" (not assumed)
|
|
405
|
+
3. **Language**: ALL generated content — Confluence pages AND local files (architecture.md, projects.yml) — MUST be in **Brazilian Portuguese (pt-BR) with correct accents** (e.g., "não" NOT "nao", "autenticação" NOT "autenticacao", "código" NOT "codigo", "é" NOT "e", "já" NOT "ja"). Technical terms stay in English (e.g., RabbitMQ, API, endpoint, status). Tone must be **clear, didactic, and accessible** — as if explaining to someone unfamiliar with the project.
|
|
406
|
+
4. Visão do Produto max 1 página
|
|
407
|
+
5. Glossary entries must have: term + definition + context of use
|
|
408
|
+
6. Domain rules must be verifiable (not vague) and traceable to a PRD section
|
|
409
|
+
7. Every "A CONFIRMAR" must state WHY it's ambiguous (what the PRD says vs. what's missing)
|
|
410
|
+
8. Repos detected from the PO documents must be declared in projects.yml (with status: planned), never commented out
|
|
411
|
+
|
|
412
|
+
## Quality criteria
|
|
413
|
+
|
|
414
|
+
The output is considered good when:
|
|
415
|
+
|
|
416
|
+
- **Glossario**: covers 100% of domain nouns and technical components mentioned in the PO documents
|
|
417
|
+
- **Regras**: every "deve", "nao pode", "obrigatorio" in the PO documents has a corresponding numbered rule
|
|
418
|
+
- **Fluxos**: every flow has a happy path AND exceptions documented
|
|
419
|
+
- **Tabelas**: every enum has values (confirmed or "A CONFIRMAR"), state entities have transition tables
|
|
420
|
+
- **Integracoes**: every async flow has events with producers, consumers, and expected payload fields
|
|
421
|
+
- **Architecture.md**: has an "open decisions" table ranked by impact
|
|
422
|
+
- **projects.yml**: has all detected repos declared (not commented), with stack and status
|
|
423
|
+
- **Self-review**: was performed, gaps were found and fixed (or confirmed none exist)
|
|
424
|
+
|
|
425
|
+
## Validation checklist
|
|
426
|
+
|
|
427
|
+
### Prerequisite checks
|
|
428
|
+
- [ ] `Demandas/` exists under project root
|
|
429
|
+
- [ ] `Demandas/` has at least one child page or attachment
|
|
430
|
+
- [ ] Demand label transition: (none/novo) → processando → processado
|
|
431
|
+
|
|
432
|
+
### Content generated
|
|
433
|
+
- [ ] Visao do Produto: all required sections present (O que é, Para quem, Por que existe, Premissas, Escopo da v1, Fora de escopo, Métricas de sucesso, Restrições)
|
|
434
|
+
- [ ] Glossario: covers all domain terms from PRD (verified by re-read)
|
|
435
|
+
- [ ] Regras: all rules have ID + Fonte (PRD section) + Verificavel
|
|
436
|
+
- [ ] Fluxos: all flows have happy path + exceptions + Mermaid flowchart TD
|
|
437
|
+
- [ ] Tabelas de Referencia: all enums defined, state transitions documented + Mermaid stateDiagram-v2
|
|
438
|
+
- [ ] Integracoes: all events have producer + consumer + expected payload
|
|
439
|
+
- [ ] Features/ page created
|
|
440
|
+
- [ ] Initial feature pages created under Features/ (with label `em-discovery`)
|
|
441
|
+
- [ ] Arquivados/ page created
|
|
442
|
+
|
|
443
|
+
### Spec repo updated
|
|
444
|
+
- [ ] projects.yml filled with all detected repos (status: planned, not commented)
|
|
445
|
+
- [ ] docs/architecture.md draft with Mermaid diagrams (flowchart, erDiagram) and open decisions table
|
|
446
|
+
|
|
447
|
+
### Quality gates
|
|
448
|
+
- [ ] Self-review performed (re-read PRD vs. output)
|
|
449
|
+
- [ ] No business context was invented
|
|
450
|
+
- [ ] All ambiguities marked "A CONFIRMAR" with explanation
|
|
451
|
+
- [ ] Unreadable attachments listed as "NAO PROCESSADO"
|
|
452
|
+
- [ ] Demand label changed to `processado` (verified)
|