@krodak/clickup-cli 1.5.0 → 1.5.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.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +27 -182
- package/dist/index.js +1817 -1420
- package/package.json +2 -1
- package/skills/clickup-cli/SKILL.md +126 -232
package/dist/index.js
CHANGED
|
@@ -1,14 +1,69 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { basename } from "path";
|
|
4
|
+
import { basename, resolve } from "path";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { createRequire } from "module";
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
7
8
|
|
|
8
9
|
// src/api.ts
|
|
9
10
|
var BASE_URL = "https://api.clickup.com/api/v2";
|
|
10
11
|
var BASE_URL_V3 = "https://api.clickup.com/api/v3";
|
|
11
12
|
var MAX_PAGES = 100;
|
|
13
|
+
function isRecord(value) {
|
|
14
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15
|
+
}
|
|
16
|
+
function expectRecord(value, context) {
|
|
17
|
+
if (!isRecord(value)) {
|
|
18
|
+
throw new Error(`Unexpected API response: expected ${context} object`);
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
function expectRecordField(data, key, context) {
|
|
23
|
+
return expectRecord(data[key], context);
|
|
24
|
+
}
|
|
25
|
+
function expectNumericField(data, key, context) {
|
|
26
|
+
const value = Number(data[key]);
|
|
27
|
+
if (!Number.isInteger(value)) {
|
|
28
|
+
throw new Error(`Unexpected API response: expected ${context}.${key} to be numeric`);
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
function expectStringField(data, key, context) {
|
|
33
|
+
const value = data[key];
|
|
34
|
+
if (typeof value !== "string") {
|
|
35
|
+
throw new Error(`Unexpected API response: expected ${context}.${key} to be a string`);
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
function expectArrayField(data, key, context) {
|
|
40
|
+
const value = data[key];
|
|
41
|
+
if (!Array.isArray(value)) {
|
|
42
|
+
throw new Error(`Unexpected API response: expected ${context}.${key} to be an array`);
|
|
43
|
+
}
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
function readCollectionField(data, key, context) {
|
|
47
|
+
if (data[key] === void 0) return [];
|
|
48
|
+
return expectArrayField(data, key, context);
|
|
49
|
+
}
|
|
50
|
+
function expectBooleanField(data, key, context) {
|
|
51
|
+
const value = data[key];
|
|
52
|
+
if (typeof value !== "boolean") {
|
|
53
|
+
throw new Error(`Unexpected API response: expected ${context}.${key} to be a boolean`);
|
|
54
|
+
}
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
function expectPaginatedCollectionField(data, key, context) {
|
|
58
|
+
const items = data[key];
|
|
59
|
+
if (!Array.isArray(items)) {
|
|
60
|
+
throw new Error(`Unexpected API response: expected ${key} array`);
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
items,
|
|
64
|
+
lastPage: expectBooleanField(data, "last_page", context)
|
|
65
|
+
};
|
|
66
|
+
}
|
|
12
67
|
function isCustomTaskId(id) {
|
|
13
68
|
return /^[A-Z]+-\d+$/i.test(id);
|
|
14
69
|
}
|
|
@@ -44,12 +99,13 @@ var ClickUpClient = class {
|
|
|
44
99
|
...options.headers
|
|
45
100
|
}
|
|
46
101
|
});
|
|
47
|
-
let
|
|
102
|
+
let parsed;
|
|
48
103
|
try {
|
|
49
|
-
|
|
104
|
+
parsed = await res.json();
|
|
50
105
|
} catch {
|
|
51
106
|
throw new Error(`ClickUp API error ${res.status}: response was not valid JSON`);
|
|
52
107
|
}
|
|
108
|
+
const data = expectRecord(parsed, "JSON");
|
|
53
109
|
if (!res.ok) {
|
|
54
110
|
const raw = data.err ?? data.error ?? data.ECODE ?? res.statusText;
|
|
55
111
|
const errMsg = typeof raw === "string" ? raw : JSON.stringify(raw);
|
|
@@ -66,8 +122,12 @@ var ClickUpClient = class {
|
|
|
66
122
|
async getMe() {
|
|
67
123
|
if (this.meCache) return this.meCache;
|
|
68
124
|
const data = await this.request("/user");
|
|
69
|
-
|
|
70
|
-
|
|
125
|
+
const user = expectRecordField(data, "user", "user");
|
|
126
|
+
this.meCache = {
|
|
127
|
+
id: expectNumericField(user, "id", "user"),
|
|
128
|
+
username: expectStringField(user, "username", "user")
|
|
129
|
+
};
|
|
130
|
+
return this.meCache;
|
|
71
131
|
}
|
|
72
132
|
async paginate(buildPath) {
|
|
73
133
|
const allTasks = [];
|
|
@@ -75,12 +135,13 @@ var ClickUpClient = class {
|
|
|
75
135
|
let lastPage = false;
|
|
76
136
|
while (!lastPage && page < MAX_PAGES) {
|
|
77
137
|
const data = await this.request(buildPath(page));
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
138
|
+
const taskPage = expectPaginatedCollectionField(
|
|
139
|
+
data,
|
|
140
|
+
"tasks",
|
|
141
|
+
"task page"
|
|
142
|
+
);
|
|
143
|
+
allTasks.push(...taskPage.items);
|
|
144
|
+
lastPage = taskPage.lastPage;
|
|
84
145
|
page++;
|
|
85
146
|
}
|
|
86
147
|
if (page >= MAX_PAGES && !lastPage) {
|
|
@@ -123,7 +184,11 @@ var ClickUpClient = class {
|
|
|
123
184
|
}
|
|
124
185
|
async getTaskComments(taskId) {
|
|
125
186
|
const data = await this.request(this.taskPath(taskId, "/comment"));
|
|
126
|
-
return
|
|
187
|
+
return readCollectionField(
|
|
188
|
+
data,
|
|
189
|
+
"comments",
|
|
190
|
+
"task comments"
|
|
191
|
+
);
|
|
127
192
|
}
|
|
128
193
|
async getTasksFromList(listId, params = {}, options = {}) {
|
|
129
194
|
return this.paginate((page) => {
|
|
@@ -144,7 +209,7 @@ var ClickUpClient = class {
|
|
|
144
209
|
}
|
|
145
210
|
async getTeams() {
|
|
146
211
|
const data = await this.request("/team");
|
|
147
|
-
return data
|
|
212
|
+
return readCollectionField(data, "teams", "teams");
|
|
148
213
|
}
|
|
149
214
|
async getSpaceWithStatuses(spaceId) {
|
|
150
215
|
return this.request(`/space/${spaceId}`);
|
|
@@ -154,27 +219,31 @@ var ClickUpClient = class {
|
|
|
154
219
|
}
|
|
155
220
|
async getSpaces(teamId) {
|
|
156
221
|
const data = await this.request(`/team/${teamId}/space?archived=false`);
|
|
157
|
-
return data
|
|
222
|
+
return readCollectionField(data, "spaces", "spaces");
|
|
158
223
|
}
|
|
159
224
|
async getCustomTaskTypes(teamId) {
|
|
160
225
|
const data = await this.request(
|
|
161
226
|
`/team/${teamId}/custom_item`
|
|
162
227
|
);
|
|
163
|
-
return
|
|
228
|
+
return readCollectionField(
|
|
229
|
+
data,
|
|
230
|
+
"custom_items",
|
|
231
|
+
"custom task types"
|
|
232
|
+
);
|
|
164
233
|
}
|
|
165
234
|
async getLists(spaceId) {
|
|
166
235
|
const data = await this.request(`/space/${spaceId}/list?archived=false`);
|
|
167
|
-
return data
|
|
236
|
+
return readCollectionField(data, "lists", "space lists");
|
|
168
237
|
}
|
|
169
238
|
async getFolders(spaceId) {
|
|
170
239
|
const data = await this.request(
|
|
171
240
|
`/space/${spaceId}/folder?archived=false`
|
|
172
241
|
);
|
|
173
|
-
return data
|
|
242
|
+
return readCollectionField(data, "folders", "space folders");
|
|
174
243
|
}
|
|
175
244
|
async getFolderLists(folderId) {
|
|
176
245
|
const data = await this.request(`/folder/${folderId}/list?archived=false`);
|
|
177
|
-
return data
|
|
246
|
+
return readCollectionField(data, "lists", "folder lists");
|
|
178
247
|
}
|
|
179
248
|
async getListViews(listId) {
|
|
180
249
|
return this.request(
|
|
@@ -242,7 +311,11 @@ var ClickUpClient = class {
|
|
|
242
311
|
}
|
|
243
312
|
async getThreadedComments(commentId) {
|
|
244
313
|
const data = await this.request(`/comment/${commentId}/reply`);
|
|
245
|
-
return
|
|
314
|
+
return readCollectionField(
|
|
315
|
+
data,
|
|
316
|
+
"comments",
|
|
317
|
+
"threaded comments"
|
|
318
|
+
);
|
|
246
319
|
}
|
|
247
320
|
async createThreadedComment(commentId, text, notifyAll) {
|
|
248
321
|
const body = { comment_text: text };
|
|
@@ -264,14 +337,22 @@ var ClickUpClient = class {
|
|
|
264
337
|
}
|
|
265
338
|
async getListCustomFields(listId) {
|
|
266
339
|
const data = await this.request(`/list/${listId}/field`);
|
|
267
|
-
return
|
|
340
|
+
return readCollectionField(
|
|
341
|
+
data,
|
|
342
|
+
"fields",
|
|
343
|
+
"list custom fields"
|
|
344
|
+
);
|
|
268
345
|
}
|
|
269
346
|
async createChecklist(taskId, name) {
|
|
270
347
|
const data = await this.request(this.taskPath(taskId, "/checklist"), {
|
|
271
348
|
method: "POST",
|
|
272
349
|
body: JSON.stringify({ name })
|
|
273
350
|
});
|
|
274
|
-
return
|
|
351
|
+
return expectRecordField(
|
|
352
|
+
data,
|
|
353
|
+
"checklist",
|
|
354
|
+
"checklist"
|
|
355
|
+
);
|
|
275
356
|
}
|
|
276
357
|
async deleteChecklist(checklistId) {
|
|
277
358
|
await this.request(`/checklist/${checklistId}`, { method: "DELETE" });
|
|
@@ -281,14 +362,22 @@ var ClickUpClient = class {
|
|
|
281
362
|
`/checklist/${checklistId}/checklist_item`,
|
|
282
363
|
{ method: "POST", body: JSON.stringify({ name }) }
|
|
283
364
|
);
|
|
284
|
-
return
|
|
365
|
+
return expectRecordField(
|
|
366
|
+
data,
|
|
367
|
+
"checklist",
|
|
368
|
+
"checklist"
|
|
369
|
+
);
|
|
285
370
|
}
|
|
286
371
|
async editChecklistItem(checklistId, checklistItemId, updates) {
|
|
287
372
|
const data = await this.request(
|
|
288
373
|
`/checklist/${checklistId}/checklist_item/${checklistItemId}`,
|
|
289
374
|
{ method: "PUT", body: JSON.stringify(updates) }
|
|
290
375
|
);
|
|
291
|
-
return
|
|
376
|
+
return expectRecordField(
|
|
377
|
+
data,
|
|
378
|
+
"checklist",
|
|
379
|
+
"checklist"
|
|
380
|
+
);
|
|
292
381
|
}
|
|
293
382
|
async deleteChecklistItem(checklistId, checklistItemId) {
|
|
294
383
|
await this.request(
|
|
@@ -348,7 +437,11 @@ var ClickUpClient = class {
|
|
|
348
437
|
const query = params.toString();
|
|
349
438
|
const url = `/team/${teamId}/time_entries${query ? `?${query}` : ""}`;
|
|
350
439
|
const data = await this.request(url);
|
|
351
|
-
const entries =
|
|
440
|
+
const entries = readCollectionField(
|
|
441
|
+
data,
|
|
442
|
+
"data",
|
|
443
|
+
"time entries"
|
|
444
|
+
);
|
|
352
445
|
if (opts?.taskId) {
|
|
353
446
|
return entries.filter((e) => e.task?.id === opts.taskId);
|
|
354
447
|
}
|
|
@@ -363,7 +456,7 @@ var ClickUpClient = class {
|
|
|
363
456
|
}
|
|
364
457
|
async getSpaceTags(spaceId) {
|
|
365
458
|
const data = await this.request(`/space/${spaceId}/tag`);
|
|
366
|
-
return data
|
|
459
|
+
return readCollectionField(data, "tags", "space tags");
|
|
367
460
|
}
|
|
368
461
|
async createSpaceTag(spaceId, name, fg, bg) {
|
|
369
462
|
await this.request(`/space/${spaceId}/tag`, {
|
|
@@ -381,7 +474,11 @@ var ClickUpClient = class {
|
|
|
381
474
|
}
|
|
382
475
|
async getWorkspaceMembers(teamId) {
|
|
383
476
|
const data = await this.request("/team");
|
|
384
|
-
const team =
|
|
477
|
+
const team = readCollectionField(
|
|
478
|
+
data,
|
|
479
|
+
"teams",
|
|
480
|
+
"workspace members"
|
|
481
|
+
).find((t) => t.id === teamId);
|
|
385
482
|
return team?.members?.map((m) => m.user) ?? [];
|
|
386
483
|
}
|
|
387
484
|
async deleteTimeEntry(teamId, timeEntryId) {
|
|
@@ -422,7 +519,7 @@ var ClickUpClient = class {
|
|
|
422
519
|
}
|
|
423
520
|
async getDocs(workspaceId) {
|
|
424
521
|
const data = await this.requestV3(`/workspaces/${workspaceId}/docs`);
|
|
425
|
-
return data
|
|
522
|
+
return readCollectionField(data, "docs", "docs");
|
|
426
523
|
}
|
|
427
524
|
async getDocPage(workspaceId, docId, pageId) {
|
|
428
525
|
return this.requestV3(
|
|
@@ -463,17 +560,21 @@ var ClickUpClient = class {
|
|
|
463
560
|
const data = await this.requestV3(
|
|
464
561
|
`/workspaces/${workspaceId}/docs/${docId}/pagelisting`
|
|
465
562
|
);
|
|
466
|
-
return
|
|
563
|
+
return readCollectionField(
|
|
564
|
+
data,
|
|
565
|
+
"pages",
|
|
566
|
+
"doc page listing"
|
|
567
|
+
);
|
|
467
568
|
}
|
|
468
569
|
async getDocPages(workspaceId, docId) {
|
|
469
570
|
const data = await this.requestV3(
|
|
470
571
|
`/workspaces/${workspaceId}/docs/${docId}/pages?content_format=text/md`
|
|
471
572
|
);
|
|
472
|
-
return data
|
|
573
|
+
return readCollectionField(data, "pages", "doc pages");
|
|
473
574
|
}
|
|
474
575
|
async getGoals(teamId) {
|
|
475
576
|
const data = await this.request(`/team/${teamId}/goal`);
|
|
476
|
-
return data
|
|
577
|
+
return readCollectionField(data, "goals", "goals");
|
|
477
578
|
}
|
|
478
579
|
async createGoal(teamId, name, opts) {
|
|
479
580
|
const body = { name, multiple_owners: true };
|
|
@@ -553,7 +654,11 @@ var ClickUpClient = class {
|
|
|
553
654
|
const data = await this.request(
|
|
554
655
|
`/team/${teamId}/taskTemplate?page=0`
|
|
555
656
|
);
|
|
556
|
-
return
|
|
657
|
+
return readCollectionField(
|
|
658
|
+
data,
|
|
659
|
+
"templates",
|
|
660
|
+
"task templates"
|
|
661
|
+
);
|
|
557
662
|
}
|
|
558
663
|
async createTaskFromTemplate(listId, templateId, name) {
|
|
559
664
|
return this.request(`/list/${listId}/taskTemplate/${templateId}`, {
|
|
@@ -567,6 +672,50 @@ var ClickUpClient = class {
|
|
|
567
672
|
import fs from "fs";
|
|
568
673
|
import { homedir } from "os";
|
|
569
674
|
import { join } from "path";
|
|
675
|
+
function isRecord2(value) {
|
|
676
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
677
|
+
}
|
|
678
|
+
function readConfigString(parsed, key, path, strict) {
|
|
679
|
+
const value = parsed[key];
|
|
680
|
+
if (value === void 0) return void 0;
|
|
681
|
+
if (typeof value !== "string") {
|
|
682
|
+
if (strict) {
|
|
683
|
+
throw new Error(`Config field ${key} must be a string in ${path}.`);
|
|
684
|
+
}
|
|
685
|
+
return void 0;
|
|
686
|
+
}
|
|
687
|
+
const trimmed = value.trim();
|
|
688
|
+
return trimmed || void 0;
|
|
689
|
+
}
|
|
690
|
+
function parseConfigFile(raw, path, strictFields, strictRoot = strictFields) {
|
|
691
|
+
let parsed;
|
|
692
|
+
try {
|
|
693
|
+
parsed = JSON.parse(raw);
|
|
694
|
+
} catch {
|
|
695
|
+
if (strictRoot) {
|
|
696
|
+
throw new Error(`Config file at ${path} contains invalid JSON. Please check the file syntax.`);
|
|
697
|
+
}
|
|
698
|
+
return {};
|
|
699
|
+
}
|
|
700
|
+
if (!isRecord2(parsed)) {
|
|
701
|
+
if (strictRoot) {
|
|
702
|
+
throw new Error(`Config file at ${path} must contain a JSON object.`);
|
|
703
|
+
}
|
|
704
|
+
return {};
|
|
705
|
+
}
|
|
706
|
+
const apiToken = readConfigString(parsed, "apiToken", path, strictFields);
|
|
707
|
+
const teamId = readConfigString(parsed, "teamId", path, strictFields);
|
|
708
|
+
const sprintFolderId = readConfigString(parsed, "sprintFolderId", path, strictFields);
|
|
709
|
+
return {
|
|
710
|
+
...apiToken ? { apiToken } : {},
|
|
711
|
+
...teamId ? { teamId } : {},
|
|
712
|
+
...sprintFolderId ? { sprintFolderId } : {}
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
function trimConfigValue(value) {
|
|
716
|
+
const trimmed = value?.trim();
|
|
717
|
+
return trimmed || void 0;
|
|
718
|
+
}
|
|
570
719
|
function configDir() {
|
|
571
720
|
const xdg = process.env.XDG_CONFIG_HOME;
|
|
572
721
|
if (xdg) return join(xdg, "cup");
|
|
@@ -601,15 +750,10 @@ function loadConfig() {
|
|
|
601
750
|
const path = configPath();
|
|
602
751
|
if (fs.existsSync(path)) {
|
|
603
752
|
const raw = fs.readFileSync(path, "utf-8");
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
throw new Error(`Config file at ${path} contains invalid JSON. Please check the file syntax.`);
|
|
609
|
-
}
|
|
610
|
-
fileToken = parsed.apiToken?.trim();
|
|
611
|
-
fileTeamId = parsed.teamId?.trim();
|
|
612
|
-
fileSprintFolderId = parsed.sprintFolderId?.trim() || void 0;
|
|
753
|
+
const parsed = parseConfigFile(raw, path, true);
|
|
754
|
+
fileToken = parsed.apiToken;
|
|
755
|
+
fileTeamId = parsed.teamId;
|
|
756
|
+
fileSprintFolderId = parsed.sprintFolderId;
|
|
613
757
|
}
|
|
614
758
|
const apiToken = envToken || fileToken;
|
|
615
759
|
if (!apiToken) {
|
|
@@ -628,11 +772,7 @@ function loadRawConfig() {
|
|
|
628
772
|
migrateFromLegacy();
|
|
629
773
|
const path = configPath();
|
|
630
774
|
if (!fs.existsSync(path)) return {};
|
|
631
|
-
|
|
632
|
-
return JSON.parse(fs.readFileSync(path, "utf-8"));
|
|
633
|
-
} catch {
|
|
634
|
-
return {};
|
|
635
|
-
}
|
|
775
|
+
return parseConfigFile(fs.readFileSync(path, "utf-8"), path, false, true);
|
|
636
776
|
}
|
|
637
777
|
function getConfigPath() {
|
|
638
778
|
migrateFromLegacy();
|
|
@@ -644,7 +784,15 @@ function writeConfig(config) {
|
|
|
644
784
|
fs.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
645
785
|
}
|
|
646
786
|
const filePath = join(dir, "config.json");
|
|
647
|
-
|
|
787
|
+
const apiToken = trimConfigValue(config.apiToken) ?? "";
|
|
788
|
+
const teamId = trimConfigValue(config.teamId) ?? "";
|
|
789
|
+
const sprintFolderId = trimConfigValue(config.sprintFolderId);
|
|
790
|
+
const normalizedConfig = {
|
|
791
|
+
...apiToken ? { apiToken } : {},
|
|
792
|
+
...teamId ? { teamId } : {},
|
|
793
|
+
...sprintFolderId ? { sprintFolderId } : {}
|
|
794
|
+
};
|
|
795
|
+
fs.writeFileSync(filePath, JSON.stringify(normalizedConfig, null, 2) + "\n", {
|
|
648
796
|
encoding: "utf-8",
|
|
649
797
|
mode: 384
|
|
650
798
|
});
|
|
@@ -2096,6 +2244,11 @@ async function fetchOverdueTasks(config, opts = {}) {
|
|
|
2096
2244
|
|
|
2097
2245
|
// src/commands/config.ts
|
|
2098
2246
|
var VALID_KEYS = /* @__PURE__ */ new Set(["apiToken", "teamId", "sprintFolderId"]);
|
|
2247
|
+
function readStoredString(value) {
|
|
2248
|
+
if (typeof value !== "string") return void 0;
|
|
2249
|
+
const trimmed = value.trim();
|
|
2250
|
+
return trimmed || void 0;
|
|
2251
|
+
}
|
|
2099
2252
|
function assertValidKey(key) {
|
|
2100
2253
|
if (!VALID_KEYS.has(key)) {
|
|
2101
2254
|
throw new Error(`Unknown config key: ${key}. Valid keys: ${[...VALID_KEYS].join(", ")}`);
|
|
@@ -2104,23 +2257,33 @@ function assertValidKey(key) {
|
|
|
2104
2257
|
function getConfigValue(key) {
|
|
2105
2258
|
assertValidKey(key);
|
|
2106
2259
|
const raw = loadRawConfig();
|
|
2107
|
-
|
|
2108
|
-
return value || void 0;
|
|
2260
|
+
return readStoredString(raw[key]);
|
|
2109
2261
|
}
|
|
2110
2262
|
function setConfigValue(key, value) {
|
|
2111
2263
|
assertValidKey(key);
|
|
2112
|
-
|
|
2264
|
+
const normalizedValue = readStoredString(value);
|
|
2265
|
+
if (key === "apiToken" && (!normalizedValue || !normalizedValue.startsWith("pk_"))) {
|
|
2113
2266
|
throw new Error("apiToken must start with pk_");
|
|
2114
2267
|
}
|
|
2115
|
-
if (key === "teamId" &&
|
|
2268
|
+
if (key === "teamId" && !normalizedValue) {
|
|
2116
2269
|
throw new Error("teamId must be non-empty");
|
|
2117
2270
|
}
|
|
2118
2271
|
const raw = loadRawConfig();
|
|
2272
|
+
const sprintFolderId = readStoredString(raw.sprintFolderId);
|
|
2119
2273
|
const merged = {
|
|
2120
|
-
apiToken: raw.apiToken
|
|
2121
|
-
teamId: raw.teamId
|
|
2122
|
-
...{
|
|
2274
|
+
...readStoredString(raw.apiToken) ? { apiToken: readStoredString(raw.apiToken) } : {},
|
|
2275
|
+
...readStoredString(raw.teamId) ? { teamId: readStoredString(raw.teamId) } : {},
|
|
2276
|
+
...sprintFolderId ? { sprintFolderId } : {}
|
|
2123
2277
|
};
|
|
2278
|
+
if (key === "sprintFolderId") {
|
|
2279
|
+
if (normalizedValue) {
|
|
2280
|
+
merged.sprintFolderId = normalizedValue;
|
|
2281
|
+
} else {
|
|
2282
|
+
delete merged.sprintFolderId;
|
|
2283
|
+
}
|
|
2284
|
+
} else {
|
|
2285
|
+
merged[key] = normalizedValue;
|
|
2286
|
+
}
|
|
2124
2287
|
writeConfig(merged);
|
|
2125
2288
|
}
|
|
2126
2289
|
function configPath2() {
|
|
@@ -2199,7 +2362,702 @@ ${commentsMd}`);
|
|
|
2199
2362
|
}
|
|
2200
2363
|
}
|
|
2201
2364
|
|
|
2365
|
+
// src/commands/metadata.ts
|
|
2366
|
+
var commandMetadata = [
|
|
2367
|
+
{
|
|
2368
|
+
name: "init",
|
|
2369
|
+
description: "Set up cup for the first time",
|
|
2370
|
+
quickReference: [{ section: "setup", usage: "init", description: "First-time setup wizard" }]
|
|
2371
|
+
},
|
|
2372
|
+
{
|
|
2373
|
+
name: "auth",
|
|
2374
|
+
description: "Validate API token and show current user",
|
|
2375
|
+
flags: ["--json"],
|
|
2376
|
+
quickReference: [
|
|
2377
|
+
{ section: "read", usage: "auth", description: "Check authentication status" }
|
|
2378
|
+
]
|
|
2379
|
+
},
|
|
2380
|
+
{
|
|
2381
|
+
name: "tasks",
|
|
2382
|
+
description: "List tasks assigned to me",
|
|
2383
|
+
flags: ["--status", "--list", "--space", "--name", "--type", "--include-closed", "--json"],
|
|
2384
|
+
quickReference: [{ section: "read", usage: "tasks", description: "List tasks assigned to me" }]
|
|
2385
|
+
},
|
|
2386
|
+
{
|
|
2387
|
+
name: "task",
|
|
2388
|
+
description: "Get task details",
|
|
2389
|
+
flags: ["--json"],
|
|
2390
|
+
quickReference: [{ section: "read", usage: "task <taskId>", description: "Get task details" }]
|
|
2391
|
+
},
|
|
2392
|
+
{
|
|
2393
|
+
name: "update",
|
|
2394
|
+
description: "Update a task",
|
|
2395
|
+
flags: [
|
|
2396
|
+
"-n",
|
|
2397
|
+
"--name",
|
|
2398
|
+
"-d",
|
|
2399
|
+
"--description",
|
|
2400
|
+
"-s",
|
|
2401
|
+
"--status",
|
|
2402
|
+
"--priority",
|
|
2403
|
+
"--due-date",
|
|
2404
|
+
"--time-estimate",
|
|
2405
|
+
"--assignee",
|
|
2406
|
+
"--parent",
|
|
2407
|
+
"--json"
|
|
2408
|
+
],
|
|
2409
|
+
quickReference: [{ section: "write", usage: "update <taskId>", description: "Update a task" }]
|
|
2410
|
+
},
|
|
2411
|
+
{
|
|
2412
|
+
name: "create",
|
|
2413
|
+
description: "Create a new task",
|
|
2414
|
+
flags: [
|
|
2415
|
+
"-l",
|
|
2416
|
+
"--list",
|
|
2417
|
+
"-n",
|
|
2418
|
+
"--name",
|
|
2419
|
+
"-d",
|
|
2420
|
+
"--description",
|
|
2421
|
+
"-p",
|
|
2422
|
+
"--parent",
|
|
2423
|
+
"-s",
|
|
2424
|
+
"--status",
|
|
2425
|
+
"--priority",
|
|
2426
|
+
"--due-date",
|
|
2427
|
+
"--assignee",
|
|
2428
|
+
"--tags",
|
|
2429
|
+
"--custom-item-id",
|
|
2430
|
+
"--time-estimate",
|
|
2431
|
+
"--template",
|
|
2432
|
+
"--json"
|
|
2433
|
+
],
|
|
2434
|
+
quickReference: [{ section: "write", usage: "create", description: "Create a new task" }]
|
|
2435
|
+
},
|
|
2436
|
+
{
|
|
2437
|
+
name: "sprint",
|
|
2438
|
+
description: "List my tasks in the current active sprint (auto-detected)",
|
|
2439
|
+
flags: ["--status", "--space", "--folder", "--include-closed", "--json"],
|
|
2440
|
+
quickReference: [
|
|
2441
|
+
{ section: "read", usage: "sprint", description: "My tasks in the active sprint" }
|
|
2442
|
+
]
|
|
2443
|
+
},
|
|
2444
|
+
{
|
|
2445
|
+
name: "sprints",
|
|
2446
|
+
description: "List all sprints in sprint folders",
|
|
2447
|
+
flags: ["--space", "--json"],
|
|
2448
|
+
quickReference: [
|
|
2449
|
+
{ section: "read", usage: "sprints", description: "List all sprints across folders" }
|
|
2450
|
+
]
|
|
2451
|
+
},
|
|
2452
|
+
{
|
|
2453
|
+
name: "subtasks",
|
|
2454
|
+
description: "List subtasks of a task or initiative",
|
|
2455
|
+
flags: ["--status", "--name", "--include-closed", "--json"],
|
|
2456
|
+
quickReference: [
|
|
2457
|
+
{ section: "read", usage: "subtasks <taskId>", description: "List subtasks of a task" }
|
|
2458
|
+
]
|
|
2459
|
+
},
|
|
2460
|
+
{
|
|
2461
|
+
name: "comment",
|
|
2462
|
+
description: "Post a comment on a task",
|
|
2463
|
+
flags: ["-m", "--message", "--notify-all", "--json"],
|
|
2464
|
+
quickReference: [
|
|
2465
|
+
{ section: "write", usage: "comment <taskId>", description: "Post a comment on a task" }
|
|
2466
|
+
]
|
|
2467
|
+
},
|
|
2468
|
+
{
|
|
2469
|
+
name: "comment-edit",
|
|
2470
|
+
description: "Edit an existing comment",
|
|
2471
|
+
flags: ["-m", "--message", "--resolved", "--unresolved", "--json"],
|
|
2472
|
+
quickReference: [
|
|
2473
|
+
{
|
|
2474
|
+
section: "write",
|
|
2475
|
+
usage: "comment-edit <commentId>",
|
|
2476
|
+
description: "Edit an existing comment"
|
|
2477
|
+
}
|
|
2478
|
+
]
|
|
2479
|
+
},
|
|
2480
|
+
{
|
|
2481
|
+
name: "comment-delete",
|
|
2482
|
+
description: "Delete a comment",
|
|
2483
|
+
flags: ["--json"],
|
|
2484
|
+
quickReference: [
|
|
2485
|
+
{
|
|
2486
|
+
section: "write",
|
|
2487
|
+
usage: "comment-delete <commentId>",
|
|
2488
|
+
description: "Delete a comment"
|
|
2489
|
+
}
|
|
2490
|
+
]
|
|
2491
|
+
},
|
|
2492
|
+
{
|
|
2493
|
+
name: "comments",
|
|
2494
|
+
description: "List comments on a task",
|
|
2495
|
+
flags: ["--json"],
|
|
2496
|
+
quickReference: [
|
|
2497
|
+
{ section: "read", usage: "comments <taskId>", description: "List comments on a task" }
|
|
2498
|
+
]
|
|
2499
|
+
},
|
|
2500
|
+
{
|
|
2501
|
+
name: "replies",
|
|
2502
|
+
description: "List threaded replies on a comment",
|
|
2503
|
+
flags: ["--json"],
|
|
2504
|
+
quickReference: [
|
|
2505
|
+
{
|
|
2506
|
+
section: "read",
|
|
2507
|
+
usage: "replies <commentId>",
|
|
2508
|
+
description: "List threaded replies on a comment"
|
|
2509
|
+
}
|
|
2510
|
+
]
|
|
2511
|
+
},
|
|
2512
|
+
{
|
|
2513
|
+
name: "reply",
|
|
2514
|
+
description: "Reply to a comment",
|
|
2515
|
+
flags: ["-m", "--message", "--notify-all", "--json"],
|
|
2516
|
+
quickReference: [
|
|
2517
|
+
{ section: "write", usage: "reply <commentId>", description: "Reply to a comment" }
|
|
2518
|
+
]
|
|
2519
|
+
},
|
|
2520
|
+
{
|
|
2521
|
+
name: "activity",
|
|
2522
|
+
description: "Show task details and comments combined",
|
|
2523
|
+
flags: ["--json"],
|
|
2524
|
+
quickReference: [
|
|
2525
|
+
{
|
|
2526
|
+
section: "read",
|
|
2527
|
+
usage: "activity <taskId>",
|
|
2528
|
+
description: "Task details + comment history"
|
|
2529
|
+
}
|
|
2530
|
+
]
|
|
2531
|
+
},
|
|
2532
|
+
{
|
|
2533
|
+
name: "lists",
|
|
2534
|
+
description: "List all lists in a space (including lists inside folders)",
|
|
2535
|
+
flags: ["--name", "--json"],
|
|
2536
|
+
quickReference: [
|
|
2537
|
+
{ section: "read", usage: "lists <spaceId>", description: "List all lists in a space" }
|
|
2538
|
+
]
|
|
2539
|
+
},
|
|
2540
|
+
{
|
|
2541
|
+
name: "spaces",
|
|
2542
|
+
description: "List spaces in your workspace",
|
|
2543
|
+
flags: ["--name", "--my", "--json"],
|
|
2544
|
+
quickReference: [{ section: "read", usage: "spaces", description: "List spaces in workspace" }]
|
|
2545
|
+
},
|
|
2546
|
+
{
|
|
2547
|
+
name: "inbox",
|
|
2548
|
+
description: "Recently updated tasks grouped by time period",
|
|
2549
|
+
flags: ["--include-closed", "--json", "--days"],
|
|
2550
|
+
quickReference: [
|
|
2551
|
+
{
|
|
2552
|
+
section: "read",
|
|
2553
|
+
usage: "inbox",
|
|
2554
|
+
description: "Recently updated tasks assigned to me"
|
|
2555
|
+
}
|
|
2556
|
+
]
|
|
2557
|
+
},
|
|
2558
|
+
{
|
|
2559
|
+
name: "assigned",
|
|
2560
|
+
description: "Show all tasks assigned to me, grouped by status",
|
|
2561
|
+
flags: ["--status", "--include-closed", "--json"],
|
|
2562
|
+
quickReference: [
|
|
2563
|
+
{ section: "read", usage: "assigned", description: "My tasks grouped by pipeline stage" }
|
|
2564
|
+
]
|
|
2565
|
+
},
|
|
2566
|
+
{
|
|
2567
|
+
name: "open",
|
|
2568
|
+
description: "Open a task in the browser by ID or name",
|
|
2569
|
+
flags: ["--json"],
|
|
2570
|
+
quickReference: [
|
|
2571
|
+
{ section: "read", usage: "open <query>", description: "Open a task in the browser" }
|
|
2572
|
+
]
|
|
2573
|
+
},
|
|
2574
|
+
{
|
|
2575
|
+
name: "search",
|
|
2576
|
+
description: "Search my tasks by name",
|
|
2577
|
+
flags: ["--status", "--include-closed", "--json"],
|
|
2578
|
+
quickReference: [
|
|
2579
|
+
{ section: "read", usage: "search <query>", description: "Search my tasks by name" }
|
|
2580
|
+
]
|
|
2581
|
+
},
|
|
2582
|
+
{
|
|
2583
|
+
name: "summary",
|
|
2584
|
+
description: "Daily standup summary: completed, in-progress, overdue",
|
|
2585
|
+
flags: ["--hours", "--json"],
|
|
2586
|
+
quickReference: [{ section: "read", usage: "summary", description: "Daily standup helper" }]
|
|
2587
|
+
},
|
|
2588
|
+
{
|
|
2589
|
+
name: "overdue",
|
|
2590
|
+
description: "List tasks that are past their due date",
|
|
2591
|
+
flags: ["--include-closed", "--json"],
|
|
2592
|
+
quickReference: [
|
|
2593
|
+
{ section: "read", usage: "overdue", description: "Tasks past their due date" }
|
|
2594
|
+
]
|
|
2595
|
+
},
|
|
2596
|
+
{
|
|
2597
|
+
name: "assign",
|
|
2598
|
+
description: "Assign or unassign users from a task",
|
|
2599
|
+
flags: ["--to", "--remove", "--json"],
|
|
2600
|
+
quickReference: [
|
|
2601
|
+
{ section: "write", usage: "assign <taskId>", description: "Assign or unassign users" }
|
|
2602
|
+
]
|
|
2603
|
+
},
|
|
2604
|
+
{
|
|
2605
|
+
name: "depend",
|
|
2606
|
+
description: "Add or remove task dependencies",
|
|
2607
|
+
flags: ["--on", "--blocks", "--remove", "--json"],
|
|
2608
|
+
quickReference: [
|
|
2609
|
+
{
|
|
2610
|
+
section: "write",
|
|
2611
|
+
usage: "depend <taskId>",
|
|
2612
|
+
description: "Add or remove task dependencies"
|
|
2613
|
+
}
|
|
2614
|
+
]
|
|
2615
|
+
},
|
|
2616
|
+
{
|
|
2617
|
+
name: "link",
|
|
2618
|
+
description: "Add or remove a link between two tasks",
|
|
2619
|
+
flags: ["--remove", "--json"],
|
|
2620
|
+
quickReference: [
|
|
2621
|
+
{
|
|
2622
|
+
section: "write",
|
|
2623
|
+
usage: "link <taskId> <linksTo>",
|
|
2624
|
+
description: "Add or remove a link between tasks"
|
|
2625
|
+
}
|
|
2626
|
+
]
|
|
2627
|
+
},
|
|
2628
|
+
{
|
|
2629
|
+
name: "attach",
|
|
2630
|
+
description: "Upload a file attachment to a task",
|
|
2631
|
+
flags: ["--json"],
|
|
2632
|
+
bashFileCompletion: true,
|
|
2633
|
+
quickReference: [
|
|
2634
|
+
{
|
|
2635
|
+
section: "write",
|
|
2636
|
+
usage: "attach <taskId> <filePath>",
|
|
2637
|
+
description: "Upload a file attachment to a task"
|
|
2638
|
+
}
|
|
2639
|
+
]
|
|
2640
|
+
},
|
|
2641
|
+
{
|
|
2642
|
+
name: "move",
|
|
2643
|
+
description: "Add or remove a task from a list",
|
|
2644
|
+
flags: ["--to", "--remove", "--json"],
|
|
2645
|
+
quickReference: [
|
|
2646
|
+
{ section: "write", usage: "move <taskId>", description: "Add or remove a task from a list" }
|
|
2647
|
+
]
|
|
2648
|
+
},
|
|
2649
|
+
{
|
|
2650
|
+
name: "field",
|
|
2651
|
+
description: "Set or remove a custom field value on a task",
|
|
2652
|
+
flags: ["--set", "--remove", "--json"],
|
|
2653
|
+
quickReference: [
|
|
2654
|
+
{
|
|
2655
|
+
section: "write",
|
|
2656
|
+
usage: "field <taskId>",
|
|
2657
|
+
description: "Set or remove custom field values"
|
|
2658
|
+
}
|
|
2659
|
+
]
|
|
2660
|
+
},
|
|
2661
|
+
{
|
|
2662
|
+
name: "delete",
|
|
2663
|
+
description: "Delete a task (requires confirmation)",
|
|
2664
|
+
flags: ["--confirm", "--json"],
|
|
2665
|
+
quickReference: [{ section: "write", usage: "delete <taskId>", description: "Delete a task" }]
|
|
2666
|
+
},
|
|
2667
|
+
{
|
|
2668
|
+
name: "tag",
|
|
2669
|
+
description: "Add or remove tags from a task",
|
|
2670
|
+
flags: ["--add", "--remove", "--json"],
|
|
2671
|
+
quickReference: [
|
|
2672
|
+
{ section: "write", usage: "tag <taskId>", description: "Add or remove tags on a task" }
|
|
2673
|
+
]
|
|
2674
|
+
},
|
|
2675
|
+
{
|
|
2676
|
+
name: "tags",
|
|
2677
|
+
description: "List tags in a space",
|
|
2678
|
+
flags: ["--json"],
|
|
2679
|
+
quickReference: [
|
|
2680
|
+
{ section: "read", usage: "tags <spaceId>", description: "List tags in a space" }
|
|
2681
|
+
]
|
|
2682
|
+
},
|
|
2683
|
+
{
|
|
2684
|
+
name: "tag-create",
|
|
2685
|
+
description: "Create a tag in a space",
|
|
2686
|
+
flags: ["--fg", "--bg", "--json"],
|
|
2687
|
+
quickReference: [
|
|
2688
|
+
{
|
|
2689
|
+
section: "write",
|
|
2690
|
+
usage: "tag-create <spaceId> <name>",
|
|
2691
|
+
description: "Create a tag in a space"
|
|
2692
|
+
}
|
|
2693
|
+
]
|
|
2694
|
+
},
|
|
2695
|
+
{
|
|
2696
|
+
name: "tag-delete",
|
|
2697
|
+
description: "Delete a tag from a space",
|
|
2698
|
+
flags: ["--json"],
|
|
2699
|
+
quickReference: [
|
|
2700
|
+
{
|
|
2701
|
+
section: "write",
|
|
2702
|
+
usage: "tag-delete <spaceId> <name>",
|
|
2703
|
+
description: "Delete a tag from a space"
|
|
2704
|
+
}
|
|
2705
|
+
]
|
|
2706
|
+
},
|
|
2707
|
+
{
|
|
2708
|
+
name: "tag-update",
|
|
2709
|
+
description: "Update a tag in a space",
|
|
2710
|
+
flags: ["--name", "--fg", "--bg", "--json"],
|
|
2711
|
+
quickReference: [
|
|
2712
|
+
{
|
|
2713
|
+
section: "write",
|
|
2714
|
+
usage: "tag-update <spaceId> <tagName>",
|
|
2715
|
+
description: "Update a tag in a space"
|
|
2716
|
+
}
|
|
2717
|
+
]
|
|
2718
|
+
},
|
|
2719
|
+
{
|
|
2720
|
+
name: "checklist",
|
|
2721
|
+
description: "Manage checklists on a task",
|
|
2722
|
+
quickReference: [
|
|
2723
|
+
{ section: "write", usage: "checklist", description: "Manage checklists on tasks" }
|
|
2724
|
+
]
|
|
2725
|
+
},
|
|
2726
|
+
{
|
|
2727
|
+
name: "time",
|
|
2728
|
+
description: "Track time on tasks",
|
|
2729
|
+
quickReference: [
|
|
2730
|
+
{
|
|
2731
|
+
section: "write",
|
|
2732
|
+
usage: "time start <taskId>",
|
|
2733
|
+
description: "Start tracking time on a task"
|
|
2734
|
+
},
|
|
2735
|
+
{ section: "write", usage: "time stop", description: "Stop the running timer" },
|
|
2736
|
+
{ section: "write", usage: "time status", description: "Show the currently running timer" },
|
|
2737
|
+
{
|
|
2738
|
+
section: "write",
|
|
2739
|
+
usage: "time log <taskId> <duration>",
|
|
2740
|
+
description: "Log a manual time entry"
|
|
2741
|
+
},
|
|
2742
|
+
{ section: "write", usage: "time list", description: "List recent time entries" },
|
|
2743
|
+
{ section: "write", usage: "time update <timeEntryId>", description: "Update a time entry" },
|
|
2744
|
+
{ section: "write", usage: "time delete <timeEntryId>", description: "Delete a time entry" }
|
|
2745
|
+
]
|
|
2746
|
+
},
|
|
2747
|
+
{
|
|
2748
|
+
name: "docs",
|
|
2749
|
+
description: "List workspace docs (optionally filter by name)",
|
|
2750
|
+
flags: ["--json"],
|
|
2751
|
+
quickReference: [
|
|
2752
|
+
{ section: "read", usage: "docs [query]", description: "List workspace docs" }
|
|
2753
|
+
]
|
|
2754
|
+
},
|
|
2755
|
+
{
|
|
2756
|
+
name: "doc",
|
|
2757
|
+
description: "View a doc (metadata + page tree) or a specific page",
|
|
2758
|
+
flags: ["--json"],
|
|
2759
|
+
quickReference: [
|
|
2760
|
+
{ section: "read", usage: "doc <docId> [pageId]", description: "View a doc or doc page" }
|
|
2761
|
+
]
|
|
2762
|
+
},
|
|
2763
|
+
{
|
|
2764
|
+
name: "doc-create",
|
|
2765
|
+
description: "Create a new doc",
|
|
2766
|
+
flags: ["-c", "--content", "--json"],
|
|
2767
|
+
quickReference: [
|
|
2768
|
+
{ section: "write", usage: "doc-create <title>", description: "Create a new doc" }
|
|
2769
|
+
]
|
|
2770
|
+
},
|
|
2771
|
+
{
|
|
2772
|
+
name: "doc-pages",
|
|
2773
|
+
description: "List all pages in a doc with content",
|
|
2774
|
+
flags: ["--json"],
|
|
2775
|
+
quickReference: [
|
|
2776
|
+
{
|
|
2777
|
+
section: "read",
|
|
2778
|
+
usage: "doc-pages <docId>",
|
|
2779
|
+
description: "All pages in a doc with content"
|
|
2780
|
+
}
|
|
2781
|
+
]
|
|
2782
|
+
},
|
|
2783
|
+
{
|
|
2784
|
+
name: "doc-page-create",
|
|
2785
|
+
description: "Create a page in a doc",
|
|
2786
|
+
flags: ["-c", "--content", "--parent-page", "--json"],
|
|
2787
|
+
quickReference: [
|
|
2788
|
+
{
|
|
2789
|
+
section: "write",
|
|
2790
|
+
usage: "doc-page-create <docId> <name>",
|
|
2791
|
+
description: "Create a page in a doc"
|
|
2792
|
+
}
|
|
2793
|
+
]
|
|
2794
|
+
},
|
|
2795
|
+
{
|
|
2796
|
+
name: "doc-page-edit",
|
|
2797
|
+
description: "Edit a doc page",
|
|
2798
|
+
flags: ["--name", "-c", "--content", "--json"],
|
|
2799
|
+
quickReference: [
|
|
2800
|
+
{
|
|
2801
|
+
section: "write",
|
|
2802
|
+
usage: "doc-page-edit <docId> <pageId>",
|
|
2803
|
+
description: "Edit a doc page"
|
|
2804
|
+
}
|
|
2805
|
+
]
|
|
2806
|
+
},
|
|
2807
|
+
{
|
|
2808
|
+
name: "doc-delete",
|
|
2809
|
+
description: "Delete a doc",
|
|
2810
|
+
flags: ["--json"],
|
|
2811
|
+
quickReference: [
|
|
2812
|
+
{ section: "write", usage: "doc-delete <docId>", description: "Delete a doc" }
|
|
2813
|
+
]
|
|
2814
|
+
},
|
|
2815
|
+
{
|
|
2816
|
+
name: "doc-page-delete",
|
|
2817
|
+
description: "Delete a doc page",
|
|
2818
|
+
flags: ["--json"],
|
|
2819
|
+
quickReference: [
|
|
2820
|
+
{
|
|
2821
|
+
section: "write",
|
|
2822
|
+
usage: "doc-page-delete <docId> <pageId>",
|
|
2823
|
+
description: "Delete a doc page"
|
|
2824
|
+
}
|
|
2825
|
+
]
|
|
2826
|
+
},
|
|
2827
|
+
{
|
|
2828
|
+
name: "folders",
|
|
2829
|
+
description: "List folders in a space (with their lists)",
|
|
2830
|
+
flags: ["--name", "--json"],
|
|
2831
|
+
quickReference: [
|
|
2832
|
+
{ section: "read", usage: "folders <spaceId>", description: "List folders in a space" }
|
|
2833
|
+
]
|
|
2834
|
+
},
|
|
2835
|
+
{
|
|
2836
|
+
name: "members",
|
|
2837
|
+
description: "List workspace members",
|
|
2838
|
+
flags: ["--json"],
|
|
2839
|
+
quickReference: [{ section: "read", usage: "members", description: "List workspace members" }]
|
|
2840
|
+
},
|
|
2841
|
+
{
|
|
2842
|
+
name: "fields",
|
|
2843
|
+
description: "List custom fields for a list",
|
|
2844
|
+
flags: ["--json"],
|
|
2845
|
+
quickReference: [
|
|
2846
|
+
{ section: "read", usage: "fields <listId>", description: "List custom fields for a list" }
|
|
2847
|
+
]
|
|
2848
|
+
},
|
|
2849
|
+
{
|
|
2850
|
+
name: "duplicate",
|
|
2851
|
+
description: "Duplicate a task",
|
|
2852
|
+
flags: ["--json"],
|
|
2853
|
+
quickReference: [
|
|
2854
|
+
{ section: "write", usage: "duplicate <taskId>", description: "Duplicate a task" }
|
|
2855
|
+
]
|
|
2856
|
+
},
|
|
2857
|
+
{
|
|
2858
|
+
name: "bulk",
|
|
2859
|
+
description: "Bulk task operations",
|
|
2860
|
+
quickReference: [
|
|
2861
|
+
{
|
|
2862
|
+
section: "write",
|
|
2863
|
+
usage: "bulk status <status> <taskIds...>",
|
|
2864
|
+
description: "Bulk update task status"
|
|
2865
|
+
}
|
|
2866
|
+
]
|
|
2867
|
+
},
|
|
2868
|
+
{
|
|
2869
|
+
name: "goals",
|
|
2870
|
+
description: "List goals in your workspace",
|
|
2871
|
+
flags: ["--json"],
|
|
2872
|
+
quickReference: [
|
|
2873
|
+
{ section: "read", usage: "goals", description: "List goals in your workspace" }
|
|
2874
|
+
]
|
|
2875
|
+
},
|
|
2876
|
+
{
|
|
2877
|
+
name: "goal-create",
|
|
2878
|
+
description: "Create a goal",
|
|
2879
|
+
flags: ["-d", "--description", "--color", "--json"],
|
|
2880
|
+
quickReference: [
|
|
2881
|
+
{ section: "write", usage: "goal-create <name>", description: "Create a goal" }
|
|
2882
|
+
]
|
|
2883
|
+
},
|
|
2884
|
+
{
|
|
2885
|
+
name: "goal-update",
|
|
2886
|
+
description: "Update a goal",
|
|
2887
|
+
flags: ["-n", "--name", "-d", "--description", "--color", "--json"],
|
|
2888
|
+
quickReference: [
|
|
2889
|
+
{ section: "write", usage: "goal-update <goalId>", description: "Update a goal" }
|
|
2890
|
+
]
|
|
2891
|
+
},
|
|
2892
|
+
{
|
|
2893
|
+
name: "goal-delete",
|
|
2894
|
+
description: "Delete a goal",
|
|
2895
|
+
flags: ["--json"],
|
|
2896
|
+
quickReference: [
|
|
2897
|
+
{ section: "write", usage: "goal-delete <goalId>", description: "Delete a goal" }
|
|
2898
|
+
]
|
|
2899
|
+
},
|
|
2900
|
+
{
|
|
2901
|
+
name: "key-results",
|
|
2902
|
+
description: "List key results for a goal",
|
|
2903
|
+
flags: ["--json"],
|
|
2904
|
+
quickReference: [
|
|
2905
|
+
{
|
|
2906
|
+
section: "read",
|
|
2907
|
+
usage: "key-results <goalId>",
|
|
2908
|
+
description: "List key results for a goal"
|
|
2909
|
+
}
|
|
2910
|
+
]
|
|
2911
|
+
},
|
|
2912
|
+
{
|
|
2913
|
+
name: "key-result-create",
|
|
2914
|
+
description: "Create a key result on a goal",
|
|
2915
|
+
flags: ["--type", "--target", "--json"],
|
|
2916
|
+
quickReference: [
|
|
2917
|
+
{
|
|
2918
|
+
section: "write",
|
|
2919
|
+
usage: "key-result-create <goalId> <name>",
|
|
2920
|
+
description: "Create a key result on a goal"
|
|
2921
|
+
}
|
|
2922
|
+
]
|
|
2923
|
+
},
|
|
2924
|
+
{
|
|
2925
|
+
name: "key-result-update",
|
|
2926
|
+
description: "Update a key result",
|
|
2927
|
+
flags: ["--progress", "--note", "--json"],
|
|
2928
|
+
quickReference: [
|
|
2929
|
+
{
|
|
2930
|
+
section: "write",
|
|
2931
|
+
usage: "key-result-update <keyResultId>",
|
|
2932
|
+
description: "Update a key result"
|
|
2933
|
+
}
|
|
2934
|
+
]
|
|
2935
|
+
},
|
|
2936
|
+
{
|
|
2937
|
+
name: "key-result-delete",
|
|
2938
|
+
description: "Delete a key result",
|
|
2939
|
+
flags: ["--json"],
|
|
2940
|
+
quickReference: [
|
|
2941
|
+
{
|
|
2942
|
+
section: "write",
|
|
2943
|
+
usage: "key-result-delete <keyResultId>",
|
|
2944
|
+
description: "Delete a key result"
|
|
2945
|
+
}
|
|
2946
|
+
]
|
|
2947
|
+
},
|
|
2948
|
+
{
|
|
2949
|
+
name: "task-types",
|
|
2950
|
+
description: "List custom task types in your workspace",
|
|
2951
|
+
flags: ["--json"],
|
|
2952
|
+
quickReference: [
|
|
2953
|
+
{ section: "read", usage: "task-types", description: "List custom task types" }
|
|
2954
|
+
]
|
|
2955
|
+
},
|
|
2956
|
+
{
|
|
2957
|
+
name: "templates",
|
|
2958
|
+
description: "List task templates in your workspace",
|
|
2959
|
+
flags: ["--json"],
|
|
2960
|
+
quickReference: [{ section: "read", usage: "templates", description: "List task templates" }]
|
|
2961
|
+
},
|
|
2962
|
+
{
|
|
2963
|
+
name: "config",
|
|
2964
|
+
description: "Manage CLI configuration",
|
|
2965
|
+
quickReference: [
|
|
2966
|
+
{ section: "configuration", usage: "config", description: "Manage CLI configuration" }
|
|
2967
|
+
]
|
|
2968
|
+
},
|
|
2969
|
+
{
|
|
2970
|
+
name: "completion",
|
|
2971
|
+
description: "Output shell completion script (bash, zsh, fish)",
|
|
2972
|
+
quickReference: [
|
|
2973
|
+
{
|
|
2974
|
+
section: "configuration",
|
|
2975
|
+
usage: "completion <shell>",
|
|
2976
|
+
description: "Output shell completion script"
|
|
2977
|
+
}
|
|
2978
|
+
]
|
|
2979
|
+
}
|
|
2980
|
+
];
|
|
2981
|
+
function parseCommandFlags(flags = []) {
|
|
2982
|
+
const parsed = [];
|
|
2983
|
+
for (const flag of flags) {
|
|
2984
|
+
if (flag.startsWith("--")) {
|
|
2985
|
+
const previous = parsed.at(-1);
|
|
2986
|
+
if (previous && previous.long === "") {
|
|
2987
|
+
previous.long = flag;
|
|
2988
|
+
} else {
|
|
2989
|
+
parsed.push({ long: flag });
|
|
2990
|
+
}
|
|
2991
|
+
continue;
|
|
2992
|
+
}
|
|
2993
|
+
parsed.push({ short: flag, long: "" });
|
|
2994
|
+
}
|
|
2995
|
+
return parsed.map((flag) => ({
|
|
2996
|
+
short: flag.short,
|
|
2997
|
+
long: flag.long
|
|
2998
|
+
}));
|
|
2999
|
+
}
|
|
3000
|
+
function commandDescription(command, programName = "cup") {
|
|
3001
|
+
if (command.name === "init") {
|
|
3002
|
+
return `Set up ${programName} for the first time`;
|
|
3003
|
+
}
|
|
3004
|
+
return command.description;
|
|
3005
|
+
}
|
|
3006
|
+
function topLevelCommandDefinitions(programName = "cup") {
|
|
3007
|
+
return commandMetadata.map((command) => ({
|
|
3008
|
+
name: command.name,
|
|
3009
|
+
description: commandDescription(command, programName),
|
|
3010
|
+
flags: parseCommandFlags("flags" in command ? command.flags : [])
|
|
3011
|
+
}));
|
|
3012
|
+
}
|
|
3013
|
+
function topLevelCommandNames() {
|
|
3014
|
+
return commandMetadata.map((command) => command.name);
|
|
3015
|
+
}
|
|
3016
|
+
|
|
2202
3017
|
// src/commands/completion.ts
|
|
3018
|
+
var bashSpecialCaseCommands = /* @__PURE__ */ new Set(["checklist", "time", "bulk", "config", "completion"]);
|
|
3019
|
+
function escapeSingleQuotes(value) {
|
|
3020
|
+
return value.replaceAll("'", "'\\''");
|
|
3021
|
+
}
|
|
3022
|
+
function renderBashCommandCases() {
|
|
3023
|
+
return commandMetadata.filter(
|
|
3024
|
+
(command) => !bashSpecialCaseCommands.has(command.name) && ((command.flags?.length ?? 0) > 0 || command.bashFileCompletion)
|
|
3025
|
+
).map((command) => {
|
|
3026
|
+
if (command.bashFileCompletion) {
|
|
3027
|
+
return ` ${command.name})
|
|
3028
|
+
if [[ "$cur" == -* ]]; then
|
|
3029
|
+
COMPREPLY=($(compgen -W "${command.flags?.join(" ") ?? ""}" -- "$cur"))
|
|
3030
|
+
else
|
|
3031
|
+
COMPREPLY=($(compgen -f -- "$cur"))
|
|
3032
|
+
fi
|
|
3033
|
+
;;`;
|
|
3034
|
+
}
|
|
3035
|
+
return ` ${command.name})
|
|
3036
|
+
COMPREPLY=($(compgen -W "${command.flags?.join(" ") ?? ""}" -- "$cur"))
|
|
3037
|
+
;;`;
|
|
3038
|
+
}).join("\n");
|
|
3039
|
+
}
|
|
3040
|
+
function renderZshTopLevelCommands(name) {
|
|
3041
|
+
return topLevelCommandDefinitions(name).map((command) => ` '${command.name}:${escapeSingleQuotes(command.description)}'`).join("\n");
|
|
3042
|
+
}
|
|
3043
|
+
function renderFishTopLevelCommands(name) {
|
|
3044
|
+
return topLevelCommandDefinitions(name).map(
|
|
3045
|
+
(command) => `complete -c ${name} -n __fish_use_subcommand -a ${command.name} -d '${escapeSingleQuotes(command.description)}'`
|
|
3046
|
+
).join("\n");
|
|
3047
|
+
}
|
|
3048
|
+
function renderFishFlagDefinition(name, commandName, flag) {
|
|
3049
|
+
const parts = [`complete -c ${name} -n '__fish_seen_subcommand_from ${commandName}'`];
|
|
3050
|
+
if (flag.short) {
|
|
3051
|
+
parts.push(`-s ${flag.short.slice(1)}`);
|
|
3052
|
+
}
|
|
3053
|
+
parts.push(`-l ${flag.long.slice(2)}`);
|
|
3054
|
+
return parts.join(" ");
|
|
3055
|
+
}
|
|
3056
|
+
function renderFishTopLevelFlags(name) {
|
|
3057
|
+
return topLevelCommandDefinitions().filter((command) => command.flags.length > 0).flatMap(
|
|
3058
|
+
(command) => command.flags.map((flag) => renderFishFlagDefinition(name, command.name, flag))
|
|
3059
|
+
).join("\n");
|
|
3060
|
+
}
|
|
2203
3061
|
function bashCompletion(name) {
|
|
2204
3062
|
return `_${name}_completions() {
|
|
2205
3063
|
local cur prev words cword
|
|
@@ -2213,7 +3071,7 @@ function bashCompletion(name) {
|
|
|
2213
3071
|
cword=$COMP_CWORD
|
|
2214
3072
|
fi
|
|
2215
3073
|
|
|
2216
|
-
local commands="
|
|
3074
|
+
local commands="${topLevelCommandNames().join(" ")}"
|
|
2217
3075
|
|
|
2218
3076
|
if [[ $cword -eq 1 ]]; then
|
|
2219
3077
|
COMPREPLY=($(compgen -W "$commands --help --version" -- "$cur"))
|
|
@@ -2234,81 +3092,7 @@ function bashCompletion(name) {
|
|
|
2234
3092
|
esac
|
|
2235
3093
|
|
|
2236
3094
|
case "$cmd" in
|
|
2237
|
-
|
|
2238
|
-
COMPREPLY=($(compgen -W "--status --list --space --name --type --include-closed --json" -- "$cur"))
|
|
2239
|
-
;;
|
|
2240
|
-
task)
|
|
2241
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2242
|
-
;;
|
|
2243
|
-
update)
|
|
2244
|
-
COMPREPLY=($(compgen -W "-n --name -d --description -s --status --priority --due-date --time-estimate --assignee --parent --json" -- "$cur"))
|
|
2245
|
-
;;
|
|
2246
|
-
create)
|
|
2247
|
-
COMPREPLY=($(compgen -W "-l --list -n --name -d --description -p --parent -s --status --priority --due-date --assignee --tags --custom-item-id --time-estimate --template --json" -- "$cur"))
|
|
2248
|
-
;;
|
|
2249
|
-
sprint)
|
|
2250
|
-
COMPREPLY=($(compgen -W "--status --space --folder --include-closed --json" -- "$cur"))
|
|
2251
|
-
;;
|
|
2252
|
-
sprints)
|
|
2253
|
-
COMPREPLY=($(compgen -W "--space --json" -- "$cur"))
|
|
2254
|
-
;;
|
|
2255
|
-
subtasks)
|
|
2256
|
-
COMPREPLY=($(compgen -W "--status --name --include-closed --json" -- "$cur"))
|
|
2257
|
-
;;
|
|
2258
|
-
comment)
|
|
2259
|
-
COMPREPLY=($(compgen -W "-m --message --notify-all --json" -- "$cur"))
|
|
2260
|
-
;;
|
|
2261
|
-
comments)
|
|
2262
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2263
|
-
;;
|
|
2264
|
-
activity)
|
|
2265
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2266
|
-
;;
|
|
2267
|
-
lists)
|
|
2268
|
-
COMPREPLY=($(compgen -W "--name --json" -- "$cur"))
|
|
2269
|
-
;;
|
|
2270
|
-
spaces)
|
|
2271
|
-
COMPREPLY=($(compgen -W "--name --my --json" -- "$cur"))
|
|
2272
|
-
;;
|
|
2273
|
-
inbox)
|
|
2274
|
-
COMPREPLY=($(compgen -W "--include-closed --json --days" -- "$cur"))
|
|
2275
|
-
;;
|
|
2276
|
-
assigned)
|
|
2277
|
-
COMPREPLY=($(compgen -W "--status --include-closed --json" -- "$cur"))
|
|
2278
|
-
;;
|
|
2279
|
-
open)
|
|
2280
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2281
|
-
;;
|
|
2282
|
-
search)
|
|
2283
|
-
COMPREPLY=($(compgen -W "--status --include-closed --json" -- "$cur"))
|
|
2284
|
-
;;
|
|
2285
|
-
summary)
|
|
2286
|
-
COMPREPLY=($(compgen -W "--hours --json" -- "$cur"))
|
|
2287
|
-
;;
|
|
2288
|
-
overdue)
|
|
2289
|
-
COMPREPLY=($(compgen -W "--include-closed --json" -- "$cur"))
|
|
2290
|
-
;;
|
|
2291
|
-
assign)
|
|
2292
|
-
COMPREPLY=($(compgen -W "--to --remove --json" -- "$cur"))
|
|
2293
|
-
;;
|
|
2294
|
-
auth)
|
|
2295
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2296
|
-
;;
|
|
2297
|
-
depend)
|
|
2298
|
-
COMPREPLY=($(compgen -W "--on --blocks --remove --json" -- "$cur"))
|
|
2299
|
-
;;
|
|
2300
|
-
move)
|
|
2301
|
-
COMPREPLY=($(compgen -W "--to --remove --json" -- "$cur"))
|
|
2302
|
-
;;
|
|
2303
|
-
field)
|
|
2304
|
-
COMPREPLY=($(compgen -W "--set --remove --json" -- "$cur"))
|
|
2305
|
-
;;
|
|
2306
|
-
delete)
|
|
2307
|
-
COMPREPLY=($(compgen -W "--confirm --json" -- "$cur"))
|
|
2308
|
-
;;
|
|
2309
|
-
tag)
|
|
2310
|
-
COMPREPLY=($(compgen -W "--add --remove --json" -- "$cur"))
|
|
2311
|
-
;;
|
|
3095
|
+
${renderBashCommandCases()}
|
|
2312
3096
|
checklist)
|
|
2313
3097
|
if [[ $cword -eq 2 ]]; then
|
|
2314
3098
|
COMPREPLY=($(compgen -W "view create delete add-item edit-item delete-item" -- "$cur"))
|
|
@@ -2319,107 +3103,11 @@ function bashCompletion(name) {
|
|
|
2319
3103
|
COMPREPLY=($(compgen -W "start stop status log list update delete" -- "$cur"))
|
|
2320
3104
|
fi
|
|
2321
3105
|
;;
|
|
2322
|
-
comment-edit)
|
|
2323
|
-
COMPREPLY=($(compgen -W "-m --message --resolved --unresolved --json" -- "$cur"))
|
|
2324
|
-
;;
|
|
2325
|
-
comment-delete)
|
|
2326
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2327
|
-
;;
|
|
2328
|
-
replies)
|
|
2329
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2330
|
-
;;
|
|
2331
|
-
reply)
|
|
2332
|
-
COMPREPLY=($(compgen -W "-m --message --notify-all --json" -- "$cur"))
|
|
2333
|
-
;;
|
|
2334
|
-
link)
|
|
2335
|
-
COMPREPLY=($(compgen -W "--remove --json" -- "$cur"))
|
|
2336
|
-
;;
|
|
2337
|
-
attach)
|
|
2338
|
-
COMPREPLY=($(compgen -f -- "$cur"))
|
|
2339
|
-
;;
|
|
2340
|
-
docs)
|
|
2341
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2342
|
-
;;
|
|
2343
|
-
doc)
|
|
2344
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2345
|
-
;;
|
|
2346
|
-
doc-pages)
|
|
2347
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2348
|
-
;;
|
|
2349
|
-
tags)
|
|
2350
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2351
|
-
;;
|
|
2352
|
-
tag-create)
|
|
2353
|
-
COMPREPLY=($(compgen -W "--fg --bg --json" -- "$cur"))
|
|
2354
|
-
;;
|
|
2355
|
-
tag-delete)
|
|
2356
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2357
|
-
;;
|
|
2358
|
-
members)
|
|
2359
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2360
|
-
;;
|
|
2361
|
-
fields)
|
|
2362
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2363
|
-
;;
|
|
2364
|
-
duplicate)
|
|
2365
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2366
|
-
;;
|
|
2367
3106
|
bulk)
|
|
2368
3107
|
if [[ $cword -eq 2 ]]; then
|
|
2369
3108
|
COMPREPLY=($(compgen -W "status" -- "$cur"))
|
|
2370
3109
|
fi
|
|
2371
3110
|
;;
|
|
2372
|
-
goals)
|
|
2373
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2374
|
-
;;
|
|
2375
|
-
goal-create)
|
|
2376
|
-
COMPREPLY=($(compgen -W "-d --description --color --json" -- "$cur"))
|
|
2377
|
-
;;
|
|
2378
|
-
goal-update)
|
|
2379
|
-
COMPREPLY=($(compgen -W "-n --name -d --description --color --json" -- "$cur"))
|
|
2380
|
-
;;
|
|
2381
|
-
goal-delete)
|
|
2382
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2383
|
-
;;
|
|
2384
|
-
key-results)
|
|
2385
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2386
|
-
;;
|
|
2387
|
-
key-result-create)
|
|
2388
|
-
COMPREPLY=($(compgen -W "--type --target --json" -- "$cur"))
|
|
2389
|
-
;;
|
|
2390
|
-
key-result-update)
|
|
2391
|
-
COMPREPLY=($(compgen -W "--progress --note --json" -- "$cur"))
|
|
2392
|
-
;;
|
|
2393
|
-
key-result-delete)
|
|
2394
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2395
|
-
;;
|
|
2396
|
-
folders)
|
|
2397
|
-
COMPREPLY=($(compgen -W "--name --json" -- "$cur"))
|
|
2398
|
-
;;
|
|
2399
|
-
doc-create)
|
|
2400
|
-
COMPREPLY=($(compgen -W "-c --content --json" -- "$cur"))
|
|
2401
|
-
;;
|
|
2402
|
-
doc-page-create)
|
|
2403
|
-
COMPREPLY=($(compgen -W "-c --content --parent-page --json" -- "$cur"))
|
|
2404
|
-
;;
|
|
2405
|
-
doc-page-edit)
|
|
2406
|
-
COMPREPLY=($(compgen -W "--name -c --content --json" -- "$cur"))
|
|
2407
|
-
;;
|
|
2408
|
-
doc-delete)
|
|
2409
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2410
|
-
;;
|
|
2411
|
-
doc-page-delete)
|
|
2412
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2413
|
-
;;
|
|
2414
|
-
tag-update)
|
|
2415
|
-
COMPREPLY=($(compgen -W "--name --fg --bg --json" -- "$cur"))
|
|
2416
|
-
;;
|
|
2417
|
-
task-types)
|
|
2418
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2419
|
-
;;
|
|
2420
|
-
templates)
|
|
2421
|
-
COMPREPLY=($(compgen -W "--json" -- "$cur"))
|
|
2422
|
-
;;
|
|
2423
3111
|
config)
|
|
2424
3112
|
if [[ $cword -eq 2 ]]; then
|
|
2425
3113
|
COMPREPLY=($(compgen -W "get set path" -- "$cur"))
|
|
@@ -2446,69 +3134,7 @@ function zshCompletion(name) {
|
|
|
2446
3134
|
_${name}() {
|
|
2447
3135
|
local -a commands
|
|
2448
3136
|
commands=(
|
|
2449
|
-
|
|
2450
|
-
'auth:Validate API token and show current user'
|
|
2451
|
-
'tasks:List tasks assigned to me'
|
|
2452
|
-
'task:Get task details'
|
|
2453
|
-
'update:Update a task'
|
|
2454
|
-
'create:Create a new task'
|
|
2455
|
-
'sprint:List my tasks in the current active sprint'
|
|
2456
|
-
'sprints:List all sprints in sprint folders'
|
|
2457
|
-
'subtasks:List subtasks of a task or initiative'
|
|
2458
|
-
'comment:Post a comment on a task'
|
|
2459
|
-
'comments:List comments on a task'
|
|
2460
|
-
'activity:Show task details and comments combined'
|
|
2461
|
-
'lists:List all lists in a space'
|
|
2462
|
-
'spaces:List spaces in your workspace'
|
|
2463
|
-
'inbox:Recently updated tasks grouped by time period'
|
|
2464
|
-
'assigned:Show all tasks assigned to me'
|
|
2465
|
-
'open:Open a task in the browser by ID or name'
|
|
2466
|
-
'search:Search my tasks by name'
|
|
2467
|
-
'summary:Daily standup summary'
|
|
2468
|
-
'overdue:List tasks that are past their due date'
|
|
2469
|
-
'assign:Assign or unassign users from a task'
|
|
2470
|
-
'depend:Add or remove task dependencies'
|
|
2471
|
-
'move:Add or remove a task from a list'
|
|
2472
|
-
'field:Set or remove a custom field value on a task'
|
|
2473
|
-
'delete:Delete a task'
|
|
2474
|
-
'tag:Add or remove tags from a task'
|
|
2475
|
-
'checklist:Manage checklists on a task'
|
|
2476
|
-
'time:Track time on tasks'
|
|
2477
|
-
'comment-edit:Edit an existing comment'
|
|
2478
|
-
'comment-delete:Delete a comment'
|
|
2479
|
-
'replies:List threaded replies on a comment'
|
|
2480
|
-
'reply:Reply to a comment'
|
|
2481
|
-
'link:Add or remove a link between two tasks'
|
|
2482
|
-
'attach:Upload a file attachment to a task'
|
|
2483
|
-
'docs:List workspace docs'
|
|
2484
|
-
'doc:View a doc or doc page'
|
|
2485
|
-
'doc-create:Create a new doc'
|
|
2486
|
-
'doc-pages:List all pages in a doc with content'
|
|
2487
|
-
'doc-page-create:Create a page in a doc'
|
|
2488
|
-
'doc-page-edit:Edit a doc page'
|
|
2489
|
-
'tags:List tags in a space'
|
|
2490
|
-
'tag-create:Create a tag in a space'
|
|
2491
|
-
'tag-delete:Delete a tag from a space'
|
|
2492
|
-
'members:List workspace members'
|
|
2493
|
-
'fields:List custom fields for a list'
|
|
2494
|
-
'duplicate:Duplicate a task'
|
|
2495
|
-
'bulk:Bulk task operations'
|
|
2496
|
-
'goals:List goals in your workspace'
|
|
2497
|
-
'goal-create:Create a goal'
|
|
2498
|
-
'goal-update:Update a goal'
|
|
2499
|
-
'goal-delete:Delete a goal'
|
|
2500
|
-
'key-results:List key results for a goal'
|
|
2501
|
-
'key-result-create:Create a key result on a goal'
|
|
2502
|
-
'key-result-update:Update a key result'
|
|
2503
|
-
'key-result-delete:Delete a key result'
|
|
2504
|
-
'doc-delete:Delete a doc'
|
|
2505
|
-
'doc-page-delete:Delete a doc page'
|
|
2506
|
-
'tag-update:Update a tag in a space'
|
|
2507
|
-
'task-types:List custom task types'
|
|
2508
|
-
'templates:List task templates'
|
|
2509
|
-
'folders:List folders in a space'
|
|
2510
|
-
'config:Manage CLI configuration'
|
|
2511
|
-
'completion:Output shell completion script'
|
|
3137
|
+
${renderZshTopLevelCommands(name)}
|
|
2512
3138
|
)
|
|
2513
3139
|
|
|
2514
3140
|
_arguments -C \\
|
|
@@ -3059,178 +3685,13 @@ function fishCompletion(name) {
|
|
|
3059
3685
|
complete -c ${name} -n __fish_use_subcommand -s h -l help -d 'Show help'
|
|
3060
3686
|
complete -c ${name} -n __fish_use_subcommand -s V -l version -d 'Show version'
|
|
3061
3687
|
|
|
3062
|
-
|
|
3063
|
-
complete -c ${name} -n __fish_use_subcommand -a auth -d 'Validate API token and show current user'
|
|
3064
|
-
complete -c ${name} -n __fish_use_subcommand -a tasks -d 'List tasks assigned to me'
|
|
3065
|
-
complete -c ${name} -n __fish_use_subcommand -a task -d 'Get task details'
|
|
3066
|
-
complete -c ${name} -n __fish_use_subcommand -a update -d 'Update a task'
|
|
3067
|
-
complete -c ${name} -n __fish_use_subcommand -a create -d 'Create a new task'
|
|
3068
|
-
complete -c ${name} -n __fish_use_subcommand -a sprint -d 'List my tasks in the current active sprint'
|
|
3069
|
-
complete -c ${name} -n __fish_use_subcommand -a sprints -d 'List all sprints in sprint folders'
|
|
3070
|
-
complete -c ${name} -n __fish_use_subcommand -a subtasks -d 'List subtasks of a task or initiative'
|
|
3071
|
-
complete -c ${name} -n __fish_use_subcommand -a comment -d 'Post a comment on a task'
|
|
3072
|
-
complete -c ${name} -n __fish_use_subcommand -a comments -d 'List comments on a task'
|
|
3073
|
-
complete -c ${name} -n __fish_use_subcommand -a activity -d 'Show task details and comments combined'
|
|
3074
|
-
complete -c ${name} -n __fish_use_subcommand -a lists -d 'List all lists in a space'
|
|
3075
|
-
complete -c ${name} -n __fish_use_subcommand -a spaces -d 'List spaces in your workspace'
|
|
3076
|
-
complete -c ${name} -n __fish_use_subcommand -a inbox -d 'Recently updated tasks grouped by time period'
|
|
3077
|
-
complete -c ${name} -n __fish_use_subcommand -a assigned -d 'Show all tasks assigned to me'
|
|
3078
|
-
complete -c ${name} -n __fish_use_subcommand -a open -d 'Open a task in the browser by ID or name'
|
|
3079
|
-
complete -c ${name} -n __fish_use_subcommand -a search -d 'Search my tasks by name'
|
|
3080
|
-
complete -c ${name} -n __fish_use_subcommand -a summary -d 'Daily standup summary'
|
|
3081
|
-
complete -c ${name} -n __fish_use_subcommand -a overdue -d 'List tasks that are past their due date'
|
|
3082
|
-
complete -c ${name} -n __fish_use_subcommand -a assign -d 'Assign or unassign users from a task'
|
|
3083
|
-
complete -c ${name} -n __fish_use_subcommand -a depend -d 'Add or remove task dependencies'
|
|
3084
|
-
complete -c ${name} -n __fish_use_subcommand -a move -d 'Add or remove a task from a list'
|
|
3085
|
-
complete -c ${name} -n __fish_use_subcommand -a field -d 'Set or remove a custom field value on a task'
|
|
3086
|
-
complete -c ${name} -n __fish_use_subcommand -a delete -d 'Delete a task'
|
|
3087
|
-
complete -c ${name} -n __fish_use_subcommand -a tag -d 'Add or remove tags from a task'
|
|
3088
|
-
complete -c ${name} -n __fish_use_subcommand -a checklist -d 'Manage checklists on a task'
|
|
3089
|
-
complete -c ${name} -n __fish_use_subcommand -a time -d 'Track time on tasks'
|
|
3090
|
-
complete -c ${name} -n __fish_use_subcommand -a comment-edit -d 'Edit an existing comment'
|
|
3091
|
-
complete -c ${name} -n __fish_use_subcommand -a comment-delete -d 'Delete a comment'
|
|
3092
|
-
complete -c ${name} -n __fish_use_subcommand -a replies -d 'List threaded replies on a comment'
|
|
3093
|
-
complete -c ${name} -n __fish_use_subcommand -a reply -d 'Reply to a comment'
|
|
3094
|
-
complete -c ${name} -n __fish_use_subcommand -a link -d 'Add or remove a link between two tasks'
|
|
3095
|
-
complete -c ${name} -n __fish_use_subcommand -a attach -d 'Upload a file attachment to a task'
|
|
3096
|
-
complete -c ${name} -n __fish_use_subcommand -a docs -d 'List workspace docs'
|
|
3097
|
-
complete -c ${name} -n __fish_use_subcommand -a doc -d 'View a doc or doc page'
|
|
3098
|
-
complete -c ${name} -n __fish_use_subcommand -a doc-create -d 'Create a new doc'
|
|
3099
|
-
complete -c ${name} -n __fish_use_subcommand -a doc-pages -d 'List all pages in a doc with content'
|
|
3100
|
-
complete -c ${name} -n __fish_use_subcommand -a doc-page-create -d 'Create a page in a doc'
|
|
3101
|
-
complete -c ${name} -n __fish_use_subcommand -a doc-page-edit -d 'Edit a doc page'
|
|
3102
|
-
complete -c ${name} -n __fish_use_subcommand -a tags -d 'List tags in a space'
|
|
3103
|
-
complete -c ${name} -n __fish_use_subcommand -a tag-create -d 'Create a tag in a space'
|
|
3104
|
-
complete -c ${name} -n __fish_use_subcommand -a tag-delete -d 'Delete a tag from a space'
|
|
3105
|
-
complete -c ${name} -n __fish_use_subcommand -a members -d 'List workspace members'
|
|
3106
|
-
complete -c ${name} -n __fish_use_subcommand -a fields -d 'List custom fields for a list'
|
|
3107
|
-
complete -c ${name} -n __fish_use_subcommand -a duplicate -d 'Duplicate a task'
|
|
3108
|
-
complete -c ${name} -n __fish_use_subcommand -a bulk -d 'Bulk task operations'
|
|
3109
|
-
complete -c ${name} -n __fish_use_subcommand -a goals -d 'List goals in your workspace'
|
|
3110
|
-
complete -c ${name} -n __fish_use_subcommand -a goal-create -d 'Create a goal'
|
|
3111
|
-
complete -c ${name} -n __fish_use_subcommand -a goal-update -d 'Update a goal'
|
|
3112
|
-
complete -c ${name} -n __fish_use_subcommand -a key-results -d 'List key results for a goal'
|
|
3113
|
-
complete -c ${name} -n __fish_use_subcommand -a key-result-create -d 'Create a key result on a goal'
|
|
3114
|
-
complete -c ${name} -n __fish_use_subcommand -a key-result-update -d 'Update a key result'
|
|
3115
|
-
complete -c ${name} -n __fish_use_subcommand -a goal-delete -d 'Delete a goal'
|
|
3116
|
-
complete -c ${name} -n __fish_use_subcommand -a key-result-delete -d 'Delete a key result'
|
|
3117
|
-
complete -c ${name} -n __fish_use_subcommand -a doc-delete -d 'Delete a doc'
|
|
3118
|
-
complete -c ${name} -n __fish_use_subcommand -a doc-page-delete -d 'Delete a doc page'
|
|
3119
|
-
complete -c ${name} -n __fish_use_subcommand -a tag-update -d 'Update a tag in a space'
|
|
3120
|
-
complete -c ${name} -n __fish_use_subcommand -a task-types -d 'List custom task types'
|
|
3121
|
-
complete -c ${name} -n __fish_use_subcommand -a templates -d 'List task templates'
|
|
3122
|
-
complete -c ${name} -n __fish_use_subcommand -a folders -d 'List folders in a space'
|
|
3123
|
-
complete -c ${name} -n __fish_use_subcommand -a config -d 'Manage CLI configuration'
|
|
3124
|
-
complete -c ${name} -n __fish_use_subcommand -a completion -d 'Output shell completion script'
|
|
3688
|
+
${renderFishTopLevelCommands(name)}
|
|
3125
3689
|
|
|
3126
|
-
|
|
3690
|
+
${renderFishTopLevelFlags(name)}
|
|
3127
3691
|
|
|
3128
|
-
complete -c ${name} -n '__fish_seen_subcommand_from
|
|
3129
|
-
complete -c ${name} -n '__fish_seen_subcommand_from
|
|
3130
|
-
complete -c ${name} -n '__fish_seen_subcommand_from
|
|
3131
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tasks' -l name -d 'Filter by name'
|
|
3132
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tasks' -l type -d 'Filter by task type'
|
|
3133
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tasks' -l include-closed -d 'Include done/closed tasks'
|
|
3134
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tasks' -l json -d 'Force JSON output'
|
|
3135
|
-
|
|
3136
|
-
complete -c ${name} -n '__fish_seen_subcommand_from task' -l json -d 'Force JSON output'
|
|
3137
|
-
|
|
3138
|
-
complete -c ${name} -n '__fish_seen_subcommand_from update' -s n -l name -d 'New task name'
|
|
3139
|
-
complete -c ${name} -n '__fish_seen_subcommand_from update' -s d -l description -d 'New description'
|
|
3140
|
-
complete -c ${name} -n '__fish_seen_subcommand_from update' -s s -l status -d 'New status'
|
|
3141
|
-
complete -c ${name} -n '__fish_seen_subcommand_from update' -l priority -d 'Priority level' -a 'urgent high normal low'
|
|
3142
|
-
complete -c ${name} -n '__fish_seen_subcommand_from update' -l due-date -d 'Due date'
|
|
3143
|
-
complete -c ${name} -n '__fish_seen_subcommand_from update' -l time-estimate -d 'Time estimate'
|
|
3144
|
-
complete -c ${name} -n '__fish_seen_subcommand_from update' -l assignee -d 'Add assignee'
|
|
3145
|
-
complete -c ${name} -n '__fish_seen_subcommand_from update' -l parent -d 'Set parent task'
|
|
3146
|
-
complete -c ${name} -n '__fish_seen_subcommand_from update' -l json -d 'Force JSON output'
|
|
3147
|
-
|
|
3148
|
-
complete -c ${name} -n '__fish_seen_subcommand_from create' -s l -l list -d 'Target list ID'
|
|
3149
|
-
complete -c ${name} -n '__fish_seen_subcommand_from create' -s n -l name -d 'Task name'
|
|
3150
|
-
complete -c ${name} -n '__fish_seen_subcommand_from create' -s d -l description -d 'Task description'
|
|
3151
|
-
complete -c ${name} -n '__fish_seen_subcommand_from create' -s p -l parent -d 'Parent task ID'
|
|
3152
|
-
complete -c ${name} -n '__fish_seen_subcommand_from create' -s s -l status -d 'Initial status'
|
|
3153
|
-
complete -c ${name} -n '__fish_seen_subcommand_from create' -l priority -d 'Priority level' -a 'urgent high normal low'
|
|
3154
|
-
complete -c ${name} -n '__fish_seen_subcommand_from create' -l due-date -d 'Due date'
|
|
3155
|
-
complete -c ${name} -n '__fish_seen_subcommand_from create' -l assignee -d 'Assignee user ID'
|
|
3156
|
-
complete -c ${name} -n '__fish_seen_subcommand_from create' -l tags -d 'Comma-separated tag names'
|
|
3157
|
-
complete -c ${name} -n '__fish_seen_subcommand_from create' -l custom-item-id -d 'Custom task type ID'
|
|
3158
|
-
complete -c ${name} -n '__fish_seen_subcommand_from create' -l time-estimate -d 'Time estimate'
|
|
3159
|
-
complete -c ${name} -n '__fish_seen_subcommand_from create' -l template -d 'Create from a task template'
|
|
3160
|
-
complete -c ${name} -n '__fish_seen_subcommand_from create' -l json -d 'Force JSON output'
|
|
3161
|
-
|
|
3162
|
-
complete -c ${name} -n '__fish_seen_subcommand_from sprint' -l status -d 'Filter by status'
|
|
3163
|
-
complete -c ${name} -n '__fish_seen_subcommand_from sprint' -l space -d 'Narrow sprint search to a space'
|
|
3164
|
-
complete -c ${name} -n '__fish_seen_subcommand_from sprint' -l folder -d 'Sprint folder ID'
|
|
3165
|
-
complete -c ${name} -n '__fish_seen_subcommand_from sprint' -l include-closed -d 'Include done/closed tasks'
|
|
3166
|
-
complete -c ${name} -n '__fish_seen_subcommand_from sprint' -l json -d 'Force JSON output'
|
|
3167
|
-
|
|
3168
|
-
complete -c ${name} -n '__fish_seen_subcommand_from sprints' -l space -d 'Filter by space'
|
|
3169
|
-
complete -c ${name} -n '__fish_seen_subcommand_from sprints' -l json -d 'Force JSON output'
|
|
3170
|
-
|
|
3171
|
-
complete -c ${name} -n '__fish_seen_subcommand_from subtasks' -l status -d 'Filter by status'
|
|
3172
|
-
complete -c ${name} -n '__fish_seen_subcommand_from subtasks' -l name -d 'Filter by name'
|
|
3173
|
-
complete -c ${name} -n '__fish_seen_subcommand_from subtasks' -l include-closed -d 'Include closed/done subtasks'
|
|
3174
|
-
complete -c ${name} -n '__fish_seen_subcommand_from subtasks' -l json -d 'Force JSON output'
|
|
3175
|
-
|
|
3176
|
-
complete -c ${name} -n '__fish_seen_subcommand_from comment' -s m -l message -d 'Comment text'
|
|
3177
|
-
complete -c ${name} -n '__fish_seen_subcommand_from comment' -l notify-all -d 'Notify all assignees'
|
|
3178
|
-
complete -c ${name} -n '__fish_seen_subcommand_from comment' -l json -d 'Force JSON output'
|
|
3179
|
-
|
|
3180
|
-
complete -c ${name} -n '__fish_seen_subcommand_from comments' -l json -d 'Force JSON output'
|
|
3181
|
-
|
|
3182
|
-
complete -c ${name} -n '__fish_seen_subcommand_from activity' -l json -d 'Force JSON output'
|
|
3183
|
-
|
|
3184
|
-
complete -c ${name} -n '__fish_seen_subcommand_from lists' -l name -d 'Filter by name'
|
|
3185
|
-
complete -c ${name} -n '__fish_seen_subcommand_from lists' -l json -d 'Force JSON output'
|
|
3186
|
-
|
|
3187
|
-
complete -c ${name} -n '__fish_seen_subcommand_from spaces' -l name -d 'Filter spaces by name'
|
|
3188
|
-
complete -c ${name} -n '__fish_seen_subcommand_from spaces' -l my -d 'Show only spaces where I have assigned tasks'
|
|
3189
|
-
complete -c ${name} -n '__fish_seen_subcommand_from spaces' -l json -d 'Force JSON output'
|
|
3190
|
-
|
|
3191
|
-
complete -c ${name} -n '__fish_seen_subcommand_from inbox' -l include-closed -d 'Include done/closed tasks'
|
|
3192
|
-
complete -c ${name} -n '__fish_seen_subcommand_from inbox' -l json -d 'Force JSON output'
|
|
3193
|
-
complete -c ${name} -n '__fish_seen_subcommand_from inbox' -l days -d 'Lookback period in days'
|
|
3194
|
-
|
|
3195
|
-
complete -c ${name} -n '__fish_seen_subcommand_from assigned' -l status -d 'Show only tasks with this status'
|
|
3196
|
-
complete -c ${name} -n '__fish_seen_subcommand_from assigned' -l include-closed -d 'Include done/closed tasks'
|
|
3197
|
-
complete -c ${name} -n '__fish_seen_subcommand_from assigned' -l json -d 'Force JSON output'
|
|
3198
|
-
|
|
3199
|
-
complete -c ${name} -n '__fish_seen_subcommand_from open' -l json -d 'Output task JSON instead of opening'
|
|
3200
|
-
|
|
3201
|
-
complete -c ${name} -n '__fish_seen_subcommand_from search' -l status -d 'Filter by status'
|
|
3202
|
-
complete -c ${name} -n '__fish_seen_subcommand_from search' -l include-closed -d 'Include done/closed tasks in search'
|
|
3203
|
-
complete -c ${name} -n '__fish_seen_subcommand_from search' -l json -d 'Force JSON output'
|
|
3204
|
-
|
|
3205
|
-
complete -c ${name} -n '__fish_seen_subcommand_from summary' -l hours -d 'Completed-tasks lookback in hours'
|
|
3206
|
-
complete -c ${name} -n '__fish_seen_subcommand_from summary' -l json -d 'Force JSON output'
|
|
3207
|
-
|
|
3208
|
-
complete -c ${name} -n '__fish_seen_subcommand_from overdue' -l include-closed -d 'Include done/closed overdue tasks'
|
|
3209
|
-
complete -c ${name} -n '__fish_seen_subcommand_from overdue' -l json -d 'Force JSON output'
|
|
3210
|
-
|
|
3211
|
-
complete -c ${name} -n '__fish_seen_subcommand_from assign' -l to -d 'Add assignee'
|
|
3212
|
-
complete -c ${name} -n '__fish_seen_subcommand_from assign' -l remove -d 'Remove assignee'
|
|
3213
|
-
complete -c ${name} -n '__fish_seen_subcommand_from assign' -l json -d 'Force JSON output'
|
|
3214
|
-
|
|
3215
|
-
complete -c ${name} -n '__fish_seen_subcommand_from depend' -l on -d 'Task that this task depends on'
|
|
3216
|
-
complete -c ${name} -n '__fish_seen_subcommand_from depend' -l blocks -d 'Task that this task blocks'
|
|
3217
|
-
complete -c ${name} -n '__fish_seen_subcommand_from depend' -l remove -d 'Remove the dependency'
|
|
3218
|
-
complete -c ${name} -n '__fish_seen_subcommand_from depend' -l json -d 'Force JSON output'
|
|
3219
|
-
|
|
3220
|
-
complete -c ${name} -n '__fish_seen_subcommand_from move' -l to -d 'Add task to this list'
|
|
3221
|
-
complete -c ${name} -n '__fish_seen_subcommand_from move' -l remove -d 'Remove task from this list'
|
|
3222
|
-
complete -c ${name} -n '__fish_seen_subcommand_from move' -l json -d 'Force JSON output'
|
|
3223
|
-
|
|
3224
|
-
complete -c ${name} -n '__fish_seen_subcommand_from field' -l set -d 'Set field name and value'
|
|
3225
|
-
complete -c ${name} -n '__fish_seen_subcommand_from field' -l remove -d 'Remove field value by name'
|
|
3226
|
-
complete -c ${name} -n '__fish_seen_subcommand_from field' -l json -d 'Force JSON output'
|
|
3227
|
-
|
|
3228
|
-
complete -c ${name} -n '__fish_seen_subcommand_from delete' -l confirm -d 'Skip confirmation prompt'
|
|
3229
|
-
complete -c ${name} -n '__fish_seen_subcommand_from delete' -l json -d 'Force JSON output'
|
|
3230
|
-
|
|
3231
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tag' -l add -d 'Comma-separated tag names to add'
|
|
3232
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tag' -l remove -d 'Comma-separated tag names to remove'
|
|
3233
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tag' -l json -d 'Force JSON output'
|
|
3692
|
+
complete -c ${name} -n '__fish_seen_subcommand_from update' -l priority -a 'urgent high normal low'
|
|
3693
|
+
complete -c ${name} -n '__fish_seen_subcommand_from create' -l priority -a 'urgent high normal low'
|
|
3694
|
+
complete -c ${name} -n '__fish_seen_subcommand_from key-result-create' -l type -a 'number percentage'
|
|
3234
3695
|
|
|
3235
3696
|
complete -c ${name} -n '__fish_seen_subcommand_from checklist; and not __fish_seen_subcommand_from view create delete add-item edit-item delete-item' -a view -d 'View checklists on a task'
|
|
3236
3697
|
complete -c ${name} -n '__fish_seen_subcommand_from checklist; and not __fish_seen_subcommand_from view create delete add-item edit-item delete-item' -a create -d 'Create a checklist on a task'
|
|
@@ -3259,100 +3720,11 @@ complete -c ${name} -n '__fish_seen_subcommand_from list; and __fish_seen_subcom
|
|
|
3259
3720
|
complete -c ${name} -n '__fish_seen_subcommand_from update; and __fish_seen_subcommand_from time' -s d -l description -d 'New description'
|
|
3260
3721
|
complete -c ${name} -n '__fish_seen_subcommand_from update; and __fish_seen_subcommand_from time' -l duration -d 'New duration'
|
|
3261
3722
|
|
|
3262
|
-
complete -c ${name} -n '__fish_seen_subcommand_from comment-delete' -l json -d 'Force JSON output'
|
|
3263
|
-
|
|
3264
|
-
complete -c ${name} -n '__fish_seen_subcommand_from replies' -l json -d 'Force JSON output'
|
|
3265
|
-
|
|
3266
|
-
complete -c ${name} -n '__fish_seen_subcommand_from reply' -s m -l message -d 'Reply text'
|
|
3267
|
-
complete -c ${name} -n '__fish_seen_subcommand_from reply' -l notify-all -d 'Notify all assignees'
|
|
3268
|
-
complete -c ${name} -n '__fish_seen_subcommand_from reply' -l json -d 'Force JSON output'
|
|
3269
|
-
|
|
3270
|
-
complete -c ${name} -n '__fish_seen_subcommand_from link' -l remove -d 'Remove the link'
|
|
3271
|
-
complete -c ${name} -n '__fish_seen_subcommand_from link' -l json -d 'Force JSON output'
|
|
3272
|
-
|
|
3273
|
-
complete -c ${name} -n '__fish_seen_subcommand_from attach' -l json -d 'Force JSON output'
|
|
3274
3723
|
complete -c ${name} -n '__fish_seen_subcommand_from attach' -F
|
|
3275
3724
|
|
|
3276
|
-
complete -c ${name} -n '__fish_seen_subcommand_from comment-edit' -s m -l message -d 'New comment text'
|
|
3277
|
-
complete -c ${name} -n '__fish_seen_subcommand_from comment-edit' -l resolved -d 'Mark comment as resolved'
|
|
3278
|
-
complete -c ${name} -n '__fish_seen_subcommand_from comment-edit' -l unresolved -d 'Mark comment as unresolved'
|
|
3279
|
-
complete -c ${name} -n '__fish_seen_subcommand_from comment-edit' -l json -d 'Force JSON output'
|
|
3280
|
-
|
|
3281
|
-
complete -c ${name} -n '__fish_seen_subcommand_from docs' -l json -d 'Force JSON output'
|
|
3282
|
-
|
|
3283
|
-
complete -c ${name} -n '__fish_seen_subcommand_from doc' -l json -d 'Force JSON output'
|
|
3284
|
-
|
|
3285
|
-
complete -c ${name} -n '__fish_seen_subcommand_from doc-pages' -l json -d 'Force JSON output'
|
|
3286
|
-
|
|
3287
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tags' -l json -d 'Force JSON output'
|
|
3288
|
-
|
|
3289
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tag-create' -l fg -d 'Foreground color'
|
|
3290
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tag-create' -l bg -d 'Background color'
|
|
3291
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tag-create' -l json -d 'Force JSON output'
|
|
3292
|
-
|
|
3293
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tag-delete' -l json -d 'Force JSON output'
|
|
3294
|
-
|
|
3295
|
-
complete -c ${name} -n '__fish_seen_subcommand_from members' -l json -d 'Force JSON output'
|
|
3296
|
-
|
|
3297
|
-
complete -c ${name} -n '__fish_seen_subcommand_from fields' -l json -d 'Force JSON output'
|
|
3298
|
-
|
|
3299
|
-
complete -c ${name} -n '__fish_seen_subcommand_from duplicate' -l json -d 'Force JSON output'
|
|
3300
|
-
|
|
3301
3725
|
complete -c ${name} -n '__fish_seen_subcommand_from bulk; and not __fish_seen_subcommand_from status' -a status -d 'Update status of multiple tasks'
|
|
3302
3726
|
complete -c ${name} -n '__fish_seen_subcommand_from status; and __fish_seen_subcommand_from bulk' -l json -d 'Force JSON output'
|
|
3303
3727
|
|
|
3304
|
-
complete -c ${name} -n '__fish_seen_subcommand_from goals' -l json -d 'Force JSON output'
|
|
3305
|
-
|
|
3306
|
-
complete -c ${name} -n '__fish_seen_subcommand_from goal-create' -s d -l description -d 'Goal description'
|
|
3307
|
-
complete -c ${name} -n '__fish_seen_subcommand_from goal-create' -l color -d 'Goal color'
|
|
3308
|
-
complete -c ${name} -n '__fish_seen_subcommand_from goal-create' -l json -d 'Force JSON output'
|
|
3309
|
-
|
|
3310
|
-
complete -c ${name} -n '__fish_seen_subcommand_from goal-update' -s n -l name -d 'New goal name'
|
|
3311
|
-
complete -c ${name} -n '__fish_seen_subcommand_from goal-update' -s d -l description -d 'New description'
|
|
3312
|
-
complete -c ${name} -n '__fish_seen_subcommand_from goal-update' -l color -d 'New color'
|
|
3313
|
-
complete -c ${name} -n '__fish_seen_subcommand_from goal-update' -l json -d 'Force JSON output'
|
|
3314
|
-
|
|
3315
|
-
complete -c ${name} -n '__fish_seen_subcommand_from key-results' -l json -d 'Force JSON output'
|
|
3316
|
-
|
|
3317
|
-
complete -c ${name} -n '__fish_seen_subcommand_from key-result-create' -l type -d 'Key result type' -a 'number percentage'
|
|
3318
|
-
complete -c ${name} -n '__fish_seen_subcommand_from key-result-create' -l target -d 'Target value'
|
|
3319
|
-
complete -c ${name} -n '__fish_seen_subcommand_from key-result-create' -l json -d 'Force JSON output'
|
|
3320
|
-
|
|
3321
|
-
complete -c ${name} -n '__fish_seen_subcommand_from key-result-update' -l progress -d 'Current progress'
|
|
3322
|
-
complete -c ${name} -n '__fish_seen_subcommand_from key-result-update' -l note -d 'Progress note'
|
|
3323
|
-
complete -c ${name} -n '__fish_seen_subcommand_from key-result-update' -l json -d 'Force JSON output'
|
|
3324
|
-
|
|
3325
|
-
complete -c ${name} -n '__fish_seen_subcommand_from goal-delete' -l json -d 'Force JSON output'
|
|
3326
|
-
|
|
3327
|
-
complete -c ${name} -n '__fish_seen_subcommand_from key-result-delete' -l json -d 'Force JSON output'
|
|
3328
|
-
|
|
3329
|
-
complete -c ${name} -n '__fish_seen_subcommand_from doc-delete' -l json -d 'Force JSON output'
|
|
3330
|
-
|
|
3331
|
-
complete -c ${name} -n '__fish_seen_subcommand_from doc-page-delete' -l json -d 'Force JSON output'
|
|
3332
|
-
|
|
3333
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tag-update' -l name -d 'New tag name'
|
|
3334
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tag-update' -l fg -d 'New foreground color'
|
|
3335
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tag-update' -l bg -d 'New background color'
|
|
3336
|
-
complete -c ${name} -n '__fish_seen_subcommand_from tag-update' -l json -d 'Force JSON output'
|
|
3337
|
-
|
|
3338
|
-
complete -c ${name} -n '__fish_seen_subcommand_from task-types' -l json -d 'Force JSON output'
|
|
3339
|
-
|
|
3340
|
-
complete -c ${name} -n '__fish_seen_subcommand_from templates' -l json -d 'Force JSON output'
|
|
3341
|
-
|
|
3342
|
-
complete -c ${name} -n '__fish_seen_subcommand_from folders' -l name -d 'Filter by folder name'
|
|
3343
|
-
complete -c ${name} -n '__fish_seen_subcommand_from folders' -l json -d 'Force JSON output'
|
|
3344
|
-
|
|
3345
|
-
complete -c ${name} -n '__fish_seen_subcommand_from doc-create' -s c -l content -d 'Initial content'
|
|
3346
|
-
complete -c ${name} -n '__fish_seen_subcommand_from doc-create' -l json -d 'Force JSON output'
|
|
3347
|
-
|
|
3348
|
-
complete -c ${name} -n '__fish_seen_subcommand_from doc-page-create' -s c -l content -d 'Page content'
|
|
3349
|
-
complete -c ${name} -n '__fish_seen_subcommand_from doc-page-create' -l parent-page -d 'Parent page ID'
|
|
3350
|
-
complete -c ${name} -n '__fish_seen_subcommand_from doc-page-create' -l json -d 'Force JSON output'
|
|
3351
|
-
|
|
3352
|
-
complete -c ${name} -n '__fish_seen_subcommand_from doc-page-edit' -l name -d 'New page name'
|
|
3353
|
-
complete -c ${name} -n '__fish_seen_subcommand_from doc-page-edit' -s c -l content -d 'New page content'
|
|
3354
|
-
complete -c ${name} -n '__fish_seen_subcommand_from doc-page-edit' -l json -d 'Force JSON output'
|
|
3355
|
-
|
|
3356
3728
|
complete -c ${name} -n '__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from get set path' -a get -d 'Print a config value'
|
|
3357
3729
|
complete -c ${name} -n '__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from get set path' -a set -d 'Set a config value'
|
|
3358
3730
|
complete -c ${name} -n '__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from get set path' -a path -d 'Print config file path'
|
|
@@ -4162,984 +4534,1009 @@ function formatTemplatesMarkdown(templates) {
|
|
|
4162
4534
|
// src/index.ts
|
|
4163
4535
|
var require2 = createRequire(import.meta.url);
|
|
4164
4536
|
var { version } = require2("../package.json");
|
|
4165
|
-
var programName = basename(process.argv[1] ?? "cup");
|
|
4166
4537
|
function wrapAction(fn) {
|
|
4167
|
-
return (...args) => {
|
|
4168
|
-
fn(...args).catch((err) => {
|
|
4538
|
+
return async (...args) => {
|
|
4539
|
+
await fn(...args).catch((err) => {
|
|
4169
4540
|
console.error(err instanceof Error ? err.message : String(err));
|
|
4170
4541
|
process.exit(1);
|
|
4171
4542
|
});
|
|
4172
4543
|
};
|
|
4173
4544
|
}
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
}
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
}
|
|
4192
|
-
})
|
|
4193
|
-
);
|
|
4194
|
-
program.command("tasks").description("List tasks assigned to me").option("--status <status>", 'Filter by status (e.g. "in progress")').option("--list <listId>", "Filter by list ID").option("--space <spaceId>", "Filter by space ID").option("--name <partial>", "Filter by name (case-insensitive contains)").option(
|
|
4195
|
-
"--type <type>",
|
|
4196
|
-
'Filter by task type (e.g. "task", "initiative", or custom type name/ID)'
|
|
4197
|
-
).option("--include-closed", "Include done/closed tasks").option("--json", "Force JSON output even in terminal").action(
|
|
4198
|
-
wrapAction(async (opts) => {
|
|
4199
|
-
const config = loadConfig();
|
|
4200
|
-
const tasks = await fetchMyTasks(config, {
|
|
4201
|
-
typeFilter: opts.type,
|
|
4202
|
-
statuses: opts.status ? [opts.status] : void 0,
|
|
4203
|
-
listIds: opts.list ? [opts.list] : void 0,
|
|
4204
|
-
spaceIds: opts.space ? [opts.space] : void 0,
|
|
4205
|
-
name: opts.name,
|
|
4206
|
-
includeClosed: opts.includeClosed
|
|
4207
|
-
});
|
|
4208
|
-
await printTasks(tasks, opts.json ?? false, config);
|
|
4209
|
-
})
|
|
4210
|
-
);
|
|
4211
|
-
program.command("task <taskId>").description("Get task details").option("--json", "Force JSON output even in terminal").action(
|
|
4212
|
-
wrapAction(async (taskId, opts) => {
|
|
4213
|
-
const config = loadConfig();
|
|
4214
|
-
const result = await getTask(config, taskId);
|
|
4215
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4216
|
-
console.log(JSON.stringify(result, null, 2));
|
|
4217
|
-
} else if (!isTTY()) {
|
|
4218
|
-
console.log(formatTaskDetailMarkdown(result));
|
|
4219
|
-
} else {
|
|
4220
|
-
console.log(formatTaskDetail(result));
|
|
4221
|
-
}
|
|
4222
|
-
})
|
|
4223
|
-
);
|
|
4224
|
-
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 or "me"').option("--parent <taskId>", "Set parent task (makes this a subtask)").option("--json", "Force JSON output even in terminal").action(
|
|
4225
|
-
wrapAction(async (taskId, opts) => {
|
|
4226
|
-
const config = loadConfig();
|
|
4227
|
-
if (opts.assignee === "me") {
|
|
4228
|
-
const client = new ClickUpClient(config);
|
|
4229
|
-
opts.assignee = String(await resolveAssigneeId(client, "me"));
|
|
4230
|
-
}
|
|
4231
|
-
const payload = buildUpdatePayload(opts);
|
|
4232
|
-
const result = await updateTask(config, taskId, payload);
|
|
4233
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4234
|
-
console.log(JSON.stringify(result, null, 2));
|
|
4235
|
-
} else {
|
|
4236
|
-
console.log(formatUpdateConfirmation(result.id, result.name));
|
|
4237
|
-
}
|
|
4238
|
-
})
|
|
4239
|
-
);
|
|
4240
|
-
program.command("create").description("Create a new task").option("-l, --list <listId>", "Target list ID (auto-detected from --parent if omitted)").requiredOption("-n, --name <name>", "Task name").option("-d, --description <text>", "Task description (markdown supported)").option("-p, --parent <taskId>", "Parent task ID (list auto-detected from parent)").option("-s, --status <status>", "Initial status").option("--priority <level>", "Priority: urgent, high, normal, low (or 1-4)").option("--due-date <date>", "Due date (YYYY-MM-DD)").option("--assignee <userId>", 'Assignee user ID or "me"').option("--tags <tags>", "Comma-separated tag names").option("--custom-item-id <id>", "Custom task type ID (use to create initiatives)").option("--time-estimate <duration>", 'Time estimate (e.g. "2h", "30m", "1h30m")').option("--template <id>", "Create from a task template").option("--json", "Force JSON output even in terminal").action(
|
|
4241
|
-
wrapAction(async (opts) => {
|
|
4242
|
-
const config = loadConfig();
|
|
4243
|
-
if (opts.assignee === "me") {
|
|
4244
|
-
const client = new ClickUpClient(config);
|
|
4245
|
-
opts.assignee = String(await resolveAssigneeId(client, "me"));
|
|
4246
|
-
}
|
|
4247
|
-
const result = await createTask(config, opts);
|
|
4248
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4249
|
-
console.log(JSON.stringify(result, null, 2));
|
|
4250
|
-
} else {
|
|
4251
|
-
console.log(formatCreateConfirmation(result.id, result.name, result.url));
|
|
4252
|
-
}
|
|
4253
|
-
})
|
|
4254
|
-
);
|
|
4255
|
-
program.command("sprint").description("List my tasks in the current active sprint (auto-detected)").option("--status <status>", "Filter by status").option("--space <nameOrId>", "Narrow sprint search to a specific space (partial name or ID)").option("--folder <folderId>", "Sprint folder ID (overrides config and auto-detection)").option("--include-closed", "Include done/closed tasks").option("--json", "Force JSON output even in terminal").action(
|
|
4256
|
-
wrapAction(
|
|
4257
|
-
async (opts) => {
|
|
4545
|
+
function parseOptionalNumberOption(value, optionName) {
|
|
4546
|
+
const parsed = Number(value);
|
|
4547
|
+
if (!Number.isFinite(parsed)) {
|
|
4548
|
+
throw new Error(`${optionName} must be a number or "null"`);
|
|
4549
|
+
}
|
|
4550
|
+
return parsed;
|
|
4551
|
+
}
|
|
4552
|
+
function buildProgram(programName = basename(process.argv[1] ?? "cup")) {
|
|
4553
|
+
const program = new Command();
|
|
4554
|
+
program.name(programName).description("ClickUp CLI for AI agents").version(version).allowExcessArguments(false);
|
|
4555
|
+
program.command("init").description(`Set up ${programName} for the first time`).action(
|
|
4556
|
+
wrapAction(async () => {
|
|
4557
|
+
await runInitCommand();
|
|
4558
|
+
})
|
|
4559
|
+
);
|
|
4560
|
+
program.command("auth").description("Validate API token and show current user").option("--json", "Force JSON output even in terminal").action(
|
|
4561
|
+
wrapAction(async (opts) => {
|
|
4258
4562
|
const config = loadConfig();
|
|
4259
|
-
await
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
)
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
);
|
|
4269
|
-
program.command("
|
|
4270
|
-
|
|
4271
|
-
|
|
4563
|
+
const result = await checkAuth(config);
|
|
4564
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
4565
|
+
console.log(JSON.stringify(result, null, 2));
|
|
4566
|
+
} else if (result.authenticated && result.user) {
|
|
4567
|
+
console.log(`Authenticated as @${result.user.username} (id: ${result.user.id})`);
|
|
4568
|
+
} else {
|
|
4569
|
+
throw new Error(`Authentication failed: ${result.error ?? "unknown error"}`);
|
|
4570
|
+
}
|
|
4571
|
+
})
|
|
4572
|
+
);
|
|
4573
|
+
program.command("tasks").description("List tasks assigned to me").option("--status <status>", 'Filter by status (e.g. "in progress")').option("--list <listId>", "Filter by list ID").option("--space <spaceId>", "Filter by space ID").option("--name <partial>", "Filter by name (case-insensitive contains)").option(
|
|
4574
|
+
"--type <type>",
|
|
4575
|
+
'Filter by task type (e.g. "task", "initiative", or custom type name/ID)'
|
|
4576
|
+
).option("--include-closed", "Include done/closed tasks").option("--json", "Force JSON output even in terminal").action(
|
|
4577
|
+
wrapAction(async (opts) => {
|
|
4578
|
+
const config = loadConfig();
|
|
4579
|
+
const tasks = await fetchMyTasks(config, {
|
|
4580
|
+
typeFilter: opts.type,
|
|
4581
|
+
statuses: opts.status ? [opts.status] : void 0,
|
|
4582
|
+
listIds: opts.list ? [opts.list] : void 0,
|
|
4583
|
+
spaceIds: opts.space ? [opts.space] : void 0,
|
|
4584
|
+
name: opts.name,
|
|
4585
|
+
includeClosed: opts.includeClosed
|
|
4586
|
+
});
|
|
4587
|
+
await printTasks(tasks, opts.json ?? false, config);
|
|
4588
|
+
})
|
|
4589
|
+
);
|
|
4590
|
+
program.command("task <taskId>").description("Get task details").option("--json", "Force JSON output even in terminal").action(
|
|
4591
|
+
wrapAction(async (taskId, opts) => {
|
|
4272
4592
|
const config = loadConfig();
|
|
4273
|
-
|
|
4274
|
-
if (opts.
|
|
4275
|
-
|
|
4276
|
-
|
|
4593
|
+
const result = await getTask(config, taskId);
|
|
4594
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
4595
|
+
console.log(JSON.stringify(result, null, 2));
|
|
4596
|
+
} else if (!isTTY()) {
|
|
4597
|
+
console.log(formatTaskDetailMarkdown(result));
|
|
4598
|
+
} else {
|
|
4599
|
+
console.log(formatTaskDetail(result));
|
|
4277
4600
|
}
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4601
|
+
})
|
|
4602
|
+
);
|
|
4603
|
+
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 or "me"').option("--parent <taskId>", "Set parent task (makes this a subtask)").option("--json", "Force JSON output even in terminal").action(
|
|
4604
|
+
wrapAction(async (taskId, opts) => {
|
|
4605
|
+
const config = loadConfig();
|
|
4606
|
+
if (opts.assignee === "me") {
|
|
4607
|
+
const client = new ClickUpClient(config);
|
|
4608
|
+
opts.assignee = String(await resolveAssigneeId(client, "me"));
|
|
4281
4609
|
}
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
);
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4610
|
+
const payload = buildUpdatePayload(opts);
|
|
4611
|
+
const result = await updateTask(config, taskId, payload);
|
|
4612
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
4613
|
+
console.log(JSON.stringify(result, null, 2));
|
|
4614
|
+
} else {
|
|
4615
|
+
console.log(formatUpdateConfirmation(result.id, result.name));
|
|
4616
|
+
}
|
|
4617
|
+
})
|
|
4618
|
+
);
|
|
4619
|
+
program.command("create").description("Create a new task").option("-l, --list <listId>", "Target list ID (auto-detected from --parent if omitted)").requiredOption("-n, --name <name>", "Task name").option("-d, --description <text>", "Task description (markdown supported)").option("-p, --parent <taskId>", "Parent task ID (list auto-detected from parent)").option("-s, --status <status>", "Initial status").option("--priority <level>", "Priority: urgent, high, normal, low (or 1-4)").option("--due-date <date>", "Due date (YYYY-MM-DD)").option("--assignee <userId>", 'Assignee user ID or "me"').option("--tags <tags>", "Comma-separated tag names").option("--custom-item-id <id>", "Custom task type ID (use to create initiatives)").option("--time-estimate <duration>", 'Time estimate (e.g. "2h", "30m", "1h30m")').option("--template <id>", "Create from a task template").option("--json", "Force JSON output even in terminal").action(
|
|
4620
|
+
wrapAction(async (opts) => {
|
|
4289
4621
|
const config = loadConfig();
|
|
4290
|
-
|
|
4622
|
+
if (opts.assignee === "me") {
|
|
4623
|
+
const client = new ClickUpClient(config);
|
|
4624
|
+
opts.assignee = String(await resolveAssigneeId(client, "me"));
|
|
4625
|
+
}
|
|
4626
|
+
const result = await createTask(config, opts);
|
|
4291
4627
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
4292
4628
|
console.log(JSON.stringify(result, null, 2));
|
|
4293
4629
|
} else {
|
|
4294
|
-
console.log(
|
|
4630
|
+
console.log(formatCreateConfirmation(result.id, result.name, result.url));
|
|
4295
4631
|
}
|
|
4296
|
-
}
|
|
4297
|
-
)
|
|
4298
|
-
)
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
);
|
|
4306
|
-
program.command("
|
|
4307
|
-
|
|
4308
|
-
|
|
4632
|
+
})
|
|
4633
|
+
);
|
|
4634
|
+
program.command("sprint").description("List my tasks in the current active sprint (auto-detected)").option("--status <status>", "Filter by status").option("--space <nameOrId>", "Narrow sprint search to a specific space (partial name or ID)").option("--folder <folderId>", "Sprint folder ID (overrides config and auto-detection)").option("--include-closed", "Include done/closed tasks").option("--json", "Force JSON output even in terminal").action(
|
|
4635
|
+
wrapAction(
|
|
4636
|
+
async (opts) => {
|
|
4637
|
+
const config = loadConfig();
|
|
4638
|
+
await runSprintCommand(config, opts);
|
|
4639
|
+
}
|
|
4640
|
+
)
|
|
4641
|
+
);
|
|
4642
|
+
program.command("sprints").description("List all sprints in sprint folders").option("--space <nameOrId>", "Filter by space (partial name or ID)").option("--json", "Force JSON output even in terminal").action(
|
|
4643
|
+
wrapAction(async (opts) => {
|
|
4644
|
+
const config = loadConfig();
|
|
4645
|
+
await listSprints(config, opts);
|
|
4646
|
+
})
|
|
4647
|
+
);
|
|
4648
|
+
program.command("subtasks <taskId>").description("List subtasks of a task or initiative").option("--status <status>", "Filter by status").option("--name <partial>", "Filter by name (case-insensitive contains)").option("--include-closed", "Include closed/done subtasks").option("--json", "Force JSON output even in terminal").action(
|
|
4649
|
+
wrapAction(
|
|
4650
|
+
async (taskId, opts) => {
|
|
4651
|
+
const config = loadConfig();
|
|
4652
|
+
let tasks = await fetchSubtasks(config, taskId, { includeClosed: opts.includeClosed });
|
|
4653
|
+
if (opts.status) {
|
|
4654
|
+
const lower = opts.status.toLowerCase();
|
|
4655
|
+
tasks = tasks.filter((t) => t.status.toLowerCase() === lower);
|
|
4656
|
+
}
|
|
4657
|
+
if (opts.name) {
|
|
4658
|
+
const query = opts.name.toLowerCase();
|
|
4659
|
+
tasks = tasks.filter((t) => t.name.toLowerCase().includes(query));
|
|
4660
|
+
}
|
|
4661
|
+
await printTasks(tasks, opts.json ?? false, config);
|
|
4662
|
+
}
|
|
4663
|
+
)
|
|
4664
|
+
);
|
|
4665
|
+
program.command("comment <taskId>").description("Post a comment on a task").requiredOption("-m, --message <text>", "Comment text").option("--notify-all", "Notify all assignees").option("--json", "Force JSON output even in terminal").action(
|
|
4666
|
+
wrapAction(
|
|
4667
|
+
async (taskId, opts) => {
|
|
4668
|
+
const config = loadConfig();
|
|
4669
|
+
const result = await postComment(config, taskId, opts.message, opts.notifyAll);
|
|
4670
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
4671
|
+
console.log(JSON.stringify(result, null, 2));
|
|
4672
|
+
} else {
|
|
4673
|
+
console.log(formatCommentConfirmation(result.id));
|
|
4674
|
+
}
|
|
4675
|
+
}
|
|
4676
|
+
)
|
|
4677
|
+
);
|
|
4678
|
+
program.command("comments <taskId>").description("List comments on a task").option("--json", "Force JSON output even in terminal").action(
|
|
4679
|
+
wrapAction(async (taskId, opts) => {
|
|
4680
|
+
const config = loadConfig();
|
|
4681
|
+
const comments = await fetchComments(config, taskId);
|
|
4682
|
+
printComments(comments, opts.json ?? false);
|
|
4683
|
+
})
|
|
4684
|
+
);
|
|
4685
|
+
program.command("comment-edit <commentId>").description("Edit an existing comment").requiredOption("-m, --message <text>", "New comment text").option("--resolved", "Mark comment as resolved").option("--unresolved", "Mark comment as unresolved").option("--json", "Force JSON output even in terminal").action(
|
|
4686
|
+
wrapAction(
|
|
4687
|
+
async (commentId, opts) => {
|
|
4688
|
+
const config = loadConfig();
|
|
4689
|
+
let resolved;
|
|
4690
|
+
if (opts.resolved) resolved = true;
|
|
4691
|
+
if (opts.unresolved) resolved = false;
|
|
4692
|
+
await editComment(config, commentId, opts.message, resolved);
|
|
4693
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
4694
|
+
console.log(JSON.stringify({ success: true, commentId }, null, 2));
|
|
4695
|
+
} else {
|
|
4696
|
+
console.log(`Comment ${commentId} updated`);
|
|
4697
|
+
}
|
|
4698
|
+
}
|
|
4699
|
+
)
|
|
4700
|
+
);
|
|
4701
|
+
program.command("comment-delete <commentId>").description("Delete a comment").option("--json", "Force JSON output even in terminal").action(
|
|
4702
|
+
wrapAction(async (commentId, opts) => {
|
|
4309
4703
|
const config = loadConfig();
|
|
4310
|
-
|
|
4311
|
-
if (opts.resolved) resolved = true;
|
|
4312
|
-
if (opts.unresolved) resolved = false;
|
|
4313
|
-
await editComment(config, commentId, opts.message, resolved);
|
|
4704
|
+
await deleteComment(config, commentId);
|
|
4314
4705
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
4315
4706
|
console.log(JSON.stringify({ success: true, commentId }, null, 2));
|
|
4316
4707
|
} else {
|
|
4317
|
-
console.log(`
|
|
4708
|
+
console.log(`Deleted comment ${commentId}`);
|
|
4318
4709
|
}
|
|
4319
|
-
}
|
|
4320
|
-
)
|
|
4321
|
-
)
|
|
4322
|
-
|
|
4323
|
-
wrapAction(async (commentId, opts) => {
|
|
4324
|
-
const config = loadConfig();
|
|
4325
|
-
await deleteComment(config, commentId);
|
|
4326
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4327
|
-
console.log(JSON.stringify({ success: true, commentId }, null, 2));
|
|
4328
|
-
} else {
|
|
4329
|
-
console.log(`Deleted comment ${commentId}`);
|
|
4330
|
-
}
|
|
4331
|
-
})
|
|
4332
|
-
);
|
|
4333
|
-
program.command("replies <commentId>").description("List threaded replies on a comment").option("--json", "Force JSON output even in terminal").action(
|
|
4334
|
-
wrapAction(async (commentId, opts) => {
|
|
4335
|
-
const config = loadConfig();
|
|
4336
|
-
const replies = await getReplies(config, commentId);
|
|
4337
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4338
|
-
console.log(JSON.stringify(replies, null, 2));
|
|
4339
|
-
} else if (isTTY()) {
|
|
4340
|
-
console.log(formatReplies(replies));
|
|
4341
|
-
} else {
|
|
4342
|
-
console.log(formatRepliesMarkdown(replies));
|
|
4343
|
-
}
|
|
4344
|
-
})
|
|
4345
|
-
);
|
|
4346
|
-
program.command("reply <commentId>").description("Reply to a comment").requiredOption("-m, --message <text>", "Reply text").option("--notify-all", "Notify all assignees").option("--json", "Force JSON output even in terminal").action(
|
|
4347
|
-
wrapAction(
|
|
4348
|
-
async (commentId, opts) => {
|
|
4710
|
+
})
|
|
4711
|
+
);
|
|
4712
|
+
program.command("replies <commentId>").description("List threaded replies on a comment").option("--json", "Force JSON output even in terminal").action(
|
|
4713
|
+
wrapAction(async (commentId, opts) => {
|
|
4349
4714
|
const config = loadConfig();
|
|
4350
|
-
await
|
|
4715
|
+
const replies = await getReplies(config, commentId);
|
|
4351
4716
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
4352
|
-
console.log(JSON.stringify(
|
|
4717
|
+
console.log(JSON.stringify(replies, null, 2));
|
|
4718
|
+
} else if (isTTY()) {
|
|
4719
|
+
console.log(formatReplies(replies));
|
|
4353
4720
|
} else {
|
|
4354
|
-
console.log(
|
|
4721
|
+
console.log(formatRepliesMarkdown(replies));
|
|
4355
4722
|
}
|
|
4356
|
-
}
|
|
4357
|
-
)
|
|
4358
|
-
)
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
)
|
|
4373
|
-
program.command("spaces").description("List spaces in your workspace").option("--name <partial>", "Filter spaces by name (case-insensitive contains)").option("--my", "Show only spaces where I have assigned tasks").option("--json", "Force JSON output even in terminal").action(
|
|
4374
|
-
wrapAction(async (opts) => {
|
|
4375
|
-
const config = loadConfig();
|
|
4376
|
-
await listSpaces(config, opts);
|
|
4377
|
-
})
|
|
4378
|
-
);
|
|
4379
|
-
program.command("inbox").description("Recently updated tasks grouped by time period").option("--include-closed", "Include done/closed tasks").option("--json", "Force JSON output even in terminal").option("--days <n>", "Lookback period in days", "30").action(
|
|
4380
|
-
wrapAction(async (opts) => {
|
|
4381
|
-
const config = loadConfig();
|
|
4382
|
-
const days = Number(opts.days ?? 30);
|
|
4383
|
-
if (!Number.isFinite(days) || days <= 0) {
|
|
4384
|
-
throw new Error("--days must be a positive number");
|
|
4385
|
-
}
|
|
4386
|
-
const tasks = await fetchInbox(config, days, { includeClosed: opts.includeClosed });
|
|
4387
|
-
await printInbox(tasks, opts.json ?? false, config);
|
|
4388
|
-
})
|
|
4389
|
-
);
|
|
4390
|
-
program.command("assigned").description("Show all tasks assigned to me, grouped by status").option("--status <status>", "Show only tasks with this status").option("--include-closed", "Include done/closed tasks").option("--json", "Force JSON output even in terminal").action(
|
|
4391
|
-
wrapAction(async (opts) => {
|
|
4392
|
-
const config = loadConfig();
|
|
4393
|
-
await runAssignedCommand(config, opts);
|
|
4394
|
-
})
|
|
4395
|
-
);
|
|
4396
|
-
program.command("open <query>").description("Open a task in the browser by ID or name").option("--json", "Output task JSON instead of opening").action(
|
|
4397
|
-
wrapAction(async (query, opts) => {
|
|
4398
|
-
const config = loadConfig();
|
|
4399
|
-
await openTask(config, query, opts);
|
|
4400
|
-
})
|
|
4401
|
-
);
|
|
4402
|
-
program.command("search <query>").description("Search my tasks by name").option("--status <status>", "Filter by status").option("--include-closed", "Include done/closed tasks in search").option("--json", "Force JSON output even in terminal").action(
|
|
4403
|
-
wrapAction(
|
|
4404
|
-
async (query, opts) => {
|
|
4723
|
+
})
|
|
4724
|
+
);
|
|
4725
|
+
program.command("reply <commentId>").description("Reply to a comment").requiredOption("-m, --message <text>", "Reply text").option("--notify-all", "Notify all assignees").option("--json", "Force JSON output even in terminal").action(
|
|
4726
|
+
wrapAction(
|
|
4727
|
+
async (commentId, opts) => {
|
|
4728
|
+
const config = loadConfig();
|
|
4729
|
+
await createReply(config, commentId, opts.message, opts.notifyAll);
|
|
4730
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
4731
|
+
console.log(JSON.stringify({ success: true, commentId }, null, 2));
|
|
4732
|
+
} else {
|
|
4733
|
+
console.log(`Replied to comment ${commentId}`);
|
|
4734
|
+
}
|
|
4735
|
+
}
|
|
4736
|
+
)
|
|
4737
|
+
);
|
|
4738
|
+
program.command("activity <taskId>").description("Show task details and comments combined").option("--json", "Force JSON output even in terminal").action(
|
|
4739
|
+
wrapAction(async (taskId, opts) => {
|
|
4405
4740
|
const config = loadConfig();
|
|
4406
|
-
const
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4741
|
+
const result = await fetchActivity(config, taskId);
|
|
4742
|
+
printActivity(result, opts.json ?? false);
|
|
4743
|
+
})
|
|
4744
|
+
);
|
|
4745
|
+
program.command("lists <spaceId>").description("List all lists in a space (including lists inside folders)").option("--name <partial>", "Filter by name (case-insensitive contains)").option("--json", "Force JSON output even in terminal").action(
|
|
4746
|
+
wrapAction(async (spaceId, opts) => {
|
|
4747
|
+
const config = loadConfig();
|
|
4748
|
+
const lists = await fetchLists(config, spaceId, { name: opts.name });
|
|
4749
|
+
printLists(lists, opts.json ?? false);
|
|
4750
|
+
})
|
|
4751
|
+
);
|
|
4752
|
+
program.command("spaces").description("List spaces in your workspace").option("--name <partial>", "Filter spaces by name (case-insensitive contains)").option("--my", "Show only spaces where I have assigned tasks").option("--json", "Force JSON output even in terminal").action(
|
|
4753
|
+
wrapAction(async (opts) => {
|
|
4754
|
+
const config = loadConfig();
|
|
4755
|
+
await listSpaces(config, opts);
|
|
4756
|
+
})
|
|
4757
|
+
);
|
|
4758
|
+
program.command("inbox").description("Recently updated tasks grouped by time period").option("--include-closed", "Include done/closed tasks").option("--json", "Force JSON output even in terminal").option("--days <n>", "Lookback period in days", "30").action(
|
|
4759
|
+
wrapAction(async (opts) => {
|
|
4760
|
+
const config = loadConfig();
|
|
4761
|
+
const days = Number(opts.days ?? 30);
|
|
4762
|
+
if (!Number.isFinite(days) || days <= 0) {
|
|
4763
|
+
throw new Error("--days must be a positive number");
|
|
4764
|
+
}
|
|
4765
|
+
const tasks = await fetchInbox(config, days, { includeClosed: opts.includeClosed });
|
|
4766
|
+
await printInbox(tasks, opts.json ?? false, config);
|
|
4767
|
+
})
|
|
4768
|
+
);
|
|
4769
|
+
program.command("assigned").description("Show all tasks assigned to me, grouped by status").option("--status <status>", "Show only tasks with this status").option("--include-closed", "Include done/closed tasks").option("--json", "Force JSON output even in terminal").action(
|
|
4770
|
+
wrapAction(async (opts) => {
|
|
4771
|
+
const config = loadConfig();
|
|
4772
|
+
await runAssignedCommand(config, opts);
|
|
4773
|
+
})
|
|
4774
|
+
);
|
|
4775
|
+
program.command("open <query>").description("Open a task in the browser by ID or name").option("--json", "Output task JSON instead of opening").action(
|
|
4776
|
+
wrapAction(async (query, opts) => {
|
|
4777
|
+
const config = loadConfig();
|
|
4778
|
+
await openTask(config, query, opts);
|
|
4779
|
+
})
|
|
4780
|
+
);
|
|
4781
|
+
program.command("search <query>").description("Search my tasks by name").option("--status <status>", "Filter by status").option("--include-closed", "Include done/closed tasks in search").option("--json", "Force JSON output even in terminal").action(
|
|
4782
|
+
wrapAction(
|
|
4783
|
+
async (query, opts) => {
|
|
4784
|
+
const config = loadConfig();
|
|
4785
|
+
const tasks = await searchTasks(config, query, {
|
|
4786
|
+
status: opts.status,
|
|
4787
|
+
includeClosed: opts.includeClosed
|
|
4788
|
+
});
|
|
4789
|
+
await printTasks(tasks, opts.json ?? false, config);
|
|
4790
|
+
}
|
|
4791
|
+
)
|
|
4792
|
+
);
|
|
4793
|
+
program.command("summary").description("Daily standup summary: completed, in-progress, overdue").option("--hours <n>", "Completed-tasks lookback in hours", "24").option("--json", "Force JSON output even in terminal").action(
|
|
4794
|
+
wrapAction(async (opts) => {
|
|
4795
|
+
const config = loadConfig();
|
|
4796
|
+
const hours = Number(opts.hours ?? 24);
|
|
4797
|
+
if (!Number.isFinite(hours) || hours <= 0) {
|
|
4798
|
+
throw new Error("--hours must be a positive number");
|
|
4799
|
+
}
|
|
4800
|
+
await runSummaryCommand(config, { hours, json: opts.json ?? false });
|
|
4801
|
+
})
|
|
4802
|
+
);
|
|
4803
|
+
program.command("overdue").description("List tasks that are past their due date").option("--include-closed", "Include done/closed overdue tasks").option("--json", "Force JSON output even in terminal").action(
|
|
4804
|
+
wrapAction(async (opts) => {
|
|
4805
|
+
const config = loadConfig();
|
|
4806
|
+
const tasks = await fetchOverdueTasks(config, { includeClosed: opts.includeClosed });
|
|
4410
4807
|
await printTasks(tasks, opts.json ?? false, config);
|
|
4411
|
-
}
|
|
4412
|
-
)
|
|
4413
|
-
)
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
);
|
|
4424
|
-
program.command("
|
|
4425
|
-
|
|
4426
|
-
const config = loadConfig();
|
|
4427
|
-
const tasks = await fetchOverdueTasks(config, { includeClosed: opts.includeClosed });
|
|
4428
|
-
await printTasks(tasks, opts.json ?? false, config);
|
|
4429
|
-
})
|
|
4430
|
-
);
|
|
4431
|
-
program.command("assign <taskId>").description("Assign or unassign users from a task").option("--to <userId>", 'Add assignee (user ID or "me")').option("--remove <userId>", 'Remove assignee (user ID or "me")').option("--json", "Force JSON output even in terminal").action(
|
|
4432
|
-
wrapAction(async (taskId, opts) => {
|
|
4433
|
-
const config = loadConfig();
|
|
4434
|
-
const result = await assignTask(config, taskId, opts);
|
|
4435
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4436
|
-
console.log(JSON.stringify(result, null, 2));
|
|
4437
|
-
} else {
|
|
4438
|
-
console.log(formatAssignConfirmation(taskId, { to: opts.to, remove: opts.remove }));
|
|
4439
|
-
}
|
|
4440
|
-
})
|
|
4441
|
-
);
|
|
4442
|
-
program.command("depend <taskId>").description("Add or remove task dependencies").option("--on <taskId>", "Task that this task depends on (waiting on)").option("--blocks <taskId>", "Task that this task blocks").option("--remove", "Remove the dependency instead of adding it").option("--json", "Force JSON output even in terminal").action(
|
|
4443
|
-
wrapAction(async (taskId, opts) => {
|
|
4444
|
-
const config = loadConfig();
|
|
4445
|
-
const message = await manageDependency(config, taskId, opts);
|
|
4446
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4447
|
-
console.log(
|
|
4448
|
-
JSON.stringify(
|
|
4449
|
-
{ taskId, on: opts.on, blocks: opts.blocks, remove: opts.remove, message },
|
|
4450
|
-
null,
|
|
4451
|
-
2
|
|
4452
|
-
)
|
|
4453
|
-
);
|
|
4454
|
-
} else {
|
|
4455
|
-
console.log(message);
|
|
4456
|
-
}
|
|
4457
|
-
})
|
|
4458
|
-
);
|
|
4459
|
-
program.command("link <taskId> <linksTo>").description("Add or remove a link between two tasks").option("--remove", "Remove the link instead of adding it").option("--json", "Force JSON output even in terminal").action(
|
|
4460
|
-
wrapAction(
|
|
4461
|
-
async (taskId, linksTo, opts) => {
|
|
4808
|
+
})
|
|
4809
|
+
);
|
|
4810
|
+
program.command("assign <taskId>").description("Assign or unassign users from a task").option("--to <userId>", 'Add assignee (user ID or "me")').option("--remove <userId>", 'Remove assignee (user ID or "me")').option("--json", "Force JSON output even in terminal").action(
|
|
4811
|
+
wrapAction(async (taskId, opts) => {
|
|
4812
|
+
const config = loadConfig();
|
|
4813
|
+
const result = await assignTask(config, taskId, opts);
|
|
4814
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
4815
|
+
console.log(JSON.stringify(result, null, 2));
|
|
4816
|
+
} else {
|
|
4817
|
+
console.log(formatAssignConfirmation(taskId, { to: opts.to, remove: opts.remove }));
|
|
4818
|
+
}
|
|
4819
|
+
})
|
|
4820
|
+
);
|
|
4821
|
+
program.command("depend <taskId>").description("Add or remove task dependencies").option("--on <taskId>", "Task that this task depends on (waiting on)").option("--blocks <taskId>", "Task that this task blocks").option("--remove", "Remove the dependency instead of adding it").option("--json", "Force JSON output even in terminal").action(
|
|
4822
|
+
wrapAction(async (taskId, opts) => {
|
|
4462
4823
|
const config = loadConfig();
|
|
4463
|
-
const
|
|
4824
|
+
const message = await manageDependency(config, taskId, opts);
|
|
4464
4825
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
4465
4826
|
console.log(
|
|
4466
4827
|
JSON.stringify(
|
|
4467
|
-
{
|
|
4828
|
+
{ taskId, on: opts.on, blocks: opts.blocks, remove: opts.remove, message },
|
|
4468
4829
|
null,
|
|
4469
4830
|
2
|
|
4470
4831
|
)
|
|
4471
4832
|
);
|
|
4472
4833
|
} else {
|
|
4473
|
-
console.log(
|
|
4834
|
+
console.log(message);
|
|
4474
4835
|
}
|
|
4475
|
-
}
|
|
4476
|
-
)
|
|
4477
|
-
)
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
);
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
const config = loadConfig();
|
|
4493
|
-
const message = await moveTask(config, taskId, opts);
|
|
4494
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4495
|
-
console.log(JSON.stringify({ taskId, to: opts.to, remove: opts.remove, message }, null, 2));
|
|
4496
|
-
} else {
|
|
4497
|
-
console.log(message);
|
|
4498
|
-
}
|
|
4499
|
-
})
|
|
4500
|
-
);
|
|
4501
|
-
program.command("field <taskId>").description("Set or remove a custom field value on a task").option("--set <nameAndValue...>", 'Set field: --set "Field Name" value').option("--remove <fieldName>", "Remove field value by name").option("--json", "Force JSON output even in terminal").action(
|
|
4502
|
-
wrapAction(
|
|
4503
|
-
async (taskId, opts) => {
|
|
4504
|
-
const config = loadConfig();
|
|
4505
|
-
const fieldOpts = {};
|
|
4506
|
-
if (opts.set) {
|
|
4507
|
-
if (opts.set.length !== 2) {
|
|
4508
|
-
throw new Error("--set requires exactly two arguments: field name and value");
|
|
4836
|
+
})
|
|
4837
|
+
);
|
|
4838
|
+
program.command("link <taskId> <linksTo>").description("Add or remove a link between two tasks").option("--remove", "Remove the link instead of adding it").option("--json", "Force JSON output even in terminal").action(
|
|
4839
|
+
wrapAction(
|
|
4840
|
+
async (taskId, linksTo, opts) => {
|
|
4841
|
+
const config = loadConfig();
|
|
4842
|
+
const result = await manageTaskLink(config, taskId, linksTo, opts.remove ?? false);
|
|
4843
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
4844
|
+
console.log(
|
|
4845
|
+
JSON.stringify(
|
|
4846
|
+
{ success: true, taskId, linksTo, action: opts.remove ? "removed" : "added" },
|
|
4847
|
+
null,
|
|
4848
|
+
2
|
|
4849
|
+
)
|
|
4850
|
+
);
|
|
4851
|
+
} else {
|
|
4852
|
+
console.log(result);
|
|
4509
4853
|
}
|
|
4510
|
-
fieldOpts.set = [opts.set[0], opts.set[1]];
|
|
4511
4854
|
}
|
|
4512
|
-
|
|
4513
|
-
|
|
4855
|
+
)
|
|
4856
|
+
);
|
|
4857
|
+
program.command("attach <taskId> <filePath>").description("Upload a file attachment to a task").option("--json", "Force JSON output even in terminal").action(
|
|
4858
|
+
wrapAction(async (taskId, filePath, opts) => {
|
|
4859
|
+
const config = loadConfig();
|
|
4860
|
+
const result = await attachFile(config, taskId, filePath);
|
|
4861
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
4862
|
+
console.log(JSON.stringify(result, null, 2));
|
|
4863
|
+
} else {
|
|
4864
|
+
console.log(`Uploaded "${result.title}" to task ${taskId}`);
|
|
4865
|
+
console.log(` ${result.url}`);
|
|
4514
4866
|
}
|
|
4515
|
-
|
|
4867
|
+
})
|
|
4868
|
+
);
|
|
4869
|
+
program.command("move <taskId>").description("Add or remove a task from a list").option("--to <listId>", "Add task to this list").option("--remove <listId>", "Remove task from this list").option("--json", "Force JSON output even in terminal").action(
|
|
4870
|
+
wrapAction(async (taskId, opts) => {
|
|
4871
|
+
const config = loadConfig();
|
|
4872
|
+
const message = await moveTask(config, taskId, opts);
|
|
4516
4873
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
4517
|
-
console.log(
|
|
4874
|
+
console.log(
|
|
4875
|
+
JSON.stringify({ taskId, to: opts.to, remove: opts.remove, message }, null, 2)
|
|
4876
|
+
);
|
|
4518
4877
|
} else {
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4878
|
+
console.log(message);
|
|
4879
|
+
}
|
|
4880
|
+
})
|
|
4881
|
+
);
|
|
4882
|
+
program.command("field <taskId>").description("Set or remove a custom field value on a task").option("--set <nameAndValue...>", 'Set field: --set "Field Name" value').option("--remove <fieldName>", "Remove field value by name").option("--json", "Force JSON output even in terminal").action(
|
|
4883
|
+
wrapAction(
|
|
4884
|
+
async (taskId, opts) => {
|
|
4885
|
+
const config = loadConfig();
|
|
4886
|
+
const fieldOpts = {};
|
|
4887
|
+
if (opts.set) {
|
|
4888
|
+
if (opts.set.length !== 2) {
|
|
4889
|
+
throw new Error("--set requires exactly two arguments: field name and value");
|
|
4890
|
+
}
|
|
4891
|
+
fieldOpts.set = [opts.set[0], opts.set[1]];
|
|
4892
|
+
}
|
|
4893
|
+
if (opts.remove) {
|
|
4894
|
+
fieldOpts.remove = opts.remove;
|
|
4895
|
+
}
|
|
4896
|
+
const { results } = await setCustomField(config, taskId, fieldOpts);
|
|
4897
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
4898
|
+
console.log(JSON.stringify(results, null, 2));
|
|
4899
|
+
} else {
|
|
4900
|
+
for (const r of results) {
|
|
4901
|
+
if (r.action === "set") {
|
|
4902
|
+
console.log(`Set "${r.field}" to ${JSON.stringify(r.value)} on ${r.taskId}`);
|
|
4903
|
+
} else {
|
|
4904
|
+
console.log(`Removed "${r.field}" from ${r.taskId}`);
|
|
4905
|
+
}
|
|
4524
4906
|
}
|
|
4525
4907
|
}
|
|
4526
4908
|
}
|
|
4527
|
-
|
|
4528
|
-
)
|
|
4529
|
-
)
|
|
4530
|
-
|
|
4531
|
-
wrapAction(async (taskId, opts) => {
|
|
4532
|
-
const config = loadConfig();
|
|
4533
|
-
const result = await deleteTaskCommand(config, taskId, opts);
|
|
4534
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4535
|
-
console.log(JSON.stringify(result, null, 2));
|
|
4536
|
-
} else {
|
|
4537
|
-
console.log(`Deleted task ${result.taskId}`);
|
|
4538
|
-
}
|
|
4539
|
-
})
|
|
4540
|
-
);
|
|
4541
|
-
program.command("tag <taskId>").description("Add or remove tags from a task").option("--add <tags>", "Comma-separated tag names to add").option("--remove <tags>", "Comma-separated tag names to remove").option("--json", "Force JSON output even in terminal").action(
|
|
4542
|
-
wrapAction(async (taskId, opts) => {
|
|
4543
|
-
const config = loadConfig();
|
|
4544
|
-
const result = await manageTags(config, taskId, opts);
|
|
4545
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4546
|
-
console.log(JSON.stringify(result, null, 2));
|
|
4547
|
-
} else {
|
|
4548
|
-
const parts = [];
|
|
4549
|
-
if (result.added.length > 0) parts.push(`Added tags: ${result.added.join(", ")}`);
|
|
4550
|
-
if (result.removed.length > 0) parts.push(`Removed tags: ${result.removed.join(", ")}`);
|
|
4551
|
-
console.log(parts.join("; "));
|
|
4552
|
-
}
|
|
4553
|
-
})
|
|
4554
|
-
);
|
|
4555
|
-
var checklistCmd = program.command("checklist").description("Manage checklists on a task");
|
|
4556
|
-
checklistCmd.command("view <taskId>").description("View checklists on a task").option("--json", "Force JSON output even in terminal").action(
|
|
4557
|
-
wrapAction(async (taskId, opts) => {
|
|
4558
|
-
const config = loadConfig();
|
|
4559
|
-
const checklists = await viewChecklists(config, taskId);
|
|
4560
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4561
|
-
console.log(JSON.stringify(checklists, null, 2));
|
|
4562
|
-
} else if (isTTY()) {
|
|
4563
|
-
console.log(formatChecklists(checklists));
|
|
4564
|
-
} else {
|
|
4565
|
-
console.log(formatChecklistsMarkdown(checklists));
|
|
4566
|
-
}
|
|
4567
|
-
})
|
|
4568
|
-
);
|
|
4569
|
-
checklistCmd.command("create <taskId> <name>").description("Create a checklist on a task").option("--json", "Force JSON output even in terminal").action(
|
|
4570
|
-
wrapAction(async (taskId, name, opts) => {
|
|
4571
|
-
const config = loadConfig();
|
|
4572
|
-
const result = await createChecklist(config, taskId, name);
|
|
4573
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4574
|
-
console.log(JSON.stringify(result, null, 2));
|
|
4575
|
-
} else {
|
|
4576
|
-
console.log(`Created checklist "${result.name}" (id: ${result.id})`);
|
|
4577
|
-
}
|
|
4578
|
-
})
|
|
4579
|
-
);
|
|
4580
|
-
checklistCmd.command("delete <checklistId>").description("Delete a checklist").option("--json", "Force JSON output even in terminal").action(
|
|
4581
|
-
wrapAction(async (checklistId, opts) => {
|
|
4582
|
-
const config = loadConfig();
|
|
4583
|
-
const result = await deleteChecklist(config, checklistId);
|
|
4584
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4585
|
-
console.log(JSON.stringify(result, null, 2));
|
|
4586
|
-
} else {
|
|
4587
|
-
console.log(`Deleted checklist ${result.checklistId}`);
|
|
4588
|
-
}
|
|
4589
|
-
})
|
|
4590
|
-
);
|
|
4591
|
-
checklistCmd.command("add-item <checklistId> <name>").description("Add an item to a checklist").option("--json", "Force JSON output even in terminal").action(
|
|
4592
|
-
wrapAction(async (checklistId, name, opts) => {
|
|
4593
|
-
const config = loadConfig();
|
|
4594
|
-
const result = await addChecklistItem(config, checklistId, name);
|
|
4595
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4596
|
-
console.log(JSON.stringify(result, null, 2));
|
|
4597
|
-
} else {
|
|
4598
|
-
console.log(`Added item "${name}" to checklist ${checklistId}`);
|
|
4599
|
-
}
|
|
4600
|
-
})
|
|
4601
|
-
);
|
|
4602
|
-
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(
|
|
4603
|
-
wrapAction(
|
|
4604
|
-
async (checklistId, checklistItemId, opts) => {
|
|
4909
|
+
)
|
|
4910
|
+
);
|
|
4911
|
+
program.command("delete <taskId>").description("Delete a task (requires confirmation)").option("--confirm", "Skip confirmation prompt (required in non-interactive mode)").option("--json", "Force JSON output even in terminal").action(
|
|
4912
|
+
wrapAction(async (taskId, opts) => {
|
|
4605
4913
|
const config = loadConfig();
|
|
4606
|
-
const
|
|
4607
|
-
if (opts.
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4914
|
+
const result = await deleteTaskCommand(config, taskId, opts);
|
|
4915
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
4916
|
+
console.log(JSON.stringify(result, null, 2));
|
|
4917
|
+
} else {
|
|
4918
|
+
console.log(`Deleted task ${result.taskId}`);
|
|
4919
|
+
}
|
|
4920
|
+
})
|
|
4921
|
+
);
|
|
4922
|
+
program.command("tag <taskId>").description("Add or remove tags from a task").option("--add <tags>", "Comma-separated tag names to add").option("--remove <tags>", "Comma-separated tag names to remove").option("--json", "Force JSON output even in terminal").action(
|
|
4923
|
+
wrapAction(
|
|
4924
|
+
async (taskId, opts) => {
|
|
4925
|
+
const config = loadConfig();
|
|
4926
|
+
const result = await manageTags(config, taskId, opts);
|
|
4927
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
4928
|
+
console.log(JSON.stringify(result, null, 2));
|
|
4929
|
+
} else {
|
|
4930
|
+
const parts = [];
|
|
4931
|
+
if (result.added.length > 0) parts.push(`Added tags: ${result.added.join(", ")}`);
|
|
4932
|
+
if (result.removed.length > 0) parts.push(`Removed tags: ${result.removed.join(", ")}`);
|
|
4933
|
+
console.log(parts.join("; "));
|
|
4934
|
+
}
|
|
4612
4935
|
}
|
|
4613
|
-
|
|
4936
|
+
)
|
|
4937
|
+
);
|
|
4938
|
+
const checklistCmd = program.command("checklist").description("Manage checklists on a task");
|
|
4939
|
+
checklistCmd.command("view <taskId>").description("View checklists on a task").option("--json", "Force JSON output even in terminal").action(
|
|
4940
|
+
wrapAction(async (taskId, opts) => {
|
|
4941
|
+
const config = loadConfig();
|
|
4942
|
+
const checklists = await viewChecklists(config, taskId);
|
|
4943
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
4944
|
+
console.log(JSON.stringify(checklists, null, 2));
|
|
4945
|
+
} else if (isTTY()) {
|
|
4946
|
+
console.log(formatChecklists(checklists));
|
|
4947
|
+
} else {
|
|
4948
|
+
console.log(formatChecklistsMarkdown(checklists));
|
|
4949
|
+
}
|
|
4950
|
+
})
|
|
4951
|
+
);
|
|
4952
|
+
checklistCmd.command("create <taskId> <name>").description("Create a checklist on a task").option("--json", "Force JSON output even in terminal").action(
|
|
4953
|
+
wrapAction(async (taskId, name, opts) => {
|
|
4954
|
+
const config = loadConfig();
|
|
4955
|
+
const result = await createChecklist(config, taskId, name);
|
|
4614
4956
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
4615
4957
|
console.log(JSON.stringify(result, null, 2));
|
|
4616
4958
|
} else {
|
|
4617
|
-
console.log(`
|
|
4959
|
+
console.log(`Created checklist "${result.name}" (id: ${result.id})`);
|
|
4618
4960
|
}
|
|
4619
|
-
}
|
|
4620
|
-
)
|
|
4621
|
-
)
|
|
4622
|
-
|
|
4623
|
-
wrapAction(async (checklistId, checklistItemId, opts) => {
|
|
4624
|
-
const config = loadConfig();
|
|
4625
|
-
const result = await deleteChecklistItem(config, checklistId, checklistItemId);
|
|
4626
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4627
|
-
console.log(JSON.stringify(result, null, 2));
|
|
4628
|
-
} else {
|
|
4629
|
-
console.log(`Deleted checklist item ${result.checklistItemId}`);
|
|
4630
|
-
}
|
|
4631
|
-
})
|
|
4632
|
-
);
|
|
4633
|
-
var timeCmd = program.command("time").description("Track time on tasks");
|
|
4634
|
-
timeCmd.command("start <taskId>").description("Start tracking time on a task").option("-d, --description <text>", "Description for the time entry").option("--json", "Force JSON output even in terminal").action(
|
|
4635
|
-
wrapAction(async (taskId, opts) => {
|
|
4636
|
-
const config = loadConfig();
|
|
4637
|
-
const result = await startTimer(config, taskId, opts.description);
|
|
4638
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4639
|
-
console.log(JSON.stringify(result, null, 2));
|
|
4640
|
-
} else {
|
|
4641
|
-
const taskName = result.task?.name ?? taskId;
|
|
4642
|
-
console.log(`Started timer on "${taskName}"`);
|
|
4643
|
-
}
|
|
4644
|
-
})
|
|
4645
|
-
);
|
|
4646
|
-
timeCmd.command("stop").description("Stop the running timer").option("--json", "Force JSON output even in terminal").action(
|
|
4647
|
-
wrapAction(async (opts) => {
|
|
4648
|
-
const config = loadConfig();
|
|
4649
|
-
const result = await stopTimer(config);
|
|
4650
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4651
|
-
console.log(JSON.stringify(result, null, 2));
|
|
4652
|
-
} else if (isTTY()) {
|
|
4653
|
-
console.log(formatTimeEntry(result));
|
|
4654
|
-
} else {
|
|
4655
|
-
console.log(formatTimeEntryMarkdown(result));
|
|
4656
|
-
}
|
|
4657
|
-
})
|
|
4658
|
-
);
|
|
4659
|
-
timeCmd.command("status").description("Show the currently running timer").option("--json", "Force JSON output even in terminal").action(
|
|
4660
|
-
wrapAction(async (opts) => {
|
|
4661
|
-
const config = loadConfig();
|
|
4662
|
-
const result = await timerStatus(config);
|
|
4663
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4664
|
-
console.log(JSON.stringify(result, null, 2));
|
|
4665
|
-
} else if (!result) {
|
|
4666
|
-
console.log("No timer running");
|
|
4667
|
-
} else if (isTTY()) {
|
|
4668
|
-
console.log(formatTimeEntry(result));
|
|
4669
|
-
} else {
|
|
4670
|
-
console.log(formatTimeEntryMarkdown(result));
|
|
4671
|
-
}
|
|
4672
|
-
})
|
|
4673
|
-
);
|
|
4674
|
-
timeCmd.command("log <taskId> <duration>").description('Log a manual time entry (e.g. "2h", "30m", "1h30m")').option("-d, --description <text>", "Description for the time entry").option("--json", "Force JSON output even in terminal").action(
|
|
4675
|
-
wrapAction(
|
|
4676
|
-
async (taskId, duration, opts) => {
|
|
4961
|
+
})
|
|
4962
|
+
);
|
|
4963
|
+
checklistCmd.command("delete <checklistId>").description("Delete a checklist").option("--json", "Force JSON output even in terminal").action(
|
|
4964
|
+
wrapAction(async (checklistId, opts) => {
|
|
4677
4965
|
const config = loadConfig();
|
|
4678
|
-
const result = await
|
|
4966
|
+
const result = await deleteChecklist(config, checklistId);
|
|
4679
4967
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
4680
4968
|
console.log(JSON.stringify(result, null, 2));
|
|
4681
4969
|
} else {
|
|
4682
|
-
console.log(`
|
|
4970
|
+
console.log(`Deleted checklist ${result.checklistId}`);
|
|
4683
4971
|
}
|
|
4684
|
-
}
|
|
4685
|
-
)
|
|
4686
|
-
)
|
|
4687
|
-
|
|
4688
|
-
wrapAction(async (opts) => {
|
|
4689
|
-
const config = loadConfig();
|
|
4690
|
-
const days = opts.days ? Number(opts.days) : 7;
|
|
4691
|
-
if (!Number.isFinite(days) || days <= 0) {
|
|
4692
|
-
throw new Error("--days must be a positive number");
|
|
4693
|
-
}
|
|
4694
|
-
const entries = await listTimeEntries(config, { days, taskId: opts.task });
|
|
4695
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4696
|
-
console.log(JSON.stringify(entries, null, 2));
|
|
4697
|
-
} else if (isTTY()) {
|
|
4698
|
-
console.log(formatTimeEntries(entries));
|
|
4699
|
-
} else {
|
|
4700
|
-
console.log(formatTimeEntriesMarkdown(entries));
|
|
4701
|
-
}
|
|
4702
|
-
})
|
|
4703
|
-
);
|
|
4704
|
-
timeCmd.command("update <timeEntryId>").description("Update a time entry").option("-d, --description <text>", "New description").option("--duration <duration>", 'New duration (e.g. "2h", "30m")').option("--json", "Force JSON output even in terminal").action(
|
|
4705
|
-
wrapAction(
|
|
4706
|
-
async (timeEntryId, opts) => {
|
|
4972
|
+
})
|
|
4973
|
+
);
|
|
4974
|
+
checklistCmd.command("add-item <checklistId> <name>").description("Add an item to a checklist").option("--json", "Force JSON output even in terminal").action(
|
|
4975
|
+
wrapAction(async (checklistId, name, opts) => {
|
|
4707
4976
|
const config = loadConfig();
|
|
4708
|
-
const
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
}
|
|
4977
|
+
const result = await addChecklistItem(config, checklistId, name);
|
|
4978
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
4979
|
+
console.log(JSON.stringify(result, null, 2));
|
|
4980
|
+
} else {
|
|
4981
|
+
console.log(`Added item "${name}" to checklist ${checklistId}`);
|
|
4982
|
+
}
|
|
4983
|
+
})
|
|
4984
|
+
);
|
|
4985
|
+
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(
|
|
4986
|
+
wrapAction(
|
|
4987
|
+
async (checklistId, checklistItemId, opts) => {
|
|
4988
|
+
const config = loadConfig();
|
|
4989
|
+
const updates = {};
|
|
4990
|
+
if (opts.name) updates.name = opts.name;
|
|
4991
|
+
if (opts.resolved) updates.resolved = true;
|
|
4992
|
+
if (opts.unresolved) updates.resolved = false;
|
|
4993
|
+
if (opts.assignee !== void 0) {
|
|
4994
|
+
updates.assignee = opts.assignee === "null" ? null : parseOptionalNumberOption(opts.assignee, "--assignee");
|
|
4995
|
+
}
|
|
4996
|
+
const result = await editChecklistItem(config, checklistId, checklistItemId, updates);
|
|
4997
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
4998
|
+
console.log(JSON.stringify(result, null, 2));
|
|
4999
|
+
} else {
|
|
5000
|
+
console.log(`Updated checklist item ${checklistItemId}`);
|
|
5001
|
+
}
|
|
5002
|
+
}
|
|
5003
|
+
)
|
|
5004
|
+
);
|
|
5005
|
+
checklistCmd.command("delete-item <checklistId> <checklistItemId>").description("Delete a checklist item").option("--json", "Force JSON output even in terminal").action(
|
|
5006
|
+
wrapAction(async (checklistId, checklistItemId, opts) => {
|
|
5007
|
+
const config = loadConfig();
|
|
5008
|
+
const result = await deleteChecklistItem(config, checklistId, checklistItemId);
|
|
4712
5009
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
4713
|
-
console.log(JSON.stringify(
|
|
5010
|
+
console.log(JSON.stringify(result, null, 2));
|
|
5011
|
+
} else {
|
|
5012
|
+
console.log(`Deleted checklist item ${result.checklistItemId}`);
|
|
5013
|
+
}
|
|
5014
|
+
})
|
|
5015
|
+
);
|
|
5016
|
+
const timeCmd = program.command("time").description("Track time on tasks");
|
|
5017
|
+
timeCmd.command("start <taskId>").description("Start tracking time on a task").option("-d, --description <text>", "Description for the time entry").option("--json", "Force JSON output even in terminal").action(
|
|
5018
|
+
wrapAction(async (taskId, opts) => {
|
|
5019
|
+
const config = loadConfig();
|
|
5020
|
+
const result = await startTimer(config, taskId, opts.description);
|
|
5021
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5022
|
+
console.log(JSON.stringify(result, null, 2));
|
|
5023
|
+
} else {
|
|
5024
|
+
const taskName = result.task?.name ?? taskId;
|
|
5025
|
+
console.log(`Started timer on "${taskName}"`);
|
|
5026
|
+
}
|
|
5027
|
+
})
|
|
5028
|
+
);
|
|
5029
|
+
timeCmd.command("stop").description("Stop the running timer").option("--json", "Force JSON output even in terminal").action(
|
|
5030
|
+
wrapAction(async (opts) => {
|
|
5031
|
+
const config = loadConfig();
|
|
5032
|
+
const result = await stopTimer(config);
|
|
5033
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5034
|
+
console.log(JSON.stringify(result, null, 2));
|
|
4714
5035
|
} else if (isTTY()) {
|
|
4715
|
-
console.log(formatTimeEntry(
|
|
5036
|
+
console.log(formatTimeEntry(result));
|
|
4716
5037
|
} else {
|
|
4717
|
-
console.log(formatTimeEntryMarkdown(
|
|
5038
|
+
console.log(formatTimeEntryMarkdown(result));
|
|
4718
5039
|
}
|
|
4719
|
-
}
|
|
4720
|
-
)
|
|
4721
|
-
)
|
|
4722
|
-
|
|
4723
|
-
wrapAction(async (timeEntryId, opts) => {
|
|
4724
|
-
const config = loadConfig();
|
|
4725
|
-
await deleteTimeEntry(config, timeEntryId);
|
|
4726
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4727
|
-
console.log(JSON.stringify({ deleted: timeEntryId }));
|
|
4728
|
-
} else {
|
|
4729
|
-
console.log(`Deleted time entry ${timeEntryId}`);
|
|
4730
|
-
}
|
|
4731
|
-
})
|
|
4732
|
-
);
|
|
4733
|
-
program.command("tags <spaceId>").description("List tags in a space").option("--json", "Force JSON output even in terminal").action(
|
|
4734
|
-
wrapAction(async (spaceId, opts) => {
|
|
4735
|
-
const config = loadConfig();
|
|
4736
|
-
const tags = await listSpaceTags(config, spaceId);
|
|
4737
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4738
|
-
console.log(JSON.stringify(tags, null, 2));
|
|
4739
|
-
} else if (isTTY()) {
|
|
4740
|
-
console.log(formatTags(tags));
|
|
4741
|
-
} else {
|
|
4742
|
-
console.log(formatTagsMarkdown(tags));
|
|
4743
|
-
}
|
|
4744
|
-
})
|
|
4745
|
-
);
|
|
4746
|
-
program.command("tag-create <spaceId> <name>").description("Create a tag in a space").option("--fg <color>", "Foreground color (hex)").option("--bg <color>", "Background color (hex)").option("--json", "Force JSON output even in terminal").action(
|
|
4747
|
-
wrapAction(
|
|
4748
|
-
async (spaceId, name, opts) => {
|
|
5040
|
+
})
|
|
5041
|
+
);
|
|
5042
|
+
timeCmd.command("status").description("Show the currently running timer").option("--json", "Force JSON output even in terminal").action(
|
|
5043
|
+
wrapAction(async (opts) => {
|
|
4749
5044
|
const config = loadConfig();
|
|
4750
|
-
await
|
|
5045
|
+
const result = await timerStatus(config);
|
|
4751
5046
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
4752
|
-
console.log(JSON.stringify(
|
|
5047
|
+
console.log(JSON.stringify(result, null, 2));
|
|
5048
|
+
} else if (!result) {
|
|
5049
|
+
console.log("No timer running");
|
|
5050
|
+
} else if (isTTY()) {
|
|
5051
|
+
console.log(formatTimeEntry(result));
|
|
4753
5052
|
} else {
|
|
4754
|
-
console.log(
|
|
5053
|
+
console.log(formatTimeEntryMarkdown(result));
|
|
4755
5054
|
}
|
|
4756
|
-
}
|
|
4757
|
-
)
|
|
4758
|
-
)
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
}
|
|
4768
|
-
})
|
|
4769
|
-
);
|
|
4770
|
-
program.command("members").description("List workspace members").option("--json", "Force JSON output even in terminal").action(
|
|
4771
|
-
wrapAction(async (opts) => {
|
|
4772
|
-
const config = loadConfig();
|
|
4773
|
-
const members = await listMembers(config);
|
|
4774
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4775
|
-
console.log(JSON.stringify(members, null, 2));
|
|
4776
|
-
} else if (isTTY()) {
|
|
4777
|
-
console.log(formatMembers(members));
|
|
4778
|
-
} else {
|
|
4779
|
-
console.log(formatMembersMarkdown(members));
|
|
4780
|
-
}
|
|
4781
|
-
})
|
|
4782
|
-
);
|
|
4783
|
-
program.command("fields <listId>").description("List custom fields for a list").option("--json", "Force JSON output even in terminal").action(
|
|
4784
|
-
wrapAction(async (listId, opts) => {
|
|
4785
|
-
const config = loadConfig();
|
|
4786
|
-
const fields = await listFields(config, listId);
|
|
4787
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4788
|
-
console.log(JSON.stringify(fields, null, 2));
|
|
4789
|
-
} else if (isTTY()) {
|
|
4790
|
-
console.log(formatFields(fields));
|
|
4791
|
-
} else {
|
|
4792
|
-
console.log(formatFieldsMarkdown(fields));
|
|
4793
|
-
}
|
|
4794
|
-
})
|
|
4795
|
-
);
|
|
4796
|
-
program.command("duplicate <taskId>").description("Duplicate a task").option("--json", "Force JSON output even in terminal").action(
|
|
4797
|
-
wrapAction(async (taskId, opts) => {
|
|
4798
|
-
const config = loadConfig();
|
|
4799
|
-
const result = await duplicateTask(config, taskId);
|
|
4800
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4801
|
-
console.log(JSON.stringify(result, null, 2));
|
|
4802
|
-
} else {
|
|
4803
|
-
console.log(`Duplicated as "${result.name}" (${result.id})`);
|
|
4804
|
-
}
|
|
4805
|
-
})
|
|
4806
|
-
);
|
|
4807
|
-
var bulkCmd = program.command("bulk").description("Bulk task operations");
|
|
4808
|
-
bulkCmd.command("status <status> <taskIds...>").description("Update status of multiple tasks").option("--json", "Force JSON output even in terminal").action(
|
|
4809
|
-
wrapAction(async (status, taskIds, opts) => {
|
|
4810
|
-
const config = loadConfig();
|
|
4811
|
-
const result = await bulkUpdateStatus(config, taskIds, status);
|
|
4812
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4813
|
-
console.log(JSON.stringify(result, null, 2));
|
|
4814
|
-
} else {
|
|
4815
|
-
console.log(`Updated ${result.updated} tasks to "${status}"`);
|
|
4816
|
-
if (result.failed.length > 0) {
|
|
4817
|
-
for (const f of result.failed) {
|
|
4818
|
-
console.log(` Failed ${f.id}: ${f.reason}`);
|
|
5055
|
+
})
|
|
5056
|
+
);
|
|
5057
|
+
timeCmd.command("log <taskId> <duration>").description('Log a manual time entry (e.g. "2h", "30m", "1h30m")').option("-d, --description <text>", "Description for the time entry").option("--json", "Force JSON output even in terminal").action(
|
|
5058
|
+
wrapAction(
|
|
5059
|
+
async (taskId, duration, opts) => {
|
|
5060
|
+
const config = loadConfig();
|
|
5061
|
+
const result = await logTime(config, taskId, duration, opts.description);
|
|
5062
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5063
|
+
console.log(JSON.stringify(result, null, 2));
|
|
5064
|
+
} else {
|
|
5065
|
+
console.log(`Logged ${duration} on task ${taskId}`);
|
|
4819
5066
|
}
|
|
4820
5067
|
}
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
)
|
|
4824
|
-
|
|
4825
|
-
wrapAction(async (opts) => {
|
|
4826
|
-
const config = loadConfig();
|
|
4827
|
-
const goals = await listGoals(config);
|
|
4828
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4829
|
-
console.log(JSON.stringify(goals, null, 2));
|
|
4830
|
-
} else if (isTTY()) {
|
|
4831
|
-
console.log(formatGoals(goals));
|
|
4832
|
-
} else {
|
|
4833
|
-
console.log(formatGoalsMarkdown(goals));
|
|
4834
|
-
}
|
|
4835
|
-
})
|
|
4836
|
-
);
|
|
4837
|
-
program.command("goal-create <name>").description("Create a goal").option("-d, --description <text>", "Goal description").option("--color <hex>", "Goal color (hex)").option("--json", "Force JSON output even in terminal").action(
|
|
4838
|
-
wrapAction(
|
|
4839
|
-
async (name, opts) => {
|
|
5068
|
+
)
|
|
5069
|
+
);
|
|
5070
|
+
timeCmd.command("list").description("List recent time entries (default: last 7 days)").option("--days <n>", "Number of days to look back", "7").option("--task <taskId>", "Filter by task ID").option("--json", "Force JSON output even in terminal").action(
|
|
5071
|
+
wrapAction(async (opts) => {
|
|
4840
5072
|
const config = loadConfig();
|
|
4841
|
-
const
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
}
|
|
5073
|
+
const days = opts.days ? Number(opts.days) : 7;
|
|
5074
|
+
if (!Number.isFinite(days) || days <= 0) {
|
|
5075
|
+
throw new Error("--days must be a positive number");
|
|
5076
|
+
}
|
|
5077
|
+
const entries = await listTimeEntries(config, { days, taskId: opts.task });
|
|
4845
5078
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
4846
|
-
console.log(JSON.stringify(
|
|
5079
|
+
console.log(JSON.stringify(entries, null, 2));
|
|
5080
|
+
} else if (isTTY()) {
|
|
5081
|
+
console.log(formatTimeEntries(entries));
|
|
4847
5082
|
} else {
|
|
4848
|
-
console.log(
|
|
5083
|
+
console.log(formatTimeEntriesMarkdown(entries));
|
|
4849
5084
|
}
|
|
4850
|
-
}
|
|
4851
|
-
)
|
|
4852
|
-
)
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
5085
|
+
})
|
|
5086
|
+
);
|
|
5087
|
+
timeCmd.command("update <timeEntryId>").description("Update a time entry").option("-d, --description <text>", "New description").option("--duration <duration>", 'New duration (e.g. "2h", "30m")').option("--json", "Force JSON output even in terminal").action(
|
|
5088
|
+
wrapAction(
|
|
5089
|
+
async (timeEntryId, opts) => {
|
|
5090
|
+
const config = loadConfig();
|
|
5091
|
+
const entry = await updateTimeEntry(config, timeEntryId, {
|
|
5092
|
+
description: opts.description,
|
|
5093
|
+
duration: opts.duration
|
|
5094
|
+
});
|
|
5095
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5096
|
+
console.log(JSON.stringify(entry, null, 2));
|
|
5097
|
+
} else if (isTTY()) {
|
|
5098
|
+
console.log(formatTimeEntry(entry));
|
|
5099
|
+
} else {
|
|
5100
|
+
console.log(formatTimeEntryMarkdown(entry));
|
|
5101
|
+
}
|
|
5102
|
+
}
|
|
5103
|
+
)
|
|
5104
|
+
);
|
|
5105
|
+
timeCmd.command("delete <timeEntryId>").description("Delete a time entry").option("--json", "Force JSON output even in terminal").action(
|
|
5106
|
+
wrapAction(async (timeEntryId, opts) => {
|
|
4856
5107
|
const config = loadConfig();
|
|
4857
|
-
|
|
4858
|
-
name: opts.name,
|
|
4859
|
-
description: opts.description,
|
|
4860
|
-
color: opts.color
|
|
4861
|
-
});
|
|
5108
|
+
await deleteTimeEntry(config, timeEntryId);
|
|
4862
5109
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
4863
|
-
console.log(JSON.stringify(
|
|
5110
|
+
console.log(JSON.stringify({ deleted: timeEntryId }));
|
|
4864
5111
|
} else {
|
|
4865
|
-
console.log(`
|
|
5112
|
+
console.log(`Deleted time entry ${timeEntryId}`);
|
|
4866
5113
|
}
|
|
4867
|
-
}
|
|
4868
|
-
)
|
|
4869
|
-
)
|
|
4870
|
-
|
|
4871
|
-
wrapAction(async (goalId, opts) => {
|
|
4872
|
-
const config = loadConfig();
|
|
4873
|
-
await deleteGoal(config, goalId);
|
|
4874
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4875
|
-
console.log(JSON.stringify({ success: true, goalId }, null, 2));
|
|
4876
|
-
} else {
|
|
4877
|
-
console.log(`Deleted goal ${goalId}`);
|
|
4878
|
-
}
|
|
4879
|
-
})
|
|
4880
|
-
);
|
|
4881
|
-
program.command("key-results <goalId>").description("List key results for a goal").option("--json", "Force JSON output even in terminal").action(
|
|
4882
|
-
wrapAction(async (goalId, opts) => {
|
|
4883
|
-
const config = loadConfig();
|
|
4884
|
-
const krs = await listKeyResults(config, goalId);
|
|
4885
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4886
|
-
console.log(JSON.stringify(krs, null, 2));
|
|
4887
|
-
} else if (isTTY()) {
|
|
4888
|
-
console.log(formatKeyResults(krs));
|
|
4889
|
-
} else {
|
|
4890
|
-
console.log(formatKeyResultsMarkdown(krs));
|
|
4891
|
-
}
|
|
4892
|
-
})
|
|
4893
|
-
);
|
|
4894
|
-
program.command("key-result-create <goalId> <name>").description("Create a key result on a goal").option("--type <type>", "Key result type (number or percentage)", "number").option("--target <n>", "Target value", "100").option("--json", "Force JSON output even in terminal").action(
|
|
4895
|
-
wrapAction(
|
|
4896
|
-
async (goalId, name, opts) => {
|
|
5114
|
+
})
|
|
5115
|
+
);
|
|
5116
|
+
program.command("tags <spaceId>").description("List tags in a space").option("--json", "Force JSON output even in terminal").action(
|
|
5117
|
+
wrapAction(async (spaceId, opts) => {
|
|
4897
5118
|
const config = loadConfig();
|
|
4898
|
-
const
|
|
4899
|
-
if (
|
|
4900
|
-
|
|
5119
|
+
const tags = await listSpaceTags(config, spaceId);
|
|
5120
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5121
|
+
console.log(JSON.stringify(tags, null, 2));
|
|
5122
|
+
} else if (isTTY()) {
|
|
5123
|
+
console.log(formatTags(tags));
|
|
5124
|
+
} else {
|
|
5125
|
+
console.log(formatTagsMarkdown(tags));
|
|
5126
|
+
}
|
|
5127
|
+
})
|
|
5128
|
+
);
|
|
5129
|
+
program.command("tag-create <spaceId> <name>").description("Create a tag in a space").option("--fg <color>", "Foreground color (hex)").option("--bg <color>", "Background color (hex)").option("--json", "Force JSON output even in terminal").action(
|
|
5130
|
+
wrapAction(
|
|
5131
|
+
async (spaceId, name, opts) => {
|
|
5132
|
+
const config = loadConfig();
|
|
5133
|
+
await createSpaceTag(config, spaceId, name, opts.fg, opts.bg);
|
|
5134
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5135
|
+
console.log(JSON.stringify({ success: true, spaceId, tag: name }, null, 2));
|
|
5136
|
+
} else {
|
|
5137
|
+
console.log(`Created tag "${name}" in space ${spaceId}`);
|
|
5138
|
+
}
|
|
4901
5139
|
}
|
|
4902
|
-
|
|
5140
|
+
)
|
|
5141
|
+
);
|
|
5142
|
+
program.command("tag-delete <spaceId> <name>").description("Delete a tag from a space").option("--json", "Force JSON output even in terminal").action(
|
|
5143
|
+
wrapAction(async (spaceId, name, opts) => {
|
|
5144
|
+
const config = loadConfig();
|
|
5145
|
+
await deleteSpaceTag(config, spaceId, name);
|
|
4903
5146
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
4904
|
-
console.log(JSON.stringify(
|
|
5147
|
+
console.log(JSON.stringify({ success: true, spaceId, tag: name }, null, 2));
|
|
4905
5148
|
} else {
|
|
4906
|
-
console.log(`
|
|
5149
|
+
console.log(`Deleted tag "${name}" from space ${spaceId}`);
|
|
4907
5150
|
}
|
|
4908
|
-
}
|
|
4909
|
-
)
|
|
4910
|
-
)
|
|
4911
|
-
|
|
4912
|
-
wrapAction(
|
|
4913
|
-
async (keyResultId, opts) => {
|
|
5151
|
+
})
|
|
5152
|
+
);
|
|
5153
|
+
program.command("members").description("List workspace members").option("--json", "Force JSON output even in terminal").action(
|
|
5154
|
+
wrapAction(async (opts) => {
|
|
4914
5155
|
const config = loadConfig();
|
|
4915
|
-
const
|
|
4916
|
-
if (opts.
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
5156
|
+
const members = await listMembers(config);
|
|
5157
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5158
|
+
console.log(JSON.stringify(members, null, 2));
|
|
5159
|
+
} else if (isTTY()) {
|
|
5160
|
+
console.log(formatMembers(members));
|
|
5161
|
+
} else {
|
|
5162
|
+
console.log(formatMembersMarkdown(members));
|
|
4920
5163
|
}
|
|
4921
|
-
|
|
4922
|
-
|
|
5164
|
+
})
|
|
5165
|
+
);
|
|
5166
|
+
program.command("fields <listId>").description("List custom fields for a list").option("--json", "Force JSON output even in terminal").action(
|
|
5167
|
+
wrapAction(async (listId, opts) => {
|
|
5168
|
+
const config = loadConfig();
|
|
5169
|
+
const fields = await listFields(config, listId);
|
|
4923
5170
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
4924
|
-
console.log(JSON.stringify(
|
|
5171
|
+
console.log(JSON.stringify(fields, null, 2));
|
|
5172
|
+
} else if (isTTY()) {
|
|
5173
|
+
console.log(formatFields(fields));
|
|
4925
5174
|
} else {
|
|
4926
|
-
console.log(
|
|
5175
|
+
console.log(formatFieldsMarkdown(fields));
|
|
4927
5176
|
}
|
|
4928
|
-
}
|
|
4929
|
-
)
|
|
4930
|
-
)
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
}
|
|
4940
|
-
|
|
4941
|
-
);
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
5177
|
+
})
|
|
5178
|
+
);
|
|
5179
|
+
program.command("duplicate <taskId>").description("Duplicate a task").option("--json", "Force JSON output even in terminal").action(
|
|
5180
|
+
wrapAction(async (taskId, opts) => {
|
|
5181
|
+
const config = loadConfig();
|
|
5182
|
+
const result = await duplicateTask(config, taskId);
|
|
5183
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5184
|
+
console.log(JSON.stringify(result, null, 2));
|
|
5185
|
+
} else {
|
|
5186
|
+
console.log(`Duplicated as "${result.name}" (${result.id})`);
|
|
5187
|
+
}
|
|
5188
|
+
})
|
|
5189
|
+
);
|
|
5190
|
+
const bulkCmd = program.command("bulk").description("Bulk task operations");
|
|
5191
|
+
bulkCmd.command("status <status> <taskIds...>").description("Update status of multiple tasks").option("--json", "Force JSON output even in terminal").action(
|
|
5192
|
+
wrapAction(async (status, taskIds, opts) => {
|
|
5193
|
+
const config = loadConfig();
|
|
5194
|
+
const result = await bulkUpdateStatus(config, taskIds, status);
|
|
5195
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5196
|
+
console.log(JSON.stringify(result, null, 2));
|
|
5197
|
+
} else {
|
|
5198
|
+
console.log(`Updated ${result.updated} tasks to "${status}"`);
|
|
5199
|
+
if (result.failed.length > 0) {
|
|
5200
|
+
for (const f of result.failed) {
|
|
5201
|
+
console.log(` Failed ${f.id}: ${f.reason}`);
|
|
5202
|
+
}
|
|
5203
|
+
}
|
|
5204
|
+
}
|
|
5205
|
+
})
|
|
5206
|
+
);
|
|
5207
|
+
program.command("goals").description("List goals in your workspace").option("--json", "Force JSON output even in terminal").action(
|
|
5208
|
+
wrapAction(async (opts) => {
|
|
5209
|
+
const config = loadConfig();
|
|
5210
|
+
const goals = await listGoals(config);
|
|
4960
5211
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
4961
|
-
console.log(JSON.stringify(
|
|
5212
|
+
console.log(JSON.stringify(goals, null, 2));
|
|
5213
|
+
} else if (isTTY()) {
|
|
5214
|
+
console.log(formatGoals(goals));
|
|
4962
5215
|
} else {
|
|
4963
|
-
|
|
5216
|
+
console.log(formatGoalsMarkdown(goals));
|
|
5217
|
+
}
|
|
5218
|
+
})
|
|
5219
|
+
);
|
|
5220
|
+
program.command("goal-create <name>").description("Create a goal").option("-d, --description <text>", "Goal description").option("--color <hex>", "Goal color (hex)").option("--json", "Force JSON output even in terminal").action(
|
|
5221
|
+
wrapAction(
|
|
5222
|
+
async (name, opts) => {
|
|
5223
|
+
const config = loadConfig();
|
|
5224
|
+
const goal = await createGoal(config, name, {
|
|
5225
|
+
description: opts.description,
|
|
5226
|
+
color: opts.color
|
|
5227
|
+
});
|
|
5228
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5229
|
+
console.log(JSON.stringify(goal, null, 2));
|
|
5230
|
+
} else {
|
|
5231
|
+
console.log(`Created goal "${goal.name}" (${goal.id})`);
|
|
5232
|
+
}
|
|
5233
|
+
}
|
|
5234
|
+
)
|
|
5235
|
+
);
|
|
5236
|
+
program.command("goal-update <goalId>").description("Update a goal").option("-n, --name <text>", "New goal name").option("-d, --description <text>", "New description").option("--color <hex>", "New color (hex)").option("--json", "Force JSON output even in terminal").action(
|
|
5237
|
+
wrapAction(
|
|
5238
|
+
async (goalId, opts) => {
|
|
5239
|
+
const config = loadConfig();
|
|
5240
|
+
const goal = await updateGoal(config, goalId, {
|
|
5241
|
+
name: opts.name,
|
|
5242
|
+
description: opts.description,
|
|
5243
|
+
color: opts.color
|
|
5244
|
+
});
|
|
5245
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5246
|
+
console.log(JSON.stringify(goal, null, 2));
|
|
5247
|
+
} else {
|
|
5248
|
+
console.log(`Updated goal "${goal.name}" (${goal.id})`);
|
|
5249
|
+
}
|
|
5250
|
+
}
|
|
5251
|
+
)
|
|
5252
|
+
);
|
|
5253
|
+
program.command("goal-delete <goalId>").description("Delete a goal").option("--json", "Force JSON output even in terminal").action(
|
|
5254
|
+
wrapAction(async (goalId, opts) => {
|
|
5255
|
+
const config = loadConfig();
|
|
5256
|
+
await deleteGoal(config, goalId);
|
|
5257
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5258
|
+
console.log(JSON.stringify({ success: true, goalId }, null, 2));
|
|
5259
|
+
} else {
|
|
5260
|
+
console.log(`Deleted goal ${goalId}`);
|
|
5261
|
+
}
|
|
5262
|
+
})
|
|
5263
|
+
);
|
|
5264
|
+
program.command("key-results <goalId>").description("List key results for a goal").option("--json", "Force JSON output even in terminal").action(
|
|
5265
|
+
wrapAction(async (goalId, opts) => {
|
|
5266
|
+
const config = loadConfig();
|
|
5267
|
+
const krs = await listKeyResults(config, goalId);
|
|
5268
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5269
|
+
console.log(JSON.stringify(krs, null, 2));
|
|
5270
|
+
} else if (isTTY()) {
|
|
5271
|
+
console.log(formatKeyResults(krs));
|
|
5272
|
+
} else {
|
|
5273
|
+
console.log(formatKeyResultsMarkdown(krs));
|
|
5274
|
+
}
|
|
5275
|
+
})
|
|
5276
|
+
);
|
|
5277
|
+
program.command("key-result-create <goalId> <name>").description("Create a key result on a goal").option("--type <type>", "Key result type (number or percentage)", "number").option("--target <n>", "Target value", "100").option("--json", "Force JSON output even in terminal").action(
|
|
5278
|
+
wrapAction(
|
|
5279
|
+
async (goalId, name, opts) => {
|
|
5280
|
+
const config = loadConfig();
|
|
5281
|
+
const target = Number(opts.target ?? 100);
|
|
5282
|
+
if (!Number.isFinite(target) || target <= 0) {
|
|
5283
|
+
throw new Error("--target must be a positive number");
|
|
5284
|
+
}
|
|
5285
|
+
const kr = await createKeyResult(config, goalId, name, opts.type ?? "number", target);
|
|
5286
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5287
|
+
console.log(JSON.stringify(kr, null, 2));
|
|
5288
|
+
} else {
|
|
5289
|
+
console.log(`Created key result "${kr.name}" (${kr.id})`);
|
|
5290
|
+
}
|
|
5291
|
+
}
|
|
5292
|
+
)
|
|
5293
|
+
);
|
|
5294
|
+
program.command("key-result-update <keyResultId>").description("Update a key result").option("--progress <n>", "Current progress value").option("--note <text>", "Progress note").option("--json", "Force JSON output even in terminal").action(
|
|
5295
|
+
wrapAction(
|
|
5296
|
+
async (keyResultId, opts) => {
|
|
5297
|
+
const config = loadConfig();
|
|
5298
|
+
const updates = {};
|
|
5299
|
+
if (opts.progress !== void 0) {
|
|
5300
|
+
const p = Number(opts.progress);
|
|
5301
|
+
if (!Number.isFinite(p)) throw new Error("--progress must be a number");
|
|
5302
|
+
updates.progress = p;
|
|
5303
|
+
}
|
|
5304
|
+
if (opts.note !== void 0) updates.note = opts.note;
|
|
5305
|
+
const kr = await updateKeyResult(config, keyResultId, updates);
|
|
5306
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5307
|
+
console.log(JSON.stringify(kr, null, 2));
|
|
5308
|
+
} else {
|
|
5309
|
+
console.log(`Updated key result "${kr.name}" (${kr.id})`);
|
|
5310
|
+
}
|
|
5311
|
+
}
|
|
5312
|
+
)
|
|
5313
|
+
);
|
|
5314
|
+
program.command("key-result-delete <keyResultId>").description("Delete a key result").option("--json", "Force JSON output even in terminal").action(
|
|
5315
|
+
wrapAction(async (keyResultId, opts) => {
|
|
5316
|
+
const config = loadConfig();
|
|
5317
|
+
await deleteKeyResult(config, keyResultId);
|
|
5318
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5319
|
+
console.log(JSON.stringify({ success: true, keyResultId }, null, 2));
|
|
5320
|
+
} else {
|
|
5321
|
+
console.log(`Deleted key result ${keyResultId}`);
|
|
5322
|
+
}
|
|
5323
|
+
})
|
|
5324
|
+
);
|
|
5325
|
+
program.command("docs [query]").description("List workspace docs (optionally filter by name)").option("--json", "Force JSON output even in terminal").action(
|
|
5326
|
+
wrapAction(async (query, opts) => {
|
|
5327
|
+
const config = loadConfig();
|
|
5328
|
+
const docs = await listDocs(config, query);
|
|
5329
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5330
|
+
console.log(JSON.stringify(docs, null, 2));
|
|
5331
|
+
} else if (isTTY()) {
|
|
5332
|
+
console.log(formatDocs(docs));
|
|
5333
|
+
} else {
|
|
5334
|
+
console.log(formatDocsMarkdown(docs));
|
|
5335
|
+
}
|
|
5336
|
+
})
|
|
5337
|
+
);
|
|
5338
|
+
program.command("doc <docId> [pageId]").description("View a doc (metadata + page tree) or a specific page").option("--json", "Force JSON output even in terminal").action(
|
|
5339
|
+
wrapAction(async (docId, pageId, opts) => {
|
|
5340
|
+
const config = loadConfig();
|
|
5341
|
+
if (pageId) {
|
|
5342
|
+
const page = await getDocPage(config, docId, pageId);
|
|
5343
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5344
|
+
console.log(JSON.stringify(page, null, 2));
|
|
5345
|
+
} else {
|
|
5346
|
+
if (page.name) console.log(`# ${page.name}
|
|
4964
5347
|
`);
|
|
4965
|
-
|
|
5348
|
+
console.log(page.content ?? "");
|
|
5349
|
+
}
|
|
5350
|
+
} else {
|
|
5351
|
+
const { doc, pages } = await getDocInfo(config, docId);
|
|
5352
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5353
|
+
console.log(JSON.stringify({ ...doc, pages }, null, 2));
|
|
5354
|
+
} else if (isTTY()) {
|
|
5355
|
+
console.log(formatDocInfo(doc, pages));
|
|
5356
|
+
} else {
|
|
5357
|
+
console.log(formatDocInfoMarkdown(doc, pages));
|
|
5358
|
+
}
|
|
4966
5359
|
}
|
|
4967
|
-
}
|
|
4968
|
-
|
|
5360
|
+
})
|
|
5361
|
+
);
|
|
5362
|
+
program.command("doc-pages <docId>").description("List all pages in a doc with content").option("--json", "Force JSON output even in terminal").action(
|
|
5363
|
+
wrapAction(async (docId, opts) => {
|
|
5364
|
+
const config = loadConfig();
|
|
5365
|
+
const pages = await getAllDocPages(config, docId);
|
|
4969
5366
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
4970
|
-
console.log(JSON.stringify(
|
|
5367
|
+
console.log(JSON.stringify(pages, null, 2));
|
|
4971
5368
|
} else if (isTTY()) {
|
|
4972
|
-
console.log(
|
|
5369
|
+
console.log(formatDocPages(pages));
|
|
4973
5370
|
} else {
|
|
4974
|
-
console.log(
|
|
5371
|
+
console.log(formatDocPagesMarkdown(pages));
|
|
4975
5372
|
}
|
|
4976
|
-
}
|
|
4977
|
-
|
|
4978
|
-
)
|
|
4979
|
-
|
|
4980
|
-
wrapAction(async (docId, opts) => {
|
|
4981
|
-
const config = loadConfig();
|
|
4982
|
-
const pages = await getAllDocPages(config, docId);
|
|
4983
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4984
|
-
console.log(JSON.stringify(pages, null, 2));
|
|
4985
|
-
} else if (isTTY()) {
|
|
4986
|
-
console.log(formatDocPages(pages));
|
|
4987
|
-
} else {
|
|
4988
|
-
console.log(formatDocPagesMarkdown(pages));
|
|
4989
|
-
}
|
|
4990
|
-
})
|
|
4991
|
-
);
|
|
4992
|
-
program.command("folders <spaceId>").description("List folders in a space (with their lists)").option("--name <partial>", "Filter folders by partial name match").option("--json", "Force JSON output even in terminal").action(
|
|
4993
|
-
wrapAction(async (spaceId, opts) => {
|
|
4994
|
-
const config = loadConfig();
|
|
4995
|
-
const folders = await listFolders(config, spaceId, opts.name);
|
|
4996
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
4997
|
-
console.log(JSON.stringify(folders, null, 2));
|
|
4998
|
-
} else if (isTTY()) {
|
|
4999
|
-
console.log(formatFolders(folders));
|
|
5000
|
-
} else {
|
|
5001
|
-
console.log(formatFoldersMarkdown(folders));
|
|
5002
|
-
}
|
|
5003
|
-
})
|
|
5004
|
-
);
|
|
5005
|
-
program.command("doc-create <title>").description("Create a new doc").option("-c, --content <text>", "Initial content (markdown)").option("--json", "Force JSON output even in terminal").action(
|
|
5006
|
-
wrapAction(async (title, opts) => {
|
|
5007
|
-
const config = loadConfig();
|
|
5008
|
-
const result = await createDoc(config, title, opts.content);
|
|
5009
|
-
if (shouldOutputJson(opts.json ?? false)) {
|
|
5010
|
-
console.log(JSON.stringify(result, null, 2));
|
|
5011
|
-
} else {
|
|
5012
|
-
console.log(`Created doc "${result.title}" (${result.id})`);
|
|
5013
|
-
}
|
|
5014
|
-
})
|
|
5015
|
-
);
|
|
5016
|
-
program.command("doc-page-create <docId> <name>").description("Create a page in a doc").option("-c, --content <text>", "Page content (markdown)").option("--parent-page <pageId>", "Parent page ID for nesting").option("--json", "Force JSON output even in terminal").action(
|
|
5017
|
-
wrapAction(
|
|
5018
|
-
async (docId, name, opts) => {
|
|
5373
|
+
})
|
|
5374
|
+
);
|
|
5375
|
+
program.command("folders <spaceId>").description("List folders in a space (with their lists)").option("--name <partial>", "Filter folders by partial name match").option("--json", "Force JSON output even in terminal").action(
|
|
5376
|
+
wrapAction(async (spaceId, opts) => {
|
|
5019
5377
|
const config = loadConfig();
|
|
5020
|
-
const
|
|
5378
|
+
const folders = await listFolders(config, spaceId, opts.name);
|
|
5021
5379
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
5022
|
-
console.log(JSON.stringify(
|
|
5380
|
+
console.log(JSON.stringify(folders, null, 2));
|
|
5381
|
+
} else if (isTTY()) {
|
|
5382
|
+
console.log(formatFolders(folders));
|
|
5023
5383
|
} else {
|
|
5024
|
-
console.log(
|
|
5384
|
+
console.log(formatFoldersMarkdown(folders));
|
|
5025
5385
|
}
|
|
5026
|
-
}
|
|
5027
|
-
)
|
|
5028
|
-
)
|
|
5029
|
-
|
|
5030
|
-
wrapAction(
|
|
5031
|
-
async (docId, pageId, opts) => {
|
|
5386
|
+
})
|
|
5387
|
+
);
|
|
5388
|
+
program.command("doc-create <title>").description("Create a new doc").option("-c, --content <text>", "Initial content (markdown)").option("--json", "Force JSON output even in terminal").action(
|
|
5389
|
+
wrapAction(async (title, opts) => {
|
|
5032
5390
|
const config = loadConfig();
|
|
5033
|
-
const
|
|
5034
|
-
name: opts.name,
|
|
5035
|
-
content: opts.content
|
|
5036
|
-
});
|
|
5391
|
+
const result = await createDoc(config, title, opts.content);
|
|
5037
5392
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
5038
|
-
console.log(JSON.stringify(
|
|
5393
|
+
console.log(JSON.stringify(result, null, 2));
|
|
5039
5394
|
} else {
|
|
5040
|
-
console.log(`
|
|
5395
|
+
console.log(`Created doc "${result.title}" (${result.id})`);
|
|
5041
5396
|
}
|
|
5042
|
-
}
|
|
5043
|
-
)
|
|
5044
|
-
)
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
)
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
);
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5397
|
+
})
|
|
5398
|
+
);
|
|
5399
|
+
program.command("doc-page-create <docId> <name>").description("Create a page in a doc").option("-c, --content <text>", "Page content (markdown)").option("--parent-page <pageId>", "Parent page ID for nesting").option("--json", "Force JSON output even in terminal").action(
|
|
5400
|
+
wrapAction(
|
|
5401
|
+
async (docId, name, opts) => {
|
|
5402
|
+
const config = loadConfig();
|
|
5403
|
+
const page = await createDocPage(config, docId, name, opts.content, opts.parentPage);
|
|
5404
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5405
|
+
console.log(JSON.stringify(page, null, 2));
|
|
5406
|
+
} else {
|
|
5407
|
+
console.log(`Created page "${page.name}" (${page.id}) in doc ${docId}`);
|
|
5408
|
+
}
|
|
5409
|
+
}
|
|
5410
|
+
)
|
|
5411
|
+
);
|
|
5412
|
+
program.command("doc-page-edit <docId> <pageId>").description("Edit a doc page").option("--name <text>", "New page name").option("-c, --content <text>", "New page content (markdown)").option("--json", "Force JSON output even in terminal").action(
|
|
5413
|
+
wrapAction(
|
|
5414
|
+
async (docId, pageId, opts) => {
|
|
5415
|
+
const config = loadConfig();
|
|
5416
|
+
const page = await editDocPage(config, docId, pageId, {
|
|
5417
|
+
name: opts.name,
|
|
5418
|
+
content: opts.content
|
|
5419
|
+
});
|
|
5420
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5421
|
+
console.log(JSON.stringify(page, null, 2));
|
|
5422
|
+
} else {
|
|
5423
|
+
console.log(`Updated page "${page.name}" (${page.id})`);
|
|
5424
|
+
}
|
|
5425
|
+
}
|
|
5426
|
+
)
|
|
5427
|
+
);
|
|
5428
|
+
program.command("doc-delete <docId>").description("Delete a doc").option("--json", "Force JSON output even in terminal").action(
|
|
5429
|
+
wrapAction(async (docId, opts) => {
|
|
5070
5430
|
const config = loadConfig();
|
|
5071
|
-
await
|
|
5072
|
-
name: opts.name,
|
|
5073
|
-
fg: opts.fg,
|
|
5074
|
-
bg: opts.bg
|
|
5075
|
-
});
|
|
5431
|
+
await deleteDoc(config, docId);
|
|
5076
5432
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
5077
|
-
console.log(
|
|
5078
|
-
JSON.stringify(
|
|
5079
|
-
{ success: true, spaceId, oldName: tagName, newName: opts.name },
|
|
5080
|
-
null,
|
|
5081
|
-
2
|
|
5082
|
-
)
|
|
5083
|
-
);
|
|
5433
|
+
console.log(JSON.stringify({ success: true, docId }, null, 2));
|
|
5084
5434
|
} else {
|
|
5085
|
-
console.log(`
|
|
5435
|
+
console.log(`Deleted doc ${docId}`);
|
|
5086
5436
|
}
|
|
5087
|
-
}
|
|
5088
|
-
)
|
|
5089
|
-
)
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
}
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
)
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
)
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
)
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
)
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
)
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
)
|
|
5437
|
+
})
|
|
5438
|
+
);
|
|
5439
|
+
program.command("doc-page-delete <docId> <pageId>").description("Delete a doc page").option("--json", "Force JSON output even in terminal").action(
|
|
5440
|
+
wrapAction(async (docId, pageId, opts) => {
|
|
5441
|
+
const config = loadConfig();
|
|
5442
|
+
await deleteDocPage(config, docId, pageId);
|
|
5443
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5444
|
+
console.log(JSON.stringify({ success: true, docId, pageId }, null, 2));
|
|
5445
|
+
} else {
|
|
5446
|
+
console.log(`Deleted page ${pageId} from doc ${docId}`);
|
|
5447
|
+
}
|
|
5448
|
+
})
|
|
5449
|
+
);
|
|
5450
|
+
program.command("tag-update <spaceId> <tagName>").description("Update a tag in a space").requiredOption("--name <newName>", "New tag name").option("--fg <color>", "New foreground color (hex)").option("--bg <color>", "New background color (hex)").option("--json", "Force JSON output even in terminal").action(
|
|
5451
|
+
wrapAction(
|
|
5452
|
+
async (spaceId, tagName, opts) => {
|
|
5453
|
+
const config = loadConfig();
|
|
5454
|
+
await updateSpaceTag(config, spaceId, tagName, {
|
|
5455
|
+
name: opts.name,
|
|
5456
|
+
fg: opts.fg,
|
|
5457
|
+
bg: opts.bg
|
|
5458
|
+
});
|
|
5459
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5460
|
+
console.log(
|
|
5461
|
+
JSON.stringify(
|
|
5462
|
+
{ success: true, spaceId, oldName: tagName, newName: opts.name },
|
|
5463
|
+
null,
|
|
5464
|
+
2
|
|
5465
|
+
)
|
|
5466
|
+
);
|
|
5467
|
+
} else {
|
|
5468
|
+
console.log(`Renamed tag "${tagName}" to "${opts.name}" in space ${spaceId}`);
|
|
5469
|
+
}
|
|
5470
|
+
}
|
|
5471
|
+
)
|
|
5472
|
+
);
|
|
5473
|
+
program.command("task-types").description("List custom task types in your workspace").option("--json", "Force JSON output even in terminal").action(
|
|
5474
|
+
wrapAction(async (opts) => {
|
|
5475
|
+
const config = loadConfig();
|
|
5476
|
+
const types = await listTaskTypes(config);
|
|
5477
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5478
|
+
console.log(JSON.stringify(types, null, 2));
|
|
5479
|
+
} else if (isTTY()) {
|
|
5480
|
+
console.log(formatTaskTypes(types));
|
|
5481
|
+
} else {
|
|
5482
|
+
console.log(formatTaskTypesMarkdown(types));
|
|
5483
|
+
}
|
|
5484
|
+
})
|
|
5485
|
+
);
|
|
5486
|
+
program.command("templates").description("List task templates in your workspace").option("--json", "Force JSON output even in terminal").action(
|
|
5487
|
+
wrapAction(async (opts) => {
|
|
5488
|
+
const config = loadConfig();
|
|
5489
|
+
const templates = await listTemplates(config);
|
|
5490
|
+
if (shouldOutputJson(opts.json ?? false)) {
|
|
5491
|
+
console.log(JSON.stringify(templates, null, 2));
|
|
5492
|
+
} else if (isTTY()) {
|
|
5493
|
+
console.log(formatTemplates(templates));
|
|
5494
|
+
} else {
|
|
5495
|
+
console.log(formatTemplatesMarkdown(templates));
|
|
5496
|
+
}
|
|
5497
|
+
})
|
|
5498
|
+
);
|
|
5499
|
+
const configCmd = program.command("config").description("Manage CLI configuration");
|
|
5500
|
+
configCmd.command("get <key>").description("Print a config value").action(
|
|
5501
|
+
wrapAction(async (key) => {
|
|
5502
|
+
const value = getConfigValue(key);
|
|
5503
|
+
if (value !== void 0) {
|
|
5504
|
+
console.log(value);
|
|
5505
|
+
}
|
|
5506
|
+
})
|
|
5507
|
+
);
|
|
5508
|
+
configCmd.command("set <key> <value>").description("Set a config value").action(
|
|
5509
|
+
wrapAction(async (key, value) => {
|
|
5510
|
+
setConfigValue(key, value);
|
|
5511
|
+
})
|
|
5512
|
+
);
|
|
5513
|
+
configCmd.command("path").description("Print config file path").action(
|
|
5514
|
+
wrapAction(async () => {
|
|
5515
|
+
console.log(configPath2());
|
|
5516
|
+
})
|
|
5517
|
+
);
|
|
5518
|
+
program.command("completion <shell>").description("Output shell completion script (bash, zsh, fish)").action(
|
|
5519
|
+
wrapAction(async (shell) => {
|
|
5520
|
+
const script = generateCompletion(shell, programName);
|
|
5521
|
+
process.stdout.write(script);
|
|
5522
|
+
})
|
|
5523
|
+
);
|
|
5524
|
+
return program;
|
|
5525
|
+
}
|
|
5526
|
+
async function run(argv = process.argv) {
|
|
5527
|
+
const programName = basename(argv[1] ?? "cup");
|
|
5528
|
+
const program = buildProgram(programName);
|
|
5529
|
+
await program.parseAsync(argv);
|
|
5530
|
+
}
|
|
5141
5531
|
process.on("SIGINT", () => {
|
|
5142
5532
|
process.stderr.write("\nInterrupted\n");
|
|
5143
5533
|
process.exit(130);
|
|
5144
5534
|
});
|
|
5145
|
-
|
|
5535
|
+
var isDirectExecution = process.argv[1] !== void 0 && fileURLToPath(import.meta.url) === resolve(process.argv[1]);
|
|
5536
|
+
if (isDirectExecution) {
|
|
5537
|
+
await run();
|
|
5538
|
+
}
|
|
5539
|
+
export {
|
|
5540
|
+
buildProgram,
|
|
5541
|
+
run
|
|
5542
|
+
};
|