@dypt/cli 0.1.11 → 0.1.13

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.13",
13
13
  description: "Command-line interface for dypt task management",
14
14
  license: "SEE LICENSE IN LICENSE",
15
15
  homepage: "https://dypt.app",
@@ -42,13 +42,14 @@ var package_default = {
42
42
  typecheck: "tsc --noEmit"
43
43
  },
44
44
  dependencies: {
45
- "@trpc/client": "^11.17.0",
45
+ "@trpc/client": "^11.18.0",
46
46
  commander: "^15.0.0",
47
- "string-width": "^8.2.1",
47
+ "string-width": "^8.2.2",
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
 
@@ -292,6 +293,7 @@ async function createCliApi(options = {}) {
292
293
  const cliClient = client;
293
294
  return {
294
295
  getAuthStatus: () => cliClient.cli.v1.auth.status.query(),
296
+ revokeCurrentToken: () => cliClient.cli.v1.auth.logout.mutate(),
295
297
  createTask: (input) => cliClient.cli.v1.tasks.create.mutate(input),
296
298
  updateTask: (input) => cliClient.cli.v1.tasks.update.mutate(input),
297
299
  reorderTasks: (input) => cliClient.cli.v1.tasks.reorder.mutate(input),
@@ -316,7 +318,11 @@ async function createCliApi(options = {}) {
316
318
  listDependencies: (input) => cliClient.cli.v1.dependencies.get.query(input),
317
319
  setNote: (input) => cliClient.cli.v1.notes.set.mutate(input),
318
320
  getNote: (input) => cliClient.cli.v1.notes.get.query(input),
319
- searchNotes: (input) => cliClient.cli.v1.notes.search.query(input)
321
+ searchNotes: (input) => cliClient.cli.v1.notes.search.query(input),
322
+ listReminders: (input) => cliClient.cli.v1.reminders.list.query(input),
323
+ addReminders: (input) => cliClient.cli.v1.reminders.add.mutate(input),
324
+ setReminders: (input) => cliClient.cli.v1.reminders.set.mutate(input),
325
+ removeReminder: (input) => cliClient.cli.v1.reminders.remove.mutate(input)
320
326
  };
321
327
  }
322
328
 
@@ -371,6 +377,10 @@ async function runLogin(input, deps = createDefaultLoginDeps()) {
371
377
  // src/commands/auth/logout.ts
372
378
  function createDefaultLogoutDeps() {
373
379
  return {
380
+ revokeToken: async () => {
381
+ const api = await createCliApi({ baseUrl: getBaseUrl() });
382
+ await api.revokeCurrentToken();
383
+ },
374
384
  clearToken: () => clearCliToken(getBaseUrl()),
375
385
  writeLine: (message) => {
376
386
  process.stdout.write(`${message}
@@ -379,6 +389,7 @@ function createDefaultLogoutDeps() {
379
389
  };
380
390
  }
381
391
  async function runLogout(deps = createDefaultLogoutDeps()) {
392
+ await deps.revokeToken();
382
393
  await deps.clearToken();
383
394
  deps.writeLine?.("Signed out of dypt CLI.");
384
395
  }
@@ -889,6 +900,119 @@ async function runNoteSet(input, deps) {
889
900
  deps.printTable(result);
890
901
  }
891
902
 
903
+ // src/commands/reminder/timing.ts
904
+ var REMINDER_TIMINGS = [
905
+ ["at-deadline", 0, "At deadline"],
906
+ ["15m", 900, "15 minutes before"],
907
+ ["30m", 1800, "30 minutes before"],
908
+ ["1h", 3600, "1 hour before"],
909
+ ["2h", 7200, "2 hours before"],
910
+ ["3h", 10800, "3 hours before"],
911
+ ["12h", 43200, "12 hours before"],
912
+ ["1d", 86400, "1 day before"],
913
+ ["1w", 604800, "1 week before"]
914
+ ];
915
+ var timingByToken = new Map(
916
+ REMINDER_TIMINGS.map(([token, seconds]) => [token, seconds])
917
+ );
918
+ var labelBySeconds = new Map(
919
+ REMINDER_TIMINGS.map(([, seconds, label]) => [seconds, label])
920
+ );
921
+ var reminderTimingTokens = REMINDER_TIMINGS.map(([token]) => token);
922
+ function parseReminderTimings(timings) {
923
+ const parsed = timings.map((timing) => {
924
+ const seconds = timingByToken.get(timing);
925
+ if (seconds === void 0) {
926
+ const supported = [
927
+ reminderTimingTokens.slice(0, -1).join(", "),
928
+ reminderTimingTokens.at(-1)
929
+ ].join(", or ");
930
+ throw new Error(
931
+ `Unsupported reminder timing: ${timing}. Use ${supported}.`
932
+ );
933
+ }
934
+ return seconds;
935
+ });
936
+ if (new Set(parsed).size !== parsed.length) {
937
+ throw new Error("Reminder timings must be unique.");
938
+ }
939
+ if (parsed.length > 3) {
940
+ throw new Error("A task can have at most 3 reminders.");
941
+ }
942
+ return parsed;
943
+ }
944
+
945
+ // src/commands/reminder/reminder.ts
946
+ function formatReminderError(error) {
947
+ const message = error instanceof Error ? error.message : String(error);
948
+ switch (message) {
949
+ case "CLI_REMINDER_DEADLINE_REQUIRED":
950
+ return "Task must have a deadline before reminders can be configured.";
951
+ case "CLI_REMINDER_DUPLICATE":
952
+ return "Reminder timings must be unique and must not already be configured.";
953
+ case "CLI_REMINDER_LIMIT":
954
+ return "A task can have at most 3 reminders.";
955
+ case "CLI_REMINDER_NOT_FOUND":
956
+ return "Reminder not found on the specified task.";
957
+ case "CLI_REMINDER_TIMING_INVALID":
958
+ return "The reminder timing is not supported.";
959
+ case "CLI_TASK_NOT_FOUND":
960
+ return "Task not found or you do not have permission to edit its reminders.";
961
+ default:
962
+ return message;
963
+ }
964
+ }
965
+ async function runWithReminderError(operation) {
966
+ try {
967
+ return await operation();
968
+ } catch (error) {
969
+ throw new Error(formatReminderError(error));
970
+ }
971
+ }
972
+ function printResult(result, json, deps) {
973
+ if (json) {
974
+ deps.printJson(result);
975
+ return;
976
+ }
977
+ deps.printTable(result);
978
+ }
979
+ async function runReminderList(input, deps) {
980
+ const result = await runWithReminderError(
981
+ () => deps.listReminders(input.taskRef)
982
+ );
983
+ printResult(result, input.json, deps);
984
+ }
985
+ async function runReminderAdd(input, deps) {
986
+ const result = await runWithReminderError(
987
+ () => deps.addReminders(
988
+ input.taskRef,
989
+ parseReminderTimings(input.timings)
990
+ )
991
+ );
992
+ printResult(result, input.json, deps);
993
+ }
994
+ async function runReminderSet(input, deps) {
995
+ const result = await runWithReminderError(
996
+ () => deps.setReminders(
997
+ input.taskRef,
998
+ parseReminderTimings(input.timings)
999
+ )
1000
+ );
1001
+ printResult(result, input.json, deps);
1002
+ }
1003
+ async function runReminderRemove(input, deps) {
1004
+ const reminderId = Number(input.reminderId);
1005
+ if (!Number.isInteger(reminderId) || reminderId <= 0) {
1006
+ throw new Error(
1007
+ `Reminder id must be a positive integer: ${input.reminderId}`
1008
+ );
1009
+ }
1010
+ const result = await runWithReminderError(
1011
+ () => deps.removeReminder(input.taskRef, reminderId)
1012
+ );
1013
+ printResult(result, input.json, deps);
1014
+ }
1015
+
892
1016
  // src/commands/task/create.ts
893
1017
  async function runTaskCreate(input, deps) {
894
1018
  const result = await deps.createTask({
@@ -897,7 +1021,8 @@ async function runTaskCreate(input, deps) {
897
1021
  priority: input.priority,
898
1022
  deadline: input.deadline,
899
1023
  expectedTimeTaken: input.expectedTimeTaken,
900
- note: input.note
1024
+ note: input.note,
1025
+ timeBeforeDeadline: input.timeBeforeDeadline
901
1026
  });
902
1027
  if (input.json) {
903
1028
  deps.printJson(result);
@@ -1496,6 +1621,11 @@ function isTaskTreeResponseLike(value) {
1496
1621
  function isDependencyCollection(value) {
1497
1622
  return isRecord(value) && Array.isArray(value.blockers) && Array.isArray(value.dependents) && value.blockers.every(isDependencyLike) && value.dependents.every(isDependencyLike);
1498
1623
  }
1624
+ function isReminderCollection(value) {
1625
+ return isRecord(value) && isTaskLike(value.task) && Array.isArray(value.reminders) && value.reminders.every(
1626
+ (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"
1627
+ );
1628
+ }
1499
1629
  function parseDateValue(value) {
1500
1630
  if (!value) return null;
1501
1631
  if (value instanceof Date) return value;
@@ -2219,6 +2349,25 @@ function renderAgentStatus(result, color) {
2219
2349
  ];
2220
2350
  return lines.join("\n");
2221
2351
  }
2352
+ function renderReminderCollection(result, color) {
2353
+ const lines = [
2354
+ `${colorize(`#${result.task.id}`, "cyan", color)} ${result.task.title}`,
2355
+ `Deadline: ${parseDateValue(result.task.deadline)?.toISOString() ?? "-"}`,
2356
+ ""
2357
+ ];
2358
+ if (result.reminders.length === 0) {
2359
+ lines.push("No reminders configured.");
2360
+ return lines.join("\n");
2361
+ }
2362
+ lines.push("Reminders");
2363
+ for (const reminder of result.reminders) {
2364
+ const sent = reminder.sent ? colorize("sent", "green", color) : "pending";
2365
+ lines.push(
2366
+ `- #${reminder.id} ${reminder.label} (${reminder.timing}) \xB7 ${parseDateValue(reminder.remindAt)?.toISOString() ?? "-"} \xB7 ${sent}`
2367
+ );
2368
+ }
2369
+ return lines.join("\n");
2370
+ }
2222
2371
  function formatHumanOutput(value, options = {}) {
2223
2372
  const color = options.color ?? Boolean(process.stdout.isTTY);
2224
2373
  if (Array.isArray(value) && value.length === 0) {
@@ -2242,6 +2391,9 @@ function formatHumanOutput(value, options = {}) {
2242
2391
  if (isTaskSummaryLike(value)) {
2243
2392
  return renderTaskSummary(value, color);
2244
2393
  }
2394
+ if (isReminderCollection(value)) {
2395
+ return renderReminderCollection(value, color);
2396
+ }
2245
2397
  if (isTaskDetailLike(value)) {
2246
2398
  return renderTaskDetailResponse(value, color);
2247
2399
  }
@@ -2388,7 +2540,47 @@ function assertTaskId(ref) {
2388
2540
  }
2389
2541
  return taskId;
2390
2542
  }
2543
+ var TASK_PUBLIC_ID_PREFIX = "t_";
2544
+ var TASK_PUBLIC_ID_LENGTH = 16;
2545
+ var TASK_PUBLIC_ID_REFERENCE_MIN_BODY_LENGTH = 4;
2546
+ var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
2547
+ var taskPublicIdReferenceBodyPattern = new RegExp(
2548
+ `^[${BASE58_ALPHABET}]{${TASK_PUBLIC_ID_REFERENCE_MIN_BODY_LENGTH},${TASK_PUBLIC_ID_LENGTH}}$`
2549
+ );
2550
+ function normalizeTaskPublicIdReference(value) {
2551
+ const trimmed = value.trim();
2552
+ const taskPathMatch = trimmed.match(/\/tasks\/([^/?#]+)/);
2553
+ const candidate = decodeURIComponent(taskPathMatch?.[1] ?? trimmed).replace(
2554
+ /^#/,
2555
+ ""
2556
+ );
2557
+ const hasExplicitPrefix = candidate.startsWith(TASK_PUBLIC_ID_PREFIX);
2558
+ const body = candidate.startsWith(TASK_PUBLIC_ID_PREFIX) ? candidate.slice(TASK_PUBLIC_ID_PREFIX.length) : candidate;
2559
+ if (!taskPublicIdReferenceBodyPattern.test(body)) return null;
2560
+ if (!hasExplicitPrefix && /^\d+$/.test(body)) return null;
2561
+ return {
2562
+ publicId: `${TASK_PUBLIC_ID_PREFIX}${body}`,
2563
+ isFullId: body.length === TASK_PUBLIC_ID_LENGTH
2564
+ };
2565
+ }
2391
2566
  function resolveTaskRefFromSearchMatches(ref, matches) {
2567
+ const publicIdReference = normalizeTaskPublicIdReference(ref);
2568
+ if (publicIdReference) {
2569
+ const publicIdMatches = matches.filter(
2570
+ (task) => task.publicId?.startsWith(publicIdReference.publicId) ?? false
2571
+ );
2572
+ if (publicIdMatches.length === 1) {
2573
+ return publicIdMatches[0].id;
2574
+ }
2575
+ if (publicIdMatches.length > 1) {
2576
+ const formattedMatches = publicIdMatches.map((task) => {
2577
+ const path4 = task.pathTitles?.join(" > ") ?? [task.parentTitle, task.title].filter(Boolean).join(" > ") ?? task.title;
2578
+ return `- #${task.id} ${path4}`;
2579
+ }).join("\n");
2580
+ throw new Error(`Task reference is ambiguous: ${ref}
2581
+ ${formattedMatches}`);
2582
+ }
2583
+ }
2392
2584
  const normalizedRef = ref.trim().toLocaleLowerCase();
2393
2585
  const exactMatches = matches.filter(
2394
2586
  (task) => task.title.trim().toLocaleLowerCase() === normalizedRef
@@ -2487,7 +2679,7 @@ function buildCli() {
2487
2679
  }
2488
2680
  );
2489
2681
  });
2490
- auth.command("logout").description("Remove the local CLI token").action(async () => {
2682
+ auth.command("logout").description("Revoke the current CLI session").action(async () => {
2491
2683
  await runLogout(createDefaultLogoutDeps());
2492
2684
  });
2493
2685
  const agent = addGroupHelpAction(
@@ -2909,8 +3101,18 @@ function buildCli() {
2909
3101
  "--priority <priority>",
2910
3102
  `task priority (${taskPriorityChoices.join("|")})`
2911
3103
  ).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(
3104
+ ).option("--deadline <deadline>", "ISO deadline").option("--expected-time <minutes>", "expected minutes").option("--note <markdown>", "initial task note in Markdown").option(
3105
+ "--reminder <timing>",
3106
+ `create-time reminder (${reminderTimingTokens.join("|")}); repeat for up to 3 reminders`,
3107
+ (timing, timings) => [
3108
+ ...timings ?? [],
3109
+ timing
3110
+ ]
3111
+ ).option("--json", "print JSON output").action(
2913
3112
  async (title, options) => {
3113
+ if (options.reminder && !options.deadline) {
3114
+ throw new Error("Use --reminder only with --deadline.");
3115
+ }
2914
3116
  await runTaskCreate(
2915
3117
  {
2916
3118
  title,
@@ -2921,6 +3123,7 @@ function buildCli() {
2921
3123
  "expected-time"
2922
3124
  ),
2923
3125
  note: options.note,
3126
+ timeBeforeDeadline: options.reminder ? parseReminderTimings(options.reminder) : void 0,
2924
3127
  json: Boolean(options.json)
2925
3128
  },
2926
3129
  {
@@ -3002,7 +3205,7 @@ function buildCli() {
3002
3205
  title: options.title,
3003
3206
  status: options.status,
3004
3207
  priority: options.priority,
3005
- deadline: options.deadline,
3208
+ deadline: options.deadline ? parseDateOption(options.deadline, "start").toISOString() : void 0,
3006
3209
  expectedTimeTaken: options.expectedTime,
3007
3210
  actualTimeTaken: options.actualTime,
3008
3211
  archivedAt: options.archive ? /* @__PURE__ */ new Date() : options.unarchive ? null : void 0,
@@ -3103,7 +3306,7 @@ function buildCli() {
3103
3306
  refs,
3104
3307
  status: options.status,
3105
3308
  priority: options.priority,
3106
- deadline: options.deadline,
3309
+ deadline: options.deadline ? parseDateOption(options.deadline, "start").toISOString() : void 0,
3107
3310
  expectedTimeTaken: options.expectedTime,
3108
3311
  actualTimeTaken: options.actualTime,
3109
3312
  archivedAt: options.archive ? /* @__PURE__ */ new Date() : options.unarchive ? null : void 0,
@@ -3368,6 +3571,81 @@ function buildCli() {
3368
3571
  }
3369
3572
  );
3370
3573
  });
3574
+ const reminder = addGroupHelpAction(
3575
+ program.command("reminder").description("Task reminder commands")
3576
+ );
3577
+ const reminderTimingHelp = reminderTimingTokens.join("|");
3578
+ 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) => {
3579
+ await runReminderList(
3580
+ { taskRef, json: Boolean(options.json) },
3581
+ {
3582
+ listReminders: (ref) => withCliApi(
3583
+ async (api) => api.listReminders({
3584
+ taskId: await resolveTaskId(api, ref)
3585
+ })
3586
+ ),
3587
+ printJson,
3588
+ printTable
3589
+ }
3590
+ );
3591
+ });
3592
+ reminder.command("add").description("Add one or more reminders without replacing existing ones").argument("<taskRef>", "task id, title, or public reference").argument(
3593
+ "<timings...>",
3594
+ `timings (${reminderTimingHelp}); maximum 3 per task`
3595
+ ).option("--json", "print JSON output").action(
3596
+ async (taskRef, timings, options) => {
3597
+ await runReminderAdd(
3598
+ { taskRef, timings, json: Boolean(options.json) },
3599
+ {
3600
+ addReminders: (ref, timeBeforeDeadline) => withCliApi(
3601
+ async (api) => api.addReminders({
3602
+ taskId: await resolveTaskId(api, ref),
3603
+ timeBeforeDeadline
3604
+ })
3605
+ ),
3606
+ printJson,
3607
+ printTable
3608
+ }
3609
+ );
3610
+ }
3611
+ );
3612
+ reminder.command("set").description("Replace all reminders configured on a task").argument("<taskRef>", "task id, title, or public reference").argument(
3613
+ "<timings...>",
3614
+ `replacement timings (${reminderTimingHelp}); maximum 3`
3615
+ ).option("--json", "print JSON output").action(
3616
+ async (taskRef, timings, options) => {
3617
+ await runReminderSet(
3618
+ { taskRef, timings, json: Boolean(options.json) },
3619
+ {
3620
+ setReminders: (ref, timeBeforeDeadline) => withCliApi(
3621
+ async (api) => api.setReminders({
3622
+ taskId: await resolveTaskId(api, ref),
3623
+ timeBeforeDeadline
3624
+ })
3625
+ ),
3626
+ printJson,
3627
+ printTable
3628
+ }
3629
+ );
3630
+ }
3631
+ );
3632
+ 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(
3633
+ async (taskRef, reminderId, options) => {
3634
+ await runReminderRemove(
3635
+ { taskRef, reminderId, json: Boolean(options.json) },
3636
+ {
3637
+ removeReminder: (ref, id) => withCliApi(
3638
+ async (api) => api.removeReminder({
3639
+ taskId: await resolveTaskId(api, ref),
3640
+ reminderId: id
3641
+ })
3642
+ ),
3643
+ printJson,
3644
+ printTable
3645
+ }
3646
+ );
3647
+ }
3648
+ );
3371
3649
  const note = addGroupHelpAction(
3372
3650
  program.command("note").description("Note commands")
3373
3651
  );