@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.
- package/LICENSE +21 -0
- package/README.md +529 -0
- package/bin/onion.js +6 -0
- package/framework/CLAUDE.md +45 -0
- package/framework/VERSION +1 -0
- package/framework/agents/compliance/iso-22301-specialist.md +985 -0
- package/framework/agents/compliance/iso-27001-specialist.md +713 -0
- package/framework/agents/compliance/pmbok-specialist.md +739 -0
- package/framework/agents/compliance/security-information-master.md +907 -0
- package/framework/agents/compliance/soc2-specialist.md +889 -0
- package/framework/agents/deployment/docker-specialist.md +1192 -0
- package/framework/agents/development/c4-architecture-specialist.md +745 -0
- package/framework/agents/development/c4-documentation-specialist.md +695 -0
- package/framework/agents/development/clickup-specialist.md +396 -0
- package/framework/agents/development/cursor-specialist.md +277 -0
- package/framework/agents/development/docs-reverse-engineer.md +417 -0
- package/framework/agents/development/gamma-api-specialist.md +1168 -0
- package/framework/agents/development/gitflow-specialist.md +1206 -0
- package/framework/agents/development/linux-security-specialist.md +675 -0
- package/framework/agents/development/mermaid-specialist.md +515 -0
- package/framework/agents/development/nodejs-specialist.md +672 -0
- package/framework/agents/development/nx-migration-specialist.md +866 -0
- package/framework/agents/development/nx-monorepo-specialist.md +618 -0
- package/framework/agents/development/postgres-specialist.md +1123 -0
- package/framework/agents/development/react-developer.md +131 -0
- package/framework/agents/development/runflow-specialist.md +277 -0
- package/framework/agents/development/system-documentation-orchestrator.md +1387 -0
- package/framework/agents/development/task-specialist.md +677 -0
- package/framework/agents/git/branch-code-reviewer.md +225 -0
- package/framework/agents/git/branch-documentation-writer.md +161 -0
- package/framework/agents/git/branch-metaspec-checker.md +67 -0
- package/framework/agents/git/branch-test-planner.md +176 -0
- package/framework/agents/meta/agent-creator-specialist.md +1266 -0
- package/framework/agents/meta/command-creator-specialist.md +1676 -0
- package/framework/agents/meta/metaspec-gate-keeper.md +240 -0
- package/framework/agents/meta/onion.md +824 -0
- package/framework/agents/product/branding-positioning-specialist.md +1029 -0
- package/framework/agents/product/extract-meeting-specialist.md +394 -0
- package/framework/agents/product/meeting-consolidator.md +482 -0
- package/framework/agents/product/pain-price-specialist.md +508 -0
- package/framework/agents/product/presentation-orchestrator.md +1190 -0
- package/framework/agents/product/product-agent.md +201 -0
- package/framework/agents/product/story-points-framework-specialist.md +538 -0
- package/framework/agents/product/storytelling-business-specialist.md +890 -0
- package/framework/agents/research/research-agent.md +292 -0
- package/framework/agents/review/code-reviewer.md +154 -0
- package/framework/agents/review/corporate-compliance-specialist.md +370 -0
- package/framework/agents/testing/test-agent.md +424 -0
- package/framework/agents/testing/test-engineer.md +294 -0
- package/framework/agents/testing/test-planner.md +117 -0
- package/framework/commands/common/prompts/README.md +208 -0
- package/framework/commands/common/prompts/clickup-patterns.md +144 -0
- package/framework/commands/common/prompts/code-review-checklist.md +168 -0
- package/framework/commands/common/prompts/git-workflow-patterns.md +235 -0
- package/framework/commands/common/prompts/output-formats.md +240 -0
- package/framework/commands/common/prompts/technical.md +194 -0
- package/framework/commands/common/templates/abstraction-template.md +399 -0
- package/framework/commands/common/templates/agent-template.md +353 -0
- package/framework/commands/common/templates/business_context_template.md +748 -0
- package/framework/commands/common/templates/command-template.md +273 -0
- package/framework/commands/common/templates/technical_context_template.md +526 -0
- package/framework/commands/design/screen-spec.md +505 -0
- package/framework/commands/development/runflow-dev.md +465 -0
- package/framework/commands/docs/build-business-docs.md +299 -0
- package/framework/commands/docs/build-compliance-docs.md +143 -0
- package/framework/commands/docs/build-index.md +119 -0
- package/framework/commands/docs/build-tech-docs.md +221 -0
- package/framework/commands/docs/docs-health.md +141 -0
- package/framework/commands/docs/help.md +278 -0
- package/framework/commands/docs/refine-vision.md +25 -0
- package/framework/commands/docs/reverse-consolidate.md +158 -0
- package/framework/commands/docs/sync-sessions.md +354 -0
- package/framework/commands/docs/validate-docs.md +157 -0
- package/framework/commands/engineer/bump.md +29 -0
- package/framework/commands/engineer/docs.md +11 -0
- package/framework/commands/engineer/hotfix.md +183 -0
- package/framework/commands/engineer/plan.md +85 -0
- package/framework/commands/engineer/pr-update.md +219 -0
- package/framework/commands/engineer/pr.md +117 -0
- package/framework/commands/engineer/pre-pr.md +81 -0
- package/framework/commands/engineer/start.md +254 -0
- package/framework/commands/engineer/validate-phase-sync.md +134 -0
- package/framework/commands/engineer/warm-up.md +20 -0
- package/framework/commands/engineer/work.md +155 -0
- package/framework/commands/f/company-context-extractor.md +93 -0
- package/framework/commands/f/process-meetings.md +103 -0
- package/framework/commands/git/README.md +682 -0
- package/framework/commands/git/code-review.md +213 -0
- package/framework/commands/git/fast-commit.md +43 -0
- package/framework/commands/git/feature/finish.md +88 -0
- package/framework/commands/git/feature/publish.md +89 -0
- package/framework/commands/git/feature/start.md +172 -0
- package/framework/commands/git/help.md +100 -0
- package/framework/commands/git/hotfix/finish.md +96 -0
- package/framework/commands/git/hotfix/start.md +92 -0
- package/framework/commands/git/init.md +111 -0
- package/framework/commands/git/release/finish.md +96 -0
- package/framework/commands/git/release/start.md +93 -0
- package/framework/commands/git/sync.md +199 -0
- package/framework/commands/meta/all-tools.md +58 -0
- package/framework/commands/meta/analyze-complex-problem.md +186 -0
- package/framework/commands/meta/create-abstraction.md +882 -0
- package/framework/commands/meta/create-agent-express.md +98 -0
- package/framework/commands/meta/create-agent.md +210 -0
- package/framework/commands/meta/create-command.md +203 -0
- package/framework/commands/meta/create-knowledge-base.md +143 -0
- package/framework/commands/meta/create-task-structure.md +150 -0
- package/framework/commands/meta/setup-integration.md +274 -0
- package/framework/commands/onion.md +169 -0
- package/framework/commands/product/README.md +249 -0
- package/framework/commands/product/analyze-pain-price.md +694 -0
- package/framework/commands/product/branding.md +458 -0
- package/framework/commands/product/check.md +46 -0
- package/framework/commands/product/checklist-sync.md +239 -0
- package/framework/commands/product/collect.md +95 -0
- package/framework/commands/product/consolidate-meetings.md +291 -0
- package/framework/commands/product/estimate.md +511 -0
- package/framework/commands/product/extract-meeting.md +226 -0
- package/framework/commands/product/feature.md +416 -0
- package/framework/commands/product/light-arch.md +82 -0
- package/framework/commands/product/presentation.md +174 -0
- package/framework/commands/product/refine.md +161 -0
- package/framework/commands/product/spec.md +79 -0
- package/framework/commands/product/task-check.md +378 -0
- package/framework/commands/product/task.md +603 -0
- package/framework/commands/product/validate-task.md +325 -0
- package/framework/commands/product/warm-up.md +24 -0
- package/framework/commands/quick/analisys.md +17 -0
- package/framework/commands/test/e2e.md +377 -0
- package/framework/commands/test/integration.md +508 -0
- package/framework/commands/test/unit.md +381 -0
- package/framework/commands/validate/collab/pair-testing.md +657 -0
- package/framework/commands/validate/collab/three-amigos.md +534 -0
- package/framework/commands/validate/qa-points/estimate.md +660 -0
- package/framework/commands/validate/test-strategy/analyze.md +1201 -0
- package/framework/commands/validate/test-strategy/create.md +411 -0
- package/framework/commands/validate/workflow.md +370 -0
- package/framework/commands/warm-up.md +20 -0
- package/framework/docs/architecture/acoplamento-clickup-problema-analise.md +468 -0
- package/framework/docs/architecture/desacoplamento-roadmap.md +364 -0
- package/framework/docs/architecture/validacao-fase-1.md +235 -0
- package/framework/docs/c4/c4-detection-rules.md +395 -0
- package/framework/docs/c4/c4-documentation-templates.md +579 -0
- package/framework/docs/c4/c4-mermaid-patterns.md +331 -0
- package/framework/docs/c4/c4-templates.md +256 -0
- package/framework/docs/clickup/clickup-acceptance-criteria-strategy.md +329 -0
- package/framework/docs/clickup/clickup-auto-update-strategy.md +340 -0
- package/framework/docs/clickup/clickup-comment-formatter.md +239 -0
- package/framework/docs/clickup/clickup-description-fix.md +384 -0
- package/framework/docs/clickup/clickup-dual-comment-strategy.md +528 -0
- package/framework/docs/clickup/clickup-formatting.md +302 -0
- package/framework/docs/clickup/separador-tamanho-otimizado.md +258 -0
- package/framework/docs/engineer/pre-pr-acceptance-validation.md +256 -0
- package/framework/docs/onion/ESPERANTO.md +293 -0
- package/framework/docs/onion/agents-reference.md +832 -0
- package/framework/docs/onion/clickup-integration.md +780 -0
- package/framework/docs/onion/commands-guide.md +924 -0
- package/framework/docs/onion/engineering-flows.md +900 -0
- package/framework/docs/onion/getting-started.md +803 -0
- package/framework/docs/onion/maintenance-checklist.md +421 -0
- package/framework/docs/onion/naming-conventions.md +286 -0
- package/framework/docs/onion/practical-examples.md +854 -0
- package/framework/docs/product/story-points-integration.md +269 -0
- package/framework/docs/product/story-points-validation.md +237 -0
- package/framework/docs/reviews/task-manager-docs-review-2025-11-24.md +184 -0
- package/framework/docs/strategies/clickup-comment-patterns.md +766 -0
- package/framework/docs/strategies/clickup-integration-tests.md +602 -0
- package/framework/docs/strategies/clickup-mcp-wrappers-tests.md +888 -0
- package/framework/docs/strategies/clickup-regression-tests.md +587 -0
- package/framework/docs/strategies/visual-patterns.md +315 -0
- package/framework/docs/templates/README.md +649 -0
- package/framework/docs/templates/adr-template.md +226 -0
- package/framework/docs/templates/analysis-template.md +280 -0
- package/framework/docs/templates/execution-plan-template.md +430 -0
- package/framework/docs/templates/guide-template.md +367 -0
- package/framework/docs/templates/phase-execution-prompt-template.md +504 -0
- package/framework/docs/templates/reference-template.md +522 -0
- package/framework/docs/templates/solution-template.md +390 -0
- package/framework/docs/tools/README.md +356 -0
- package/framework/docs/tools/agents.md +365 -0
- package/framework/docs/tools/commands.md +669 -0
- package/framework/docs/tools/cursor.md +539 -0
- package/framework/docs/tools/mcps.md +937 -0
- package/framework/docs/tools/rules.md +461 -0
- package/framework/rules/language-and-documentation.mdc +371 -0
- package/framework/rules/nestjs-controllers.md +83 -0
- package/framework/rules/nestjs-dtos.md +255 -0
- package/framework/rules/nestjs-modules.md +141 -0
- package/framework/rules/nestjs-services.md +230 -0
- package/framework/rules/nx-rules.mdc +41 -0
- package/framework/rules/onion-patterns.mdc +197 -0
- package/framework/skills/codebase-visualizer/SKILL.md +26 -0
- package/framework/skills/codebase-visualizer/scripts/visualize.py +131 -0
- package/framework/skills/collect/SKILL.md +84 -0
- package/framework/skills/create-rule/SKILL.md +152 -0
- package/framework/skills/db-schema-visualizer/SKILL.md +49 -0
- package/framework/skills/db-schema-visualizer/scripts/visualize.py +1191 -0
- package/framework/skills/sync-meetings/SKILL.md +239 -0
- package/framework/utils/clickup-mcp-wrappers.md +744 -0
- package/framework/utils/date-time-standards.md +200 -0
- package/framework/utils/task-manager/README.md +94 -0
- package/framework/utils/task-manager/adapters/asana.md +377 -0
- package/framework/utils/task-manager/adapters/clickup.md +467 -0
- package/framework/utils/task-manager/adapters/linear.md +421 -0
- package/framework/utils/task-manager/detector.md +299 -0
- package/framework/utils/task-manager/factory.md +363 -0
- package/framework/utils/task-manager/interface.md +248 -0
- package/framework/utils/task-manager/types.md +409 -0
- package/package.json +41 -0
- package/src/cli.js +73 -0
- package/src/commands/doctor.js +191 -0
- package/src/commands/init.js +287 -0
- package/src/commands/install.js +261 -0
- package/src/commands/list.js +152 -0
- package/src/commands/uninstall.js +90 -0
- package/src/commands/update.js +26 -0
- package/src/utils/fs.js +89 -0
- package/src/utils/log.js +35 -0
- package/src/utils/paths.js +32 -0
- package/src/utils/prompt.js +76 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
# 🟣 Linear Adapter (Stub)
|
|
2
|
+
|
|
3
|
+
## 🎯 Propósito
|
|
4
|
+
|
|
5
|
+
Stub documentado para implementação futura do `ITaskManager` para Linear.
|
|
6
|
+
|
|
7
|
+
> ⚠️ **STUB**: Este adapter contém apenas a estrutura e documentação. A implementação completa requer desenvolvimento adicional.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 📋 Configuração
|
|
12
|
+
|
|
13
|
+
### Variáveis de Ambiente
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Obrigatória
|
|
17
|
+
LINEAR_API_KEY=lin_api_xxxxx
|
|
18
|
+
|
|
19
|
+
# Opcionais
|
|
20
|
+
LINEAR_TEAM_ID=xxxxx-xxxxx-xxxxx # Team padrão
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Obter Token
|
|
24
|
+
|
|
25
|
+
1. Acesse Linear → Settings → API → Personal API Keys
|
|
26
|
+
2. Clique em "Create key"
|
|
27
|
+
3. Copie o token e adicione ao `.env`
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 📊 API do Linear
|
|
32
|
+
|
|
33
|
+
### Endpoint
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
https://api.linear.app/graphql
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Autenticação
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
Authorization: Bearer {LINEAR_API_KEY}
|
|
43
|
+
Content-Type: application/json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 🔧 Implementação (Stub)
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
/**
|
|
52
|
+
* Adapter Linear implementando ITaskManager.
|
|
53
|
+
*
|
|
54
|
+
* ⚠️ STUB: Métodos retornam notImplemented() por padrão.
|
|
55
|
+
* Para implementação completa, usar Linear GraphQL API.
|
|
56
|
+
*/
|
|
57
|
+
class LinearAdapter implements ITaskManager {
|
|
58
|
+
readonly provider: TaskManagerProvider = 'linear';
|
|
59
|
+
readonly isConfigured: boolean;
|
|
60
|
+
|
|
61
|
+
private apiKey: string;
|
|
62
|
+
private teamId?: string;
|
|
63
|
+
|
|
64
|
+
constructor(config: LinearAdapterConfig) {
|
|
65
|
+
this.apiKey = config.apiKey;
|
|
66
|
+
this.teamId = config.teamId;
|
|
67
|
+
this.isConfigured = !!this.apiKey;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
71
|
+
// CRUD DE TASKS (ISSUES)
|
|
72
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
73
|
+
|
|
74
|
+
async createTask(input: CreateTaskInput): Promise<TaskOutput> {
|
|
75
|
+
return this.notImplemented('createTask');
|
|
76
|
+
|
|
77
|
+
// TODO: Implementar usando GraphQL mutation
|
|
78
|
+
// mutation IssueCreate($input: IssueCreateInput!) {
|
|
79
|
+
// issueCreate(input: $input) {
|
|
80
|
+
// success
|
|
81
|
+
// issue {
|
|
82
|
+
// id
|
|
83
|
+
// identifier
|
|
84
|
+
// title
|
|
85
|
+
// url
|
|
86
|
+
// }
|
|
87
|
+
// }
|
|
88
|
+
// }
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async getTask(taskId: string): Promise<TaskOutput> {
|
|
92
|
+
return this.notImplemented('getTask');
|
|
93
|
+
|
|
94
|
+
// TODO: Implementar usando GraphQL query
|
|
95
|
+
// query Issue($id: String!) {
|
|
96
|
+
// issue(id: $id) {
|
|
97
|
+
// id
|
|
98
|
+
// identifier
|
|
99
|
+
// title
|
|
100
|
+
// description
|
|
101
|
+
// state { name }
|
|
102
|
+
// priority
|
|
103
|
+
// url
|
|
104
|
+
// }
|
|
105
|
+
// }
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async updateTask(taskId: string, updates: UpdateTaskInput): Promise<TaskOutput> {
|
|
109
|
+
return this.notImplemented('updateTask');
|
|
110
|
+
|
|
111
|
+
// TODO: Implementar usando GraphQL mutation
|
|
112
|
+
// mutation IssueUpdate($id: String!, $input: IssueUpdateInput!) {
|
|
113
|
+
// issueUpdate(id: $id, input: $input) {
|
|
114
|
+
// success
|
|
115
|
+
// issue { id title }
|
|
116
|
+
// }
|
|
117
|
+
// }
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async deleteTask(taskId: string): Promise<boolean> {
|
|
121
|
+
console.warn('⚠️ Linear.deleteTask() não implementado');
|
|
122
|
+
return false;
|
|
123
|
+
|
|
124
|
+
// TODO: Linear usa archive ao invés de delete
|
|
125
|
+
// mutation IssueArchive($id: String!) {
|
|
126
|
+
// issueArchive(id: $id) { success }
|
|
127
|
+
// }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
131
|
+
// SUBTASKS (SUB-ISSUES)
|
|
132
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
133
|
+
|
|
134
|
+
async createSubtask(parentId: string, input: CreateTaskInput): Promise<TaskOutput> {
|
|
135
|
+
return this.notImplemented('createSubtask');
|
|
136
|
+
|
|
137
|
+
// TODO: Usar parentId no mutation
|
|
138
|
+
// mutation IssueCreate($input: IssueCreateInput!) {
|
|
139
|
+
// issueCreate(input: { ...input, parentId: $parentId }) { ... }
|
|
140
|
+
// }
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async getSubtasks(parentId: string): Promise<TaskOutput[]> {
|
|
144
|
+
console.warn('⚠️ Linear.getSubtasks() não implementado');
|
|
145
|
+
return [];
|
|
146
|
+
|
|
147
|
+
// TODO: Query children
|
|
148
|
+
// query Issue($id: String!) {
|
|
149
|
+
// issue(id: $id) {
|
|
150
|
+
// children { nodes { id title } }
|
|
151
|
+
// }
|
|
152
|
+
// }
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
156
|
+
// COMENTÁRIOS
|
|
157
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
158
|
+
|
|
159
|
+
async addComment(taskId: string, comment: string): Promise<CommentOutput> {
|
|
160
|
+
return this.notImplemented('addComment');
|
|
161
|
+
|
|
162
|
+
// TODO: Mutation CommentCreate
|
|
163
|
+
// mutation CommentCreate($input: CommentCreateInput!) {
|
|
164
|
+
// commentCreate(input: { issueId: $taskId, body: $comment }) {
|
|
165
|
+
// success
|
|
166
|
+
// comment { id body }
|
|
167
|
+
// }
|
|
168
|
+
// }
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async getComments(taskId: string): Promise<CommentOutput[]> {
|
|
172
|
+
console.warn('⚠️ Linear.getComments() não implementado');
|
|
173
|
+
return [];
|
|
174
|
+
|
|
175
|
+
// TODO: Query comments
|
|
176
|
+
// query Issue($id: String!) {
|
|
177
|
+
// issue(id: $id) {
|
|
178
|
+
// comments { nodes { id body user { name } } }
|
|
179
|
+
// }
|
|
180
|
+
// }
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
184
|
+
// STATUS
|
|
185
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
186
|
+
|
|
187
|
+
async updateStatus(taskId: string, status: TaskStatus): Promise<TaskOutput> {
|
|
188
|
+
return this.notImplemented('updateStatus');
|
|
189
|
+
|
|
190
|
+
// TODO: Mapear status para stateId do Linear
|
|
191
|
+
// mutation IssueUpdate($id: String!, $input: IssueUpdateInput!) {
|
|
192
|
+
// issueUpdate(id: $id, input: { stateId: $stateId }) { ... }
|
|
193
|
+
// }
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
197
|
+
// BUSCA
|
|
198
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
199
|
+
|
|
200
|
+
async searchTasks(query: SearchQuery): Promise<TaskOutput[]> {
|
|
201
|
+
console.warn('⚠️ Linear.searchTasks() não implementado');
|
|
202
|
+
return [];
|
|
203
|
+
|
|
204
|
+
// TODO: Query issues com filtro
|
|
205
|
+
// query Issues($filter: IssueFilter) {
|
|
206
|
+
// issues(filter: $filter) {
|
|
207
|
+
// nodes { id identifier title }
|
|
208
|
+
// }
|
|
209
|
+
// }
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
213
|
+
// PROJETOS (TEAMS/PROJECTS)
|
|
214
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
215
|
+
|
|
216
|
+
async getProjectList(): Promise<ProjectOutput[]> {
|
|
217
|
+
console.warn('⚠️ Linear.getProjectList() não implementado');
|
|
218
|
+
return [];
|
|
219
|
+
|
|
220
|
+
// TODO: Query teams ou projects
|
|
221
|
+
// query Teams {
|
|
222
|
+
// teams { nodes { id name } }
|
|
223
|
+
// }
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async getProject(projectId: string): Promise<ProjectOutput> {
|
|
227
|
+
return this.notImplemented('getProject');
|
|
228
|
+
|
|
229
|
+
// TODO: Query team ou project
|
|
230
|
+
// query Team($id: String!) {
|
|
231
|
+
// team(id: $id) { id name description }
|
|
232
|
+
// }
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
236
|
+
// VALIDAÇÃO
|
|
237
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
238
|
+
|
|
239
|
+
validateTaskId(taskId: string): boolean {
|
|
240
|
+
// Linear IDs:
|
|
241
|
+
// - Identifier format: ABC-123
|
|
242
|
+
// - UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
|
243
|
+
return /^[A-Z]+-\d+$/.test(taskId) ||
|
|
244
|
+
/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(taskId);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
getProviderFromTaskId(taskId: string): TaskManagerProvider | null {
|
|
248
|
+
return this.validateTaskId(taskId) ? 'linear' : null;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
252
|
+
// HELPERS
|
|
253
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
254
|
+
|
|
255
|
+
private notImplemented(method: string): never {
|
|
256
|
+
throw new Error(
|
|
257
|
+
`❌ Linear.${method}() não implementado.\n` +
|
|
258
|
+
`💡 Este é um adapter STUB. Para implementação completa:\n` +
|
|
259
|
+
` 1. Consulte a documentação: https://developers.linear.app/\n` +
|
|
260
|
+
` 2. Implemente o método usando GraphQL API\n` +
|
|
261
|
+
` 3. Teste com sua conta Linear`
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Helper para fazer requisições GraphQL ao Linear.
|
|
267
|
+
* Use este método ao implementar os métodos acima.
|
|
268
|
+
*/
|
|
269
|
+
private async graphql<T>(query: string, variables?: Record<string, any>): Promise<T> {
|
|
270
|
+
const response = await fetch('https://api.linear.app/graphql', {
|
|
271
|
+
method: 'POST',
|
|
272
|
+
headers: {
|
|
273
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
274
|
+
'Content-Type': 'application/json'
|
|
275
|
+
},
|
|
276
|
+
body: JSON.stringify({ query, variables })
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
if (!response.ok) {
|
|
280
|
+
throw new Error(`Linear API error: ${response.statusText}`);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const result = await response.json();
|
|
284
|
+
|
|
285
|
+
if (result.errors) {
|
|
286
|
+
throw new Error(`Linear GraphQL error: ${result.errors[0].message}`);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return result.data;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## 📊 Mapeamento de Conceitos
|
|
297
|
+
|
|
298
|
+
| Interface | Linear |
|
|
299
|
+
|-----------|--------|
|
|
300
|
+
| `project` | Team ou Project |
|
|
301
|
+
| `task` | Issue |
|
|
302
|
+
| `subtask` | Sub-issue (child) |
|
|
303
|
+
| `status` | State (workflow) |
|
|
304
|
+
| `comment` | Comment |
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## 🔄 Status Mapping (Exemplo)
|
|
309
|
+
|
|
310
|
+
| Interface | Linear State |
|
|
311
|
+
|-----------|--------------|
|
|
312
|
+
| `backlog` | Backlog |
|
|
313
|
+
| `todo` | Todo |
|
|
314
|
+
| `in_progress` | In Progress |
|
|
315
|
+
| `review` | In Review |
|
|
316
|
+
| `done` | Done |
|
|
317
|
+
| `canceled` | Canceled |
|
|
318
|
+
|
|
319
|
+
> ⚠️ Os estados do Linear são customizáveis por team. O mapeamento real depende da configuração do workspace.
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## 📚 Referências para Implementação
|
|
324
|
+
|
|
325
|
+
### GraphQL Queries Úteis
|
|
326
|
+
|
|
327
|
+
#### Listar Issues
|
|
328
|
+
|
|
329
|
+
```graphql
|
|
330
|
+
query Issues($teamId: String!, $first: Int) {
|
|
331
|
+
team(id: $teamId) {
|
|
332
|
+
issues(first: $first) {
|
|
333
|
+
nodes {
|
|
334
|
+
id
|
|
335
|
+
identifier
|
|
336
|
+
title
|
|
337
|
+
description
|
|
338
|
+
state { name color }
|
|
339
|
+
priority
|
|
340
|
+
url
|
|
341
|
+
createdAt
|
|
342
|
+
updatedAt
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
#### Criar Issue
|
|
350
|
+
|
|
351
|
+
```graphql
|
|
352
|
+
mutation IssueCreate($input: IssueCreateInput!) {
|
|
353
|
+
issueCreate(input: $input) {
|
|
354
|
+
success
|
|
355
|
+
issue {
|
|
356
|
+
id
|
|
357
|
+
identifier
|
|
358
|
+
title
|
|
359
|
+
url
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
#### Atualizar Issue
|
|
366
|
+
|
|
367
|
+
```graphql
|
|
368
|
+
mutation IssueUpdate($id: String!, $input: IssueUpdateInput!) {
|
|
369
|
+
issueUpdate(id: $id, input: $input) {
|
|
370
|
+
success
|
|
371
|
+
issue {
|
|
372
|
+
id
|
|
373
|
+
title
|
|
374
|
+
state { name }
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## 🚀 Como Implementar
|
|
383
|
+
|
|
384
|
+
1. **Configurar ambiente**
|
|
385
|
+
```bash
|
|
386
|
+
LINEAR_API_KEY=lin_api_xxxxx
|
|
387
|
+
LINEAR_TEAM_ID=xxxxx
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
2. **Testar conexão**
|
|
391
|
+
```typescript
|
|
392
|
+
const adapter = new LinearAdapter({ apiKey: process.env.LINEAR_API_KEY });
|
|
393
|
+
const teams = await adapter.graphql(`query { teams { nodes { id name } } }`);
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
3. **Implementar métodos**
|
|
397
|
+
- Começar por `createTask` e `getTask`
|
|
398
|
+
- Adicionar `updateTask` e `updateStatus`
|
|
399
|
+
- Implementar `addComment` e `getComments`
|
|
400
|
+
- Por último, `searchTasks` e `getProjectList`
|
|
401
|
+
|
|
402
|
+
4. **Testar com comandos**
|
|
403
|
+
```bash
|
|
404
|
+
TASK_MANAGER_PROVIDER=linear
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## 📚 Referências
|
|
410
|
+
|
|
411
|
+
- [Linear API Docs](https://developers.linear.app/)
|
|
412
|
+
- [Linear GraphQL Explorer](https://linear.app/graphql)
|
|
413
|
+
- [Interface ITaskManager](../interface.md)
|
|
414
|
+
- [Types](../types.md)
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
**Versão**: 1.0.0 (Stub)
|
|
419
|
+
**Criado em**: 2025-11-24
|
|
420
|
+
**Status**: 📝 Documentado, aguardando implementação
|
|
421
|
+
|