@dypt/cli 0.1.14 → 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 +396 -172
- 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",
|
|
@@ -240,10 +240,7 @@ async function clearCliToken(baseUrl = getBaseUrl(), filePath = getScopedTokenFi
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
// src/lib/trpc.ts
|
|
243
|
-
import {
|
|
244
|
-
createTRPCProxyClient,
|
|
245
|
-
httpBatchLink
|
|
246
|
-
} from "@trpc/client";
|
|
243
|
+
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";
|
|
247
244
|
import superjson from "superjson";
|
|
248
245
|
function resolveBaseUrl(baseUrl) {
|
|
249
246
|
return (baseUrl ?? getBaseUrl()).replace(/\/$/, "");
|
|
@@ -257,10 +254,7 @@ async function resolveAccessToken(baseUrl, getAccessToken) {
|
|
|
257
254
|
}
|
|
258
255
|
async function createCliTrpcClient(options = {}) {
|
|
259
256
|
const baseUrl = resolveBaseUrl(options.baseUrl);
|
|
260
|
-
const accessToken = await resolveAccessToken(
|
|
261
|
-
baseUrl,
|
|
262
|
-
options.getAccessToken
|
|
263
|
-
);
|
|
257
|
+
const accessToken = await resolveAccessToken(baseUrl, options.getAccessToken);
|
|
264
258
|
return createTRPCProxyClient({
|
|
265
259
|
links: [
|
|
266
260
|
httpBatchLink({
|
|
@@ -289,7 +283,11 @@ async function postJson(path4, body, options = {}) {
|
|
|
289
283
|
};
|
|
290
284
|
}
|
|
291
285
|
async function startDeviceAuth(label, options = {}) {
|
|
292
|
-
const response = await postJson(
|
|
286
|
+
const response = await postJson(
|
|
287
|
+
"/api/cli/auth/device-code",
|
|
288
|
+
{ label },
|
|
289
|
+
options
|
|
290
|
+
);
|
|
293
291
|
if (response.status >= 400) {
|
|
294
292
|
throw new Error(response.json.error ?? "CLI_DEVICE_AUTH_START_FAILED");
|
|
295
293
|
}
|
|
@@ -345,7 +343,14 @@ async function createCliApi(options = {}) {
|
|
|
345
343
|
listReminders: (input) => cliClient.cli.v1.reminders.list.query(input),
|
|
346
344
|
addReminders: (input) => cliClient.cli.v1.reminders.add.mutate(input),
|
|
347
345
|
setReminders: (input) => cliClient.cli.v1.reminders.set.mutate(input),
|
|
348
|
-
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)
|
|
349
354
|
};
|
|
350
355
|
}
|
|
351
356
|
|
|
@@ -1045,7 +1050,8 @@ async function runTaskCreate(input, deps) {
|
|
|
1045
1050
|
deadline: input.deadline,
|
|
1046
1051
|
expectedTimeTaken: input.expectedTimeTaken,
|
|
1047
1052
|
note: input.note,
|
|
1048
|
-
timeBeforeDeadline: input.timeBeforeDeadline
|
|
1053
|
+
...input.timeBeforeDeadline !== void 0 ? { timeBeforeDeadline: input.timeBeforeDeadline } : {},
|
|
1054
|
+
...input.tagPublicIds?.length ? { tagPublicIds: input.tagPublicIds } : {}
|
|
1049
1055
|
});
|
|
1050
1056
|
if (input.json) {
|
|
1051
1057
|
deps.printJson(result);
|
|
@@ -1129,7 +1135,9 @@ async function runTaskList(input, deps) {
|
|
|
1129
1135
|
actualTimeTo: input.actualTimeTo,
|
|
1130
1136
|
showPath: input.showPath,
|
|
1131
1137
|
limit: input.limit ?? "50",
|
|
1132
|
-
cursor: input.cursor
|
|
1138
|
+
cursor: input.cursor,
|
|
1139
|
+
tag: input.tag,
|
|
1140
|
+
tagMode: input.tagMode
|
|
1133
1141
|
});
|
|
1134
1142
|
if (input.json) {
|
|
1135
1143
|
deps.printJson(result);
|
|
@@ -1484,6 +1492,47 @@ async function runTaskCleanupPreview(input, deps) {
|
|
|
1484
1492
|
deps.printTable(result);
|
|
1485
1493
|
}
|
|
1486
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
|
+
|
|
1487
1536
|
// src/lib/banner.ts
|
|
1488
1537
|
var BANNER_LINES = [
|
|
1489
1538
|
" _ _ ",
|
|
@@ -2490,14 +2539,22 @@ async function confirmAction(message, deps = {}) {
|
|
|
2490
2539
|
|
|
2491
2540
|
// src/index.ts
|
|
2492
2541
|
var cliVersion = package_default.version;
|
|
2493
|
-
var taskStatusChoices = [
|
|
2494
|
-
"not started",
|
|
2495
|
-
"in progress",
|
|
2496
|
-
"completed"
|
|
2497
|
-
];
|
|
2542
|
+
var taskStatusChoices = ["not started", "in progress", "completed"];
|
|
2498
2543
|
var taskPriorityChoices = ["low", "mid", "medium", "high"];
|
|
2499
2544
|
var agentTargetChoices = ["codex", "claude"];
|
|
2500
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
|
+
];
|
|
2501
2558
|
function normalizePriority(priority) {
|
|
2502
2559
|
if (!priority) return void 0;
|
|
2503
2560
|
if (priority === "medium") return "mid";
|
|
@@ -2534,7 +2591,9 @@ function parseIntegerOption(value, label, minimum = 0, maximum) {
|
|
|
2534
2591
|
throw new Error(`${label} must be an integer >= ${minimum}`);
|
|
2535
2592
|
}
|
|
2536
2593
|
if (maximum !== void 0 && parsed > maximum) {
|
|
2537
|
-
throw new Error(
|
|
2594
|
+
throw new Error(
|
|
2595
|
+
`${label} must be an integer between ${minimum} and ${maximum}`
|
|
2596
|
+
);
|
|
2538
2597
|
}
|
|
2539
2598
|
return parsed;
|
|
2540
2599
|
}
|
|
@@ -2600,8 +2659,10 @@ function resolveTaskRefFromSearchMatches(ref, matches) {
|
|
|
2600
2659
|
const path4 = task.pathTitles?.join(" > ") ?? [task.parentTitle, task.title].filter(Boolean).join(" > ") ?? task.title;
|
|
2601
2660
|
return `- #${task.id} ${path4}`;
|
|
2602
2661
|
}).join("\n");
|
|
2603
|
-
throw new Error(
|
|
2604
|
-
${
|
|
2662
|
+
throw new Error(
|
|
2663
|
+
`Task reference is ambiguous: ${ref}
|
|
2664
|
+
${formattedMatches}`
|
|
2665
|
+
);
|
|
2605
2666
|
}
|
|
2606
2667
|
}
|
|
2607
2668
|
const normalizedRef = ref.trim().toLocaleLowerCase();
|
|
@@ -2766,6 +2827,132 @@ function buildCli() {
|
|
|
2766
2827
|
);
|
|
2767
2828
|
}
|
|
2768
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
|
+
);
|
|
2769
2956
|
const task = addGroupHelpAction(
|
|
2770
2957
|
program.command("task").description("Task commands")
|
|
2771
2958
|
);
|
|
@@ -2819,7 +3006,13 @@ function buildCli() {
|
|
|
2819
3006
|
"--priority <priority>",
|
|
2820
3007
|
`task priority (${taskPriorityChoices.join("|")})`
|
|
2821
3008
|
).choices([...taskPriorityChoices])
|
|
2822
|
-
).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(
|
|
2823
3016
|
"after",
|
|
2824
3017
|
[
|
|
2825
3018
|
"",
|
|
@@ -2830,82 +3023,88 @@ function buildCli() {
|
|
|
2830
3023
|
" pnpm cli task list --show-path --title-contains dypt",
|
|
2831
3024
|
" pnpm cli task list --cursor 119"
|
|
2832
3025
|
].join("\n")
|
|
2833
|
-
).action(
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
input.
|
|
2879
|
-
"
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
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
|
+
);
|
|
2909
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(
|
|
2910
3109
|
"after",
|
|
2911
3110
|
[
|
|
@@ -2917,50 +3116,52 @@ function buildCli() {
|
|
|
2917
3116
|
" pnpm cli task search dypt --limit 8",
|
|
2918
3117
|
" pnpm cli task search dypt --cursor-score 1 --cursor-id 45877 --limit 8"
|
|
2919
3118
|
].join("\n")
|
|
2920
|
-
).action(
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
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
|
+
}
|
|
2925
3162
|
);
|
|
2926
3163
|
}
|
|
2927
|
-
|
|
2928
|
-
{
|
|
2929
|
-
query,
|
|
2930
|
-
parent: options.parent,
|
|
2931
|
-
scope: options.scope,
|
|
2932
|
-
limit: options.limit,
|
|
2933
|
-
cursorScore: options.cursorScore,
|
|
2934
|
-
cursorId: options.cursorId,
|
|
2935
|
-
json: Boolean(options.json)
|
|
2936
|
-
},
|
|
2937
|
-
{
|
|
2938
|
-
searchTasks: (input) => withCliApi(async (api) => {
|
|
2939
|
-
const parentTaskId = input.parent ? await resolveTaskId(api, input.parent) : void 0;
|
|
2940
|
-
const scopeTaskId = input.scope ? await resolveTaskId(api, input.scope) : void 0;
|
|
2941
|
-
return api.searchTasks({
|
|
2942
|
-
query: input.query,
|
|
2943
|
-
parentTaskId,
|
|
2944
|
-
scopeTaskId,
|
|
2945
|
-
limit: parseIntegerOption(input.limit, "limit", 1, 100),
|
|
2946
|
-
cursor: input.cursorScore || input.cursorId ? {
|
|
2947
|
-
score: parseNumberOption(
|
|
2948
|
-
input.cursorScore,
|
|
2949
|
-
"cursor-score"
|
|
2950
|
-
),
|
|
2951
|
-
id: parseIntegerOption(
|
|
2952
|
-
input.cursorId,
|
|
2953
|
-
"cursor-id",
|
|
2954
|
-
1
|
|
2955
|
-
)
|
|
2956
|
-
} : void 0
|
|
2957
|
-
});
|
|
2958
|
-
}),
|
|
2959
|
-
printJson,
|
|
2960
|
-
printTable
|
|
2961
|
-
}
|
|
2962
|
-
);
|
|
2963
|
-
});
|
|
3164
|
+
);
|
|
2964
3165
|
task.command("tree").description(
|
|
2965
3166
|
"Show a task subtree; omit ref for root tasks (defaults to depth 2)"
|
|
2966
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(
|
|
@@ -3112,9 +3313,7 @@ function buildCli() {
|
|
|
3112
3313
|
);
|
|
3113
3314
|
});
|
|
3114
3315
|
};
|
|
3115
|
-
addGroupHelpAction(
|
|
3116
|
-
task.command("note").description("Task note commands")
|
|
3117
|
-
);
|
|
3316
|
+
addGroupHelpAction(task.command("note").description("Task note commands"));
|
|
3118
3317
|
const taskNote = task.commands.find((command) => command.name() === "note");
|
|
3119
3318
|
if (taskNote) {
|
|
3120
3319
|
addTaskNoteCommands(taskNote);
|
|
@@ -3125,6 +3324,10 @@ function buildCli() {
|
|
|
3125
3324
|
`task priority (${taskPriorityChoices.join("|")})`
|
|
3126
3325
|
).choices([...taskPriorityChoices])
|
|
3127
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(
|
|
3128
3331
|
"--reminder <timing>",
|
|
3129
3332
|
`create-time reminder (${reminderTimingTokens.join("|")}); repeat for up to 3 reminders`,
|
|
3130
3333
|
(timing, timings) => [
|
|
@@ -3150,15 +3353,29 @@ function buildCli() {
|
|
|
3150
3353
|
json: Boolean(options.json)
|
|
3151
3354
|
},
|
|
3152
3355
|
{
|
|
3153
|
-
createTask: (input) => withCliApi(
|
|
3154
|
-
|
|
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({
|
|
3155
3369
|
...input,
|
|
3370
|
+
...matched.length ? {
|
|
3371
|
+
tagPublicIds: matched.map((item) => item.publicId)
|
|
3372
|
+
} : {},
|
|
3156
3373
|
parentId: await resolveParentId(
|
|
3157
3374
|
options.parent,
|
|
3158
3375
|
(ref) => resolveTaskId(api, ref)
|
|
3159
3376
|
)
|
|
3160
|
-
})
|
|
3161
|
-
),
|
|
3377
|
+
});
|
|
3378
|
+
}),
|
|
3162
3379
|
printJson,
|
|
3163
3380
|
printTable
|
|
3164
3381
|
}
|
|
@@ -3185,30 +3402,32 @@ function buildCli() {
|
|
|
3185
3402
|
}
|
|
3186
3403
|
);
|
|
3187
3404
|
});
|
|
3188
|
-
task.command("delete-many").argument("<refs...>").option("--yes", "skip confirmation").option("--json", "print JSON output").action(
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
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
|
+
{
|
|
3198
3414
|
isTty: Boolean(process.stdout.isTTY),
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
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
|
+
);
|
|
3212
3431
|
task.command("update").argument("<ref>").option("--title <title>", "new title").addOption(
|
|
3213
3432
|
new Option(
|
|
3214
3433
|
"--status <status>",
|
|
@@ -3392,7 +3611,10 @@ function buildCli() {
|
|
|
3392
3611
|
);
|
|
3393
3612
|
}
|
|
3394
3613
|
);
|
|
3395
|
-
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(
|
|
3396
3618
|
async (refs, options) => {
|
|
3397
3619
|
await runTaskReorder(
|
|
3398
3620
|
{
|
|
@@ -3441,7 +3663,9 @@ function buildCli() {
|
|
|
3441
3663
|
].join("\n")
|
|
3442
3664
|
)
|
|
3443
3665
|
);
|
|
3444
|
-
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(
|
|
3445
3669
|
"after",
|
|
3446
3670
|
[
|
|
3447
3671
|
"",
|