@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,859 @@
|
|
|
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
|
+
.cursor/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 ".cursor/utils/{{abstraction_name}}" ]; then
|
|
76
|
+
echo "β ERRO: AbstraΓ§Γ£o '{{abstraction_name}}' jΓ‘ existe!"
|
|
77
|
+
ls -la .cursor/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
|
+
- [ ] Nome ΓΊnico (nΓ£o existe em `.cursor/utils/`)
|
|
90
|
+
- [ ] Nome em kebab-case vΓ‘lido
|
|
91
|
+
- [ ] Pelo menos 1 provedor definido (ou usar fallback only)
|
|
92
|
+
|
|
93
|
+
### Passo 2: Determinar Valores
|
|
94
|
+
|
|
95
|
+
**DerivaΓ§Γ£o AutomΓ‘tica:**
|
|
96
|
+
|
|
97
|
+
| Input | DerivaΓ§Γ£o |
|
|
98
|
+
|-------|-----------|
|
|
99
|
+
| `{{abstraction_name}}` | `notification-manager` |
|
|
100
|
+
| `{{interface_name}}` | `INotificationManager` (auto: I + PascalCase) |
|
|
101
|
+
| `{{providers}}` | `slack,discord,email` ou `none` se vazio |
|
|
102
|
+
| `{{env_prefix}}` | `NOTIFICATION_MANAGER` (auto: UPPER_SNAKE) |
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
// Derivar interface_name se nΓ£o fornecido
|
|
106
|
+
const interfaceName = "{{interface_name}}" ||
|
|
107
|
+
"I" + "{{abstraction_name}}"
|
|
108
|
+
.split('-')
|
|
109
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
110
|
+
.join('');
|
|
111
|
+
|
|
112
|
+
// Derivar env_prefix
|
|
113
|
+
const envPrefix = "{{abstraction_name}}"
|
|
114
|
+
.toUpperCase()
|
|
115
|
+
.replace(/-/g, '_');
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Passo 3: Criar Estrutura de DiretΓ³rios
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
mkdir -p .cursor/utils/{{abstraction_name}}/adapters
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Passo 4: Gerar README.md
|
|
125
|
+
|
|
126
|
+
```markdown
|
|
127
|
+
# π {{interface_name}} - Abstraction Layer
|
|
128
|
+
|
|
129
|
+
## π― PropΓ³sito
|
|
130
|
+
|
|
131
|
+
Camada de abstraΓ§Γ£o que permite trocar o provedor de {{description}} sem modificar os comandos do Sistema Onion.
|
|
132
|
+
|
|
133
|
+
## π Estrutura
|
|
134
|
+
|
|
135
|
+
\`\`\`
|
|
136
|
+
{{abstraction_name}}/
|
|
137
|
+
βββ README.md # Este arquivo
|
|
138
|
+
βββ interface.md # Interface {{interface_name}}
|
|
139
|
+
βββ types.md # Tipos compartilhados
|
|
140
|
+
βββ detector.md # DetecΓ§Γ£o de provedor
|
|
141
|
+
βββ factory.md # Factory para adapters
|
|
142
|
+
βββ adapters/
|
|
143
|
+
{{#each providers}}
|
|
144
|
+
βββ {{this}}.md # Adapter {{this}}
|
|
145
|
+
{{/each}}
|
|
146
|
+
βββ none.md # Adapter Fallback
|
|
147
|
+
\`\`\`
|
|
148
|
+
|
|
149
|
+
## β‘ Uso RΓ‘pido
|
|
150
|
+
|
|
151
|
+
### 1. Configurar Provedor
|
|
152
|
+
|
|
153
|
+
No \`.env\`:
|
|
154
|
+
\`\`\`bash
|
|
155
|
+
{{env_prefix}}_PROVIDER={{providers[0]}} # {{providers.join(' | ')}} | none
|
|
156
|
+
\`\`\`
|
|
157
|
+
|
|
158
|
+
### 2. Usar nos Comandos
|
|
159
|
+
|
|
160
|
+
\`\`\`typescript
|
|
161
|
+
// Importar factory
|
|
162
|
+
import { get{{interface_name.slice(1)}} } from '.cursor/utils/{{abstraction_name}}/factory';
|
|
163
|
+
|
|
164
|
+
// Obter adapter configurado
|
|
165
|
+
const manager = get{{interface_name.slice(1)}}();
|
|
166
|
+
|
|
167
|
+
// Usar interface comum
|
|
168
|
+
await manager.send({ ... });
|
|
169
|
+
\`\`\`
|
|
170
|
+
|
|
171
|
+
## π§ Provedores Suportados
|
|
172
|
+
|
|
173
|
+
| Provedor | Status | Notas |
|
|
174
|
+
|----------|--------|-------|
|
|
175
|
+
{{#each providers}}
|
|
176
|
+
| {{this}} | π Stub | ImplementaΓ§Γ£o necessΓ‘ria |
|
|
177
|
+
{{/each}}
|
|
178
|
+
| None | β
Funcional | Modo offline |
|
|
179
|
+
|
|
180
|
+
## π DocumentaΓ§Γ£o Relacionada
|
|
181
|
+
|
|
182
|
+
- [SDAAL Pattern](../../docs/knowbase/concepts/specification-driven-ai-abstraction-layer.md)
|
|
183
|
+
- [Interface](./interface.md)
|
|
184
|
+
- [Factory](./factory.md)
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
**VersΓ£o**: 1.0.0
|
|
189
|
+
**Criado em**: {{data_atual}}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Passo 5: Gerar interface.md
|
|
193
|
+
|
|
194
|
+
```markdown
|
|
195
|
+
# π Interface {{interface_name}}
|
|
196
|
+
|
|
197
|
+
## π― PropΓ³sito
|
|
198
|
+
|
|
199
|
+
Define o contrato que todos os adapters devem implementar, garantindo consistΓͺncia e permitindo troca transparente de provedores.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## π Interface Completa
|
|
204
|
+
|
|
205
|
+
\`\`\`typescript
|
|
206
|
+
/**
|
|
207
|
+
* Interface abstrata para {{description}}.
|
|
208
|
+
* Todos os adapters devem implementar esta interface.
|
|
209
|
+
*/
|
|
210
|
+
interface {{interface_name}} {
|
|
211
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
212
|
+
// IDENTIFICAΓΓO
|
|
213
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Nome do provedor: '{{providers.join("' | '")}}' | 'none'
|
|
217
|
+
*/
|
|
218
|
+
readonly provider: {{interface_name.slice(1)}}Provider;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Indica se o provedor estΓ‘ configurado corretamente
|
|
222
|
+
*/
|
|
223
|
+
readonly isConfigured: boolean;
|
|
224
|
+
|
|
225
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
226
|
+
// OPERAΓΓES PRINCIPAIS
|
|
227
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
228
|
+
|
|
229
|
+
// TODO: Adicionar mΓ©todos especΓficos da abstraΓ§Γ£o
|
|
230
|
+
// Exemplo:
|
|
231
|
+
// send(input: SendInput): Promise<SendOutput>;
|
|
232
|
+
// get(id: string): Promise<ItemOutput>;
|
|
233
|
+
|
|
234
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
235
|
+
// VALIDAΓΓO
|
|
236
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Valida configuraΓ§Γ£o do provedor.
|
|
240
|
+
* @returns true se configuraΓ§Γ£o estΓ‘ vΓ‘lida
|
|
241
|
+
*/
|
|
242
|
+
validateConfiguration(): boolean;
|
|
243
|
+
}
|
|
244
|
+
\`\`\`
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## π MΓ©todos por Categoria
|
|
249
|
+
|
|
250
|
+
| Categoria | MΓ©todos | DescriΓ§Γ£o |
|
|
251
|
+
|-----------|---------|-----------|
|
|
252
|
+
| **IdentificaΓ§Γ£o** | \`provider\`, \`isConfigured\` | InformaΓ§Γ΅es do adapter |
|
|
253
|
+
| **Principais** | TODO | OperaΓ§Γ΅es de negΓ³cio |
|
|
254
|
+
| **ValidaΓ§Γ£o** | \`validateConfiguration\` | VerificaΓ§Γ£o de setup |
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## π ImplementaΓ§Γ£o NecessΓ‘ria
|
|
259
|
+
|
|
260
|
+
Para completar a interface:
|
|
261
|
+
|
|
262
|
+
1. Definir mΓ©todos especΓficos em [types.md](./types.md)
|
|
263
|
+
2. Implementar em cada adapter em [adapters/](./adapters/)
|
|
264
|
+
3. Atualizar mapeamentos de campos
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## π ReferΓͺncias
|
|
269
|
+
|
|
270
|
+
- [Tipos Compartilhados](./types.md)
|
|
271
|
+
- [Factory](./factory.md)
|
|
272
|
+
- [Adapters](./adapters/)
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
**VersΓ£o**: 1.0.0
|
|
277
|
+
**Criado em**: {{data_atual}}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Passo 6: Gerar types.md
|
|
281
|
+
|
|
282
|
+
```markdown
|
|
283
|
+
# π¦ Tipos Compartilhados - {{interface_name}}
|
|
284
|
+
|
|
285
|
+
## π― PropΓ³sito
|
|
286
|
+
|
|
287
|
+
Define os tipos TypeScript compartilhados entre todos os adapters, garantindo consistΓͺncia nas operaΓ§Γ΅es de entrada e saΓda.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## π§ Enums e Constantes
|
|
292
|
+
|
|
293
|
+
\`\`\`typescript
|
|
294
|
+
/**
|
|
295
|
+
* Provedores suportados.
|
|
296
|
+
*/
|
|
297
|
+
type {{interface_name.slice(1)}}Provider = '{{providers.join("' | '")}}' | 'none';
|
|
298
|
+
\`\`\`
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## π₯ Tipos de Entrada (Input)
|
|
303
|
+
|
|
304
|
+
\`\`\`typescript
|
|
305
|
+
/**
|
|
306
|
+
* TODO: Definir tipos de entrada.
|
|
307
|
+
* Exemplo:
|
|
308
|
+
*/
|
|
309
|
+
interface BaseInput {
|
|
310
|
+
/** Campo obrigatΓ³rio */
|
|
311
|
+
requiredField: string;
|
|
312
|
+
|
|
313
|
+
/** Campo opcional */
|
|
314
|
+
optionalField?: string;
|
|
315
|
+
}
|
|
316
|
+
\`\`\`
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## π€ Tipos de SaΓda (Output)
|
|
321
|
+
|
|
322
|
+
\`\`\`typescript
|
|
323
|
+
/**
|
|
324
|
+
* TODO: Definir tipos de saΓda.
|
|
325
|
+
* Exemplo:
|
|
326
|
+
*/
|
|
327
|
+
interface BaseOutput {
|
|
328
|
+
/** ID ΓΊnico */
|
|
329
|
+
id: string;
|
|
330
|
+
|
|
331
|
+
/** Provedor de origem */
|
|
332
|
+
provider: {{interface_name.slice(1)}}Provider;
|
|
333
|
+
|
|
334
|
+
/** Timestamp de criaΓ§Γ£o */
|
|
335
|
+
createdAt: string;
|
|
336
|
+
}
|
|
337
|
+
\`\`\`
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## βοΈ Tipos de ConfiguraΓ§Γ£o
|
|
342
|
+
|
|
343
|
+
\`\`\`typescript
|
|
344
|
+
/**
|
|
345
|
+
* ConfiguraΓ§Γ£o de um provedor.
|
|
346
|
+
*/
|
|
347
|
+
interface ProviderConfig {
|
|
348
|
+
/** Nome do provedor */
|
|
349
|
+
provider: {{interface_name.slice(1)}}Provider;
|
|
350
|
+
|
|
351
|
+
/** Se estΓ‘ configurado corretamente */
|
|
352
|
+
isConfigured: boolean;
|
|
353
|
+
|
|
354
|
+
/** VariΓ‘veis de ambiente obrigatΓ³rias */
|
|
355
|
+
requiredEnvVars: string[];
|
|
356
|
+
|
|
357
|
+
/** VariΓ‘veis de ambiente opcionais */
|
|
358
|
+
optionalEnvVars: string[];
|
|
359
|
+
|
|
360
|
+
/** Mensagem de erro se nΓ£o configurado */
|
|
361
|
+
errorMessage?: string;
|
|
362
|
+
}
|
|
363
|
+
\`\`\`
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
## π ReferΓͺncias
|
|
368
|
+
|
|
369
|
+
- [Interface](./interface.md)
|
|
370
|
+
- [Detector de Provedor](./detector.md)
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
**VersΓ£o**: 1.0.0
|
|
375
|
+
**Criado em**: {{data_atual}}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Passo 7: Gerar detector.md
|
|
379
|
+
|
|
380
|
+
```markdown
|
|
381
|
+
# π Detector de Provedor - {{interface_name}}
|
|
382
|
+
|
|
383
|
+
## π― PropΓ³sito
|
|
384
|
+
|
|
385
|
+
Detecta e valida o provedor configurado via variΓ‘veis de ambiente.
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## π FunΓ§Γ΅es Principais
|
|
390
|
+
|
|
391
|
+
### detectProvider()
|
|
392
|
+
|
|
393
|
+
\`\`\`typescript
|
|
394
|
+
/**
|
|
395
|
+
* Detecta o provedor configurado via variΓ‘veis de ambiente.
|
|
396
|
+
* @returns ConfiguraΓ§Γ£o do provedor ativo
|
|
397
|
+
*/
|
|
398
|
+
function detectProvider(): ProviderConfig {
|
|
399
|
+
const provider = (process.env.{{env_prefix}}_PROVIDER || 'none') as {{interface_name.slice(1)}}Provider;
|
|
400
|
+
|
|
401
|
+
const configs: Record<{{interface_name.slice(1)}}Provider, ProviderConfig> = {
|
|
402
|
+
{{#each providers}}
|
|
403
|
+
'{{this}}': {
|
|
404
|
+
provider: '{{this}}',
|
|
405
|
+
isConfigured: !!process.env.{{../env_prefix}}_{{this.toUpperCase()}}_TOKEN,
|
|
406
|
+
requiredEnvVars: ['{{../env_prefix}}_{{this.toUpperCase()}}_TOKEN'],
|
|
407
|
+
optionalEnvVars: ['{{../env_prefix}}_{{this.toUpperCase()}}_WORKSPACE'],
|
|
408
|
+
errorMessage: !process.env.{{../env_prefix}}_{{this.toUpperCase()}}_TOKEN
|
|
409
|
+
? 'β {{../env_prefix}}_{{this.toUpperCase()}}_TOKEN nΓ£o configurado'
|
|
410
|
+
: undefined
|
|
411
|
+
},
|
|
412
|
+
{{/each}}
|
|
413
|
+
|
|
414
|
+
'none': {
|
|
415
|
+
provider: 'none',
|
|
416
|
+
isConfigured: true,
|
|
417
|
+
requiredEnvVars: [],
|
|
418
|
+
optionalEnvVars: [],
|
|
419
|
+
errorMessage: undefined
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
return configs[provider] || configs.none;
|
|
424
|
+
}
|
|
425
|
+
\`\`\`
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
### checkProviderConfiguration()
|
|
430
|
+
|
|
431
|
+
\`\`\`typescript
|
|
432
|
+
/**
|
|
433
|
+
* Verifica a configuraΓ§Γ£o completa do provedor.
|
|
434
|
+
* @returns Objeto com status e mensagens
|
|
435
|
+
*/
|
|
436
|
+
function checkProviderConfiguration(): {
|
|
437
|
+
provider: {{interface_name.slice(1)}}Provider;
|
|
438
|
+
isConfigured: boolean;
|
|
439
|
+
missingVars: string[];
|
|
440
|
+
message: string;
|
|
441
|
+
} {
|
|
442
|
+
const config = detectProvider();
|
|
443
|
+
|
|
444
|
+
const missingVars = config.requiredEnvVars.filter(
|
|
445
|
+
varName => !process.env[varName]
|
|
446
|
+
);
|
|
447
|
+
|
|
448
|
+
let message: string;
|
|
449
|
+
|
|
450
|
+
if (config.provider === 'none') {
|
|
451
|
+
message = 'βΉοΈ Nenhum provedor configurado. Operando em modo offline.';
|
|
452
|
+
} else if (!config.isConfigured) {
|
|
453
|
+
message = \`β \${config.provider.toUpperCase()} nΓ£o configurado. Faltando: \${missingVars.join(', ')}\`;
|
|
454
|
+
} else {
|
|
455
|
+
message = \`β
\${config.provider.toUpperCase()} configurado corretamente.\`;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
return {
|
|
459
|
+
provider: config.provider,
|
|
460
|
+
isConfigured: config.isConfigured,
|
|
461
|
+
missingVars,
|
|
462
|
+
message
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
\`\`\`
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
## π VariΓ‘veis de Ambiente
|
|
470
|
+
|
|
471
|
+
| Provedor | VariΓ‘vel ObrigatΓ³ria | VariΓ‘veis Opcionais |
|
|
472
|
+
|----------|---------------------|---------------------|
|
|
473
|
+
{{#each providers}}
|
|
474
|
+
| {{this}} | \`{{../env_prefix}}_{{this.toUpperCase()}}_TOKEN\` | \`{{../env_prefix}}_{{this.toUpperCase()}}_WORKSPACE\` |
|
|
475
|
+
{{/each}}
|
|
476
|
+
| none | - | - |
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
## π ReferΓͺncias
|
|
481
|
+
|
|
482
|
+
- [Types](./types.md)
|
|
483
|
+
- [Factory](./factory.md)
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
**VersΓ£o**: 1.0.0
|
|
488
|
+
**Criado em**: {{data_atual}}
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
### Passo 8: Gerar factory.md
|
|
492
|
+
|
|
493
|
+
```markdown
|
|
494
|
+
# π Factory - {{interface_name}}
|
|
495
|
+
|
|
496
|
+
## π― PropΓ³sito
|
|
497
|
+
|
|
498
|
+
Fornece factory para instanciar o adapter correto baseado na configuraΓ§Γ£o do ambiente.
|
|
499
|
+
|
|
500
|
+
---
|
|
501
|
+
|
|
502
|
+
## π FunΓ§Γ£o Principal
|
|
503
|
+
|
|
504
|
+
### get{{interface_name.slice(1)}}()
|
|
505
|
+
|
|
506
|
+
\`\`\`typescript
|
|
507
|
+
/**
|
|
508
|
+
* Retorna uma instΓ’ncia do manager configurado.
|
|
509
|
+
* Baseado em {{env_prefix}}_PROVIDER no .env
|
|
510
|
+
*
|
|
511
|
+
* @param options - OpΓ§Γ΅es de configuraΓ§Γ£o (opcional)
|
|
512
|
+
* @returns InstΓ’ncia do adapter apropriado
|
|
513
|
+
*/
|
|
514
|
+
function get{{interface_name.slice(1)}}(options?: FactoryOptions): {{interface_name}} {
|
|
515
|
+
const config = detectProvider();
|
|
516
|
+
|
|
517
|
+
if (options?.debug) {
|
|
518
|
+
console.log(\`[{{interface_name}}] Provider: \${config.provider}\`);
|
|
519
|
+
console.log(\`[{{interface_name}}] Configured: \${config.isConfigured}\`);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
if (!config.isConfigured) {
|
|
523
|
+
if (options?.throwOnMisconfigured) {
|
|
524
|
+
throw new Error(config.errorMessage || 'Provider not configured');
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
console.warn(\`β οΈ \${config.errorMessage}\`);
|
|
528
|
+
console.warn(\`π‘ Continuando em modo offline...\`);
|
|
529
|
+
return new NoProviderAdapter();
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
switch (config.provider) {
|
|
533
|
+
{{#each providers}}
|
|
534
|
+
case '{{this}}':
|
|
535
|
+
return new {{this.charAt(0).toUpperCase() + this.slice(1)}}Adapter({
|
|
536
|
+
token: process.env.{{../env_prefix}}_{{this.toUpperCase()}}_TOKEN!,
|
|
537
|
+
workspace: process.env.{{../env_prefix}}_{{this.toUpperCase()}}_WORKSPACE
|
|
538
|
+
});
|
|
539
|
+
{{/each}}
|
|
540
|
+
|
|
541
|
+
case 'none':
|
|
542
|
+
default:
|
|
543
|
+
return new NoProviderAdapter();
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
\`\`\`
|
|
547
|
+
|
|
548
|
+
---
|
|
549
|
+
|
|
550
|
+
## βοΈ Tipos da Factory
|
|
551
|
+
|
|
552
|
+
\`\`\`typescript
|
|
553
|
+
/**
|
|
554
|
+
* OpΓ§Γ΅es para a factory.
|
|
555
|
+
*/
|
|
556
|
+
interface FactoryOptions {
|
|
557
|
+
/** Habilita logs de debug */
|
|
558
|
+
debug?: boolean;
|
|
559
|
+
|
|
560
|
+
/** LanΓ§a erro se provedor nΓ£o configurado */
|
|
561
|
+
throwOnMisconfigured?: boolean;
|
|
562
|
+
|
|
563
|
+
/** ForΓ§a um provedor especΓfico */
|
|
564
|
+
forceProvider?: {{interface_name.slice(1)}}Provider;
|
|
565
|
+
}
|
|
566
|
+
\`\`\`
|
|
567
|
+
|
|
568
|
+
---
|
|
569
|
+
|
|
570
|
+
## π NoProviderAdapter (Fallback)
|
|
571
|
+
|
|
572
|
+
\`\`\`typescript
|
|
573
|
+
/**
|
|
574
|
+
* Adapter de fallback quando nenhum provedor estΓ‘ configurado.
|
|
575
|
+
*/
|
|
576
|
+
class NoProviderAdapter implements {{interface_name}} {
|
|
577
|
+
readonly provider: {{interface_name.slice(1)}}Provider = 'none';
|
|
578
|
+
readonly isConfigured: boolean = false;
|
|
579
|
+
|
|
580
|
+
// TODO: Implementar mΓ©todos com comportamento offline
|
|
581
|
+
// Retornar valores sensatos ou warnings
|
|
582
|
+
|
|
583
|
+
validateConfiguration(): boolean {
|
|
584
|
+
return false;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
\`\`\`
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
## π§ͺ Exemplos de Uso
|
|
592
|
+
|
|
593
|
+
\`\`\`typescript
|
|
594
|
+
// Uso bΓ‘sico
|
|
595
|
+
const manager = get{{interface_name.slice(1)}}();
|
|
596
|
+
|
|
597
|
+
if (manager.isConfigured) {
|
|
598
|
+
// OperaΓ§Γ΅es online
|
|
599
|
+
} else {
|
|
600
|
+
console.log('β οΈ Modo offline');
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// Com validaΓ§Γ£o obrigatΓ³ria
|
|
604
|
+
try {
|
|
605
|
+
const manager = get{{interface_name.slice(1)}}({ throwOnMisconfigured: true });
|
|
606
|
+
} catch (error) {
|
|
607
|
+
console.error('β Provedor nΓ£o configurado');
|
|
608
|
+
}
|
|
609
|
+
\`\`\`
|
|
610
|
+
|
|
611
|
+
---
|
|
612
|
+
|
|
613
|
+
## π ReferΓͺncias
|
|
614
|
+
|
|
615
|
+
- [Interface](./interface.md)
|
|
616
|
+
- [Detector](./detector.md)
|
|
617
|
+
- [Adapters](./adapters/)
|
|
618
|
+
|
|
619
|
+
---
|
|
620
|
+
|
|
621
|
+
**VersΓ£o**: 1.0.0
|
|
622
|
+
**Criado em**: {{data_atual}}
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
### Passo 9: Gerar Adapters
|
|
626
|
+
|
|
627
|
+
Para cada provedor em `{{providers}}`, criar:
|
|
628
|
+
|
|
629
|
+
```markdown
|
|
630
|
+
# π΅ {{provider}} Adapter
|
|
631
|
+
|
|
632
|
+
## π― PropΓ³sito
|
|
633
|
+
|
|
634
|
+
ImplementaΓ§Γ£o do {{interface_name}} para {{provider}}.
|
|
635
|
+
|
|
636
|
+
---
|
|
637
|
+
|
|
638
|
+
## π ConfiguraΓ§Γ£o
|
|
639
|
+
|
|
640
|
+
### VariΓ‘veis de Ambiente
|
|
641
|
+
|
|
642
|
+
\`\`\`bash
|
|
643
|
+
# ObrigatΓ³ria
|
|
644
|
+
{{env_prefix}}_{{provider.toUpperCase()}}_TOKEN=xxx
|
|
645
|
+
|
|
646
|
+
# Opcionais
|
|
647
|
+
{{env_prefix}}_{{provider.toUpperCase()}}_WORKSPACE=xxx
|
|
648
|
+
\`\`\`
|
|
649
|
+
|
|
650
|
+
---
|
|
651
|
+
|
|
652
|
+
## π§ ImplementaΓ§Γ£o
|
|
653
|
+
|
|
654
|
+
\`\`\`typescript
|
|
655
|
+
/**
|
|
656
|
+
* Adapter {{provider}} implementando {{interface_name}}.
|
|
657
|
+
*/
|
|
658
|
+
class {{provider.charAt(0).toUpperCase() + provider.slice(1)}}Adapter implements {{interface_name}} {
|
|
659
|
+
readonly provider: {{interface_name.slice(1)}}Provider = '{{provider}}';
|
|
660
|
+
readonly isConfigured: boolean;
|
|
661
|
+
|
|
662
|
+
private token: string;
|
|
663
|
+
private workspace?: string;
|
|
664
|
+
|
|
665
|
+
constructor(config: {{provider.charAt(0).toUpperCase() + provider.slice(1)}}AdapterConfig) {
|
|
666
|
+
this.token = config.token;
|
|
667
|
+
this.workspace = config.workspace;
|
|
668
|
+
this.isConfigured = !!this.token;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
672
|
+
// TODO: IMPLEMENTAR MΓTODOS
|
|
673
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
674
|
+
|
|
675
|
+
validateConfiguration(): boolean {
|
|
676
|
+
return this.isConfigured;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// Adicionar mΓ©todos especΓficos...
|
|
680
|
+
}
|
|
681
|
+
\`\`\`
|
|
682
|
+
|
|
683
|
+
---
|
|
684
|
+
|
|
685
|
+
## π Mapeamento de Campos
|
|
686
|
+
|
|
687
|
+
| Interface | {{provider}} API | Notas |
|
|
688
|
+
|-----------|-----------------|-------|
|
|
689
|
+
| TODO | TODO | Mapear campos |
|
|
690
|
+
|
|
691
|
+
---
|
|
692
|
+
|
|
693
|
+
## π§ͺ Exemplos de Uso
|
|
694
|
+
|
|
695
|
+
\`\`\`typescript
|
|
696
|
+
// Via Factory (recomendado)
|
|
697
|
+
const manager = get{{interface_name.slice(1)}}();
|
|
698
|
+
|
|
699
|
+
// Direto (para testes)
|
|
700
|
+
const adapter = new {{provider.charAt(0).toUpperCase() + provider.slice(1)}}Adapter({
|
|
701
|
+
token: 'xxx',
|
|
702
|
+
workspace: 'xxx'
|
|
703
|
+
});
|
|
704
|
+
\`\`\`
|
|
705
|
+
|
|
706
|
+
---
|
|
707
|
+
|
|
708
|
+
## π ReferΓͺncias
|
|
709
|
+
|
|
710
|
+
- [Interface](../interface.md)
|
|
711
|
+
- [Types](../types.md)
|
|
712
|
+
|
|
713
|
+
---
|
|
714
|
+
|
|
715
|
+
**VersΓ£o**: 1.0.0
|
|
716
|
+
**Criado em**: {{data_atual}}
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
### Passo 10: Gerar none.md (Fallback)
|
|
720
|
+
|
|
721
|
+
```markdown
|
|
722
|
+
# βͺ NoProvider Adapter (Fallback)
|
|
723
|
+
|
|
724
|
+
## π― PropΓ³sito
|
|
725
|
+
|
|
726
|
+
Adapter de fallback que permite operaΓ§Γ£o offline quando nenhum provedor estΓ‘ configurado.
|
|
727
|
+
|
|
728
|
+
---
|
|
729
|
+
|
|
730
|
+
## π Comportamento
|
|
731
|
+
|
|
732
|
+
O NoProviderAdapter:
|
|
733
|
+
|
|
734
|
+
- β
Permite que comandos executem sem falhar
|
|
735
|
+
- β οΈ Exibe warnings quando operaΓ§Γ΅es sΓ£o tentadas
|
|
736
|
+
- π Pode gerar IDs locais para rastreamento
|
|
737
|
+
- β NΓ£o persiste dados em serviΓ§os externos
|
|
738
|
+
|
|
739
|
+
---
|
|
740
|
+
|
|
741
|
+
## π§ ImplementaΓ§Γ£o
|
|
742
|
+
|
|
743
|
+
\`\`\`typescript
|
|
744
|
+
/**
|
|
745
|
+
* Adapter de fallback - modo offline.
|
|
746
|
+
*/
|
|
747
|
+
class NoProviderAdapter implements {{interface_name}} {
|
|
748
|
+
readonly provider: {{interface_name.slice(1)}}Provider = 'none';
|
|
749
|
+
readonly isConfigured: boolean = false;
|
|
750
|
+
|
|
751
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
752
|
+
// OPERAΓΓES (warnings + fallback)
|
|
753
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
754
|
+
|
|
755
|
+
// TODO: Implementar cada mΓ©todo com:
|
|
756
|
+
// 1. console.warn('β οΈ OperaΓ§Γ£o X - modo offline');
|
|
757
|
+
// 2. Retornar valor sensato ou throw com mensagem clara
|
|
758
|
+
|
|
759
|
+
validateConfiguration(): boolean {
|
|
760
|
+
console.warn('β οΈ Nenhum provedor configurado');
|
|
761
|
+
return false;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
\`\`\`
|
|
765
|
+
|
|
766
|
+
---
|
|
767
|
+
|
|
768
|
+
## π Comportamento por OperaΓ§Γ£o
|
|
769
|
+
|
|
770
|
+
| OperaΓ§Γ£o | Comportamento Offline |
|
|
771
|
+
|----------|----------------------|
|
|
772
|
+
| Leitura | Retorna array vazio ou null |
|
|
773
|
+
| Escrita | Warning + ID local |
|
|
774
|
+
| AtualizaΓ§Γ£o | Warning + throw/false |
|
|
775
|
+
| DeleΓ§Γ£o | Warning + false |
|
|
776
|
+
|
|
777
|
+
---
|
|
778
|
+
|
|
779
|
+
## π ReferΓͺncias
|
|
780
|
+
|
|
781
|
+
- [Factory](../factory.md)
|
|
782
|
+
- [Interface](../interface.md)
|
|
783
|
+
|
|
784
|
+
---
|
|
785
|
+
|
|
786
|
+
**VersΓ£o**: 1.0.0
|
|
787
|
+
**Criado em**: {{data_atual}}
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
### Passo 11: Atualizar .env.example
|
|
791
|
+
|
|
792
|
+
Adicionar ao `.env.example`:
|
|
793
|
+
|
|
794
|
+
```bash
|
|
795
|
+
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
796
|
+
# {{interface_name.slice(1)}} Configuration
|
|
797
|
+
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
798
|
+
{{env_prefix}}_PROVIDER=none # {{providers.join(' | ')}} | none
|
|
799
|
+
|
|
800
|
+
{{#each providers}}
|
|
801
|
+
# {{this}}
|
|
802
|
+
{{../env_prefix}}_{{this.toUpperCase()}}_TOKEN=
|
|
803
|
+
{{../env_prefix}}_{{this.toUpperCase()}}_WORKSPACE=
|
|
804
|
+
|
|
805
|
+
{{/each}}
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
## π€ Output Esperado
|
|
809
|
+
|
|
810
|
+
```
|
|
811
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
812
|
+
β
ABSTRACTION LAYER CRIADA (SDAAL)
|
|
813
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
814
|
+
|
|
815
|
+
π Estrutura:
|
|
816
|
+
.cursor/utils/{{abstraction_name}}/
|
|
817
|
+
βββ README.md β
|
|
818
|
+
βββ interface.md β
|
|
819
|
+
βββ types.md β
|
|
820
|
+
βββ factory.md β
|
|
821
|
+
βββ detector.md β
|
|
822
|
+
βββ adapters/
|
|
823
|
+
{{#each providers}}
|
|
824
|
+
βββ {{this}}.md π (stub)
|
|
825
|
+
{{/each}}
|
|
826
|
+
βββ none.md β
|
|
827
|
+
|
|
828
|
+
π Detalhes:
|
|
829
|
+
β Interface: {{interface_name}}
|
|
830
|
+
β Provedores: {{providers.join(', ')}}
|
|
831
|
+
β Env Prefix: {{env_prefix}}_PROVIDER
|
|
832
|
+
|
|
833
|
+
π§ PrΓ³ximos Passos:
|
|
834
|
+
1. Definir mΓ©todos em interface.md
|
|
835
|
+
2. Adicionar tipos em types.md
|
|
836
|
+
3. Implementar adapters em adapters/
|
|
837
|
+
4. Configurar .env com {{env_prefix}}_PROVIDER
|
|
838
|
+
|
|
839
|
+
π DocumentaΓ§Γ£o:
|
|
840
|
+
β Pattern: docs/knowbase/concepts/specification-driven-ai-abstraction-layer.md
|
|
841
|
+
β Exemplo: .cursor/utils/task-manager/
|
|
842
|
+
|
|
843
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
## π ReferΓͺncias
|
|
847
|
+
|
|
848
|
+
- [SDAAL Pattern](../../docs/knowbase/concepts/specification-driven-ai-abstraction-layer.md)
|
|
849
|
+
- [Task Manager (ReferΓͺncia)](../../.cursor/utils/task-manager/)
|
|
850
|
+
- Agente: @onion
|
|
851
|
+
|
|
852
|
+
## β οΈ Notas
|
|
853
|
+
|
|
854
|
+
- Cada arquivo deve ter < 400 linhas
|
|
855
|
+
- Interface deve ser extensΓvel (Open/Closed)
|
|
856
|
+
- Sempre incluir NoProviderAdapter (fallback)
|
|
857
|
+
- Documentar variΓ‘veis de ambiente necessΓ‘rias
|
|
858
|
+
- Usar emojis e separadores ASCII para facilitar parsing por IA
|
|
859
|
+
|