@dypt/cli 0.1.13 → 0.1.15
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/dist/index.js +431 -184
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { Argument, Command, Option } from "commander";
|
|
|
9
9
|
// package.json
|
|
10
10
|
var package_default = {
|
|
11
11
|
name: "@dypt/cli",
|
|
12
|
-
version: "0.1.
|
|
12
|
+
version: "0.1.15",
|
|
13
13
|
description: "Command-line interface for dypt task management",
|
|
14
14
|
license: "SEE LICENSE IN LICENSE",
|
|
15
15
|
homepage: "https://dypt.app",
|
|
@@ -64,7 +64,7 @@ function getConfigDir() {
|
|
|
64
64
|
}
|
|
65
65
|
function getScopedTokenFilePath(baseUrl) {
|
|
66
66
|
const url = new URL(baseUrl);
|
|
67
|
-
const scope = `${url.hostname}${url.port ? `-${url.port}` : ""}`.replace(/[^a-zA-Z0-9.-]/g, "-").toLowerCase();
|
|
67
|
+
const scope = `${url.protocol.slice(0, -1)}-${url.hostname}${url.port ? `-${url.port}` : ""}`.replace(/[^a-zA-Z0-9.-]/g, "-").toLowerCase();
|
|
68
68
|
return path.join(getConfigDir(), "tokens", `${scope}.json`);
|
|
69
69
|
}
|
|
70
70
|
function getBaseUrl() {
|
|
@@ -86,9 +86,21 @@ var MACOS_ACCOUNT_NAME_PREFIX = "dypt-cli";
|
|
|
86
86
|
function isMissingFileError(error) {
|
|
87
87
|
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
88
88
|
}
|
|
89
|
+
function isMissingKeychainItemError(error) {
|
|
90
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === 44;
|
|
91
|
+
}
|
|
89
92
|
async function ensureParentDirectory(filePath) {
|
|
90
93
|
await mkdir(path2.dirname(filePath), { recursive: true });
|
|
91
94
|
}
|
|
95
|
+
async function removeFallbackTokenFile(filePath) {
|
|
96
|
+
try {
|
|
97
|
+
await rm(filePath);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
if (!isMissingFileError(error)) {
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
92
104
|
function getCredentialScope(baseUrl = getBaseUrl()) {
|
|
93
105
|
const url = new URL(baseUrl);
|
|
94
106
|
return `${url.protocol}//${url.host}`;
|
|
@@ -146,7 +158,7 @@ async function saveMacOsKeychainToken(accessToken, expiresAt, baseUrl) {
|
|
|
146
158
|
}
|
|
147
159
|
async function clearMacOsKeychainToken(baseUrl) {
|
|
148
160
|
if (process.platform !== "darwin") {
|
|
149
|
-
return
|
|
161
|
+
return;
|
|
150
162
|
}
|
|
151
163
|
try {
|
|
152
164
|
await execFileAsync("security", [
|
|
@@ -156,9 +168,10 @@ async function clearMacOsKeychainToken(baseUrl) {
|
|
|
156
168
|
"-s",
|
|
157
169
|
getMacOsServiceName(baseUrl)
|
|
158
170
|
]);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
171
|
+
} catch (error) {
|
|
172
|
+
if (!isMissingKeychainItemError(error)) {
|
|
173
|
+
throw error;
|
|
174
|
+
}
|
|
162
175
|
}
|
|
163
176
|
}
|
|
164
177
|
async function readCliToken(baseUrl = getBaseUrl(), filePath = getScopedTokenFilePath(baseUrl)) {
|
|
@@ -190,6 +203,7 @@ async function saveCliToken(accessToken, expiresAt, baseUrl = getBaseUrl(), file
|
|
|
190
203
|
baseUrl
|
|
191
204
|
);
|
|
192
205
|
if (wroteToKeychain) {
|
|
206
|
+
await removeFallbackTokenFile(filePath);
|
|
193
207
|
return;
|
|
194
208
|
}
|
|
195
209
|
await ensureParentDirectory(filePath);
|
|
@@ -203,24 +217,30 @@ async function saveCliToken(accessToken, expiresAt, baseUrl = getBaseUrl(), file
|
|
|
203
217
|
);
|
|
204
218
|
}
|
|
205
219
|
async function clearCliToken(baseUrl = getBaseUrl(), filePath = getScopedTokenFilePath(baseUrl)) {
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
220
|
+
const cleanupErrors = [];
|
|
221
|
+
try {
|
|
222
|
+
await clearMacOsKeychainToken(baseUrl);
|
|
223
|
+
} catch (error) {
|
|
224
|
+
cleanupErrors.push(error);
|
|
209
225
|
}
|
|
210
226
|
try {
|
|
211
|
-
await
|
|
227
|
+
await removeFallbackTokenFile(filePath);
|
|
212
228
|
} catch (error) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
229
|
+
cleanupErrors.push(error);
|
|
230
|
+
}
|
|
231
|
+
if (cleanupErrors.length === 1) {
|
|
232
|
+
throw cleanupErrors[0];
|
|
233
|
+
}
|
|
234
|
+
if (cleanupErrors.length > 1) {
|
|
235
|
+
throw new AggregateError(
|
|
236
|
+
cleanupErrors,
|
|
237
|
+
"Could not clear all stored CLI credentials"
|
|
238
|
+
);
|
|
216
239
|
}
|
|
217
240
|
}
|
|
218
241
|
|
|
219
242
|
// src/lib/trpc.ts
|
|
220
|
-
import {
|
|
221
|
-
createTRPCProxyClient,
|
|
222
|
-
httpBatchLink
|
|
223
|
-
} from "@trpc/client";
|
|
243
|
+
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";
|
|
224
244
|
import superjson from "superjson";
|
|
225
245
|
function resolveBaseUrl(baseUrl) {
|
|
226
246
|
return (baseUrl ?? getBaseUrl()).replace(/\/$/, "");
|
|
@@ -234,10 +254,7 @@ async function resolveAccessToken(baseUrl, getAccessToken) {
|
|
|
234
254
|
}
|
|
235
255
|
async function createCliTrpcClient(options = {}) {
|
|
236
256
|
const baseUrl = resolveBaseUrl(options.baseUrl);
|
|
237
|
-
const accessToken = await resolveAccessToken(
|
|
238
|
-
baseUrl,
|
|
239
|
-
options.getAccessToken
|
|
240
|
-
);
|
|
257
|
+
const accessToken = await resolveAccessToken(baseUrl, options.getAccessToken);
|
|
241
258
|
return createTRPCProxyClient({
|
|
242
259
|
links: [
|
|
243
260
|
httpBatchLink({
|
|
@@ -266,7 +283,11 @@ async function postJson(path4, body, options = {}) {
|
|
|
266
283
|
};
|
|
267
284
|
}
|
|
268
285
|
async function startDeviceAuth(label, options = {}) {
|
|
269
|
-
const response = await postJson(
|
|
286
|
+
const response = await postJson(
|
|
287
|
+
"/api/cli/auth/device-code",
|
|
288
|
+
{ label },
|
|
289
|
+
options
|
|
290
|
+
);
|
|
270
291
|
if (response.status >= 400) {
|
|
271
292
|
throw new Error(response.json.error ?? "CLI_DEVICE_AUTH_START_FAILED");
|
|
272
293
|
}
|
|
@@ -322,7 +343,14 @@ async function createCliApi(options = {}) {
|
|
|
322
343
|
listReminders: (input) => cliClient.cli.v1.reminders.list.query(input),
|
|
323
344
|
addReminders: (input) => cliClient.cli.v1.reminders.add.mutate(input),
|
|
324
345
|
setReminders: (input) => cliClient.cli.v1.reminders.set.mutate(input),
|
|
325
|
-
removeReminder: (input) => cliClient.cli.v1.reminders.remove.mutate(input)
|
|
346
|
+
removeReminder: (input) => cliClient.cli.v1.reminders.remove.mutate(input),
|
|
347
|
+
listTags: (input) => cliClient.cli.v1.tags.list.query(input),
|
|
348
|
+
createTag: (input) => cliClient.cli.v1.tags.create.mutate(input),
|
|
349
|
+
updateTag: (input) => cliClient.cli.v1.tags.update.mutate(input),
|
|
350
|
+
deleteTag: (input) => cliClient.cli.v1.tags.delete.mutate(input),
|
|
351
|
+
mergeTag: (input) => cliClient.cli.v1.tags.merge.mutate(input),
|
|
352
|
+
getTaskTags: (input) => cliClient.cli.v1.tags.forTask.query(input),
|
|
353
|
+
assignTaskTags: (input) => cliClient.cli.v1.tags.assign.mutate(input)
|
|
326
354
|
};
|
|
327
355
|
}
|
|
328
356
|
|
|
@@ -1022,7 +1050,8 @@ async function runTaskCreate(input, deps) {
|
|
|
1022
1050
|
deadline: input.deadline,
|
|
1023
1051
|
expectedTimeTaken: input.expectedTimeTaken,
|
|
1024
1052
|
note: input.note,
|
|
1025
|
-
timeBeforeDeadline: input.timeBeforeDeadline
|
|
1053
|
+
...input.timeBeforeDeadline !== void 0 ? { timeBeforeDeadline: input.timeBeforeDeadline } : {},
|
|
1054
|
+
...input.tagPublicIds?.length ? { tagPublicIds: input.tagPublicIds } : {}
|
|
1026
1055
|
});
|
|
1027
1056
|
if (input.json) {
|
|
1028
1057
|
deps.printJson(result);
|
|
@@ -1106,7 +1135,9 @@ async function runTaskList(input, deps) {
|
|
|
1106
1135
|
actualTimeTo: input.actualTimeTo,
|
|
1107
1136
|
showPath: input.showPath,
|
|
1108
1137
|
limit: input.limit ?? "50",
|
|
1109
|
-
cursor: input.cursor
|
|
1138
|
+
cursor: input.cursor,
|
|
1139
|
+
tag: input.tag,
|
|
1140
|
+
tagMode: input.tagMode
|
|
1110
1141
|
});
|
|
1111
1142
|
if (input.json) {
|
|
1112
1143
|
deps.printJson(result);
|
|
@@ -1461,6 +1492,47 @@ async function runTaskCleanupPreview(input, deps) {
|
|
|
1461
1492
|
deps.printTable(result);
|
|
1462
1493
|
}
|
|
1463
1494
|
|
|
1495
|
+
// src/commands/tag/tag.ts
|
|
1496
|
+
function print(result, json, deps) {
|
|
1497
|
+
if (json) deps.printJson(result);
|
|
1498
|
+
else deps.printTable(result);
|
|
1499
|
+
}
|
|
1500
|
+
async function runTagList(input, deps) {
|
|
1501
|
+
const result = await deps.listTags({
|
|
1502
|
+
query: input.query,
|
|
1503
|
+
includeArchived: input.includeArchived
|
|
1504
|
+
});
|
|
1505
|
+
print(result, input.json, deps);
|
|
1506
|
+
}
|
|
1507
|
+
async function runTagCreate(input, deps) {
|
|
1508
|
+
const result = await deps.createTag({
|
|
1509
|
+
name: input.name,
|
|
1510
|
+
colour: input.colour
|
|
1511
|
+
});
|
|
1512
|
+
print(result, input.json, deps);
|
|
1513
|
+
}
|
|
1514
|
+
async function runTagUpdate(input, deps) {
|
|
1515
|
+
const { json, ...mutation } = input;
|
|
1516
|
+
print(await deps.updateTag(mutation), json, deps);
|
|
1517
|
+
}
|
|
1518
|
+
async function runTagDelete(input, deps) {
|
|
1519
|
+
print(
|
|
1520
|
+
await deps.deleteTag({ tagPublicId: input.tagPublicId }),
|
|
1521
|
+
input.json,
|
|
1522
|
+
deps
|
|
1523
|
+
);
|
|
1524
|
+
}
|
|
1525
|
+
async function runTagMerge(input, deps) {
|
|
1526
|
+
print(
|
|
1527
|
+
await deps.mergeTag({
|
|
1528
|
+
sourceTagPublicId: input.sourceTagPublicId,
|
|
1529
|
+
destinationTagPublicId: input.destinationTagPublicId
|
|
1530
|
+
}),
|
|
1531
|
+
input.json,
|
|
1532
|
+
deps
|
|
1533
|
+
);
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1464
1536
|
// src/lib/banner.ts
|
|
1465
1537
|
var BANNER_LINES = [
|
|
1466
1538
|
" _ _ ",
|
|
@@ -2467,14 +2539,22 @@ async function confirmAction(message, deps = {}) {
|
|
|
2467
2539
|
|
|
2468
2540
|
// src/index.ts
|
|
2469
2541
|
var cliVersion = package_default.version;
|
|
2470
|
-
var taskStatusChoices = [
|
|
2471
|
-
"not started",
|
|
2472
|
-
"in progress",
|
|
2473
|
-
"completed"
|
|
2474
|
-
];
|
|
2542
|
+
var taskStatusChoices = ["not started", "in progress", "completed"];
|
|
2475
2543
|
var taskPriorityChoices = ["low", "mid", "medium", "high"];
|
|
2476
2544
|
var agentTargetChoices = ["codex", "claude"];
|
|
2477
2545
|
var agentSourceChoices = ["github-release", "github-main", "local"];
|
|
2546
|
+
var tagColourChoices = [
|
|
2547
|
+
"gray",
|
|
2548
|
+
"red",
|
|
2549
|
+
"orange",
|
|
2550
|
+
"amber",
|
|
2551
|
+
"green",
|
|
2552
|
+
"teal",
|
|
2553
|
+
"blue",
|
|
2554
|
+
"indigo",
|
|
2555
|
+
"violet",
|
|
2556
|
+
"pink"
|
|
2557
|
+
];
|
|
2478
2558
|
function normalizePriority(priority) {
|
|
2479
2559
|
if (!priority) return void 0;
|
|
2480
2560
|
if (priority === "medium") return "mid";
|
|
@@ -2511,7 +2591,9 @@ function parseIntegerOption(value, label, minimum = 0, maximum) {
|
|
|
2511
2591
|
throw new Error(`${label} must be an integer >= ${minimum}`);
|
|
2512
2592
|
}
|
|
2513
2593
|
if (maximum !== void 0 && parsed > maximum) {
|
|
2514
|
-
throw new Error(
|
|
2594
|
+
throw new Error(
|
|
2595
|
+
`${label} must be an integer between ${minimum} and ${maximum}`
|
|
2596
|
+
);
|
|
2515
2597
|
}
|
|
2516
2598
|
return parsed;
|
|
2517
2599
|
}
|
|
@@ -2577,8 +2659,10 @@ function resolveTaskRefFromSearchMatches(ref, matches) {
|
|
|
2577
2659
|
const path4 = task.pathTitles?.join(" > ") ?? [task.parentTitle, task.title].filter(Boolean).join(" > ") ?? task.title;
|
|
2578
2660
|
return `- #${task.id} ${path4}`;
|
|
2579
2661
|
}).join("\n");
|
|
2580
|
-
throw new Error(
|
|
2581
|
-
${
|
|
2662
|
+
throw new Error(
|
|
2663
|
+
`Task reference is ambiguous: ${ref}
|
|
2664
|
+
${formattedMatches}`
|
|
2665
|
+
);
|
|
2582
2666
|
}
|
|
2583
2667
|
}
|
|
2584
2668
|
const normalizedRef = ref.trim().toLocaleLowerCase();
|
|
@@ -2743,6 +2827,132 @@ function buildCli() {
|
|
|
2743
2827
|
);
|
|
2744
2828
|
}
|
|
2745
2829
|
);
|
|
2830
|
+
const tag = addGroupHelpAction(
|
|
2831
|
+
program.command("tag").description("Tag commands")
|
|
2832
|
+
);
|
|
2833
|
+
tag.command("list").option("--query <text>", "filter tags by name").option("--archived", "include archived tags").option("--json", "print JSON output").action(
|
|
2834
|
+
async (options) => runTagList(
|
|
2835
|
+
{
|
|
2836
|
+
query: options.query,
|
|
2837
|
+
includeArchived: Boolean(options.archived),
|
|
2838
|
+
json: Boolean(options.json)
|
|
2839
|
+
},
|
|
2840
|
+
{
|
|
2841
|
+
listTags: (input) => withCliApi((api) => api.listTags(input)),
|
|
2842
|
+
printJson,
|
|
2843
|
+
printTable
|
|
2844
|
+
}
|
|
2845
|
+
)
|
|
2846
|
+
);
|
|
2847
|
+
tag.command("create").argument("<name>").addOption(
|
|
2848
|
+
new Option("--colour <colour>", "tag colour").choices([...tagColourChoices]).default("gray")
|
|
2849
|
+
).option("--json", "print JSON output").action(
|
|
2850
|
+
async (name, options) => runTagCreate(
|
|
2851
|
+
{ name, colour: options.colour, json: Boolean(options.json) },
|
|
2852
|
+
{
|
|
2853
|
+
createTag: (input) => withCliApi((api) => api.createTag(input)),
|
|
2854
|
+
printJson,
|
|
2855
|
+
printTable
|
|
2856
|
+
}
|
|
2857
|
+
)
|
|
2858
|
+
);
|
|
2859
|
+
tag.command("update").argument("<tag-id>").option("--name <name>", "new tag name").addOption(
|
|
2860
|
+
new Option("--colour <colour>", "new tag colour").choices([
|
|
2861
|
+
...tagColourChoices
|
|
2862
|
+
])
|
|
2863
|
+
).option("--archive", "archive the tag").option("--restore", "restore the tag").option("--json", "print JSON output").action(
|
|
2864
|
+
async (tagPublicId, options) => {
|
|
2865
|
+
if (options.archive && options.restore)
|
|
2866
|
+
throw new Error("Choose either --archive or --restore.");
|
|
2867
|
+
await runTagUpdate(
|
|
2868
|
+
{
|
|
2869
|
+
tagPublicId,
|
|
2870
|
+
name: options.name,
|
|
2871
|
+
colour: options.colour,
|
|
2872
|
+
archived: options.archive ? true : options.restore ? false : void 0,
|
|
2873
|
+
json: Boolean(options.json)
|
|
2874
|
+
},
|
|
2875
|
+
{
|
|
2876
|
+
updateTag: (input) => withCliApi((api) => api.updateTag(input)),
|
|
2877
|
+
printJson,
|
|
2878
|
+
printTable
|
|
2879
|
+
}
|
|
2880
|
+
);
|
|
2881
|
+
}
|
|
2882
|
+
);
|
|
2883
|
+
tag.command("assign").argument("<task-refs...>").option(
|
|
2884
|
+
"--tag <name>",
|
|
2885
|
+
"existing tag name; repeat to assign multiple",
|
|
2886
|
+
(value, values = []) => [...values, value]
|
|
2887
|
+
).option("--clear", "remove all tags from the task").option("--json", "print JSON output").action(
|
|
2888
|
+
async (taskRefs, options) => {
|
|
2889
|
+
if (!options.clear && !options.tag?.length)
|
|
2890
|
+
throw new Error("Provide at least one --tag or use --clear.");
|
|
2891
|
+
await withCliApi(async (api) => {
|
|
2892
|
+
const taskIds = await Promise.all(
|
|
2893
|
+
taskRefs.map((taskRef) => resolveTaskId(api, taskRef))
|
|
2894
|
+
);
|
|
2895
|
+
const catalogue = await api.listTags({});
|
|
2896
|
+
const requested = (options.tag ?? []).map(
|
|
2897
|
+
(name) => name.trim().replace(/\s+/g, " ").toLowerCase()
|
|
2898
|
+
);
|
|
2899
|
+
const matched = requested.map(
|
|
2900
|
+
(name) => catalogue.find((tag2) => tag2.name === name)
|
|
2901
|
+
);
|
|
2902
|
+
if (matched.some((item) => !item))
|
|
2903
|
+
throw new Error(
|
|
2904
|
+
"Every --tag must name an existing tag. Use `dypt tag create` first."
|
|
2905
|
+
);
|
|
2906
|
+
const tagPublicIds = options.clear ? [] : matched.map((item) => item.publicId);
|
|
2907
|
+
const results = await Promise.all(
|
|
2908
|
+
taskIds.map(
|
|
2909
|
+
(taskId) => api.assignTaskTags({ taskId, tagPublicIds })
|
|
2910
|
+
)
|
|
2911
|
+
);
|
|
2912
|
+
const output = results.length === 1 ? results[0] : results;
|
|
2913
|
+
if (options.json) printJson(output);
|
|
2914
|
+
else printTable(output);
|
|
2915
|
+
});
|
|
2916
|
+
}
|
|
2917
|
+
);
|
|
2918
|
+
tag.command("merge").description("Merge a source tag into an active destination tag").argument("<source-tag-id>").argument("<destination-tag-id>").option("--yes", "confirm assignment transfer and source deletion").option("--json", "print JSON output").action(
|
|
2919
|
+
async (sourceTagPublicId, destinationTagPublicId, options) => {
|
|
2920
|
+
if (!options.yes) {
|
|
2921
|
+
throw new Error(
|
|
2922
|
+
"Merging transfers every assignment and permanently deletes the source tag. Re-run with --yes."
|
|
2923
|
+
);
|
|
2924
|
+
}
|
|
2925
|
+
await runTagMerge(
|
|
2926
|
+
{
|
|
2927
|
+
sourceTagPublicId,
|
|
2928
|
+
destinationTagPublicId,
|
|
2929
|
+
json: Boolean(options.json)
|
|
2930
|
+
},
|
|
2931
|
+
{
|
|
2932
|
+
mergeTag: (input) => withCliApi((api) => api.mergeTag(input)),
|
|
2933
|
+
printJson,
|
|
2934
|
+
printTable
|
|
2935
|
+
}
|
|
2936
|
+
);
|
|
2937
|
+
}
|
|
2938
|
+
);
|
|
2939
|
+
tag.command("delete").argument("<tag-id>").option("--yes", "confirm permanent deletion").option("--json", "print JSON output").action(
|
|
2940
|
+
async (tagPublicId, options) => {
|
|
2941
|
+
if (!options.yes) {
|
|
2942
|
+
throw new Error(
|
|
2943
|
+
"Permanent tag deletion removes every assignment. Re-run with --yes."
|
|
2944
|
+
);
|
|
2945
|
+
}
|
|
2946
|
+
await runTagDelete(
|
|
2947
|
+
{ tagPublicId, json: Boolean(options.json) },
|
|
2948
|
+
{
|
|
2949
|
+
deleteTag: (input) => withCliApi((api) => api.deleteTag(input)),
|
|
2950
|
+
printJson,
|
|
2951
|
+
printTable
|
|
2952
|
+
}
|
|
2953
|
+
);
|
|
2954
|
+
}
|
|
2955
|
+
);
|
|
2746
2956
|
const task = addGroupHelpAction(
|
|
2747
2957
|
program.command("task").description("Task commands")
|
|
2748
2958
|
);
|
|
@@ -2796,7 +3006,13 @@ function buildCli() {
|
|
|
2796
3006
|
"--priority <priority>",
|
|
2797
3007
|
`task priority (${taskPriorityChoices.join("|")})`
|
|
2798
3008
|
).choices([...taskPriorityChoices])
|
|
2799
|
-
).option("--leaves", "only show leaf tasks").option("--blocked <mode>", "show, hide, or only blocked tasks").option("--blocking <mode>", "show, hide, or only blocking tasks").option("--title-contains <text>", "filter titles by substring").option("--deadline-from <iso>", "inclusive deadline start").option("--deadline-to <iso>", "inclusive deadline end").option("--created-from <iso>", "inclusive created-at start").option("--created-to <iso>", "inclusive created-at end").option("--expected-time-from <minutes>", "minimum expected time").option("--expected-time-to <minutes>", "maximum expected time").option("--actual-time-from <minutes>", "minimum actual time").option("--actual-time-to <minutes>", "maximum actual time").option("--parent <ref>", "only include direct children of the given task").option("--scope <ref>", "only include descendants of the given task").option("--show-path", "show task path context in list output").option(
|
|
3009
|
+
).option("--leaves", "only show leaf tasks").option("--blocked <mode>", "show, hide, or only blocked tasks").option("--blocking <mode>", "show, hide, or only blocking tasks").option("--title-contains <text>", "filter titles by substring").option("--deadline-from <iso>", "inclusive deadline start").option("--deadline-to <iso>", "inclusive deadline end").option("--created-from <iso>", "inclusive created-at start").option("--created-to <iso>", "inclusive created-at end").option("--expected-time-from <minutes>", "minimum expected time").option("--expected-time-to <minutes>", "maximum expected time").option("--actual-time-from <minutes>", "minimum actual time").option("--actual-time-to <minutes>", "maximum actual time").option("--parent <ref>", "only include direct children of the given task").option("--scope <ref>", "only include descendants of the given task").option("--show-path", "show task path context in list output").option(
|
|
3010
|
+
"--tag <name>",
|
|
3011
|
+
"filter by tag; repeat for multiple tags",
|
|
3012
|
+
(value, values = []) => [...values, value]
|
|
3013
|
+
).addOption(
|
|
3014
|
+
new Option("--tag-mode <mode>", "match any or all selected tags").choices(["any", "all"]).default("any")
|
|
3015
|
+
).option("--limit <n>", "page size (1-100, default: 50)").option("--cursor <id>", "cursor task id for pagination").option("--json", "print JSON output").addHelpText(
|
|
2800
3016
|
"after",
|
|
2801
3017
|
[
|
|
2802
3018
|
"",
|
|
@@ -2807,82 +3023,88 @@ function buildCli() {
|
|
|
2807
3023
|
" pnpm cli task list --show-path --title-contains dypt",
|
|
2808
3024
|
" pnpm cli task list --cursor 119"
|
|
2809
3025
|
].join("\n")
|
|
2810
|
-
).action(
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
input.
|
|
2856
|
-
"
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
3026
|
+
).action(
|
|
3027
|
+
async (options) => {
|
|
3028
|
+
assertExclusiveHierarchyOptions(options.parent, options.scope);
|
|
3029
|
+
await runTaskList(
|
|
3030
|
+
{
|
|
3031
|
+
archived: options.archived,
|
|
3032
|
+
status: options.status,
|
|
3033
|
+
priority: options.priority,
|
|
3034
|
+
leaves: Boolean(options.leaves),
|
|
3035
|
+
blocked: options.blocked,
|
|
3036
|
+
blocking: options.blocking,
|
|
3037
|
+
titleContains: options.titleContains,
|
|
3038
|
+
deadlineFrom: options.deadlineFrom,
|
|
3039
|
+
deadlineTo: options.deadlineTo,
|
|
3040
|
+
createdFrom: options.createdFrom,
|
|
3041
|
+
createdTo: options.createdTo,
|
|
3042
|
+
expectedTimeFrom: options.expectedTimeFrom,
|
|
3043
|
+
expectedTimeTo: options.expectedTimeTo,
|
|
3044
|
+
actualTimeFrom: options.actualTimeFrom,
|
|
3045
|
+
actualTimeTo: options.actualTimeTo,
|
|
3046
|
+
parent: options.parent,
|
|
3047
|
+
scope: options.scope,
|
|
3048
|
+
showPath: Boolean(options.showPath),
|
|
3049
|
+
limit: options.limit,
|
|
3050
|
+
cursor: options.cursor,
|
|
3051
|
+
tag: options.tag,
|
|
3052
|
+
tagMode: options.tagMode,
|
|
3053
|
+
json: Boolean(options.json)
|
|
3054
|
+
},
|
|
3055
|
+
{
|
|
3056
|
+
listTasks: (input) => withCliApi(async (api) => {
|
|
3057
|
+
const parentTaskId = input.parent ? await resolveTaskId(api, input.parent) : void 0;
|
|
3058
|
+
const scopeTaskId = input.scope ? await resolveTaskId(api, input.scope) : void 0;
|
|
3059
|
+
return api.listTasks({
|
|
3060
|
+
archived: normalizeArchivedMode(input.archived),
|
|
3061
|
+
parentTaskId,
|
|
3062
|
+
scopeTaskId,
|
|
3063
|
+
status: normalizeStatus(input.status),
|
|
3064
|
+
priority: normalizePriority(input.priority),
|
|
3065
|
+
leaves: input.leaves,
|
|
3066
|
+
blocked: normalizeFilterMode(input.blocked),
|
|
3067
|
+
blocking: normalizeFilterMode(input.blocking),
|
|
3068
|
+
titleContains: input.titleContains,
|
|
3069
|
+
deadlineFrom: parseDateOption(input.deadlineFrom, "start"),
|
|
3070
|
+
deadlineTo: parseDateOption(input.deadlineTo, "end"),
|
|
3071
|
+
createdFrom: parseDateOption(input.createdFrom, "start"),
|
|
3072
|
+
createdTo: parseDateOption(input.createdTo, "end"),
|
|
3073
|
+
expectedTimeFrom: parseIntegerOption(
|
|
3074
|
+
input.expectedTimeFrom,
|
|
3075
|
+
"expected-time-from",
|
|
3076
|
+
0
|
|
3077
|
+
),
|
|
3078
|
+
expectedTimeTo: parseIntegerOption(
|
|
3079
|
+
input.expectedTimeTo,
|
|
3080
|
+
"expected-time-to",
|
|
3081
|
+
0
|
|
3082
|
+
),
|
|
3083
|
+
actualTimeFrom: parseIntegerOption(
|
|
3084
|
+
input.actualTimeFrom,
|
|
3085
|
+
"actual-time-from",
|
|
3086
|
+
0
|
|
3087
|
+
),
|
|
3088
|
+
actualTimeTo: parseIntegerOption(
|
|
3089
|
+
input.actualTimeTo,
|
|
3090
|
+
"actual-time-to",
|
|
3091
|
+
0
|
|
3092
|
+
),
|
|
3093
|
+
showPath: input.showPath,
|
|
3094
|
+
tagNames: input.tag,
|
|
3095
|
+
tagMode: input.tagMode === "all" ? "all" : "any",
|
|
3096
|
+
limit: parseIntegerOption(input.limit, "limit", 1, 100),
|
|
3097
|
+
cursor: input.cursor ? {
|
|
3098
|
+
id: parseIntegerOption(input.cursor, "cursor", 1)
|
|
3099
|
+
} : void 0
|
|
3100
|
+
});
|
|
3101
|
+
}),
|
|
3102
|
+
printJson,
|
|
3103
|
+
printTable
|
|
3104
|
+
}
|
|
3105
|
+
);
|
|
3106
|
+
}
|
|
3107
|
+
);
|
|
2886
3108
|
task.command("search").argument("<query>").option("--parent <ref>", "only search direct children of the given task").option("--scope <ref>", "only search descendants of the given task").option("--limit <n>", "page size (1-100, default: 20)").option("--cursor-score <score>", "pagination cursor score").option("--cursor-id <id>", "pagination cursor task id").option("--json", "print JSON output").addHelpText(
|
|
2887
3109
|
"after",
|
|
2888
3110
|
[
|
|
@@ -2894,50 +3116,52 @@ function buildCli() {
|
|
|
2894
3116
|
" pnpm cli task search dypt --limit 8",
|
|
2895
3117
|
" pnpm cli task search dypt --cursor-score 1 --cursor-id 45877 --limit 8"
|
|
2896
3118
|
].join("\n")
|
|
2897
|
-
).action(
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
3119
|
+
).action(
|
|
3120
|
+
async (query, options) => {
|
|
3121
|
+
assertExclusiveHierarchyOptions(options.parent, options.scope);
|
|
3122
|
+
if (options.cursorScore && !options.cursorId || options.cursorId && !options.cursorScore) {
|
|
3123
|
+
throw new Error(
|
|
3124
|
+
"Both --cursor-score and --cursor-id are required together"
|
|
3125
|
+
);
|
|
3126
|
+
}
|
|
3127
|
+
await runTaskSearch(
|
|
3128
|
+
{
|
|
3129
|
+
query,
|
|
3130
|
+
parent: options.parent,
|
|
3131
|
+
scope: options.scope,
|
|
3132
|
+
limit: options.limit,
|
|
3133
|
+
cursorScore: options.cursorScore,
|
|
3134
|
+
cursorId: options.cursorId,
|
|
3135
|
+
json: Boolean(options.json)
|
|
3136
|
+
},
|
|
3137
|
+
{
|
|
3138
|
+
searchTasks: (input) => withCliApi(async (api) => {
|
|
3139
|
+
const parentTaskId = input.parent ? await resolveTaskId(api, input.parent) : void 0;
|
|
3140
|
+
const scopeTaskId = input.scope ? await resolveTaskId(api, input.scope) : void 0;
|
|
3141
|
+
return api.searchTasks({
|
|
3142
|
+
query: input.query,
|
|
3143
|
+
parentTaskId,
|
|
3144
|
+
scopeTaskId,
|
|
3145
|
+
limit: parseIntegerOption(input.limit, "limit", 1, 100),
|
|
3146
|
+
cursor: input.cursorScore || input.cursorId ? {
|
|
3147
|
+
score: parseNumberOption(
|
|
3148
|
+
input.cursorScore,
|
|
3149
|
+
"cursor-score"
|
|
3150
|
+
),
|
|
3151
|
+
id: parseIntegerOption(
|
|
3152
|
+
input.cursorId,
|
|
3153
|
+
"cursor-id",
|
|
3154
|
+
1
|
|
3155
|
+
)
|
|
3156
|
+
} : void 0
|
|
3157
|
+
});
|
|
3158
|
+
}),
|
|
3159
|
+
printJson,
|
|
3160
|
+
printTable
|
|
3161
|
+
}
|
|
2902
3162
|
);
|
|
2903
3163
|
}
|
|
2904
|
-
|
|
2905
|
-
{
|
|
2906
|
-
query,
|
|
2907
|
-
parent: options.parent,
|
|
2908
|
-
scope: options.scope,
|
|
2909
|
-
limit: options.limit,
|
|
2910
|
-
cursorScore: options.cursorScore,
|
|
2911
|
-
cursorId: options.cursorId,
|
|
2912
|
-
json: Boolean(options.json)
|
|
2913
|
-
},
|
|
2914
|
-
{
|
|
2915
|
-
searchTasks: (input) => withCliApi(async (api) => {
|
|
2916
|
-
const parentTaskId = input.parent ? await resolveTaskId(api, input.parent) : void 0;
|
|
2917
|
-
const scopeTaskId = input.scope ? await resolveTaskId(api, input.scope) : void 0;
|
|
2918
|
-
return api.searchTasks({
|
|
2919
|
-
query: input.query,
|
|
2920
|
-
parentTaskId,
|
|
2921
|
-
scopeTaskId,
|
|
2922
|
-
limit: parseIntegerOption(input.limit, "limit", 1, 100),
|
|
2923
|
-
cursor: input.cursorScore || input.cursorId ? {
|
|
2924
|
-
score: parseNumberOption(
|
|
2925
|
-
input.cursorScore,
|
|
2926
|
-
"cursor-score"
|
|
2927
|
-
),
|
|
2928
|
-
id: parseIntegerOption(
|
|
2929
|
-
input.cursorId,
|
|
2930
|
-
"cursor-id",
|
|
2931
|
-
1
|
|
2932
|
-
)
|
|
2933
|
-
} : void 0
|
|
2934
|
-
});
|
|
2935
|
-
}),
|
|
2936
|
-
printJson,
|
|
2937
|
-
printTable
|
|
2938
|
-
}
|
|
2939
|
-
);
|
|
2940
|
-
});
|
|
3164
|
+
);
|
|
2941
3165
|
task.command("tree").description(
|
|
2942
3166
|
"Show a task subtree; omit ref for root tasks (defaults to depth 2)"
|
|
2943
3167
|
).argument("[ref]", "task id or title; omit for root tasks").option("--json", "print JSON output").option("--depth <depth>", "limit subtree depth").option("--full", "show the full subtree without a default depth limit").action(
|
|
@@ -3089,9 +3313,7 @@ function buildCli() {
|
|
|
3089
3313
|
);
|
|
3090
3314
|
});
|
|
3091
3315
|
};
|
|
3092
|
-
addGroupHelpAction(
|
|
3093
|
-
task.command("note").description("Task note commands")
|
|
3094
|
-
);
|
|
3316
|
+
addGroupHelpAction(task.command("note").description("Task note commands"));
|
|
3095
3317
|
const taskNote = task.commands.find((command) => command.name() === "note");
|
|
3096
3318
|
if (taskNote) {
|
|
3097
3319
|
addTaskNoteCommands(taskNote);
|
|
@@ -3102,6 +3324,10 @@ function buildCli() {
|
|
|
3102
3324
|
`task priority (${taskPriorityChoices.join("|")})`
|
|
3103
3325
|
).choices([...taskPriorityChoices])
|
|
3104
3326
|
).option("--deadline <deadline>", "ISO deadline").option("--expected-time <minutes>", "expected minutes").option("--note <markdown>", "initial task note in Markdown").option(
|
|
3327
|
+
"--tag <name>",
|
|
3328
|
+
"existing tag name; repeat to assign multiple",
|
|
3329
|
+
(value, values = []) => [...values, value]
|
|
3330
|
+
).option(
|
|
3105
3331
|
"--reminder <timing>",
|
|
3106
3332
|
`create-time reminder (${reminderTimingTokens.join("|")}); repeat for up to 3 reminders`,
|
|
3107
3333
|
(timing, timings) => [
|
|
@@ -3127,15 +3353,29 @@ function buildCli() {
|
|
|
3127
3353
|
json: Boolean(options.json)
|
|
3128
3354
|
},
|
|
3129
3355
|
{
|
|
3130
|
-
createTask: (input) => withCliApi(
|
|
3131
|
-
|
|
3356
|
+
createTask: (input) => withCliApi(async (api) => {
|
|
3357
|
+
const requested = (options.tag ?? []).map(
|
|
3358
|
+
(name) => name.trim().replace(/\s+/g, " ").toLowerCase()
|
|
3359
|
+
);
|
|
3360
|
+
const catalogue = requested.length ? await api.listTags({}) : [];
|
|
3361
|
+
const matched = requested.map(
|
|
3362
|
+
(name) => catalogue.find((tag2) => tag2.name === name)
|
|
3363
|
+
);
|
|
3364
|
+
if (matched.some((item) => !item))
|
|
3365
|
+
throw new Error(
|
|
3366
|
+
"Every --tag must name an existing tag. Use `dypt tag create` first."
|
|
3367
|
+
);
|
|
3368
|
+
return api.createTask({
|
|
3132
3369
|
...input,
|
|
3370
|
+
...matched.length ? {
|
|
3371
|
+
tagPublicIds: matched.map((item) => item.publicId)
|
|
3372
|
+
} : {},
|
|
3133
3373
|
parentId: await resolveParentId(
|
|
3134
3374
|
options.parent,
|
|
3135
3375
|
(ref) => resolveTaskId(api, ref)
|
|
3136
3376
|
)
|
|
3137
|
-
})
|
|
3138
|
-
),
|
|
3377
|
+
});
|
|
3378
|
+
}),
|
|
3139
3379
|
printJson,
|
|
3140
3380
|
printTable
|
|
3141
3381
|
}
|
|
@@ -3162,30 +3402,32 @@ function buildCli() {
|
|
|
3162
3402
|
}
|
|
3163
3403
|
);
|
|
3164
3404
|
});
|
|
3165
|
-
task.command("delete-many").argument("<refs...>").option("--yes", "skip confirmation").option("--json", "print JSON output").action(
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
confirm: (message) => confirmAction(message, {
|
|
3405
|
+
task.command("delete-many").argument("<refs...>").option("--yes", "skip confirmation").option("--json", "print JSON output").action(
|
|
3406
|
+
async (refs, options) => {
|
|
3407
|
+
await runTaskDeleteMany(
|
|
3408
|
+
{
|
|
3409
|
+
refs,
|
|
3410
|
+
yes: Boolean(options.yes),
|
|
3411
|
+
json: Boolean(options.json)
|
|
3412
|
+
},
|
|
3413
|
+
{
|
|
3175
3414
|
isTty: Boolean(process.stdout.isTTY),
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3415
|
+
confirm: (message) => confirmAction(message, {
|
|
3416
|
+
isTty: Boolean(process.stdout.isTTY),
|
|
3417
|
+
readLine: promptLine
|
|
3418
|
+
}),
|
|
3419
|
+
deleteTasks: (taskRefs) => withCliApi(async (api) => {
|
|
3420
|
+
const taskIds = await Promise.all(
|
|
3421
|
+
taskRefs.map((ref) => resolveTaskId(api, ref))
|
|
3422
|
+
);
|
|
3423
|
+
return api.deleteTasks({ taskIds });
|
|
3424
|
+
}),
|
|
3425
|
+
printJson,
|
|
3426
|
+
printTable
|
|
3427
|
+
}
|
|
3428
|
+
);
|
|
3429
|
+
}
|
|
3430
|
+
);
|
|
3189
3431
|
task.command("update").argument("<ref>").option("--title <title>", "new title").addOption(
|
|
3190
3432
|
new Option(
|
|
3191
3433
|
"--status <status>",
|
|
@@ -3369,7 +3611,10 @@ function buildCli() {
|
|
|
3369
3611
|
);
|
|
3370
3612
|
}
|
|
3371
3613
|
);
|
|
3372
|
-
task.command("reorder").argument("<refs...>").option(
|
|
3614
|
+
task.command("reorder").argument("<refs...>").option(
|
|
3615
|
+
"--parent <ref>",
|
|
3616
|
+
'validate task order under the given parent or "root"'
|
|
3617
|
+
).option("--preview", "preview the reorder without mutating").option("--json", "print JSON output").action(
|
|
3373
3618
|
async (refs, options) => {
|
|
3374
3619
|
await runTaskReorder(
|
|
3375
3620
|
{
|
|
@@ -3418,7 +3663,9 @@ function buildCli() {
|
|
|
3418
3663
|
].join("\n")
|
|
3419
3664
|
)
|
|
3420
3665
|
);
|
|
3421
|
-
cleanup.command("relocate-and-collapse").description(
|
|
3666
|
+
cleanup.command("relocate-and-collapse").description(
|
|
3667
|
+
"Move surviving direct children out of a wrapper and collapse it if emptied"
|
|
3668
|
+
).requiredOption("--wrapper <ref>", "wrapper task to clean up").requiredOption("--tasks <refs...>", "surviving direct child tasks to move").requiredOption("--to <ref>", 'destination parent task or "root"').option("--preview", "preview the workflow without mutating (default)").option("--yes", "apply the workflow immediately").option("--json", "print JSON output").addHelpText(
|
|
3422
3669
|
"after",
|
|
3423
3670
|
[
|
|
3424
3671
|
"",
|