@dypt/cli 0.1.11 → 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
@@ -42,11 +42,14 @@ Create a new task:
42
42
  dypt task create "Follow up with customers"
43
43
  dypt task create "Write release notes" --parent Work
44
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
45
46
  ```
46
47
 
47
48
  Use `--note <markdown>` to create the task and its initial note atomically. If
48
- the note cannot be stored, the task is not created. The command returns the
49
- same task output in text and `--json` modes whether or not `--note` is used.
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.
50
53
 
51
54
  ### Inspect a task
52
55
 
@@ -85,6 +88,47 @@ dypt task reorder 71595 71594 71598 --parent Work
85
88
  Dependencies and blockers are not changed by reordering; use `dypt dep` commands
86
89
  for execution dependencies.
87
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
+
88
132
  ## JSON output
89
133
 
90
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.11",
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",
@@ -48,7 +48,8 @@ var package_default = {
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
 
@@ -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({
@@ -897,7 +1015,8 @@ async function runTaskCreate(input, deps) {
897
1015
  priority: input.priority,
898
1016
  deadline: input.deadline,
899
1017
  expectedTimeTaken: input.expectedTimeTaken,
900
- note: input.note
1018
+ note: input.note,
1019
+ timeBeforeDeadline: input.timeBeforeDeadline
901
1020
  });
902
1021
  if (input.json) {
903
1022
  deps.printJson(result);
@@ -1496,6 +1615,11 @@ function isTaskTreeResponseLike(value) {
1496
1615
  function isDependencyCollection(value) {
1497
1616
  return isRecord(value) && Array.isArray(value.blockers) && Array.isArray(value.dependents) && value.blockers.every(isDependencyLike) && value.dependents.every(isDependencyLike);
1498
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
+ }
1499
1623
  function parseDateValue(value) {
1500
1624
  if (!value) return null;
1501
1625
  if (value instanceof Date) return value;
@@ -2219,6 +2343,25 @@ function renderAgentStatus(result, color) {
2219
2343
  ];
2220
2344
  return lines.join("\n");
2221
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
+ }
2222
2365
  function formatHumanOutput(value, options = {}) {
2223
2366
  const color = options.color ?? Boolean(process.stdout.isTTY);
2224
2367
  if (Array.isArray(value) && value.length === 0) {
@@ -2242,6 +2385,9 @@ function formatHumanOutput(value, options = {}) {
2242
2385
  if (isTaskSummaryLike(value)) {
2243
2386
  return renderTaskSummary(value, color);
2244
2387
  }
2388
+ if (isReminderCollection(value)) {
2389
+ return renderReminderCollection(value, color);
2390
+ }
2245
2391
  if (isTaskDetailLike(value)) {
2246
2392
  return renderTaskDetailResponse(value, color);
2247
2393
  }
@@ -2388,7 +2534,47 @@ function assertTaskId(ref) {
2388
2534
  }
2389
2535
  return taskId;
2390
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
+ }
2391
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
+ }
2392
2578
  const normalizedRef = ref.trim().toLocaleLowerCase();
2393
2579
  const exactMatches = matches.filter(
2394
2580
  (task) => task.title.trim().toLocaleLowerCase() === normalizedRef
@@ -2909,8 +3095,18 @@ function buildCli() {
2909
3095
  "--priority <priority>",
2910
3096
  `task priority (${taskPriorityChoices.join("|")})`
2911
3097
  ).choices([...taskPriorityChoices])
2912
- ).option("--deadline <deadline>", "ISO deadline").option("--expected-time <minutes>", "expected minutes").option("--note <markdown>", "initial task note in Markdown").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(
2913
3106
  async (title, options) => {
3107
+ if (options.reminder && !options.deadline) {
3108
+ throw new Error("Use --reminder only with --deadline.");
3109
+ }
2914
3110
  await runTaskCreate(
2915
3111
  {
2916
3112
  title,
@@ -2921,6 +3117,7 @@ function buildCli() {
2921
3117
  "expected-time"
2922
3118
  ),
2923
3119
  note: options.note,
3120
+ timeBeforeDeadline: options.reminder ? parseReminderTimings(options.reminder) : void 0,
2924
3121
  json: Boolean(options.json)
2925
3122
  },
2926
3123
  {
@@ -3002,7 +3199,7 @@ function buildCli() {
3002
3199
  title: options.title,
3003
3200
  status: options.status,
3004
3201
  priority: options.priority,
3005
- deadline: options.deadline,
3202
+ deadline: options.deadline ? parseDateOption(options.deadline, "start").toISOString() : void 0,
3006
3203
  expectedTimeTaken: options.expectedTime,
3007
3204
  actualTimeTaken: options.actualTime,
3008
3205
  archivedAt: options.archive ? /* @__PURE__ */ new Date() : options.unarchive ? null : void 0,
@@ -3103,7 +3300,7 @@ function buildCli() {
3103
3300
  refs,
3104
3301
  status: options.status,
3105
3302
  priority: options.priority,
3106
- deadline: options.deadline,
3303
+ deadline: options.deadline ? parseDateOption(options.deadline, "start").toISOString() : void 0,
3107
3304
  expectedTimeTaken: options.expectedTime,
3108
3305
  actualTimeTaken: options.actualTime,
3109
3306
  archivedAt: options.archive ? /* @__PURE__ */ new Date() : options.unarchive ? null : void 0,
@@ -3368,6 +3565,81 @@ function buildCli() {
3368
3565
  }
3369
3566
  );
3370
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
+ );
3371
3643
  const note = addGroupHelpAction(
3372
3644
  program.command("note").description("Note commands")
3373
3645
  );