@krodak/clickup-cli 1.41.0 → 1.43.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.41.0",
4
+ "version": "1.43.0",
5
5
  "author": {
6
6
  "name": "Krzysztof Rodak"
7
7
  },
package/dist/index.js CHANGED
@@ -769,16 +769,18 @@ var ClickUpClient = class {
769
769
  `/workspaces/${workspaceId}/docs/${docId}/pages/${pageId}?content_format=text/md`
770
770
  );
771
771
  }
772
- async createDoc(workspaceId, title, content, parentId) {
773
- const body = { title };
774
- if (content) body.content = content;
775
- if (parentId) {
776
- body.parent_id = parentId;
777
- body.parent_type = "doc";
778
- }
772
+ /**
773
+ * Create a Doc.
774
+ *
775
+ * ClickUp's v3 Create Doc endpoint accepts `name` only — `title` and `content`
776
+ * are silently ignored (the request still returns 201), which is why passing
777
+ * them produced unnamed Docs with empty root pages. Initial content must be
778
+ * written to the Doc's root page via {@link editDocPage}.
779
+ */
780
+ async createDoc(workspaceId, name) {
779
781
  return this.requestV3(`/workspaces/${workspaceId}/docs`, {
780
782
  method: "POST",
781
- body: JSON.stringify(body)
783
+ body: JSON.stringify({ name })
782
784
  });
783
785
  }
784
786
  async createDocPage(workspaceId, docId, name, content, parentPageId) {
@@ -859,11 +861,6 @@ var ClickUpClient = class {
859
861
  async deleteKeyResult(keyResultId) {
860
862
  await this.request(`/key_result/${keyResultId}`, { method: "DELETE" });
861
863
  }
862
- async deleteDoc(workspaceId, docId) {
863
- await this.requestV3(`/workspaces/${workspaceId}/docs/${docId}`, {
864
- method: "DELETE"
865
- });
866
- }
867
864
  async deleteDocPage(workspaceId, docId, pageId) {
868
865
  await this.requestV3(
869
866
  `/workspaces/${workspaceId}/docs/${docId}/pages/${pageId}`,
@@ -1166,6 +1163,10 @@ var VALID_FAVORITE_TYPES = /* @__PURE__ */ new Set([
1166
1163
  "view",
1167
1164
  "task"
1168
1165
  ]);
1166
+ function looksLikeTaskId(value) {
1167
+ if (/^[A-Za-z]+-\d+$/.test(value)) return true;
1168
+ return value.length >= 6 && /^[a-z0-9]+$/i.test(value) && /\d/.test(value);
1169
+ }
1169
1170
  function isFilterEntry(v) {
1170
1171
  if (!isRecord(v)) return false;
1171
1172
  if (!Array.isArray(v.command)) return false;
@@ -1373,7 +1374,9 @@ function loadConfig(profileName) {
1373
1374
  const profile = multi.profiles[resolvedProfile];
1374
1375
  if (!profile) {
1375
1376
  const available = Object.keys(multi.profiles).join(", ");
1376
- throw new Error(`Profile "${resolvedProfile}" not found. Available: ${available}`);
1377
+ throw new Error(
1378
+ `Profile "${resolvedProfile}" not found. Available: ${available}` + (looksLikeTaskId(resolvedProfile) ? `. That looks like a task ID \u2014 note that -p is --profile, not --parent. For a subtask use: cup create --parent ${resolvedProfile} ...` : "")
1379
+ );
1377
1380
  }
1378
1381
  const apiToken = envToken ?? profile.apiToken?.trim();
1379
1382
  if (!apiToken) {
@@ -3469,12 +3472,12 @@ async function runAssignedCommand(config, opts) {
3469
3472
  }
3470
3473
 
3471
3474
  // src/commands/open.ts
3472
- function looksLikeTaskId(query) {
3475
+ function looksLikeTaskId2(query) {
3473
3476
  return /^[a-z0-9]+$/i.test(query) && query.length <= 12 || isCustomTaskId(query);
3474
3477
  }
3475
3478
  async function openTask(config, query, opts = {}) {
3476
3479
  const client = new ClickUpClient(config);
3477
- if (looksLikeTaskId(query)) {
3480
+ if (looksLikeTaskId2(query)) {
3478
3481
  let task;
3479
3482
  try {
3480
3483
  task = await client.getTask(query);
@@ -3955,7 +3958,6 @@ var commandMetadata = [
3955
3958
  "-d",
3956
3959
  "--description",
3957
3960
  "--description-file",
3958
- "-p",
3959
3961
  "--parent",
3960
3962
  "-s",
3961
3963
  "--status",
@@ -4471,10 +4473,14 @@ var commandMetadata = [
4471
4473
  },
4472
4474
  {
4473
4475
  name: "doc-delete",
4474
- description: "Delete a doc",
4476
+ description: "Not supported: ClickUp has no delete-Doc API (use the ClickUp UI)",
4475
4477
  flags: ["--json"],
4476
4478
  quickReference: [
4477
- { section: "write", usage: "doc-delete <docId>", description: "Delete a doc" }
4479
+ {
4480
+ section: "write",
4481
+ usage: "doc-delete <docId>",
4482
+ description: "Not supported by ClickUp API (delete Docs in the UI)"
4483
+ }
4478
4484
  ]
4479
4485
  },
4480
4486
  {
@@ -5326,7 +5332,7 @@ ${renderZshTopLevelCommands(name)}
5326
5332
  '(-n --name)'{-n,--name}'[Task name]:name:' \\
5327
5333
  '(-d --description)'{-d,--description}'[Task description]:text:' \\
5328
5334
  '--description-file[Read description from a file (- for stdin)]:path:_files' \\
5329
- '(-p --parent)'{-p,--parent}'[Parent task ID]:task_id:' \\
5335
+ '--parent[Parent task ID]:task_id:' \\
5330
5336
  '(-s --status)'{-s,--status}'[Initial status]:status:(open "in progress" "in review" done closed)' \\
5331
5337
  '--priority[Priority level]:priority:(urgent high normal low)' \\
5332
5338
  '--due-date[Due date]:date:' \\
@@ -7268,8 +7274,22 @@ function formatDocPagesMarkdown(pages) {
7268
7274
  async function createDoc(config, title, content) {
7269
7275
  if (!title.trim()) throw new Error("Doc title cannot be empty");
7270
7276
  const client = new ClickUpClient(config);
7271
- const doc = await client.createDoc(config.teamId, title, content);
7272
- return { id: doc.id, title: doc.name ?? title };
7277
+ const doc = await client.createDoc(config.teamId, title);
7278
+ try {
7279
+ const pages = await client.getDocPageListing(config.teamId, doc.id);
7280
+ const rootPage = pages[0];
7281
+ if (!rootPage) throw new Error("the doc has no root page");
7282
+ await client.editDocPage(config.teamId, doc.id, rootPage.id, {
7283
+ name: title,
7284
+ ...content !== void 0 ? { content } : {}
7285
+ });
7286
+ } catch (err) {
7287
+ throw new Error(
7288
+ `Created doc ${doc.id} but could not write its root page: ${err.message}`,
7289
+ { cause: err }
7290
+ );
7291
+ }
7292
+ return { id: doc.id, title: doc.name || title };
7273
7293
  }
7274
7294
  async function createDocPage(config, docId, name, content, parentPageId) {
7275
7295
  if (!name.trim()) throw new Error("Page name cannot be empty");
@@ -7283,9 +7303,10 @@ async function editDocPage(config, docId, pageId, updates) {
7283
7303
  const client = new ClickUpClient(config);
7284
7304
  return client.editDocPage(config.teamId, docId, pageId, updates);
7285
7305
  }
7286
- async function deleteDoc(config, docId) {
7287
- const client = new ClickUpClient(config);
7288
- await client.deleteDoc(config.teamId, docId);
7306
+ async function deleteDoc(docId) {
7307
+ throw new Error(
7308
+ `Cannot delete doc ${docId}: ClickUp's public API does not support deleting Docs (no delete endpoint exists; the request returns HTTP 405). Delete or archive the Doc in the ClickUp UI instead. To remove a single page, use \`cup doc-page-delete <docId> <pageId>\`.`
7309
+ );
7289
7310
  }
7290
7311
  async function deleteDocPage(config, docId, pageId) {
7291
7312
  const client = new ClickUpClient(config);
@@ -8937,7 +8958,9 @@ function buildProgram(programName = basename(process.argv[1] ?? "cup")) {
8937
8958
  "--description-file <path>",
8938
8959
  'Read description from a file ("-" for stdin); avoids shell quoting. Mutually exclusive with -d'
8939
8960
  ).option(
8940
- "-p, --parent <taskId>",
8961
+ // No -p short flag: it collides with the global -p, --profile and would be
8962
+ // parsed as the profile name (see the global-option-collision test).
8963
+ "--parent <taskId>",
8941
8964
  "Parent task: native id, custom id (e.g. PROD-811), or task URL (list auto-detected)"
8942
8965
  ).option("-s, --status <status>", "Initial status").option("--priority <level>", "Priority: urgent, high, normal, low (or 1-4)").option(
8943
8966
  "--due-date <date>",
@@ -10283,15 +10306,9 @@ function buildProgram(programName = basename(process.argv[1] ?? "cup")) {
10283
10306
  }
10284
10307
  )
10285
10308
  );
10286
- program.command("doc-delete <docId>").description("Delete a doc").option("--json", "Force JSON output even in terminal").action(
10287
- wrapAction(async (docId, opts) => {
10288
- const config = loadConfig(getProfileName());
10289
- await deleteDoc(config, docId);
10290
- if (shouldOutputJson(opts.json ?? false)) {
10291
- console.log(JSON.stringify({ success: true, docId }, null, 2));
10292
- } else {
10293
- console.log(`Deleted doc ${docId}`);
10294
- }
10309
+ program.command("doc-delete <docId>").description("Not supported: ClickUp has no delete-Doc API (use the ClickUp UI)").option("--json", "Force JSON output even in terminal").action(
10310
+ wrapAction(async (docId) => {
10311
+ await deleteDoc(docId);
10295
10312
  })
10296
10313
  );
10297
10314
  program.command("doc-page-delete <docId> <pageId>").description("Delete a doc page").option("--json", "Force JSON output even in terminal").action(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krodak/clickup-cli",
3
- "version": "1.41.0",
3
+ "version": "1.43.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.41.0
6
+ # ClickUp CLI (`cup`) - skill version 1.43.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.41.0, 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.43.0, update with `npm install -g @krodak/clickup-cli` and refresh this skill with `cup skill`.
11
11
 
12
12
  ## Install & Configure
13
13
 
@@ -163,7 +163,7 @@ All commands support `--help` for full flag details. All commands support `--jso
163
163
 
164
164
  | Command | What it does |
165
165
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
166
- | `cup create -n name [-l listId\|sprint:current] [-p parentId] [-d desc\|--description-file path] [-s status] [--priority p] [--due-date d] [--start-date d] [--time-estimate t] [--assignee id\|me] [--group-assignee uuid\|@handle,...] [--tags t] [--custom-item-id n] [--template id] [--field "Name" val]` | Create task (`--list` accepts `sprint:current`, `--field` sets custom fields inline; `--description-file` reads markdown from a file or `-` for stdin) |
166
+ | `cup create -n name [-l listId\|sprint:current] [--parent parentId] [-d desc\|--description-file path] [-s status] [--priority p] [--due-date d] [--start-date d] [--time-estimate t] [--assignee id\|me] [--group-assignee uuid\|@handle,...] [--tags t] [--custom-item-id n] [--template id] [--field "Name" val]` | Create task (`--list` accepts `sprint:current`, `--field` sets custom fields inline; `--description-file` reads markdown from a file or `-` for stdin) |
167
167
  | `cup update <id> [-n name] [-d desc\|--description-file path] [-s status] [--priority p] [--due-date d\|none] [--start-date d] [--time-estimate t] [--assignee id\|me] [--remove-assignee id\|me] [--group-assignee uuid\|@handle] [--remove-group-assignee uuid\|@handle] [--parent id] [--archive] [--unarchive] [--type type] [--field "Name" val]` | Update task fields (`--description-file` reads markdown from a file or `-` for stdin) |
168
168
  | `cup comment <id> -m text\|--message-file path [--notify-all] [--mention user]` | Post comment (markdown auto-converted to rich text; `--message-file` reads from a file or `-` for stdin; `--mention` for real @mentions, repeatable) |
169
169
  | `cup comment-edit <commentId> -m text\|--message-file path [--resolved] [--unresolved] [--mention user]` | Edit a comment (markdown auto-converted to rich text; `--mention` for real @mentions) |
@@ -209,10 +209,10 @@ All commands support `--help` for full flag details. All commands support `--jso
209
209
  | `cup key-result-create <goalId> <name> [--type t] [--target n]` | Create key result |
210
210
  | `cup key-result-update <keyResultId> [--progress n] [--note text]` | Update key result |
211
211
  | `cup key-result-delete <keyResultId>` | Delete key result |
212
- | `cup doc-create <title> [-c content]` | Create a doc |
212
+ | `cup doc-create <title> [-c content]` | Create a doc (root page is named after the title; `-c` writes its markdown content) |
213
213
  | `cup doc-page-create <docId> <name> [-c content] [--parent-page pageId]` | Create doc page |
214
214
  | `cup doc-page-edit <docId> <pageId> [--name text] [-c content]` | Edit doc page |
215
- | `cup doc-delete <docId>` | Delete a doc |
215
+ | `cup doc-delete <docId>` | **Not supported** — ClickUp has no delete-Doc API (HTTP 405). Fails fast; delete Docs in the UI. Use `cup doc-page-delete` for a single page |
216
216
  | `cup doc-page-delete <docId> <pageId>` | Delete doc page |
217
217
  | `cup space-create <name>` | Create a space |
218
218
  | `cup list-create <spaceId> <name> [--folder folderId] [--copy-statuses-from id]` | Create a list in a space or folder |
@@ -261,6 +261,10 @@ All commands support `--help` for full flag details. All commands support `--jso
261
261
  | `-p, --profile <n>` | Use a specific profile for this command |
262
262
  | `--json` | Force JSON output (available on all commands) |
263
263
 
264
+ > **`-p` is always `--profile`, never `--parent`.** Global short flags win over subcommand
265
+ > ones, so `cup create -p <taskId>` fails with `Profile "<taskId>" not found`. Use
266
+ > `cup create --parent <taskId>`.
267
+
264
268
  ## Flags & Conventions
265
269
 
266
270
  | Topic | Detail |
@@ -352,7 +356,7 @@ cup update abc123def -s "done"
352
356
  cup update abc123def --priority high --due-date 2025-03-15
353
357
  cup update abc123def --due-date 2025-03-15T14:30 # date + time (user's timezone)
354
358
  cup update abc123def --due-date 2025-03-15T14:30:00Z # UTC
355
- cup create -n "Fix the thing" -p abc123def
359
+ cup create -n "Fix the thing" --parent abc123def # -p is the global --profile, not --parent
356
360
  cup create -n "Fix bug" -l <listId> --priority urgent --tags "bug,frontend"
357
361
  cup create -n "Bug fix" -l sprint:current # create in active sprint
358
362
  cup create -n "Q3 Roadmap" -l <listId> --custom-item-id 1