@hasna/connectors 0.3.16 → 0.4.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.
Files changed (127) hide show
  1. package/bin/index.js +71 -1
  2. package/bin/mcp.js +71 -1
  3. package/bin/serve.js +70 -0
  4. package/connectors/connect-asana/.env.example +11 -0
  5. package/connectors/connect-asana/CLAUDE.md +128 -0
  6. package/connectors/connect-asana/README.md +193 -0
  7. package/connectors/connect-asana/package.json +52 -0
  8. package/connectors/connect-asana/src/api/client.ts +119 -0
  9. package/connectors/connect-asana/src/api/index.ts +319 -0
  10. package/connectors/connect-asana/src/cli/index.ts +731 -0
  11. package/connectors/connect-asana/src/index.ts +19 -0
  12. package/connectors/connect-asana/src/types/index.ts +270 -0
  13. package/connectors/connect-asana/src/utils/config.ts +171 -0
  14. package/connectors/connect-asana/src/utils/output.ts +119 -0
  15. package/connectors/connect-asana/tsconfig.json +16 -0
  16. package/connectors/connect-clickup/.env.example +11 -0
  17. package/connectors/connect-clickup/CLAUDE.md +128 -0
  18. package/connectors/connect-clickup/README.md +193 -0
  19. package/connectors/connect-clickup/package.json +52 -0
  20. package/connectors/connect-clickup/src/api/client.ts +116 -0
  21. package/connectors/connect-clickup/src/api/index.ts +400 -0
  22. package/connectors/connect-clickup/src/cli/index.ts +625 -0
  23. package/connectors/connect-clickup/src/index.ts +19 -0
  24. package/connectors/connect-clickup/src/types/index.ts +591 -0
  25. package/connectors/connect-clickup/src/utils/config.ts +157 -0
  26. package/connectors/connect-clickup/src/utils/output.ts +119 -0
  27. package/connectors/connect-clickup/tsconfig.json +16 -0
  28. package/connectors/connect-confluence/.env.example +11 -0
  29. package/connectors/connect-confluence/CLAUDE.md +272 -0
  30. package/connectors/connect-confluence/README.md +193 -0
  31. package/connectors/connect-confluence/package.json +53 -0
  32. package/connectors/connect-confluence/scripts/release.ts +179 -0
  33. package/connectors/connect-confluence/src/api/client.ts +213 -0
  34. package/connectors/connect-confluence/src/api/example.ts +48 -0
  35. package/connectors/connect-confluence/src/api/index.ts +51 -0
  36. package/connectors/connect-confluence/src/cli/index.ts +254 -0
  37. package/connectors/connect-confluence/src/index.ts +103 -0
  38. package/connectors/connect-confluence/src/types/index.ts +237 -0
  39. package/connectors/connect-confluence/src/utils/auth.ts +274 -0
  40. package/connectors/connect-confluence/src/utils/bulk.ts +212 -0
  41. package/connectors/connect-confluence/src/utils/config.ts +326 -0
  42. package/connectors/connect-confluence/src/utils/output.ts +175 -0
  43. package/connectors/connect-confluence/src/utils/settings.ts +114 -0
  44. package/connectors/connect-confluence/src/utils/storage.ts +198 -0
  45. package/connectors/connect-confluence/tsconfig.json +16 -0
  46. package/connectors/connect-jira/.env.example +11 -0
  47. package/connectors/connect-jira/CLAUDE.md +128 -0
  48. package/connectors/connect-jira/README.md +193 -0
  49. package/connectors/connect-jira/package.json +53 -0
  50. package/connectors/connect-jira/src/api/client.ts +131 -0
  51. package/connectors/connect-jira/src/api/index.ts +266 -0
  52. package/connectors/connect-jira/src/cli/index.ts +653 -0
  53. package/connectors/connect-jira/src/index.ts +23 -0
  54. package/connectors/connect-jira/src/types/index.ts +448 -0
  55. package/connectors/connect-jira/src/utils/config.ts +179 -0
  56. package/connectors/connect-jira/src/utils/output.ts +119 -0
  57. package/connectors/connect-jira/tsconfig.json +16 -0
  58. package/connectors/connect-linear/CLAUDE.md +88 -0
  59. package/connectors/connect-linear/README.md +201 -0
  60. package/connectors/connect-linear/package.json +45 -0
  61. package/connectors/connect-linear/src/api/client.ts +62 -0
  62. package/connectors/connect-linear/src/api/index.ts +46 -0
  63. package/connectors/connect-linear/src/api/issues.ts +247 -0
  64. package/connectors/connect-linear/src/api/projects.ts +179 -0
  65. package/connectors/connect-linear/src/api/teams.ts +125 -0
  66. package/connectors/connect-linear/src/api/users.ts +112 -0
  67. package/connectors/connect-linear/src/cli/index.ts +560 -0
  68. package/connectors/connect-linear/src/index.ts +27 -0
  69. package/connectors/connect-linear/src/types/index.ts +275 -0
  70. package/connectors/connect-linear/src/utils/config.ts +249 -0
  71. package/connectors/connect-linear/src/utils/output.ts +119 -0
  72. package/connectors/connect-linear/tsconfig.json +16 -0
  73. package/connectors/connect-slack/.env.example +7 -0
  74. package/connectors/connect-slack/CLAUDE.md +69 -0
  75. package/connectors/connect-slack/README.md +150 -0
  76. package/connectors/connect-slack/package.json +44 -0
  77. package/connectors/connect-slack/src/api/channels.ts +112 -0
  78. package/connectors/connect-slack/src/api/client.ts +97 -0
  79. package/connectors/connect-slack/src/api/index.ts +42 -0
  80. package/connectors/connect-slack/src/api/messages.ts +127 -0
  81. package/connectors/connect-slack/src/api/users.ts +110 -0
  82. package/connectors/connect-slack/src/cli/index.ts +494 -0
  83. package/connectors/connect-slack/src/index.ts +21 -0
  84. package/connectors/connect-slack/src/types/index.ts +263 -0
  85. package/connectors/connect-slack/src/utils/config.ts +297 -0
  86. package/connectors/connect-slack/src/utils/output.ts +119 -0
  87. package/connectors/connect-slack/tsconfig.json +16 -0
  88. package/connectors/connect-telegram/.env.example +2 -0
  89. package/connectors/connect-telegram/package.json +49 -0
  90. package/connectors/connect-todoist/.env.example +11 -0
  91. package/connectors/connect-todoist/CLAUDE.md +104 -0
  92. package/connectors/connect-todoist/README.md +193 -0
  93. package/connectors/connect-todoist/package.json +52 -0
  94. package/connectors/connect-todoist/src/api/client.ts +117 -0
  95. package/connectors/connect-todoist/src/api/index.ts +188 -0
  96. package/connectors/connect-todoist/src/cli/index.ts +990 -0
  97. package/connectors/connect-todoist/src/index.ts +21 -0
  98. package/connectors/connect-todoist/src/types/index.ts +240 -0
  99. package/connectors/connect-todoist/src/utils/config.ts +157 -0
  100. package/connectors/connect-todoist/src/utils/output.ts +119 -0
  101. package/connectors/connect-todoist/tsconfig.json +16 -0
  102. package/connectors/connect-trello/.env.example +11 -0
  103. package/connectors/connect-trello/CLAUDE.md +128 -0
  104. package/connectors/connect-trello/README.md +193 -0
  105. package/connectors/connect-trello/package.json +53 -0
  106. package/connectors/connect-trello/src/api/client.ts +128 -0
  107. package/connectors/connect-trello/src/api/index.ts +278 -0
  108. package/connectors/connect-trello/src/cli/index.ts +737 -0
  109. package/connectors/connect-trello/src/index.ts +21 -0
  110. package/connectors/connect-trello/src/types/index.ts +314 -0
  111. package/connectors/connect-trello/src/utils/config.ts +182 -0
  112. package/connectors/connect-trello/src/utils/output.ts +119 -0
  113. package/connectors/connect-trello/tsconfig.json +16 -0
  114. package/connectors/connect-whatsapp/.env.example +11 -0
  115. package/connectors/connect-whatsapp/CLAUDE.md +113 -0
  116. package/connectors/connect-whatsapp/README.md +193 -0
  117. package/connectors/connect-whatsapp/package.json +53 -0
  118. package/connectors/connect-whatsapp/src/api/client.ts +133 -0
  119. package/connectors/connect-whatsapp/src/api/index.ts +365 -0
  120. package/connectors/connect-whatsapp/src/cli/index.ts +686 -0
  121. package/connectors/connect-whatsapp/src/index.ts +25 -0
  122. package/connectors/connect-whatsapp/src/types/index.ts +502 -0
  123. package/connectors/connect-whatsapp/src/utils/config.ts +179 -0
  124. package/connectors/connect-whatsapp/src/utils/output.ts +119 -0
  125. package/connectors/connect-whatsapp/tsconfig.json +16 -0
  126. package/dist/index.js +70 -0
  127. package/package.json +1 -1
@@ -0,0 +1,625 @@
1
+ #!/usr/bin/env bun
2
+ import { Command } from 'commander';
3
+ import chalk from 'chalk';
4
+ import { ClickUp } from '../api';
5
+ import {
6
+ getApiKey,
7
+ setApiKey,
8
+ clearConfig,
9
+ getConfigDir,
10
+ setProfileOverride,
11
+ getCurrentProfile,
12
+ setCurrentProfile,
13
+ listProfiles,
14
+ createProfile,
15
+ deleteProfile,
16
+ profileExists,
17
+ loadProfile,
18
+ } from '../utils/config';
19
+ import type { OutputFormat } from '../utils/output';
20
+ import { success, error, info, print } from '../utils/output';
21
+
22
+ const CONNECTOR_NAME = 'connect-clickup';
23
+ const VERSION = '0.0.1';
24
+
25
+ const program = new Command();
26
+
27
+ program
28
+ .name(CONNECTOR_NAME)
29
+ .description('ClickUp connector CLI - Workspaces, spaces, folders, lists, and tasks management')
30
+ .version(VERSION)
31
+ .option('-k, --api-key <key>', 'API key (overrides config)')
32
+ .option('-f, --format <format>', 'Output format (json, pretty)', 'pretty')
33
+ .option('-p, --profile <profile>', 'Use a specific profile')
34
+ .hook('preAction', (thisCommand) => {
35
+ const opts = thisCommand.opts();
36
+ if (opts.profile) {
37
+ if (!profileExists(opts.profile)) {
38
+ error(`Profile "${opts.profile}" does not exist. Create it with "${CONNECTOR_NAME} profile create ${opts.profile}"`);
39
+ process.exit(1);
40
+ }
41
+ setProfileOverride(opts.profile);
42
+ }
43
+ if (opts.apiKey) {
44
+ process.env.CLICKUP_API_KEY = opts.apiKey;
45
+ }
46
+ });
47
+
48
+ function getFormat(cmd: Command): OutputFormat {
49
+ const parent = cmd.parent;
50
+ return (parent?.opts().format || 'pretty') as OutputFormat;
51
+ }
52
+
53
+ function getClient(): ClickUp {
54
+ const apiKey = getApiKey();
55
+ if (!apiKey) {
56
+ error(`No API key configured. Run "${CONNECTOR_NAME} config set-key <key>" or set CLICKUP_API_KEY environment variable.`);
57
+ process.exit(1);
58
+ }
59
+ return new ClickUp({ apiKey });
60
+ }
61
+
62
+ // ============================================
63
+ // Profile Commands
64
+ // ============================================
65
+ const profileCmd = program
66
+ .command('profile')
67
+ .description('Manage configuration profiles');
68
+
69
+ profileCmd
70
+ .command('list')
71
+ .description('List all profiles')
72
+ .action(() => {
73
+ const profiles = listProfiles();
74
+ const current = getCurrentProfile();
75
+
76
+ if (profiles.length === 0) {
77
+ info('No profiles found. Use "profile create <name>" to create one.');
78
+ return;
79
+ }
80
+
81
+ success(`Profiles:`);
82
+ profiles.forEach(p => {
83
+ const isActive = p === current ? chalk.green(' (active)') : '';
84
+ console.log(` ${p}${isActive}`);
85
+ });
86
+ });
87
+
88
+ profileCmd
89
+ .command('use <name>')
90
+ .description('Switch to a profile')
91
+ .action((name: string) => {
92
+ if (!profileExists(name)) {
93
+ error(`Profile "${name}" does not exist. Create it with "profile create ${name}"`);
94
+ process.exit(1);
95
+ }
96
+ setCurrentProfile(name);
97
+ success(`Switched to profile: ${name}`);
98
+ });
99
+
100
+ profileCmd
101
+ .command('create <name>')
102
+ .description('Create a new profile')
103
+ .option('--api-key <key>', 'API key')
104
+ .option('--use', 'Switch to this profile after creation')
105
+ .action((name: string, opts) => {
106
+ if (profileExists(name)) {
107
+ error(`Profile "${name}" already exists`);
108
+ process.exit(1);
109
+ }
110
+
111
+ createProfile(name, {
112
+ apiKey: opts.apiKey,
113
+ });
114
+ success(`Profile "${name}" created`);
115
+
116
+ if (opts.use) {
117
+ setCurrentProfile(name);
118
+ info(`Switched to profile: ${name}`);
119
+ }
120
+ });
121
+
122
+ profileCmd
123
+ .command('delete <name>')
124
+ .description('Delete a profile')
125
+ .action((name: string) => {
126
+ if (name === 'default') {
127
+ error('Cannot delete the default profile');
128
+ process.exit(1);
129
+ }
130
+ if (deleteProfile(name)) {
131
+ success(`Profile "${name}" deleted`);
132
+ } else {
133
+ error(`Profile "${name}" not found`);
134
+ process.exit(1);
135
+ }
136
+ });
137
+
138
+ profileCmd
139
+ .command('show [name]')
140
+ .description('Show profile configuration')
141
+ .action((name?: string) => {
142
+ const profileName = name || getCurrentProfile();
143
+ const config = loadProfile(profileName);
144
+ const active = getCurrentProfile();
145
+
146
+ console.log(chalk.bold(`Profile: ${profileName}${profileName === active ? chalk.green(' (active)') : ''}`));
147
+ info(`API Key: ${config.apiKey ? `${config.apiKey.substring(0, 8)}...` : chalk.gray('not set')}`);
148
+ });
149
+
150
+ // ============================================
151
+ // Config Commands
152
+ // ============================================
153
+ const configCmd = program
154
+ .command('config')
155
+ .description('Manage CLI configuration');
156
+
157
+ configCmd
158
+ .command('set-key <apiKey>')
159
+ .description('Set API key')
160
+ .action((apiKey: string) => {
161
+ setApiKey(apiKey);
162
+ success(`API key saved to profile: ${getCurrentProfile()}`);
163
+ });
164
+
165
+ configCmd
166
+ .command('show')
167
+ .description('Show current configuration')
168
+ .action(() => {
169
+ const profileName = getCurrentProfile();
170
+ const apiKey = getApiKey();
171
+
172
+ console.log(chalk.bold(`Active Profile: ${profileName}`));
173
+ info(`Config directory: ${getConfigDir()}`);
174
+ info(`API Key: ${apiKey ? `${apiKey.substring(0, 8)}...` : chalk.gray('not set')}`);
175
+ });
176
+
177
+ configCmd
178
+ .command('clear')
179
+ .description('Clear configuration')
180
+ .action(() => {
181
+ clearConfig();
182
+ success(`Configuration cleared for profile: ${getCurrentProfile()}`);
183
+ });
184
+
185
+ // ============================================
186
+ // User Commands
187
+ // ============================================
188
+ const userCmd = program
189
+ .command('user')
190
+ .description('User operations');
191
+
192
+ userCmd
193
+ .command('me')
194
+ .description('Get current authenticated user')
195
+ .action(async () => {
196
+ try {
197
+ const client = getClient();
198
+ const result = await client.getAuthorizedUser();
199
+ print(result, getFormat(userCmd));
200
+ } catch (err) {
201
+ error(String(err));
202
+ process.exit(1);
203
+ }
204
+ });
205
+
206
+ // ============================================
207
+ // Workspace Commands
208
+ // ============================================
209
+ const workspaceCmd = program
210
+ .command('workspace')
211
+ .description('Workspace (team) operations');
212
+
213
+ workspaceCmd
214
+ .command('list')
215
+ .description('List workspaces')
216
+ .action(async () => {
217
+ try {
218
+ const client = getClient();
219
+ const result = await client.listWorkspaces();
220
+ print(result, getFormat(workspaceCmd));
221
+ } catch (err) {
222
+ error(String(err));
223
+ process.exit(1);
224
+ }
225
+ });
226
+
227
+ // ============================================
228
+ // Space Commands
229
+ // ============================================
230
+ const spaceCmd = program
231
+ .command('space')
232
+ .description('Space operations');
233
+
234
+ spaceCmd
235
+ .command('list <teamId>')
236
+ .description('List spaces in a workspace')
237
+ .option('--archived', 'Include archived spaces')
238
+ .action(async (teamId: string, opts) => {
239
+ try {
240
+ const client = getClient();
241
+ const result = await client.listSpaces(teamId, { archived: opts.archived });
242
+ print(result, getFormat(spaceCmd));
243
+ } catch (err) {
244
+ error(String(err));
245
+ process.exit(1);
246
+ }
247
+ });
248
+
249
+ spaceCmd
250
+ .command('get <spaceId>')
251
+ .description('Get a space by ID')
252
+ .action(async (spaceId: string) => {
253
+ try {
254
+ const client = getClient();
255
+ const result = await client.getSpace(spaceId);
256
+ print(result, getFormat(spaceCmd));
257
+ } catch (err) {
258
+ error(String(err));
259
+ process.exit(1);
260
+ }
261
+ });
262
+
263
+ spaceCmd
264
+ .command('create')
265
+ .description('Create a new space')
266
+ .requiredOption('-t, --team <id>', 'Team/workspace ID')
267
+ .requiredOption('-n, --name <name>', 'Space name')
268
+ .action(async (opts) => {
269
+ try {
270
+ const client = getClient();
271
+ const result = await client.createSpace(opts.team, { name: opts.name });
272
+ success('Space created!');
273
+ print(result, getFormat(spaceCmd));
274
+ } catch (err) {
275
+ error(String(err));
276
+ process.exit(1);
277
+ }
278
+ });
279
+
280
+ spaceCmd
281
+ .command('delete <spaceId>')
282
+ .description('Delete a space')
283
+ .action(async (spaceId: string) => {
284
+ try {
285
+ const client = getClient();
286
+ await client.deleteSpace(spaceId);
287
+ success(`Space ${spaceId} deleted!`);
288
+ } catch (err) {
289
+ error(String(err));
290
+ process.exit(1);
291
+ }
292
+ });
293
+
294
+ // ============================================
295
+ // Folder Commands
296
+ // ============================================
297
+ const folderCmd = program
298
+ .command('folder')
299
+ .description('Folder operations');
300
+
301
+ folderCmd
302
+ .command('list <spaceId>')
303
+ .description('List folders in a space')
304
+ .option('--archived', 'Include archived folders')
305
+ .action(async (spaceId: string, opts) => {
306
+ try {
307
+ const client = getClient();
308
+ const result = await client.listFolders(spaceId, { archived: opts.archived });
309
+ print(result, getFormat(folderCmd));
310
+ } catch (err) {
311
+ error(String(err));
312
+ process.exit(1);
313
+ }
314
+ });
315
+
316
+ folderCmd
317
+ .command('get <folderId>')
318
+ .description('Get a folder by ID')
319
+ .action(async (folderId: string) => {
320
+ try {
321
+ const client = getClient();
322
+ const result = await client.getFolder(folderId);
323
+ print(result, getFormat(folderCmd));
324
+ } catch (err) {
325
+ error(String(err));
326
+ process.exit(1);
327
+ }
328
+ });
329
+
330
+ folderCmd
331
+ .command('create')
332
+ .description('Create a new folder')
333
+ .requiredOption('-s, --space <id>', 'Space ID')
334
+ .requiredOption('-n, --name <name>', 'Folder name')
335
+ .action(async (opts) => {
336
+ try {
337
+ const client = getClient();
338
+ const result = await client.createFolder(opts.space, { name: opts.name });
339
+ success('Folder created!');
340
+ print(result, getFormat(folderCmd));
341
+ } catch (err) {
342
+ error(String(err));
343
+ process.exit(1);
344
+ }
345
+ });
346
+
347
+ folderCmd
348
+ .command('delete <folderId>')
349
+ .description('Delete a folder')
350
+ .action(async (folderId: string) => {
351
+ try {
352
+ const client = getClient();
353
+ await client.deleteFolder(folderId);
354
+ success(`Folder ${folderId} deleted!`);
355
+ } catch (err) {
356
+ error(String(err));
357
+ process.exit(1);
358
+ }
359
+ });
360
+
361
+ // ============================================
362
+ // List Commands
363
+ // ============================================
364
+ const listCmd = program
365
+ .command('list')
366
+ .description('List operations');
367
+
368
+ listCmd
369
+ .command('show <folderId>')
370
+ .description('List lists in a folder')
371
+ .option('--archived', 'Include archived lists')
372
+ .action(async (folderId: string, opts) => {
373
+ try {
374
+ const client = getClient();
375
+ const result = await client.listLists(folderId, { archived: opts.archived });
376
+ print(result, getFormat(listCmd));
377
+ } catch (err) {
378
+ error(String(err));
379
+ process.exit(1);
380
+ }
381
+ });
382
+
383
+ listCmd
384
+ .command('get <listId>')
385
+ .description('Get a list by ID')
386
+ .action(async (listId: string) => {
387
+ try {
388
+ const client = getClient();
389
+ const result = await client.getList(listId);
390
+ print(result, getFormat(listCmd));
391
+ } catch (err) {
392
+ error(String(err));
393
+ process.exit(1);
394
+ }
395
+ });
396
+
397
+ listCmd
398
+ .command('create')
399
+ .description('Create a new list')
400
+ .requiredOption('-o, --folder <id>', 'Folder ID')
401
+ .requiredOption('-n, --name <name>', 'List name')
402
+ .action(async (opts) => {
403
+ try {
404
+ const client = getClient();
405
+ const result = await client.createList(opts.folder, { name: opts.name });
406
+ success('List created!');
407
+ print(result, getFormat(listCmd));
408
+ } catch (err) {
409
+ error(String(err));
410
+ process.exit(1);
411
+ }
412
+ });
413
+
414
+ listCmd
415
+ .command('delete <listId>')
416
+ .description('Delete a list')
417
+ .action(async (listId: string) => {
418
+ try {
419
+ const client = getClient();
420
+ await client.deleteList(listId);
421
+ success(`List ${listId} deleted!`);
422
+ } catch (err) {
423
+ error(String(err));
424
+ process.exit(1);
425
+ }
426
+ });
427
+
428
+ // ============================================
429
+ // Task Commands
430
+ // ============================================
431
+ const taskCmd = program
432
+ .command('task')
433
+ .description('Task operations');
434
+
435
+ taskCmd
436
+ .command('show <listId>')
437
+ .description('List tasks in a list')
438
+ .option('--archived', 'Include archived tasks')
439
+ .option('--subtasks', 'Include subtasks')
440
+ .option('--include-closed', 'Include closed tasks')
441
+ .option('-p, --page <number>', 'Page number')
442
+ .action(async (listId: string, opts) => {
443
+ try {
444
+ const client = getClient();
445
+ const result = await client.listTasks(listId, {
446
+ archived: opts.archived,
447
+ subtasks: opts.subtasks,
448
+ include_closed: opts.includeClosed,
449
+ page: opts.page ? parseInt(opts.page) : undefined,
450
+ });
451
+ print(result, getFormat(taskCmd));
452
+ } catch (err) {
453
+ error(String(err));
454
+ process.exit(1);
455
+ }
456
+ });
457
+
458
+ taskCmd
459
+ .command('get <taskId>')
460
+ .description('Get a task by ID')
461
+ .option('--include-subtasks', 'Include subtasks')
462
+ .action(async (taskId: string, opts) => {
463
+ try {
464
+ const client = getClient();
465
+ const result = await client.getTask(taskId, { include_subtasks: opts.includeSubtasks });
466
+ print(result, getFormat(taskCmd));
467
+ } catch (err) {
468
+ error(String(err));
469
+ process.exit(1);
470
+ }
471
+ });
472
+
473
+ taskCmd
474
+ .command('create')
475
+ .description('Create a new task')
476
+ .requiredOption('-l, --list <id>', 'List ID')
477
+ .requiredOption('-n, --name <name>', 'Task name')
478
+ .option('-d, --description <text>', 'Task description')
479
+ .option('--priority <number>', 'Priority (1=urgent, 2=high, 3=normal, 4=low)')
480
+ .option('--status <status>', 'Task status')
481
+ .action(async (opts) => {
482
+ try {
483
+ const client = getClient();
484
+ const result = await client.createTask(opts.list, {
485
+ name: opts.name,
486
+ description: opts.description,
487
+ priority: opts.priority ? parseInt(opts.priority) : undefined,
488
+ status: opts.status,
489
+ });
490
+ success('Task created!');
491
+ print(result, getFormat(taskCmd));
492
+ } catch (err) {
493
+ error(String(err));
494
+ process.exit(1);
495
+ }
496
+ });
497
+
498
+ taskCmd
499
+ .command('update <taskId>')
500
+ .description('Update a task')
501
+ .option('-n, --name <name>', 'Task name')
502
+ .option('-d, --description <text>', 'Task description')
503
+ .option('--priority <number>', 'Priority')
504
+ .option('--status <status>', 'Task status')
505
+ .action(async (taskId: string, opts) => {
506
+ try {
507
+ const client = getClient();
508
+ const result = await client.updateTask(taskId, {
509
+ name: opts.name,
510
+ description: opts.description,
511
+ priority: opts.priority ? parseInt(opts.priority) : undefined,
512
+ status: opts.status,
513
+ });
514
+ success('Task updated!');
515
+ print(result, getFormat(taskCmd));
516
+ } catch (err) {
517
+ error(String(err));
518
+ process.exit(1);
519
+ }
520
+ });
521
+
522
+ taskCmd
523
+ .command('delete <taskId>')
524
+ .description('Delete a task')
525
+ .action(async (taskId: string) => {
526
+ try {
527
+ const client = getClient();
528
+ await client.deleteTask(taskId);
529
+ success(`Task ${taskId} deleted!`);
530
+ } catch (err) {
531
+ error(String(err));
532
+ process.exit(1);
533
+ }
534
+ });
535
+
536
+ // ============================================
537
+ // Comment Commands
538
+ // ============================================
539
+ const commentCmd = program
540
+ .command('comment')
541
+ .description('Comment operations');
542
+
543
+ commentCmd
544
+ .command('list <taskId>')
545
+ .description('List comments on a task')
546
+ .action(async (taskId: string) => {
547
+ try {
548
+ const client = getClient();
549
+ const result = await client.listTaskComments(taskId);
550
+ print(result, getFormat(commentCmd));
551
+ } catch (err) {
552
+ error(String(err));
553
+ process.exit(1);
554
+ }
555
+ });
556
+
557
+ commentCmd
558
+ .command('create')
559
+ .description('Create a comment on a task')
560
+ .requiredOption('-t, --task <id>', 'Task ID')
561
+ .requiredOption('-c, --comment <text>', 'Comment text')
562
+ .action(async (opts) => {
563
+ try {
564
+ const client = getClient();
565
+ const result = await client.createTaskComment(opts.task, { comment_text: opts.comment });
566
+ success('Comment created!');
567
+ print(result, getFormat(commentCmd));
568
+ } catch (err) {
569
+ error(String(err));
570
+ process.exit(1);
571
+ }
572
+ });
573
+
574
+ commentCmd
575
+ .command('delete <commentId>')
576
+ .description('Delete a comment')
577
+ .action(async (commentId: string) => {
578
+ try {
579
+ const client = getClient();
580
+ await client.deleteComment(commentId);
581
+ success(`Comment ${commentId} deleted!`);
582
+ } catch (err) {
583
+ error(String(err));
584
+ process.exit(1);
585
+ }
586
+ });
587
+
588
+ // ============================================
589
+ // Goal Commands
590
+ // ============================================
591
+ const goalCmd = program
592
+ .command('goal')
593
+ .description('Goal operations');
594
+
595
+ goalCmd
596
+ .command('list <teamId>')
597
+ .description('List goals in a workspace')
598
+ .option('--include-completed', 'Include completed goals')
599
+ .action(async (teamId: string, opts) => {
600
+ try {
601
+ const client = getClient();
602
+ const result = await client.listGoals(teamId, { include_completed: opts.includeCompleted });
603
+ print(result, getFormat(goalCmd));
604
+ } catch (err) {
605
+ error(String(err));
606
+ process.exit(1);
607
+ }
608
+ });
609
+
610
+ goalCmd
611
+ .command('get <goalId>')
612
+ .description('Get a goal by ID')
613
+ .action(async (goalId: string) => {
614
+ try {
615
+ const client = getClient();
616
+ const result = await client.getGoal(goalId);
617
+ print(result, getFormat(goalCmd));
618
+ } catch (err) {
619
+ error(String(err));
620
+ process.exit(1);
621
+ }
622
+ });
623
+
624
+ // Parse and execute
625
+ program.parse();
@@ -0,0 +1,19 @@
1
+ // ClickUp Connector
2
+ // TypeScript wrapper for ClickUp workspaces, spaces, folders, lists, and tasks API
3
+
4
+ export { ClickUp } from './api';
5
+ export * from './types';
6
+ export { ClickUpClient } from './api';
7
+
8
+ export {
9
+ getApiKey,
10
+ setApiKey,
11
+ getCurrentProfile,
12
+ setCurrentProfile,
13
+ listProfiles,
14
+ createProfile,
15
+ deleteProfile,
16
+ loadProfile,
17
+ saveProfile,
18
+ clearConfig,
19
+ } from './utils/config';