@dypt/cli 0.1.10 → 0.1.12

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/README.md CHANGED
@@ -41,8 +41,16 @@ Create a new task:
41
41
  ```bash
42
42
  dypt task create "Follow up with customers"
43
43
  dypt task create "Write release notes" --parent Work
44
+ dypt task create "Prepare launch" --note "## Context\n\nCoordinate the release."
45
+ dypt task create "Prepare launch" --deadline 2026-08-01T09:00:00Z --reminder at-deadline --reminder 1d
44
46
  ```
45
47
 
48
+ Use `--note <markdown>` to create the task and its initial note atomically. If
49
+ the note cannot be stored, the task is not created. Repeat
50
+ `--reminder <timing>` up to three times to configure reminders alongside a
51
+ deadline. The task, note, and reminders are stored atomically; if any part
52
+ fails, none of them are created.
53
+
46
54
  ### Inspect a task
47
55
 
48
56
  View a task and its details:
@@ -80,6 +88,47 @@ dypt task reorder 71595 71594 71598 --parent Work
80
88
  Dependencies and blockers are not changed by reordering; use `dypt dep` commands
81
89
  for execution dependencies.
82
90
 
91
+ ### Manage reminders
92
+
93
+ Configure up to three reminders relative to a task's deadline:
94
+
95
+ ```bash
96
+ dypt task create "Prepare launch" --deadline 2026-08-01T09:00:00Z --reminder at-deadline --reminder 1d
97
+ dypt reminder add 123 at-deadline 1d 1w
98
+ dypt reminder list 123
99
+ dypt reminder set 123 1h 1d
100
+ dypt reminder remove 123 456
101
+ ```
102
+
103
+ `add` preserves existing reminders, while `set` atomically replaces all
104
+ configured reminders. `remove` takes the reminder id shown by `reminder list`;
105
+ it does not delete or otherwise change the task.
106
+
107
+ Supported timing tokens are:
108
+
109
+ | Token | Timing |
110
+ | ------------- | ----------------- |
111
+ | `at-deadline` | at the deadline |
112
+ | `15m` | 15 minutes before |
113
+ | `30m` | 30 minutes before |
114
+ | `1h` | 1 hour before |
115
+ | `2h` | 2 hours before |
116
+ | `3h` | 3 hours before |
117
+ | `12h` | 12 hours before |
118
+ | `1d` | 1 day before |
119
+ | `1w` | 1 week before |
120
+
121
+ The task must have a deadline before reminders can be added or replaced.
122
+ The same applies to create-time `--reminder` options. Duplicate timings and
123
+ collections larger than three are rejected. Add `--json` to any reminder
124
+ command for structured task, deadline, reminder id, timing, scheduled time, and
125
+ sent-state output:
126
+
127
+ ```bash
128
+ dypt reminder list 123 --json
129
+ dypt reminder add 123 1d --json
130
+ ```
131
+
83
132
  ## JSON output
84
133
 
85
134
  Most commands support `--json` for agent and automation use.
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.10",
12
+ version: "0.1.12",
13
13
  description: "Command-line interface for dypt task management",
14
14
  license: "SEE LICENSE IN LICENSE",
15
15
  homepage: "https://dypt.app",
@@ -43,12 +43,13 @@ var package_default = {
43
43
  },
44
44
  dependencies: {
45
45
  "@trpc/client": "^11.17.0",
46
- commander: "^14.0.3",
46
+ commander: "^15.0.0",
47
47
  "string-width": "^8.2.1",
48
48
  superjson: "^2.2.6"
49
49
  },
50
50
  devDependencies: {
51
- tsup: "^8.5.1"
51
+ tsup: "^8.5.1",
52
+ typescript: "^6.0.3"
52
53
  }
53
54
  };
54
55
 
@@ -67,7 +68,7 @@ function getScopedTokenFilePath(baseUrl) {
67
68
  return path.join(getConfigDir(), "tokens", `${scope}.json`);
68
69
  }
69
70
  function getBaseUrl() {
70
- return (process.env.DYPT_BASE_URL ?? process.env.NEXT_PUBLIC_URL ?? "https://dypt.app").replace(/\/$/, "");
71
+ return (process.env.DYPT_BASE_URL ?? process.env.NEXT_PUBLIC_URL ?? "https://dypt.app").replace(/\/+$/, "");
71
72
  }
72
73
  function getDefaultDeviceLabel() {
73
74
  const hostname = os.hostname().trim();
@@ -316,7 +317,11 @@ async function createCliApi(options = {}) {
316
317
  listDependencies: (input) => cliClient.cli.v1.dependencies.get.query(input),
317
318
  setNote: (input) => cliClient.cli.v1.notes.set.mutate(input),
318
319
  getNote: (input) => cliClient.cli.v1.notes.get.query(input),
319
- searchNotes: (input) => cliClient.cli.v1.notes.search.query(input)
320
+ searchNotes: (input) => cliClient.cli.v1.notes.search.query(input),
321
+ listReminders: (input) => cliClient.cli.v1.reminders.list.query(input),
322
+ addReminders: (input) => cliClient.cli.v1.reminders.add.mutate(input),
323
+ setReminders: (input) => cliClient.cli.v1.reminders.set.mutate(input),
324
+ removeReminder: (input) => cliClient.cli.v1.reminders.remove.mutate(input)
320
325
  };
321
326
  }
322
327
 
@@ -889,6 +894,119 @@ async function runNoteSet(input, deps) {
889
894
  deps.printTable(result);
890
895
  }
891
896
 
897
+ // src/commands/reminder/timing.ts
898
+ var REMINDER_TIMINGS = [
899
+ ["at-deadline", 0, "At deadline"],
900
+ ["15m", 900, "15 minutes before"],
901
+ ["30m", 1800, "30 minutes before"],
902
+ ["1h", 3600, "1 hour before"],
903
+ ["2h", 7200, "2 hours before"],
904
+ ["3h", 10800, "3 hours before"],
905
+ ["12h", 43200, "12 hours before"],
906
+ ["1d", 86400, "1 day before"],
907
+ ["1w", 604800, "1 week before"]
908
+ ];
909
+ var timingByToken = new Map(
910
+ REMINDER_TIMINGS.map(([token, seconds]) => [token, seconds])
911
+ );
912
+ var labelBySeconds = new Map(
913
+ REMINDER_TIMINGS.map(([, seconds, label]) => [seconds, label])
914
+ );
915
+ var reminderTimingTokens = REMINDER_TIMINGS.map(([token]) => token);
916
+ function parseReminderTimings(timings) {
917
+ const parsed = timings.map((timing) => {
918
+ const seconds = timingByToken.get(timing);
919
+ if (seconds === void 0) {
920
+ const supported = [
921
+ reminderTimingTokens.slice(0, -1).join(", "),
922
+ reminderTimingTokens.at(-1)
923
+ ].join(", or ");
924
+ throw new Error(
925
+ `Unsupported reminder timing: ${timing}. Use ${supported}.`
926
+ );
927
+ }
928
+ return seconds;
929
+ });
930
+ if (new Set(parsed).size !== parsed.length) {
931
+ throw new Error("Reminder timings must be unique.");
932
+ }
933
+ if (parsed.length > 3) {
934
+ throw new Error("A task can have at most 3 reminders.");
935
+ }
936
+ return parsed;
937
+ }
938
+
939
+ // src/commands/reminder/reminder.ts
940
+ function formatReminderError(error) {
941
+ const message = error instanceof Error ? error.message : String(error);
942
+ switch (message) {
943
+ case "CLI_REMINDER_DEADLINE_REQUIRED":
944
+ return "Task must have a deadline before reminders can be configured.";
945
+ case "CLI_REMINDER_DUPLICATE":
946
+ return "Reminder timings must be unique and must not already be configured.";
947
+ case "CLI_REMINDER_LIMIT":
948
+ return "A task can have at most 3 reminders.";
949
+ case "CLI_REMINDER_NOT_FOUND":
950
+ return "Reminder not found on the specified task.";
951
+ case "CLI_REMINDER_TIMING_INVALID":
952
+ return "The reminder timing is not supported.";
953
+ case "CLI_TASK_NOT_FOUND":
954
+ return "Task not found or you do not have permission to edit its reminders.";
955
+ default:
956
+ return message;
957
+ }
958
+ }
959
+ async function runWithReminderError(operation) {
960
+ try {
961
+ return await operation();
962
+ } catch (error) {
963
+ throw new Error(formatReminderError(error));
964
+ }
965
+ }
966
+ function printResult(result, json, deps) {
967
+ if (json) {
968
+ deps.printJson(result);
969
+ return;
970
+ }
971
+ deps.printTable(result);
972
+ }
973
+ async function runReminderList(input, deps) {
974
+ const result = await runWithReminderError(
975
+ () => deps.listReminders(input.taskRef)
976
+ );
977
+ printResult(result, input.json, deps);
978
+ }
979
+ async function runReminderAdd(input, deps) {
980
+ const result = await runWithReminderError(
981
+ () => deps.addReminders(
982
+ input.taskRef,
983
+ parseReminderTimings(input.timings)
984
+ )
985
+ );
986
+ printResult(result, input.json, deps);
987
+ }
988
+ async function runReminderSet(input, deps) {
989
+ const result = await runWithReminderError(
990
+ () => deps.setReminders(
991
+ input.taskRef,
992
+ parseReminderTimings(input.timings)
993
+ )
994
+ );
995
+ printResult(result, input.json, deps);
996
+ }
997
+ async function runReminderRemove(input, deps) {
998
+ const reminderId = Number(input.reminderId);
999
+ if (!Number.isInteger(reminderId) || reminderId <= 0) {
1000
+ throw new Error(
1001
+ `Reminder id must be a positive integer: ${input.reminderId}`
1002
+ );
1003
+ }
1004
+ const result = await runWithReminderError(
1005
+ () => deps.removeReminder(input.taskRef, reminderId)
1006
+ );
1007
+ printResult(result, input.json, deps);
1008
+ }
1009
+
892
1010
  // src/commands/task/create.ts
893
1011
  async function runTaskCreate(input, deps) {
894
1012
  const result = await deps.createTask({
@@ -896,7 +1014,9 @@ async function runTaskCreate(input, deps) {
896
1014
  parentId: input.parentId ?? null,
897
1015
  priority: input.priority,
898
1016
  deadline: input.deadline,
899
- expectedTimeTaken: input.expectedTimeTaken
1017
+ expectedTimeTaken: input.expectedTimeTaken,
1018
+ note: input.note,
1019
+ timeBeforeDeadline: input.timeBeforeDeadline
900
1020
  });
901
1021
  if (input.json) {
902
1022
  deps.printJson(result);
@@ -1099,9 +1219,26 @@ async function runTaskTree(input, deps) {
1099
1219
  deps.printTable(result);
1100
1220
  }
1101
1221
 
1222
+ // src/commands/task/updateFields.ts
1223
+ function hasSharedTaskMutationFields(input) {
1224
+ return input.status !== void 0 || input.priority !== void 0 || input.deadline !== void 0 || input.expectedTimeTaken !== void 0 || input.actualTimeTaken !== void 0 || input.archivedAt !== void 0 || input.parentRef !== void 0;
1225
+ }
1226
+ function pickSharedTaskMutationFields(input) {
1227
+ return {
1228
+ status: input.status,
1229
+ priority: input.priority,
1230
+ deadline: input.deadline,
1231
+ expectedTimeTaken: input.expectedTimeTaken,
1232
+ actualTimeTaken: input.actualTimeTaken,
1233
+ archivedAt: input.archivedAt,
1234
+ parentRef: input.parentRef
1235
+ };
1236
+ }
1237
+
1102
1238
  // src/commands/task/update.ts
1103
1239
  async function runTaskUpdate(input, deps) {
1104
- const hasMutations = input.title !== void 0 || input.status !== void 0 || input.priority !== void 0 || input.deadline !== void 0 || input.expectedTimeTaken !== void 0 || input.actualTimeTaken !== void 0 || input.archivedAt !== void 0 || input.parentRef !== void 0 || input.position !== void 0;
1240
+ const sharedArgs = pickSharedTaskMutationFields(input);
1241
+ const hasMutations = input.title !== void 0 || hasSharedTaskMutationFields(sharedArgs) || input.position !== void 0;
1105
1242
  if (!hasMutations) {
1106
1243
  throw new Error(
1107
1244
  "No changes specified. Use --title, --status, --priority, --deadline, --expected-time, --actual-time, --archive, --unarchive, --parent, or --position."
@@ -1113,24 +1250,12 @@ async function runTaskUpdate(input, deps) {
1113
1250
  const args = {
1114
1251
  ref: input.ref,
1115
1252
  title: input.title,
1116
- status: input.status,
1117
- priority: input.priority,
1118
- deadline: input.deadline,
1119
- expectedTimeTaken: input.expectedTimeTaken,
1120
- actualTimeTaken: input.actualTimeTaken,
1121
- archivedAt: input.archivedAt,
1122
- parentRef: input.parentRef,
1253
+ ...sharedArgs,
1123
1254
  position: input.position
1124
1255
  };
1125
1256
  const result = input.preview ? await deps.previewTask({
1126
1257
  ref: args.ref,
1127
- status: args.status,
1128
- priority: args.priority,
1129
- deadline: args.deadline,
1130
- expectedTimeTaken: args.expectedTimeTaken,
1131
- actualTimeTaken: args.actualTimeTaken,
1132
- archivedAt: args.archivedAt,
1133
- parentRef: args.parentRef,
1258
+ ...sharedArgs,
1134
1259
  position: args.position
1135
1260
  }) : await deps.updateTask(args);
1136
1261
  if (input.json) {
@@ -1142,7 +1267,8 @@ async function runTaskUpdate(input, deps) {
1142
1267
 
1143
1268
  // src/commands/task/updateMany.ts
1144
1269
  async function runTaskUpdateMany(input, deps) {
1145
- const hasMutations = input.status !== void 0 || input.priority !== void 0 || input.deadline !== void 0 || input.expectedTimeTaken !== void 0 || input.actualTimeTaken !== void 0 || input.archivedAt !== void 0 || input.parentRef !== void 0;
1270
+ const sharedArgs = pickSharedTaskMutationFields(input);
1271
+ const hasMutations = hasSharedTaskMutationFields(sharedArgs);
1146
1272
  if (!hasMutations) {
1147
1273
  throw new Error(
1148
1274
  "No changes specified. Use --status, --priority, --deadline, --expected-time, --actual-time, --archive, --unarchive, or --parent."
@@ -1150,13 +1276,7 @@ async function runTaskUpdateMany(input, deps) {
1150
1276
  }
1151
1277
  const args = {
1152
1278
  refs: input.refs,
1153
- status: input.status,
1154
- priority: input.priority,
1155
- deadline: input.deadline,
1156
- expectedTimeTaken: input.expectedTimeTaken,
1157
- actualTimeTaken: input.actualTimeTaken,
1158
- archivedAt: input.archivedAt,
1159
- parentRef: input.parentRef
1279
+ ...sharedArgs
1160
1280
  };
1161
1281
  const result = input.preview ? await deps.previewManyTasks(args) : await deps.updateManyTasks(args);
1162
1282
  if (input.json) {
@@ -1495,6 +1615,11 @@ function isTaskTreeResponseLike(value) {
1495
1615
  function isDependencyCollection(value) {
1496
1616
  return isRecord(value) && Array.isArray(value.blockers) && Array.isArray(value.dependents) && value.blockers.every(isDependencyLike) && value.dependents.every(isDependencyLike);
1497
1617
  }
1618
+ function isReminderCollection(value) {
1619
+ return isRecord(value) && isTaskLike(value.task) && Array.isArray(value.reminders) && value.reminders.every(
1620
+ (reminder) => isRecord(reminder) && typeof reminder.id === "number" && typeof reminder.taskId === "number" && typeof reminder.timing === "string" && typeof reminder.label === "string" && (reminder.remindAt === null || reminder.remindAt instanceof Date || typeof reminder.remindAt === "string") && typeof reminder.sent === "boolean"
1621
+ );
1622
+ }
1498
1623
  function parseDateValue(value) {
1499
1624
  if (!value) return null;
1500
1625
  if (value instanceof Date) return value;
@@ -2218,6 +2343,25 @@ function renderAgentStatus(result, color) {
2218
2343
  ];
2219
2344
  return lines.join("\n");
2220
2345
  }
2346
+ function renderReminderCollection(result, color) {
2347
+ const lines = [
2348
+ `${colorize(`#${result.task.id}`, "cyan", color)} ${result.task.title}`,
2349
+ `Deadline: ${parseDateValue(result.task.deadline)?.toISOString() ?? "-"}`,
2350
+ ""
2351
+ ];
2352
+ if (result.reminders.length === 0) {
2353
+ lines.push("No reminders configured.");
2354
+ return lines.join("\n");
2355
+ }
2356
+ lines.push("Reminders");
2357
+ for (const reminder of result.reminders) {
2358
+ const sent = reminder.sent ? colorize("sent", "green", color) : "pending";
2359
+ lines.push(
2360
+ `- #${reminder.id} ${reminder.label} (${reminder.timing}) \xB7 ${parseDateValue(reminder.remindAt)?.toISOString() ?? "-"} \xB7 ${sent}`
2361
+ );
2362
+ }
2363
+ return lines.join("\n");
2364
+ }
2221
2365
  function formatHumanOutput(value, options = {}) {
2222
2366
  const color = options.color ?? Boolean(process.stdout.isTTY);
2223
2367
  if (Array.isArray(value) && value.length === 0) {
@@ -2241,6 +2385,9 @@ function formatHumanOutput(value, options = {}) {
2241
2385
  if (isTaskSummaryLike(value)) {
2242
2386
  return renderTaskSummary(value, color);
2243
2387
  }
2388
+ if (isReminderCollection(value)) {
2389
+ return renderReminderCollection(value, color);
2390
+ }
2244
2391
  if (isTaskDetailLike(value)) {
2245
2392
  return renderTaskDetailResponse(value, color);
2246
2393
  }
@@ -2372,9 +2519,10 @@ function parseNumberOption(value, label) {
2372
2519
  }
2373
2520
  function parseDateOption(value, boundary) {
2374
2521
  if (!value) return void 0;
2375
- const normalized = /^\d{4}-\d{2}-\d{2}$/.test(value) ? `${value}${boundary === "start" ? "T00:00:00.000Z" : "T23:59:59.999Z"}` : value;
2522
+ const isDateOnly = /^\d{4}-\d{2}-\d{2}$/.test(value);
2523
+ const normalized = isDateOnly ? `${value}${boundary === "start" ? "T00:00:00.000Z" : "T23:59:59.999Z"}` : value;
2376
2524
  const parsed = new Date(normalized);
2377
- if (Number.isNaN(parsed.getTime())) {
2525
+ if (Number.isNaN(parsed.getTime()) || isDateOnly && parsed.toISOString().slice(0, 10) !== value) {
2378
2526
  throw new Error(`Invalid date: ${value}`);
2379
2527
  }
2380
2528
  return parsed;
@@ -2386,7 +2534,47 @@ function assertTaskId(ref) {
2386
2534
  }
2387
2535
  return taskId;
2388
2536
  }
2537
+ var TASK_PUBLIC_ID_PREFIX = "t_";
2538
+ var TASK_PUBLIC_ID_LENGTH = 16;
2539
+ var TASK_PUBLIC_ID_REFERENCE_MIN_BODY_LENGTH = 4;
2540
+ var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
2541
+ var taskPublicIdReferenceBodyPattern = new RegExp(
2542
+ `^[${BASE58_ALPHABET}]{${TASK_PUBLIC_ID_REFERENCE_MIN_BODY_LENGTH},${TASK_PUBLIC_ID_LENGTH}}$`
2543
+ );
2544
+ function normalizeTaskPublicIdReference(value) {
2545
+ const trimmed = value.trim();
2546
+ const taskPathMatch = trimmed.match(/\/tasks\/([^/?#]+)/);
2547
+ const candidate = decodeURIComponent(taskPathMatch?.[1] ?? trimmed).replace(
2548
+ /^#/,
2549
+ ""
2550
+ );
2551
+ const hasExplicitPrefix = candidate.startsWith(TASK_PUBLIC_ID_PREFIX);
2552
+ const body = candidate.startsWith(TASK_PUBLIC_ID_PREFIX) ? candidate.slice(TASK_PUBLIC_ID_PREFIX.length) : candidate;
2553
+ if (!taskPublicIdReferenceBodyPattern.test(body)) return null;
2554
+ if (!hasExplicitPrefix && /^\d+$/.test(body)) return null;
2555
+ return {
2556
+ publicId: `${TASK_PUBLIC_ID_PREFIX}${body}`,
2557
+ isFullId: body.length === TASK_PUBLIC_ID_LENGTH
2558
+ };
2559
+ }
2389
2560
  function resolveTaskRefFromSearchMatches(ref, matches) {
2561
+ const publicIdReference = normalizeTaskPublicIdReference(ref);
2562
+ if (publicIdReference) {
2563
+ const publicIdMatches = matches.filter(
2564
+ (task) => task.publicId?.startsWith(publicIdReference.publicId) ?? false
2565
+ );
2566
+ if (publicIdMatches.length === 1) {
2567
+ return publicIdMatches[0].id;
2568
+ }
2569
+ if (publicIdMatches.length > 1) {
2570
+ const formattedMatches = publicIdMatches.map((task) => {
2571
+ const path4 = task.pathTitles?.join(" > ") ?? [task.parentTitle, task.title].filter(Boolean).join(" > ") ?? task.title;
2572
+ return `- #${task.id} ${path4}`;
2573
+ }).join("\n");
2574
+ throw new Error(`Task reference is ambiguous: ${ref}
2575
+ ${formattedMatches}`);
2576
+ }
2577
+ }
2390
2578
  const normalizedRef = ref.trim().toLocaleLowerCase();
2391
2579
  const exactMatches = matches.filter(
2392
2580
  (task) => task.title.trim().toLocaleLowerCase() === normalizedRef
@@ -2433,6 +2621,11 @@ function assertExclusiveHierarchyOptions(parent, scope) {
2433
2621
  throw new Error("Use either --parent or --scope, not both");
2434
2622
  }
2435
2623
  }
2624
+ function assertExclusiveArchiveOptions(archive, unarchive) {
2625
+ if (archive && unarchive) {
2626
+ throw new Error("Use either --archive or --unarchive, not both");
2627
+ }
2628
+ }
2436
2629
  async function withCliApi(callback) {
2437
2630
  const api = await createCliApi();
2438
2631
  return callback(api);
@@ -2902,8 +3095,18 @@ function buildCli() {
2902
3095
  "--priority <priority>",
2903
3096
  `task priority (${taskPriorityChoices.join("|")})`
2904
3097
  ).choices([...taskPriorityChoices])
2905
- ).option("--deadline <deadline>", "ISO deadline").option("--expected-time <minutes>", "expected minutes").option("--json", "print JSON output").action(
3098
+ ).option("--deadline <deadline>", "ISO deadline").option("--expected-time <minutes>", "expected minutes").option("--note <markdown>", "initial task note in Markdown").option(
3099
+ "--reminder <timing>",
3100
+ `create-time reminder (${reminderTimingTokens.join("|")}); repeat for up to 3 reminders`,
3101
+ (timing, timings) => [
3102
+ ...timings ?? [],
3103
+ timing
3104
+ ]
3105
+ ).option("--json", "print JSON output").action(
2906
3106
  async (title, options) => {
3107
+ if (options.reminder && !options.deadline) {
3108
+ throw new Error("Use --reminder only with --deadline.");
3109
+ }
2907
3110
  await runTaskCreate(
2908
3111
  {
2909
3112
  title,
@@ -2913,6 +3116,8 @@ function buildCli() {
2913
3116
  options.expectedTime,
2914
3117
  "expected-time"
2915
3118
  ),
3119
+ note: options.note,
3120
+ timeBeforeDeadline: options.reminder ? parseReminderTimings(options.reminder) : void 0,
2916
3121
  json: Boolean(options.json)
2917
3122
  },
2918
3123
  {
@@ -2987,13 +3192,14 @@ function buildCli() {
2987
3192
  ).choices([...taskPriorityChoices])
2988
3193
  ).option("--deadline <deadline>", "ISO deadline").option("--expected-time <minutes>", "expected minutes").option("--actual-time <minutes>", "actual minutes").option("--archive", "archive the task").option("--unarchive", "unarchive the task").option("--parent <ref>", 'move task under the given parent or "root"').option("--position <position>", "0-based sibling position").option("--preview", "preview the update without mutating").option("--json", "print JSON output").action(
2989
3194
  async (ref, options) => {
3195
+ assertExclusiveArchiveOptions(options.archive, options.unarchive);
2990
3196
  await runTaskUpdate(
2991
3197
  {
2992
3198
  ref,
2993
3199
  title: options.title,
2994
3200
  status: options.status,
2995
3201
  priority: options.priority,
2996
- deadline: options.deadline,
3202
+ deadline: options.deadline ? parseDateOption(options.deadline, "start").toISOString() : void 0,
2997
3203
  expectedTimeTaken: options.expectedTime,
2998
3204
  actualTimeTaken: options.actualTime,
2999
3205
  archivedAt: options.archive ? /* @__PURE__ */ new Date() : options.unarchive ? null : void 0,
@@ -3010,8 +3216,14 @@ function buildCli() {
3010
3216
  status: normalizeStatus(input.status),
3011
3217
  priority: normalizePriority(input.priority),
3012
3218
  deadline: input.deadline ? new Date(String(input.deadline)) : void 0,
3013
- expectedTimeTaken: input.expectedTimeTaken ? Number(input.expectedTimeTaken) : void 0,
3014
- actualTimeTaken: input.actualTimeTaken ? Number(input.actualTimeTaken) : void 0,
3219
+ expectedTimeTaken: parseIntegerOption(
3220
+ input.expectedTimeTaken,
3221
+ "expected-time"
3222
+ ),
3223
+ actualTimeTaken: parseIntegerOption(
3224
+ input.actualTimeTaken,
3225
+ "actual-time"
3226
+ ),
3015
3227
  archivedAt: input.archivedAt,
3016
3228
  parentId: await resolveParentId(
3017
3229
  input.parentRef,
@@ -3026,8 +3238,14 @@ function buildCli() {
3026
3238
  status: normalizeStatus(input.status),
3027
3239
  priority: normalizePriority(input.priority),
3028
3240
  deadline: input.deadline ? new Date(String(input.deadline)) : void 0,
3029
- expectedTimeTaken: input.expectedTimeTaken ? Number(input.expectedTimeTaken) : void 0,
3030
- actualTimeTaken: input.actualTimeTaken ? Number(input.actualTimeTaken) : void 0,
3241
+ expectedTimeTaken: parseIntegerOption(
3242
+ input.expectedTimeTaken,
3243
+ "expected-time"
3244
+ ),
3245
+ actualTimeTaken: parseIntegerOption(
3246
+ input.actualTimeTaken,
3247
+ "actual-time"
3248
+ ),
3031
3249
  archivedAt: input.archivedAt,
3032
3250
  parentId: await resolveParentId(
3033
3251
  input.parentRef,
@@ -3076,12 +3294,13 @@ function buildCli() {
3076
3294
  ).choices([...taskPriorityChoices])
3077
3295
  ).option("--deadline <deadline>", "ISO deadline").option("--expected-time <minutes>", "expected minutes").option("--actual-time <minutes>", "actual minutes").option("--archive", "archive the tasks").option("--unarchive", "unarchive the tasks").option("--parent <ref>", 'move tasks under the given parent or "root"').option("--preview", "preview the bulk update without mutating").option("--json", "print JSON output").action(
3078
3296
  async (refs, options) => {
3297
+ assertExclusiveArchiveOptions(options.archive, options.unarchive);
3079
3298
  await runTaskUpdateMany(
3080
3299
  {
3081
3300
  refs,
3082
3301
  status: options.status,
3083
3302
  priority: options.priority,
3084
- deadline: options.deadline,
3303
+ deadline: options.deadline ? parseDateOption(options.deadline, "start").toISOString() : void 0,
3085
3304
  expectedTimeTaken: options.expectedTime,
3086
3305
  actualTimeTaken: options.actualTime,
3087
3306
  archivedAt: options.archive ? /* @__PURE__ */ new Date() : options.unarchive ? null : void 0,
@@ -3099,8 +3318,14 @@ function buildCli() {
3099
3318
  status: normalizeStatus(input.status),
3100
3319
  priority: normalizePriority(input.priority),
3101
3320
  deadline: input.deadline ? new Date(String(input.deadline)) : void 0,
3102
- expectedTimeTaken: input.expectedTimeTaken ? Number(input.expectedTimeTaken) : void 0,
3103
- actualTimeTaken: input.actualTimeTaken ? Number(input.actualTimeTaken) : void 0,
3321
+ expectedTimeTaken: parseIntegerOption(
3322
+ input.expectedTimeTaken,
3323
+ "expected-time"
3324
+ ),
3325
+ actualTimeTaken: parseIntegerOption(
3326
+ input.actualTimeTaken,
3327
+ "actual-time"
3328
+ ),
3104
3329
  archivedAt: input.archivedAt,
3105
3330
  parentId: await resolveParentId(
3106
3331
  input.parentRef,
@@ -3117,8 +3342,14 @@ function buildCli() {
3117
3342
  status: normalizeStatus(input.status),
3118
3343
  priority: normalizePriority(input.priority),
3119
3344
  deadline: input.deadline ? new Date(String(input.deadline)) : void 0,
3120
- expectedTimeTaken: input.expectedTimeTaken ? Number(input.expectedTimeTaken) : void 0,
3121
- actualTimeTaken: input.actualTimeTaken ? Number(input.actualTimeTaken) : void 0,
3345
+ expectedTimeTaken: parseIntegerOption(
3346
+ input.expectedTimeTaken,
3347
+ "expected-time"
3348
+ ),
3349
+ actualTimeTaken: parseIntegerOption(
3350
+ input.actualTimeTaken,
3351
+ "actual-time"
3352
+ ),
3122
3353
  archivedAt: input.archivedAt,
3123
3354
  parentId: await resolveParentId(
3124
3355
  input.parentRef,
@@ -3334,6 +3565,81 @@ function buildCli() {
3334
3565
  }
3335
3566
  );
3336
3567
  });
3568
+ const reminder = addGroupHelpAction(
3569
+ program.command("reminder").description("Task reminder commands")
3570
+ );
3571
+ const reminderTimingHelp = reminderTimingTokens.join("|");
3572
+ reminder.command("list").description("List reminders configured on a task").argument("<taskRef>", "task id, title, or public reference").option("--json", "print JSON output").action(async (taskRef, options) => {
3573
+ await runReminderList(
3574
+ { taskRef, json: Boolean(options.json) },
3575
+ {
3576
+ listReminders: (ref) => withCliApi(
3577
+ async (api) => api.listReminders({
3578
+ taskId: await resolveTaskId(api, ref)
3579
+ })
3580
+ ),
3581
+ printJson,
3582
+ printTable
3583
+ }
3584
+ );
3585
+ });
3586
+ reminder.command("add").description("Add one or more reminders without replacing existing ones").argument("<taskRef>", "task id, title, or public reference").argument(
3587
+ "<timings...>",
3588
+ `timings (${reminderTimingHelp}); maximum 3 per task`
3589
+ ).option("--json", "print JSON output").action(
3590
+ async (taskRef, timings, options) => {
3591
+ await runReminderAdd(
3592
+ { taskRef, timings, json: Boolean(options.json) },
3593
+ {
3594
+ addReminders: (ref, timeBeforeDeadline) => withCliApi(
3595
+ async (api) => api.addReminders({
3596
+ taskId: await resolveTaskId(api, ref),
3597
+ timeBeforeDeadline
3598
+ })
3599
+ ),
3600
+ printJson,
3601
+ printTable
3602
+ }
3603
+ );
3604
+ }
3605
+ );
3606
+ reminder.command("set").description("Replace all reminders configured on a task").argument("<taskRef>", "task id, title, or public reference").argument(
3607
+ "<timings...>",
3608
+ `replacement timings (${reminderTimingHelp}); maximum 3`
3609
+ ).option("--json", "print JSON output").action(
3610
+ async (taskRef, timings, options) => {
3611
+ await runReminderSet(
3612
+ { taskRef, timings, json: Boolean(options.json) },
3613
+ {
3614
+ setReminders: (ref, timeBeforeDeadline) => withCliApi(
3615
+ async (api) => api.setReminders({
3616
+ taskId: await resolveTaskId(api, ref),
3617
+ timeBeforeDeadline
3618
+ })
3619
+ ),
3620
+ printJson,
3621
+ printTable
3622
+ }
3623
+ );
3624
+ }
3625
+ );
3626
+ reminder.command("remove").description("Remove one reminder from a task").argument("<taskRef>", "task id, title, or public reference").argument("<reminderId>", "reminder id shown by reminder list").option("--json", "print JSON output").action(
3627
+ async (taskRef, reminderId, options) => {
3628
+ await runReminderRemove(
3629
+ { taskRef, reminderId, json: Boolean(options.json) },
3630
+ {
3631
+ removeReminder: (ref, id) => withCliApi(
3632
+ async (api) => api.removeReminder({
3633
+ taskId: await resolveTaskId(api, ref),
3634
+ reminderId: id
3635
+ })
3636
+ ),
3637
+ printJson,
3638
+ printTable
3639
+ }
3640
+ );
3641
+ }
3642
+ );
3337
3643
  const note = addGroupHelpAction(
3338
3644
  program.command("note").description("Note commands")
3339
3645
  );