@onion-architect-ai/cli 4.1.0-beta.1 → 4.1.0-beta.3

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.
Files changed (207) hide show
  1. package/dist/cli.js +8 -19
  2. package/dist/cli.js.map +1 -1
  3. package/package.json +4 -3
  4. package/templates/.cursor/agents/compliance/iso-22301-specialist.md +917 -0
  5. package/templates/.cursor/agents/compliance/iso-27001-specialist.md +641 -0
  6. package/templates/.cursor/agents/compliance/pmbok-specialist.md +669 -0
  7. package/templates/.cursor/agents/compliance/security-information-master.md +824 -0
  8. package/templates/.cursor/agents/compliance/soc2-specialist.md +818 -0
  9. package/templates/.cursor/agents/deployment/docker-specialist.md +1192 -0
  10. package/templates/.cursor/agents/meta/agent-creator-specialist.md +1135 -0
  11. package/templates/.cursor/agents/meta/command-creator-specialist.md +1519 -0
  12. package/templates/.cursor/agents/meta/metaspec-gate-keeper.md +240 -0
  13. package/templates/.cursor/agents/meta/onion.md +753 -0
  14. package/templates/.cursor/agents/research/research-agent.md +292 -0
  15. package/templates/.cursor/agents/review/corporate-compliance-specialist.md +370 -0
  16. package/templates/.cursor/commands/common/prompts/README.md +187 -0
  17. package/templates/.cursor/commands/common/prompts/clickup-patterns.md +144 -0
  18. package/templates/.cursor/commands/common/prompts/code-review-checklist.md +168 -0
  19. package/templates/.cursor/commands/common/prompts/git-workflow-patterns.md +235 -0
  20. package/templates/.cursor/commands/common/prompts/output-formats.md +240 -0
  21. package/templates/.cursor/commands/common/prompts/technical.md +172 -0
  22. package/templates/.cursor/commands/common/prompts/validation-rules.md +173 -0
  23. package/templates/.cursor/commands/common/templates/abstraction-template.md +400 -0
  24. package/templates/.cursor/commands/common/templates/agent-template.md +353 -0
  25. package/templates/.cursor/commands/common/templates/business_context_template.md +748 -0
  26. package/templates/.cursor/commands/common/templates/command-template.md +273 -0
  27. package/templates/.cursor/commands/common/templates/technical_context_template.md +526 -0
  28. package/templates/.cursor/commands/development/runflow-dev.md +465 -0
  29. package/templates/.cursor/commands/docs/build-compliance-docs.md +143 -0
  30. package/templates/.cursor/commands/git/README.md +606 -0
  31. package/templates/.cursor/commands/meta/all-tools.md +50 -0
  32. package/templates/.cursor/commands/meta/analyze-complex-problem.md +186 -0
  33. package/templates/.cursor/commands/meta/create-abstraction.md +859 -0
  34. package/templates/.cursor/commands/meta/create-agent-express.md +83 -0
  35. package/templates/.cursor/commands/meta/create-agent.md +210 -0
  36. package/templates/.cursor/commands/meta/create-command.md +203 -0
  37. package/templates/.cursor/commands/meta/create-knowledge-base.md +143 -0
  38. package/templates/.cursor/commands/meta/create-task-structure.md +150 -0
  39. package/templates/.cursor/commands/meta/setup-integration.md +257 -0
  40. package/templates/.cursor/commands/onion/setup.md +843 -0
  41. package/templates/.cursor/commands/onion.md +168 -0
  42. package/templates/.cursor/commands/product/README.md +230 -0
  43. package/templates/.cursor/commands/quick/analisys.md +17 -0
  44. package/templates/.cursor/commands/validate/collab/pair-testing.md +633 -0
  45. package/templates/.cursor/commands/validate/collab/three-amigos.md +505 -0
  46. package/templates/.cursor/commands/validate/qa-points/estimate.md +660 -0
  47. package/templates/.cursor/commands/validate/test-strategy/analyze.md +1134 -0
  48. package/templates/.cursor/commands/validate/test-strategy/create.md +392 -0
  49. package/templates/.cursor/commands/validate/workflow.md +360 -0
  50. package/templates/.cursor/commands/warm-up.md +91 -0
  51. package/templates/.cursor/docs/architecture/acoplamento-clickup-problema-analise.md +446 -0
  52. package/templates/.cursor/docs/architecture/desacoplamento-roadmap.md +360 -0
  53. package/templates/.cursor/docs/architecture/validacao-fase-1.md +219 -0
  54. package/templates/.cursor/docs/c4/c4-detection-rules.md +395 -0
  55. package/templates/.cursor/docs/c4/c4-documentation-templates.md +579 -0
  56. package/templates/.cursor/docs/c4/c4-mermaid-patterns.md +331 -0
  57. package/templates/.cursor/docs/c4/c4-templates.md +256 -0
  58. package/templates/.cursor/docs/clickup/clickup-acceptance-criteria-strategy.md +329 -0
  59. package/templates/.cursor/docs/clickup/clickup-auto-update-strategy.md +318 -0
  60. package/templates/.cursor/docs/clickup/clickup-comment-formatter.md +239 -0
  61. package/templates/.cursor/docs/clickup/clickup-description-fix.md +355 -0
  62. package/templates/.cursor/docs/clickup/clickup-dual-comment-strategy.md +505 -0
  63. package/templates/.cursor/docs/clickup/clickup-formatting.md +302 -0
  64. package/templates/.cursor/docs/clickup/separador-tamanho-otimizado.md +256 -0
  65. package/templates/.cursor/docs/engineer/pre-pr-acceptance-validation.md +256 -0
  66. package/templates/.cursor/docs/onion/ESPERANTO.md +278 -0
  67. package/templates/.cursor/docs/onion/agents-reference.md +832 -0
  68. package/templates/.cursor/docs/onion/clickup-integration.md +738 -0
  69. package/templates/.cursor/docs/onion/commands-guide.md +807 -0
  70. package/templates/.cursor/docs/onion/engineering-flows.md +865 -0
  71. package/templates/.cursor/docs/onion/getting-started.md +741 -0
  72. package/templates/.cursor/docs/onion/maintenance-checklist.md +388 -0
  73. package/templates/.cursor/docs/onion/naming-conventions.md +268 -0
  74. package/templates/.cursor/docs/onion/practical-examples.md +782 -0
  75. package/templates/.cursor/docs/product/story-points-integration.md +254 -0
  76. package/templates/.cursor/docs/product/story-points-validation.md +224 -0
  77. package/templates/.cursor/docs/reviews/task-manager-docs-review-2025-11-24.md +167 -0
  78. package/templates/.cursor/docs/strategies/clickup-comment-patterns.md +766 -0
  79. package/templates/.cursor/docs/strategies/clickup-integration-tests.md +599 -0
  80. package/templates/.cursor/docs/strategies/clickup-mcp-wrappers-tests.md +854 -0
  81. package/templates/.cursor/docs/strategies/clickup-regression-tests.md +589 -0
  82. package/templates/.cursor/docs/strategies/visual-patterns.md +308 -0
  83. package/templates/.cursor/docs/templates/README.md +624 -0
  84. package/templates/.cursor/docs/templates/adr-template.md +226 -0
  85. package/templates/.cursor/docs/templates/analysis-template.md +280 -0
  86. package/templates/.cursor/docs/templates/execution-plan-template.md +430 -0
  87. package/templates/.cursor/docs/templates/guide-template.md +367 -0
  88. package/templates/.cursor/docs/templates/phase-execution-prompt-template.md +504 -0
  89. package/templates/.cursor/docs/templates/reference-template.md +522 -0
  90. package/templates/.cursor/docs/templates/solution-template.md +390 -0
  91. package/templates/.cursor/docs/tools/README.md +325 -0
  92. package/templates/.cursor/docs/tools/agents.md +330 -0
  93. package/templates/.cursor/docs/tools/commands.md +606 -0
  94. package/templates/.cursor/docs/tools/cursor.md +498 -0
  95. package/templates/.cursor/docs/tools/mcps.md +858 -0
  96. package/templates/.cursor/docs/tools/rules.md +423 -0
  97. package/templates/.cursor/rules/language-and-documentation.mdc +371 -0
  98. package/templates/.cursor/rules/onion-patterns.mdc +197 -0
  99. package/templates/.cursor/rules/validation-rules.mdc +194 -0
  100. package/templates/.cursor/utils/clickup-mcp-wrappers.md +671 -0
  101. package/templates/.cursor/utils/date-time-standards.md +182 -0
  102. package/templates/.cursor/utils/task-manager/README.md +94 -0
  103. package/templates/.cursor/utils/task-manager/adapters/asana.md +377 -0
  104. package/templates/.cursor/utils/task-manager/adapters/clickup.md +467 -0
  105. package/templates/.cursor/utils/task-manager/adapters/linear.md +421 -0
  106. package/templates/.cursor/utils/task-manager/detector.md +290 -0
  107. package/templates/.cursor/utils/task-manager/factory.md +363 -0
  108. package/templates/.cursor/utils/task-manager/interface.md +248 -0
  109. package/templates/.cursor/utils/task-manager/types.md +409 -0
  110. package/templates/.cursor/validation/product-task-validation.md +344 -0
  111. package/templates/.onion/contexts/business/.context-config.yml +52 -0
  112. package/templates/.onion/contexts/business/README.md +222 -0
  113. package/templates/.onion/contexts/business/agents/branding-specialist.md +1030 -0
  114. package/templates/.onion/contexts/business/agents/clickup-specialist.md +397 -0
  115. package/templates/.onion/contexts/business/agents/extract-meeting-specialist.md +395 -0
  116. package/templates/.onion/contexts/business/agents/gamma-specialist.md +1169 -0
  117. package/templates/.onion/contexts/business/agents/meeting-consolidator.md +483 -0
  118. package/templates/.onion/contexts/business/agents/pain-price-specialist.md +509 -0
  119. package/templates/.onion/contexts/business/agents/presentation-orchestrator.md +1191 -0
  120. package/templates/.onion/contexts/business/agents/product-agent.md +202 -0
  121. package/templates/.onion/contexts/business/agents/story-points-specialist.md +539 -0
  122. package/templates/.onion/contexts/business/agents/storytelling-specialist.md +891 -0
  123. package/templates/.onion/contexts/business/agents/task-specialist.md +618 -0
  124. package/templates/.onion/contexts/business/agents/whisper-specialist.md +373 -0
  125. package/templates/.onion/contexts/business/commands/advanced/analyze-pain-price.md +709 -0
  126. package/templates/.onion/contexts/business/commands/advanced/branding.md +460 -0
  127. package/templates/.onion/contexts/business/commands/advanced/checklist-sync.md +241 -0
  128. package/templates/.onion/contexts/business/commands/advanced/presentation.md +189 -0
  129. package/templates/.onion/contexts/business/commands/advanced/transform-consolidated.md +592 -0
  130. package/templates/.onion/contexts/business/commands/help.md +212 -0
  131. package/templates/.onion/contexts/business/commands/intermediate/check.md +48 -0
  132. package/templates/.onion/contexts/business/commands/intermediate/collect.md +96 -0
  133. package/templates/.onion/contexts/business/commands/intermediate/consolidate-meetings.md +306 -0
  134. package/templates/.onion/contexts/business/commands/intermediate/convert-to-tasks.md +220 -0
  135. package/templates/.onion/contexts/business/commands/intermediate/extract-meeting.md +241 -0
  136. package/templates/.onion/contexts/business/commands/intermediate/feature.md +431 -0
  137. package/templates/.onion/contexts/business/commands/intermediate/light-arch.md +97 -0
  138. package/templates/.onion/contexts/business/commands/intermediate/task-check.md +340 -0
  139. package/templates/.onion/contexts/business/commands/intermediate/validate-task.md +294 -0
  140. package/templates/.onion/contexts/business/commands/intermediate/whisper.md +325 -0
  141. package/templates/.onion/contexts/business/commands/starter/estimate.md +519 -0
  142. package/templates/.onion/contexts/business/commands/starter/refine.md +186 -0
  143. package/templates/.onion/contexts/business/commands/starter/spec.md +107 -0
  144. package/templates/.onion/contexts/business/commands/starter/task.md +585 -0
  145. package/templates/.onion/contexts/business/commands/starter/warm-up.md +187 -0
  146. package/templates/.onion/contexts/technical/.context-config.yml +64 -0
  147. package/templates/.onion/contexts/technical/README.md +238 -0
  148. package/templates/.onion/contexts/technical/agents/branch-code-reviewer.md +200 -0
  149. package/templates/.onion/contexts/technical/agents/branch-doc-writer.md +162 -0
  150. package/templates/.onion/contexts/technical/agents/branch-metaspec-checker.md +68 -0
  151. package/templates/.onion/contexts/technical/agents/branch-test-planner.md +177 -0
  152. package/templates/.onion/contexts/technical/agents/c4-architecture-specialist.md +712 -0
  153. package/templates/.onion/contexts/technical/agents/c4-documentation-specialist.md +658 -0
  154. package/templates/.onion/contexts/technical/agents/code-reviewer.md +155 -0
  155. package/templates/.onion/contexts/technical/agents/cursor-specialist.md +249 -0
  156. package/templates/.onion/contexts/technical/agents/docs-reverse-engineer.md +418 -0
  157. package/templates/.onion/contexts/technical/agents/gitflow-specialist.md +1207 -0
  158. package/templates/.onion/contexts/technical/agents/linux-security-specialist.md +676 -0
  159. package/templates/.onion/contexts/technical/agents/mermaid-specialist.md +516 -0
  160. package/templates/.onion/contexts/technical/agents/nodejs-specialist.md +673 -0
  161. package/templates/.onion/contexts/technical/agents/nx-migration-specialist.md +867 -0
  162. package/templates/.onion/contexts/technical/agents/nx-monorepo-specialist.md +619 -0
  163. package/templates/.onion/contexts/technical/agents/postgres-specialist.md +1124 -0
  164. package/templates/.onion/contexts/technical/agents/react-developer.md +132 -0
  165. package/templates/.onion/contexts/technical/agents/runflow-specialist.md +278 -0
  166. package/templates/.onion/contexts/technical/agents/system-doc-orchestrator.md +1388 -0
  167. package/templates/.onion/contexts/technical/agents/test-agent.md +425 -0
  168. package/templates/.onion/contexts/technical/agents/test-engineer.md +295 -0
  169. package/templates/.onion/contexts/technical/agents/test-planner.md +118 -0
  170. package/templates/.onion/contexts/technical/agents/zen-engine-specialist.md +421 -0
  171. package/templates/.onion/contexts/technical/commands/advanced/bump.md +43 -0
  172. package/templates/.onion/contexts/technical/commands/advanced/consolidate-documents.md +424 -0
  173. package/templates/.onion/contexts/technical/commands/advanced/e2e.md +392 -0
  174. package/templates/.onion/contexts/technical/commands/advanced/feature-finish.md +90 -0
  175. package/templates/.onion/contexts/technical/commands/advanced/feature-publish.md +91 -0
  176. package/templates/.onion/contexts/technical/commands/advanced/feature-start.md +158 -0
  177. package/templates/.onion/contexts/technical/commands/advanced/hotfix-finish.md +98 -0
  178. package/templates/.onion/contexts/technical/commands/advanced/hotfix-start.md +94 -0
  179. package/templates/.onion/contexts/technical/commands/advanced/hotfix.md +186 -0
  180. package/templates/.onion/contexts/technical/commands/advanced/refine-vision.md +27 -0
  181. package/templates/.onion/contexts/technical/commands/advanced/release-finish.md +98 -0
  182. package/templates/.onion/contexts/technical/commands/advanced/release-start.md +95 -0
  183. package/templates/.onion/contexts/technical/commands/advanced/reverse-consolidate.md +160 -0
  184. package/templates/.onion/contexts/technical/commands/advanced/validate-phase-sync.md +118 -0
  185. package/templates/.onion/contexts/technical/commands/help.md +329 -0
  186. package/templates/.onion/contexts/technical/commands/intermediate/build-business-docs.md +276 -0
  187. package/templates/.onion/contexts/technical/commands/intermediate/build-index.md +128 -0
  188. package/templates/.onion/contexts/technical/commands/intermediate/build-tech-docs.md +204 -0
  189. package/templates/.onion/contexts/technical/commands/intermediate/code-review.md +215 -0
  190. package/templates/.onion/contexts/technical/commands/intermediate/docs-health.md +142 -0
  191. package/templates/.onion/contexts/technical/commands/intermediate/fast-commit.md +45 -0
  192. package/templates/.onion/contexts/technical/commands/intermediate/integration.md +523 -0
  193. package/templates/.onion/contexts/technical/commands/intermediate/pr-update.md +198 -0
  194. package/templates/.onion/contexts/technical/commands/intermediate/pre-pr.md +91 -0
  195. package/templates/.onion/contexts/technical/commands/intermediate/start.md +266 -0
  196. package/templates/.onion/contexts/technical/commands/intermediate/sync-sessions.md +320 -0
  197. package/templates/.onion/contexts/technical/commands/intermediate/unit.md +378 -0
  198. package/templates/.onion/contexts/technical/commands/intermediate/validate-docs.md +159 -0
  199. package/templates/.onion/contexts/technical/commands/starter/docs.md +39 -0
  200. package/templates/.onion/contexts/technical/commands/starter/help.md +306 -0
  201. package/templates/.onion/contexts/technical/commands/starter/init.md +139 -0
  202. package/templates/.onion/contexts/technical/commands/starter/plan.md +111 -0
  203. package/templates/.onion/contexts/technical/commands/starter/pr.md +136 -0
  204. package/templates/.onion/contexts/technical/commands/starter/sync.md +228 -0
  205. package/templates/.onion/contexts/technical/commands/starter/warm-up.md +173 -0
  206. package/templates/.onion/contexts/technical/commands/starter/work.md +169 -0
  207. package/templates/.onion/core/commands/help.md +388 -0
@@ -0,0 +1,782 @@
1
+ # 💡 Exemplos Práticos - Sistema Onion
2
+
3
+ ## 📋 Índice
4
+
5
+ - [Exemplo 1: Nova Feature do Zero](#-exemplo-1-nova-feature-do-zero)
6
+ - [Exemplo 2: Hotfix Urgente](#-exemplo-2-hotfix-urgente)
7
+ - [Exemplo 3: Release e Deploy](#-exemplo-3-release-e-deploy)
8
+ - [Exemplo 4: Gerar Documentação](#-exemplo-4-gerar-documentação)
9
+ - [Exemplo 5: Integração ClickUp Completa](#-exemplo-5-integração-clickup-completa)
10
+ - [Anti-Patterns](#-anti-patterns-o-que-não-fazer)
11
+ - [Troubleshooting Comum](#-troubleshooting-comum)
12
+
13
+ ---
14
+
15
+ ## 🚀 Exemplo 1: Nova Feature do Zero
16
+
17
+ ### Cenário
18
+ Você precisa implementar um sistema completo de autenticação JWT com refresh tokens.
19
+
20
+ ### Workflow Completo
21
+
22
+ #### Passo 1: Criar Task Estruturada
23
+ ```bash
24
+ /product/task "Implementar autenticação JWT com refresh tokens e logout seguro"
25
+ ```
26
+
27
+ **O que acontece:**
28
+ 1. Sistema analisa README.md e docs/
29
+ 2. Identifica como feature de segurança (complexidade média)
30
+ 3. Apresenta plano para confirmação:
31
+
32
+ ```markdown
33
+ ## 🎯 PLANO DE TASK PROPOSTO
34
+
35
+ ### **📋 Task Principal**
36
+ **Nome**: 🎯 Implementar Autenticação JWT
37
+ **Tipo**: Feature
38
+ **Complexidade**: Média
39
+ **Estimativa**: 13-17 horas
40
+
41
+ ### **🏗️ Decomposição**
42
+ 📋 Task Principal
43
+ ├── 🔧 Backend JWT Service (4-6h)
44
+ │ ├── ✅ Implementar geração de JWT
45
+ │ ├── ✅ Implementar validação de tokens
46
+ │ └── ✅ Implementar refresh mechanism
47
+ ├── 🔧 API Integration (3-4h)
48
+ │ ├── ✅ Middleware de autenticação
49
+ │ ├── ✅ Protected routes
50
+ │ └── ✅ Error handling
51
+ ├── 🔧 Frontend Integration (3-4h)
52
+ │ ├── ✅ Login component
53
+ │ ├── ✅ Token storage
54
+ │ └── ✅ Auto-refresh
55
+ └── 🔧 Testing & Security (3-4h)
56
+ ├── ✅ Unit tests
57
+ ├── ✅ Integration tests
58
+ └── ✅ Security audit
59
+
60
+ ❓ **Este plano está correto? Posso proceder?** [Y/n]
61
+ ```
62
+
63
+ 4. Após confirmação (`y`):
64
+ - Cria task no ClickUp (ID: `86xyz123`)
65
+ - Cria 4 subtasks com parent relationship
66
+ - Executa `/git/feature/start jwt-authentication`
67
+ - Cria sessão `.cursor/sessions/jwt-authentication/`
68
+ - Gera context files
69
+
70
+ **Saída:**
71
+ ```
72
+ ✅ TASK CRIADA COM DECOMPOSIÇÃO INTELIGENTE
73
+
74
+ 📋 ClickUp: https://app.clickup.com/t/86xyz123
75
+ 🌿 Branch: feature/jwt-authentication
76
+ 📁 Sessão: .cursor/sessions/jwt-authentication/
77
+ ```
78
+
79
+ ---
80
+
81
+ #### Passo 2: Iniciar Desenvolvimento
82
+ ```bash
83
+ /engineer/start jwt-authentication
84
+ ```
85
+
86
+ **O que acontece:**
87
+ 1. Valida branch (já criada pelo `/product/task`)
88
+ 2. Lê task do ClickUp com subtasks
89
+ 3. Faz 5-7 questões de clarificação:
90
+
91
+ ```markdown
92
+ ## 🔍 Questões de Clarificação
93
+
94
+ 1. **Algoritmo JWT**: Prefere RS256 (assimétrico) ou HS256 (simétrico)?
95
+ - Sugestão: RS256 para melhor segurança
96
+
97
+ 2. **Storage de Refresh Tokens**: Redis ou PostgreSQL?
98
+ - Sugestão: Redis para performance
99
+
100
+ 3. **Expiração**: Qual TTL para access e refresh tokens?
101
+ - Sugestão: 15min (access), 7 dias (refresh)
102
+
103
+ 4. **Logout**: Blacklist de tokens ou invalidação de refresh?
104
+ - Sugestão: Invalidação de refresh (mais simples)
105
+
106
+ 5. **Rate Limiting**: Implementar em endpoints de auth?
107
+ - Sugestão: Sim, 5 tentativas por minuto
108
+
109
+ ❓ **Concordas com estas sugestões?** [Y/n]
110
+ ```
111
+
112
+ 4. Após confirmação, cria arquitetura:
113
+
114
+ **`architecture.md`:**
115
+ ```markdown
116
+ # Arquitetura - Autenticação JWT
117
+
118
+ ## Componentes
119
+
120
+ ### JWT Service
121
+ - Geração de access tokens (RS256)
122
+ - Validação de tokens
123
+ - Refresh mechanism
124
+
125
+ ### Auth Middleware
126
+ - Validação de tokens em requests
127
+ - Error handling
128
+ - Rate limiting
129
+
130
+ ### Token Storage
131
+ - Redis para refresh tokens
132
+ - TTL automático
133
+ - Blacklist opcional
134
+
135
+ ## Decisões Técnicas
136
+
137
+ ### RS256 vs HS256
138
+ **Escolhido**: RS256
139
+ **Razão**: Melhor segurança, permite validação sem secret
140
+
141
+ ### Redis vs PostgreSQL
142
+ **Escolhido**: Redis
143
+ **Razão**: Performance, TTL nativo, uso temporário
144
+
145
+ ## Trade-offs
146
+
147
+ ### Positivos
148
+ - ✅ Stateless authentication
149
+ - ✅ Escalabilidade
150
+ - ✅ Performance
151
+
152
+ ### Negativos
153
+ - ⚠️ Complexidade inicial
154
+ - ⚠️ Dependência de Redis
155
+ ```
156
+
157
+ 5. Gera plano de implementação:
158
+
159
+ **`plan.md`:**
160
+ ```markdown
161
+ # Plano - Autenticação JWT
162
+
163
+ ## Fase 1: Backend JWT Service (4-6h) ⏳ IN PROGRESS
164
+ - [ ] Instalar dependências (jsonwebtoken, bcrypt)
165
+ - [ ] Criar JWTService class
166
+ - [ ] Implementar generateToken()
167
+ - [ ] Implementar validateToken()
168
+ - [ ] Implementar refreshToken()
169
+ - [ ] Unit tests
170
+
171
+ ## Fase 2: API Integration (3-4h)
172
+ - [ ] Criar auth middleware
173
+ - [ ] Proteger routes
174
+ - [ ] Implementar error handling
175
+ - [ ] Rate limiting
176
+ - [ ] Integration tests
177
+
178
+ ## Fase 3: Frontend Integration (3-4h)
179
+ - [ ] Login component
180
+ - [ ] Token storage (localStorage)
181
+ - [ ] Axios interceptors
182
+ - [ ] Auto-refresh logic
183
+ - [ ] E2E tests
184
+
185
+ ## Fase 4: Testing & Security (3-4h)
186
+ - [ ] Security audit
187
+ - [ ] Penetration testing
188
+ - [ ] Performance testing
189
+ - [ ] Documentation
190
+ ```
191
+
192
+ 6. Atualiza ClickUp:
193
+ - Status → "In Progress"
194
+ - Comentário de início
195
+ - Cria mapeamento fase→subtask
196
+
197
+ ---
198
+
199
+ #### Passo 3: Implementar Fases
200
+ ```bash
201
+ /engineer/work jwt-authentication
202
+ ```
203
+
204
+ **Ciclo de Implementação:**
205
+
206
+ **Fase 1: Backend JWT Service**
207
+ ```typescript
208
+ // Sistema implementa código
209
+ // src/services/jwt.service.ts
210
+ import jwt from 'jsonwebtoken';
211
+ import { readFileSync } from 'fs';
212
+
213
+ export class JWTService {
214
+ private privateKey: string;
215
+ private publicKey: string;
216
+
217
+ constructor() {
218
+ this.privateKey = readFileSync('keys/private.pem', 'utf8');
219
+ this.publicKey = readFileSync('keys/public.pem', 'utf8');
220
+ }
221
+
222
+ generateToken(payload: any): string {
223
+ return jwt.sign(payload, this.privateKey, {
224
+ algorithm: 'RS256',
225
+ expiresIn: '15m'
226
+ });
227
+ }
228
+
229
+ validateToken(token: string): any {
230
+ return jwt.verify(token, this.publicKey, {
231
+ algorithms: ['RS256']
232
+ });
233
+ }
234
+
235
+ // ... mais código
236
+ }
237
+ ```
238
+
239
+ **Após completar Fase 1:**
240
+ 1. Sistema pausa e pede validação ao usuário
241
+ 2. Usuário revisa e aprova (`y`)
242
+ 3. Sistema automaticamente:
243
+ - Atualiza subtask "Backend JWT Service" → "done"
244
+ - Adiciona comentário no ClickUp:
245
+
246
+ ```
247
+ 🔧 PROGRESSO DE DESENVOLVIMENTO
248
+
249
+ ━━━━━━━━━━━━━━━━━━━━━━━━
250
+
251
+ 📋 FASE COMPLETADA:
252
+ ▶ Fase 1: Backend JWT Service
253
+ ▶ Arquivos modificados: 8 arquivos
254
+ ▶ Funcionalidades: Token generation, validation, refresh
255
+ ▶ Testes: 15 unit tests ✅
256
+
257
+ ✅ DECISÕES TÉCNICAS:
258
+ ∟ Usamos RS256 (assimétrico)
259
+ ∟ Tokens em Redis com TTL
260
+ ∟ Rate limiting implementado
261
+ ∟ Logging de eventos
262
+
263
+ 🚀 PRÓXIMA FASE:
264
+ ▶ Fase 2: API Integration
265
+ ▶ Estimativa: 3-4 horas
266
+
267
+ 📊 PROGRESSO GERAL: 25% completo (1/4 fases)
268
+
269
+ ━━━━━━━━━━━━━━━━━━━━━━━━
270
+
271
+ ⏰ 2025-01-27 15:45 | 🎯 Próximo: Integrar com API
272
+ ```
273
+
274
+ 4. Atualiza `plan.md`:
275
+
276
+ ```markdown
277
+ ## Fase 1: Backend JWT Service (4-6h) ✅ COMPLETED
278
+ - [x] Instalar dependências
279
+ - [x] Criar JWTService class
280
+ - [x] Implementar generateToken()
281
+ - [x] Implementar validateToken()
282
+ - [x] Implementar refreshToken()
283
+ - [x] Unit tests (15 tests)
284
+
285
+ **Decisões:**
286
+ - Usamos RS256 para melhor segurança
287
+ - Redis para storage com TTL automático
288
+ - Rate limiting: 5 req/min
289
+
290
+ **Próxima Fase:** API Integration
291
+ ```
292
+
293
+ **Repete para Fases 2, 3 e 4...**
294
+
295
+ ---
296
+
297
+ #### Passo 4: Criar Pull Request
298
+ ```bash
299
+ /engineer/pr
300
+ ```
301
+
302
+ **O que acontece:**
303
+ 1. Valida que todos os testes passam
304
+ 2. Commit e push das mudanças
305
+ 3. Atualiza ClickUp:
306
+ - Status → "in progress"
307
+ - Tag → "under-review"
308
+ - Comentário com PR link
309
+ 4. Abre PR no GitHub/GitLab
310
+ 5. Aguarda code review
311
+ 6. Aplica correções (se necessário)
312
+
313
+ ---
314
+
315
+ #### Passo 5: Pós-Merge
316
+ ```bash
317
+ # Automático após merge
318
+ /git/sync
319
+ ```
320
+
321
+ **O que acontece:**
322
+ 1. GitFlow analysis
323
+ 2. Cleanup de branches
324
+ 3. Session archiving
325
+ 4. Atualiza ClickUp → "Done"
326
+ 5. Sincroniza branches locais
327
+
328
+ ---
329
+
330
+ ### Resultado Final
331
+ - ✅ Feature completa implementada
332
+ - ✅ 4 subtasks concluídas
333
+ - ✅ Documentação gerada
334
+ - ✅ Testes passando
335
+ - ✅ ClickUp sincronizado
336
+ - ✅ Branch merged e limpa
337
+
338
+ ---
339
+
340
+ ## 🔥 Exemplo 2: Hotfix Urgente
341
+
342
+ ### Cenário
343
+ Bug crítico em produção: timeout na API de pagamentos causando perda de transações.
344
+
345
+ ### Workflow Rápido
346
+
347
+ #### Passo 1: Criar Hotfix
348
+ ```bash
349
+ /git/hotfix/start "fix-payment-timeout"
350
+ ```
351
+
352
+ **Saída:**
353
+ ```
354
+ 🔥 HOTFIX BRANCH CRIADA
355
+
356
+ Branch: hotfix/fix-payment-timeout
357
+ Base: main (produção)
358
+ Sessão: .cursor/sessions/fix-payment-timeout/
359
+ ```
360
+
361
+ ---
362
+
363
+ #### Passo 2: Análise e Implementação
364
+ ```bash
365
+ /engineer/hotfix "fix-payment-timeout"
366
+ ```
367
+
368
+ **Análise Rápida:**
369
+ ```markdown
370
+ ## 🐛 Análise do Bug
371
+
372
+ ### Sintomas
373
+ - Timeout após 30s em /api/payments
374
+ - 15% das transações falhando
375
+ - Logs mostram query lenta
376
+
377
+ ### Root Cause
378
+ - Query N+1 em relacionamentos
379
+ - Falta de índice em payments.user_id
380
+ - Connection pool saturado
381
+
382
+ ### Fix
383
+ 1. Adicionar índice
384
+ 2. Otimizar query (eager loading)
385
+ 3. Aumentar connection pool
386
+ ```
387
+
388
+ **Implementação:**
389
+ ```sql
390
+ -- migrations/add_payment_index.sql
391
+ CREATE INDEX idx_payments_user_id ON payments(user_id);
392
+ ```
393
+
394
+ ```typescript
395
+ // src/services/payment.service.ts
396
+ // ANTES (N+1 problem)
397
+ const payments = await Payment.findAll();
398
+ for (const payment of payments) {
399
+ const user = await payment.getUser(); // N+1!
400
+ }
401
+
402
+ // DEPOIS (eager loading)
403
+ const payments = await Payment.findAll({
404
+ include: [{ model: User }] // ✅ Single query
405
+ });
406
+ ```
407
+
408
+ ---
409
+
410
+ #### Passo 3: Testes Rápidos
411
+ ```bash
412
+ # Testes de regressão
413
+ npm test -- payment.service.spec.ts
414
+
415
+ # Performance test
416
+ artillery quick --count 100 --num 10 http://localhost:3000/api/payments
417
+ ```
418
+
419
+ ---
420
+
421
+ #### Passo 4: PR Urgente
422
+ ```bash
423
+ /engineer/pr
424
+ ```
425
+
426
+ **Code Review Acelerado:**
427
+ - ✅ Testes passam
428
+ - ✅ Performance melhorou 10x
429
+ - ✅ Sem breaking changes
430
+
431
+ ---
432
+
433
+ #### Passo 5: Merge e Deploy
434
+ ```bash
435
+ # Após aprovação
436
+ /git/hotfix/finish
437
+ ```
438
+
439
+ **O que acontece:**
440
+ 1. Merge para `main` (produção)
441
+ 2. Merge para `develop` (desenvolvimento)
442
+ 3. Tag `hotfix/fix-payment-timeout`
443
+ 4. Deploy automático para produção
444
+ 5. Notificação da equipe
445
+
446
+ ---
447
+
448
+ ### Resultado
449
+ - ⏱️ **Tempo total:** 2 horas (análise + fix + deploy)
450
+ - ✅ **Bug resolvido** em produção
451
+ - ✅ **Zero downtime**
452
+ - ✅ **Documentado** para postmortem
453
+
454
+ ---
455
+
456
+ ## 📦 Exemplo 3: Release e Deploy
457
+
458
+ ### Cenário
459
+ Preparar release v1.2.0 com 15 features e 8 bugfixes.
460
+
461
+ ### Workflow
462
+
463
+ #### Passo 1: Criar Release Branch
464
+ ```bash
465
+ /git/release/start "v1.2.0"
466
+ ```
467
+
468
+ ---
469
+
470
+ #### Passo 2: Ajustes Finais
471
+ ```bash
472
+ # Atualizar CHANGELOG
473
+ # Atualizar versão
474
+ /engineer/bump minor
475
+
476
+ # Testes finais
477
+ npm run test:e2e
478
+ npm run test:integration
479
+ ```
480
+
481
+ ---
482
+
483
+ #### Passo 3: PR e Aprovação
484
+ ```bash
485
+ /engineer/pr
486
+ ```
487
+
488
+ **Checklist de Release:**
489
+ - ✅ Todos os testes passam
490
+ - ✅ CHANGELOG atualizado
491
+ - ✅ Versão atualizada
492
+ - ✅ Documentação atualizada
493
+ - ✅ Breaking changes documentadas
494
+
495
+ ---
496
+
497
+ #### Passo 4: Merge e Tag
498
+ ```bash
499
+ /git/release/finish
500
+ ```
501
+
502
+ **O que acontece:**
503
+ 1. Merge para `main`
504
+ 2. Merge para `develop`
505
+ 3. Tag `v1.2.0`
506
+ 4. Deploy para produção
507
+ 5. Release notes geradas
508
+
509
+ ---
510
+
511
+ ## 📚 Exemplo 4: Gerar Documentação
512
+
513
+ ### Cenário
514
+ Projeto novo precisa de documentação completa.
515
+
516
+ ### Workflow
517
+
518
+ #### Passo 1: Documentação de Negócio
519
+ ```bash
520
+ /docs/build-business-docs
521
+ ```
522
+
523
+ **Saída:**
524
+ ```
525
+ docs/business-context/
526
+ ├── vision.md # Visão do produto
527
+ ├── stakeholders.md # Stakeholders e papéis
528
+ └── business-model.md # Modelo de negócio
529
+ ```
530
+
531
+ ---
532
+
533
+ #### Passo 2: Documentação Técnica
534
+ ```bash
535
+ /docs/build-tech-docs
536
+ ```
537
+
538
+ **Saída:**
539
+ ```
540
+ docs/technical-context/
541
+ ├── architecture.md # Arquitetura do sistema
542
+ ├── technology-stack.md # Stack tecnológico
543
+ └── constraints.md # Restrições técnicas
544
+ ```
545
+
546
+ ---
547
+
548
+ #### Passo 3: Índice Navegável
549
+ ```bash
550
+ /docs/build-index
551
+ ```
552
+
553
+ **Saída:** `docs/index.md` com links para toda documentação
554
+
555
+ ---
556
+
557
+ #### Passo 4: Validação
558
+ ```bash
559
+ /docs/validate-docs
560
+ /docs/docs-health
561
+ ```
562
+
563
+ **Validações:**
564
+ - ✅ Links funcionam
565
+ - ✅ Estrutura completa
566
+ - ✅ Sem seções vazias
567
+ - ✅ Formatação consistente
568
+
569
+ ---
570
+
571
+ ## 🔗 Exemplo 5: Integração ClickUp Completa
572
+
573
+ ### Cenário
574
+ Usar ClickUp MCP para gerenciar todo o ciclo de vida de uma feature.
575
+
576
+ ### Workflow Detalhado
577
+
578
+ #### Passo 1: Criar Task com Decomposição
579
+ ```bash
580
+ /product/task "Sistema de notificações push com preferências de usuário"
581
+ ```
582
+
583
+ **ClickUp Structure Criada:**
584
+ ```
585
+ 📋 Sistema de Notificações Push (86abc789)
586
+ ├── 🔧 Backend Push Service (86abc790)
587
+ │ └── Checklists Nativos:
588
+ │ ✅ Implementar FCM integration
589
+ │ ✅ Criar notification queue
590
+ │ ✅ Implementar retry logic
591
+ ├── 🔧 User Preferences API (86abc791)
592
+ │ └── Checklists Nativos:
593
+ │ ✅ CRUD de preferências
594
+ │ ✅ Validação de regras
595
+ │ ✅ Testes de API
596
+ └── 🔧 Frontend Integration (86abc792)
597
+ └── Checklists Nativos:
598
+ ✅ Settings UI
599
+ ✅ Push permission
600
+ ✅ Notification display
601
+ ```
602
+
603
+ ---
604
+
605
+ #### Passo 2: Monitorar Progresso
606
+ ```bash
607
+ # Durante desenvolvimento
608
+ /engineer/work notificacoes-push
609
+
610
+ # Sistema automaticamente:
611
+ # - Lê checklists nativos
612
+ # - Calcula progresso (3/9 items = 33%)
613
+ # - Atualiza ClickUp em tempo real
614
+ ```
615
+
616
+ ---
617
+
618
+ #### Passo 3: Sincronização Automática
619
+ ```javascript
620
+ // Sistema monitora checklists nativos
621
+ const task = await mcp_clickup_get_task({
622
+ task_id: "86abc789",
623
+ subtasks: true
624
+ });
625
+
626
+ // Calcula progresso
627
+ let totalItems = 0;
628
+ let resolvedItems = 0;
629
+
630
+ task.subtasks.forEach(subtask => {
631
+ subtask.checklists.forEach(checklist => {
632
+ totalItems += checklist.unresolved + checklist.resolved;
633
+ resolvedItems += checklist.resolved;
634
+ });
635
+ });
636
+
637
+ const progress = (resolvedItems / totalItems * 100).toFixed(1);
638
+ console.log(`Progresso: ${progress}%`); // 33.3%
639
+ ```
640
+
641
+ ---
642
+
643
+ #### Passo 4: Validação de Conclusão
644
+ ```bash
645
+ /product/task-check 86abc789
646
+ ```
647
+
648
+ **Validações:**
649
+ - ✅ Todos os checklists resolvidos
650
+ - ✅ Critérios de aceitação atendidos
651
+ - ✅ Testes passando
652
+ - ✅ Documentação completa
653
+
654
+ ---
655
+
656
+ ## ❌ Anti-Patterns: O Que NÃO Fazer
657
+
658
+ ### Anti-Pattern 1: Pular Análise
659
+ ```bash
660
+ # ❌ ERRADO
661
+ /engineer/work feature-x # Sem /engineer/start antes!
662
+
663
+ # ✅ CORRETO
664
+ /engineer/start feature-x # Análise primeiro
665
+ /engineer/work feature-x # Depois implementação
666
+ ```
667
+
668
+ ---
669
+
670
+ ### Anti-Pattern 2: Não Usar Hierarquia ClickUp
671
+ ```javascript
672
+ // ❌ ERRADO - Subtasks independentes
673
+ await create_bulk_tasks({
674
+ tasks: [
675
+ { name: "Subtask 1" },
676
+ { name: "Subtask 2" }
677
+ ]
678
+ });
679
+
680
+ // ✅ CORRETO - Hierarquia apropriada
681
+ const main = await create_task({ name: "Main" });
682
+ await create_task({ name: "Sub 1", parent: main.id });
683
+ await create_task({ name: "Sub 2", parent: main.id });
684
+ ```
685
+
686
+ ---
687
+
688
+ ### Anti-Pattern 3: Commits Grandes
689
+ ```bash
690
+ # ❌ ERRADO
691
+ git add .
692
+ git commit -m "Implementei tudo"
693
+
694
+ # ✅ CORRETO
695
+ git add src/services/jwt.service.ts
696
+ git commit -m "feat: implement JWT generation"
697
+
698
+ git add src/middleware/auth.middleware.ts
699
+ git commit -m "feat: add auth middleware"
700
+ ```
701
+
702
+ ---
703
+
704
+ ### Anti-Pattern 4: Pular Testes
705
+ ```bash
706
+ # ❌ ERRADO
707
+ /engineer/pr # Sem rodar testes!
708
+
709
+ # ✅ CORRETO
710
+ npm test
711
+ /engineer/pre-pr # Validações
712
+ /engineer/pr # Depois PR
713
+ ```
714
+
715
+ ---
716
+
717
+ ## 🔧 Troubleshooting Comum
718
+
719
+ ### Problema 1: Branch já existe
720
+ ```bash
721
+ # Sintoma
722
+ Error: Branch feature/x already exists
723
+
724
+ # Solução
725
+ git checkout feature/x # Usar existente
726
+ # OU
727
+ git branch -D feature/x # Deletar e recriar
728
+ /git/feature/start "x"
729
+ ```
730
+
731
+ ---
732
+
733
+ ### Problema 2: ClickUp não atualiza
734
+ ```bash
735
+ # Diagnóstico
736
+ cat .cursor/sessions/<feature-slug>/context.md | grep "Task ID"
737
+
738
+ # Se task-id incorreto, corrigir manualmente
739
+ # Se correto, validar conexão MCP
740
+ ```
741
+
742
+ ---
743
+
744
+ ### Problema 3: Sessão não encontrada
745
+ ```bash
746
+ # Sintoma
747
+ /engineer/work x
748
+ Error: Session not found
749
+
750
+ # Solução
751
+ /engineer/start x # Criar sessão
752
+ ```
753
+
754
+ ---
755
+
756
+ ### Problema 4: Testes falhando
757
+ ```bash
758
+ # Diagnóstico
759
+ npm test -- --verbose
760
+
761
+ # Correção
762
+ # 1. Corrigir testes
763
+ # 2. Rodar novamente
764
+ # 3. Só então fazer PR
765
+ ```
766
+
767
+ ---
768
+
769
+ ## 🔗 Documentos Relacionados
770
+
771
+ - [Guia de Comandos](./commands-guide.md) - Todos os comandos
772
+ - [Fluxos de Engenharia](./engineering-flows.md) - Workflows detalhados
773
+ - [Integração ClickUp](./clickup-integration.md) - ClickUp MCP
774
+ - [Referência de Agentes](./agents-reference.md) - Agentes disponíveis
775
+ - [Configuração Inicial](./getting-started.md) - Setup do sistema
776
+
777
+ ---
778
+
779
+ **Última atualização:** 2025-01-27
780
+ **Versão:** 2.0
781
+ **Exemplos:** 5 completos + anti-patterns + troubleshooting
782
+