@krodak/clickup-cli 0.12.0 → 0.12.2

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/README.md CHANGED
@@ -215,6 +215,7 @@ cu update abc123 --due-date 2025-03-15
215
215
  cu update abc123 --assignee 12345
216
216
  cu update abc123 -n "New name" -s "done" --priority urgent
217
217
  cu update abc123 --time-estimate 2h
218
+ cu update abc123 --parent parentTaskId # make it a subtask
218
219
  cu update abc123 -s "in progress" --json
219
220
  ```
220
221
 
@@ -227,6 +228,7 @@ cu update abc123 -s "in progress" --json
227
228
  | `--due-date <date>` | Due date (`YYYY-MM-DD`) |
228
229
  | `--time-estimate <duration>` | Time estimate (e.g. `"2h"`, `"30m"`, `"1h30m"`) |
229
230
  | `--assignee <userId>` | Add assignee by numeric user ID |
231
+ | `--parent <taskId>` | Set parent task (makes this a subtask) |
230
232
  | `--json` | Force JSON output even in terminal |
231
233
 
232
234
  ### `cu create`
package/dist/index.js CHANGED
@@ -248,6 +248,15 @@ var ClickUpClient = class {
248
248
  }
249
249
  };
250
250
 
251
+ // src/date.ts
252
+ function formatDate(ms) {
253
+ const d = new Date(Number(ms));
254
+ const year = d.getUTCFullYear();
255
+ const month = String(d.getUTCMonth() + 1).padStart(2, "0");
256
+ const day = String(d.getUTCDate()).padStart(2, "0");
257
+ return `${year}-${month}-${day}`;
258
+ }
259
+
251
260
  // src/output.ts
252
261
  import chalk from "chalk";
253
262
  function isTTY() {
@@ -348,13 +357,6 @@ ${formatMarkdownTable(g.tasks, TASK_MD_COLUMNS)}`);
348
357
  if (sections.length === 0) return "No tasks found.";
349
358
  return sections.join("\n\n");
350
359
  }
351
- function formatDate(ms) {
352
- const d = new Date(Number(ms));
353
- const year = d.getUTCFullYear();
354
- const month = String(d.getUTCMonth() + 1).padStart(2, "0");
355
- const day = String(d.getUTCDate()).padStart(2, "0");
356
- return `${year}-${month}-${day}`;
357
- }
358
360
  function formatDuration(ms) {
359
361
  const totalMinutes = Math.floor(ms / 6e4);
360
362
  const hours = Math.floor(totalMinutes / 60);
@@ -627,11 +629,7 @@ function isInitiative(task) {
627
629
  }
628
630
  function formatDueDate(ms) {
629
631
  if (!ms) return "";
630
- const d = new Date(Number(ms));
631
- const year = d.getUTCFullYear();
632
- const month = String(d.getUTCMonth() + 1).padStart(2, "0");
633
- const day = String(d.getUTCDate()).padStart(2, "0");
634
- return `${year}-${month}-${day}`;
632
+ return formatDate(ms);
635
633
  }
636
634
  function summarize(task) {
637
635
  return {
@@ -746,10 +744,11 @@ function buildUpdatePayload(opts) {
746
744
  if (opts.timeEstimate !== void 0) {
747
745
  payload.time_estimate = parseTimeEstimate(opts.timeEstimate);
748
746
  }
747
+ if (opts.parent !== void 0) payload.parent = opts.parent;
749
748
  return payload;
750
749
  }
751
750
  function hasUpdateFields(options) {
752
- return options.name !== void 0 || options.description !== void 0 || options.markdown_content !== void 0 || options.status !== void 0 || options.priority !== void 0 || options.due_date !== void 0 || options.time_estimate !== void 0 || options.assignees !== void 0;
751
+ return options.name !== void 0 || options.description !== void 0 || options.markdown_content !== void 0 || options.status !== void 0 || options.priority !== void 0 || options.due_date !== void 0 || options.time_estimate !== void 0 || options.assignees !== void 0 || options.parent !== void 0;
753
752
  }
754
753
  async function resolveStatus(client, taskId, statusInput) {
755
754
  const task = await client.getTask(taskId);
@@ -769,7 +768,7 @@ async function resolveStatus(client, taskId, statusInput) {
769
768
  async function updateTask(config, taskId, options) {
770
769
  if (!hasUpdateFields(options))
771
770
  throw new Error(
772
- "Provide at least one of: --name, --description, --status, --priority, --due-date, --time-estimate, --assignee"
771
+ "Provide at least one of: --name, --description, --status, --priority, --due-date, --time-estimate, --assignee, --parent"
773
772
  );
774
773
  const client = new ClickUpClient(config);
775
774
  if (options.status !== void 0) {
@@ -2097,8 +2096,19 @@ async function moveTask(config, taskId, opts) {
2097
2096
  messages.push(`Added ${taskId} to list ${opts.to}`);
2098
2097
  }
2099
2098
  if (opts.remove) {
2100
- await client.removeTaskFromList(taskId, opts.remove);
2101
- messages.push(`Removed ${taskId} from list ${opts.remove}`);
2099
+ try {
2100
+ await client.removeTaskFromList(taskId, opts.remove);
2101
+ messages.push(`Removed ${taskId} from list ${opts.remove}`);
2102
+ } catch (err) {
2103
+ if (messages.length > 0) {
2104
+ const reason = err instanceof Error ? err.message : String(err);
2105
+ throw new Error(
2106
+ `${messages.join("; ")}; but failed to remove from list ${opts.remove}: ${reason}`,
2107
+ { cause: err }
2108
+ );
2109
+ }
2110
+ throw err;
2111
+ }
2102
2112
  }
2103
2113
  return messages.join("; ");
2104
2114
  }
@@ -2175,7 +2185,7 @@ program.command("task <taskId>").description("Get task details").option("--json"
2175
2185
  }
2176
2186
  })
2177
2187
  );
2178
- program.command("update <taskId>").description("Update a task").option("-n, --name <text>", "New task name").option("-d, --description <text>", "New description (markdown supported)").option("-s, --status <status>", 'New status (e.g. "in progress", "done")').option("--priority <level>", "Priority: urgent, high, normal, low (or 1-4)").option("--due-date <date>", "Due date (YYYY-MM-DD)").option("--time-estimate <duration>", 'Time estimate (e.g. "2h", "30m", "1h30m")').option("--assignee <userId>", "Add assignee by user ID").option("--json", "Force JSON output even in terminal").action(
2188
+ program.command("update <taskId>").description("Update a task").option("-n, --name <text>", "New task name").option("-d, --description <text>", "New description (markdown supported)").option("-s, --status <status>", 'New status (e.g. "in progress", "done")').option("--priority <level>", "Priority: urgent, high, normal, low (or 1-4)").option("--due-date <date>", "Due date (YYYY-MM-DD)").option("--time-estimate <duration>", 'Time estimate (e.g. "2h", "30m", "1h30m")').option("--assignee <userId>", "Add assignee by user ID").option("--parent <taskId>", "Set parent task (makes this a subtask)").option("--json", "Force JSON output even in terminal").action(
2179
2189
  wrapAction(async (taskId, opts) => {
2180
2190
  const config = loadConfig();
2181
2191
  const payload = buildUpdatePayload(opts);
@@ -2335,7 +2345,13 @@ program.command("depend <taskId>").description("Add or remove task dependencies"
2335
2345
  const config = loadConfig();
2336
2346
  const message = await manageDependency(config, taskId, opts);
2337
2347
  if (shouldOutputJson(opts.json ?? false)) {
2338
- console.log(JSON.stringify({ taskId, ...opts, message }, null, 2));
2348
+ console.log(
2349
+ JSON.stringify(
2350
+ { taskId, on: opts.on, blocks: opts.blocks, remove: opts.remove, message },
2351
+ null,
2352
+ 2
2353
+ )
2354
+ );
2339
2355
  } else {
2340
2356
  console.log(message);
2341
2357
  }
@@ -2346,7 +2362,7 @@ program.command("move <taskId>").description("Add or remove a task from a list")
2346
2362
  const config = loadConfig();
2347
2363
  const message = await moveTask(config, taskId, opts);
2348
2364
  if (shouldOutputJson(opts.json ?? false)) {
2349
- console.log(JSON.stringify({ taskId, ...opts, message }, null, 2));
2365
+ console.log(JSON.stringify({ taskId, to: opts.to, remove: opts.remove, message }, null, 2));
2350
2366
  } else {
2351
2367
  console.log(message);
2352
2368
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krodak/clickup-cli",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "description": "ClickUp CLI for AI agents and humans",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -58,7 +58,7 @@ All commands support `--help` for full flag details.
58
58
 
59
59
  | Command | What it does |
60
60
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------- |
61
- | `cu update <id> [-n name] [-d desc] [-s status] [--priority p] [--due-date d] [--time-estimate t] [--assignee id] [--json]` | Update task fields (desc supports markdown) |
61
+ | `cu update <id> [-n name] [-d desc] [-s status] [--priority p] [--due-date d] [--time-estimate t] [--assignee id] [--parent id] [--json]` | Update task fields (desc supports markdown) |
62
62
  | `cu create -n name [-l listId] [-p parentId] [-d desc] [-s status] [--priority p] [--due-date d] [--time-estimate t] [--assignee id] [--tags t] [--custom-item-id n] [--json]` | Create task (desc supports markdown) |
63
63
  | `cu comment <id> -m text [--json]` | Post comment on task |
64
64
  | `cu assign <id> [--to userId\|me] [--remove userId\|me] [--json]` | Assign/unassign users |
@@ -128,6 +128,7 @@ cu inbox --days 7 # recently updated
128
128
  cu update abc123def -s "done"
129
129
  cu update abc123def --priority high --due-date 2025-03-15
130
130
  cu update abc123def --time-estimate 2h
131
+ cu update abc123def --parent parentId # make it a subtask
131
132
  cu create -n "Fix the thing" -p abc123def
132
133
  cu create -n "Fix bug" -l <listId> --priority urgent --tags "bug,frontend"
133
134
  cu create -n "Q3 Roadmap" -l <listId> --custom-item-id 1 # create initiative