@onion-ai/cli 1.0.0-beta.1

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 (220) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +529 -0
  3. package/bin/onion.js +6 -0
  4. package/framework/CLAUDE.md +45 -0
  5. package/framework/VERSION +1 -0
  6. package/framework/agents/compliance/iso-22301-specialist.md +985 -0
  7. package/framework/agents/compliance/iso-27001-specialist.md +713 -0
  8. package/framework/agents/compliance/pmbok-specialist.md +739 -0
  9. package/framework/agents/compliance/security-information-master.md +907 -0
  10. package/framework/agents/compliance/soc2-specialist.md +889 -0
  11. package/framework/agents/deployment/docker-specialist.md +1192 -0
  12. package/framework/agents/development/c4-architecture-specialist.md +745 -0
  13. package/framework/agents/development/c4-documentation-specialist.md +695 -0
  14. package/framework/agents/development/clickup-specialist.md +396 -0
  15. package/framework/agents/development/cursor-specialist.md +277 -0
  16. package/framework/agents/development/docs-reverse-engineer.md +417 -0
  17. package/framework/agents/development/gamma-api-specialist.md +1168 -0
  18. package/framework/agents/development/gitflow-specialist.md +1206 -0
  19. package/framework/agents/development/linux-security-specialist.md +675 -0
  20. package/framework/agents/development/mermaid-specialist.md +515 -0
  21. package/framework/agents/development/nodejs-specialist.md +672 -0
  22. package/framework/agents/development/nx-migration-specialist.md +866 -0
  23. package/framework/agents/development/nx-monorepo-specialist.md +618 -0
  24. package/framework/agents/development/postgres-specialist.md +1123 -0
  25. package/framework/agents/development/react-developer.md +131 -0
  26. package/framework/agents/development/runflow-specialist.md +277 -0
  27. package/framework/agents/development/system-documentation-orchestrator.md +1387 -0
  28. package/framework/agents/development/task-specialist.md +677 -0
  29. package/framework/agents/git/branch-code-reviewer.md +225 -0
  30. package/framework/agents/git/branch-documentation-writer.md +161 -0
  31. package/framework/agents/git/branch-metaspec-checker.md +67 -0
  32. package/framework/agents/git/branch-test-planner.md +176 -0
  33. package/framework/agents/meta/agent-creator-specialist.md +1266 -0
  34. package/framework/agents/meta/command-creator-specialist.md +1676 -0
  35. package/framework/agents/meta/metaspec-gate-keeper.md +240 -0
  36. package/framework/agents/meta/onion.md +824 -0
  37. package/framework/agents/product/branding-positioning-specialist.md +1029 -0
  38. package/framework/agents/product/extract-meeting-specialist.md +394 -0
  39. package/framework/agents/product/meeting-consolidator.md +482 -0
  40. package/framework/agents/product/pain-price-specialist.md +508 -0
  41. package/framework/agents/product/presentation-orchestrator.md +1190 -0
  42. package/framework/agents/product/product-agent.md +201 -0
  43. package/framework/agents/product/story-points-framework-specialist.md +538 -0
  44. package/framework/agents/product/storytelling-business-specialist.md +890 -0
  45. package/framework/agents/research/research-agent.md +292 -0
  46. package/framework/agents/review/code-reviewer.md +154 -0
  47. package/framework/agents/review/corporate-compliance-specialist.md +370 -0
  48. package/framework/agents/testing/test-agent.md +424 -0
  49. package/framework/agents/testing/test-engineer.md +294 -0
  50. package/framework/agents/testing/test-planner.md +117 -0
  51. package/framework/commands/common/prompts/README.md +208 -0
  52. package/framework/commands/common/prompts/clickup-patterns.md +144 -0
  53. package/framework/commands/common/prompts/code-review-checklist.md +168 -0
  54. package/framework/commands/common/prompts/git-workflow-patterns.md +235 -0
  55. package/framework/commands/common/prompts/output-formats.md +240 -0
  56. package/framework/commands/common/prompts/technical.md +194 -0
  57. package/framework/commands/common/templates/abstraction-template.md +399 -0
  58. package/framework/commands/common/templates/agent-template.md +353 -0
  59. package/framework/commands/common/templates/business_context_template.md +748 -0
  60. package/framework/commands/common/templates/command-template.md +273 -0
  61. package/framework/commands/common/templates/technical_context_template.md +526 -0
  62. package/framework/commands/design/screen-spec.md +505 -0
  63. package/framework/commands/development/runflow-dev.md +465 -0
  64. package/framework/commands/docs/build-business-docs.md +299 -0
  65. package/framework/commands/docs/build-compliance-docs.md +143 -0
  66. package/framework/commands/docs/build-index.md +119 -0
  67. package/framework/commands/docs/build-tech-docs.md +221 -0
  68. package/framework/commands/docs/docs-health.md +141 -0
  69. package/framework/commands/docs/help.md +278 -0
  70. package/framework/commands/docs/refine-vision.md +25 -0
  71. package/framework/commands/docs/reverse-consolidate.md +158 -0
  72. package/framework/commands/docs/sync-sessions.md +354 -0
  73. package/framework/commands/docs/validate-docs.md +157 -0
  74. package/framework/commands/engineer/bump.md +29 -0
  75. package/framework/commands/engineer/docs.md +11 -0
  76. package/framework/commands/engineer/hotfix.md +183 -0
  77. package/framework/commands/engineer/plan.md +85 -0
  78. package/framework/commands/engineer/pr-update.md +219 -0
  79. package/framework/commands/engineer/pr.md +117 -0
  80. package/framework/commands/engineer/pre-pr.md +81 -0
  81. package/framework/commands/engineer/start.md +254 -0
  82. package/framework/commands/engineer/validate-phase-sync.md +134 -0
  83. package/framework/commands/engineer/warm-up.md +20 -0
  84. package/framework/commands/engineer/work.md +155 -0
  85. package/framework/commands/f/company-context-extractor.md +93 -0
  86. package/framework/commands/f/process-meetings.md +103 -0
  87. package/framework/commands/git/README.md +682 -0
  88. package/framework/commands/git/code-review.md +213 -0
  89. package/framework/commands/git/fast-commit.md +43 -0
  90. package/framework/commands/git/feature/finish.md +88 -0
  91. package/framework/commands/git/feature/publish.md +89 -0
  92. package/framework/commands/git/feature/start.md +172 -0
  93. package/framework/commands/git/help.md +100 -0
  94. package/framework/commands/git/hotfix/finish.md +96 -0
  95. package/framework/commands/git/hotfix/start.md +92 -0
  96. package/framework/commands/git/init.md +111 -0
  97. package/framework/commands/git/release/finish.md +96 -0
  98. package/framework/commands/git/release/start.md +93 -0
  99. package/framework/commands/git/sync.md +199 -0
  100. package/framework/commands/meta/all-tools.md +58 -0
  101. package/framework/commands/meta/analyze-complex-problem.md +186 -0
  102. package/framework/commands/meta/create-abstraction.md +882 -0
  103. package/framework/commands/meta/create-agent-express.md +98 -0
  104. package/framework/commands/meta/create-agent.md +210 -0
  105. package/framework/commands/meta/create-command.md +203 -0
  106. package/framework/commands/meta/create-knowledge-base.md +143 -0
  107. package/framework/commands/meta/create-task-structure.md +150 -0
  108. package/framework/commands/meta/setup-integration.md +274 -0
  109. package/framework/commands/onion.md +169 -0
  110. package/framework/commands/product/README.md +249 -0
  111. package/framework/commands/product/analyze-pain-price.md +694 -0
  112. package/framework/commands/product/branding.md +458 -0
  113. package/framework/commands/product/check.md +46 -0
  114. package/framework/commands/product/checklist-sync.md +239 -0
  115. package/framework/commands/product/collect.md +95 -0
  116. package/framework/commands/product/consolidate-meetings.md +291 -0
  117. package/framework/commands/product/estimate.md +511 -0
  118. package/framework/commands/product/extract-meeting.md +226 -0
  119. package/framework/commands/product/feature.md +416 -0
  120. package/framework/commands/product/light-arch.md +82 -0
  121. package/framework/commands/product/presentation.md +174 -0
  122. package/framework/commands/product/refine.md +161 -0
  123. package/framework/commands/product/spec.md +79 -0
  124. package/framework/commands/product/task-check.md +378 -0
  125. package/framework/commands/product/task.md +603 -0
  126. package/framework/commands/product/validate-task.md +325 -0
  127. package/framework/commands/product/warm-up.md +24 -0
  128. package/framework/commands/quick/analisys.md +17 -0
  129. package/framework/commands/test/e2e.md +377 -0
  130. package/framework/commands/test/integration.md +508 -0
  131. package/framework/commands/test/unit.md +381 -0
  132. package/framework/commands/validate/collab/pair-testing.md +657 -0
  133. package/framework/commands/validate/collab/three-amigos.md +534 -0
  134. package/framework/commands/validate/qa-points/estimate.md +660 -0
  135. package/framework/commands/validate/test-strategy/analyze.md +1201 -0
  136. package/framework/commands/validate/test-strategy/create.md +411 -0
  137. package/framework/commands/validate/workflow.md +370 -0
  138. package/framework/commands/warm-up.md +20 -0
  139. package/framework/docs/architecture/acoplamento-clickup-problema-analise.md +468 -0
  140. package/framework/docs/architecture/desacoplamento-roadmap.md +364 -0
  141. package/framework/docs/architecture/validacao-fase-1.md +235 -0
  142. package/framework/docs/c4/c4-detection-rules.md +395 -0
  143. package/framework/docs/c4/c4-documentation-templates.md +579 -0
  144. package/framework/docs/c4/c4-mermaid-patterns.md +331 -0
  145. package/framework/docs/c4/c4-templates.md +256 -0
  146. package/framework/docs/clickup/clickup-acceptance-criteria-strategy.md +329 -0
  147. package/framework/docs/clickup/clickup-auto-update-strategy.md +340 -0
  148. package/framework/docs/clickup/clickup-comment-formatter.md +239 -0
  149. package/framework/docs/clickup/clickup-description-fix.md +384 -0
  150. package/framework/docs/clickup/clickup-dual-comment-strategy.md +528 -0
  151. package/framework/docs/clickup/clickup-formatting.md +302 -0
  152. package/framework/docs/clickup/separador-tamanho-otimizado.md +258 -0
  153. package/framework/docs/engineer/pre-pr-acceptance-validation.md +256 -0
  154. package/framework/docs/onion/ESPERANTO.md +293 -0
  155. package/framework/docs/onion/agents-reference.md +832 -0
  156. package/framework/docs/onion/clickup-integration.md +780 -0
  157. package/framework/docs/onion/commands-guide.md +924 -0
  158. package/framework/docs/onion/engineering-flows.md +900 -0
  159. package/framework/docs/onion/getting-started.md +803 -0
  160. package/framework/docs/onion/maintenance-checklist.md +421 -0
  161. package/framework/docs/onion/naming-conventions.md +286 -0
  162. package/framework/docs/onion/practical-examples.md +854 -0
  163. package/framework/docs/product/story-points-integration.md +269 -0
  164. package/framework/docs/product/story-points-validation.md +237 -0
  165. package/framework/docs/reviews/task-manager-docs-review-2025-11-24.md +184 -0
  166. package/framework/docs/strategies/clickup-comment-patterns.md +766 -0
  167. package/framework/docs/strategies/clickup-integration-tests.md +602 -0
  168. package/framework/docs/strategies/clickup-mcp-wrappers-tests.md +888 -0
  169. package/framework/docs/strategies/clickup-regression-tests.md +587 -0
  170. package/framework/docs/strategies/visual-patterns.md +315 -0
  171. package/framework/docs/templates/README.md +649 -0
  172. package/framework/docs/templates/adr-template.md +226 -0
  173. package/framework/docs/templates/analysis-template.md +280 -0
  174. package/framework/docs/templates/execution-plan-template.md +430 -0
  175. package/framework/docs/templates/guide-template.md +367 -0
  176. package/framework/docs/templates/phase-execution-prompt-template.md +504 -0
  177. package/framework/docs/templates/reference-template.md +522 -0
  178. package/framework/docs/templates/solution-template.md +390 -0
  179. package/framework/docs/tools/README.md +356 -0
  180. package/framework/docs/tools/agents.md +365 -0
  181. package/framework/docs/tools/commands.md +669 -0
  182. package/framework/docs/tools/cursor.md +539 -0
  183. package/framework/docs/tools/mcps.md +937 -0
  184. package/framework/docs/tools/rules.md +461 -0
  185. package/framework/rules/language-and-documentation.mdc +371 -0
  186. package/framework/rules/nestjs-controllers.md +83 -0
  187. package/framework/rules/nestjs-dtos.md +255 -0
  188. package/framework/rules/nestjs-modules.md +141 -0
  189. package/framework/rules/nestjs-services.md +230 -0
  190. package/framework/rules/nx-rules.mdc +41 -0
  191. package/framework/rules/onion-patterns.mdc +197 -0
  192. package/framework/skills/codebase-visualizer/SKILL.md +26 -0
  193. package/framework/skills/codebase-visualizer/scripts/visualize.py +131 -0
  194. package/framework/skills/collect/SKILL.md +84 -0
  195. package/framework/skills/create-rule/SKILL.md +152 -0
  196. package/framework/skills/db-schema-visualizer/SKILL.md +49 -0
  197. package/framework/skills/db-schema-visualizer/scripts/visualize.py +1191 -0
  198. package/framework/skills/sync-meetings/SKILL.md +239 -0
  199. package/framework/utils/clickup-mcp-wrappers.md +744 -0
  200. package/framework/utils/date-time-standards.md +200 -0
  201. package/framework/utils/task-manager/README.md +94 -0
  202. package/framework/utils/task-manager/adapters/asana.md +377 -0
  203. package/framework/utils/task-manager/adapters/clickup.md +467 -0
  204. package/framework/utils/task-manager/adapters/linear.md +421 -0
  205. package/framework/utils/task-manager/detector.md +299 -0
  206. package/framework/utils/task-manager/factory.md +363 -0
  207. package/framework/utils/task-manager/interface.md +248 -0
  208. package/framework/utils/task-manager/types.md +409 -0
  209. package/package.json +41 -0
  210. package/src/cli.js +73 -0
  211. package/src/commands/doctor.js +191 -0
  212. package/src/commands/init.js +287 -0
  213. package/src/commands/install.js +261 -0
  214. package/src/commands/list.js +152 -0
  215. package/src/commands/uninstall.js +90 -0
  216. package/src/commands/update.js +26 -0
  217. package/src/utils/fs.js +89 -0
  218. package/src/utils/log.js +35 -0
  219. package/src/utils/paths.js +32 -0
  220. package/src/utils/prompt.js +76 -0
@@ -0,0 +1,882 @@
1
+ ---
2
+ name: create-abstraction
3
+ description: |
4
+ GeraΓ§Γ£o de camada de abstraΓ§Γ£o seguindo o padrΓ£o SDAAL.
5
+ Use para criar abstraΓ§Γ΅es agnΓ³sticas de provedor (Task Manager, Notification, Storage).
6
+ model: sonnet
7
+
8
+ parameters:
9
+ - name: abstraction_name
10
+ description: Nome da abstraΓ§Γ£o em kebab-case (ex: notification-manager)
11
+ required: true
12
+ - name: interface_name
13
+ description: Nome da interface TypeScript (ex: INotificationManager)
14
+ required: false
15
+ - name: providers
16
+ description: Lista de provedores separados por vΓ­rgula (ex: slack,discord,email)
17
+ required: false
18
+ - name: description
19
+ description: DescriΓ§Γ£o breve do propΓ³sito da abstraΓ§Γ£o
20
+ required: false
21
+
22
+ category: meta
23
+ tags:
24
+ - abstraction
25
+ - sdaal
26
+ - architecture
27
+ - adapter-pattern
28
+
29
+ version: "1.0.0"
30
+ updated: "2025-11-25"
31
+
32
+ related_commands:
33
+ - /meta/create-command
34
+ - /meta/create-agent
35
+
36
+ related_agents:
37
+ - onion
38
+
39
+ knowledge_base:
40
+ - docs/knowbase/concepts/specification-driven-ai-abstraction-layer.md
41
+ - docs/knowbase/concepts/task-manager-abstraction.md
42
+ ---
43
+
44
+ # πŸ—οΈ Criar Abstraction Layer (SDAAL)
45
+
46
+ Gerador de camadas de abstraΓ§Γ£o seguindo o padrΓ£o **Specification-Driven AI Abstraction Layer**.
47
+
48
+ ## 🎯 Objetivo
49
+
50
+ Criar estrutura completa de abstraΓ§Γ£o agnΓ³stica de provedor, permitindo trocar implementaΓ§Γ΅es sem modificar comandos ou agentes.
51
+
52
+ ## πŸ“ PadrΓ£o SDAAL
53
+
54
+ O padrΓ£o gera a seguinte estrutura:
55
+
56
+ ```
57
+ .claude/utils/{{abstraction_name}}/
58
+ β”œβ”€β”€ README.md # VisΓ£o geral e uso rΓ‘pido
59
+ β”œβ”€β”€ interface.md # Interface/Contrato principal
60
+ β”œβ”€β”€ types.md # Tipos de entrada e saΓ­da
61
+ β”œβ”€β”€ factory.md # CriaΓ§Γ£o de instΓ’ncias
62
+ β”œβ”€β”€ detector.md # DetecΓ§Γ£o de contexto/provedor
63
+ └── adapters/
64
+ β”œβ”€β”€ provider-a.md # Adapter Provider A
65
+ β”œβ”€β”€ provider-b.md # Adapter Provider B
66
+ └── none.md # Fallback (Null Object Pattern)
67
+ ```
68
+
69
+ ## ⚑ Fluxo de Execução
70
+
71
+ ### Passo 1: ValidaΓ§Γ£o de Entrada
72
+
73
+ ```bash
74
+ # Verificar se abstraΓ§Γ£o jΓ‘ existe
75
+ if [ -d ".claude/utils/{{abstraction_name}}" ]; then
76
+ echo "❌ ERRO: Abstração '{{abstraction_name}}' jÑ existe!"
77
+ ls -la .claude/utils/{{abstraction_name}}/
78
+ exit 1
79
+ fi
80
+
81
+ # Validar formato kebab-case
82
+ if [[ ! "{{abstraction_name}}" =~ ^[a-z][a-z0-9]*(-[a-z0-9]+)*$ ]]; then
83
+ echo "❌ ERRO: Nome deve ser kebab-case (ex: notification-manager)"
84
+ exit 1
85
+ fi
86
+ ```
87
+
88
+ **Checklist de ValidaΓ§Γ£o:**
89
+
90
+ - [ ] Nome ΓΊnico (nΓ£o existe em `.claude/utils/`)
91
+ - [ ] Nome em kebab-case vΓ‘lido
92
+ - [ ] Pelo menos 1 provedor definido (ou usar fallback only)
93
+
94
+ ### Passo 2: Determinar Valores
95
+
96
+ **DerivaΓ§Γ£o AutomΓ‘tica:**
97
+
98
+ | Input | DerivaΓ§Γ£o |
99
+ | ---------------------- | --------------------------------------------- |
100
+ | `{{abstraction_name}}` | `notification-manager` |
101
+ | `{{interface_name}}` | `INotificationManager` (auto: I + PascalCase) |
102
+ | `{{providers}}` | `slack,discord,email` ou `none` se vazio |
103
+ | `{{env_prefix}}` | `NOTIFICATION_MANAGER` (auto: UPPER_SNAKE) |
104
+
105
+ ```typescript
106
+ // Derivar interface_name se nΓ£o fornecido
107
+ const interfaceName =
108
+ '{{interface_name}}' ||
109
+ 'I' +
110
+ '{{abstraction_name}}'
111
+ .split('-')
112
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
113
+ .join('');
114
+
115
+ // Derivar env_prefix
116
+ const envPrefix = '{{abstraction_name}}'.toUpperCase().replace(/-/g, '_');
117
+ ```
118
+
119
+ ### Passo 3: Criar Estrutura de DiretΓ³rios
120
+
121
+ ```bash
122
+ mkdir -p .claude/utils/{{abstraction_name}}/adapters
123
+ ```
124
+
125
+ ### Passo 4: Gerar README.md
126
+
127
+ ```markdown
128
+ # πŸ”Œ {{interface_name}} - Abstraction Layer
129
+
130
+ ## 🎯 Propósito
131
+
132
+ Camada de abstraΓ§Γ£o que permite trocar o provedor de {{description}} sem modificar os comandos do Sistema Onion.
133
+
134
+ ## πŸ“ Estrutura
135
+
136
+ \`\`\`
137
+ {{abstraction_name}}/
138
+ β”œβ”€β”€ README.md # Este arquivo
139
+ β”œβ”€β”€ interface.md # Interface {{interface_name}}
140
+ β”œβ”€β”€ types.md # Tipos compartilhados
141
+ β”œβ”€β”€ detector.md # DetecΓ§Γ£o de provedor
142
+ β”œβ”€β”€ factory.md # Factory para adapters
143
+ └── adapters/
144
+ {{#each providers}}
145
+ β”œβ”€β”€ {{this}}.md # Adapter {{this}}
146
+ {{/each}}
147
+ └── none.md # Adapter Fallback
148
+ \`\`\`
149
+
150
+ ## ⚑ Uso RÑpido
151
+
152
+ ### 1. Configurar Provedor
153
+
154
+ No \`.env\`:
155
+ \`\`\`bash
156
+ {{env_prefix}}\_PROVIDER={{providers[0]}} # {{providers.join(' | ')}} | none
157
+ \`\`\`
158
+
159
+ ### 2. Usar nos Comandos
160
+
161
+ \`\`\`typescript
162
+ // Importar factory
163
+ import { get{{interface_name.slice(1)}} } from '.claude/utils/{{abstraction_name}}/factory';
164
+
165
+ // Obter adapter configurado
166
+ const manager = get{{interface_name.slice(1)}}();
167
+
168
+ // Usar interface comum
169
+ await manager.send({ ... });
170
+ \`\`\`
171
+
172
+ ## πŸ”§ Provedores Suportados
173
+
174
+ | Provedor | Status | Notas |
175
+ | -------- | ------ | ----- |
176
+
177
+ {{#each providers}}
178
+ | {{this}} | πŸ“ Stub | ImplementaΓ§Γ£o necessΓ‘ria |
179
+ {{/each}}
180
+ | None | βœ… Funcional | Modo offline |
181
+
182
+ ## πŸ“š DocumentaΓ§Γ£o Relacionada
183
+
184
+ - [SDAAL Pattern](../../docs/knowbase/concepts/specification-driven-ai-abstraction-layer.md)
185
+ - [Interface](./interface.md)
186
+ - [Factory](./factory.md)
187
+
188
+ ---
189
+
190
+ **VersΓ£o**: 1.0.0
191
+ **Criado em**: {{data_atual}}
192
+ ```
193
+
194
+ ### Passo 5: Gerar interface.md
195
+
196
+ ```markdown
197
+ # πŸ“ Interface {{interface_name}}
198
+
199
+ ## 🎯 Propósito
200
+
201
+ Define o contrato que todos os adapters devem implementar, garantindo consistΓͺncia e permitindo troca transparente de provedores.
202
+
203
+ ---
204
+
205
+ ## πŸ“‹ Interface Completa
206
+
207
+ \`\`\`typescript
208
+ /\*\*
209
+
210
+ - Interface abstrata para {{description}}.
211
+ - Todos os adapters devem implementar esta interface.
212
+ \*/
213
+ interface {{interface_name}} {
214
+ // ═══════════════════════════════════════════════════════════════════════════
215
+ // IDENTIFICAÇÃO
216
+ // ═══════════════════════════════════════════════════════════════════════════
217
+
218
+ /\*\*
219
+
220
+ - Nome do provedor: '{{providers.join("' | '")}}' | 'none'
221
+ \*/
222
+ readonly provider: {{interface_name.slice(1)}}Provider;
223
+
224
+ /\*\*
225
+
226
+ - Indica se o provedor estΓ‘ configurado corretamente
227
+ \*/
228
+ readonly isConfigured: boolean;
229
+
230
+ // ═══════════════════════════════════════════════════════════════════════════
231
+ // OPERAÇÕES PRINCIPAIS
232
+ // ═══════════════════════════════════════════════════════════════════════════
233
+
234
+ // TODO: Adicionar mΓ©todos especΓ­ficos da abstraΓ§Γ£o
235
+ // Exemplo:
236
+ // send(input: SendInput): Promise<SendOutput>;
237
+ // get(id: string): Promise<ItemOutput>;
238
+
239
+ // ═══════════════════════════════════════════════════════════════════════════
240
+ // VALIDAÇÃO
241
+ // ═══════════════════════════════════════════════════════════════════════════
242
+
243
+ /\*\*
244
+
245
+ - Valida configuraΓ§Γ£o do provedor.
246
+ - @returns true se configuraΓ§Γ£o estΓ‘ vΓ‘lida
247
+ \*/
248
+ validateConfiguration(): boolean;
249
+ }
250
+ \`\`\`
251
+
252
+ ---
253
+
254
+ ## πŸ“Š MΓ©todos por Categoria
255
+
256
+ | Categoria | MΓ©todos | DescriΓ§Γ£o |
257
+ | ----------------- | ------------------------------ | ---------------------- |
258
+ | **IdentificaΓ§Γ£o** | \`provider\`, \`isConfigured\` | InformaΓ§Γ΅es do adapter |
259
+ | **Principais** | TODO | OperaΓ§Γ΅es de negΓ³cio |
260
+ | **ValidaΓ§Γ£o** | \`validateConfiguration\` | VerificaΓ§Γ£o de setup |
261
+
262
+ ---
263
+
264
+ ## πŸ”„ ImplementaΓ§Γ£o NecessΓ‘ria
265
+
266
+ Para completar a interface:
267
+
268
+ 1. Definir mΓ©todos especΓ­ficos em [types.md](./types.md)
269
+ 2. Implementar em cada adapter em [adapters/](./adapters/)
270
+ 3. Atualizar mapeamentos de campos
271
+
272
+ ---
273
+
274
+ ## πŸ“š ReferΓͺncias
275
+
276
+ - [Tipos Compartilhados](./types.md)
277
+ - [Factory](./factory.md)
278
+ - [Adapters](./adapters/)
279
+
280
+ ---
281
+
282
+ **VersΓ£o**: 1.0.0
283
+ **Criado em**: {{data_atual}}
284
+ ```
285
+
286
+ ### Passo 6: Gerar types.md
287
+
288
+ ```markdown
289
+ # πŸ“¦ Tipos Compartilhados - {{interface_name}}
290
+
291
+ ## 🎯 Propósito
292
+
293
+ Define os tipos TypeScript compartilhados entre todos os adapters, garantindo consistΓͺncia nas operaΓ§Γ΅es de entrada e saΓ­da.
294
+
295
+ ---
296
+
297
+ ## πŸ”§ Enums e Constantes
298
+
299
+ \`\`\`typescript
300
+ /\*\*
301
+
302
+ - Provedores suportados.
303
+ \*/
304
+ type {{interface_name.slice(1)}}Provider = '{{providers.join("' | '")}}' | 'none';
305
+ \`\`\`
306
+
307
+ ---
308
+
309
+ ## πŸ“₯ Tipos de Entrada (Input)
310
+
311
+ \`\`\`typescript
312
+ /\*\*
313
+
314
+ - TODO: Definir tipos de entrada.
315
+ - Exemplo:
316
+ _/
317
+ interface BaseInput {
318
+ /\*\* Campo obrigatΓ³rio _/
319
+ requiredField: string;
320
+
321
+ /\*_ Campo opcional _/
322
+ optionalField?: string;
323
+ }
324
+ \`\`\`
325
+
326
+ ---
327
+
328
+ ## πŸ“€ Tipos de SaΓ­da (Output)
329
+
330
+ \`\`\`typescript
331
+ /\*\*
332
+
333
+ - TODO: Definir tipos de saΓ­da.
334
+ - Exemplo:
335
+ _/
336
+ interface BaseOutput {
337
+ /\*\* ID ΓΊnico _/
338
+ id: string;
339
+
340
+ /\*_ Provedor de origem _/
341
+ provider: {{interface_name.slice(1)}}Provider;
342
+
343
+ /\*_ Timestamp de criaΓ§Γ£o _/
344
+ createdAt: string;
345
+ }
346
+ \`\`\`
347
+
348
+ ---
349
+
350
+ ## βš™οΈ Tipos de ConfiguraΓ§Γ£o
351
+
352
+ \`\`\`typescript
353
+ /\*\*
354
+
355
+ - ConfiguraΓ§Γ£o de um provedor.
356
+ _/
357
+ interface ProviderConfig {
358
+ /\*\* Nome do provedor _/
359
+ provider: {{interface_name.slice(1)}}Provider;
360
+
361
+ /\*_ Se estΓ‘ configurado corretamente _/
362
+ isConfigured: boolean;
363
+
364
+ /\*_ VariΓ‘veis de ambiente obrigatΓ³rias _/
365
+ requiredEnvVars: string[];
366
+
367
+ /\*_ VariΓ‘veis de ambiente opcionais _/
368
+ optionalEnvVars: string[];
369
+
370
+ /\*_ Mensagem de erro se nΓ£o configurado _/
371
+ errorMessage?: string;
372
+ }
373
+ \`\`\`
374
+
375
+ ---
376
+
377
+ ## πŸ“š ReferΓͺncias
378
+
379
+ - [Interface](./interface.md)
380
+ - [Detector de Provedor](./detector.md)
381
+
382
+ ---
383
+
384
+ **VersΓ£o**: 1.0.0
385
+ **Criado em**: {{data_atual}}
386
+ ```
387
+
388
+ ### Passo 7: Gerar detector.md
389
+
390
+ ```markdown
391
+ # πŸ” Detector de Provedor - {{interface_name}}
392
+
393
+ ## 🎯 Propósito
394
+
395
+ Detecta e valida o provedor configurado via variΓ‘veis de ambiente.
396
+
397
+ ---
398
+
399
+ ## πŸ“‹ FunΓ§Γ΅es Principais
400
+
401
+ ### detectProvider()
402
+
403
+ \`\`\`typescript
404
+ /\*\*
405
+
406
+ - Detecta o provedor configurado via variΓ‘veis de ambiente.
407
+ - @returns ConfiguraΓ§Γ£o do provedor ativo
408
+ \*/
409
+ function detectProvider(): ProviderConfig {
410
+ const provider = (process.env.{{env_prefix}}\_PROVIDER || 'none') as {{interface_name.slice(1)}}Provider;
411
+
412
+ const configs: Record<{{interface_name.slice(1)}}Provider, ProviderConfig> = {
413
+ {{#each providers}}
414
+ '{{this}}': {
415
+ provider: '{{this}}',
416
+ isConfigured: !!process.env.{{../env_prefix}}_{{this.toUpperCase()}}\_TOKEN,
417
+ requiredEnvVars: ['{{../env_prefix}}_{{this.toUpperCase()}}_TOKEN'],
418
+ optionalEnvVars: ['{{../env_prefix}}_{{this.toUpperCase()}}_WORKSPACE'],
419
+ errorMessage: !process.env.{{../env_prefix}}_{{this.toUpperCase()}}_TOKEN
420
+ ? '❌ {{../env_prefix}}_{{this.toUpperCase()}}\_TOKEN não configurado'
421
+ : undefined
422
+ },
423
+ {{/each}}
424
+
425
+ 'none': {
426
+ provider: 'none',
427
+ isConfigured: true,
428
+ requiredEnvVars: [],
429
+ optionalEnvVars: [],
430
+ errorMessage: undefined
431
+ }
432
+
433
+ };
434
+
435
+ return configs[provider] || configs.none;
436
+ }
437
+ \`\`\`
438
+
439
+ ---
440
+
441
+ ### checkProviderConfiguration()
442
+
443
+ \`\`\`typescript
444
+ /\*\*
445
+
446
+ - Verifica a configuraΓ§Γ£o completa do provedor.
447
+ - @returns Objeto com status e mensagens
448
+ \*/
449
+ function checkProviderConfiguration(): {
450
+ provider: {{interface_name.slice(1)}}Provider;
451
+ isConfigured: boolean;
452
+ missingVars: string[];
453
+ message: string;
454
+ } {
455
+ const config = detectProvider();
456
+
457
+ const missingVars = config.requiredEnvVars.filter(
458
+ varName => !process.env[varName]
459
+ );
460
+
461
+ let message: string;
462
+
463
+ if (config.provider === 'none') {
464
+ message = 'ℹ️ Nenhum provedor configurado. Operando em modo offline.';
465
+ } else if (!config.isConfigured) {
466
+ message = \`❌ \${config.provider.toUpperCase()} não configurado. Faltando: \${missingVars.join(', ')}\`;
467
+ } else {
468
+ message = \`βœ… \${config.provider.toUpperCase()} configurado corretamente.\`;
469
+ }
470
+
471
+ return {
472
+ provider: config.provider,
473
+ isConfigured: config.isConfigured,
474
+ missingVars,
475
+ message
476
+ };
477
+ }
478
+ \`\`\`
479
+
480
+ ---
481
+
482
+ ## πŸ“Š VariΓ‘veis de Ambiente
483
+
484
+ | Provedor | VariΓ‘vel ObrigatΓ³ria | VariΓ‘veis Opcionais |
485
+ | -------- | -------------------- | ------------------- |
486
+
487
+ {{#each providers}}
488
+ | {{this}} | \`{{../env_prefix}}_{{this.toUpperCase()}}\_TOKEN\` | \`{{../env_prefix}}_{{this.toUpperCase()}}\_WORKSPACE\` |
489
+ {{/each}}
490
+ | none | - | - |
491
+
492
+ ---
493
+
494
+ ## πŸ“š ReferΓͺncias
495
+
496
+ - [Types](./types.md)
497
+ - [Factory](./factory.md)
498
+
499
+ ---
500
+
501
+ **VersΓ£o**: 1.0.0
502
+ **Criado em**: {{data_atual}}
503
+ ```
504
+
505
+ ### Passo 8: Gerar factory.md
506
+
507
+ ```markdown
508
+ # 🏭 Factory - {{interface_name}}
509
+
510
+ ## 🎯 Propósito
511
+
512
+ Fornece factory para instanciar o adapter correto baseado na configuraΓ§Γ£o do ambiente.
513
+
514
+ ---
515
+
516
+ ## πŸ“‹ FunΓ§Γ£o Principal
517
+
518
+ ### get{{interface_name.slice(1)}}()
519
+
520
+ \`\`\`typescript
521
+ /\*\*
522
+
523
+ - Retorna uma instΓ’ncia do manager configurado.
524
+ - Baseado em {{env_prefix}}\_PROVIDER no .env
525
+ -
526
+ - @param options - OpΓ§Γ΅es de configuraΓ§Γ£o (opcional)
527
+ - @returns InstΓ’ncia do adapter apropriado
528
+ \*/
529
+ function get{{interface_name.slice(1)}}(options?: FactoryOptions): {{interface_name}} {
530
+ const config = detectProvider();
531
+
532
+ if (options?.debug) {
533
+ console.log(\`[{{interface_name}}] Provider: \${config.provider}\`);
534
+ console.log(\`[{{interface_name}}] Configured: \${config.isConfigured}\`);
535
+ }
536
+
537
+ if (!config.isConfigured) {
538
+ if (options?.throwOnMisconfigured) {
539
+ throw new Error(config.errorMessage || 'Provider not configured');
540
+ }
541
+
542
+ console.warn(\`⚠️ \${config.errorMessage}\`);
543
+ console.warn(\`πŸ’‘ Continuando em modo offline...\`);
544
+ return new NoProviderAdapter();
545
+
546
+ }
547
+
548
+ switch (config.provider) {
549
+ {{#each providers}}
550
+ case '{{this}}':
551
+ return new {{this.charAt(0).toUpperCase() + this.slice(1)}}Adapter({
552
+ token: process.env.{{../env_prefix}}_{{this.toUpperCase()}}\_TOKEN!,
553
+ workspace: process.env.{{../env_prefix}}_{{this.toUpperCase()}}\_WORKSPACE
554
+ });
555
+ {{/each}}
556
+
557
+ case 'none':
558
+ default:
559
+ return new NoProviderAdapter();
560
+
561
+ }
562
+ }
563
+ \`\`\`
564
+
565
+ ---
566
+
567
+ ## βš™οΈ Tipos da Factory
568
+
569
+ \`\`\`typescript
570
+ /\*\*
571
+
572
+ - OpΓ§Γ΅es para a factory.
573
+ _/
574
+ interface FactoryOptions {
575
+ /\*\* Habilita logs de debug _/
576
+ debug?: boolean;
577
+
578
+ /\*_ LanΓ§a erro se provedor nΓ£o configurado _/
579
+ throwOnMisconfigured?: boolean;
580
+
581
+ /\*_ ForΓ§a um provedor especΓ­fico _/
582
+ forceProvider?: {{interface_name.slice(1)}}Provider;
583
+ }
584
+ \`\`\`
585
+
586
+ ---
587
+
588
+ ## πŸ“Š NoProviderAdapter (Fallback)
589
+
590
+ \`\`\`typescript
591
+ /\*\*
592
+
593
+ - Adapter de fallback quando nenhum provedor estΓ‘ configurado.
594
+ \*/
595
+ class NoProviderAdapter implements {{interface_name}} {
596
+ readonly provider: {{interface_name.slice(1)}}Provider = 'none';
597
+ readonly isConfigured: boolean = false;
598
+
599
+ // TODO: Implementar mΓ©todos com comportamento offline
600
+ // Retornar valores sensatos ou warnings
601
+
602
+ validateConfiguration(): boolean {
603
+ return false;
604
+ }
605
+ }
606
+ \`\`\`
607
+
608
+ ---
609
+
610
+ ## πŸ§ͺ Exemplos de Uso
611
+
612
+ \`\`\`typescript
613
+ // Uso bΓ‘sico
614
+ const manager = get{{interface_name.slice(1)}}();
615
+
616
+ if (manager.isConfigured) {
617
+ // OperaΓ§Γ΅es online
618
+ } else {
619
+ console.log('⚠️ Modo offline');
620
+ }
621
+
622
+ // Com validaΓ§Γ£o obrigatΓ³ria
623
+ try {
624
+ const manager = get{{interface_name.slice(1)}}({ throwOnMisconfigured: true });
625
+ } catch (error) {
626
+ console.error('❌ Provedor não configurado');
627
+ }
628
+ \`\`\`
629
+
630
+ ---
631
+
632
+ ## πŸ“š ReferΓͺncias
633
+
634
+ - [Interface](./interface.md)
635
+ - [Detector](./detector.md)
636
+ - [Adapters](./adapters/)
637
+
638
+ ---
639
+
640
+ **VersΓ£o**: 1.0.0
641
+ **Criado em**: {{data_atual}}
642
+ ```
643
+
644
+ ### Passo 9: Gerar Adapters
645
+
646
+ Para cada provedor em `{{providers}}`, criar:
647
+
648
+ ```markdown
649
+ # πŸ”΅ {{provider}} Adapter
650
+
651
+ ## 🎯 Propósito
652
+
653
+ ImplementaΓ§Γ£o do {{interface_name}} para {{provider}}.
654
+
655
+ ---
656
+
657
+ ## πŸ“‹ ConfiguraΓ§Γ£o
658
+
659
+ ### VariΓ‘veis de Ambiente
660
+
661
+ \`\`\`bash
662
+
663
+ # ObrigatΓ³ria
664
+
665
+ {{env_prefix}}\_{{provider.toUpperCase()}}\_TOKEN=xxx
666
+
667
+ # Opcionais
668
+
669
+ {{env_prefix}}\_{{provider.toUpperCase()}}\_WORKSPACE=xxx
670
+ \`\`\`
671
+
672
+ ---
673
+
674
+ ## πŸ”§ ImplementaΓ§Γ£o
675
+
676
+ \`\`\`typescript
677
+ /\*\*
678
+
679
+ - Adapter {{provider}} implementando {{interface_name}}.
680
+ \*/
681
+ class {{provider.charAt(0).toUpperCase() + provider.slice(1)}}Adapter implements {{interface_name}} {
682
+ readonly provider: {{interface_name.slice(1)}}Provider = '{{provider}}';
683
+ readonly isConfigured: boolean;
684
+
685
+ private token: string;
686
+ private workspace?: string;
687
+
688
+ constructor(config: {{provider.charAt(0).toUpperCase() + provider.slice(1)}}AdapterConfig) {
689
+ this.token = config.token;
690
+ this.workspace = config.workspace;
691
+ this.isConfigured = !!this.token;
692
+ }
693
+
694
+ // ═══════════════════════════════════════════════════════════════════════════
695
+ // TODO: IMPLEMENTAR MÉTODOS
696
+ // ═══════════════════════════════════════════════════════════════════════════
697
+
698
+ validateConfiguration(): boolean {
699
+ return this.isConfigured;
700
+ }
701
+
702
+ // Adicionar mΓ©todos especΓ­ficos...
703
+ }
704
+ \`\`\`
705
+
706
+ ---
707
+
708
+ ## πŸ“Š Mapeamento de Campos
709
+
710
+ | Interface | {{provider}} API | Notas |
711
+ | --------- | ---------------- | ------------- |
712
+ | TODO | TODO | Mapear campos |
713
+
714
+ ---
715
+
716
+ ## πŸ§ͺ Exemplos de Uso
717
+
718
+ \`\`\`typescript
719
+ // Via Factory (recomendado)
720
+ const manager = get{{interface_name.slice(1)}}();
721
+
722
+ // Direto (para testes)
723
+ const adapter = new {{provider.charAt(0).toUpperCase() + provider.slice(1)}}Adapter({
724
+ token: 'xxx',
725
+ workspace: 'xxx'
726
+ });
727
+ \`\`\`
728
+
729
+ ---
730
+
731
+ ## πŸ“š ReferΓͺncias
732
+
733
+ - [Interface](../interface.md)
734
+ - [Types](../types.md)
735
+
736
+ ---
737
+
738
+ **VersΓ£o**: 1.0.0
739
+ **Criado em**: {{data_atual}}
740
+ ```
741
+
742
+ ### Passo 10: Gerar none.md (Fallback)
743
+
744
+ ```markdown
745
+ # βšͺ NoProvider Adapter (Fallback)
746
+
747
+ ## 🎯 Propósito
748
+
749
+ Adapter de fallback que permite operaΓ§Γ£o offline quando nenhum provedor estΓ‘ configurado.
750
+
751
+ ---
752
+
753
+ ## πŸ“‹ Comportamento
754
+
755
+ O NoProviderAdapter:
756
+
757
+ - βœ… Permite que comandos executem sem falhar
758
+ - ⚠️ Exibe warnings quando operaçáes são tentadas
759
+ - πŸ“ Pode gerar IDs locais para rastreamento
760
+ - ❌ Não persiste dados em serviços externos
761
+
762
+ ---
763
+
764
+ ## πŸ”§ ImplementaΓ§Γ£o
765
+
766
+ \`\`\`typescript
767
+ /\*\*
768
+
769
+ - Adapter de fallback - modo offline.
770
+ \*/
771
+ class NoProviderAdapter implements {{interface_name}} {
772
+ readonly provider: {{interface_name.slice(1)}}Provider = 'none';
773
+ readonly isConfigured: boolean = false;
774
+
775
+ // ═══════════════════════════════════════════════════════════════════════════
776
+ // OPERAÇÕES (warnings + fallback)
777
+ // ═══════════════════════════════════════════════════════════════════════════
778
+
779
+ // TODO: Implementar cada mΓ©todo com:
780
+ // 1. console.warn('⚠️ Operação X - modo offline');
781
+ // 2. Retornar valor sensato ou throw com mensagem clara
782
+
783
+ validateConfiguration(): boolean {
784
+ console.warn('⚠️ Nenhum provedor configurado');
785
+ return false;
786
+ }
787
+ }
788
+ \`\`\`
789
+
790
+ ---
791
+
792
+ ## πŸ“Š Comportamento por OperaΓ§Γ£o
793
+
794
+ | OperaΓ§Γ£o | Comportamento Offline |
795
+ | ----------- | --------------------------- |
796
+ | Leitura | Retorna array vazio ou null |
797
+ | Escrita | Warning + ID local |
798
+ | AtualizaΓ§Γ£o | Warning + throw/false |
799
+ | DeleΓ§Γ£o | Warning + false |
800
+
801
+ ---
802
+
803
+ ## πŸ“š ReferΓͺncias
804
+
805
+ - [Factory](../factory.md)
806
+ - [Interface](../interface.md)
807
+
808
+ ---
809
+
810
+ **VersΓ£o**: 1.0.0
811
+ **Criado em**: {{data_atual}}
812
+ ```
813
+
814
+ ### Passo 11: Atualizar .env.example
815
+
816
+ Adicionar ao `.env.example`:
817
+
818
+ ```bash
819
+ # ═══════════════════════════════════════════════════════════════════════════
820
+ # {{interface_name.slice(1)}} Configuration
821
+ # ═══════════════════════════════════════════════════════════════════════════
822
+ {{env_prefix}}_PROVIDER=none # {{providers.join(' | ')}} | none
823
+
824
+ {{#each providers}}
825
+ # {{this}}
826
+ {{../env_prefix}}_{{this.toUpperCase()}}_TOKEN=
827
+ {{../env_prefix}}_{{this.toUpperCase()}}_WORKSPACE=
828
+
829
+ {{/each}}
830
+ ```
831
+
832
+ ## πŸ“€ Output Esperado
833
+
834
+ ```
835
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
836
+ βœ… ABSTRACTION LAYER CRIADA (SDAAL)
837
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
838
+
839
+ πŸ“ Estrutura:
840
+ .claude/utils/{{abstraction_name}}/
841
+ β”œβ”€β”€ README.md βœ…
842
+ β”œβ”€β”€ interface.md βœ…
843
+ β”œβ”€β”€ types.md βœ…
844
+ β”œβ”€β”€ factory.md βœ…
845
+ β”œβ”€β”€ detector.md βœ…
846
+ └── adapters/
847
+ {{#each providers}}
848
+ β”œβ”€β”€ {{this}}.md πŸ“ (stub)
849
+ {{/each}}
850
+ └── none.md βœ…
851
+
852
+ πŸ“‹ Detalhes:
853
+ ∟ Interface: {{interface_name}}
854
+ ∟ Provedores: {{providers.join(', ')}}
855
+ ∟ Env Prefix: {{env_prefix}}_PROVIDER
856
+
857
+ πŸ”§ PrΓ³ximos Passos:
858
+ 1. Definir mΓ©todos em interface.md
859
+ 2. Adicionar tipos em types.md
860
+ 3. Implementar adapters em adapters/
861
+ 4. Configurar .env com {{env_prefix}}_PROVIDER
862
+
863
+ πŸ“š DocumentaΓ§Γ£o:
864
+ ∟ Pattern: docs/knowbase/concepts/specification-driven-ai-abstraction-layer.md
865
+ ∟ Exemplo: .claude/utils/task-manager/
866
+
867
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
868
+ ```
869
+
870
+ ## πŸ”— ReferΓͺncias
871
+
872
+ - [SDAAL Pattern](../../docs/knowbase/concepts/specification-driven-ai-abstraction-layer.md)
873
+ - [Task Manager (ReferΓͺncia)](../../.claude/utils/task-manager/)
874
+ - Agente: @onion
875
+
876
+ ## ⚠️ Notas
877
+
878
+ - Cada arquivo deve ter < 400 linhas
879
+ - Interface deve ser extensΓ­vel (Open/Closed)
880
+ - Sempre incluir NoProviderAdapter (fallback)
881
+ - Documentar variΓ‘veis de ambiente necessΓ‘rias
882
+ - Usar emojis e separadores ASCII para facilitar parsing por IA