@guilhermefsousa/open-spec-kit 0.0.9 → 0.0.11
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 +1 -1
- package/bin/open-spec-kit.js +7 -0
- package/package.json +1 -1
- package/src/commands/doctor.js +107 -197
- package/src/commands/init.js +112 -347
- package/src/commands/install.js +393 -0
- package/src/commands/update.js +117 -165
- package/src/schemas/spec.schema.js +3 -3
- package/src/utils/global-path.js +73 -0
- package/templates/agents/agents/spec-hub.agent.md +13 -13
- package/templates/agents/rules/hub_structure.instructions.md +1 -1
- package/templates/agents/rules/ownership.instructions.md +39 -39
- package/templates/agents/skills/dev-orchestrator/SKILL.md +17 -17
- package/templates/agents/skills/discovery/SKILL.md +17 -17
- package/templates/agents/skills/setup-project/SKILL.md +15 -15
- package/templates/agents/skills/specifying-features/SKILL.md +28 -28
- package/templates/github/agents/spec-hub.agent.md +5 -5
- package/templates/github/copilot-instructions.md +9 -9
- package/templates/github/instructions/hub_structure.instructions.md +1 -1
- package/templates/github/instructions/ownership.instructions.md +9 -9
- package/templates/github/skills/dev-orchestrator/SKILL.md +619 -5
- package/templates/github/skills/discovery/SKILL.md +419 -5
- package/templates/github/skills/setup-project/SKILL.md +496 -5
- package/templates/github/skills/specifying-features/SKILL.md +417 -5
- /package/templates/github/prompts/{dev.prompt.md → osk-build.prompt.md} +0 -0
- /package/templates/github/prompts/{discovery.prompt.md → osk-discover.prompt.md} +0 -0
- /package/templates/github/prompts/{setup.prompt.md → osk-init.prompt.md} +0 -0
- /package/templates/github/prompts/{nova-feature.prompt.md → osk-spec.prompt.md} +0 -0
|
@@ -1,9 +1,500 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: "
|
|
2
|
+
name: osk-init
|
|
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]"
|
|
4
7
|
---
|
|
5
8
|
|
|
6
|
-
# Setup Project
|
|
9
|
+
# Setup Project
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
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: `/osk-init 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 a page whose title CONTAINS "Demandas" (case-insensitive, partial match). This allows variations like "Demandas", "TFB — Demandas", "Demandas v2", etc. Save as `DEMANDAS_ID`.
|
|
64
|
+
- If multiple matches → use the first one. Log: "Múltiplas páginas com 'Demandas' encontradas. Usando: {title} ({id})."
|
|
65
|
+
- If not found → **STOP**: "Pasta Demandas/ não encontrada. O PO precisa criá-la como filha da página raiz."
|
|
66
|
+
|
|
67
|
+
**1d.** Check demand label. If no `novo` label, add `novo`. Then change to `processando`.
|
|
68
|
+
|
|
69
|
+
**1e.** List DIRECT children of `DEMANDAS_ID` (1 MCP call). Save as `DEMAND_PAGES`.
|
|
70
|
+
- If empty → **STOP**: "Demandas/ está vazia. O PO precisa adicionar documentos."
|
|
71
|
+
|
|
72
|
+
**1f.** For EACH page in `DEMAND_PAGES`:
|
|
73
|
+
- Read FULL content (entire body) via MCP
|
|
74
|
+
- Read page attachments via MCP
|
|
75
|
+
- Do **NOT** navigate to sub-pages — read only this level
|
|
76
|
+
|
|
77
|
+
**Attachment handling:**
|
|
78
|
+
- If an attachment can be read (text, markdown, etc.): read and incorporate
|
|
79
|
+
- 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."
|
|
80
|
+
|
|
81
|
+
**Call budget:**
|
|
82
|
+
|
|
83
|
+
| Operation | Calls |
|
|
84
|
+
|-----------|-------|
|
|
85
|
+
| Children of root | 1 |
|
|
86
|
+
| Children of Demandas | 1 |
|
|
87
|
+
| Content of each demand | N (one per page) |
|
|
88
|
+
| **Total** | **2 + N** |
|
|
89
|
+
|
|
90
|
+
**FORBIDDEN:**
|
|
91
|
+
- Generic CQL searches
|
|
92
|
+
- Listing ancestors
|
|
93
|
+
- Recursive navigation (children of children)
|
|
94
|
+
- Using curl/fetch/direct HTTP
|
|
95
|
+
|
|
96
|
+
**After reading, compile a structured understanding of:**
|
|
97
|
+
- What the product is and who it serves
|
|
98
|
+
- Business domain rules and flows
|
|
99
|
+
- Existing systems and integrations
|
|
100
|
+
- Key terms and concepts
|
|
101
|
+
- Stack and technology constraints
|
|
102
|
+
- Repos needed (from architecture description, or inferred from stack)
|
|
103
|
+
|
|
104
|
+
### 2. Read Figma design context (optional)
|
|
105
|
+
|
|
106
|
+
**Condition**: this step ONLY runs if BOTH conditions are true:
|
|
107
|
+
1. `projects.yml` has a `figma:` section with `file_url` filled
|
|
108
|
+
2. The Figma MCP is available (`figma` server configured in `.mcp.json`)
|
|
109
|
+
|
|
110
|
+
If `projects.yml` has `figma.file_url` but the MCP is not available, **warn the user**: "⚠ Figma configurado em projects.yml mas MCP Figma não disponível. Execute 'open-spec-kit doctor' para diagnosticar. Continuando sem contexto do Figma."
|
|
111
|
+
|
|
112
|
+
If `projects.yml` does NOT have a `figma:` section, skip silently (Figma is optional).
|
|
113
|
+
|
|
114
|
+
**If available:**
|
|
115
|
+
1. Extract the file key from the URL in `projects.yml` → `figma.file_url`
|
|
116
|
+
- 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`)
|
|
117
|
+
2. Use `get_design_context` with the file key to get an overview
|
|
118
|
+
3. Use `get_metadata` to get the page/frame structure
|
|
119
|
+
4. Incorporate into the structured understanding (compiled in step 1):
|
|
120
|
+
- **Screens identified**: list main Figma pages/frames — use to enrich Feature identification (Step 3.5)
|
|
121
|
+
- **Design system components**: if reusable components exist, register them — use to enrich the Glossário (Step 3.2)
|
|
122
|
+
- **Visual flows**: if Figma organizes frames into flows (e.g., "Login Flow", "Onboarding"), map them — use to enrich Domínio/Fluxos (Step 3.3)
|
|
123
|
+
- **Visible text**: labels, placeholders, error messages — use to enrich Regras (validations)
|
|
124
|
+
|
|
125
|
+
**Do NOT use `get_screenshot`** in this step — the goal is structural context, not visual captures.
|
|
126
|
+
|
|
127
|
+
When generating the living docs (step 3), reference Figma screens where relevant:
|
|
128
|
+
- In **Fluxos**: "Fluxo visual no Figma: frame '{frame_name}'"
|
|
129
|
+
- In **Visão do Produto**: mention if Figma contains navigable prototypes
|
|
130
|
+
|
|
131
|
+
**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."
|
|
132
|
+
|
|
133
|
+
### 3. Generate living docs on Confluence
|
|
134
|
+
|
|
135
|
+
**CRITICAL: All pages in this section MUST be created as children of `ROOT_ID` (the project root page), NOT as children of `DEMANDAS_ID`. `Demandas/` is a SIBLING — the generated pages go NEXT TO it, not INSIDE it. Use `ROOT_ID` as the parent_id for every `confluence_create_page` call in this step.**
|
|
136
|
+
|
|
137
|
+
Via MCP Confluence, create these pages **under the project root (`ROOT_ID`)**, in this order.
|
|
138
|
+
|
|
139
|
+
**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). **Read the sigla from `projects.yml` field `project.sigla` — NEVER derive or invent a new one.** This avoids title conflicts within the same Confluence space. The project root page does NOT get a prefix (it's already unique by definition).
|
|
140
|
+
|
|
141
|
+
Title format:
|
|
142
|
+
- Domain pages: `{SIGLA} — Visão do Produto`, `{SIGLA} — Glossário`, etc.
|
|
143
|
+
- Features: `{SIGLA}-NNN - Feature name` (e.g., `FT-001 - Cadastro e Autenticação`)
|
|
144
|
+
|
|
145
|
+
In simple layout (1 space = 1 project), the prefix is optional — no conflict risk.
|
|
146
|
+
|
|
147
|
+
**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):
|
|
148
|
+
- `🎯 {SIGLA} — Visão do Produto`
|
|
149
|
+
- `📖 {SIGLA} — Glossário`
|
|
150
|
+
- `🏛️ {SIGLA} — Domínio`
|
|
151
|
+
- `📏 {SIGLA} — Regras`
|
|
152
|
+
- `🔀 {SIGLA} — Fluxos`
|
|
153
|
+
- `📊 {SIGLA} — Tabelas de Referência`
|
|
154
|
+
- `🔌 {SIGLA} — Integrações`
|
|
155
|
+
- `🚀 {SIGLA} — Features`
|
|
156
|
+
- `📦 {SIGLA} — Arquivados`
|
|
157
|
+
- Business features: `🚀 {SIGLA}-NNN - Feature name`
|
|
158
|
+
- Infrastructure feature: `⚙️ {SIGLA}-000 - Infraestrutura e Scaffold`
|
|
159
|
+
|
|
160
|
+
**Step 3.1 — Visão do Produto** (max 1 page):
|
|
161
|
+
|
|
162
|
+
Must contain these sections:
|
|
163
|
+
- **O que e**: what the product is (1-2 paragraphs)
|
|
164
|
+
- **Para quem**: target users/personas, expanded beyond a single line
|
|
165
|
+
- **Por que existe**: business motivations
|
|
166
|
+
- **Premissas**: assumptions stated in the PO docs (copy them, don't summarize)
|
|
167
|
+
- **Escopo da v1**: what's in
|
|
168
|
+
- **Fora de escopo**: what's explicitly out
|
|
169
|
+
- **Riscos e dependências críticas**: external systems without defined contracts, teams/knowledge dependencies, technical unknowns. If PO docs mention integration with an external system but no contract or API is defined, register as risk. If PO mentions a technology the team has no experience with, register as risk. If no risks identified, write "Nenhum risco crítico identificado nos documentos do PO."
|
|
170
|
+
- **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.
|
|
171
|
+
- **Restricoes**: mandatory tech, environment, compliance constraints
|
|
172
|
+
|
|
173
|
+
**Step 3.2 — Glossario** (table format):
|
|
174
|
+
|
|
175
|
+
Columns: Termo | Definicao | Contexto de uso
|
|
176
|
+
|
|
177
|
+
Completeness criteria:
|
|
178
|
+
- Every domain noun mentioned in the PO documents must appear (entities, roles, states, concepts)
|
|
179
|
+
- Every technical component mentioned must appear (infrastructure, protocols, patterns)
|
|
180
|
+
- 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.
|
|
181
|
+
|
|
182
|
+
Minimum expected terms for any project:
|
|
183
|
+
- All entities (user, task, list, etc.)
|
|
184
|
+
- All states/enums (status values, priorities, etc.)
|
|
185
|
+
- All roles/personas
|
|
186
|
+
- All infrastructure components (DB, queue, cache, etc.)
|
|
187
|
+
- Domain-specific concepts (ownership, async processing, etc.)
|
|
188
|
+
|
|
189
|
+
**Step 3.3 — Dominio/** (parent page + 4 children):
|
|
190
|
+
|
|
191
|
+
**Regras** (table format):
|
|
192
|
+
- Columns: ID | Regra | Fonte | Verificavel
|
|
193
|
+
- ID: sequential (RN-01, RN-02, ...)
|
|
194
|
+
- **Fonte**: MUST reference the PRD section the rule was extracted from (ex: "PRD §9.4 — Gerenciamento de tarefas"). This enables traceability.
|
|
195
|
+
- Verificavel: how to test this rule (concrete, not vague)
|
|
196
|
+
- Group rules by domain area (ownership, auth, entities, etc.)
|
|
197
|
+
- After writing all rules, **re-read the PO documents** looking for "deve", "nao pode", "obrigatorio", "somente", "exclusivamente" — any missed rule must be added
|
|
198
|
+
|
|
199
|
+
**Fluxos**:
|
|
200
|
+
- One section per business flow
|
|
201
|
+
- Each flow: numbered steps describing the happy path
|
|
202
|
+
- After the numbered steps, add a **Mermaid** `flowchart TD` diagram visualizing the flow. Example:
|
|
203
|
+
```mermaid
|
|
204
|
+
flowchart TD
|
|
205
|
+
A[Usuário submete formulário] --> B{Dados válidos?}
|
|
206
|
+
B -->|Sim| C[Salvar no banco]
|
|
207
|
+
B -->|Não| D[Retornar erros]
|
|
208
|
+
C --> E[Enviar confirmação]
|
|
209
|
+
```
|
|
210
|
+
- **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."
|
|
211
|
+
- If a flow involves async processing, clearly mark the sync/async boundary
|
|
212
|
+
- **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:
|
|
213
|
+
```mermaid
|
|
214
|
+
sequenceDiagram
|
|
215
|
+
participant FE as Frontend
|
|
216
|
+
participant BFF as BFF Web
|
|
217
|
+
participant API as API
|
|
218
|
+
participant DB as PostgreSQL
|
|
219
|
+
participant RMQ as RabbitMQ
|
|
220
|
+
participant WRK as Worker
|
|
221
|
+
|
|
222
|
+
FE->>BFF: POST /bills (SSO Corp token)
|
|
223
|
+
BFF->>API: POST /api/v1/bills (JWT)
|
|
224
|
+
API->>DB: INSERT bills (status: GERANDO)
|
|
225
|
+
API->>RMQ: Publish fila_nova_fatura
|
|
226
|
+
API-->>BFF: 202 Accepted
|
|
227
|
+
BFF-->>FE: 202 Accepted
|
|
228
|
+
RMQ->>WRK: Consume fila_nova_fatura
|
|
229
|
+
WRK->>DB: UPDATE bills (status: GERADA)
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**Tabelas de Referencia**:
|
|
233
|
+
- All enums, categories, reference data
|
|
234
|
+
- For each enum: if values are defined in the PRD, list them. If inferred, mark "A CONFIRMAR"
|
|
235
|
+
- **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"
|
|
236
|
+
- After the table, add a **Mermaid** `stateDiagram-v2` visualizing the transitions. Example:
|
|
237
|
+
```mermaid
|
|
238
|
+
stateDiagram-v2
|
|
239
|
+
[*] --> Aberta
|
|
240
|
+
Aberta --> EmProgresso
|
|
241
|
+
EmProgresso --> Concluida
|
|
242
|
+
EmProgresso --> Bloqueada
|
|
243
|
+
Bloqueada --> EmProgresso
|
|
244
|
+
Concluida --> [*]
|
|
245
|
+
```
|
|
246
|
+
- Dashboard indicators with calculation formulas
|
|
247
|
+
|
|
248
|
+
**Integracoes**:
|
|
249
|
+
- Internal components: table with component, technology, responsibility
|
|
250
|
+
- Event flow: producer → broker → consumer → action
|
|
251
|
+
- For each event: define the minimum expected payload fields. Mark as "A CONFIRMAR — payload a definir na spec tecnica"
|
|
252
|
+
- External integrations: list or write "Nenhuma na v1"
|
|
253
|
+
|
|
254
|
+
**Step 3.4 — Structure pages:**
|
|
255
|
+
- Create `🚀 {SIGLA} — Features` parent page under the project root if it doesn't exist
|
|
256
|
+
- Create `📦 {SIGLA} — Arquivados` parent page under the project root if it doesn't exist
|
|
257
|
+
|
|
258
|
+
**Step 3.5 — Create initial feature pages:**
|
|
259
|
+
|
|
260
|
+
**Step 3.5a — Feature 000 — Infraestrutura e Scaffold (mandatory for new projects):**
|
|
261
|
+
|
|
262
|
+
If `projects.yml` has `status: inception` (new project, no active repos), ALWAYS create as the FIRST feature:
|
|
263
|
+
|
|
264
|
+
- Title: `⚙️ {SIGLA}-000 - Infraestrutura e Scaffold`
|
|
265
|
+
- Label: `em-discovery`
|
|
266
|
+
- Content (in pt-BR):
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
| Campo | Valor |
|
|
270
|
+
|-------|-------|
|
|
271
|
+
| ID | {SIGLA}-000 |
|
|
272
|
+
| Depende de | — (nenhuma, esta é a base) |
|
|
273
|
+
| Complexidade | média |
|
|
274
|
+
| Repos envolvidos | {listar todos os repos de projects.yml} |
|
|
275
|
+
|
|
276
|
+
## Escopo
|
|
277
|
+
|
|
278
|
+
Criação da infraestrutura base para o projeto:
|
|
279
|
+
- Criação dos repositórios: {listar repos com nome e tipo}
|
|
280
|
+
- Pipeline de CI/CD (build, test, lint) para cada repo
|
|
281
|
+
- Docker Compose para ambiente local (todos os serviços + dependências)
|
|
282
|
+
- Script de criação do banco de dados (DDL completo)
|
|
283
|
+
- Health checks e endpoints de diagnóstico
|
|
284
|
+
- Configuração de variáveis de ambiente (.env, secrets)
|
|
285
|
+
- README com instruções de setup local
|
|
286
|
+
|
|
287
|
+
## Critério de aceite
|
|
288
|
+
|
|
289
|
+
- Todos os repos criados e acessíveis
|
|
290
|
+
- `docker-compose up` sobe o ambiente local completo
|
|
291
|
+
- Health check de cada serviço retorna 200
|
|
292
|
+
- Pipeline de CI passa em cada repo (build + tests)
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
All subsequent features ({SIGLA}-001 onwards) have an implicit dependency on {SIGLA}-000.
|
|
296
|
+
|
|
297
|
+
**Step 3.5b — Business features:**
|
|
298
|
+
|
|
299
|
+
**Reminder: feature pages are children of `{SIGLA} — Features` (which is a child of `ROOT_ID`). Do NOT create features inside `Demandas/`.**
|
|
300
|
+
|
|
301
|
+
**Follow this feature identification algorithm — both phases are mandatory:**
|
|
302
|
+
|
|
303
|
+
**Phase A — Map PO sections to feature candidates:**
|
|
304
|
+
1. Read each PO document in `Demandas/`
|
|
305
|
+
2. Identify every NUMBERED SECTION or HEADING that describes a distinct user capability (look for: "Objetivo:", "Como [persona]...", numbered items "0.", "1.", "2.", or distinct headings with acceptance criteria)
|
|
306
|
+
3. One section with a distinct objective = one feature candidate
|
|
307
|
+
4. Record for each candidate: source reference (e.g., "Regra de Negocio §2"), title, number of acceptance criteria
|
|
308
|
+
5. If a document has NO numbered sections (free-form text), identify capabilities by change of theme, persona, or objective — each distinct capability = one candidate
|
|
309
|
+
|
|
310
|
+
**Phase B — Cross-cutting concern sweep:**
|
|
311
|
+
After listing business features from Phase A, scan ALL PO documents AND architecture docs for these triggers. If found AND no Phase A candidate already covers the concern explicitly, CREATE a dedicated feature:
|
|
312
|
+
|
|
313
|
+
| Trigger keywords in input docs | Feature to create |
|
|
314
|
+
|-------------------------------|-------------------|
|
|
315
|
+
| SSO, JWT, OAuth, roles, permissões, autorização, autenticação, LGPD, rate limit | {SIGLA}-NNN - Autenticação e Autorização |
|
|
316
|
+
| automático, SLA, prazo, timeout, scheduled, job, cron, fechamento automático | {SIGLA}-NNN - Processos Automáticos e SLA |
|
|
317
|
+
|
|
318
|
+
General principle: any capability mentioned in the PO that is NOT tied to a specific user screen or flow but affects multiple features should be evaluated as a potential cross-cutting feature.
|
|
319
|
+
|
|
320
|
+
If the concern IS already an explicit PO section (identified in Phase A as its own candidate), do NOT create a duplicate.
|
|
321
|
+
|
|
322
|
+
**After identifying all features, create a page for EACH.** For each feature:
|
|
323
|
+
|
|
324
|
+
1. Create a child page under `{SIGLA} — Features` with title: `🚀 {SIGLA}-NNN - Feature name` (numbering sequential: 001, 002, ...). E.g., `🚀 FT-001 - Cadastro e Autenticação`, `🚀 TD-003 - Gerenciamento de Tarefas`
|
|
325
|
+
2. Content MUST follow this template (in pt-BR):
|
|
326
|
+
```
|
|
327
|
+
| Campo | Valor |
|
|
328
|
+
|-------|-------|
|
|
329
|
+
| ID | {SIGLA}-NNN |
|
|
330
|
+
| Depende de | {SIGLA}-000 (e outras se houver, separadas por vírgula) |
|
|
331
|
+
| Complexidade | baixa / média / alta |
|
|
332
|
+
| Repos envolvidos | {quais repos participam} |
|
|
333
|
+
| Seções do PO | {source sections, e.g., "Regra de Negocio §2, §7; DefinicoesTecnicas §2.2"} |
|
|
334
|
+
|
|
335
|
+
## Escopo
|
|
336
|
+
{bullet list of what this feature includes — extracted from PO docs, not invented}
|
|
337
|
+
```
|
|
338
|
+
3. Add label `em-discovery` (ready for /osk-discover to process)
|
|
339
|
+
|
|
340
|
+
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 /osk-discover."
|
|
341
|
+
|
|
342
|
+
This step ensures /osk-discover always finds a feature page to work with.
|
|
343
|
+
|
|
344
|
+
### 4. Set up the spec repo
|
|
345
|
+
|
|
346
|
+
In the local spec repo:
|
|
347
|
+
|
|
348
|
+
**Fill `projects.yml`:**
|
|
349
|
+
- Project name, domain, status, team size
|
|
350
|
+
- **Sigla**: `sigla: XX` — short abbreviation (2-4 letters) used as prefix in Confluence titles and feature IDs. **MUST read from `projects.yml` field `project.sigla`** — this was already set by the user during `open-spec-kit init`. NEVER derive or invent a new sigla. If `projects.yml` has no sigla, ask the dev.
|
|
351
|
+
- Stack (from PO's docs or ask the dev)
|
|
352
|
+
- **VCS**: `vcs: github | gitlab` and `vcs_org: {org/group}` — ask the dev if not obvious from context
|
|
353
|
+
- **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`.
|
|
354
|
+
- External dependencies
|
|
355
|
+
- Confluence space key and root_page_id (if multi-project layout)
|
|
356
|
+
|
|
357
|
+
**Create directories:**
|
|
358
|
+
- `docs/lessons/` — empty (used by /osk-build to log surprises)
|
|
359
|
+
- `docs/decisions/` — empty (used for ADRs)
|
|
360
|
+
|
|
361
|
+
**Generate `docs/architecture.md` draft:**
|
|
362
|
+
- System components (table: component, technology, responsibility)
|
|
363
|
+
- Data flow diagram — use a **Mermaid** `flowchart` block showing sync (solid arrows `-->`) and async (dotted arrows `-.->`) flows. Example:
|
|
364
|
+
```mermaid
|
|
365
|
+
flowchart LR
|
|
366
|
+
A[Client] -->|HTTP| B[API]
|
|
367
|
+
B -->|sync| C[Database]
|
|
368
|
+
B -.->|async| D[Queue]
|
|
369
|
+
D -.-> E[Worker]
|
|
370
|
+
```
|
|
371
|
+
- Data model — use a **Mermaid** `erDiagram` block for high-level entity relationships. Example:
|
|
372
|
+
```mermaid
|
|
373
|
+
erDiagram
|
|
374
|
+
Usuario ||--o{ Tarefa : possui
|
|
375
|
+
Tarefa }o--|| Status : tem
|
|
376
|
+
```
|
|
377
|
+
- Events identified (table: event, generates notification?, generates history?)
|
|
378
|
+
- Environment/infrastructure (how it runs)
|
|
379
|
+
- **Decisoes em aberto**: list ALL "A CONFIRMAR" items from all Confluence pages, ranked by impact. High impact = blocks /osk-spec or /osk-build. Format:
|
|
380
|
+
|
|
381
|
+
```
|
|
382
|
+
| # | Decisao | Impacto | Bloqueia | Status |
|
|
383
|
+
|---|---------|---------|----------|--------|
|
|
384
|
+
| 1 | Worker separado ou parte da API? | Alto — define repos e CI | /osk-spec | aberta |
|
|
385
|
+
| 2 | Valores do enum de Status | Médio — afeta model e validação | /osk-build | aberta |
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
Status values: `aberta`, `resolvida — [decisão tomada]`. The /osk-discover updates this column when resolving decisions (exit gate).
|
|
389
|
+
|
|
390
|
+
Mark sections as "DRAFT — validar com o time"
|
|
391
|
+
|
|
392
|
+
### MCP failure recovery
|
|
393
|
+
|
|
394
|
+
If a Confluence page creation fails mid-flow:
|
|
395
|
+
1. Log which pages were successfully created and which failed
|
|
396
|
+
2. Save pending page creations to `docs/pending-confluence-updates.md` with: target parent page, page title, content summary, date
|
|
397
|
+
3. Report to dev: "Setup parcial — {N} de {total} páginas criadas. Páginas faltantes: {list}. Re-execute /osk-init para tentar criar as faltantes."
|
|
398
|
+
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.
|
|
399
|
+
|
|
400
|
+
### 5. Self-review
|
|
401
|
+
|
|
402
|
+
Before closing the loop, the agent MUST do a self-review:
|
|
403
|
+
|
|
404
|
+
1. **Re-read the original PO documents in Demandas/** in full
|
|
405
|
+
2. **Compare against each generated page** and check:
|
|
406
|
+
- Did I miss any section of the PO documents?
|
|
407
|
+
- Did I miss any term for the glossary?
|
|
408
|
+
- Did I miss any rule?
|
|
409
|
+
- Did I miss any flow?
|
|
410
|
+
- Did I invent anything that isn't in the PO documents?
|
|
411
|
+
3. **Fix any gaps found** by updating the pages
|
|
412
|
+
4. **Report** what was added/fixed in the self-review
|
|
413
|
+
5. **Feature coverage**: for EACH numbered section or distinct capability in the PO documents, verify it is covered by at least one feature page. If uncovered → create a feature or add the scope to an existing one. Report: "Cobertura de features: {N}/{total} seções do PO cobertas."
|
|
414
|
+
6. **Cross-cutting check**: if PO/architecture docs mention auth keywords (SSO, JWT, OAuth, roles, permissões, autorização, autenticação, LGPD, rate limit) → verify a feature covers auth implementation. If they mention automation keywords (automático, SLA, prazo, timeout, scheduled, job, cron, fechamento automático) → verify a feature covers it. If missing → create the dedicated feature. Use the same trigger keywords from Phase B.
|
|
415
|
+
|
|
416
|
+
### 6. Close the loop
|
|
417
|
+
|
|
418
|
+
- Change demand label on Confluence: `processando` → `processado`
|
|
419
|
+
- Verify label transition happened (read back the page to confirm)
|
|
420
|
+
- If there are "Nao processados" attachments, add a comment on the demand page listing them
|
|
421
|
+
- Notify Google Chat (if `GCHAT_WEBHOOK_URL` is not set, the script skips silently).
|
|
422
|
+
**Choose the correct script for the OS:**
|
|
423
|
+
- Windows (PowerShell): `powershell -ExecutionPolicy Bypass -File ./scripts/notify-gchat.ps1`
|
|
424
|
+
- Linux/macOS (Bash): `bash ./scripts/notify-gchat.sh`
|
|
425
|
+
|
|
426
|
+
Parameters (same for both scripts):
|
|
427
|
+
|
|
428
|
+
--card --title "✅ Projeto configurado" --subtitle "{project_name}" --body "📄 <b>Páginas criadas:</b>
|
|
429
|
+
• Visão do Produto
|
|
430
|
+
• Glossário ({term_count} termos)
|
|
431
|
+
• Domínio (Regras, Fluxos, Tabelas, Integrações)
|
|
432
|
+
• Features ({feature_count} identificadas)
|
|
433
|
+
• Arquivados
|
|
434
|
+
|
|
435
|
+
📊 <b>Métricas:</b>
|
|
436
|
+
• {rule_count} regras de negócio
|
|
437
|
+
• {flow_count} fluxos documentados
|
|
438
|
+
• {open_decisions_count} decisões em aberto ({high_impact_count} alto impacto)" --next "Resolver decisões de alto impacto e rodar /osk-discover" --button-text "Abrir Visão do Produto" --button-url "{confluence_vision_page_url}"
|
|
439
|
+
|
|
440
|
+
Replace `{}` placeholders with actual values from the execution context.
|
|
441
|
+
|
|
442
|
+
## Rules
|
|
443
|
+
|
|
444
|
+
1. NEVER invent business context — everything comes from PO's documents
|
|
445
|
+
2. If something is unclear, mark it as "A CONFIRMAR" (not assumed)
|
|
446
|
+
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.
|
|
447
|
+
4. Visão do Produto max 1 page
|
|
448
|
+
5. Glossary entries must have: term + definition + context of use
|
|
449
|
+
6. Domain rules must be verifiable (not vague) and traceable to a PRD section
|
|
450
|
+
7. Every "A CONFIRMAR" must state WHY it's ambiguous (what the PRD says vs. what's missing)
|
|
451
|
+
8. Repos detected from the PO documents must be declared in projects.yml (with status: planned), never commented out
|
|
452
|
+
|
|
453
|
+
## Quality criteria
|
|
454
|
+
|
|
455
|
+
The output is considered good when:
|
|
456
|
+
|
|
457
|
+
- **Glossario**: covers 100% of domain nouns and technical components mentioned in the PO documents
|
|
458
|
+
- **Regras**: every "deve", "nao pode", "obrigatorio" in the PO documents has a corresponding numbered rule
|
|
459
|
+
- **Fluxos**: every flow has a happy path AND exceptions documented
|
|
460
|
+
- **Tabelas**: every enum has values (confirmed or "A CONFIRMAR"), state entities have transition tables
|
|
461
|
+
- **Integracoes**: every async flow has events with producers, consumers, and expected payload fields
|
|
462
|
+
- **Architecture.md**: has an "open decisions" table ranked by impact
|
|
463
|
+
- **projects.yml**: has all detected repos declared (not commented), with stack and status
|
|
464
|
+
- **Self-review**: was performed, gaps were found and fixed (or confirmed none exist)
|
|
465
|
+
- **Features**: every numbered section/capability in the PO documents is covered by at least one feature. Cross-cutting concerns (auth, automated processes) have dedicated features when triggered by keywords in the input. Feature pages include Escopo and Seções do PO fields.
|
|
466
|
+
|
|
467
|
+
## Validation checklist
|
|
468
|
+
|
|
469
|
+
### Prerequisite checks
|
|
470
|
+
- [ ] `Demandas/` exists under project root
|
|
471
|
+
- [ ] `Demandas/` has at least one child page or attachment
|
|
472
|
+
- [ ] Demand label transition: (none/novo) → processando → processado
|
|
473
|
+
|
|
474
|
+
### Content generated
|
|
475
|
+
- [ ] Visao do Produto: all required sections present (O que é, Para quem, Por que existe, Premissas, Escopo da v1, Fora de escopo, Riscos e dependências críticas, Métricas de sucesso, Restrições)
|
|
476
|
+
- [ ] Glossario: covers all domain terms from PRD (verified by re-read)
|
|
477
|
+
- [ ] Regras: all rules have ID + Fonte (PRD section) + Verificavel
|
|
478
|
+
- [ ] Fluxos: all flows have happy path + exceptions + Mermaid flowchart TD
|
|
479
|
+
- [ ] Tabelas de Referencia: all enums defined, state transitions documented + Mermaid stateDiagram-v2
|
|
480
|
+
- [ ] Integracoes: all events have producer + consumer + expected payload
|
|
481
|
+
- [ ] {SIGLA} — Features parent page created
|
|
482
|
+
- [ ] Initial feature pages created under {SIGLA} — Features (with label `em-discovery`)
|
|
483
|
+
- [ ] Every PO section covered by at least one feature (verified in self-review)
|
|
484
|
+
- [ ] Cross-cutting features created when PO mentions auth/SSO/JWT or SLA/automático keywords
|
|
485
|
+
- [ ] Feature pages have: Seções do PO field + Escopo section
|
|
486
|
+
- [ ] {SIGLA} — Arquivados parent page created
|
|
487
|
+
|
|
488
|
+
### Spec repo updated
|
|
489
|
+
- [ ] projects.yml filled with all detected repos (status: planned, not commented)
|
|
490
|
+
- [ ] docs/architecture.md draft with Mermaid diagrams (flowchart, erDiagram) and open decisions table
|
|
491
|
+
- [ ] `docs/lessons/` and `docs/decisions/` directories created
|
|
492
|
+
|
|
493
|
+
### Quality gates
|
|
494
|
+
- [ ] Self-review performed (re-read PRD vs. output)
|
|
495
|
+
- [ ] Figma context read and incorporated (if configured)
|
|
496
|
+
- [ ] No business context was invented
|
|
497
|
+
- [ ] All ambiguities marked "A CONFIRMAR" with explanation
|
|
498
|
+
- [ ] Unreadable attachments listed as "NAO PROCESSADO"
|
|
499
|
+
- [ ] Demand label changed to `processado` (verified)
|
|
500
|
+
- [ ] GChat notification sent (if webhook configured)
|