@chykalophia/clickup-mcp-server 3.2.0
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 +467 -0
- package/bin/clickup-mcp-server-ai.js +9 -0
- package/bin/clickup-mcp-server-basic.js +9 -0
- package/bin/clickup-mcp-server-efficiency.js +9 -0
- package/bin/clickup-mcp-server-enhanced.js +9 -0
- package/build/app.d.ts +1 -0
- package/build/app.js +2 -0
- package/build/app.js.map +1 -0
- package/build/clickup-client/attachments-enhanced.d.ts +128 -0
- package/build/clickup-client/attachments-enhanced.js +212 -0
- package/build/clickup-client/attachments-enhanced.js.map +1 -0
- package/build/clickup-client/auth.d.ts +254 -0
- package/build/clickup-client/auth.js +105 -0
- package/build/clickup-client/auth.js.map +1 -0
- package/build/clickup-client/chat-enhanced.d.ts +141 -0
- package/build/clickup-client/chat-enhanced.js +196 -0
- package/build/clickup-client/chat-enhanced.js.map +1 -0
- package/build/clickup-client/checklists.d.ts +87 -0
- package/build/clickup-client/checklists.js +63 -0
- package/build/clickup-client/checklists.js.map +1 -0
- package/build/clickup-client/comments-enhanced.d.ts +176 -0
- package/build/clickup-client/comments-enhanced.js +230 -0
- package/build/clickup-client/comments-enhanced.js.map +1 -0
- package/build/clickup-client/comments.d.ts +173 -0
- package/build/clickup-client/comments.js +312 -0
- package/build/clickup-client/comments.js.map +1 -0
- package/build/clickup-client/custom-fields-enhanced.d.ts +286 -0
- package/build/clickup-client/custom-fields-enhanced.js +416 -0
- package/build/clickup-client/custom-fields-enhanced.js.map +1 -0
- package/build/clickup-client/dependencies-enhanced.d.ts +144 -0
- package/build/clickup-client/dependencies-enhanced.js +142 -0
- package/build/clickup-client/dependencies-enhanced.js.map +1 -0
- package/build/clickup-client/docs-enhanced.d.ts +176 -0
- package/build/clickup-client/docs-enhanced.js +374 -0
- package/build/clickup-client/docs-enhanced.js.map +1 -0
- package/build/clickup-client/docs.d.ts +84 -0
- package/build/clickup-client/docs.js +156 -0
- package/build/clickup-client/docs.js.map +1 -0
- package/build/clickup-client/folders.d.ts +62 -0
- package/build/clickup-client/folders.js +53 -0
- package/build/clickup-client/folders.js.map +1 -0
- package/build/clickup-client/goals-enhanced.d.ts +163 -0
- package/build/clickup-client/goals-enhanced.js +309 -0
- package/build/clickup-client/goals-enhanced.js.map +1 -0
- package/build/clickup-client/index.d.ts +16 -0
- package/build/clickup-client/index.js +61 -0
- package/build/clickup-client/index.js.map +1 -0
- package/build/clickup-client/lists.d.ts +105 -0
- package/build/clickup-client/lists.js +108 -0
- package/build/clickup-client/lists.js.map +1 -0
- package/build/clickup-client/secure-client.d.ts +88 -0
- package/build/clickup-client/secure-client.js +275 -0
- package/build/clickup-client/secure-client.js.map +1 -0
- package/build/clickup-client/spaces.d.ts +58 -0
- package/build/clickup-client/spaces.js +28 -0
- package/build/clickup-client/spaces.js.map +1 -0
- package/build/clickup-client/tasks.d.ts +161 -0
- package/build/clickup-client/tasks.js +99 -0
- package/build/clickup-client/tasks.js.map +1 -0
- package/build/clickup-client/time-tracking-enhanced.d.ts +153 -0
- package/build/clickup-client/time-tracking-enhanced.js +292 -0
- package/build/clickup-client/time-tracking-enhanced.js.map +1 -0
- package/build/clickup-client/views-enhanced.d.ts +149 -0
- package/build/clickup-client/views-enhanced.js +210 -0
- package/build/clickup-client/views-enhanced.js.map +1 -0
- package/build/clickup-client/webhooks-enhanced.d.ts +119 -0
- package/build/clickup-client/webhooks-enhanced.js +169 -0
- package/build/clickup-client/webhooks-enhanced.js.map +1 -0
- package/build/controllers/lists.controller.d.ts +1 -0
- package/build/controllers/lists.controller.js +2 -0
- package/build/controllers/lists.controller.js.map +1 -0
- package/build/index-efficiency-simple.d.ts +2 -0
- package/build/index-efficiency-simple.js +379 -0
- package/build/index-efficiency-simple.js.map +1 -0
- package/build/index-enhanced-efficiency.d.ts +2 -0
- package/build/index-enhanced-efficiency.js +275 -0
- package/build/index-enhanced-efficiency.js.map +1 -0
- package/build/index-enhanced.d.ts +2 -0
- package/build/index-enhanced.js +74 -0
- package/build/index-enhanced.js.map +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +77 -0
- package/build/index.js.map +1 -0
- package/build/resources/checklist-resources.d.ts +2 -0
- package/build/resources/checklist-resources.js +102 -0
- package/build/resources/checklist-resources.js.map +1 -0
- package/build/resources/comment-resources.d.ts +2 -0
- package/build/resources/comment-resources.js +152 -0
- package/build/resources/comment-resources.js.map +1 -0
- package/build/resources/doc-resources.d.ts +2 -0
- package/build/resources/doc-resources.js +77 -0
- package/build/resources/doc-resources.js.map +1 -0
- package/build/resources/folder-resources.d.ts +2 -0
- package/build/resources/folder-resources.js +160 -0
- package/build/resources/folder-resources.js.map +1 -0
- package/build/resources/list-resources.d.ts +2 -0
- package/build/resources/list-resources.js +104 -0
- package/build/resources/list-resources.js.map +1 -0
- package/build/resources/space-resources.d.ts +2 -0
- package/build/resources/space-resources.js +104 -0
- package/build/resources/space-resources.js.map +1 -0
- package/build/resources/task-resources.d.ts +2 -0
- package/build/resources/task-resources.js +57 -0
- package/build/resources/task-resources.js.map +1 -0
- package/build/routes/lists.routes.d.ts +1 -0
- package/build/routes/lists.routes.js +2 -0
- package/build/routes/lists.routes.js.map +1 -0
- package/build/schemas/attachments-schemas.d.ts +201 -0
- package/build/schemas/attachments-schemas.js +250 -0
- package/build/schemas/attachments-schemas.js.map +1 -0
- package/build/schemas/chat-schemas.d.ts +478 -0
- package/build/schemas/chat-schemas.js +173 -0
- package/build/schemas/chat-schemas.js.map +1 -0
- package/build/schemas/custom-field-schemas.d.ts +1617 -0
- package/build/schemas/custom-field-schemas.js +384 -0
- package/build/schemas/custom-field-schemas.js.map +1 -0
- package/build/schemas/dependencies-schemas.d.ts +274 -0
- package/build/schemas/dependencies-schemas.js +176 -0
- package/build/schemas/dependencies-schemas.js.map +1 -0
- package/build/schemas/document-schemas.d.ts +433 -0
- package/build/schemas/document-schemas.js +168 -0
- package/build/schemas/document-schemas.js.map +1 -0
- package/build/schemas/goals-schemas.d.ts +961 -0
- package/build/schemas/goals-schemas.js +293 -0
- package/build/schemas/goals-schemas.js.map +1 -0
- package/build/schemas/time-tracking-schemas.d.ts +741 -0
- package/build/schemas/time-tracking-schemas.js +234 -0
- package/build/schemas/time-tracking-schemas.js.map +1 -0
- package/build/schemas/views-schemas.d.ts +1168 -0
- package/build/schemas/views-schemas.js +221 -0
- package/build/schemas/views-schemas.js.map +1 -0
- package/build/schemas/webhook-schemas.d.ts +1127 -0
- package/build/schemas/webhook-schemas.js +137 -0
- package/build/schemas/webhook-schemas.js.map +1 -0
- package/build/services/lists.service.d.ts +1 -0
- package/build/services/lists.service.js +2 -0
- package/build/services/lists.service.js.map +1 -0
- package/build/tools/attachments-tools-setup.d.ts +2 -0
- package/build/tools/attachments-tools-setup.js +387 -0
- package/build/tools/attachments-tools-setup.js.map +1 -0
- package/build/tools/chat-tools-enhanced.d.ts +5 -0
- package/build/tools/chat-tools-enhanced.js +396 -0
- package/build/tools/chat-tools-enhanced.js.map +1 -0
- package/build/tools/chat-tools.d.ts +2 -0
- package/build/tools/chat-tools.js +614 -0
- package/build/tools/chat-tools.js.map +1 -0
- package/build/tools/checklist-tools.d.ts +2 -0
- package/build/tools/checklist-tools.js +139 -0
- package/build/tools/checklist-tools.js.map +1 -0
- package/build/tools/comment-tools.d.ts +2 -0
- package/build/tools/comment-tools.js +295 -0
- package/build/tools/comment-tools.js.map +1 -0
- package/build/tools/custom-field-tools.d.ts +2 -0
- package/build/tools/custom-field-tools.js +578 -0
- package/build/tools/custom-field-tools.js.map +1 -0
- package/build/tools/dependencies-tools-setup.d.ts +2 -0
- package/build/tools/dependencies-tools-setup.js +319 -0
- package/build/tools/dependencies-tools-setup.js.map +1 -0
- package/build/tools/doc-tools-enhanced.d.ts +2 -0
- package/build/tools/doc-tools-enhanced.js +417 -0
- package/build/tools/doc-tools-enhanced.js.map +1 -0
- package/build/tools/doc-tools.d.ts +2 -0
- package/build/tools/doc-tools.js +109 -0
- package/build/tools/doc-tools.js.map +1 -0
- package/build/tools/goals-tools.d.ts +2 -0
- package/build/tools/goals-tools.js +422 -0
- package/build/tools/goals-tools.js.map +1 -0
- package/build/tools/helper-tools.d.ts +2 -0
- package/build/tools/helper-tools.js +363 -0
- package/build/tools/helper-tools.js.map +1 -0
- package/build/tools/space-tools.d.ts +2 -0
- package/build/tools/space-tools.js +45 -0
- package/build/tools/space-tools.js.map +1 -0
- package/build/tools/task-tools.d.ts +2 -0
- package/build/tools/task-tools.js +415 -0
- package/build/tools/task-tools.js.map +1 -0
- package/build/tools/time-tracking-tools.d.ts +2 -0
- package/build/tools/time-tracking-tools.js +329 -0
- package/build/tools/time-tracking-tools.js.map +1 -0
- package/build/tools/views-tools-setup.d.ts +2 -0
- package/build/tools/views-tools-setup.js +358 -0
- package/build/tools/views-tools-setup.js.map +1 -0
- package/build/tools/webhook-tools-setup.d.ts +2 -0
- package/build/tools/webhook-tools-setup.js +304 -0
- package/build/tools/webhook-tools-setup.js.map +1 -0
- package/build/tools/webhook-tools.d.ts +4 -0
- package/build/tools/webhook-tools.js +345 -0
- package/build/tools/webhook-tools.js.map +1 -0
- package/build/utils/clickup-comment-formatter.d.ts +124 -0
- package/build/utils/clickup-comment-formatter.js +504 -0
- package/build/utils/clickup-comment-formatter.js.map +1 -0
- package/build/utils/context-aware-suggestions.d.ts +45 -0
- package/build/utils/context-aware-suggestions.js +360 -0
- package/build/utils/context-aware-suggestions.js.map +1 -0
- package/build/utils/error-handling.d.ts +140 -0
- package/build/utils/error-handling.js +392 -0
- package/build/utils/error-handling.js.map +1 -0
- package/build/utils/markdown-styling.d.ts +40 -0
- package/build/utils/markdown-styling.js +344 -0
- package/build/utils/markdown-styling.js.map +1 -0
- package/build/utils/markdown.d.ts +54 -0
- package/build/utils/markdown.js +243 -0
- package/build/utils/markdown.js.map +1 -0
- package/build/utils/security.d.ts +79 -0
- package/build/utils/security.js +303 -0
- package/build/utils/security.js.map +1 -0
- package/build/utils/tool-efficiency.d.ts +59 -0
- package/build/utils/tool-efficiency.js +247 -0
- package/build/utils/tool-efficiency.js.map +1 -0
- package/package.json +130 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { processClickUpResponse } from '../utils/markdown.js';
|
|
2
|
+
import { prepareCommentForClickUp, clickUpCommentToMarkdown } from '../utils/clickup-comment-formatter.js';
|
|
3
|
+
export class CommentsClient {
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Get comments for a specific task
|
|
9
|
+
* @param taskId The ID of the task to get comments for
|
|
10
|
+
* @param params Optional parameters for pagination
|
|
11
|
+
* @returns A list of comments with processed content
|
|
12
|
+
*/
|
|
13
|
+
async getTaskComments(taskId, params) {
|
|
14
|
+
const result = await this.client.get(`/task/${taskId}/comment`, params);
|
|
15
|
+
// Process each comment's content
|
|
16
|
+
if (result.comments && Array.isArray(result.comments)) {
|
|
17
|
+
result.comments = result.comments.map((comment) => {
|
|
18
|
+
const processed = processClickUpResponse(comment);
|
|
19
|
+
// Convert ClickUp comment format to markdown for display
|
|
20
|
+
if (processed.comment && Array.isArray(processed.comment)) {
|
|
21
|
+
try {
|
|
22
|
+
processed.comment_markdown = clickUpCommentToMarkdown({ comment: processed.comment });
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
console.warn('Failed to convert ClickUp comment to markdown:', error);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return processed;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Clean up ClickUp comment response by removing duplicate text blocks
|
|
35
|
+
* ClickUp automatically appends original text as final block - we remove it
|
|
36
|
+
*/
|
|
37
|
+
cleanupCommentResponse(processed) {
|
|
38
|
+
if (processed.comment && Array.isArray(processed.comment) && processed.comment.length > 1) {
|
|
39
|
+
const lastBlock = processed.comment[processed.comment.length - 1];
|
|
40
|
+
// Check if the last block is a duplicate of the original markdown
|
|
41
|
+
if (lastBlock && typeof lastBlock.text === 'string' &&
|
|
42
|
+
(!lastBlock.attributes || Object.keys(lastBlock.attributes).length === 0)) {
|
|
43
|
+
// If the last block contains markdown syntax, it's likely the duplicate
|
|
44
|
+
const hasMarkdownSyntax = /[*_`#[\]()>-]/.test(lastBlock.text) ||
|
|
45
|
+
lastBlock.text.includes('```') ||
|
|
46
|
+
lastBlock.text.includes('**') ||
|
|
47
|
+
lastBlock.text.includes('##');
|
|
48
|
+
if (hasMarkdownSyntax && lastBlock.text.length > 50) {
|
|
49
|
+
// Remove the duplicate block
|
|
50
|
+
processed.comment = processed.comment.slice(0, -1);
|
|
51
|
+
// Also clean up the comment_text field
|
|
52
|
+
if (processed.comment_text && processed.comment_text.includes(lastBlock.text)) {
|
|
53
|
+
processed.comment_text = processed.comment_text.replace(lastBlock.text, '').trim();
|
|
54
|
+
}
|
|
55
|
+
// Regenerate clean comment_markdown
|
|
56
|
+
if (processed.comment && Array.isArray(processed.comment)) {
|
|
57
|
+
try {
|
|
58
|
+
processed.comment_markdown = clickUpCommentToMarkdown({ comment: processed.comment });
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.warn('Failed to regenerate clean comment markdown:', error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return processed;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create a new comment on a task
|
|
71
|
+
* @param taskId The ID of the task to comment on
|
|
72
|
+
* @param params The comment parameters (supports markdown in comment_text)
|
|
73
|
+
* @returns The created comment with processed content
|
|
74
|
+
*/
|
|
75
|
+
async createTaskComment(taskId, params) {
|
|
76
|
+
// Use ONLY structured format - no comment_text to avoid duplication
|
|
77
|
+
const processedParams = { ...params };
|
|
78
|
+
if (params.comment_text) {
|
|
79
|
+
const commentData = prepareCommentForClickUp(params.comment_text);
|
|
80
|
+
// Send ONLY structured format - remove comment_text completely
|
|
81
|
+
delete processedParams.comment_text;
|
|
82
|
+
processedParams.comment = commentData.comment;
|
|
83
|
+
// Remove any other text fields to prevent conflicts
|
|
84
|
+
delete processedParams.text;
|
|
85
|
+
delete processedParams.description;
|
|
86
|
+
}
|
|
87
|
+
const result = await this.client.post(`/task/${taskId}/comment`, processedParams);
|
|
88
|
+
// Process the response
|
|
89
|
+
let processed = processClickUpResponse(result);
|
|
90
|
+
// Clean up ClickUp's duplicate text blocks
|
|
91
|
+
processed = this.cleanupCommentResponse(processed);
|
|
92
|
+
return processed;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get comments for a chat view
|
|
96
|
+
* @param viewId The ID of the chat view to get comments for
|
|
97
|
+
* @param params Optional parameters for pagination
|
|
98
|
+
* @returns A list of comments with processed content
|
|
99
|
+
*/
|
|
100
|
+
async getChatViewComments(viewId, params) {
|
|
101
|
+
const result = await this.client.get(`/view/${viewId}/comment`, params);
|
|
102
|
+
// Process each comment's content
|
|
103
|
+
if (result.comments && Array.isArray(result.comments)) {
|
|
104
|
+
result.comments = result.comments.map((comment) => {
|
|
105
|
+
const processed = processClickUpResponse(comment);
|
|
106
|
+
// Convert ClickUp comment format to markdown for display
|
|
107
|
+
if (processed.comment && Array.isArray(processed.comment)) {
|
|
108
|
+
try {
|
|
109
|
+
processed.comment_markdown = clickUpCommentToMarkdown({ comment: processed.comment });
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
console.warn('Failed to convert ClickUp comment to markdown:', error);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return processed;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return result;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Create a new comment on a chat view
|
|
122
|
+
* @param viewId The ID of the chat view to comment on
|
|
123
|
+
* @param params The comment parameters (supports markdown in comment_text)
|
|
124
|
+
* @returns The created comment with processed content
|
|
125
|
+
*/
|
|
126
|
+
async createChatViewComment(viewId, params) {
|
|
127
|
+
// Use ONLY structured format - no comment_text to avoid duplication
|
|
128
|
+
const processedParams = { ...params };
|
|
129
|
+
if (params.comment_text) {
|
|
130
|
+
const commentData = prepareCommentForClickUp(params.comment_text);
|
|
131
|
+
// Send ONLY structured format - remove comment_text completely
|
|
132
|
+
delete processedParams.comment_text;
|
|
133
|
+
processedParams.comment = commentData.comment;
|
|
134
|
+
// Remove any other text fields to prevent conflicts
|
|
135
|
+
delete processedParams.text;
|
|
136
|
+
delete processedParams.description;
|
|
137
|
+
}
|
|
138
|
+
const result = await this.client.post(`/view/${viewId}/comment`, processedParams);
|
|
139
|
+
// Process the response
|
|
140
|
+
const processed = processClickUpResponse(result);
|
|
141
|
+
// Convert ClickUp comment format to markdown for display
|
|
142
|
+
if (processed.comment && Array.isArray(processed.comment)) {
|
|
143
|
+
try {
|
|
144
|
+
processed.comment_markdown = clickUpCommentToMarkdown({ comment: processed.comment });
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
console.warn('Failed to convert ClickUp comment to markdown:', error);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return processed;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Get comments for a list
|
|
154
|
+
* @param listId The ID of the list to get comments for
|
|
155
|
+
* @param params Optional parameters for pagination
|
|
156
|
+
* @returns A list of comments with processed content
|
|
157
|
+
*/
|
|
158
|
+
async getListComments(listId, params) {
|
|
159
|
+
const result = await this.client.get(`/list/${listId}/comment`, params);
|
|
160
|
+
// Process each comment's content
|
|
161
|
+
if (result.comments && Array.isArray(result.comments)) {
|
|
162
|
+
result.comments = result.comments.map((comment) => {
|
|
163
|
+
const processed = processClickUpResponse(comment);
|
|
164
|
+
// Convert ClickUp comment format to markdown for display
|
|
165
|
+
if (processed.comment && Array.isArray(processed.comment)) {
|
|
166
|
+
try {
|
|
167
|
+
processed.comment_markdown = clickUpCommentToMarkdown({ comment: processed.comment });
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
console.warn('Failed to convert ClickUp comment to markdown:', error);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return processed;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return result;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Create a new comment on a list
|
|
180
|
+
* @param listId The ID of the list to comment on
|
|
181
|
+
* @param params The comment parameters (supports markdown in comment_text)
|
|
182
|
+
* @returns The created comment with processed content
|
|
183
|
+
*/
|
|
184
|
+
async createListComment(listId, params) {
|
|
185
|
+
// Use ONLY structured format - no comment_text to avoid duplication
|
|
186
|
+
const processedParams = { ...params };
|
|
187
|
+
if (params.comment_text) {
|
|
188
|
+
const commentData = prepareCommentForClickUp(params.comment_text);
|
|
189
|
+
// Send ONLY structured format - remove comment_text completely
|
|
190
|
+
delete processedParams.comment_text;
|
|
191
|
+
processedParams.comment = commentData.comment;
|
|
192
|
+
// Remove any other text fields to prevent conflicts
|
|
193
|
+
delete processedParams.text;
|
|
194
|
+
delete processedParams.description;
|
|
195
|
+
}
|
|
196
|
+
const result = await this.client.post(`/list/${listId}/comment`, processedParams);
|
|
197
|
+
// Process the response
|
|
198
|
+
const processed = processClickUpResponse(result);
|
|
199
|
+
// Convert ClickUp comment format to markdown for display
|
|
200
|
+
if (processed.comment && Array.isArray(processed.comment)) {
|
|
201
|
+
try {
|
|
202
|
+
processed.comment_markdown = clickUpCommentToMarkdown({ comment: processed.comment });
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
console.warn('Failed to convert ClickUp comment to markdown:', error);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return processed;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Update an existing comment
|
|
212
|
+
* @param commentId The ID of the comment to update
|
|
213
|
+
* @param params The comment parameters to update (supports markdown in comment_text)
|
|
214
|
+
* @returns The updated comment with processed content
|
|
215
|
+
*/
|
|
216
|
+
async updateComment(commentId, params) {
|
|
217
|
+
// Use ONLY structured format - no comment_text to avoid duplication
|
|
218
|
+
const processedParams = { ...params };
|
|
219
|
+
if (params.comment_text) {
|
|
220
|
+
const commentData = prepareCommentForClickUp(params.comment_text);
|
|
221
|
+
// Send ONLY structured format - remove comment_text completely
|
|
222
|
+
delete processedParams.comment_text;
|
|
223
|
+
processedParams.comment = commentData.comment;
|
|
224
|
+
// Remove any other text fields to prevent conflicts
|
|
225
|
+
delete processedParams.text;
|
|
226
|
+
delete processedParams.description;
|
|
227
|
+
}
|
|
228
|
+
const result = await this.client.put(`/comment/${commentId}`, processedParams);
|
|
229
|
+
// Process the response
|
|
230
|
+
const processed = processClickUpResponse(result);
|
|
231
|
+
// Convert ClickUp comment format to markdown for display
|
|
232
|
+
if (processed.comment && Array.isArray(processed.comment)) {
|
|
233
|
+
try {
|
|
234
|
+
processed.comment_markdown = clickUpCommentToMarkdown({ comment: processed.comment });
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
console.warn('Failed to convert ClickUp comment to markdown:', error);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return processed;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Delete a comment
|
|
244
|
+
* @param commentId The ID of the comment to delete
|
|
245
|
+
* @returns Success message
|
|
246
|
+
*/
|
|
247
|
+
async deleteComment(commentId) {
|
|
248
|
+
return this.client.delete(`/comment/${commentId}`);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Get threaded comments for a parent comment
|
|
252
|
+
* @param commentId The ID of the parent comment
|
|
253
|
+
* @param params Optional parameters for pagination
|
|
254
|
+
* @returns A list of threaded comments with processed content
|
|
255
|
+
*/
|
|
256
|
+
async getThreadedComments(commentId, params) {
|
|
257
|
+
const result = await this.client.get(`/comment/${commentId}/reply`, params);
|
|
258
|
+
// Process each comment's content
|
|
259
|
+
if (result.comments && Array.isArray(result.comments)) {
|
|
260
|
+
result.comments = result.comments.map((comment) => {
|
|
261
|
+
const processed = processClickUpResponse(comment);
|
|
262
|
+
// Convert ClickUp comment format to markdown for display
|
|
263
|
+
if (processed.comment && Array.isArray(processed.comment)) {
|
|
264
|
+
try {
|
|
265
|
+
processed.comment_markdown = clickUpCommentToMarkdown({ comment: processed.comment });
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
console.warn('Failed to convert ClickUp comment to markdown:', error);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return processed;
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
return result;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Create a new threaded comment on a parent comment
|
|
278
|
+
* @param commentId The ID of the parent comment
|
|
279
|
+
* @param params The comment parameters (supports markdown in comment_text)
|
|
280
|
+
* @returns The created threaded comment with processed content
|
|
281
|
+
*/
|
|
282
|
+
async createThreadedComment(commentId, params) {
|
|
283
|
+
// Process comment text for ClickUp's structured format ONLY
|
|
284
|
+
const processedParams = { ...params };
|
|
285
|
+
if (params.comment_text) {
|
|
286
|
+
const commentData = prepareCommentForClickUp(params.comment_text);
|
|
287
|
+
// Use ONLY ClickUp's structured comment format - no comment_text at all
|
|
288
|
+
delete processedParams.comment_text;
|
|
289
|
+
processedParams.comment = commentData.comment;
|
|
290
|
+
// Remove any other text fields to prevent ClickUp auto-detection
|
|
291
|
+
delete processedParams.text;
|
|
292
|
+
delete processedParams.description;
|
|
293
|
+
}
|
|
294
|
+
const result = await this.client.post(`/comment/${commentId}/reply`, processedParams);
|
|
295
|
+
// Process the response
|
|
296
|
+
const processed = processClickUpResponse(result);
|
|
297
|
+
// Convert ClickUp comment format to markdown for display
|
|
298
|
+
if (processed.comment && Array.isArray(processed.comment)) {
|
|
299
|
+
try {
|
|
300
|
+
processed.comment_markdown = clickUpCommentToMarkdown({ comment: processed.comment });
|
|
301
|
+
}
|
|
302
|
+
catch (error) {
|
|
303
|
+
console.warn('Failed to convert ClickUp comment to markdown:', error);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return processed;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
export const createCommentsClient = (client) => {
|
|
310
|
+
return new CommentsClient(client);
|
|
311
|
+
};
|
|
312
|
+
//# sourceMappingURL=comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.js","sourceRoot":"","sources":["../../src/clickup-client/comments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAuB,MAAM,uCAAuC,CAAC;AA8FhI,MAAM,OAAO,cAAc;IAGzB,YAAY,MAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CAAC,MAAc,EAAE,MAA8B;QAClE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,UAAU,EAAE,MAAM,CAAC,CAAC;QAExE,iCAAiC;QACjC,IAAI,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtD,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAY,EAAE,EAAE;gBACrD,MAAM,SAAS,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;gBAElD,yDAAyD;gBACzD,IAAI,SAAS,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;oBAC1D,IAAI,CAAC;wBACH,SAAS,CAAC,gBAAgB,GAAG,wBAAwB,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;oBACxF,CAAC;oBAAC,OAAO,KAAK,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QAC5D,MAAM,eAAe,GAAQ,EAAE,GAAG,MAAM,EAAE,CAAC;QAC3C,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;YACxB,MAAM,WAAW,GAAG,wBAAwB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YAElE,wEAAwE;YACxE,OAAO,eAAe,CAAC,YAAY,CAAC;YACpC,eAAe,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;YAE9C,iEAAiE;YACjE,OAAO,eAAe,CAAC,IAAI,CAAC;YAC5B,OAAO,eAAe,CAAC,WAAW,CAAC;QACrC,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,SAAS,QAAQ,EAAE,eAAe,CAAC,CAAC;QAEtF,uBAAuB;QACvB,MAAM,SAAS,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;QAEjD,yDAAyD;QACzD,IAAI,SAAS,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1D,IAAI,CAAC;gBACH,SAAS,CAAC,gBAAgB,GAAG,wBAAwB,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;YACxF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,gDAAgD,EAAE,KAAK,CAAC,CAAC;YACxE,CAAC;QACH,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAqB,EAAkB,EAAE;IAC5E,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC,CAAC"}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { ClickUpClient } from './index.js';
|
|
2
|
+
export type CustomFieldType = 'text' | 'textarea' | 'number' | 'currency' | 'date' | 'drop_down' | 'labels' | 'checkbox' | 'url' | 'email' | 'phone' | 'rating' | 'progress' | 'task_relationship';
|
|
3
|
+
export interface BaseCustomField {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
type: CustomFieldType;
|
|
7
|
+
date_created: string;
|
|
8
|
+
hide_from_guests: boolean;
|
|
9
|
+
required: boolean;
|
|
10
|
+
type_config: Record<string, any>;
|
|
11
|
+
}
|
|
12
|
+
export interface ShortTextField extends BaseCustomField {
|
|
13
|
+
type: 'text';
|
|
14
|
+
type_config: {
|
|
15
|
+
default?: string;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface LongTextField extends BaseCustomField {
|
|
20
|
+
type: 'textarea';
|
|
21
|
+
type_config: {
|
|
22
|
+
default?: string;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface NumberField extends BaseCustomField {
|
|
27
|
+
type: 'number';
|
|
28
|
+
type_config: {
|
|
29
|
+
default?: number;
|
|
30
|
+
precision?: number;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface CurrencyField extends BaseCustomField {
|
|
34
|
+
type: 'currency';
|
|
35
|
+
type_config: {
|
|
36
|
+
default?: number;
|
|
37
|
+
precision?: number;
|
|
38
|
+
currency_type?: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface DateField extends BaseCustomField {
|
|
42
|
+
type: 'date';
|
|
43
|
+
type_config: {
|
|
44
|
+
default?: number;
|
|
45
|
+
include_time?: boolean;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export interface DropdownOption {
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
color?: string;
|
|
52
|
+
orderindex: number;
|
|
53
|
+
}
|
|
54
|
+
export interface DropdownField extends BaseCustomField {
|
|
55
|
+
type: 'drop_down';
|
|
56
|
+
type_config: {
|
|
57
|
+
default?: number;
|
|
58
|
+
options: DropdownOption[];
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface LabelsField extends BaseCustomField {
|
|
62
|
+
type: 'labels';
|
|
63
|
+
type_config: {
|
|
64
|
+
options: DropdownOption[];
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface CheckboxField extends BaseCustomField {
|
|
68
|
+
type: 'checkbox';
|
|
69
|
+
type_config: {
|
|
70
|
+
default?: boolean;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export interface URLField extends BaseCustomField {
|
|
74
|
+
type: 'url';
|
|
75
|
+
type_config: {
|
|
76
|
+
default?: string;
|
|
77
|
+
placeholder?: string;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export interface EmailField extends BaseCustomField {
|
|
81
|
+
type: 'email';
|
|
82
|
+
type_config: {
|
|
83
|
+
default?: string;
|
|
84
|
+
placeholder?: string;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export interface PhoneField extends BaseCustomField {
|
|
88
|
+
type: 'phone';
|
|
89
|
+
type_config: {
|
|
90
|
+
default?: string;
|
|
91
|
+
placeholder?: string;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export interface RatingField extends BaseCustomField {
|
|
95
|
+
type: 'rating';
|
|
96
|
+
type_config: {
|
|
97
|
+
default?: number;
|
|
98
|
+
count: number;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export interface ProgressField extends BaseCustomField {
|
|
102
|
+
type: 'progress';
|
|
103
|
+
type_config: {
|
|
104
|
+
default?: number;
|
|
105
|
+
start?: number;
|
|
106
|
+
end?: number;
|
|
107
|
+
unit?: string;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export interface TaskRelationshipField extends BaseCustomField {
|
|
111
|
+
type: 'task_relationship';
|
|
112
|
+
type_config: {
|
|
113
|
+
multiple?: boolean;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export type CustomField = ShortTextField | LongTextField | NumberField | CurrencyField | DateField | DropdownField | LabelsField | CheckboxField | URLField | EmailField | PhoneField | RatingField | ProgressField | TaskRelationshipField;
|
|
117
|
+
export interface BaseCustomFieldValue {
|
|
118
|
+
id: string;
|
|
119
|
+
name: string;
|
|
120
|
+
type: CustomFieldType;
|
|
121
|
+
value: any;
|
|
122
|
+
}
|
|
123
|
+
export interface TextFieldValue extends BaseCustomFieldValue {
|
|
124
|
+
type: 'text' | 'textarea';
|
|
125
|
+
value: {
|
|
126
|
+
value: string;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export interface NumberFieldValue extends BaseCustomFieldValue {
|
|
130
|
+
type: 'number' | 'currency';
|
|
131
|
+
value: {
|
|
132
|
+
value: number;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
export interface DateFieldValue extends BaseCustomFieldValue {
|
|
136
|
+
type: 'date';
|
|
137
|
+
value: {
|
|
138
|
+
value: number;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
export interface DropdownFieldValue extends BaseCustomFieldValue {
|
|
142
|
+
type: 'drop_down';
|
|
143
|
+
value: {
|
|
144
|
+
value: {
|
|
145
|
+
id: string;
|
|
146
|
+
name: string;
|
|
147
|
+
color?: string;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export interface LabelsFieldValue extends BaseCustomFieldValue {
|
|
152
|
+
type: 'labels';
|
|
153
|
+
value: {
|
|
154
|
+
value: Array<{
|
|
155
|
+
id: string;
|
|
156
|
+
name: string;
|
|
157
|
+
color?: string;
|
|
158
|
+
}>;
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
export interface CheckboxFieldValue extends BaseCustomFieldValue {
|
|
162
|
+
type: 'checkbox';
|
|
163
|
+
value: {
|
|
164
|
+
value: boolean;
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
export interface URLFieldValue extends BaseCustomFieldValue {
|
|
168
|
+
type: 'url' | 'email' | 'phone';
|
|
169
|
+
value: {
|
|
170
|
+
value: string;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
export interface RatingFieldValue extends BaseCustomFieldValue {
|
|
174
|
+
type: 'rating';
|
|
175
|
+
value: {
|
|
176
|
+
value: number;
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
export interface ProgressFieldValue extends BaseCustomFieldValue {
|
|
180
|
+
type: 'progress';
|
|
181
|
+
value: {
|
|
182
|
+
value: number;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
export interface TaskRelationshipFieldValue extends BaseCustomFieldValue {
|
|
186
|
+
type: 'task_relationship';
|
|
187
|
+
value: {
|
|
188
|
+
value: string | string[];
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
export type CustomFieldValue = TextFieldValue | NumberFieldValue | DateFieldValue | DropdownFieldValue | LabelsFieldValue | CheckboxFieldValue | URLFieldValue | RatingFieldValue | ProgressFieldValue | TaskRelationshipFieldValue;
|
|
192
|
+
export interface CreateCustomFieldParams {
|
|
193
|
+
name: string;
|
|
194
|
+
type: CustomFieldType;
|
|
195
|
+
type_config?: Record<string, any>;
|
|
196
|
+
required?: boolean;
|
|
197
|
+
hide_from_guests?: boolean;
|
|
198
|
+
}
|
|
199
|
+
export interface UpdateCustomFieldParams {
|
|
200
|
+
name?: string;
|
|
201
|
+
type_config?: Record<string, any>;
|
|
202
|
+
required?: boolean;
|
|
203
|
+
hide_from_guests?: boolean;
|
|
204
|
+
}
|
|
205
|
+
export interface SetFieldValueParams {
|
|
206
|
+
value: any;
|
|
207
|
+
}
|
|
208
|
+
export interface GetCustomFieldsParams {
|
|
209
|
+
include_deleted?: boolean;
|
|
210
|
+
}
|
|
211
|
+
export interface CustomFieldsResponse {
|
|
212
|
+
fields: CustomField[];
|
|
213
|
+
}
|
|
214
|
+
export declare class EnhancedCustomFieldsClient {
|
|
215
|
+
private client;
|
|
216
|
+
private apiToken;
|
|
217
|
+
constructor(client: ClickUpClient);
|
|
218
|
+
private getHeaders;
|
|
219
|
+
/**
|
|
220
|
+
* Get custom fields for a list
|
|
221
|
+
*/
|
|
222
|
+
getListCustomFields(listId: string, params?: GetCustomFieldsParams): Promise<CustomField[]>;
|
|
223
|
+
/**
|
|
224
|
+
* Get custom fields for a folder
|
|
225
|
+
*/
|
|
226
|
+
getFolderCustomFields(folderId: string, params?: GetCustomFieldsParams): Promise<CustomField[]>;
|
|
227
|
+
/**
|
|
228
|
+
* Get custom fields for a space
|
|
229
|
+
*/
|
|
230
|
+
getSpaceCustomFields(spaceId: string, params?: GetCustomFieldsParams): Promise<CustomField[]>;
|
|
231
|
+
/**
|
|
232
|
+
* Create a custom field in a list
|
|
233
|
+
*/
|
|
234
|
+
createListCustomField(listId: string, params: CreateCustomFieldParams): Promise<CustomField>;
|
|
235
|
+
/**
|
|
236
|
+
* Create a custom field in a folder
|
|
237
|
+
*/
|
|
238
|
+
createFolderCustomField(folderId: string, params: CreateCustomFieldParams): Promise<CustomField>;
|
|
239
|
+
/**
|
|
240
|
+
* Create a custom field in a space
|
|
241
|
+
*/
|
|
242
|
+
createSpaceCustomField(spaceId: string, params: CreateCustomFieldParams): Promise<CustomField>;
|
|
243
|
+
/**
|
|
244
|
+
* Update a custom field
|
|
245
|
+
*/
|
|
246
|
+
updateCustomField(fieldId: string, params: UpdateCustomFieldParams): Promise<CustomField>;
|
|
247
|
+
/**
|
|
248
|
+
* Delete a custom field
|
|
249
|
+
*/
|
|
250
|
+
deleteCustomField(fieldId: string): Promise<void>;
|
|
251
|
+
/**
|
|
252
|
+
* Set a custom field value on a task
|
|
253
|
+
*/
|
|
254
|
+
setCustomFieldValue(taskId: string, fieldId: string, value: any): Promise<void>;
|
|
255
|
+
/**
|
|
256
|
+
* Remove a custom field value from a task
|
|
257
|
+
*/
|
|
258
|
+
removeCustomFieldValue(taskId: string, fieldId: string): Promise<void>;
|
|
259
|
+
/**
|
|
260
|
+
* Get a custom field value from a task
|
|
261
|
+
*/
|
|
262
|
+
getCustomFieldValue(taskId: string, fieldId: string): Promise<any>;
|
|
263
|
+
/**
|
|
264
|
+
* Get all custom field values for a task
|
|
265
|
+
*/
|
|
266
|
+
getTaskCustomFieldValues(taskId: string): Promise<any[]>;
|
|
267
|
+
/**
|
|
268
|
+
* Bulk set multiple custom field values on a task
|
|
269
|
+
*/
|
|
270
|
+
bulkSetCustomFieldValues(taskId: string, fieldValues: Array<{
|
|
271
|
+
field_id: string;
|
|
272
|
+
value: any;
|
|
273
|
+
}>): Promise<any[]>;
|
|
274
|
+
/**
|
|
275
|
+
* Validate a field value against its field type
|
|
276
|
+
*/
|
|
277
|
+
validateFieldValue(field: CustomField, value: any): boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Get field type configuration template
|
|
280
|
+
*/
|
|
281
|
+
getFieldTypeTemplate(type: CustomFieldType): Record<string, any>;
|
|
282
|
+
private isValidURL;
|
|
283
|
+
private isValidEmail;
|
|
284
|
+
private handleError;
|
|
285
|
+
}
|
|
286
|
+
export declare const createEnhancedCustomFieldsClient: (client: ClickUpClient) => EnhancedCustomFieldsClient;
|