@krodak/clickup-cli 1.23.1 → 1.24.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.
@@ -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.23.1",
4
+ "version": "1.24.0",
5
5
  "author": {
6
6
  "name": "Krzysztof Rodak"
7
7
  },
package/dist/index.js CHANGED
@@ -551,10 +551,12 @@ var ClickUpClient = class {
551
551
  async deleteChecklist(checklistId) {
552
552
  await this.request(`/checklist/${checklistId}`, { method: "DELETE" });
553
553
  }
554
- async createChecklistItem(checklistId, name) {
554
+ async createChecklistItem(checklistId, name, parent) {
555
+ const body = { name };
556
+ if (parent !== void 0) body.parent = parent;
555
557
  const data = await this.request(
556
558
  `/checklist/${checklistId}/checklist_item`,
557
- { method: "POST", body: JSON.stringify({ name }) }
559
+ { method: "POST", body: JSON.stringify(body) }
558
560
  );
559
561
  return expectRecordField(
560
562
  data,
@@ -5638,9 +5640,9 @@ async function deleteChecklist(config, checklistId) {
5638
5640
  await client.deleteChecklist(checklistId);
5639
5641
  return { checklistId };
5640
5642
  }
5641
- async function addChecklistItem(config, checklistId, name) {
5643
+ async function addChecklistItem(config, checklistId, name, parent) {
5642
5644
  const client = new ClickUpClient(config);
5643
- return client.createChecklistItem(checklistId, name);
5645
+ return client.createChecklistItem(checklistId, name, parent);
5644
5646
  }
5645
5647
  async function editChecklistItem(config, checklistId, checklistItemId, updates) {
5646
5648
  const client = new ClickUpClient(config);
@@ -5651,31 +5653,59 @@ async function deleteChecklistItem(config, checklistId, checklistItemId) {
5651
5653
  await client.deleteChecklistItem(checklistId, checklistItemId);
5652
5654
  return { checklistId, checklistItemId };
5653
5655
  }
5656
+ function sortByOrder(items) {
5657
+ return [...items].sort((a, b) => (a.orderindex ?? 0) - (b.orderindex ?? 0));
5658
+ }
5659
+ function countItems(items) {
5660
+ let total = 0;
5661
+ let resolved = 0;
5662
+ for (const item of items) {
5663
+ total++;
5664
+ if (item.resolved) resolved++;
5665
+ if (item.children?.length) {
5666
+ const nested = countItems(item.children);
5667
+ total += nested.total;
5668
+ resolved += nested.resolved;
5669
+ }
5670
+ }
5671
+ return { total, resolved };
5672
+ }
5654
5673
  function formatChecklists(checklists) {
5655
5674
  if (checklists.length === 0) return "No checklists";
5656
5675
  const lines = [];
5676
+ const renderItem = (item, depth) => {
5677
+ const indent = " ".repeat(depth + 1);
5678
+ const check = item.resolved ? chalk9.green("[x]") : chalk9.dim("[ ]");
5679
+ const name = item.resolved ? chalk9.dim(item.name) : item.name;
5680
+ const assignee = item.assignee ? chalk9.dim(` @${item.assignee.username}`) : "";
5681
+ lines.push(`${indent}${check} ${name}${assignee}`);
5682
+ lines.push(chalk9.dim(`${indent} item-id: ${item.id}`));
5683
+ for (const child of sortByOrder(item.children ?? [])) {
5684
+ renderItem(child, depth + 1);
5685
+ }
5686
+ };
5657
5687
  for (const cl of checklists) {
5658
- const resolved = cl.items.filter((i) => i.resolved).length;
5659
- lines.push(chalk9.bold(`${cl.name} (${resolved}/${cl.items.length})`));
5688
+ const { total, resolved } = countItems(cl.items);
5689
+ lines.push(chalk9.bold(`${cl.name} (${resolved}/${total})`));
5660
5690
  lines.push(chalk9.dim(` ID: ${cl.id}`));
5661
- for (const item of cl.items) {
5662
- const check = item.resolved ? chalk9.green("[x]") : chalk9.dim("[ ]");
5663
- const name = item.resolved ? chalk9.dim(item.name) : item.name;
5664
- const assignee = item.assignee ? chalk9.dim(` @${item.assignee.username}`) : "";
5665
- lines.push(` ${check} ${name}${assignee}`);
5666
- lines.push(chalk9.dim(` item-id: ${item.id}`));
5667
- }
5691
+ for (const item of sortByOrder(cl.items)) renderItem(item, 0);
5668
5692
  }
5669
5693
  return lines.join("\n");
5670
5694
  }
5671
5695
  function formatChecklistsMarkdown(checklists) {
5672
5696
  if (checklists.length === 0) return "No checklists";
5697
+ const renderItem = (item, depth) => {
5698
+ const indent = " ".repeat(depth);
5699
+ const lines = [`${indent}- [${item.resolved ? "x" : " "}] ${item.name}`];
5700
+ for (const child of sortByOrder(item.children ?? [])) {
5701
+ lines.push(...renderItem(child, depth + 1));
5702
+ }
5703
+ return lines;
5704
+ };
5673
5705
  return checklists.map((cl) => {
5674
- const resolved = cl.items.filter((i) => i.resolved).length;
5675
- const header = `### ${cl.name} (${resolved}/${cl.items.length})`;
5676
- const items = cl.items.map(
5677
- (item) => `- [${item.resolved ? "x" : " "}] ${item.name}`
5678
- );
5706
+ const { total, resolved } = countItems(cl.items);
5707
+ const header = `### ${cl.name} (${resolved}/${total})`;
5708
+ const items = sortByOrder(cl.items).flatMap((item) => renderItem(item, 0));
5679
5709
  return [header, "", ...items].join("\n");
5680
5710
  }).join("\n\n");
5681
5711
  }
@@ -7435,18 +7465,23 @@ function buildProgram(programName = basename(process.argv[1] ?? "cup")) {
7435
7465
  }
7436
7466
  })
7437
7467
  );
7438
- checklistCmd.command("add-item <checklistId> <name>").description("Add an item to a checklist").option("--json", "Force JSON output even in terminal").action(
7439
- wrapAction(async (checklistId, name, opts) => {
7440
- const config = loadConfig(getProfileName());
7441
- const result = await addChecklistItem(config, checklistId, name);
7442
- if (shouldOutputJson(opts.json ?? false)) {
7443
- console.log(JSON.stringify(result, null, 2));
7444
- } else {
7445
- console.log(`Added item "${name}" to checklist ${checklistId}`);
7468
+ checklistCmd.command("add-item <checklistId> <name>").description("Add an item to a checklist").option("--parent <itemId>", "Nest under a parent checklist item ID").option("--json", "Force JSON output even in terminal").action(
7469
+ wrapAction(
7470
+ async (checklistId, name, opts) => {
7471
+ const config = loadConfig(getProfileName());
7472
+ const result = await addChecklistItem(config, checklistId, name, opts.parent);
7473
+ if (shouldOutputJson(opts.json ?? false)) {
7474
+ console.log(JSON.stringify(result, null, 2));
7475
+ } else {
7476
+ console.log(`Added item "${name}" to checklist ${checklistId}`);
7477
+ }
7446
7478
  }
7447
- })
7479
+ )
7448
7480
  );
7449
- checklistCmd.command("edit-item <checklistId> <checklistItemId>").description("Edit a checklist item").option("--name <name>", "New item name").option("--resolved", "Mark item as resolved").option("--unresolved", "Mark item as unresolved").option("--assignee <userId>", 'Assign user by ID (use "null" to unassign)').option("--json", "Force JSON output even in terminal").action(
7481
+ checklistCmd.command("edit-item <checklistId> <checklistItemId>").description("Edit a checklist item").option("--name <name>", "New item name").option("--resolved", "Mark item as resolved").option("--unresolved", "Mark item as unresolved").option("--assignee <userId>", 'Assign user by ID (use "null" to unassign)').option(
7482
+ "--parent <itemId>",
7483
+ 'Reparent item under another checklist item ID (use "null" to unnest)'
7484
+ ).option("--json", "Force JSON output even in terminal").action(
7450
7485
  wrapAction(
7451
7486
  async (checklistId, checklistItemId, opts) => {
7452
7487
  const config = loadConfig(getProfileName());
@@ -7457,6 +7492,9 @@ function buildProgram(programName = basename(process.argv[1] ?? "cup")) {
7457
7492
  if (opts.assignee !== void 0) {
7458
7493
  updates.assignee = opts.assignee === "null" ? null : parseOptionalNumberOption(opts.assignee, "--assignee");
7459
7494
  }
7495
+ if (opts.parent !== void 0) {
7496
+ updates.parent = opts.parent === "null" ? null : opts.parent;
7497
+ }
7460
7498
  const result = await editChecklistItem(config, checklistId, checklistItemId, updates);
7461
7499
  if (shouldOutputJson(opts.json ?? false)) {
7462
7500
  console.log(JSON.stringify(result, null, 2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krodak/clickup-cli",
3
- "version": "1.23.1",
3
+ "version": "1.24.0",
4
4
  "description": "ClickUp CLI for AI agents and humans",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -3,11 +3,11 @@ name: clickup
3
3
  description: 'Use when managing ClickUp tasks, sprints, or comments via the `cup` CLI tool. Triggers: task queries, status updates, sprint tracking, creating subtasks, posting comments, threaded replies, standup summaries, searching tasks, checking overdue items, assigning tasks, listing spaces and lists, opening tasks in browser, checking auth or config, setting custom fields, deleting tasks, managing tags, managing checklists, editing comments, task links, time tracking, attachments, file uploads, listing members, listing fields, duplicating tasks, bulk operations, goals, key results, saved filters, favorites.'
4
4
  ---
5
5
 
6
- # ClickUp CLI (`cup`) - skill version 1.23.1
6
+ # ClickUp CLI (`cup`) - skill version 1.24.0
7
7
 
8
8
  Reference for AI agents using the `cup` CLI tool. Covers task management, sprint tracking, comments, time tracking, custom fields, goals, docs, and project workflows.
9
9
 
10
- > **Version check:** Run `cup --version`. If your installed version is older than 1.23.1, update with `npm install -g @krodak/clickup-cli` and refresh this skill with `cup skill`.
10
+ > **Version check:** Run `cup --version`. If your installed version is older than 1.24.0, update with `npm install -g @krodak/clickup-cli` and refresh this skill with `cup skill`.
11
11
 
12
12
  ## Install & Configure
13
13
 
@@ -173,8 +173,8 @@ All commands support `--help` for full flag details. All commands support `--jso
173
173
  | `cup checklist view <id>` | View checklists on a task |
174
174
  | `cup checklist create <id> <name>` | Create a checklist |
175
175
  | `cup checklist delete <checklistId>` | Delete a checklist |
176
- | `cup checklist add-item <checklistId> <name>` | Add item to checklist |
177
- | `cup checklist edit-item <checklistId> <itemId> [--name n] [--resolved] [--unresolved] [--assignee id]` | Edit checklist item |
176
+ | `cup checklist add-item <checklistId> <name> [--parent itemId]` | Add item to checklist (nest under parent via `--parent`) |
177
+ | `cup checklist edit-item <checklistId> <itemId> [--name n] [--resolved] [--unresolved] [--assignee id] [--parent itemId\|null]` | Edit checklist item (reparent with `--parent`, use `"null"` to unnest) |
178
178
  | `cup checklist delete-item <checklistId> <itemId>` | Delete checklist item |
179
179
  | `cup time start <taskId> [-d desc]` | Start timer |
180
180
  | `cup time stop` | Stop running timer |
@@ -305,7 +305,9 @@ cup field abc123def --set "Story Points" 5
305
305
  cup tag abc123def --add "bug,frontend"
306
306
  cup checklist create abc123def "QA Steps"
307
307
  cup checklist add-item <clId> "Run unit tests"
308
+ cup checklist add-item <clId> "Sub step" --parent <itemId> # nest under parent
308
309
  cup checklist edit-item <clId> <itemId> --resolved
310
+ cup checklist edit-item <clId> <itemId> --parent <newParent> # reparent (use "null" to unnest)
309
311
  cup link abc123 def456
310
312
  cup attach abc123def ./screenshot.png
311
313
  cup time start abc123def -d "Working on feature"