@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,406 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: discovery
|
|
3
|
+
description: "Reads PO demands and project context, identifies gaps and ambiguities, generates structured questions or a PRD. Handles the Q&A loop with the PO via Confluence."
|
|
4
|
+
metadata:
|
|
5
|
+
works_on: [copilot, antigravity, claude]
|
|
6
|
+
argument-hint: "[feature name or Confluence page ID]"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Discovery
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Read all available inputs (PO demand, domain docs, architecture, existing code), identify what's missing or ambiguous, and either generate structured questions for the PO or produce a complete PRD.
|
|
14
|
+
|
|
15
|
+
## Before you start
|
|
16
|
+
|
|
17
|
+
### Validate prerequisites
|
|
18
|
+
|
|
19
|
+
Before anything, verify that the project was set up correctly:
|
|
20
|
+
|
|
21
|
+
1. Read `projects.yml` — if empty or has only template content, **stop** with message: "/setup não foi executado. Execute /setup antes de /discovery."
|
|
22
|
+
2. **Resolver acesso ao Confluence** (mesma lógica do /setup):
|
|
23
|
+
a. Se MCP Confluence está disponível → usar MCP
|
|
24
|
+
b. Senão, ler `.env` para credenciais de API REST (`CONFLUENCE_URL`, `CONFLUENCE_USER`, `CONFLUENCE_API_TOKEN`)
|
|
25
|
+
c. Se nenhum dos dois → **stop** com mensagem: "MCP Confluence não disponível e .env não configurado."
|
|
26
|
+
3. Verificar que estas páginas existem sob a raiz do projeto (`root_page_id` de `projects.yml`):
|
|
27
|
+
- `Visão do Produto` — if not found, **stop** with message: "Página 'Visão do Produto' não encontrada. Execute /setup primeiro."
|
|
28
|
+
- `Glossário` — if not found, **stop** with same message pattern
|
|
29
|
+
- `Domínio/` (with children: Regras, Fluxos, Tabelas, Integrações) — if not found, **stop**
|
|
30
|
+
- `Features/` — if not found, **stop**
|
|
31
|
+
4. If any prerequisite fails, do NOT proceed. Report clearly what is missing.
|
|
32
|
+
|
|
33
|
+
### Feature selection (BUG-032)
|
|
34
|
+
|
|
35
|
+
Se o argumento NÃO foi passado (usuário executou `/discovery` sem feature name):
|
|
36
|
+
|
|
37
|
+
1. Listar TODAS as features sob `Features/` no Confluence
|
|
38
|
+
2. Para cada feature, ler a tabela de metadados (campo "Depende de")
|
|
39
|
+
3. Filtrar features com label `em-discovery` (prontas para discovery)
|
|
40
|
+
4. **Verificar dependências**: uma feature só pode ser feita em discovery se TODAS as features de que depende já têm label `em-spec` ou `done`. Features com dependências não satisfeitas: marcar como "(bloqueada — depende de {SIGLA}-NNN)"
|
|
41
|
+
5. Apresentar ao dev a lista de features disponíveis (não-bloqueadas), ordenada pelo ID:
|
|
42
|
+
```
|
|
43
|
+
Features disponíveis para /discovery:
|
|
44
|
+
1. ⚙️ TFB-000 - Infraestrutura e Scaffold
|
|
45
|
+
2. 🚀 TFB-001 - Importação de Faturas
|
|
46
|
+
3. 🚀 TFB-003 - Consulta de Faturas
|
|
47
|
+
|
|
48
|
+
Bloqueadas:
|
|
49
|
+
- 🚀 TFB-002 - Conferência (depende de TFB-001)
|
|
50
|
+
```
|
|
51
|
+
6. Perguntar: "Qual feature deseja trabalhar?"
|
|
52
|
+
7. Prosseguir com a feature escolhida.
|
|
53
|
+
|
|
54
|
+
Se o argumento FOI passado (ex: `/discovery TFB-001`):
|
|
55
|
+
- Localizar a feature page correspondente e prosseguir normalmente.
|
|
56
|
+
- Se a feature tem dependências não satisfeitas, **avisar** mas continuar (dev pode estar fazendo fora de ordem conscientemente).
|
|
57
|
+
|
|
58
|
+
### Read context
|
|
59
|
+
|
|
60
|
+
Read these files FIRST:
|
|
61
|
+
1. `projects.yml` — repos, stack, dependencies, Confluence space
|
|
62
|
+
2. `docs/architecture.md` — system structure
|
|
63
|
+
3. ALL files in `docs/lessons/` — past mistakes to avoid
|
|
64
|
+
4. ALL files in `docs/decisions/` — technical choices
|
|
65
|
+
5. Recent specs in `specs/` — what was done before
|
|
66
|
+
|
|
67
|
+
## Flow
|
|
68
|
+
|
|
69
|
+
### 1. Compile all information
|
|
70
|
+
|
|
71
|
+
No Confluence (via MCP ou API REST — conforme resolvido em "Before you start"), leia:
|
|
72
|
+
- The feature page in `Features/` (demand extracted by /setup)
|
|
73
|
+
- `Dominio/` — business rules, flows, reference tables, integrations
|
|
74
|
+
- `Visao do Produto` — product scope and success metrics
|
|
75
|
+
- Previous Q&A rounds on the feature page (if any)
|
|
76
|
+
|
|
77
|
+
From the spec repo, read:
|
|
78
|
+
- `docs/architecture.md` — current system design
|
|
79
|
+
- `docs/lessons/` — what went wrong before
|
|
80
|
+
- `docs/decisions/` — technical constraints
|
|
81
|
+
- `specs/` — ALL existing specs (brief.md, contracts.md, scenarios.md). These are the **baseline** for evolution.
|
|
82
|
+
|
|
83
|
+
### 1b. Detect evolution context
|
|
84
|
+
|
|
85
|
+
If `specs/` contains existing feature specs:
|
|
86
|
+
- Read their `contracts.md` files — identify entities, endpoints, types, and error formats already defined
|
|
87
|
+
- Read their `scenarios.md` files — identify behaviors already tested
|
|
88
|
+
- This is the **existing system context**. The new feature builds ON TOP of this, not in isolation.
|
|
89
|
+
|
|
90
|
+
When generating the PRD (Step 6), the discovery MUST:
|
|
91
|
+
- **Reference** existing entities/endpoints instead of redefining them (e.g., "Utiliza a entidade `Usuario` já definida em specs/001")
|
|
92
|
+
- **Identify impacts** on existing features (e.g., "Adiciona campo `saldo` à entidade `Conta` da feature 002")
|
|
93
|
+
- **Reuse** existing types (ErrorResponse, PaginatedResponse) by reference, not copy
|
|
94
|
+
- **Flag conflicts** if the new feature contradicts an existing spec (e.g., "Feature 003 diz que `Conta` não tem `saldo`, mas esta feature precisa de saldo")
|
|
95
|
+
|
|
96
|
+
This ensures the PRD is a **complete description of the new feature** with explicit connections to the existing system — not a delta document, not a redefinition.
|
|
97
|
+
|
|
98
|
+
### 1c. Read Figma design context (opcional)
|
|
99
|
+
|
|
100
|
+
**Condição**: este passo SÓ executa se AMBAS as condições forem verdadeiras:
|
|
101
|
+
1. `projects.yml` tem seção `figma:` com `file_url` preenchido
|
|
102
|
+
2. O MCP Figma está disponível (servidor `figma` configurado)
|
|
103
|
+
|
|
104
|
+
Se qualquer condição falhar, **pule silenciosamente**.
|
|
105
|
+
|
|
106
|
+
**Se disponível:**
|
|
107
|
+
1. Extraia o file key da URL em `projects.yml` → `figma.file_url` (segmento após `/design/` ou `/file/`)
|
|
108
|
+
2. Use `get_design_context` com o file key para obter visão geral
|
|
109
|
+
3. Use `search_design_system` com o nome da feature sendo analisada para localizar frames relevantes
|
|
110
|
+
4. Se encontrar frames relacionados, use `get_metadata` nos frames específicos para extrair:
|
|
111
|
+
- Campos de formulário visíveis (nomes, tipos, indicadores de obrigatório)
|
|
112
|
+
- Estados de tela (vazio, carregado, erro, loading)
|
|
113
|
+
- Fluxos de navegação entre telas
|
|
114
|
+
- Variáveis de design system usadas (cores, espaçamentos, tokens)
|
|
115
|
+
|
|
116
|
+
**Impacto no gap analysis (passo 3):**
|
|
117
|
+
- Na categoria **UX**: compare o design do Figma com os requisitos da demanda. Se o Figma mostra campos ou fluxos não mencionados na demanda, registre como gap: "DESIGN: Figma mostra {elemento} mas demanda não menciona. Confirmar com PO se está no escopo."
|
|
118
|
+
- Na categoria **DATA**: se o Figma mostra campos em formulários, use-os para validar/completar a lista de entidades e atributos
|
|
119
|
+
- Na categoria **SCOPE**: se o Figma tem telas não cobertas pela demanda, registre como gap de escopo
|
|
120
|
+
|
|
121
|
+
**Impacto no PRD (passo 6):**
|
|
122
|
+
- Na seção "Requisitos aceitos", referencie frames do Figma: "REQ-NN: [descrição] (ref: Figma frame '{frame_name}')"
|
|
123
|
+
- Adicione seção opcional ao PRD: "### Referências visuais" com lista de frames relevantes e seus file keys
|
|
124
|
+
|
|
125
|
+
**Regra**: se o Figma mostra comportamento NÃO descrito na demanda, registrar como gap de negócio: "DESIGN: Figma mostra {X} mas demanda não menciona. PO precisa confirmar."
|
|
126
|
+
|
|
127
|
+
### 2. Scan existing code (if repos exist)
|
|
128
|
+
|
|
129
|
+
If `projects.yml` lists repos with `status: active` that already have code:
|
|
130
|
+
- **Read** (in this order, stop when sufficient context is gathered):
|
|
131
|
+
1. Endpoints/controllers/routes — what APIs already exist
|
|
132
|
+
2. Entities/models — what data structures are defined
|
|
133
|
+
3. Event handlers/publishers — what async events exist
|
|
134
|
+
4. Tests — what behaviors are already validated
|
|
135
|
+
- **Skip**: internal services, helpers, utilities, infrastructure code
|
|
136
|
+
- Identify reuse opportunities (existing types, shared patterns) and constraints (naming conventions, error formats)
|
|
137
|
+
|
|
138
|
+
### 3. Identify gaps
|
|
139
|
+
|
|
140
|
+
**3a. Check for duplicates:**
|
|
141
|
+
- Read existing specs in `specs/` — does a spec already cover this feature?
|
|
142
|
+
- Read the PRD principal and existing feature pages — is this feature already described elsewhere?
|
|
143
|
+
- If duplicate found: **warn** — "Feature já existe em specs/NNN ou na feature page {title}."
|
|
144
|
+
- If the feature page has label `prd-rejeitado`: this is a re-discovery — proceed normally (the previous PRD was rejected)
|
|
145
|
+
- If the feature page has label `em-spec` or `done`: **stop** — "Feature já especificada/implementada. Para re-fazer discovery, remova o label em-spec primeiro."
|
|
146
|
+
- Otherwise: ask the dev whether to continue or stop
|
|
147
|
+
|
|
148
|
+
**3b. Cross-validate with existing rules AND specs:**
|
|
149
|
+
- Read `Domínio/Regras` and compare against the feature requirements
|
|
150
|
+
- If ANY requirement contradicts an existing RN, register it as a **critical gap** that MUST be resolved before generating the PRD
|
|
151
|
+
- Format: "CONTRADIÇÃO: REQ-XX diz Y, mas RN-ZZ diz W. PO precisa decidir qual prevalece."
|
|
152
|
+
- **Cross-validate with existing specs**: read `scenarios.md` and `contracts.md` from ALL existing specs in `specs/`. Check:
|
|
153
|
+
- Does this feature contradict a scenario from another feature? (ex: different error format, different ownership behavior)
|
|
154
|
+
- Does this feature reuse types defined in another feature? If yes, reference — do NOT redefine.
|
|
155
|
+
- Does this feature share endpoints with another? If yes, document explicitly which feature owns the endpoint and which extends it.
|
|
156
|
+
- If contradictions found, register as critical gap: "CONTRADIÇÃO COM SPEC: feature {NNN} scenarios.md CT-XX assume Y, mas esta feature requer W."
|
|
157
|
+
|
|
158
|
+
**3c. Verify Glossary completeness:**
|
|
159
|
+
- Read `Glossário` on Confluence
|
|
160
|
+
- List every new term, entity, enum, or concept that this feature introduces and that is NOT yet in the Glossário
|
|
161
|
+
- If new terms found, register them as a **glossary update** to be added when the PRD is finalized
|
|
162
|
+
- Format: "GLOSSÁRIO: termos novos a adicionar — {term1} ({definition}), {term2} ({definition})"
|
|
163
|
+
- This includes: new entities, new enum values, new technical concepts (ex: PaginatedResponse), new domain concepts (ex: "tarefa vencida")
|
|
164
|
+
|
|
165
|
+
**3d. Coverage scan and gap compilation:**
|
|
166
|
+
|
|
167
|
+
Scan the demand using this taxonomy. For each category, mark status:
|
|
168
|
+
Covered / Partial / Missing.
|
|
169
|
+
|
|
170
|
+
| Category | What to verify |
|
|
171
|
+
|----------|---------------|
|
|
172
|
+
| SCOPE | What's in/out? Duplicates existing feature? |
|
|
173
|
+
| BUSINESS_RULES | Ambiguous logic? Contradicts existing RN? |
|
|
174
|
+
| DATA | Entities clear? Types/formats defined? Estimated volume? |
|
|
175
|
+
| INTEGRATION | External systems? Failure modes? Sync/async? |
|
|
176
|
+
| SECURITY | Sensitive data? Auth requirements? Redaction needed? |
|
|
177
|
+
| PERFORMANCE | SLAs? Expected load? Rate limits? |
|
|
178
|
+
| UX | Error messages? Empty states? (if frontend) |
|
|
179
|
+
|
|
180
|
+
**Special rule — PERFORMANCE**: this category can NEVER be marked as "Covered" without at least one question about: data limits (how many records per entity?), response SLA (max acceptable response time per endpoint), or expected throughput (requests/second, concurrent users). If the PO demand does not mention performance, ASK — absence of a performance requirement does not mean "no requirement", it means "undocumented implicit requirement".
|
|
181
|
+
|
|
182
|
+
For each category marked Partial or Missing, generate a candidate question.
|
|
183
|
+
|
|
184
|
+
**Prioritize:** Impact (High/Medium/Low) x Blocks spec? (Yes/No).
|
|
185
|
+
Select at most **5 questions**, prioritizing those that block.
|
|
186
|
+
|
|
187
|
+
Categorize each gap as:
|
|
188
|
+
- **Business gap** — PO needs to decide (business rules, scope, priorities)
|
|
189
|
+
- **Technical gap** — team needs to decide (architecture, patterns, tech choices)
|
|
190
|
+
|
|
191
|
+
### 4. Assess feature scope
|
|
192
|
+
|
|
193
|
+
Before deciding questions vs PRD, assess the scope:
|
|
194
|
+
- Count how many distinct behaviors/capabilities the feature introduces
|
|
195
|
+
- If the feature has **more than 15 distinct behaviors** or spans **4+ repos**, flag it: "Feature potencialmente grande — considerar quebra em sub-features antes de prosseguir."
|
|
196
|
+
- This is a suggestion, not a blocker. The PO/dev decides whether to break it up.
|
|
197
|
+
- If kept as-is, document the scope assessment in the PRD under "### Premissas".
|
|
198
|
+
|
|
199
|
+
### 5. Locate the feature page
|
|
200
|
+
|
|
201
|
+
Before generating questions or PRD, find the feature page:
|
|
202
|
+
|
|
203
|
+
1. Search for an existing feature page in `Features/` matching the feature name/argument (created by /setup in Step 4.5)
|
|
204
|
+
2. **If found**: use it (read existing content, detect previous Q&A rounds)
|
|
205
|
+
3. **If NOT found**: the /setup may have failed to create it. Create it under `Features/` as fallback:
|
|
206
|
+
- Title: `{SIGLA}-NNN - Feature name` (next sequential number, using project sigla from projects.yml)
|
|
207
|
+
- Content: 1-2 paragraphs describing the feature (from PO documents or argument context)
|
|
208
|
+
- Label: `em-discovery`
|
|
209
|
+
- Log: "Feature page não encontrada — criada como fallback. Verifique se /setup rodou corretamente."
|
|
210
|
+
4. The feature page is the SINGLE source of truth for this feature's discovery process
|
|
211
|
+
|
|
212
|
+
### 6. Decision: questions or PRD?
|
|
213
|
+
|
|
214
|
+
**IF there are business gaps (PO needs to answer):**
|
|
215
|
+
|
|
216
|
+
Generate structured questions on the feature page in Confluence:
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
## Dúvidas & Decisões — Rodada N
|
|
220
|
+
|
|
221
|
+
### Dúvida N.1: [short title]
|
|
222
|
+
**Contexto:** [why this matters]
|
|
223
|
+
**Opções:**
|
|
224
|
+
- A) [option] — Trade-off: [pros/cons]
|
|
225
|
+
- B) [option] — Trade-off: [pros/cons]
|
|
226
|
+
- C) [option] — Trade-off: [pros/cons]
|
|
227
|
+
**Recomendação:** [if you have one, with justification]
|
|
228
|
+
**Resposta PO:** _aguardando_
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Then:
|
|
232
|
+
- Change feature label → `aguardando-po`
|
|
233
|
+
- Notify Google Chat (se `GCHAT_WEBHOOK_URL` não estiver definida, o script pula silenciosamente):
|
|
234
|
+
|
|
235
|
+
./scripts/notify-gchat.sh --card \
|
|
236
|
+
--title "❓ Dúvidas aguardando PO" \
|
|
237
|
+
--subtitle "{project_name}" \
|
|
238
|
+
--body "<b>Feature:</b> {feature_name}
|
|
239
|
+
|
|
240
|
+
{question_count} dúvidas precisam de resposta antes de gerar o PRD." \
|
|
241
|
+
--next "PO responder as dúvidas no Confluence" \
|
|
242
|
+
--button-text "Responder no Confluence" \
|
|
243
|
+
--button-url "{feature_page_url}"
|
|
244
|
+
|
|
245
|
+
Substitua os valores entre `{}` pelos dados reais. Notificações sempre em pt-BR.
|
|
246
|
+
- STOP and wait for PO to respond
|
|
247
|
+
|
|
248
|
+
**Timeout and escalation:** if the PO does not respond in a reasonable time, the dev can re-run /discovery on the same feature. The agent must detect previous questions (existing "Dúvidas & Decisões — Rodada N" section) and:
|
|
249
|
+
- Check the page's `modified` field (via MCP ou API REST). If the last modification was more than 3 business days ago and responses still contain "_aguardando_": escalate.
|
|
250
|
+
- If there are pending responses but within the deadline: re-notify via Google Chat (same command as the previous step)
|
|
251
|
+
- If more than 3 business days have passed: escalate to TL:
|
|
252
|
+
|
|
253
|
+
./scripts/notify-gchat.sh --card \
|
|
254
|
+
--title "⚠️ Dúvidas sem resposta há {days} dias" \
|
|
255
|
+
--subtitle "{project_name}" \
|
|
256
|
+
--body "<b>Feature:</b> {feature_name}
|
|
257
|
+
|
|
258
|
+
Escalando ao TL. {pending_count} dúvidas pendentes bloqueiam o PRD." \
|
|
259
|
+
--next "TL intervir para desbloquear" \
|
|
260
|
+
--button-text "Ver dúvidas" \
|
|
261
|
+
--button-url "{feature_page_url}"
|
|
262
|
+
|
|
263
|
+
**IF there are only technical gaps (team decides):**
|
|
264
|
+
|
|
265
|
+
For architectural trade-offs, read `projects.yml` → `agents.principal`. If configured (not null), consult that agent to validate options. Document the decision in the PRD.
|
|
266
|
+
|
|
267
|
+
**Fallback**: if `principal-engineer` agent is not available, document the options with trade-offs in the PRD and mark as "DECISÃO TÉCNICA — a validar com TL antes do /spec".
|
|
268
|
+
|
|
269
|
+
After documenting technical decisions, **return to step 6** and re-evaluate: if no gaps remain, proceed to generate the full PRD.
|
|
270
|
+
|
|
271
|
+
**IF no gaps remain (or all answered):**
|
|
272
|
+
|
|
273
|
+
Generate the PRD on the feature page in Confluence:
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
## PRD
|
|
277
|
+
|
|
278
|
+
### Resumo executivo
|
|
279
|
+
[2-3 sentences: what, why, for whom]
|
|
280
|
+
|
|
281
|
+
### Requisitos aceitos
|
|
282
|
+
- REQ-01: [requirement from PO answers]
|
|
283
|
+
- REQ-02: [requirement]
|
|
284
|
+
- ...
|
|
285
|
+
|
|
286
|
+
### Fora de escopo
|
|
287
|
+
- [explicitly excluded items]
|
|
288
|
+
|
|
289
|
+
### Premissas
|
|
290
|
+
- [assumptions that were validated with PO]
|
|
291
|
+
|
|
292
|
+
### Métricas de sucesso
|
|
293
|
+
- [how to measure if this feature works]
|
|
294
|
+
|
|
295
|
+
### Decisões tomadas
|
|
296
|
+
- Duvida N.1: [decision] — Justificativa: [why]
|
|
297
|
+
- ...
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Then:
|
|
301
|
+
- Change feature label → `prd-review`
|
|
302
|
+
- Notify Google Chat:
|
|
303
|
+
|
|
304
|
+
./scripts/notify-gchat.sh --card \
|
|
305
|
+
--title "📋 PRD pronto pra review" \
|
|
306
|
+
--subtitle "{project_name}" \
|
|
307
|
+
--body "<b>Feature:</b> {feature_name}
|
|
308
|
+
|
|
309
|
+
📊 <b>Métricas:</b>
|
|
310
|
+
• {req_count} requisitos aceitos
|
|
311
|
+
• {decision_count} decisões tomadas
|
|
312
|
+
• {out_of_scope_count} itens fora de escopo" \
|
|
313
|
+
--next "PO revisar e aprovar (label prd-aprovado)" \
|
|
314
|
+
--button-text "Revisar PRD" \
|
|
315
|
+
--button-url "{feature_page_url}"
|
|
316
|
+
|
|
317
|
+
Substitua os valores entre `{}` pelos dados reais. Notificações sempre em pt-BR.
|
|
318
|
+
|
|
319
|
+
### 7. Handle partial PO responses
|
|
320
|
+
|
|
321
|
+
If the PO responded to SOME but not ALL questions:
|
|
322
|
+
- Generate a NEW round of questions (Rodada N+1) containing ONLY the unanswered questions
|
|
323
|
+
- Do NOT generate the PRD with open business gaps — every gap MUST be resolved first
|
|
324
|
+
- Notify GChat: "{pending_count} dúvidas ainda pendentes na feature {name}"
|
|
325
|
+
|
|
326
|
+
### 8. Handle PRD rejection
|
|
327
|
+
|
|
328
|
+
If the PO adds label `prd-rejeitado` on the feature page:
|
|
329
|
+
1. Read the rejection comments (page comments or inline notes)
|
|
330
|
+
2. Identify what needs to change (new requirements? scope change? wrong assumptions?)
|
|
331
|
+
3. Generate a new round of questions addressing the rejection reasons
|
|
332
|
+
4. Change label → `aguardando-po`
|
|
333
|
+
5. Notify GChat: "PRD da feature {name} rejeitado — nova rodada de dúvidas gerada"
|
|
334
|
+
|
|
335
|
+
The flow returns to step 6 (questions loop) until the PO approves.
|
|
336
|
+
|
|
337
|
+
**Escalation**: if the PRD is rejected 3 or more times, notify the TL (Tech Lead) via GChat:
|
|
338
|
+
|
|
339
|
+
./scripts/notify-gchat.sh --card \
|
|
340
|
+
--title "⚠️ PRD rejeitado {rejection_count}x" \
|
|
341
|
+
--subtitle "{project_name}" \
|
|
342
|
+
--body "<b>Feature:</b> {feature_name}
|
|
343
|
+
|
|
344
|
+
PRD rejeitado {rejection_count} vezes. Possível desalinhamento entre PO e time técnico." \
|
|
345
|
+
--next "TL mediar entre PO e time" \
|
|
346
|
+
--button-text "Ver feature" \
|
|
347
|
+
--button-url "{feature_page_url}"
|
|
348
|
+
|
|
349
|
+
### Label transition summary
|
|
350
|
+
|
|
351
|
+
```
|
|
352
|
+
(feature page created) → em-discovery → aguardando-po → prd-review → prd-aprovado (by PO)
|
|
353
|
+
↑ |
|
|
354
|
+
└── prd-rejeitado ─────────┘
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
**Who adds `prd-aprovado`**: the PO, manually, after reviewing the PRD. This is NOT automated — it's a human approval gate.
|
|
358
|
+
|
|
359
|
+
## Agents used
|
|
360
|
+
|
|
361
|
+
- Agent configured in `projects.yml` → `agents.principal` — to validate architectural trade-offs when technical gaps are found
|
|
362
|
+
|
|
363
|
+
## MCP failure recovery
|
|
364
|
+
|
|
365
|
+
If a Confluence operation fails mid-flow (publishing questions, updating PRD, changing labels):
|
|
366
|
+
1. Log which operations succeeded and which failed
|
|
367
|
+
2. Save pending operations to `docs/pending-confluence-updates.md` with: target page, content to add/update, operation type, date
|
|
368
|
+
3. Report to dev: "Confluence indisponível — {N} operações pendentes salvas em docs/pending-confluence-updates.md."
|
|
369
|
+
4. On re-execution, check if `docs/pending-confluence-updates.md` exists and attempt to apply pending operations FIRST before proceeding with new work. Remove applied entries from the file.
|
|
370
|
+
|
|
371
|
+
## Rules
|
|
372
|
+
|
|
373
|
+
1. NEVER invent business context — if you don't know, ask
|
|
374
|
+
2. Questions must have options with trade-offs (never open-ended)
|
|
375
|
+
3. Each question must explain WHY it matters (context)
|
|
376
|
+
4. PRD requirements must be verifiable (not vague)
|
|
377
|
+
5. **Language**: ALL generated content — Confluence pages AND local files — MUST be in **Brazilian Portuguese (pt-BR) with correct accents** (e.g., "não" NOT "nao", "autenticação" NOT "autenticacao", "código" NOT "codigo"). Technical terms stay in English (e.g., endpoint, status, token).
|
|
378
|
+
6. Reference lessons from `docs/lessons/` when relevant
|
|
379
|
+
7. Mark assumptions clearly as "PREMISSA" in the PRD
|
|
380
|
+
8. **Scripts cross-platform**: ao executar `./scripts/notify-gchat.*`, detectar o OS. Em Windows usar `powershell -ExecutionPolicy Bypass -File ./scripts/notify-gchat.ps1`, em Linux/macOS usar `bash ./scripts/notify-gchat.sh`. Os parâmetros são os mesmos em ambos.
|
|
381
|
+
|
|
382
|
+
## Validation checklist
|
|
383
|
+
|
|
384
|
+
- [ ] All Confluence pages read (demand, domain, vision, glossário)
|
|
385
|
+
- [ ] Spec repo context read (architecture, lessons, decisions, specs)
|
|
386
|
+
- [ ] Existing code scanned (if repos exist)
|
|
387
|
+
- [ ] Cross-validated with existing specs (no contradictions with scenarios/contracts of other features)
|
|
388
|
+
- [ ] Glossary checked — new terms identified and listed for addition
|
|
389
|
+
- [ ] Feature scope assessed (flagged if >15 behaviors or 4+ repos)
|
|
390
|
+
- [ ] Gaps categorized as business or technical
|
|
391
|
+
- [ ] Questions have options with trade-offs (not open-ended)
|
|
392
|
+
- [ ] PRD has all sections (resumo, requisitos, fora de escopo, premissas, metricas)
|
|
393
|
+
- [ ] Every REQ is verifiable (can be tested in a Given/When/Then scenario)
|
|
394
|
+
- [ ] Feature label updated on Confluence
|
|
395
|
+
- [ ] GChat notification sent
|
|
396
|
+
- [ ] Figma context read (if configured) — design gaps identified and incorporated
|
|
397
|
+
- [ ] No business context was invented
|
|
398
|
+
|
|
399
|
+
## Exit gate (BLOCKING — cannot close the loop without these)
|
|
400
|
+
|
|
401
|
+
The /discovery CANNOT be considered done until ALL of the following are true. If any item fails, fix it before proceeding.
|
|
402
|
+
|
|
403
|
+
1. **Glossary updated on Confluence** — if the PRD section "GLOSSÁRIO: termos novos" lists any terms, they MUST be added to the Glossário page on Confluence BEFORE closing. Read the current page, add the terms, update. Do NOT leave this for /spec.
|
|
404
|
+
2. **All "A CONFIRMAR" in Glossário resolved** — if any term in the Glossário still has "A CONFIRMAR" and the /discovery answered that question (e.g., PO confirmed enum values), update the Glossário to remove the "A CONFIRMAR" and replace with the confirmed value.
|
|
405
|
+
3. **Decisions attributed correctly** — business decisions (scope, enums, features) marked as "PO". Technical decisions (cascade, notification rules, filtering) marked as "Dev". Never mix them.
|
|
406
|
+
4. **architecture.md updated** — if the /discovery resolved any open decision listed in architecture.md, update the Status column from `aberta` to `resolvida — [decisão tomada]`. Do NOT leave stale "A CONFIRMAR" when the answer exists.
|