@cortex-context/cli 0.0.5
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/LICENSE +21 -0
- package/README.md +98 -0
- package/dist/index.js +28124 -0
- package/dist/index.js.map +1 -0
- package/dist/templates/local/cortex.config.template.yaml +50 -0
- package/dist/templates/local/docker-compose.local.yml +57 -0
- package/dist/templates/rules/copilot-instructions-cortex.md +22 -0
- package/dist/templates/skills/cortex-dimensions/SKILL.md +150 -0
- package/dist/templates/skills/cortex-generate-spec/SKILL.md +265 -0
- package/dist/templates/skills/cortex-ingest/SKILL.md +178 -0
- package/dist/templates/skills/cortex-research/SKILL.md +168 -0
- package/package.json +60 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# cortex.config.yaml — Configuração do Cortex Knowledge Graph
|
|
2
|
+
# Gerado por: cortex-context init
|
|
3
|
+
# Documentação: https://github.com/rodrigoroldan/cortex-context
|
|
4
|
+
|
|
5
|
+
project:
|
|
6
|
+
# Nome do projeto (aparece como rótulo nos nós do grafo)
|
|
7
|
+
name: "meu-projeto"
|
|
8
|
+
|
|
9
|
+
# Ambiente padrão para o manifesto (dev, staging, production)
|
|
10
|
+
environment: "dev"
|
|
11
|
+
|
|
12
|
+
# Prefixo de IDs para specs (ex: "spec" → spec-001, spec-002...)
|
|
13
|
+
spec_prefix: "spec"
|
|
14
|
+
|
|
15
|
+
# Serviços do projeto (usado para enriquecer arestas de dependência)
|
|
16
|
+
services: []
|
|
17
|
+
# - name: "backend"
|
|
18
|
+
# repo_path: "../backend"
|
|
19
|
+
# - name: "frontend"
|
|
20
|
+
# repo_path: "../frontend"
|
|
21
|
+
# - name: "bff"
|
|
22
|
+
# repo_path: "../bff"
|
|
23
|
+
|
|
24
|
+
# Configuração de ingestão
|
|
25
|
+
ingest:
|
|
26
|
+
# Padrões de arquivo a excluir do diff analysis
|
|
27
|
+
exclude_patterns:
|
|
28
|
+
- "*.lock"
|
|
29
|
+
- "*.sum"
|
|
30
|
+
- "node_modules/**"
|
|
31
|
+
- ".git/**"
|
|
32
|
+
- "dist/**"
|
|
33
|
+
- "build/**"
|
|
34
|
+
- "target/**"
|
|
35
|
+
- "__pycache__/**"
|
|
36
|
+
- "*.pyc"
|
|
37
|
+
- ".env"
|
|
38
|
+
- ".env.*"
|
|
39
|
+
|
|
40
|
+
# Padrões de arquivo de spec (nós do tipo "spec" são extraídos daqui)
|
|
41
|
+
spec_patterns:
|
|
42
|
+
- "specs/**/*.md"
|
|
43
|
+
- "docs/specs/**/*.md"
|
|
44
|
+
|
|
45
|
+
# APM enrichment (opcional — adiciona dados de observabilidade aos nós)
|
|
46
|
+
apm:
|
|
47
|
+
enabled: false
|
|
48
|
+
# provider: "openobserve"
|
|
49
|
+
# url: "https://logs.rolds.dev"
|
|
50
|
+
# token: "..."
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# docker-compose.local.yml — Cortex stack local
|
|
2
|
+
# Gerado por: cortex-context init --local
|
|
3
|
+
#
|
|
4
|
+
# Uso:
|
|
5
|
+
# docker compose -f docker-compose.local.yml up -d
|
|
6
|
+
# docker compose -f docker-compose.local.yml down
|
|
7
|
+
#
|
|
8
|
+
# Acesso:
|
|
9
|
+
# Cortex API: http://localhost:8082
|
|
10
|
+
# Neo4j UI: http://localhost:7474 (usuário: neo4j / senha: cortex-local)
|
|
11
|
+
|
|
12
|
+
services:
|
|
13
|
+
neo4j:
|
|
14
|
+
image: neo4j:5.21-community
|
|
15
|
+
container_name: cortex-neo4j-local
|
|
16
|
+
environment:
|
|
17
|
+
NEO4J_AUTH: neo4j/cortex-local
|
|
18
|
+
NEO4J_PLUGINS: '["apoc"]'
|
|
19
|
+
NEO4J_dbms_security_procedures_unrestricted: apoc.*
|
|
20
|
+
NEO4J_dbms_memory_heap_initial__size: 256m
|
|
21
|
+
NEO4J_dbms_memory_heap_max__size: 512m
|
|
22
|
+
ports:
|
|
23
|
+
- "7474:7474"
|
|
24
|
+
- "7687:7687"
|
|
25
|
+
volumes:
|
|
26
|
+
- cortex_neo4j_data:/data
|
|
27
|
+
healthcheck:
|
|
28
|
+
test: ["CMD", "wget", "-qO-", "http://localhost:7474"]
|
|
29
|
+
interval: 10s
|
|
30
|
+
timeout: 5s
|
|
31
|
+
retries: 10
|
|
32
|
+
restart: unless-stopped
|
|
33
|
+
|
|
34
|
+
cortex-api:
|
|
35
|
+
image: ghcr.io/rodrigoroldan/cortex-context:latest
|
|
36
|
+
container_name: cortex-api-local
|
|
37
|
+
environment:
|
|
38
|
+
NEO4J_URI: bolt://neo4j:7687
|
|
39
|
+
NEO4J_USER: neo4j
|
|
40
|
+
NEO4J_PASSWORD: cortex-local
|
|
41
|
+
CORTEX_API_TOKEN: ${CORTEX_API_TOKEN:-dev-token-local}
|
|
42
|
+
LOG_LEVEL: INFO
|
|
43
|
+
ports:
|
|
44
|
+
- "8082:8082"
|
|
45
|
+
depends_on:
|
|
46
|
+
neo4j:
|
|
47
|
+
condition: service_healthy
|
|
48
|
+
healthcheck:
|
|
49
|
+
test: ["CMD", "wget", "-qO-", "http://localhost:8082/health"]
|
|
50
|
+
interval: 10s
|
|
51
|
+
timeout: 5s
|
|
52
|
+
retries: 10
|
|
53
|
+
restart: unless-stopped
|
|
54
|
+
|
|
55
|
+
volumes:
|
|
56
|
+
cortex_neo4j_data:
|
|
57
|
+
driver: local
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
## 🧠 Cortex Product Knowledge Graph
|
|
2
|
+
|
|
3
|
+
Before implementing any feature, use the Cortex MCP tools to check for existing specs and context:
|
|
4
|
+
|
|
5
|
+
- **`query_product_context`**: Semantic search — use with keywords before starting any work
|
|
6
|
+
- **`get_spec_context`**: Get full details of a specific spec (spec-NNN) including related nodes
|
|
7
|
+
- **`get_service_context`**: Understand what specs affect a given service
|
|
8
|
+
- **`list_features`**: List features by status (planned, in-progress, completed, deprecated)
|
|
9
|
+
- **`list_dimensions`**: Explore graph dimensions (specs, services, temporal workflows, etc.)
|
|
10
|
+
- **`get_node_context`**: Explore any node + 1-hop neighbors
|
|
11
|
+
|
|
12
|
+
**Rule**: Always call `query_product_context` before planning or implementing any feature.
|
|
13
|
+
This prevents duplicate work and ensures you have full product context.
|
|
14
|
+
|
|
15
|
+
**Example**:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
# Before implementing payment feature:
|
|
19
|
+
query_product_context("pagamento PIX rateio cobrança")
|
|
20
|
+
get_spec_context("spec-042") # if relevant spec found
|
|
21
|
+
get_service_context("backend") # understand service dependencies
|
|
22
|
+
```
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cortex-dimensions
|
|
3
|
+
description: >
|
|
4
|
+
Skill para explorar dimensões genéricas do Cortex além de spec/service.
|
|
5
|
+
Use quando o usuário quiser listar ou explorar dimensões disponíveis, buscar
|
|
6
|
+
por workflows Temporal no grafo, explorar tipos de nós disponíveis, ou precisar
|
|
7
|
+
de informação sobre qualquer entidade que não seja spec ou serviço.
|
|
8
|
+
Triggers: "listar dimensões cortex", "dimensões disponíveis", "quais workflows temporal",
|
|
9
|
+
"explorar dimensão X", "temporal workflow no cortex", "temporal workflow context",
|
|
10
|
+
"que outros tipos de nós existem", "dimensão X do grafo".
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Skill: Cortex Dimensions — Discovery de Dimensões Genéricas
|
|
14
|
+
|
|
15
|
+
## Propósito
|
|
16
|
+
|
|
17
|
+
Explorar o grafo Cortex de forma **agnóstica** — sem assumir quais tipos de nós existem.
|
|
18
|
+
O Cortex é extensível: além de `spec` e `service`, pode conter `temporal_workflow`,
|
|
19
|
+
`bff_route`, e futuras dimensões adicionadas sem mudança no código do MCP.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Quando Usar
|
|
24
|
+
|
|
25
|
+
| Situação | Ação |
|
|
26
|
+
|----------|------|
|
|
27
|
+
| Não sabe quais dimensões existem | `list_dimensions()` primeiro |
|
|
28
|
+
| Quer ver Temporal Workflows no grafo | `list_dimensions()` → `get_node_context("temporal_workflow", id)` |
|
|
29
|
+
| "Quais workflows o Cortex conhece?" | `list_dimensions()` + `get_node_context` por dim_key |
|
|
30
|
+
| Explorar qualquer dimensão nova | `list_dimensions()` → inspecionar dim_key → `get_node_context` |
|
|
31
|
+
| Busca por entidade não-spec/service | `list_dimensions()` → identificar dim_key correto |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Tools MCP Disponíveis
|
|
36
|
+
|
|
37
|
+
### 1. `list_dimensions` — Discovery de dimensões
|
|
38
|
+
|
|
39
|
+
**Sempre chame primeiro** quando não souber o `dim_key` correto.
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
Parâmetros: nenhum
|
|
43
|
+
|
|
44
|
+
Retorna: tabela com {dim_key, node_label, contagem_de_nós}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Exemplo de resposta:
|
|
48
|
+
```
|
|
49
|
+
| dim_key | node_label | nós |
|
|
50
|
+
|-------------------|------------------|-----|
|
|
51
|
+
| spec | Spec | 122 |
|
|
52
|
+
| service | Service | 8 |
|
|
53
|
+
| temporal_workflow | TemporalWorkflow | 15 |
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### 2. `get_node_context` — Detalhe de qualquer nó
|
|
59
|
+
|
|
60
|
+
Use após descobrir o `dim_key` correto via `list_dimensions`.
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Parâmetros:
|
|
64
|
+
dim_key: str # chave da dimensão, ex: "temporal_workflow"
|
|
65
|
+
node_id: str # ID do nó, ex: "workflow-finance-reconciliation"
|
|
66
|
+
|
|
67
|
+
Retorna: propriedades do nó + vizinhos 1-hop com tipo de relacionamento
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Fluxo: Explorar Temporal Workflows no Cortex
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
1. list_dimensions()
|
|
76
|
+
→ Confirma que "temporal_workflow" existe com N nós
|
|
77
|
+
|
|
78
|
+
2. Para listar todos os workflows disponíveis:
|
|
79
|
+
Não existe um tool de listagem genérica por ID — use o output de list_dimensions
|
|
80
|
+
para confirmar a dimensão existe, então faça chamadas com IDs conhecidos.
|
|
81
|
+
|
|
82
|
+
IDs de TemporalWorkflow (nomenclatura padrão):
|
|
83
|
+
workflow-finance-reconciliation, workflow-overdue-installment,
|
|
84
|
+
workflow-psp-reconciliation, workflow-pricing-psp-review,
|
|
85
|
+
workflow-event-publication, workflow-outbound-execution,
|
|
86
|
+
workflow-invite-lifecycle, workflow-payment-expiration,
|
|
87
|
+
workflow-participant-lifecycle, workflow-notification-fallback,
|
|
88
|
+
workflow-accounting-snapshot, workflow-event-publication-monitoring,
|
|
89
|
+
workflow-participant-recalculation, workflow-payment-confirmation,
|
|
90
|
+
workflow-sandbox
|
|
91
|
+
|
|
92
|
+
3. get_node_context("temporal_workflow", "workflow-finance-reconciliation")
|
|
93
|
+
→ Retorna schedule, status, mode_resolver, service_id, replaces (job substituído)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Fluxo: Descoberta Completa
|
|
99
|
+
|
|
100
|
+
Quando o usuário pergunta algo sobre uma entidade e você não sabe qual dimensão usar:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
1. list_dimensions()
|
|
104
|
+
→ Identifica dim_keys disponíveis
|
|
105
|
+
|
|
106
|
+
2. Se a dimensão é clara: get_node_context(dim_key, node_id)
|
|
107
|
+
→ Retorna detalhes do nó + vizinhos
|
|
108
|
+
|
|
109
|
+
3. Se não encontrar o ID exato:
|
|
110
|
+
→ Para specs: use get_spec_context ou list_features
|
|
111
|
+
→ Para services: use get_service_context
|
|
112
|
+
→ Para workflows: use os IDs padrão listados acima
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Dimensões Conhecidas (Referência)
|
|
118
|
+
|
|
119
|
+
| dim_key | Tipo de Entidade | Exemplos de node_id |
|
|
120
|
+
|---------|-----------------|---------------------|
|
|
121
|
+
| `spec` | Features/Specs | `spec-070`, `spec-147` |
|
|
122
|
+
| `service` | Serviços do sistema | `service-bff`, `service-backend` |
|
|
123
|
+
| `temporal_workflow` | Workflows Temporal.io | `workflow-finance-reconciliation` |
|
|
124
|
+
|
|
125
|
+
> **Nota**: Esta lista pode estar desatualizada. Use `list_dimensions()` para ver
|
|
126
|
+
> as dimensões reais em produção com contagem atual de nós.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Sobre os Temporal Workflows no Grafo
|
|
131
|
+
|
|
132
|
+
O Cortex rastreia os **15 Temporal Workflows ativos** do backend com:
|
|
133
|
+
- `schedule`: cron schedule (para workflows agendados)
|
|
134
|
+
- `mode`: estado atual (DISABLED/SHADOW/PRIMARY)
|
|
135
|
+
- `replaces`: job legado substituído
|
|
136
|
+
- `queue`: task queue do worker
|
|
137
|
+
- `status`: ativo/inativo
|
|
138
|
+
|
|
139
|
+
Use `get_node_context("temporal_workflow", workflow_id)` para ver o estado atual
|
|
140
|
+
e as relações com specs que o criaram ou modificaram.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Output Format
|
|
145
|
+
|
|
146
|
+
Quando apresentar resultados de `get_node_context`:
|
|
147
|
+
- Mostre **todas as propriedades** do nó claramente formatadas
|
|
148
|
+
- Agrupe os vizinhos por `label` (Spec, Service, etc.)
|
|
149
|
+
- Mostre a **direção** da relação (`→ AFFECTS`, `← IMPLEMENTS`, etc.)
|
|
150
|
+
- Se for um TemporalWorkflow, destaque `mode` e `schedule`
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cortex-generate-spec
|
|
3
|
+
description: >
|
|
4
|
+
Synthetic PM skill — gera specs de features a partir de pedidos vagos.
|
|
5
|
+
Usa o Cortex para pesquisa semântica de contexto existente, faz perguntas
|
|
6
|
+
de refinamento ao usuário, e produz um plan.md completo pronto para revisão.
|
|
7
|
+
Use quando: "gerar spec", "criar plan.md", "quero especificar a feature X",
|
|
8
|
+
"escreve um plan.md para", "generate spec", "spec para feature", "criar spec",
|
|
9
|
+
"planejar feature", "planeja isso pra mim".
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Skill: Generate-Spec — Synthetic Product Manager
|
|
13
|
+
|
|
14
|
+
## Propósito
|
|
15
|
+
|
|
16
|
+
Agir como um **Product Manager técnico** para transformar uma ideia vaga em uma
|
|
17
|
+
spec estruturada (`plan.md`) com contexto do produto, escopo definido, e plano
|
|
18
|
+
de implementação. Usa o **Cortex Vector RAG + FTS** para encontrar features
|
|
19
|
+
relacionadas antes de perguntar qualquer coisa ao usuário.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Fluxo Obrigatório
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
1. PESQUISA CORTEX
|
|
27
|
+
↓
|
|
28
|
+
2. ANÁLISE DE IMPACTO
|
|
29
|
+
↓
|
|
30
|
+
3. PERGUNTAS DE REFINAMENTO (3-5 perguntas)
|
|
31
|
+
↓
|
|
32
|
+
4. GERAÇÃO DO PLAN.MD
|
|
33
|
+
↓
|
|
34
|
+
5. SALVAR ARQUIVO
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Fase 1: Pesquisa Cortex (SEMPRE fazer antes de perguntar)
|
|
40
|
+
|
|
41
|
+
### 1a. Busca Semântica (Vector RAG)
|
|
42
|
+
|
|
43
|
+
Use o endpoint do Cortex para encontrar specs semanticamente relacionadas:
|
|
44
|
+
|
|
45
|
+
```http
|
|
46
|
+
POST {CORTEX_URL}/api/v1/query/semantic
|
|
47
|
+
Authorization: Bearer {CORTEX_API_TOKEN}
|
|
48
|
+
Content-Type: application/json
|
|
49
|
+
|
|
50
|
+
{
|
|
51
|
+
"query": "{descrição da feature do usuário}",
|
|
52
|
+
"top_k": 10,
|
|
53
|
+
"hops": 1
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
> **Fallback**: Se Vector RAG não estiver disponível (503), use FTS:
|
|
58
|
+
> `GET /api/v1/query?keywords={keywords}&limit=10`
|
|
59
|
+
|
|
60
|
+
### 1b. Busca por Keywords (FTS cross-validation)
|
|
61
|
+
|
|
62
|
+
```http
|
|
63
|
+
GET {CORTEX_URL}/api/v1/query?keywords={keywords_extraídas}&limit=8
|
|
64
|
+
Authorization: Bearer {CORTEX_API_TOKEN}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 1c. Checar Features em Andamento
|
|
68
|
+
|
|
69
|
+
```http
|
|
70
|
+
POST {CORTEX_URL}/api/v1/nodes
|
|
71
|
+
Authorization: Bearer {CORTEX_API_TOKEN}
|
|
72
|
+
Content-Type: application/json
|
|
73
|
+
|
|
74
|
+
{
|
|
75
|
+
"query": "MATCH (n:Spec) WHERE n.status IN ['in-progress', 'planned'] RETURN n ORDER BY n.id LIMIT 20"
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Fase 2: Análise de Impacto
|
|
82
|
+
|
|
83
|
+
Com os resultados do Cortex, analisar:
|
|
84
|
+
|
|
85
|
+
1. **Há specs existentes sobre o mesmo tema?**
|
|
86
|
+
- Se sim: notar IDs (spec-NNN) e status — não duplicar esforço
|
|
87
|
+
- Se outra spec está `in-progress`: alertar usuário sobre conflito potencial
|
|
88
|
+
|
|
89
|
+
2. **Quais serviços são afetados?**
|
|
90
|
+
- Extrair dos edges `AFFECTS` → Service nodes
|
|
91
|
+
- Montar lista: Frontend / BFF / Backend / Lambda / etc.
|
|
92
|
+
|
|
93
|
+
3. **Há dependências críticas?**
|
|
94
|
+
- Edges `DEPENDS_ON` / `SUPERSEDES` / `MOTIVATED_BY`
|
|
95
|
+
- Specs bloqueantes ou que serão impactadas
|
|
96
|
+
|
|
97
|
+
4. **Há ADRs relevantes?** (se dimensão `adr` ativa)
|
|
98
|
+
- Decisões arquiteturais que condicionam a feature
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Fase 3: Perguntas de Refinamento
|
|
103
|
+
|
|
104
|
+
Formule **3-5 perguntas** focadas nos gaps identificados. Apresente ao usuário
|
|
105
|
+
**antes** de gerar o plan.md. Exemplos de perguntas úteis:
|
|
106
|
+
|
|
107
|
+
### Perguntas de Escopo
|
|
108
|
+
- "O fluxo precisa funcionar offline (WebView sem conexão) ou sempre requer rede?"
|
|
109
|
+
- "Há usuários com role diferente que precisam de comportamento distinto?"
|
|
110
|
+
- "Isso precisa ser retroativo (afetar dados existentes) ou só novos registros?"
|
|
111
|
+
|
|
112
|
+
### Perguntas de Impacto Financeiro / Legal
|
|
113
|
+
- "Há movimentação financeira envolvida? Se sim, precisa de rastro contábil?"
|
|
114
|
+
- "Há dados pessoais (PII) no fluxo? Impacto em LGPD?"
|
|
115
|
+
|
|
116
|
+
### Perguntas de Conflito com Features Existentes
|
|
117
|
+
- Se detectado spec em andamento: "A spec-NNN já cobre parte disso. Quer expandir ela ou criar uma nova?"
|
|
118
|
+
- "Isso substitui algum comportamento atual? O que deve ser mantido?"
|
|
119
|
+
|
|
120
|
+
### Perguntas de Critérios de Aceite
|
|
121
|
+
- "Como saberemos que a feature está pronta? Qual é o happy path mínimo?"
|
|
122
|
+
- "Há casos de erro específicos que precisam de UX dedicada?"
|
|
123
|
+
|
|
124
|
+
### Perguntas de Prioridade / Ondas
|
|
125
|
+
- "Precisa entregar tudo de uma vez ou pode ser incremental em ondas?"
|
|
126
|
+
- "Qual é o prazo crítico, se houver?"
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Fase 4: Geração do plan.md
|
|
131
|
+
|
|
132
|
+
### Estrutura obrigatória
|
|
133
|
+
|
|
134
|
+
```markdown
|
|
135
|
+
# Plan de Execução — Feature {NNN}
|
|
136
|
+
|
|
137
|
+
## Visão Geral
|
|
138
|
+
|
|
139
|
+
{Descrição clara do problema e da solução. 2-4 parágrafos.}
|
|
140
|
+
|
|
141
|
+
**Specs relacionadas**: spec-NNN (status), spec-MMM (status)
|
|
142
|
+
**Serviços afetados**: Frontend, BFF, Backend [, outros]
|
|
143
|
+
**ADRs relevantes**: adr-slug (se houver)
|
|
144
|
+
|
|
145
|
+
## Contexto de Produto
|
|
146
|
+
|
|
147
|
+
{Por que isso é importante agora? Qual dor resolve? Qual oportunidade captura?}
|
|
148
|
+
|
|
149
|
+
## Ondas de Implementação
|
|
150
|
+
|
|
151
|
+
### Onda 1 — {Nome descritivo}
|
|
152
|
+
|
|
153
|
+
- {Tarefa concreta}
|
|
154
|
+
- {Tarefa concreta}
|
|
155
|
+
|
|
156
|
+
**Resultado esperado**: {O que estará funcionando ao final desta onda}
|
|
157
|
+
|
|
158
|
+
### Onda 2 — {Nome descritivo}
|
|
159
|
+
{... mesmo formato}
|
|
160
|
+
|
|
161
|
+
## Critérios de Aceite
|
|
162
|
+
|
|
163
|
+
- [ ] {Critério testável e verificável}
|
|
164
|
+
- [ ] {Critério testável e verificável}
|
|
165
|
+
- [ ] {Critério testável e verificável}
|
|
166
|
+
|
|
167
|
+
## Riscos e Mitigações
|
|
168
|
+
|
|
169
|
+
| Risco | Probabilidade | Impacto | Mitigação |
|
|
170
|
+
|-------|--------------|---------|-----------|
|
|
171
|
+
| {risco} | Alta/Média/Baixa | Alto/Médio/Baixo | {mitigação} |
|
|
172
|
+
|
|
173
|
+
## Decisões Técnicas Chave
|
|
174
|
+
|
|
175
|
+
{Decisões que o time precisa tomar antes ou durante a implementação.}
|
|
176
|
+
|
|
177
|
+
## Interfaces de API (se aplicável)
|
|
178
|
+
|
|
179
|
+
{Novos endpoints, mudanças em contratos, DTOs relevantes.}
|
|
180
|
+
|
|
181
|
+
## Notas Adicionais
|
|
182
|
+
|
|
183
|
+
{Contexto de produto, histórico de decisões, links externos relevantes.}
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
**Criado em**: {data}
|
|
187
|
+
**Status**: planned
|
|
188
|
+
**Spec ID**: spec-{NNN}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Numeração da Spec
|
|
192
|
+
|
|
193
|
+
Para determinar o próximo NNN:
|
|
194
|
+
|
|
195
|
+
```http
|
|
196
|
+
GET {CORTEX_URL}/api/v1/nodes?label=Spec&limit=200
|
|
197
|
+
Authorization: Bearer {CORTEX_API_TOKEN}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Pegar o maior número encontrado em `spec-{NNN}` e incrementar em 1.
|
|
201
|
+
Se não conseguir via API, inspecionar `ls <seu-workspace>/specs/` e usar o maior número + 1.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Fase 5: Salvar Arquivo
|
|
206
|
+
|
|
207
|
+
### Criar diretório e arquivo
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
mkdir -p <seu-workspace>/specs/{NNN}-{slug}/
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Salvar em:
|
|
214
|
+
```
|
|
215
|
+
<seu-workspace>/specs/{NNN}-{slug}/plan.md
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Slug**: kebab-case da feature. Máximo 5 palavras. Sem acentos.
|
|
219
|
+
Exemplo: `078-withdraw-flow-v2`, `079-admin-event-moderation`
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Saída Final ao Usuário
|
|
224
|
+
|
|
225
|
+
Após salvar, apresentar:
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
✅ Spec gerada: specs/{NNN}-{slug}/plan.md
|
|
229
|
+
|
|
230
|
+
**Contexto encontrado**:
|
|
231
|
+
- {N} specs relacionadas encontradas (spec-NNN, spec-MMM)
|
|
232
|
+
- {N} serviços afetados (Frontend, BFF, Backend)
|
|
233
|
+
- {N} conflitos/dependências identificados
|
|
234
|
+
|
|
235
|
+
**Próximos passos sugeridos**:
|
|
236
|
+
1. Revisar o plan.md gerado
|
|
237
|
+
2. Ajustar prioridade das ondas se necessário
|
|
238
|
+
3. Quando pronto: `Start Implementation` para iniciar o loop autônomo
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Regras de Qualidade
|
|
244
|
+
|
|
245
|
+
1. **NÃO gere a spec sem pesquisar o Cortex primeiro** — evita duplicação
|
|
246
|
+
2. **NÃO invente informações técnicas** — pergunte se não tiver certeza
|
|
247
|
+
3. **Faça perguntas ANTES de escrever** — a spec precisa do contexto do usuário
|
|
248
|
+
4. **Seja conciso nas ondas** — cada onda deve ser entregável independente
|
|
249
|
+
5. **Marque dependências externas** — se depende de spec não concluída, diga
|
|
250
|
+
6. **Use o NNN correto** — nunca reutilize um número de spec existente
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Variáveis de Ambiente
|
|
255
|
+
|
|
256
|
+
| Variável | Valor |
|
|
257
|
+
|----------|-------|
|
|
258
|
+
| `CORTEX_URL` | URL do seu servidor Cortex (ex: `http://localhost:8082`) |
|
|
259
|
+
| `CORTEX_API_TOKEN` | Token definido no `.env` do seu servidor Cortex |
|
|
260
|
+
|
|
261
|
+
Para obter o token localmente:
|
|
262
|
+
```bash
|
|
263
|
+
# Via .env do cortex
|
|
264
|
+
cat <seu-cortex-dir>/.env | grep CORTEX_API_TOKEN
|
|
265
|
+
```
|