@guilhermefsousa/open-spec-kit 0.0.1
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 +210 -0
- package/src/commands/validate.js +615 -0
- package/src/parsers/markdown-sections.js +271 -0
- package/src/schemas/projects.schema.js +111 -0
- package/src/schemas/spec.schema.js +760 -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 +459 -0
- package/templates/agents/skills/specifying-features/SKILL.md +379 -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,459 @@
|
|
|
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 of the project root]"
|
|
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. **Confluence access — ALWAYS use MCP:**
|
|
21
|
+
- All Confluence operations (read pages, create pages, labels) MUST use the MCP server (`confluence` in `.mcp.json`).
|
|
22
|
+
- **Do NOT use curl, fetch, or direct REST calls** — even if `.env` has credentials.
|
|
23
|
+
- If MCP is not responding → **STOP**: "MCP Confluence não disponível. Execute 'open-spec-kit doctor' para diagnosticar."
|
|
24
|
+
3. **Resolve the argument (space key or page ID):**
|
|
25
|
+
a. If `projects.yml` has `confluence.root_page_id` → use as page ID (do NOT ask the user)
|
|
26
|
+
b. If `projects.yml` has `confluence.space` → use as space key
|
|
27
|
+
c. If neither found → ask the user
|
|
28
|
+
|
|
29
|
+
## Inputs
|
|
30
|
+
|
|
31
|
+
- **Argument:** Confluence space key (e.g., `GERFAT`) OR page ID of the project root (e.g., `589824`)
|
|
32
|
+
- PO's raw files in `Demandas/` on Confluence (docs, PDFs, spreadsheets, screenshots — any format)
|
|
33
|
+
|
|
34
|
+
### How the argument is resolved
|
|
35
|
+
|
|
36
|
+
The setup supports two Confluence layouts:
|
|
37
|
+
|
|
38
|
+
**1 space = 1 project (simple):**
|
|
39
|
+
- Argument is a space key (ex: `MFS`, `GERFAT`)
|
|
40
|
+
- All pages are created at the space root
|
|
41
|
+
- `Demandas/` is a top-level page in the space
|
|
42
|
+
|
|
43
|
+
**1 space = N projects (multi-project):**
|
|
44
|
+
- Argument is the page ID of the project root page (ex: `589824` for "Todo App")
|
|
45
|
+
- All pages are created as children of that root page
|
|
46
|
+
- `Demandas/` is a child of the project root page
|
|
47
|
+
|
|
48
|
+
**Detection:** if the argument is numeric, treat as page ID. Otherwise, treat as space key.
|
|
49
|
+
|
|
50
|
+
## Flow
|
|
51
|
+
|
|
52
|
+
### 1. Resolve project root and read Demands
|
|
53
|
+
|
|
54
|
+
**Follow EXACTLY this algorithm via MCP, no deviations:**
|
|
55
|
+
|
|
56
|
+
**1a.** Resolve `ROOT_ID`:
|
|
57
|
+
- If argument is numeric → `ROOT_ID = argument`
|
|
58
|
+
- If argument is text (space key) → `ROOT_ID = space root page`
|
|
59
|
+
- If no argument → read `projects.yml` (`confluence.root_page_id` or `confluence.space`)
|
|
60
|
+
|
|
61
|
+
**1b.** List DIRECT children of `ROOT_ID` (1 MCP call). Save the list.
|
|
62
|
+
|
|
63
|
+
**1c.** In the list, find the page titled "Demandas" (case-insensitive). Save as `DEMANDAS_ID`.
|
|
64
|
+
- If not found → **STOP**: "Pasta Demandas/ não encontrada. O PO precisa criá-la."
|
|
65
|
+
|
|
66
|
+
**1d.** Check demand label. If no `novo` label, add `novo`. Then change to `processando`.
|
|
67
|
+
|
|
68
|
+
**1e.** List DIRECT children of `DEMANDAS_ID` (1 MCP call). Save as `DEMAND_PAGES`.
|
|
69
|
+
- If empty → **STOP**: "Demandas/ está vazia. O PO precisa adicionar documentos."
|
|
70
|
+
|
|
71
|
+
**1f.** For EACH page in `DEMAND_PAGES`:
|
|
72
|
+
- Read FULL content (entire body) via MCP
|
|
73
|
+
- Read page attachments via MCP
|
|
74
|
+
- Do **NOT** navigate to sub-pages — read only this level
|
|
75
|
+
|
|
76
|
+
**Attachment handling:**
|
|
77
|
+
- If an attachment can be read (text, markdown, etc.): read and incorporate
|
|
78
|
+
- 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."
|
|
79
|
+
|
|
80
|
+
**Call budget:**
|
|
81
|
+
|
|
82
|
+
| Operation | Calls |
|
|
83
|
+
|-----------|-------|
|
|
84
|
+
| Children of root | 1 |
|
|
85
|
+
| Children of Demandas | 1 |
|
|
86
|
+
| Content of each demand | N (one per page) |
|
|
87
|
+
| **Total** | **2 + N** |
|
|
88
|
+
|
|
89
|
+
**FORBIDDEN:**
|
|
90
|
+
- Generic CQL searches
|
|
91
|
+
- Listing ancestors
|
|
92
|
+
- Recursive navigation (children of children)
|
|
93
|
+
- Using curl/fetch/direct HTTP
|
|
94
|
+
|
|
95
|
+
**After reading, compile a structured understanding of:**
|
|
96
|
+
- What the product is and who it serves
|
|
97
|
+
- Business domain rules and flows
|
|
98
|
+
- Existing systems and integrations
|
|
99
|
+
- Key terms and concepts
|
|
100
|
+
- Stack and technology constraints
|
|
101
|
+
- Repos needed (from architecture description, or inferred from stack)
|
|
102
|
+
|
|
103
|
+
### 2. Read Figma design context (optional)
|
|
104
|
+
|
|
105
|
+
**Condition**: this step ONLY runs if BOTH conditions are true:
|
|
106
|
+
1. `projects.yml` has a `figma:` section with `file_url` filled
|
|
107
|
+
2. The Figma MCP is available (`figma` server configured in `.mcp.json`)
|
|
108
|
+
|
|
109
|
+
If either condition fails, **skip silently** — do not report an error or ask for configuration.
|
|
110
|
+
|
|
111
|
+
**If available:**
|
|
112
|
+
1. Extract the file key from the URL in `projects.yml` → `figma.file_url`
|
|
113
|
+
- The file key is the segment after `/design/` or `/file/` in the URL (e.g., `https://www.figma.com/design/ABC123/Name` → file key = `ABC123`)
|
|
114
|
+
2. Use `get_design_context` with the file key to get an overview
|
|
115
|
+
3. Use `get_metadata` to get the page/frame structure
|
|
116
|
+
4. Incorporate into the structured understanding (compiled in step 1):
|
|
117
|
+
- **Screens identified**: list main Figma pages/frames — use to enrich Feature identification (Step 3.5)
|
|
118
|
+
- **Design system components**: if reusable components exist, register them — use to enrich the Glossário (Step 3.2)
|
|
119
|
+
- **Visual flows**: if Figma organizes frames into flows (e.g., "Login Flow", "Onboarding"), map them — use to enrich Domínio/Fluxos (Step 3.3)
|
|
120
|
+
- **Visible text**: labels, placeholders, error messages — use to enrich Regras (validations)
|
|
121
|
+
|
|
122
|
+
**Do NOT use `get_screenshot`** in this step — the goal is structural context, not visual captures.
|
|
123
|
+
|
|
124
|
+
When generating the living docs (step 3), reference Figma screens where relevant:
|
|
125
|
+
- In **Fluxos**: "Fluxo visual no Figma: frame '{frame_name}'"
|
|
126
|
+
- In **Visão do Produto**: mention if Figma contains navigable prototypes
|
|
127
|
+
|
|
128
|
+
**Rule**: Figma is a SUPPLEMENTARY source. It enriches what the PO wrote in `Demandas/`, never replaces it. If Figma shows something that contradicts a PO document, register as "A CONFIRMAR — divergência entre Figma e documento do PO."
|
|
129
|
+
|
|
130
|
+
### 3. Generate living docs on Confluence
|
|
131
|
+
|
|
132
|
+
Via MCP Confluence, create these pages **under the project root**, in this order.
|
|
133
|
+
|
|
134
|
+
**Title prefix (multi-project)**: when the layout is multi-project (argument is a numeric page ID), ALL created page titles must be prefixed with the project acronym (`sigla` field in projects.yml). This avoids title conflicts within the same Confluence space. The project root page does NOT get a prefix (it's already unique by definition).
|
|
135
|
+
|
|
136
|
+
Title format:
|
|
137
|
+
- Domain pages: `{SIGLA} — Visão do Produto`, `{SIGLA} — Glossário`, etc.
|
|
138
|
+
- Features: `{SIGLA}-NNN - Feature name` (e.g., `FT-001 - Cadastro e Autenticação`)
|
|
139
|
+
|
|
140
|
+
In simple layout (1 space = 1 project), the prefix is optional — no conflict risk.
|
|
141
|
+
|
|
142
|
+
**Required emojis**: include the emoji directly IN THE PAGE TITLE (not as a separate parameter — not every API/MCP supports emoji as a separate field):
|
|
143
|
+
- `🎯 {SIGLA} — Visão do Produto`
|
|
144
|
+
- `📖 {SIGLA} — Glossário`
|
|
145
|
+
- `🏛️ {SIGLA} — Domínio`
|
|
146
|
+
- `📏 {SIGLA} — Regras`
|
|
147
|
+
- `🔀 {SIGLA} — Fluxos`
|
|
148
|
+
- `📊 {SIGLA} — Tabelas de Referência`
|
|
149
|
+
- `🔌 {SIGLA} — Integrações`
|
|
150
|
+
- `🚀 Features`
|
|
151
|
+
- `📦 Arquivados`
|
|
152
|
+
- Business features: `🚀 {SIGLA}-NNN - Feature name`
|
|
153
|
+
- Infrastructure feature: `⚙️ {SIGLA}-000 - Infraestrutura e Scaffold`
|
|
154
|
+
|
|
155
|
+
**Step 3.1 — Visão do Produto** (max 1 page):
|
|
156
|
+
|
|
157
|
+
Must contain these sections:
|
|
158
|
+
- **O que e**: what the product is (1-2 paragraphs)
|
|
159
|
+
- **Para quem**: target users/personas, expanded beyond a single line
|
|
160
|
+
- **Por que existe**: business motivations
|
|
161
|
+
- **Premissas**: assumptions stated in the PO docs (copy them, don't summarize)
|
|
162
|
+
- **Escopo da v1**: what's in
|
|
163
|
+
- **Fora de escopo**: what's explicitly out
|
|
164
|
+
- **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.
|
|
165
|
+
- **Restricoes**: mandatory tech, environment, compliance constraints
|
|
166
|
+
|
|
167
|
+
**Step 3.2 — Glossario** (table format):
|
|
168
|
+
|
|
169
|
+
Columns: Termo | Definicao | Contexto de uso
|
|
170
|
+
|
|
171
|
+
Completeness criteria:
|
|
172
|
+
- Every domain noun mentioned in the PO documents must appear (entities, roles, states, concepts)
|
|
173
|
+
- Every technical component mentioned must appear (infrastructure, protocols, patterns)
|
|
174
|
+
- 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.
|
|
175
|
+
|
|
176
|
+
Minimum expected terms for any project:
|
|
177
|
+
- All entities (user, task, list, etc.)
|
|
178
|
+
- All states/enums (status values, priorities, etc.)
|
|
179
|
+
- All roles/personas
|
|
180
|
+
- All infrastructure components (DB, queue, cache, etc.)
|
|
181
|
+
- Domain-specific concepts (ownership, async processing, etc.)
|
|
182
|
+
|
|
183
|
+
**Step 3.3 — Dominio/** (parent page + 4 children):
|
|
184
|
+
|
|
185
|
+
**Regras** (table format):
|
|
186
|
+
- Columns: ID | Regra | Fonte | Verificavel
|
|
187
|
+
- ID: sequential (RN-01, RN-02, ...)
|
|
188
|
+
- **Fonte**: MUST reference the PRD section the rule was extracted from (ex: "PRD §9.4 — Gerenciamento de tarefas"). This enables traceability.
|
|
189
|
+
- Verificavel: how to test this rule (concrete, not vague)
|
|
190
|
+
- Group rules by domain area (ownership, auth, entities, etc.)
|
|
191
|
+
- After writing all rules, **re-read the PO documents** looking for "deve", "nao pode", "obrigatorio", "somente", "exclusivamente" — any missed rule must be added
|
|
192
|
+
|
|
193
|
+
**Fluxos**:
|
|
194
|
+
- One section per business flow
|
|
195
|
+
- Each flow: numbered steps describing the happy path
|
|
196
|
+
- After the numbered steps, add a **Mermaid** `flowchart TD` diagram visualizing the flow. Example:
|
|
197
|
+
```mermaid
|
|
198
|
+
flowchart TD
|
|
199
|
+
A[Usuário submete formulário] --> B{Dados válidos?}
|
|
200
|
+
B -->|Sim| C[Salvar no banco]
|
|
201
|
+
B -->|Não| D[Retornar erros]
|
|
202
|
+
C --> E[Enviar confirmação]
|
|
203
|
+
```
|
|
204
|
+
- **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."
|
|
205
|
+
- If a flow involves async processing, clearly mark the sync/async boundary
|
|
206
|
+
- **Sequence diagram**: if the flow involves **more than 1 system component** (e.g., Frontend, BFF, API, Worker, DB, RabbitMQ), add a **Mermaid `sequenceDiagram`** IN ADDITION to the flowchart, showing component interactions. The **flowchart** shows the LOGIC (decisions, paths). The **sequenceDiagram** shows the EXECUTION (who calls whom, sync vs async). Purely business flows (no technical interaction) only need the flowchart. Example:
|
|
207
|
+
```mermaid
|
|
208
|
+
sequenceDiagram
|
|
209
|
+
participant FE as Frontend
|
|
210
|
+
participant BFF as BFF Web
|
|
211
|
+
participant API as API
|
|
212
|
+
participant DB as PostgreSQL
|
|
213
|
+
participant RMQ as RabbitMQ
|
|
214
|
+
participant WRK as Worker
|
|
215
|
+
|
|
216
|
+
FE->>BFF: POST /bills (SSO Corp token)
|
|
217
|
+
BFF->>API: POST /api/v1/bills (JWT)
|
|
218
|
+
API->>DB: INSERT bills (status: GERANDO)
|
|
219
|
+
API->>RMQ: Publish fila_nova_fatura
|
|
220
|
+
API-->>BFF: 202 Accepted
|
|
221
|
+
BFF-->>FE: 202 Accepted
|
|
222
|
+
RMQ->>WRK: Consume fila_nova_fatura
|
|
223
|
+
WRK->>DB: UPDATE bills (status: GERADA)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Tabelas de Referencia**:
|
|
227
|
+
- All enums, categories, reference data
|
|
228
|
+
- For each enum: if values are defined in the PRD, list them. If inferred, mark "A CONFIRMAR"
|
|
229
|
+
- **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"
|
|
230
|
+
- After the table, add a **Mermaid** `stateDiagram-v2` visualizing the transitions. Example:
|
|
231
|
+
```mermaid
|
|
232
|
+
stateDiagram-v2
|
|
233
|
+
[*] --> Aberta
|
|
234
|
+
Aberta --> EmProgresso
|
|
235
|
+
EmProgresso --> Concluida
|
|
236
|
+
EmProgresso --> Bloqueada
|
|
237
|
+
Bloqueada --> EmProgresso
|
|
238
|
+
Concluida --> [*]
|
|
239
|
+
```
|
|
240
|
+
- Dashboard indicators with calculation formulas
|
|
241
|
+
|
|
242
|
+
**Integracoes**:
|
|
243
|
+
- Internal components: table with component, technology, responsibility
|
|
244
|
+
- Event flow: producer → broker → consumer → action
|
|
245
|
+
- For each event: define the minimum expected payload fields. Mark as "A CONFIRMAR — payload a definir na spec tecnica"
|
|
246
|
+
- External integrations: list or write "Nenhuma na v1"
|
|
247
|
+
|
|
248
|
+
**Step 3.4 — Structure pages:**
|
|
249
|
+
- Create `Features/` parent page under the project root if it doesn't exist
|
|
250
|
+
- Create `Arquivados/` parent page under the project root if it doesn't exist
|
|
251
|
+
|
|
252
|
+
**Step 3.5 — Create initial feature pages:**
|
|
253
|
+
|
|
254
|
+
**Step 3.5a — Feature 000 — Infraestrutura e Scaffold (mandatory for new projects):**
|
|
255
|
+
|
|
256
|
+
If `projects.yml` has `status: inception` (new project, no active repos), ALWAYS create as the FIRST feature:
|
|
257
|
+
|
|
258
|
+
- Title: `⚙️ {SIGLA}-000 - Infraestrutura e Scaffold`
|
|
259
|
+
- Label: `em-discovery`
|
|
260
|
+
- Content (in pt-BR):
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
| Campo | Valor |
|
|
264
|
+
|-------|-------|
|
|
265
|
+
| ID | {SIGLA}-000 |
|
|
266
|
+
| Depende de | — (nenhuma, esta é a base) |
|
|
267
|
+
| Complexidade | média |
|
|
268
|
+
| Repos envolvidos | {listar todos os repos de projects.yml} |
|
|
269
|
+
|
|
270
|
+
## Escopo
|
|
271
|
+
|
|
272
|
+
Criação da infraestrutura base para o projeto:
|
|
273
|
+
- Criação dos repositórios: {listar repos com nome e tipo}
|
|
274
|
+
- Pipeline de CI/CD (build, test, lint) para cada repo
|
|
275
|
+
- Docker Compose para ambiente local (todos os serviços + dependências)
|
|
276
|
+
- Script de criação do banco de dados (DDL completo)
|
|
277
|
+
- Health checks e endpoints de diagnóstico
|
|
278
|
+
- Configuração de variáveis de ambiente (.env, secrets)
|
|
279
|
+
- README com instruções de setup local
|
|
280
|
+
|
|
281
|
+
## Critério de aceite
|
|
282
|
+
|
|
283
|
+
- Todos os repos criados e acessíveis
|
|
284
|
+
- `docker-compose up` sobe o ambiente local completo
|
|
285
|
+
- Health check de cada serviço retorna 200
|
|
286
|
+
- Pipeline de CI passa em cada repo (build + tests)
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
All subsequent features ({SIGLA}-001 onwards) have an implicit dependency on {SIGLA}-000.
|
|
290
|
+
|
|
291
|
+
**Step 3.5b — Business features:**
|
|
292
|
+
|
|
293
|
+
Analyze the PO documents in `Demandas/` and identify distinct features/capabilities described. For EACH feature identified:
|
|
294
|
+
|
|
295
|
+
1. Create a child page under `Features/` with title: `🚀 {SIGLA}-NNN - Feature name` (numbering sequential: 001, 002, ...). E.g., `🚀 FT-001 - Cadastro e Autenticação`, `🚀 TD-003 - Gerenciamento de Tarefas`
|
|
296
|
+
2. Content MUST start with a metadata table:
|
|
297
|
+
```
|
|
298
|
+
| Campo | Valor |
|
|
299
|
+
|-------|-------|
|
|
300
|
+
| ID | {SIGLA}-NNN |
|
|
301
|
+
| Depende de | {SIGLA}-000 (e outras se houver, separadas por vírgula) |
|
|
302
|
+
| Complexidade | baixa / média / alta |
|
|
303
|
+
| Repos envolvidos | {quais repos participam} |
|
|
304
|
+
```
|
|
305
|
+
After the table: 1-2 paragraphs extracted from PO documents describing what the feature does.
|
|
306
|
+
3. Add label `em-discovery` (ready for /discovery to process)
|
|
307
|
+
|
|
308
|
+
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."
|
|
309
|
+
|
|
310
|
+
This step ensures /discovery always finds a feature page to work with.
|
|
311
|
+
|
|
312
|
+
### 4. Set up the spec repo
|
|
313
|
+
|
|
314
|
+
In the local spec repo:
|
|
315
|
+
|
|
316
|
+
**Fill `projects.yml`:**
|
|
317
|
+
- Project name, domain, status, team size
|
|
318
|
+
- **Sigla**: `sigla: XX` — short abbreviation (2-4 letters) used as prefix in Confluence titles and feature IDs. Derive from project name (e.g., FinTrack → FT, Todo → TD, CRM → CRM). Ask the dev if ambiguous.
|
|
319
|
+
- Stack (from PO's docs or ask the dev)
|
|
320
|
+
- **VCS**: `vcs: github | gitlab` and `vcs_org: {org/group}` — ask the dev if not obvious from context
|
|
321
|
+
- **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`.
|
|
322
|
+
- External dependencies
|
|
323
|
+
- Confluence space key and root_page_id (if multi-project layout)
|
|
324
|
+
|
|
325
|
+
**Create directories:**
|
|
326
|
+
- `docs/lessons/` — empty (used by /dev to log surprises)
|
|
327
|
+
- `docs/decisions/` — empty (used for ADRs)
|
|
328
|
+
|
|
329
|
+
**Generate `docs/architecture.md` draft:**
|
|
330
|
+
- System components (table: component, technology, responsibility)
|
|
331
|
+
- Data flow diagram — use a **Mermaid** `flowchart` block showing sync (solid arrows `-->`) and async (dotted arrows `-.->`) flows. Example:
|
|
332
|
+
```mermaid
|
|
333
|
+
flowchart LR
|
|
334
|
+
A[Client] -->|HTTP| B[API]
|
|
335
|
+
B -->|sync| C[Database]
|
|
336
|
+
B -.->|async| D[Queue]
|
|
337
|
+
D -.-> E[Worker]
|
|
338
|
+
```
|
|
339
|
+
- Data model — use a **Mermaid** `erDiagram` block for high-level entity relationships. Example:
|
|
340
|
+
```mermaid
|
|
341
|
+
erDiagram
|
|
342
|
+
Usuario ||--o{ Tarefa : possui
|
|
343
|
+
Tarefa }o--|| Status : tem
|
|
344
|
+
```
|
|
345
|
+
- Events identified (table: event, generates notification?, generates history?)
|
|
346
|
+
- Environment/infrastructure (how it runs)
|
|
347
|
+
- **Decisoes em aberto**: list ALL "A CONFIRMAR" items from all Confluence pages, ranked by impact. High impact = blocks /spec or /dev. Format:
|
|
348
|
+
|
|
349
|
+
```
|
|
350
|
+
| # | Decisao | Impacto | Bloqueia | Status |
|
|
351
|
+
|---|---------|---------|----------|--------|
|
|
352
|
+
| 1 | Worker separado ou parte da API? | Alto — define repos e CI | /spec | aberta |
|
|
353
|
+
| 2 | Valores do enum de Status | Medio — afeta model e validacao | /dev | aberta |
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
Status values: `aberta`, `resolvida — [decisão tomada]`. The /discovery updates this column when resolving decisions (exit gate).
|
|
357
|
+
|
|
358
|
+
Mark sections as "DRAFT — validar com o time"
|
|
359
|
+
|
|
360
|
+
### MCP failure recovery
|
|
361
|
+
|
|
362
|
+
If a Confluence page creation fails mid-flow:
|
|
363
|
+
1. Log which pages were successfully created and which failed
|
|
364
|
+
2. Save pending page creations to `docs/pending-confluence-updates.md` with: target parent page, page title, content summary, date
|
|
365
|
+
3. Report to dev: "Setup parcial — {N} de {total} páginas criadas. Páginas faltantes: {list}. Re-execute /setup para tentar criar as faltantes."
|
|
366
|
+
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 (by listing children of the parent page) and only create the missing ones — never duplicate. Remove applied entries from the file.
|
|
367
|
+
|
|
368
|
+
### 5. Self-review
|
|
369
|
+
|
|
370
|
+
Before closing the loop, the agent MUST do a self-review:
|
|
371
|
+
|
|
372
|
+
1. **Re-read the original PO documents in Demandas/** in full
|
|
373
|
+
2. **Compare against each generated page** and check:
|
|
374
|
+
- Did I miss any section of the PO documents?
|
|
375
|
+
- Did I miss any term for the glossary?
|
|
376
|
+
- Did I miss any rule?
|
|
377
|
+
- Did I miss any flow?
|
|
378
|
+
- Did I invent anything that isn't in the PO documents?
|
|
379
|
+
3. **Fix any gaps found** by updating the pages
|
|
380
|
+
4. **Report** what was added/fixed in the self-review
|
|
381
|
+
|
|
382
|
+
### 6. Close the loop
|
|
383
|
+
|
|
384
|
+
- Change demand label on Confluence: `processando` → `processado`
|
|
385
|
+
- Verify label transition happened (read back the page to confirm)
|
|
386
|
+
- If there are "Nao processados" attachments, add a comment on the demand page listing them
|
|
387
|
+
- Notify Google Chat (if `GCHAT_WEBHOOK_URL` is not set, the script skips silently).
|
|
388
|
+
**Choose the correct script for the OS:**
|
|
389
|
+
- Windows (PowerShell): `powershell -ExecutionPolicy Bypass -File ./scripts/notify-gchat.ps1`
|
|
390
|
+
- Linux/macOS (Bash): `bash ./scripts/notify-gchat.sh`
|
|
391
|
+
|
|
392
|
+
Parameters (same for both scripts):
|
|
393
|
+
|
|
394
|
+
--card --title "✅ Projeto configurado" --subtitle "{project_name}" --body "📄 <b>Páginas criadas:</b>
|
|
395
|
+
• Visão do Produto
|
|
396
|
+
• Glossário ({term_count} termos)
|
|
397
|
+
• Domínio (Regras, Fluxos, Tabelas, Integrações)
|
|
398
|
+
• Features ({feature_count} identificadas)
|
|
399
|
+
• Arquivados
|
|
400
|
+
|
|
401
|
+
📊 <b>Métricas:</b>
|
|
402
|
+
• {rule_count} regras de negócio
|
|
403
|
+
• {flow_count} fluxos documentados
|
|
404
|
+
• {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}"
|
|
405
|
+
|
|
406
|
+
Replace `{}` placeholders with actual values from the execution context.
|
|
407
|
+
|
|
408
|
+
## Rules
|
|
409
|
+
|
|
410
|
+
1. NEVER invent business context — everything comes from PO's documents
|
|
411
|
+
2. If something is unclear, mark it as "A CONFIRMAR" (not assumed)
|
|
412
|
+
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.
|
|
413
|
+
4. Visão do Produto max 1 page
|
|
414
|
+
5. Glossary entries must have: term + definition + context of use
|
|
415
|
+
6. Domain rules must be verifiable (not vague) and traceable to a PRD section
|
|
416
|
+
7. Every "A CONFIRMAR" must state WHY it's ambiguous (what the PRD says vs. what's missing)
|
|
417
|
+
8. Repos detected from the PO documents must be declared in projects.yml (with status: planned), never commented out
|
|
418
|
+
|
|
419
|
+
## Quality criteria
|
|
420
|
+
|
|
421
|
+
The output is considered good when:
|
|
422
|
+
|
|
423
|
+
- **Glossario**: covers 100% of domain nouns and technical components mentioned in the PO documents
|
|
424
|
+
- **Regras**: every "deve", "nao pode", "obrigatorio" in the PO documents has a corresponding numbered rule
|
|
425
|
+
- **Fluxos**: every flow has a happy path AND exceptions documented
|
|
426
|
+
- **Tabelas**: every enum has values (confirmed or "A CONFIRMAR"), state entities have transition tables
|
|
427
|
+
- **Integracoes**: every async flow has events with producers, consumers, and expected payload fields
|
|
428
|
+
- **Architecture.md**: has an "open decisions" table ranked by impact
|
|
429
|
+
- **projects.yml**: has all detected repos declared (not commented), with stack and status
|
|
430
|
+
- **Self-review**: was performed, gaps were found and fixed (or confirmed none exist)
|
|
431
|
+
|
|
432
|
+
## Validation checklist
|
|
433
|
+
|
|
434
|
+
### Prerequisite checks
|
|
435
|
+
- [ ] `Demandas/` exists under project root
|
|
436
|
+
- [ ] `Demandas/` has at least one child page or attachment
|
|
437
|
+
- [ ] Demand label transition: (none/novo) → processando → processado
|
|
438
|
+
|
|
439
|
+
### Content generated
|
|
440
|
+
- [ ] 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)
|
|
441
|
+
- [ ] Glossario: covers all domain terms from PRD (verified by re-read)
|
|
442
|
+
- [ ] Regras: all rules have ID + Fonte (PRD section) + Verificavel
|
|
443
|
+
- [ ] Fluxos: all flows have happy path + exceptions + Mermaid flowchart TD
|
|
444
|
+
- [ ] Tabelas de Referencia: all enums defined, state transitions documented + Mermaid stateDiagram-v2
|
|
445
|
+
- [ ] Integracoes: all events have producer + consumer + expected payload
|
|
446
|
+
- [ ] Features/ page created
|
|
447
|
+
- [ ] Initial feature pages created under Features/ (with label `em-discovery`)
|
|
448
|
+
- [ ] Arquivados/ page created
|
|
449
|
+
|
|
450
|
+
### Spec repo updated
|
|
451
|
+
- [ ] projects.yml filled with all detected repos (status: planned, not commented)
|
|
452
|
+
- [ ] docs/architecture.md draft with Mermaid diagrams (flowchart, erDiagram) and open decisions table
|
|
453
|
+
|
|
454
|
+
### Quality gates
|
|
455
|
+
- [ ] Self-review performed (re-read PRD vs. output)
|
|
456
|
+
- [ ] No business context was invented
|
|
457
|
+
- [ ] All ambiguities marked "A CONFIRMAR" with explanation
|
|
458
|
+
- [ ] Unreadable attachments listed as "NAO PROCESSADO"
|
|
459
|
+
- [ ] Demand label changed to `processado` (verified)
|