@onion-architect-ai/cli 4.1.0-beta.1 → 4.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +8 -19
- 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,467 @@
|
|
|
1
|
+
# 🔵 ClickUp Adapter
|
|
2
|
+
|
|
3
|
+
## 🎯 Propósito
|
|
4
|
+
|
|
5
|
+
Implementação do `ITaskManager` para ClickUp usando o MCP (Model Context Protocol) do ClickUp.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 📋 Configuração
|
|
10
|
+
|
|
11
|
+
### Variáveis de Ambiente
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Obrigatória
|
|
15
|
+
CLICKUP_API_TOKEN=pk_xxxxx
|
|
16
|
+
|
|
17
|
+
# Opcionais
|
|
18
|
+
CLICKUP_WORKSPACE_ID=90131664218 # Auto-detectado se não informado
|
|
19
|
+
CLICKUP_DEFAULT_LIST_ID=901314121395 # Lista padrão para novas tasks
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Obter Token
|
|
23
|
+
|
|
24
|
+
1. Acesse ClickUp → Settings → Apps
|
|
25
|
+
2. Clique em "Generate" em API Token
|
|
26
|
+
3. Copie o token e adicione ao `.env`
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 🔧 Implementação
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
/**
|
|
34
|
+
* Adapter ClickUp implementando ITaskManager.
|
|
35
|
+
* Usa ClickUp MCP para todas as operações.
|
|
36
|
+
*/
|
|
37
|
+
class ClickUpAdapter implements ITaskManager {
|
|
38
|
+
readonly provider: TaskManagerProvider = 'clickup';
|
|
39
|
+
readonly isConfigured: boolean;
|
|
40
|
+
|
|
41
|
+
private apiToken: string;
|
|
42
|
+
private workspaceId?: string;
|
|
43
|
+
private defaultListId?: string;
|
|
44
|
+
|
|
45
|
+
constructor(config: ClickUpAdapterConfig) {
|
|
46
|
+
this.apiToken = config.apiToken;
|
|
47
|
+
this.workspaceId = config.workspaceId;
|
|
48
|
+
this.defaultListId = config.defaultListId;
|
|
49
|
+
this.isConfigured = !!this.apiToken;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
53
|
+
// CRUD DE TASKS
|
|
54
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
55
|
+
|
|
56
|
+
async createTask(input: CreateTaskInput): Promise<TaskOutput> {
|
|
57
|
+
const listId = input.projectId || this.defaultListId;
|
|
58
|
+
|
|
59
|
+
if (!listId) {
|
|
60
|
+
throw new Error('❌ list_id ou CLICKUP_DEFAULT_LIST_ID obrigatório');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const result = await mcp_ClickUp_clickup_create_task({
|
|
64
|
+
workspace_id: this.workspaceId,
|
|
65
|
+
list_id: listId,
|
|
66
|
+
name: input.name,
|
|
67
|
+
description: input.description,
|
|
68
|
+
markdown_description: input.markdownDescription,
|
|
69
|
+
priority: this.mapPriorityToClickUp(input.priority),
|
|
70
|
+
due_date: input.dueDate,
|
|
71
|
+
start_date: input.startDate,
|
|
72
|
+
assignees: input.assignees,
|
|
73
|
+
tags: input.tags
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
return this.normalizeTask(JSON.parse(result.content[0].text));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async getTask(taskId: string): Promise<TaskOutput> {
|
|
80
|
+
const result = await mcp_ClickUp_clickup_get_task({
|
|
81
|
+
workspace_id: this.workspaceId,
|
|
82
|
+
task_id: taskId,
|
|
83
|
+
subtasks: true
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return this.normalizeTask(JSON.parse(result.content[0].text));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async updateTask(taskId: string, updates: UpdateTaskInput): Promise<TaskOutput> {
|
|
90
|
+
const result = await mcp_ClickUp_clickup_update_task({
|
|
91
|
+
workspace_id: this.workspaceId,
|
|
92
|
+
task_id: taskId,
|
|
93
|
+
name: updates.name,
|
|
94
|
+
description: updates.description,
|
|
95
|
+
markdown_description: updates.markdownDescription,
|
|
96
|
+
status: updates.status ? this.mapStatusToClickUp(updates.status) : undefined,
|
|
97
|
+
priority: updates.priority ? this.mapPriorityToClickUp(updates.priority) : undefined,
|
|
98
|
+
due_date: updates.dueDate,
|
|
99
|
+
start_date: updates.startDate,
|
|
100
|
+
assignees: updates.assignees
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
return this.normalizeTask(JSON.parse(result.content[0].text));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async deleteTask(taskId: string): Promise<boolean> {
|
|
107
|
+
// ClickUp MCP não tem delete direto, usar update para archived
|
|
108
|
+
try {
|
|
109
|
+
await mcp_ClickUp_clickup_update_task({
|
|
110
|
+
workspace_id: this.workspaceId,
|
|
111
|
+
task_id: taskId,
|
|
112
|
+
// Arquivar como alternativa a deletar
|
|
113
|
+
});
|
|
114
|
+
return true;
|
|
115
|
+
} catch {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
121
|
+
// SUBTASKS
|
|
122
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
123
|
+
|
|
124
|
+
async createSubtask(parentId: string, input: CreateTaskInput): Promise<TaskOutput> {
|
|
125
|
+
// Primeiro, obter a lista da task pai
|
|
126
|
+
const parentTask = await this.getTask(parentId);
|
|
127
|
+
const listId = parentTask.projectId || this.defaultListId;
|
|
128
|
+
|
|
129
|
+
const result = await mcp_ClickUp_clickup_create_task({
|
|
130
|
+
workspace_id: this.workspaceId,
|
|
131
|
+
list_id: listId,
|
|
132
|
+
parent: parentId, // ← Torna subtask
|
|
133
|
+
name: input.name,
|
|
134
|
+
description: input.description,
|
|
135
|
+
markdown_description: input.markdownDescription,
|
|
136
|
+
priority: this.mapPriorityToClickUp(input.priority),
|
|
137
|
+
tags: input.tags
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
return this.normalizeTask(JSON.parse(result.content[0].text));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async getSubtasks(parentId: string): Promise<TaskOutput[]> {
|
|
144
|
+
const result = await mcp_ClickUp_clickup_get_task({
|
|
145
|
+
workspace_id: this.workspaceId,
|
|
146
|
+
task_id: parentId,
|
|
147
|
+
subtasks: true
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
const task = JSON.parse(result.content[0].text);
|
|
151
|
+
return (task.subtasks || []).map((st: any) => this.normalizeTask(st));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
155
|
+
// COMENTÁRIOS
|
|
156
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
157
|
+
|
|
158
|
+
async addComment(taskId: string, comment: string): Promise<CommentOutput> {
|
|
159
|
+
const result = await mcp_ClickUp_clickup_create_task_comment({
|
|
160
|
+
workspace_id: this.workspaceId,
|
|
161
|
+
task_id: taskId,
|
|
162
|
+
comment_text: comment
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
const data = JSON.parse(result.content[0].text);
|
|
166
|
+
return {
|
|
167
|
+
id: String(data.comment?.id || data.id),
|
|
168
|
+
text: comment,
|
|
169
|
+
author: {
|
|
170
|
+
id: String(data.comment?.user?.id || 'unknown'),
|
|
171
|
+
name: data.comment?.user?.username || 'Unknown'
|
|
172
|
+
},
|
|
173
|
+
createdAt: new Date().toISOString()
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
async getComments(taskId: string): Promise<CommentOutput[]> {
|
|
178
|
+
const result = await mcp_ClickUp_clickup_get_task_comments({
|
|
179
|
+
workspace_id: this.workspaceId,
|
|
180
|
+
task_id: taskId
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
const data = JSON.parse(result.content[0].text);
|
|
184
|
+
return (data.comments || []).map((c: any) => ({
|
|
185
|
+
id: String(c.id),
|
|
186
|
+
text: c.comment_text || c.comment,
|
|
187
|
+
author: {
|
|
188
|
+
id: String(c.user?.id || 'unknown'),
|
|
189
|
+
name: c.user?.username || 'Unknown'
|
|
190
|
+
},
|
|
191
|
+
createdAt: new Date(parseInt(c.date)).toISOString()
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
196
|
+
// STATUS
|
|
197
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
198
|
+
|
|
199
|
+
async updateStatus(taskId: string, status: TaskStatus): Promise<TaskOutput> {
|
|
200
|
+
return this.updateTask(taskId, { status });
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
204
|
+
// BUSCA
|
|
205
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
206
|
+
|
|
207
|
+
async searchTasks(query: SearchQuery): Promise<TaskOutput[]> {
|
|
208
|
+
const result = await mcp_ClickUp_clickup_search({
|
|
209
|
+
workspace_id: this.workspaceId,
|
|
210
|
+
keywords: query.text,
|
|
211
|
+
filters: {
|
|
212
|
+
asset_types: ['task']
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
const data = JSON.parse(result.content[0].text);
|
|
217
|
+
return (data.results || [])
|
|
218
|
+
.filter((r: any) => r.type === 'task')
|
|
219
|
+
.slice(0, query.limit || 50)
|
|
220
|
+
.map((r: any) => this.normalizeSearchResult(r));
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
224
|
+
// PROJETOS/LISTAS
|
|
225
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
226
|
+
|
|
227
|
+
async getProjectList(): Promise<ProjectOutput[]> {
|
|
228
|
+
const result = await mcp_ClickUp_clickup_get_workspace_hierarchy({
|
|
229
|
+
workspace_id: this.workspaceId,
|
|
230
|
+
max_depth: 2
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
const data = JSON.parse(result.content[0].text);
|
|
234
|
+
const projects: ProjectOutput[] = [];
|
|
235
|
+
|
|
236
|
+
// Extrair listas de todos os spaces
|
|
237
|
+
for (const space of data.spaces || []) {
|
|
238
|
+
for (const folder of space.folders || []) {
|
|
239
|
+
for (const list of folder.lists || []) {
|
|
240
|
+
projects.push({
|
|
241
|
+
id: list.id,
|
|
242
|
+
name: `${space.name} / ${folder.name} / ${list.name}`,
|
|
243
|
+
workspaceId: this.workspaceId
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
// Listas sem folder
|
|
248
|
+
for (const list of space.lists || []) {
|
|
249
|
+
projects.push({
|
|
250
|
+
id: list.id,
|
|
251
|
+
name: `${space.name} / ${list.name}`,
|
|
252
|
+
workspaceId: this.workspaceId
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return projects;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
async getProject(projectId: string): Promise<ProjectOutput> {
|
|
261
|
+
const result = await mcp_ClickUp_clickup_get_list({
|
|
262
|
+
workspace_id: this.workspaceId,
|
|
263
|
+
list_id: projectId
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
const data = JSON.parse(result.content[0].text);
|
|
267
|
+
return {
|
|
268
|
+
id: data.id,
|
|
269
|
+
name: data.name,
|
|
270
|
+
description: data.content,
|
|
271
|
+
workspaceId: this.workspaceId
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
276
|
+
// VALIDAÇÃO
|
|
277
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
278
|
+
|
|
279
|
+
validateTaskId(taskId: string): boolean {
|
|
280
|
+
// ClickUp IDs: 9 caracteres alfanuméricos
|
|
281
|
+
return /^[a-z0-9]{9}$/i.test(taskId);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
getProviderFromTaskId(taskId: string): TaskManagerProvider | null {
|
|
285
|
+
return this.validateTaskId(taskId) ? 'clickup' : null;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
289
|
+
// HELPERS PRIVADOS
|
|
290
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
291
|
+
|
|
292
|
+
private normalizeTask(raw: any): TaskOutput {
|
|
293
|
+
return {
|
|
294
|
+
id: raw.id,
|
|
295
|
+
provider: 'clickup',
|
|
296
|
+
name: raw.name,
|
|
297
|
+
description: raw.text_content || raw.description || '',
|
|
298
|
+
status: this.normalizeStatus(raw.status?.status),
|
|
299
|
+
statusRaw: raw.status?.status,
|
|
300
|
+
statusColor: raw.status?.color,
|
|
301
|
+
priority: this.normalizePriority(raw.priority?.priority),
|
|
302
|
+
url: raw.url,
|
|
303
|
+
createdAt: new Date(parseInt(raw.date_created)).toISOString(),
|
|
304
|
+
updatedAt: new Date(parseInt(raw.date_updated)).toISOString(),
|
|
305
|
+
dueDate: raw.due_date ? new Date(parseInt(raw.due_date)).toISOString() : undefined,
|
|
306
|
+
startDate: raw.start_date ? new Date(parseInt(raw.start_date)).toISOString() : undefined,
|
|
307
|
+
assignees: (raw.assignees || []).map((a: any) => ({
|
|
308
|
+
id: String(a.id),
|
|
309
|
+
name: a.username,
|
|
310
|
+
email: a.email
|
|
311
|
+
})),
|
|
312
|
+
tags: (raw.tags || []).map((t: any) => t.name),
|
|
313
|
+
subtasks: raw.subtasks?.map((st: any) => this.normalizeTask(st)),
|
|
314
|
+
parent: raw.parent || undefined,
|
|
315
|
+
projectId: raw.list?.id,
|
|
316
|
+
projectName: raw.list?.name,
|
|
317
|
+
timeEstimate: raw.time_estimate ? Math.round(raw.time_estimate / 60000) : undefined,
|
|
318
|
+
timeSpent: raw.time_spent ? Math.round(raw.time_spent / 60000) : undefined
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
private normalizeSearchResult(raw: any): TaskOutput {
|
|
323
|
+
return {
|
|
324
|
+
id: raw.id,
|
|
325
|
+
provider: 'clickup',
|
|
326
|
+
name: raw.name,
|
|
327
|
+
description: raw.description || '',
|
|
328
|
+
status: 'todo',
|
|
329
|
+
url: raw.url || `https://app.clickup.com/t/${raw.id}`,
|
|
330
|
+
createdAt: new Date().toISOString(),
|
|
331
|
+
updatedAt: new Date().toISOString(),
|
|
332
|
+
assignees: [],
|
|
333
|
+
tags: []
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
private normalizeStatus(clickupStatus?: string): TaskStatus {
|
|
338
|
+
const statusMap: Record<string, TaskStatus> = {
|
|
339
|
+
'backlog': 'backlog',
|
|
340
|
+
'bakclog': 'backlog', // Typo comum no ClickUp
|
|
341
|
+
'to do': 'todo',
|
|
342
|
+
'open': 'todo',
|
|
343
|
+
'in progress': 'in_progress',
|
|
344
|
+
'in review': 'review',
|
|
345
|
+
'review': 'review',
|
|
346
|
+
'done': 'done',
|
|
347
|
+
'complete': 'done',
|
|
348
|
+
'closed': 'closed'
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
return statusMap[clickupStatus?.toLowerCase() || ''] || 'todo';
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
private mapStatusToClickUp(status: TaskStatus): string {
|
|
355
|
+
const statusMap: Record<TaskStatus, string> = {
|
|
356
|
+
'backlog': 'backlog',
|
|
357
|
+
'todo': 'to do',
|
|
358
|
+
'in_progress': 'in progress',
|
|
359
|
+
'review': 'review',
|
|
360
|
+
'done': 'done',
|
|
361
|
+
'closed': 'closed',
|
|
362
|
+
'canceled': 'closed'
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
return statusMap[status] || 'to do';
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
private normalizePriority(clickupPriority?: string): TaskPriority | undefined {
|
|
369
|
+
const priorityMap: Record<string, TaskPriority> = {
|
|
370
|
+
'1': 'urgent',
|
|
371
|
+
'urgent': 'urgent',
|
|
372
|
+
'2': 'high',
|
|
373
|
+
'high': 'high',
|
|
374
|
+
'3': 'normal',
|
|
375
|
+
'normal': 'normal',
|
|
376
|
+
'4': 'low',
|
|
377
|
+
'low': 'low'
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
return priorityMap[clickupPriority?.toLowerCase() || ''];
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
private mapPriorityToClickUp(priority?: TaskPriority): string | undefined {
|
|
384
|
+
if (!priority) return undefined;
|
|
385
|
+
|
|
386
|
+
const priorityMap: Record<TaskPriority, string> = {
|
|
387
|
+
'urgent': 'urgent',
|
|
388
|
+
'high': 'high',
|
|
389
|
+
'normal': 'normal',
|
|
390
|
+
'low': 'low'
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
return priorityMap[priority];
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
## 📊 Mapeamento de Campos
|
|
401
|
+
|
|
402
|
+
### Task Fields
|
|
403
|
+
|
|
404
|
+
| Interface | ClickUp API | Notas |
|
|
405
|
+
|-----------|-------------|-------|
|
|
406
|
+
| `name` | `name` | Direto |
|
|
407
|
+
| `description` | `description` | Texto plano |
|
|
408
|
+
| `markdownDescription` | `markdown_description` | Com formatação |
|
|
409
|
+
| `status` | `status.status` | Mapeado |
|
|
410
|
+
| `priority` | `priority.priority` | Mapeado |
|
|
411
|
+
| `dueDate` | `due_date` | Timestamp ms |
|
|
412
|
+
| `assignees` | `assignees[].id` | Array de IDs |
|
|
413
|
+
| `tags` | `tags[].name` | Array de strings |
|
|
414
|
+
| `projectId` | `list.id` | ID da lista |
|
|
415
|
+
|
|
416
|
+
### Status Mapping
|
|
417
|
+
|
|
418
|
+
| Interface | ClickUp |
|
|
419
|
+
|-----------|---------|
|
|
420
|
+
| `backlog` | "backlog" |
|
|
421
|
+
| `todo` | "to do" |
|
|
422
|
+
| `in_progress` | "in progress" |
|
|
423
|
+
| `review` | "review" |
|
|
424
|
+
| `done` | "done" |
|
|
425
|
+
| `closed` | "closed" |
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
## 🧪 Exemplos de Uso
|
|
430
|
+
|
|
431
|
+
```typescript
|
|
432
|
+
// Via Factory
|
|
433
|
+
const tm = getTaskManager(); // Retorna ClickUpAdapter se configurado
|
|
434
|
+
|
|
435
|
+
// Criar task
|
|
436
|
+
const task = await tm.createTask({
|
|
437
|
+
name: 'Nova Feature',
|
|
438
|
+
description: 'Implementar funcionalidade X',
|
|
439
|
+
priority: 'high',
|
|
440
|
+
tags: ['feature', 'v2']
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
// Criar subtask
|
|
444
|
+
const subtask = await tm.createSubtask(task.id, {
|
|
445
|
+
name: 'Fase 1: Setup'
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
// Atualizar status
|
|
449
|
+
await tm.updateStatus(subtask.id, 'in_progress');
|
|
450
|
+
|
|
451
|
+
// Adicionar comentário
|
|
452
|
+
await tm.addComment(task.id, '🚀 Desenvolvimento iniciado!');
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## 📚 Referências
|
|
458
|
+
|
|
459
|
+
- [ClickUp API Docs](https://clickup.com/api)
|
|
460
|
+
- [Interface ITaskManager](../interface.md)
|
|
461
|
+
- [Types](../types.md)
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
**Versão**: 1.0.0
|
|
466
|
+
**Criado em**: 2025-11-24
|
|
467
|
+
|