@krodak/clickup-cli 0.6.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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +395 -0
  3. package/dist/index.js +1772 -0
  4. package/package.json +65 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Krzysztof Rodak
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,395 @@
1
+ # cu - ClickUp CLI
2
+
3
+ A ClickUp CLI for AI agents and humans. Two operating modes: interactive tables with a task picker in terminals, raw JSON when piped.
4
+
5
+ ## Requirements
6
+
7
+ - Node 22+
8
+ - A ClickUp personal API token (`pk_...` from https://app.clickup.com/settings/apps)
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install -g @krodak/clickup-cli
14
+ ```
15
+
16
+ ## Getting started
17
+
18
+ ```bash
19
+ cu init
20
+ ```
21
+
22
+ Prompts for your API token, verifies it, auto-detects your workspace, and writes `~/.config/cu/config.json`.
23
+
24
+ ## Operating Modes
25
+
26
+ ### Interactive TTY mode (for humans)
27
+
28
+ When run in a terminal (TTY detected), list commands (`cu tasks`, `cu initiatives`, `cu sprint`, `cu inbox`, `cu subtasks`, `cu overdue`) display:
29
+
30
+ 1. A formatted table with auto-sized columns showing task ID, name, status, type, list, and URL.
31
+ 2. An interactive checkbox picker (powered by @inquirer/prompts) - navigate with arrow keys, toggle selection with space, confirm with enter.
32
+ 3. For selected tasks, a rich detail view showing: name (bold/underlined), ID, status, type, list, assignees, priority, dates, estimate, tracked time, tags, parent, URL, and a description preview (first 3 lines).
33
+ 4. A prompt to open the selected tasks in the browser.
34
+
35
+ Pass `--json` to any list command to bypass interactive mode and get raw JSON output in a terminal.
36
+
37
+ ### JSON piped mode (for AI agents and scripts)
38
+
39
+ When output is piped (no TTY), all list commands output JSON arrays to stdout. No interactive UI is shown.
40
+
41
+ - `cu task <id> --json` returns the full JSON response for a single task.
42
+ - All list commands output JSON arrays.
43
+ - Errors go to stderr with exit code 1.
44
+ - Write commands (`update`, `create`, `comment`, `assign`) always output JSON regardless of mode.
45
+ - Set `NO_COLOR` to disable color output.
46
+
47
+ ## For AI agents
48
+
49
+ Always use the `--json` flag or pipe output to ensure you get JSON. Parse with `jq` or programmatically.
50
+
51
+ ```bash
52
+ # List my in-progress tasks
53
+ cu tasks --status "in progress" --json | jq '.[] | {id, name}'
54
+
55
+ # Get full task details as JSON
56
+ cu task abc123 --json | jq '{id, name, status}'
57
+
58
+ # Check current sprint
59
+ cu sprint --json | jq '.[] | select(.status != "done")'
60
+
61
+ # Create subtask under initiative
62
+ INITIATIVE_ID=$(cu initiatives --json | jq -r '.[0].id')
63
+ cu create -n "New subtask" -p "$INITIATIVE_ID"
64
+
65
+ # Update status when done
66
+ cu update abc123 -s "done"
67
+ ```
68
+
69
+ Write commands (`update`, `create`, `comment`) always return JSON, no `--json` flag needed.
70
+
71
+ ## AI Agents Skill
72
+
73
+ A skill file is included at `skill/SKILL.md` that teaches AI agents how to use `cu`. Install it for your agent of choice:
74
+
75
+ ### OpenCode
76
+
77
+ ```bash
78
+ mkdir -p ~/.config/opencode/skills/clickup
79
+ cp skill/SKILL.md ~/.config/opencode/skills/clickup/SKILL.md
80
+ ```
81
+
82
+ ### Claude Code
83
+
84
+ ```bash
85
+ mkdir -p ~/.claude/skills/clickup
86
+ cp skill/SKILL.md ~/.claude/skills/clickup/SKILL.md
87
+ ```
88
+
89
+ Then reference it in your `CLAUDE.md` or project instructions.
90
+
91
+ ### Codex
92
+
93
+ Copy the contents of `skill/SKILL.md` into your Codex system prompt or project instructions file.
94
+
95
+ ### Other agents
96
+
97
+ The skill file is a standalone markdown document. Feed it to any agent that supports custom instructions or tool documentation.
98
+
99
+ ## Config
100
+
101
+ ### Config file
102
+
103
+ `~/.config/cu/config.json` (or `$XDG_CONFIG_HOME/cu/config.json`):
104
+
105
+ ```json
106
+ {
107
+ "apiToken": "pk_...",
108
+ "teamId": "12345678"
109
+ }
110
+ ```
111
+
112
+ ### Environment variables
113
+
114
+ Environment variables override config file values:
115
+
116
+ | Variable | Description |
117
+ | -------------- | ---------------------------------- |
118
+ | `CU_API_TOKEN` | ClickUp personal API token (`pk_`) |
119
+ | `CU_TEAM_ID` | Workspace (team) ID |
120
+
121
+ When both are set, the config file is not required. Useful for CI/CD and containerized agents.
122
+
123
+ ## Commands
124
+
125
+ ### `cu init`
126
+
127
+ First-time setup. Prompts for your API token, verifies it, auto-detects your workspace, and writes `~/.config/cu/config.json`.
128
+
129
+ ```bash
130
+ cu init
131
+ ```
132
+
133
+ ### `cu tasks`
134
+
135
+ List tasks assigned to me.
136
+
137
+ ```bash
138
+ cu tasks
139
+ cu tasks --status "in progress"
140
+ cu tasks --name "login"
141
+ cu tasks --list <listId>
142
+ cu tasks --space <spaceId>
143
+ cu tasks --json # force JSON output
144
+ ```
145
+
146
+ ### `cu initiatives`
147
+
148
+ List initiatives assigned to me.
149
+
150
+ ```bash
151
+ cu initiatives
152
+ cu initiatives --status "to do"
153
+ cu initiatives --name "auth"
154
+ cu initiatives --list <listId>
155
+ cu initiatives --space <spaceId>
156
+ cu initiatives --json
157
+ ```
158
+
159
+ ### `cu sprint`
160
+
161
+ List my tasks in the currently active sprint (auto-detected from sprint folder date ranges).
162
+
163
+ ```bash
164
+ cu sprint
165
+ cu sprint --status "in progress"
166
+ cu sprint --json
167
+ ```
168
+
169
+ ### `cu assigned`
170
+
171
+ All tasks assigned to me, grouped by pipeline stage (code review, in progress, to do, etc.).
172
+
173
+ ```bash
174
+ cu assigned
175
+ cu assigned --include-closed
176
+ cu assigned --json
177
+ ```
178
+
179
+ ### `cu inbox`
180
+
181
+ Tasks assigned to me that were recently updated, grouped by time period (today, yesterday, last 7 days, etc.). Default lookback is 30 days.
182
+
183
+ ```bash
184
+ cu inbox
185
+ cu inbox --days 7
186
+ cu inbox --json
187
+ ```
188
+
189
+ ### `cu task <id>`
190
+
191
+ Get task details. Pretty summary in terminal, JSON when piped.
192
+
193
+ ```bash
194
+ cu task abc123
195
+ cu task abc123 --json # full JSON response
196
+ ```
197
+
198
+ ### `cu subtasks <id>`
199
+
200
+ List subtasks of a task or initiative.
201
+
202
+ ```bash
203
+ cu subtasks abc123
204
+ cu subtasks abc123 --json
205
+ ```
206
+
207
+ ### `cu update <id>`
208
+
209
+ Update a task. Provide at least one option.
210
+
211
+ ```bash
212
+ cu update abc123 -s "in progress"
213
+ cu update abc123 -n "New task name"
214
+ cu update abc123 -d "Updated description with **markdown**"
215
+ cu update abc123 --priority high
216
+ cu update abc123 --due-date 2025-03-15
217
+ cu update abc123 --assignee 12345
218
+ cu update abc123 -n "New name" -s "done" --priority urgent
219
+ ```
220
+
221
+ | Flag | Description |
222
+ | -------------------------- | ---------------------------------------------------- |
223
+ | `-n, --name <text>` | New task name |
224
+ | `-d, --description <text>` | New description (markdown supported) |
225
+ | `-s, --status <status>` | New status (e.g. `"in progress"`, `"done"`) |
226
+ | `--priority <level>` | Priority: `urgent`, `high`, `normal`, `low` (or 1-4) |
227
+ | `--due-date <date>` | Due date (`YYYY-MM-DD`) |
228
+ | `--assignee <userId>` | Add assignee by numeric user ID |
229
+
230
+ ### `cu create`
231
+
232
+ Create a new task. If `--parent` is given, list is auto-detected from the parent task.
233
+
234
+ ```bash
235
+ cu create -n "Fix login bug" -l <listId>
236
+ cu create -n "Subtask name" -p <parentTaskId> # --list auto-detected
237
+ cu create -n "Task" -l <listId> -d "desc" -s "open"
238
+ cu create -n "Task" -l <listId> --priority high --due-date 2025-06-01
239
+ cu create -n "Task" -l <listId> --assignee 12345 --tags "bug,frontend"
240
+ ```
241
+
242
+ | Flag | Required | Description |
243
+ | -------------------------- | ---------------- | ---------------------------------------------------- |
244
+ | `-n, --name <name>` | yes | Task name |
245
+ | `-l, --list <listId>` | if no `--parent` | Target list ID |
246
+ | `-p, --parent <taskId>` | no | Parent task (list auto-detected) |
247
+ | `-d, --description <text>` | no | Description (markdown) |
248
+ | `-s, --status <status>` | no | Initial status |
249
+ | `--priority <level>` | no | Priority: `urgent`, `high`, `normal`, `low` (or 1-4) |
250
+ | `--due-date <date>` | no | Due date (`YYYY-MM-DD`) |
251
+ | `--assignee <userId>` | no | Assignee by numeric user ID |
252
+ | `--tags <tags>` | no | Comma-separated tag names |
253
+
254
+ ### `cu comment <id>`
255
+
256
+ Post a comment on a task.
257
+
258
+ ```bash
259
+ cu comment abc123 -m "Addressed in PR #42"
260
+ ```
261
+
262
+ ### `cu comments <id>`
263
+
264
+ List comments on a task. Formatted view in terminal, JSON when piped.
265
+
266
+ ```bash
267
+ cu comments abc123
268
+ cu comments abc123 --json
269
+ ```
270
+
271
+ ### `cu lists <spaceId>`
272
+
273
+ List all lists in a space, including lists inside folders. Useful for discovering list IDs needed by `--list` filter and `cu create -l`.
274
+
275
+ ```bash
276
+ cu lists <spaceId>
277
+ cu lists <spaceId> --name "sprint" # filter by partial name
278
+ cu lists <spaceId> --json
279
+ ```
280
+
281
+ | Flag | Description |
282
+ | ------------------ | ---------------------------------- |
283
+ | `--name <partial>` | Filter lists by partial name match |
284
+ | `--json` | Force JSON output |
285
+
286
+ ### `cu spaces`
287
+
288
+ List spaces in your workspace. Useful for getting space IDs for the `--space` filter.
289
+
290
+ ```bash
291
+ cu spaces
292
+ cu spaces --name "eng" # filter by partial name match (case-insensitive)
293
+ cu spaces --my # show only spaces you are a member of
294
+ cu spaces --json
295
+ ```
296
+
297
+ | Flag | Description |
298
+ | ------------------ | ----------------------------------- |
299
+ | `--name <partial>` | Filter spaces by partial name match |
300
+ | `--my` | Show only spaces you belong to |
301
+ | `--json` | Force JSON output |
302
+
303
+ ### `cu open <query>`
304
+
305
+ Open a task in the browser. Accepts a task ID or partial name.
306
+
307
+ ```bash
308
+ cu open abc123 # open by task ID
309
+ cu open "login bug" # search by name, open first match
310
+ cu open abc123 --json # output task JSON instead of opening
311
+ ```
312
+
313
+ If the query matches multiple tasks by name, all matches are listed and the first is opened.
314
+
315
+ ### `cu summary`
316
+
317
+ Daily standup helper. Shows tasks grouped into: recently completed, in progress, and overdue.
318
+
319
+ ```bash
320
+ cu summary
321
+ cu summary --hours 48 # extend completed window to 48 hours
322
+ cu summary --json
323
+ ```
324
+
325
+ | Flag | Description |
326
+ | ------------- | -------------------------------------------------- |
327
+ | `--hours <n>` | Lookback for recently completed tasks (default 24) |
328
+ | `--json` | Force JSON output |
329
+
330
+ ### `cu overdue`
331
+
332
+ List tasks that are past their due date (excludes done/closed tasks).
333
+
334
+ ```bash
335
+ cu overdue
336
+ cu overdue --json
337
+ ```
338
+
339
+ Tasks are sorted by due date ascending (most overdue first).
340
+
341
+ ### `cu assign <id>`
342
+
343
+ Assign or unassign users from a task. Supports `me` as shorthand for your user ID.
344
+
345
+ ```bash
346
+ cu assign abc123 --to 12345 # add assignee
347
+ cu assign abc123 --to me # assign yourself
348
+ cu assign abc123 --remove 12345 # remove assignee
349
+ cu assign abc123 --to me --remove 67890 # both at once
350
+ cu assign abc123 --to me --json # output updated task JSON
351
+ ```
352
+
353
+ | Flag | Description |
354
+ | ------------------- | --------------------------------- |
355
+ | `--to <userId>` | Add assignee (user ID or `me`) |
356
+ | `--remove <userId>` | Remove assignee (user ID or `me`) |
357
+ | `--json` | Force JSON output |
358
+
359
+ ### `cu config`
360
+
361
+ Manage CLI configuration.
362
+
363
+ ```bash
364
+ cu config get apiToken # print a config value
365
+ cu config set teamId 12345 # set a config value
366
+ cu config path # print config file path
367
+ ```
368
+
369
+ Valid keys: `apiToken`, `teamId`. Setting `apiToken` validates the `pk_` prefix.
370
+
371
+ ### `cu completion <shell>`
372
+
373
+ Output shell completion script. Supports `bash`, `zsh`, and `fish`.
374
+
375
+ ```bash
376
+ # Bash - add to ~/.bashrc
377
+ eval "$(cu completion bash)"
378
+
379
+ # Zsh - add to ~/.zshrc
380
+ eval "$(cu completion zsh)"
381
+
382
+ # Fish - save to completions directory
383
+ cu completion fish > ~/.config/fish/completions/cu.fish
384
+ ```
385
+
386
+ Completions cover all commands, flags, and known values (priority levels, status names, config keys).
387
+
388
+ ## Development
389
+
390
+ ```bash
391
+ npm install
392
+ npm test # unit tests (vitest, tests/unit/)
393
+ npm run test:e2e # e2e tests (tests/e2e/, requires CLICKUP_API_TOKEN in .env.test)
394
+ npm run build # tsup -> dist/
395
+ ```