@krodak/clickup-cli 1.20.0 → 1.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "clickup-cli",
3
3
  "description": "ClickUp CLI skills for managing tasks, sprints, comments, checklists, custom fields, tags, and time tracking via the cup command",
4
- "version": "1.20.0",
4
+ "version": "1.20.1",
5
5
  "author": {
6
6
  "name": "Krzysztof Rodak"
7
7
  },
package/dist/index.js CHANGED
@@ -407,6 +407,32 @@ var ClickUpClient = class {
407
407
  async removeTaskFromList(taskId, listId) {
408
408
  await this.request(`/list/${listId}/task/${taskId}`, { method: "DELETE" });
409
409
  }
410
+ async moveTaskToList(taskId, listId) {
411
+ if (!this.teamId) {
412
+ throw new Error("teamId is required to move a task to a new home list");
413
+ }
414
+ const [task, destList] = await Promise.all([
415
+ this.getTask(taskId),
416
+ this.getListWithStatuses(listId)
417
+ ]);
418
+ const taskStatus = task.status.status.toLowerCase();
419
+ const destStatuses = destList.statuses.map((s) => s.status.toLowerCase());
420
+ const statusMappings = [];
421
+ if (!destStatuses.includes(taskStatus)) {
422
+ const destStatus = destList.statuses.find((s) => s.type === "open") ?? destList.statuses[0];
423
+ if (!destStatus) {
424
+ throw new Error(`Destination list ${listId} has no statuses`);
425
+ }
426
+ statusMappings.push({
427
+ source_status: task.status.status,
428
+ destination_status: destStatus.status
429
+ });
430
+ }
431
+ await this.requestV3(`/workspaces/${this.teamId}/tasks/${taskId}/home_list/${listId}`, {
432
+ method: "PUT",
433
+ body: JSON.stringify({ status_mappings: statusMappings })
434
+ });
435
+ }
410
436
  async setCustomFieldValue(taskId, fieldId, value) {
411
437
  await this.request(this.taskPath(taskId, `/field/${fieldId}`), {
412
438
  method: "POST",
@@ -5154,6 +5180,11 @@ async function moveTask(config, taskId, opts) {
5154
5180
  }
5155
5181
  const client = new ClickUpClient(config);
5156
5182
  const messages = [];
5183
+ if (opts.to && opts.remove) {
5184
+ await client.moveTaskToList(taskId, opts.to);
5185
+ messages.push(`Moved ${taskId} from list ${opts.remove} to list ${opts.to}`);
5186
+ return messages.join("; ");
5187
+ }
5157
5188
  if (opts.to) {
5158
5189
  await client.addTaskToList(taskId, opts.to);
5159
5190
  messages.push(`Added ${taskId} to list ${opts.to}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krodak/clickup-cli",
3
- "version": "1.20.0",
3
+ "version": "1.20.1",
4
4
  "description": "ClickUp CLI for AI agents and humans",
5
5
  "type": "module",
6
6
  "license": "MIT",