@onion-architect-ai/cli 4.1.0-beta.1 → 4.1.0-beta.2
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/dist/cli.js +8 -7
- package/dist/cli.js.map +1 -1
- package/package.json +4 -3
- package/templates/.cursor/agents/compliance/iso-22301-specialist.md +917 -0
- package/templates/.cursor/agents/compliance/iso-27001-specialist.md +641 -0
- package/templates/.cursor/agents/compliance/pmbok-specialist.md +669 -0
- package/templates/.cursor/agents/compliance/security-information-master.md +824 -0
- package/templates/.cursor/agents/compliance/soc2-specialist.md +818 -0
- package/templates/.cursor/agents/deployment/docker-specialist.md +1192 -0
- package/templates/.cursor/agents/meta/agent-creator-specialist.md +1135 -0
- package/templates/.cursor/agents/meta/command-creator-specialist.md +1519 -0
- package/templates/.cursor/agents/meta/metaspec-gate-keeper.md +240 -0
- package/templates/.cursor/agents/meta/onion.md +753 -0
- package/templates/.cursor/agents/research/research-agent.md +292 -0
- package/templates/.cursor/agents/review/corporate-compliance-specialist.md +370 -0
- package/templates/.cursor/commands/common/prompts/README.md +187 -0
- package/templates/.cursor/commands/common/prompts/clickup-patterns.md +144 -0
- package/templates/.cursor/commands/common/prompts/code-review-checklist.md +168 -0
- package/templates/.cursor/commands/common/prompts/git-workflow-patterns.md +235 -0
- package/templates/.cursor/commands/common/prompts/output-formats.md +240 -0
- package/templates/.cursor/commands/common/prompts/technical.md +172 -0
- package/templates/.cursor/commands/common/prompts/validation-rules.md +173 -0
- package/templates/.cursor/commands/common/templates/abstraction-template.md +400 -0
- package/templates/.cursor/commands/common/templates/agent-template.md +353 -0
- package/templates/.cursor/commands/common/templates/business_context_template.md +748 -0
- package/templates/.cursor/commands/common/templates/command-template.md +273 -0
- package/templates/.cursor/commands/common/templates/technical_context_template.md +526 -0
- package/templates/.cursor/commands/development/runflow-dev.md +465 -0
- package/templates/.cursor/commands/docs/build-compliance-docs.md +143 -0
- package/templates/.cursor/commands/git/README.md +606 -0
- package/templates/.cursor/commands/meta/all-tools.md +50 -0
- package/templates/.cursor/commands/meta/analyze-complex-problem.md +186 -0
- package/templates/.cursor/commands/meta/create-abstraction.md +859 -0
- package/templates/.cursor/commands/meta/create-agent-express.md +83 -0
- package/templates/.cursor/commands/meta/create-agent.md +210 -0
- package/templates/.cursor/commands/meta/create-command.md +203 -0
- package/templates/.cursor/commands/meta/create-knowledge-base.md +143 -0
- package/templates/.cursor/commands/meta/create-task-structure.md +150 -0
- package/templates/.cursor/commands/meta/setup-integration.md +257 -0
- package/templates/.cursor/commands/onion/setup.md +843 -0
- package/templates/.cursor/commands/onion.md +168 -0
- package/templates/.cursor/commands/product/README.md +230 -0
- package/templates/.cursor/commands/quick/analisys.md +17 -0
- package/templates/.cursor/commands/validate/collab/pair-testing.md +633 -0
- package/templates/.cursor/commands/validate/collab/three-amigos.md +505 -0
- package/templates/.cursor/commands/validate/qa-points/estimate.md +660 -0
- package/templates/.cursor/commands/validate/test-strategy/analyze.md +1134 -0
- package/templates/.cursor/commands/validate/test-strategy/create.md +392 -0
- package/templates/.cursor/commands/validate/workflow.md +360 -0
- package/templates/.cursor/commands/warm-up.md +91 -0
- package/templates/.cursor/docs/architecture/acoplamento-clickup-problema-analise.md +446 -0
- package/templates/.cursor/docs/architecture/desacoplamento-roadmap.md +360 -0
- package/templates/.cursor/docs/architecture/validacao-fase-1.md +219 -0
- package/templates/.cursor/docs/c4/c4-detection-rules.md +395 -0
- package/templates/.cursor/docs/c4/c4-documentation-templates.md +579 -0
- package/templates/.cursor/docs/c4/c4-mermaid-patterns.md +331 -0
- package/templates/.cursor/docs/c4/c4-templates.md +256 -0
- package/templates/.cursor/docs/clickup/clickup-acceptance-criteria-strategy.md +329 -0
- package/templates/.cursor/docs/clickup/clickup-auto-update-strategy.md +318 -0
- package/templates/.cursor/docs/clickup/clickup-comment-formatter.md +239 -0
- package/templates/.cursor/docs/clickup/clickup-description-fix.md +355 -0
- package/templates/.cursor/docs/clickup/clickup-dual-comment-strategy.md +505 -0
- package/templates/.cursor/docs/clickup/clickup-formatting.md +302 -0
- package/templates/.cursor/docs/clickup/separador-tamanho-otimizado.md +256 -0
- package/templates/.cursor/docs/engineer/pre-pr-acceptance-validation.md +256 -0
- package/templates/.cursor/docs/onion/ESPERANTO.md +278 -0
- package/templates/.cursor/docs/onion/agents-reference.md +832 -0
- package/templates/.cursor/docs/onion/clickup-integration.md +738 -0
- package/templates/.cursor/docs/onion/commands-guide.md +807 -0
- package/templates/.cursor/docs/onion/engineering-flows.md +865 -0
- package/templates/.cursor/docs/onion/getting-started.md +741 -0
- package/templates/.cursor/docs/onion/maintenance-checklist.md +388 -0
- package/templates/.cursor/docs/onion/naming-conventions.md +268 -0
- package/templates/.cursor/docs/onion/practical-examples.md +782 -0
- package/templates/.cursor/docs/product/story-points-integration.md +254 -0
- package/templates/.cursor/docs/product/story-points-validation.md +224 -0
- package/templates/.cursor/docs/reviews/task-manager-docs-review-2025-11-24.md +167 -0
- package/templates/.cursor/docs/strategies/clickup-comment-patterns.md +766 -0
- package/templates/.cursor/docs/strategies/clickup-integration-tests.md +599 -0
- package/templates/.cursor/docs/strategies/clickup-mcp-wrappers-tests.md +854 -0
- package/templates/.cursor/docs/strategies/clickup-regression-tests.md +589 -0
- package/templates/.cursor/docs/strategies/visual-patterns.md +308 -0
- package/templates/.cursor/docs/templates/README.md +624 -0
- package/templates/.cursor/docs/templates/adr-template.md +226 -0
- package/templates/.cursor/docs/templates/analysis-template.md +280 -0
- package/templates/.cursor/docs/templates/execution-plan-template.md +430 -0
- package/templates/.cursor/docs/templates/guide-template.md +367 -0
- package/templates/.cursor/docs/templates/phase-execution-prompt-template.md +504 -0
- package/templates/.cursor/docs/templates/reference-template.md +522 -0
- package/templates/.cursor/docs/templates/solution-template.md +390 -0
- package/templates/.cursor/docs/tools/README.md +325 -0
- package/templates/.cursor/docs/tools/agents.md +330 -0
- package/templates/.cursor/docs/tools/commands.md +606 -0
- package/templates/.cursor/docs/tools/cursor.md +498 -0
- package/templates/.cursor/docs/tools/mcps.md +858 -0
- package/templates/.cursor/docs/tools/rules.md +423 -0
- package/templates/.cursor/rules/language-and-documentation.mdc +371 -0
- package/templates/.cursor/rules/onion-patterns.mdc +197 -0
- package/templates/.cursor/rules/validation-rules.mdc +194 -0
- package/templates/.cursor/utils/clickup-mcp-wrappers.md +671 -0
- package/templates/.cursor/utils/date-time-standards.md +182 -0
- package/templates/.cursor/utils/task-manager/README.md +94 -0
- package/templates/.cursor/utils/task-manager/adapters/asana.md +377 -0
- package/templates/.cursor/utils/task-manager/adapters/clickup.md +467 -0
- package/templates/.cursor/utils/task-manager/adapters/linear.md +421 -0
- package/templates/.cursor/utils/task-manager/detector.md +290 -0
- package/templates/.cursor/utils/task-manager/factory.md +363 -0
- package/templates/.cursor/utils/task-manager/interface.md +248 -0
- package/templates/.cursor/utils/task-manager/types.md +409 -0
- package/templates/.cursor/validation/product-task-validation.md +344 -0
- package/templates/.onion/contexts/business/.context-config.yml +52 -0
- package/templates/.onion/contexts/business/README.md +222 -0
- package/templates/.onion/contexts/business/agents/branding-specialist.md +1030 -0
- package/templates/.onion/contexts/business/agents/clickup-specialist.md +397 -0
- package/templates/.onion/contexts/business/agents/extract-meeting-specialist.md +395 -0
- package/templates/.onion/contexts/business/agents/gamma-specialist.md +1169 -0
- package/templates/.onion/contexts/business/agents/meeting-consolidator.md +483 -0
- package/templates/.onion/contexts/business/agents/pain-price-specialist.md +509 -0
- package/templates/.onion/contexts/business/agents/presentation-orchestrator.md +1191 -0
- package/templates/.onion/contexts/business/agents/product-agent.md +202 -0
- package/templates/.onion/contexts/business/agents/story-points-specialist.md +539 -0
- package/templates/.onion/contexts/business/agents/storytelling-specialist.md +891 -0
- package/templates/.onion/contexts/business/agents/task-specialist.md +618 -0
- package/templates/.onion/contexts/business/agents/whisper-specialist.md +373 -0
- package/templates/.onion/contexts/business/commands/advanced/analyze-pain-price.md +709 -0
- package/templates/.onion/contexts/business/commands/advanced/branding.md +460 -0
- package/templates/.onion/contexts/business/commands/advanced/checklist-sync.md +241 -0
- package/templates/.onion/contexts/business/commands/advanced/presentation.md +189 -0
- package/templates/.onion/contexts/business/commands/advanced/transform-consolidated.md +592 -0
- package/templates/.onion/contexts/business/commands/help.md +212 -0
- package/templates/.onion/contexts/business/commands/intermediate/check.md +48 -0
- package/templates/.onion/contexts/business/commands/intermediate/collect.md +96 -0
- package/templates/.onion/contexts/business/commands/intermediate/consolidate-meetings.md +306 -0
- package/templates/.onion/contexts/business/commands/intermediate/convert-to-tasks.md +220 -0
- package/templates/.onion/contexts/business/commands/intermediate/extract-meeting.md +241 -0
- package/templates/.onion/contexts/business/commands/intermediate/feature.md +431 -0
- package/templates/.onion/contexts/business/commands/intermediate/light-arch.md +97 -0
- package/templates/.onion/contexts/business/commands/intermediate/task-check.md +340 -0
- package/templates/.onion/contexts/business/commands/intermediate/validate-task.md +294 -0
- package/templates/.onion/contexts/business/commands/intermediate/whisper.md +325 -0
- package/templates/.onion/contexts/business/commands/starter/estimate.md +519 -0
- package/templates/.onion/contexts/business/commands/starter/refine.md +186 -0
- package/templates/.onion/contexts/business/commands/starter/spec.md +107 -0
- package/templates/.onion/contexts/business/commands/starter/task.md +585 -0
- package/templates/.onion/contexts/business/commands/starter/warm-up.md +187 -0
- package/templates/.onion/contexts/technical/.context-config.yml +64 -0
- package/templates/.onion/contexts/technical/README.md +238 -0
- package/templates/.onion/contexts/technical/agents/branch-code-reviewer.md +200 -0
- package/templates/.onion/contexts/technical/agents/branch-doc-writer.md +162 -0
- package/templates/.onion/contexts/technical/agents/branch-metaspec-checker.md +68 -0
- package/templates/.onion/contexts/technical/agents/branch-test-planner.md +177 -0
- package/templates/.onion/contexts/technical/agents/c4-architecture-specialist.md +712 -0
- package/templates/.onion/contexts/technical/agents/c4-documentation-specialist.md +658 -0
- package/templates/.onion/contexts/technical/agents/code-reviewer.md +155 -0
- package/templates/.onion/contexts/technical/agents/cursor-specialist.md +249 -0
- package/templates/.onion/contexts/technical/agents/docs-reverse-engineer.md +418 -0
- package/templates/.onion/contexts/technical/agents/gitflow-specialist.md +1207 -0
- package/templates/.onion/contexts/technical/agents/linux-security-specialist.md +676 -0
- package/templates/.onion/contexts/technical/agents/mermaid-specialist.md +516 -0
- package/templates/.onion/contexts/technical/agents/nodejs-specialist.md +673 -0
- package/templates/.onion/contexts/technical/agents/nx-migration-specialist.md +867 -0
- package/templates/.onion/contexts/technical/agents/nx-monorepo-specialist.md +619 -0
- package/templates/.onion/contexts/technical/agents/postgres-specialist.md +1124 -0
- package/templates/.onion/contexts/technical/agents/react-developer.md +132 -0
- package/templates/.onion/contexts/technical/agents/runflow-specialist.md +278 -0
- package/templates/.onion/contexts/technical/agents/system-doc-orchestrator.md +1388 -0
- package/templates/.onion/contexts/technical/agents/test-agent.md +425 -0
- package/templates/.onion/contexts/technical/agents/test-engineer.md +295 -0
- package/templates/.onion/contexts/technical/agents/test-planner.md +118 -0
- package/templates/.onion/contexts/technical/agents/zen-engine-specialist.md +421 -0
- package/templates/.onion/contexts/technical/commands/advanced/bump.md +43 -0
- package/templates/.onion/contexts/technical/commands/advanced/consolidate-documents.md +424 -0
- package/templates/.onion/contexts/technical/commands/advanced/e2e.md +392 -0
- package/templates/.onion/contexts/technical/commands/advanced/feature-finish.md +90 -0
- package/templates/.onion/contexts/technical/commands/advanced/feature-publish.md +91 -0
- package/templates/.onion/contexts/technical/commands/advanced/feature-start.md +158 -0
- package/templates/.onion/contexts/technical/commands/advanced/hotfix-finish.md +98 -0
- package/templates/.onion/contexts/technical/commands/advanced/hotfix-start.md +94 -0
- package/templates/.onion/contexts/technical/commands/advanced/hotfix.md +186 -0
- package/templates/.onion/contexts/technical/commands/advanced/refine-vision.md +27 -0
- package/templates/.onion/contexts/technical/commands/advanced/release-finish.md +98 -0
- package/templates/.onion/contexts/technical/commands/advanced/release-start.md +95 -0
- package/templates/.onion/contexts/technical/commands/advanced/reverse-consolidate.md +160 -0
- package/templates/.onion/contexts/technical/commands/advanced/validate-phase-sync.md +118 -0
- package/templates/.onion/contexts/technical/commands/help.md +329 -0
- package/templates/.onion/contexts/technical/commands/intermediate/build-business-docs.md +276 -0
- package/templates/.onion/contexts/technical/commands/intermediate/build-index.md +128 -0
- package/templates/.onion/contexts/technical/commands/intermediate/build-tech-docs.md +204 -0
- package/templates/.onion/contexts/technical/commands/intermediate/code-review.md +215 -0
- package/templates/.onion/contexts/technical/commands/intermediate/docs-health.md +142 -0
- package/templates/.onion/contexts/technical/commands/intermediate/fast-commit.md +45 -0
- package/templates/.onion/contexts/technical/commands/intermediate/integration.md +523 -0
- package/templates/.onion/contexts/technical/commands/intermediate/pr-update.md +198 -0
- package/templates/.onion/contexts/technical/commands/intermediate/pre-pr.md +91 -0
- package/templates/.onion/contexts/technical/commands/intermediate/start.md +266 -0
- package/templates/.onion/contexts/technical/commands/intermediate/sync-sessions.md +320 -0
- package/templates/.onion/contexts/technical/commands/intermediate/unit.md +378 -0
- package/templates/.onion/contexts/technical/commands/intermediate/validate-docs.md +159 -0
- package/templates/.onion/contexts/technical/commands/starter/docs.md +39 -0
- package/templates/.onion/contexts/technical/commands/starter/help.md +306 -0
- package/templates/.onion/contexts/technical/commands/starter/init.md +139 -0
- package/templates/.onion/contexts/technical/commands/starter/plan.md +111 -0
- package/templates/.onion/contexts/technical/commands/starter/pr.md +136 -0
- package/templates/.onion/contexts/technical/commands/starter/sync.md +228 -0
- package/templates/.onion/contexts/technical/commands/starter/warm-up.md +173 -0
- package/templates/.onion/contexts/technical/commands/starter/work.md +169 -0
- package/templates/.onion/core/commands/help.md +388 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sync-sessions
|
|
3
|
+
description: Sincronizar e organizar sessões de trabalho do Sistema Onion.
|
|
4
|
+
model: sonnet
|
|
5
|
+
category: docs
|
|
6
|
+
tags: [sessions, sync, organization]
|
|
7
|
+
version: "4.0.0"
|
|
8
|
+
updated: "2025-12-20"
|
|
9
|
+
level: intermediate
|
|
10
|
+
context: technical
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# 🔄 Sync Sessions - Sincronização de Sessões Onion
|
|
14
|
+
|
|
15
|
+
Sincroniza e organiza todas as sessões de trabalho do Sistema Onion, garantindo que o contexto de desenvolvimento esteja preservado e acessível para referência futura.
|
|
16
|
+
|
|
17
|
+
## 🎯 Objetivo
|
|
18
|
+
|
|
19
|
+
Este comando analisa o trabalho realizado na sessão atual, organiza a documentação gerada e sincroniza com a estrutura `.cursor/sessions/`, mantendo um histórico organizado de todas as atividades de desenvolvimento.
|
|
20
|
+
|
|
21
|
+
## 🎯 Funcionalidades
|
|
22
|
+
|
|
23
|
+
### Organização de Sessões
|
|
24
|
+
- Detecta o trabalho realizado na sessão atual
|
|
25
|
+
- Cria estrutura organizada por data e tópico
|
|
26
|
+
- Preserva contexto e decisões tomadas
|
|
27
|
+
- Gera índice navegável de sessões
|
|
28
|
+
|
|
29
|
+
### Sincronização Automática
|
|
30
|
+
- Identifica arquivos criados/modificados
|
|
31
|
+
- Captura comandos Onion executados
|
|
32
|
+
- Preserva interações e decisões
|
|
33
|
+
- Mantém histórico de mudanças
|
|
34
|
+
|
|
35
|
+
### Validação e Integridade
|
|
36
|
+
- Verifica completude da documentação da sessão
|
|
37
|
+
- Valida estrutura de diretórios
|
|
38
|
+
- Identifica sessões incompletas
|
|
39
|
+
- Sugere melhorias na organização
|
|
40
|
+
|
|
41
|
+
## 🚀 Como Usar
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Sincronizar sessão atual
|
|
45
|
+
/docs/sync-sessions
|
|
46
|
+
|
|
47
|
+
# Sincronizar com nome customizado
|
|
48
|
+
/docs/sync-sessions "implementacao-feature-x"
|
|
49
|
+
|
|
50
|
+
# Sincronizar e arquivar sessão
|
|
51
|
+
/docs/sync-sessions --archive
|
|
52
|
+
|
|
53
|
+
# Apenas validar sem sincronizar
|
|
54
|
+
/docs/sync-sessions --validate-only
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 📋 Processo Executado
|
|
58
|
+
|
|
59
|
+
### 1. **Análise da Sessão Atual**
|
|
60
|
+
- Identifica data/hora de início
|
|
61
|
+
- Lista arquivos criados/modificados
|
|
62
|
+
- Captura comandos executados
|
|
63
|
+
- Extrai decisões e contexto
|
|
64
|
+
|
|
65
|
+
### 2. **Estruturação**
|
|
66
|
+
```
|
|
67
|
+
.cursor/sessions/
|
|
68
|
+
└── YYYY-MM-DD_HHMM_topic-name/
|
|
69
|
+
├── README.md # Resumo da sessão
|
|
70
|
+
├── context.md # Contexto inicial
|
|
71
|
+
├── decisions.md # Decisões tomadas
|
|
72
|
+
├── changes.md # Mudanças realizadas
|
|
73
|
+
├── notes.md # Notas e observações
|
|
74
|
+
├── files-changed.txt # Lista de arquivos
|
|
75
|
+
└── commands-executed.txt # Comandos usados
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3. **Geração de Documentação**
|
|
79
|
+
- **README.md**: Resumo executivo da sessão
|
|
80
|
+
- **context.md**: Contexto e motivação
|
|
81
|
+
- **decisions.md**: Decisões arquiteturais e técnicas
|
|
82
|
+
- **changes.md**: Log detalhado de mudanças
|
|
83
|
+
- **notes.md**: Anotações e insights
|
|
84
|
+
|
|
85
|
+
### 4. **Sincronização**
|
|
86
|
+
- Move/copia arquivos para estrutura correta
|
|
87
|
+
- Atualiza índice de sessões
|
|
88
|
+
- Gera links de navegação
|
|
89
|
+
- Valida integridade
|
|
90
|
+
|
|
91
|
+
## 📁 Estrutura de Sessão
|
|
92
|
+
|
|
93
|
+
### README.md
|
|
94
|
+
```markdown
|
|
95
|
+
# [Topic Name] - [Date]
|
|
96
|
+
|
|
97
|
+
## 🎯 Objetivo
|
|
98
|
+
[Descrição do objetivo da sessão]
|
|
99
|
+
|
|
100
|
+
## 📊 Resultados
|
|
101
|
+
- [Lista de entregas]
|
|
102
|
+
- [Arquivos criados/modificados]
|
|
103
|
+
|
|
104
|
+
## 🔗 Links Relacionados
|
|
105
|
+
- [Documentação relacionada]
|
|
106
|
+
- [Issues/PRs relacionados]
|
|
107
|
+
|
|
108
|
+
## ⏱️ Tempo Investido
|
|
109
|
+
[Duração aproximada]
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### context.md
|
|
113
|
+
```markdown
|
|
114
|
+
# Contexto - [Topic]
|
|
115
|
+
|
|
116
|
+
## Situação Inicial
|
|
117
|
+
[Estado do projeto antes da sessão]
|
|
118
|
+
|
|
119
|
+
## Motivação
|
|
120
|
+
[Por que este trabalho foi necessário]
|
|
121
|
+
|
|
122
|
+
## Restrições
|
|
123
|
+
[Limitações técnicas, tempo, recursos]
|
|
124
|
+
|
|
125
|
+
## Referências
|
|
126
|
+
[Links, documentos, discussões relevantes]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### decisions.md
|
|
130
|
+
```markdown
|
|
131
|
+
# Decisões Tomadas - [Topic]
|
|
132
|
+
|
|
133
|
+
## Decisão 1: [Título]
|
|
134
|
+
- **Contexto**: [Por que esta decisão foi necessária]
|
|
135
|
+
- **Opções Consideradas**:
|
|
136
|
+
- Opção A: [Prós/Contras]
|
|
137
|
+
- Opção B: [Prós/Contras]
|
|
138
|
+
- **Decisão**: [Opção escolhida]
|
|
139
|
+
- **Justificativa**: [Razões]
|
|
140
|
+
- **Impacto**: [Consequências]
|
|
141
|
+
|
|
142
|
+
## Decisão 2: [Título]
|
|
143
|
+
[...]
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### changes.md
|
|
147
|
+
```markdown
|
|
148
|
+
# Mudanças Realizadas - [Topic]
|
|
149
|
+
|
|
150
|
+
## Arquivos Criados
|
|
151
|
+
- `path/to/file1.ts` - [Descrição]
|
|
152
|
+
- `path/to/file2.md` - [Descrição]
|
|
153
|
+
|
|
154
|
+
## Arquivos Modificados
|
|
155
|
+
- `path/to/existing.ts`
|
|
156
|
+
- [Descrição da mudança]
|
|
157
|
+
- [Linhas afetadas]
|
|
158
|
+
|
|
159
|
+
## Comandos Executados
|
|
160
|
+
1. `/docs/build-tech-docs` - [Resultado]
|
|
161
|
+
2. `/git/create-branch` - [Branch criada]
|
|
162
|
+
|
|
163
|
+
## Testes Adicionados
|
|
164
|
+
- [Lista de testes criados]
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## 🤖 Integração com Agentes
|
|
168
|
+
|
|
169
|
+
Este comando convoca automaticamente:
|
|
170
|
+
- **@branch-documentation-writer**: Gera documentação estruturada
|
|
171
|
+
- **@metaspec-gate-keeper**: Valida conformidade com padrões
|
|
172
|
+
- **@gitflow-specialist**: Auxilia em questões Git se necessário
|
|
173
|
+
|
|
174
|
+
## ⚙️ Opções Avançadas
|
|
175
|
+
|
|
176
|
+
### Flags Disponíveis
|
|
177
|
+
```bash
|
|
178
|
+
--archive # Move sessão para archived/
|
|
179
|
+
--validate-only # Apenas valida sem sincronizar
|
|
180
|
+
--force # Força sincronização mesmo com erros
|
|
181
|
+
--skip-git # Não inclui informações Git
|
|
182
|
+
--detailed # Gera relatório detalhado
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Exemplos Avançados
|
|
186
|
+
```bash
|
|
187
|
+
# Sincronizar e arquivar sessão antiga
|
|
188
|
+
/docs/sync-sessions "refactoring-api" --archive
|
|
189
|
+
|
|
190
|
+
# Validar integridade sem modificar
|
|
191
|
+
/docs/sync-sessions --validate-only
|
|
192
|
+
|
|
193
|
+
# Sincronização forçada com relatório detalhado
|
|
194
|
+
/docs/sync-sessions --force --detailed
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## 📊 Métricas Capturadas
|
|
198
|
+
|
|
199
|
+
O comando captura automaticamente:
|
|
200
|
+
- **Arquivos**: Criados, modificados, deletados
|
|
201
|
+
- **Linhas de Código**: Adicionadas, removidas
|
|
202
|
+
- **Comandos**: Onion executados
|
|
203
|
+
- **Tempo**: Duração aproximada da sessão
|
|
204
|
+
- **Agentes**: AI agents convocados
|
|
205
|
+
- **Commits**: Git commits relacionados (se aplicável)
|
|
206
|
+
|
|
207
|
+
## ⚠️ Resolução de Problemas
|
|
208
|
+
|
|
209
|
+
### **Problema 1: Sessão já existe**
|
|
210
|
+
- **Sintoma**: Erro "Session directory already exists"
|
|
211
|
+
- **Solução**: Use flag `--force` ou renomeie a sessão
|
|
212
|
+
|
|
213
|
+
### **Problema 2: Arquivos não detectados**
|
|
214
|
+
- **Sintoma**: Lista de arquivos incompleta
|
|
215
|
+
- **Causa**: Arquivos fora do workspace ou gitignored
|
|
216
|
+
- **Fix**: Verifique `.gitignore` e workspace boundaries
|
|
217
|
+
|
|
218
|
+
### **Problema 3: Contexto insuficiente**
|
|
219
|
+
- **Sintoma**: README.md com pouca informação
|
|
220
|
+
- **Solução**: Execute comandos Onion com mais contexto antes de sincronizar
|
|
221
|
+
|
|
222
|
+
## 🔍 Validações Realizadas
|
|
223
|
+
|
|
224
|
+
O comando valida:
|
|
225
|
+
- ✅ Estrutura de diretórios correta
|
|
226
|
+
- ✅ Todos os arquivos markdown obrigatórios presentes
|
|
227
|
+
- ✅ README.md com seções mínimas
|
|
228
|
+
- ✅ Links internos funcionando
|
|
229
|
+
- ✅ Sem duplicação de sessões
|
|
230
|
+
- ✅ Índice de sessões atualizado
|
|
231
|
+
|
|
232
|
+
## 📈 Output Esperado
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
🔄 Sincronizando Sessão Onion...
|
|
236
|
+
|
|
237
|
+
📊 Análise da Sessão:
|
|
238
|
+
• Tópico: implementação-dashboard-operacoes
|
|
239
|
+
• Data: 2025-10-03 10:30
|
|
240
|
+
• Arquivos Criados: 15
|
|
241
|
+
• Arquivos Modificados: 8
|
|
242
|
+
• Comandos Executados: 5
|
|
243
|
+
• Agentes Convocados: 3
|
|
244
|
+
|
|
245
|
+
📁 Estrutura Criada:
|
|
246
|
+
✅ .cursor/sessions/2025-10-03_1030_dashboard-operacoes/
|
|
247
|
+
✅ README.md
|
|
248
|
+
✅ context.md
|
|
249
|
+
✅ decisions.md
|
|
250
|
+
✅ changes.md
|
|
251
|
+
✅ notes.md
|
|
252
|
+
✅ files-changed.txt
|
|
253
|
+
✅ commands-executed.txt
|
|
254
|
+
|
|
255
|
+
🔗 Índice Atualizado:
|
|
256
|
+
✅ .cursor/sessions/INDEX.md
|
|
257
|
+
|
|
258
|
+
✅ Sessão sincronizada com sucesso!
|
|
259
|
+
|
|
260
|
+
📚 Para revisar:
|
|
261
|
+
cat .cursor/sessions/2025-10-03_1030_dashboard-operacoes/README.md
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## 🎯 Casos de Uso
|
|
265
|
+
|
|
266
|
+
### Caso 1: Fim de Sessão de Desenvolvimento
|
|
267
|
+
```bash
|
|
268
|
+
# Ao terminar trabalho do dia
|
|
269
|
+
/docs/sync-sessions "refactoring-contracts-module"
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Caso 2: Antes de Trocar de Branch
|
|
273
|
+
```bash
|
|
274
|
+
# Preservar contexto antes de mudar de tarefa
|
|
275
|
+
/docs/sync-sessions --detailed
|
|
276
|
+
git checkout other-branch
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Caso 3: Auditoria de Trabalho Realizado
|
|
280
|
+
```bash
|
|
281
|
+
# Gerar relatório completo da sessão
|
|
282
|
+
/docs/sync-sessions --validate-only --detailed
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Caso 4: Arquivar Trabalho Concluído
|
|
286
|
+
```bash
|
|
287
|
+
# Mover sessão para archived após merge
|
|
288
|
+
/docs/sync-sessions "feature-x-completed" --archive
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## 🔗 Comandos Relacionados
|
|
292
|
+
|
|
293
|
+
- `/docs/build-index` - Reconstrói índice de documentação
|
|
294
|
+
- `/docs/docs-health` - Verifica saúde da documentação
|
|
295
|
+
- `/docs/validate-docs` - Valida completude
|
|
296
|
+
- `/git/help` - Ajuda com Git workflows
|
|
297
|
+
|
|
298
|
+
## 📝 Notas Importantes
|
|
299
|
+
|
|
300
|
+
1. **Frequência**: Execute ao final de cada sessão significativa de trabalho
|
|
301
|
+
2. **Contexto**: Quanto mais contexto fornecer, melhor a documentação gerada
|
|
302
|
+
3. **Consistência**: Manter padrão de nomenclatura ajuda na navegação
|
|
303
|
+
4. **Limpeza**: Arquive sessões antigas periodicamente para manter organização
|
|
304
|
+
|
|
305
|
+
## 🎓 Best Practices
|
|
306
|
+
|
|
307
|
+
1. **Nomeie Sessions Descritivamente**: Use nomes que descrevam claramente o trabalho
|
|
308
|
+
2. **Documente Decisões**: Capture o "porquê" das decisões, não apenas o "o quê"
|
|
309
|
+
3. **Preserve Contexto**: Inclua links para issues, PRs, discussões relevantes
|
|
310
|
+
4. **Seja Consistente**: Use padrões consistentes de nomenclatura
|
|
311
|
+
5. **Arquive Regularmente**: Mova sessões antigas para `archived/` periodicamente
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
**Agente Responsável**: @branch-documentation-writer
|
|
316
|
+
**Validador**: @metaspec-gate-keeper
|
|
317
|
+
**Categoria**: Documentação / Organização
|
|
318
|
+
**Prioridade**: Média
|
|
319
|
+
**Última Atualização**: Outubro 2025
|
|
320
|
+
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: unit
|
|
3
|
+
description: |
|
|
4
|
+
Gera e executa testes unitários automaticamente com detecção de framework.
|
|
5
|
+
Use para criar testes seguindo padrões do projeto e executá-los com coverage.
|
|
6
|
+
model: sonnet
|
|
7
|
+
|
|
8
|
+
parameters:
|
|
9
|
+
- name: file-path
|
|
10
|
+
description: Caminho do arquivo fonte para testar (obrigatório)
|
|
11
|
+
required: true
|
|
12
|
+
- name: --generate
|
|
13
|
+
description: Gera arquivo de teste se não existir
|
|
14
|
+
required: false
|
|
15
|
+
- name: --run
|
|
16
|
+
description: Executa os testes após gerar/validar
|
|
17
|
+
required: false
|
|
18
|
+
- name: --coverage
|
|
19
|
+
description: Inclui relatório de coverage na execução
|
|
20
|
+
required: false
|
|
21
|
+
- name: --watch
|
|
22
|
+
description: Modo watch para re-execução automática
|
|
23
|
+
required: false
|
|
24
|
+
- name: --framework
|
|
25
|
+
description: Framework específico (sobrescreve auto-detecção: jest|vitest|pytest|junit)
|
|
26
|
+
required: false
|
|
27
|
+
|
|
28
|
+
category: test
|
|
29
|
+
tags:
|
|
30
|
+
- testing
|
|
31
|
+
- unit-tests
|
|
32
|
+
- test-generation
|
|
33
|
+
- code-quality
|
|
34
|
+
- automation
|
|
35
|
+
- coverage
|
|
36
|
+
|
|
37
|
+
version: "4.0.0"
|
|
38
|
+
updated: "2025-12-20"
|
|
39
|
+
|
|
40
|
+
related_commands:
|
|
41
|
+
- /test/integration
|
|
42
|
+
- /test/e2e
|
|
43
|
+
- /validate/test-strategy/create
|
|
44
|
+
- /engineer/work
|
|
45
|
+
- /git/code-review
|
|
46
|
+
|
|
47
|
+
related_agents:
|
|
48
|
+
- test-engineer
|
|
49
|
+
- test-planner
|
|
50
|
+
level: intermediate
|
|
51
|
+
context: technical
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
# 🧪 Test Unit
|
|
55
|
+
|
|
56
|
+
Gera e executa testes unitários automaticamente com detecção inteligente de framework, análise de código e integração com ferramentas de coverage.
|
|
57
|
+
|
|
58
|
+
## 🎯 Objetivo
|
|
59
|
+
|
|
60
|
+
Automatizar o ciclo completo de testes unitários:
|
|
61
|
+
- **Auto-detecção** de framework de teste baseado em configurações do projeto
|
|
62
|
+
- **Análise de código** para identificar funções/métodos públicos testáveis
|
|
63
|
+
- **Geração automática** de arquivos de teste seguindo padrões do projeto
|
|
64
|
+
- **Execução inteligente** com suporte a coverage e watch mode
|
|
65
|
+
- **Integração** com pipeline de testes existente
|
|
66
|
+
|
|
67
|
+
## ⚡ Fluxo de Execução
|
|
68
|
+
|
|
69
|
+
### Passo 1: Validar Arquivo Fonte
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Verificar se arquivo existe
|
|
73
|
+
if [ ! -f "{{file-path}}" ]; then
|
|
74
|
+
echo "❌ ERRO: Arquivo não encontrado: {{file-path}}"
|
|
75
|
+
exit 1
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
# Extrair informações do arquivo
|
|
79
|
+
- Extensão: .js, .ts, .tsx, .py, .java, etc.
|
|
80
|
+
- Diretório base
|
|
81
|
+
- Nome do arquivo (sem extensão)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Validações:**
|
|
85
|
+
```markdown
|
|
86
|
+
SE arquivo não existe:
|
|
87
|
+
❌ ERRO: Arquivo não encontrado: {{file-path}}
|
|
88
|
+
💡 Verifique o caminho e tente novamente
|
|
89
|
+
|
|
90
|
+
SE arquivo não é código fonte suportado:
|
|
91
|
+
⚠️ AVISO: Tipo de arquivo pode não ser suportado
|
|
92
|
+
Tipos suportados: .js, .ts, .tsx, .jsx, .py, .java, .go, .rs
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Passo 2: Detectar Framework de Teste
|
|
96
|
+
|
|
97
|
+
**Estratégia de Detecção (em ordem de prioridade):**
|
|
98
|
+
|
|
99
|
+
1. **Verificar configurações:** `package.json` (Jest/Vitest), `pytest.ini` (PyTest), `pom.xml`/`build.gradle` (JUnit), `go.mod` (Go), `Cargo.toml` (Rust)
|
|
100
|
+
2. **Buscar arquivos de teste existentes:** `**/*.test.{js,ts}`, `**/test_*.py`, `**/*_test.go`, `**/*Test.java`
|
|
101
|
+
3. **Inferir por linguagem:** Jest/Vitest (JS/TS), PyTest (Python), JUnit (Java), testing (Go), cargo test (Rust)
|
|
102
|
+
|
|
103
|
+
**Output:**
|
|
104
|
+
```markdown
|
|
105
|
+
✅ Framework: [jest|vitest|pytest|junit|go-test|rust-test]
|
|
106
|
+
📁 Config: [caminho]
|
|
107
|
+
📦 Package manager: [npm|pnpm|yarn|pip|maven|gradle|cargo]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Se `--framework` fornecido:** Sobrescreve detecção automática
|
|
111
|
+
|
|
112
|
+
### Passo 3: Analisar Código Fonte
|
|
113
|
+
|
|
114
|
+
**Objetivo:** Identificar funções/métodos públicos que precisam de testes.
|
|
115
|
+
|
|
116
|
+
#### 3.1 Ler Arquivo Fonte
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
read_file {{file-path}}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### 3.2 Extrair Funções/Métodos Públicos
|
|
123
|
+
|
|
124
|
+
**Padrões por linguagem:**
|
|
125
|
+
- **JS/TS:** `export function/const/class`, `export default`
|
|
126
|
+
- **Python:** `def nome_funcao` (sem `_` inicial), classes públicas
|
|
127
|
+
- **Java:** `public methods`, `@Test` annotations
|
|
128
|
+
- **Go:** `func NomeFuncao` (maiúscula inicial)
|
|
129
|
+
- **Rust:** `pub fn`, `pub struct`, `impl` públicos
|
|
130
|
+
|
|
131
|
+
#### 3.3 Identificar Dependências Externas
|
|
132
|
+
|
|
133
|
+
- Imports/requires externos, APIs, arquivos/DB, dependências para mocks
|
|
134
|
+
|
|
135
|
+
**Output da Análise:**
|
|
136
|
+
```markdown
|
|
137
|
+
📊 Análise de Código:
|
|
138
|
+
∟ Funções públicas encontradas: [N]
|
|
139
|
+
∟ Classes encontradas: [N]
|
|
140
|
+
∟ Dependências externas: [lista]
|
|
141
|
+
∟ Complexidade estimada: [baixa|média|alta]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Passo 4: Verificar Arquivo de Teste Existente
|
|
145
|
+
|
|
146
|
+
**Padrões de nomenclatura:**
|
|
147
|
+
- **Jest/Vitest:** `{{file}}.test.{js,ts,tsx}`
|
|
148
|
+
- **PyTest:** `test_{{file}}.py` ou `tests/test_{{file}}.py`
|
|
149
|
+
- **JUnit:** `{{Class}}Test.java` em `src/test/`
|
|
150
|
+
- **Go:** `{{file}}_test.go`
|
|
151
|
+
- **Rust:** `#[cfg(test)]` no mesmo arquivo
|
|
152
|
+
|
|
153
|
+
**Decisão:**
|
|
154
|
+
```markdown
|
|
155
|
+
SE arquivo existe:
|
|
156
|
+
✅ Encontrado: [caminho]
|
|
157
|
+
SE --generate: ⚠️ Pula geração, continua execução
|
|
158
|
+
SENÃO: Continua execução
|
|
159
|
+
|
|
160
|
+
SE não existe:
|
|
161
|
+
SE --generate: → Gerar (Passo 5)
|
|
162
|
+
SENÃO: ❌ ERRO: Use --generate para criar
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Passo 5: Gerar Arquivo de Teste (SE --generate)
|
|
166
|
+
|
|
167
|
+
**Estratégia:**
|
|
168
|
+
1. **Ler padrões existentes:** Buscar `**/*.test.{js,ts}`, `**/test_*.py` para extrair estrutura, imports, nomenclatura
|
|
169
|
+
2. **Gerar testes base:** Padrão AAA (Arrange, Act, Assert) para cada função pública:
|
|
170
|
+
- Happy path: entrada válida → saída esperada
|
|
171
|
+
- Edge cases: null, vazios, limites
|
|
172
|
+
- Error handling: entradas inválidas → exceções
|
|
173
|
+
3. **Configurar mocks:** Para dependências externas (Jest: `jest.mock()`, Vitest: `vi.mock()`)
|
|
174
|
+
4. **Criar arquivo:** `write {{test-file-path}}`
|
|
175
|
+
|
|
176
|
+
**Exemplo estrutura (Jest/Vitest):**
|
|
177
|
+
```typescript
|
|
178
|
+
describe('nomeFuncao', () => {
|
|
179
|
+
test('should return expected result with valid input', () => {
|
|
180
|
+
const result = nomeFuncao('valid input')
|
|
181
|
+
expect(result).toBe('expected output')
|
|
182
|
+
})
|
|
183
|
+
test('should handle edge case', () => {
|
|
184
|
+
expect(() => nomeFuncao(null)).toThrow()
|
|
185
|
+
})
|
|
186
|
+
})
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Validação:** ✅ Arquivo gerado: {{test-file-path}}, [N] testes (happy path: X, edge: Y, errors: Z)
|
|
190
|
+
|
|
191
|
+
### Passo 6: Executar Testes (SE --run)
|
|
192
|
+
|
|
193
|
+
**Comandos por framework:**
|
|
194
|
+
|
|
195
|
+
- **Jest:** `npx jest {{test-file}} [--coverage] [--watch]` ou `pnpm jest`
|
|
196
|
+
- **Vitest:** `npx vitest [run] {{test-file}} [--coverage]` ou `pnpm vitest`
|
|
197
|
+
- **PyTest:** `pytest {{test-file}} [--cov={{dir}} --cov-report=html]` ou `ptw` (watch)
|
|
198
|
+
- **JUnit:** `mvn test -Dtest={{Class}}` ou `./gradlew test --tests {{Class}}`
|
|
199
|
+
- **Go:** `go test ./{{pkg}} [-v] [-cover]`
|
|
200
|
+
- **Rust:** `cargo test {{name}}`
|
|
201
|
+
|
|
202
|
+
**Construir comando:** Base + `--coverage` (se flag) + `--watch` (se flag) + execução única (se não watch)
|
|
203
|
+
|
|
204
|
+
**Executar:** `run_terminal_cmd [comando]` e capturar: resultados (pass/fail), coverage (se aplicável), erros, tempo
|
|
205
|
+
|
|
206
|
+
### Passo 7: Apresentar Resultados
|
|
207
|
+
|
|
208
|
+
## 📤 Output Esperado
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
212
|
+
✅ TESTES UNITÁRIOS - {{file-path}}
|
|
213
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
214
|
+
|
|
215
|
+
🔍 Detecção:
|
|
216
|
+
∟ Framework: [jest|vitest|pytest|junit|go-test|rust-test]
|
|
217
|
+
∟ Config: [caminho do arquivo de config]
|
|
218
|
+
∟ Package manager: [npm|pnpm|yarn|pip|maven|gradle|cargo]
|
|
219
|
+
|
|
220
|
+
📊 Análise de Código:
|
|
221
|
+
∟ Arquivo fonte: {{file-path}}
|
|
222
|
+
∟ Funções públicas: [N]
|
|
223
|
+
∟ Classes: [N]
|
|
224
|
+
∟ Dependências externas: [lista]
|
|
225
|
+
∟ Complexidade: [baixa|média|alta]
|
|
226
|
+
|
|
227
|
+
📝 Arquivo de Teste:
|
|
228
|
+
∟ Status: [✅ Existente | ✅ Gerado | ❌ Não encontrado]
|
|
229
|
+
∟ Caminho: {{test-file-path}}
|
|
230
|
+
∟ Testes: [N] casos de teste
|
|
231
|
+
├─ Happy path: [N]
|
|
232
|
+
├─ Edge cases: [N]
|
|
233
|
+
└─ Error handling: [N]
|
|
234
|
+
|
|
235
|
+
🧪 Execução:
|
|
236
|
+
∟ Comando: [comando executado]
|
|
237
|
+
∟ Status: [✅ Passou | ❌ Falhou | ⚠️ Parcial]
|
|
238
|
+
∟ Testes executados: [X/Y] passaram
|
|
239
|
+
∟ Tempo: [X]s
|
|
240
|
+
|
|
241
|
+
📈 Coverage (se --coverage):
|
|
242
|
+
∟ Statements: [X]%
|
|
243
|
+
∟ Branches: [X]%
|
|
244
|
+
∟ Functions: [X]%
|
|
245
|
+
∟ Lines: [X]%
|
|
246
|
+
∟ Arquivo: [caminho do relatório]
|
|
247
|
+
|
|
248
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
249
|
+
|
|
250
|
+
🚀 Próximos Passos:
|
|
251
|
+
1. Revisar testes gerados e adicionar casos específicos
|
|
252
|
+
2. Executar novamente: /test/unit {{file-path}} --run
|
|
253
|
+
3. Integrar no pipeline: /validate/test-strategy/create
|
|
254
|
+
4. Code review: /git/code-review
|
|
255
|
+
|
|
256
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## 📋 Exemplos de Uso
|
|
260
|
+
|
|
261
|
+
**1. Gerar e executar com coverage:**
|
|
262
|
+
```bash
|
|
263
|
+
/test/unit src/utils/validation.js --generate --run --coverage
|
|
264
|
+
```
|
|
265
|
+
→ Detecta framework, analisa código, gera `validation.test.js`, executa com coverage
|
|
266
|
+
|
|
267
|
+
**2. Apenas gerar teste:**
|
|
268
|
+
```bash
|
|
269
|
+
/test/unit app/models/user.py --generate --framework pytest
|
|
270
|
+
```
|
|
271
|
+
→ Força PyTest, gera `test_user.py`, não executa
|
|
272
|
+
|
|
273
|
+
**3. Executar com watch:**
|
|
274
|
+
```bash
|
|
275
|
+
/test/unit components/Button.tsx --run --watch
|
|
276
|
+
```
|
|
277
|
+
→ Detecta framework, executa `Button.test.tsx` em modo watch
|
|
278
|
+
|
|
279
|
+
**4. Executar teste existente:**
|
|
280
|
+
```bash
|
|
281
|
+
/test/unit src/services/api.ts --run --coverage
|
|
282
|
+
```
|
|
283
|
+
→ Encontra `api.test.ts`, executa com coverage, não gera novo arquivo
|
|
284
|
+
|
|
285
|
+
## ⚙️ Parâmetros Detalhados
|
|
286
|
+
|
|
287
|
+
| Parâmetro | Tipo | Obrigatório | Descrição |
|
|
288
|
+
|-----------|------|-------------|-----------|
|
|
289
|
+
| `file-path` | string | ✅ | Caminho do arquivo fonte para testar |
|
|
290
|
+
| `--generate` | flag | ❌ | Gera arquivo de teste se não existir |
|
|
291
|
+
| `--run` | flag | ❌ | Executa os testes após gerar/validar |
|
|
292
|
+
| `--coverage` | flag | ❌ | Inclui relatório de coverage |
|
|
293
|
+
| `--watch` | flag | ❌ | Modo watch para re-execução automática |
|
|
294
|
+
| `--framework` | string | ❌ | Framework específico (sobrescreve auto-detecção) |
|
|
295
|
+
|
|
296
|
+
## 🔗 Comandos Relacionados
|
|
297
|
+
|
|
298
|
+
- `/test/integration` - Testes de integração (Grey-box)
|
|
299
|
+
- `/test/e2e` - Testes end-to-end (Black-box)
|
|
300
|
+
- `/validate/test-strategy/create` - Criar estratégia completa de testes
|
|
301
|
+
- `/engineer/work` - Continuar desenvolvimento com testes
|
|
302
|
+
- `/git/code-review` - Revisar código incluindo testes
|
|
303
|
+
|
|
304
|
+
## ⚠️ Validações e Regras
|
|
305
|
+
|
|
306
|
+
### Validações Obrigatórias
|
|
307
|
+
|
|
308
|
+
1. **Arquivo fonte deve existir:**
|
|
309
|
+
```markdown
|
|
310
|
+
SE arquivo não encontrado:
|
|
311
|
+
❌ ERRO: Arquivo não encontrado: {{file-path}}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
2. **Framework deve ser detectável ou fornecido:**
|
|
315
|
+
```markdown
|
|
316
|
+
SE nenhum framework detectado E --framework não fornecido:
|
|
317
|
+
❌ ERRO: Não foi possível detectar framework de teste
|
|
318
|
+
💡 Instale um framework ou use --framework [nome]
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
3. **Arquivo de teste deve existir para execução:**
|
|
322
|
+
```markdown
|
|
323
|
+
SE --run fornecido E arquivo de teste não existe E --generate não fornecido:
|
|
324
|
+
❌ ERRO: Arquivo de teste não encontrado
|
|
325
|
+
💡 Use --generate para criar automaticamente
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Regras de Negócio
|
|
329
|
+
|
|
330
|
+
1. **Auto-detecção tem prioridade** sobre --framework, exceto se --framework fornecido
|
|
331
|
+
2. **Geração segue padrões** do projeto (analisa testes existentes)
|
|
332
|
+
3. **Coverage requer** framework com suporte (Jest, Vitest, PyTest)
|
|
333
|
+
4. **Watch mode** mantém processo rodando até interrupção
|
|
334
|
+
5. **Testes gerados** cobrem happy path, edge cases e error handling básicos
|
|
335
|
+
|
|
336
|
+
## 🔧 Suporte por Linguagem
|
|
337
|
+
|
|
338
|
+
| Linguagem | Frameworks | Coverage | Watch |
|
|
339
|
+
|-----------|-----------|----------|-------|
|
|
340
|
+
| JS/TS | Jest, Vitest, Mocha | ✅ | ✅ |
|
|
341
|
+
| Python | PyTest, unittest | ✅ | ⚠️ |
|
|
342
|
+
| Java | JUnit 5/4 | ✅ | ❌ |
|
|
343
|
+
| Go | testing (built-in) | ✅ | ⚠️ |
|
|
344
|
+
| Rust | cargo test | ⚠️ | ❌ |
|
|
345
|
+
|
|
346
|
+
## 📚 Referências
|
|
347
|
+
|
|
348
|
+
- **Agente de Testes:** @test-engineer
|
|
349
|
+
- **Framework de Testes:** `docs/knowbase/frameworks/framework_testes.md`
|
|
350
|
+
- **Padrões de Teste:** `.cursor/agents/testing/test-engineer.md`
|
|
351
|
+
|
|
352
|
+
## ⚠️ Notas Importantes
|
|
353
|
+
|
|
354
|
+
- **Auto-detecção inteligente:** Analisa configurações e padrões do projeto
|
|
355
|
+
- **Geração conservadora:** Cria testes básicos, desenvolvedor deve expandir
|
|
356
|
+
- **Integração com pipeline:** Testes gerados seguem padrões do projeto
|
|
357
|
+
- **Coverage opcional:** Requer configuração prévia do framework
|
|
358
|
+
- **Watch mode:** Mantém processo ativo, use Ctrl+C para parar
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
**Versão:** 3.0.0
|
|
363
|
+
**Última atualização:** 2025-11-24
|
|
364
|
+
**Mantido por:** Sistema Onion
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## 📚 Pré-requisitos
|
|
371
|
+
|
|
372
|
+
Domine comandos starter antes de usar este comando intermediate/advanced.
|
|
373
|
+
|
|
374
|
+
Consulte os comandos help para ver hierarquia completa e comandos relacionados:
|
|
375
|
+
- /business/help --level=starter
|
|
376
|
+
- /technical/help --level=starter
|
|
377
|
+
|
|
378
|
+
💡 Comandos intermediate/advanced assumem familiaridade com workflows básicos do contexto.
|