@dypt/cli 0.1.18 → 0.1.19

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
@@ -83,12 +83,32 @@ Change status, priority, due date, archive state, or parent:
83
83
  dypt task update 123 --status "in progress"
84
84
  dypt task update 123 --priority high
85
85
  dypt task update 123 --deadline 2026-05-01T09:00:00Z
86
+ dypt task update 123 --clear-deadline --preview
87
+ dypt task update 123 --clear-deadline
86
88
  dypt task update 123 --parent Work
87
89
  dypt task update 123 --parent root --preview
88
90
  dypt task update 123 --position 0
89
91
  dypt task update 123 --archive
90
92
  ```
91
93
 
94
+ `dypt task update-many` (including `--preview`) accepts at most 100 task IDs
95
+ per request, including repeated IDs. Apply commits the whole request and its
96
+ sync history atomically: if any task or journal write fails, no part of that
97
+ request is committed. Split larger updates into explicit batches; separate
98
+ requests are not one transaction. A lost response is still an uncertain
99
+ outcome—inspect the tasks before retrying.
100
+
101
+ Use `--clear-deadline` to remove an existing deadline. It can be previewed for
102
+ single or bulk updates:
103
+
104
+ ```bash
105
+ dypt task update-many 123 456 --clear-deadline --preview
106
+ dypt task update-many 123 456 --clear-deadline
107
+ ```
108
+
109
+ `--deadline` and `--clear-deadline` are mutually exclusive. Omitting both
110
+ leaves the current deadline unchanged.
111
+
92
112
  ### Reorder tasks
93
113
 
94
114
  Set visible sibling order from an explicit task list. Preview first for safe
@@ -103,6 +123,14 @@ dypt task reorder 71595 71594 71598 --parent Work
103
123
  Dependencies and blockers are not changed by reordering; use `dypt dep` commands
104
124
  for execution dependencies.
105
125
 
126
+ Reorder and its preview accept at most 100 submitted IDs and require the
127
+ **complete sibling set**, including omitted and archived siblings, to contain
128
+ at most 100 tasks. Selected tasks come first; omitted siblings keep their
129
+ relative order afterwards. Larger sibling sets are rejected with
130
+ `CLI_BULK_TASK_LIMIT_EXCEEDED` before writes, not truncated or automatically
131
+ chunked (chunking would change the meaning of the reorder). Reorder writes and
132
+ sync history commit atomically, using the same rollback contract as bulk updates.
133
+
106
134
  ### Manage reminders
107
135
 
108
136
  Configure up to three reminders relative to a task's deadline:
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.18",
12
+ version: "0.1.19",
13
13
  description: "Command-line interface for dypt task management",
14
14
  license: "SEE LICENSE IN LICENSE",
15
15
  homepage: "https://dypt.app",
@@ -486,6 +486,7 @@ async function createCliApi(options = {}) {
486
486
  getBranchFocusSignals: (input) => cliClient.cli.v1.tasks.planFocus.query(input),
487
487
  listTasks: (input) => cliClient.cli.v1.tasks.list.query(input ?? {}),
488
488
  searchTasks: (input) => cliClient.cli.v1.tasks.search.query(input),
489
+ resolveTaskReferences: (input) => cliClient.cli.v1.tasks.resolveMany.query(input),
489
490
  getTaskTree: (input) => cliClient.cli.v1.tasks.tree.query(input),
490
491
  deleteTasks: (input) => cliClient.cli.v1.tasks.deleteMany.mutate(input),
491
492
  addDependency: (input) => cliClient.cli.v1.dependencies.add.mutate(input),
@@ -505,7 +506,8 @@ async function createCliApi(options = {}) {
505
506
  deleteTag: (input) => cliClient.cli.v1.tags.delete.mutate(input),
506
507
  mergeTag: (input) => cliClient.cli.v1.tags.merge.mutate(input),
507
508
  getTaskTags: (input) => cliClient.cli.v1.tags.forTask.query(input),
508
- assignTaskTags: (input) => cliClient.cli.v1.tags.assign.mutate(input)
509
+ assignTaskTags: (input) => cliClient.cli.v1.tags.assign.mutate(input),
510
+ assignManyTaskTags: (input) => cliClient.cli.v1.tags.assignMany.mutate(input)
509
511
  };
510
512
  }
511
513
 
@@ -1468,7 +1470,7 @@ async function runTaskUpdate(input, deps) {
1468
1470
  const hasMutations = input.title !== void 0 || hasSharedTaskMutationFields(sharedArgs) || input.position !== void 0;
1469
1471
  if (!hasMutations) {
1470
1472
  throw new Error(
1471
- "No changes specified. Use --title, --status, --priority, --deadline, --expected-time, --actual-time, --archive, --unarchive, --parent, or --position."
1473
+ "No changes specified. Use --title, --status, --priority, --deadline, --clear-deadline, --expected-time, --actual-time, --archive, --unarchive, --parent, or --position."
1472
1474
  );
1473
1475
  }
1474
1476
  if (input.preview && input.title !== void 0) {
@@ -1498,7 +1500,7 @@ async function runTaskUpdateMany(input, deps) {
1498
1500
  const hasMutations = hasSharedTaskMutationFields(sharedArgs);
1499
1501
  if (!hasMutations) {
1500
1502
  throw new Error(
1501
- "No changes specified. Use --status, --priority, --deadline, --expected-time, --actual-time, --archive, --unarchive, or --parent."
1503
+ "No changes specified. Use --status, --priority, --deadline, --clear-deadline, --expected-time, --actual-time, --archive, --unarchive, or --parent."
1502
1504
  );
1503
1505
  }
1504
1506
  const args = {
@@ -1630,18 +1632,26 @@ async function runTaskCleanupRelocateCollapse(input, deps) {
1630
1632
  "Provide at least one surviving task with --tasks <refs...>."
1631
1633
  );
1632
1634
  }
1633
- const wrapperId = await deps.resolveTaskRef(input.wrapper);
1634
- const toParentId = input.to === "root" ? null : await deps.resolveTaskRef(input.to);
1635
+ const refsToResolve = [
1636
+ input.wrapper,
1637
+ ...input.to === "root" ? [] : [input.to],
1638
+ ...input.tasks
1639
+ ];
1640
+ const resolvedRefs = deps.resolveTaskRefs ? await deps.resolveTaskRefs(refsToResolve) : await Promise.all(refsToResolve.map((ref) => deps.resolveTaskRef(ref)));
1641
+ let resolvedIndex = 0;
1642
+ const wrapperId = resolvedRefs[resolvedIndex++];
1643
+ const toParentId = input.to === "root" ? null : resolvedRefs[resolvedIndex++];
1635
1644
  if (toParentId === wrapperId) {
1636
1645
  throw new Error("Destination cannot be the wrapper itself.");
1637
1646
  }
1638
- const movingTaskIds = dedupeTaskIds(
1639
- await Promise.all(input.tasks.map((ref) => deps.resolveTaskRef(ref)))
1640
- );
1647
+ const movingTaskIds = dedupeTaskIds(resolvedRefs.slice(resolvedIndex));
1641
1648
  if (toParentId !== null && movingTaskIds.includes(toParentId)) {
1642
1649
  throw new Error("Destination cannot be one of the tasks being moved.");
1643
1650
  }
1644
- const activeDirectChildren = await loadAllActiveDirectChildren(wrapperId, deps);
1651
+ const activeDirectChildren = await loadAllActiveDirectChildren(
1652
+ wrapperId,
1653
+ deps
1654
+ );
1645
1655
  const activeDirectChildIds = new Set(
1646
1656
  activeDirectChildren.map((child) => child.id)
1647
1657
  );
@@ -1687,6 +1697,16 @@ function print(result, json, deps) {
1687
1697
  if (json) deps.printJson(result);
1688
1698
  else deps.printTable(result);
1689
1699
  }
1700
+ function normalizeBulkAssignmentOutput(result) {
1701
+ if (!Array.isArray(result)) return result;
1702
+ const taskTags = result.map((item) => {
1703
+ if (typeof item === "object" && item !== null && "tags" in item && Array.isArray(item.tags)) {
1704
+ return item.tags;
1705
+ }
1706
+ return item;
1707
+ });
1708
+ return taskTags.length === 1 ? taskTags[0] : taskTags;
1709
+ }
1690
1710
  async function runTagList(input, deps) {
1691
1711
  const result = await deps.listTags({
1692
1712
  query: input.query,
@@ -1726,6 +1746,14 @@ async function runTagMerge(input, deps) {
1726
1746
  deps
1727
1747
  );
1728
1748
  }
1749
+ async function runTaskTagsAssign(input, deps) {
1750
+ const result = await deps.assignTags({
1751
+ taskIds: input.taskIds,
1752
+ tagPublicIds: input.tagPublicIds,
1753
+ mode: input.clear ? "clear" : "add"
1754
+ });
1755
+ print(normalizeBulkAssignmentOutput(result), input.json, deps);
1756
+ }
1729
1757
 
1730
1758
  // src/lib/banner.ts
1731
1759
  var BANNER_LINES = [
@@ -2939,6 +2967,32 @@ async function resolveTaskId(api, ref) {
2939
2967
  const matches = result.items ?? [];
2940
2968
  return resolveTaskRefFromSearchMatches(ref, matches);
2941
2969
  }
2970
+ var MAX_BULK_NON_NUMERIC_TASK_REFERENCES = 100;
2971
+ async function resolveTaskIds(api, refs) {
2972
+ const nonNumericRefs = refs.filter((ref) => !/^\d+$/.test(ref));
2973
+ if (nonNumericRefs.length > MAX_BULK_NON_NUMERIC_TASK_REFERENCES) {
2974
+ throw new Error(
2975
+ `Resolve at most ${MAX_BULK_NON_NUMERIC_TASK_REFERENCES} non-numeric task references per command`
2976
+ );
2977
+ }
2978
+ const result = nonNumericRefs.length ? await api.resolveTaskReferences({
2979
+ refs: nonNumericRefs,
2980
+ archived: "all"
2981
+ }) : { items: [] };
2982
+ const resolvedItems = result.items ?? [];
2983
+ if (resolvedItems.length !== nonNumericRefs.length) {
2984
+ throw new Error("Task reference resolution returned an incomplete result");
2985
+ }
2986
+ let nonNumericIndex = 0;
2987
+ return refs.map((ref) => {
2988
+ if (/^\d+$/.test(ref)) return assertTaskId(ref);
2989
+ const item = resolvedItems[nonNumericIndex++];
2990
+ if (!item || item.ref !== ref) {
2991
+ throw new Error("Task reference resolution returned an invalid order");
2992
+ }
2993
+ return resolveTaskRefFromSearchMatches(ref, item.matches);
2994
+ });
2995
+ }
2942
2996
  async function resolveParentId(parentRef, resolveRef) {
2943
2997
  if (parentRef === void 0) {
2944
2998
  return void 0;
@@ -2958,6 +3012,15 @@ function assertExclusiveArchiveOptions(archive, unarchive) {
2958
3012
  throw new Error("Use either --archive or --unarchive, not both");
2959
3013
  }
2960
3014
  }
3015
+ function assertExclusiveDeadlineOptions(deadline, clearDeadline) {
3016
+ if (deadline && clearDeadline) {
3017
+ throw new Error("Use either --deadline or --clear-deadline, not both");
3018
+ }
3019
+ }
3020
+ function toTaskMutationDeadline(deadline) {
3021
+ if (deadline === null) return null;
3022
+ return deadline ? new Date(deadline) : void 0;
3023
+ }
2961
3024
  async function withCliApi(callback) {
2962
3025
  const api = await createCliApi();
2963
3026
  return callback(api);
@@ -3150,20 +3213,18 @@ function buildCli() {
3150
3213
  );
3151
3214
  tag.command("assign").argument("<task-refs...>").option(
3152
3215
  "--tag <name>",
3153
- "existing tag name; repeat to assign multiple",
3216
+ "existing tag to add; repeat to assign multiple",
3154
3217
  (value, values = []) => [...values, value]
3155
- ).option("--clear", "remove all tags from the task").option("--json", "print JSON output").action(
3218
+ ).option("--clear", "remove all tags from the selected tasks").option("--json", "print JSON output").action(
3156
3219
  async (taskRefs, options) => {
3157
3220
  if (!options.clear && !options.tag?.length)
3158
3221
  throw new Error("Provide at least one --tag or use --clear.");
3159
3222
  await withCliApi(async (api) => {
3160
- const taskIds = await Promise.all(
3161
- taskRefs.map((taskRef) => resolveTaskId(api, taskRef))
3162
- );
3163
- const catalogue = await api.listTags({});
3223
+ const taskIds = await resolveTaskIds(api, taskRefs);
3164
3224
  const requested = (options.tag ?? []).map(
3165
3225
  (name) => name.trim().replace(/\s+/g, " ").toLowerCase()
3166
3226
  );
3227
+ const catalogue = requested.length ? await api.listTags({}) : [];
3167
3228
  const matched = requested.map(
3168
3229
  (name) => catalogue.find((tag2) => tag2.name === name)
3169
3230
  );
@@ -3172,14 +3233,19 @@ function buildCli() {
3172
3233
  "Every --tag must name an existing tag. Use `dypt tag create` first."
3173
3234
  );
3174
3235
  const tagPublicIds = options.clear ? [] : matched.map((item) => item.publicId);
3175
- const results = await Promise.all(
3176
- taskIds.map(
3177
- (taskId) => api.assignTaskTags({ taskId, tagPublicIds })
3178
- )
3236
+ await runTaskTagsAssign(
3237
+ {
3238
+ taskIds,
3239
+ tagPublicIds,
3240
+ clear: Boolean(options.clear),
3241
+ json: Boolean(options.json)
3242
+ },
3243
+ {
3244
+ assignTags: (input) => api.assignManyTaskTags(input),
3245
+ printJson,
3246
+ printTable
3247
+ }
3179
3248
  );
3180
- const output = results.length === 1 ? results[0] : results;
3181
- if (options.json) printJson(output);
3182
- else printTable(output);
3183
3249
  });
3184
3250
  }
3185
3251
  );
@@ -3719,9 +3785,7 @@ function buildCli() {
3719
3785
  readLine: promptLine
3720
3786
  }),
3721
3787
  deleteTasks: (taskRefs) => withCliApi(async (api) => {
3722
- const taskIds = await Promise.all(
3723
- taskRefs.map((ref) => resolveTaskId(api, ref))
3724
- );
3788
+ const taskIds = await resolveTaskIds(api, taskRefs);
3725
3789
  return api.deleteTasks({ taskIds });
3726
3790
  }),
3727
3791
  printJson,
@@ -3740,16 +3804,17 @@ function buildCli() {
3740
3804
  "--priority <priority>",
3741
3805
  `new priority (${taskPriorityChoices.join("|")})`
3742
3806
  ).choices([...taskPriorityChoices])
3743
- ).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(
3807
+ ).option("--deadline <deadline>", "ISO deadline").option("--clear-deadline", "remove the task 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(
3744
3808
  async (ref, options) => {
3745
3809
  assertExclusiveArchiveOptions(options.archive, options.unarchive);
3810
+ assertExclusiveDeadlineOptions(options.deadline, options.clearDeadline);
3746
3811
  await runTaskUpdate(
3747
3812
  {
3748
3813
  ref,
3749
3814
  title: options.title,
3750
3815
  status: options.status,
3751
3816
  priority: options.priority,
3752
- deadline: options.deadline ? parseDateOption(options.deadline, "start").toISOString() : void 0,
3817
+ deadline: options.clearDeadline ? null : options.deadline ? parseDateOption(options.deadline, "start").toISOString() : void 0,
3753
3818
  expectedTimeTaken: options.expectedTime,
3754
3819
  actualTimeTaken: options.actualTime,
3755
3820
  archivedAt: options.archive ? /* @__PURE__ */ new Date() : options.unarchive ? null : void 0,
@@ -3765,7 +3830,7 @@ function buildCli() {
3765
3830
  title: input.title,
3766
3831
  status: normalizeStatus(input.status),
3767
3832
  priority: normalizePriority(input.priority),
3768
- deadline: input.deadline ? new Date(String(input.deadline)) : void 0,
3833
+ deadline: toTaskMutationDeadline(input.deadline),
3769
3834
  expectedTimeTaken: parseIntegerOption(
3770
3835
  input.expectedTimeTaken,
3771
3836
  "expected-time",
@@ -3789,7 +3854,7 @@ function buildCli() {
3789
3854
  taskIds: [await resolveTaskId(api, String(input.ref))],
3790
3855
  status: normalizeStatus(input.status),
3791
3856
  priority: normalizePriority(input.priority),
3792
- deadline: input.deadline ? new Date(String(input.deadline)) : void 0,
3857
+ deadline: toTaskMutationDeadline(input.deadline),
3793
3858
  expectedTimeTaken: parseIntegerOption(
3794
3859
  input.expectedTimeTaken,
3795
3860
  "expected-time",
@@ -3846,15 +3911,16 @@ function buildCli() {
3846
3911
  "--priority <priority>",
3847
3912
  `new priority (${taskPriorityChoices.join("|")})`
3848
3913
  ).choices([...taskPriorityChoices])
3849
- ).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(
3914
+ ).option("--deadline <deadline>", "ISO deadline").option("--clear-deadline", "remove deadlines from the tasks").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(
3850
3915
  async (refs, options) => {
3851
3916
  assertExclusiveArchiveOptions(options.archive, options.unarchive);
3917
+ assertExclusiveDeadlineOptions(options.deadline, options.clearDeadline);
3852
3918
  await runTaskUpdateMany(
3853
3919
  {
3854
3920
  refs,
3855
3921
  status: options.status,
3856
3922
  priority: options.priority,
3857
- deadline: options.deadline ? parseDateOption(options.deadline, "start").toISOString() : void 0,
3923
+ deadline: options.clearDeadline ? null : options.deadline ? parseDateOption(options.deadline, "start").toISOString() : void 0,
3858
3924
  expectedTimeTaken: options.expectedTime,
3859
3925
  actualTimeTaken: options.actualTime,
3860
3926
  archivedAt: options.archive ? /* @__PURE__ */ new Date() : options.unarchive ? null : void 0,
@@ -3864,14 +3930,12 @@ function buildCli() {
3864
3930
  },
3865
3931
  {
3866
3932
  updateManyTasks: (input) => withCliApi(async (api) => {
3867
- const taskIds = await Promise.all(
3868
- input.refs.map((ref) => resolveTaskId(api, ref))
3869
- );
3933
+ const taskIds = await resolveTaskIds(api, input.refs);
3870
3934
  return api.updateManyTasks({
3871
3935
  taskIds,
3872
3936
  status: normalizeStatus(input.status),
3873
3937
  priority: normalizePriority(input.priority),
3874
- deadline: input.deadline ? new Date(String(input.deadline)) : void 0,
3938
+ deadline: toTaskMutationDeadline(input.deadline),
3875
3939
  expectedTimeTaken: parseIntegerOption(
3876
3940
  input.expectedTimeTaken,
3877
3941
  "expected-time",
@@ -3890,14 +3954,12 @@ function buildCli() {
3890
3954
  });
3891
3955
  }),
3892
3956
  previewManyTasks: (input) => withCliApi(async (api) => {
3893
- const taskIds = await Promise.all(
3894
- input.refs.map((ref) => resolveTaskId(api, ref))
3895
- );
3957
+ const taskIds = await resolveTaskIds(api, input.refs);
3896
3958
  return api.previewManyTasks({
3897
3959
  taskIds,
3898
3960
  status: normalizeStatus(input.status),
3899
3961
  priority: normalizePriority(input.priority),
3900
- deadline: input.deadline ? new Date(String(input.deadline)) : void 0,
3962
+ deadline: toTaskMutationDeadline(input.deadline),
3901
3963
  expectedTimeTaken: parseIntegerOption(
3902
3964
  input.expectedTimeTaken,
3903
3965
  "expected-time",
@@ -3935,9 +3997,7 @@ function buildCli() {
3935
3997
  },
3936
3998
  {
3937
3999
  reorderTasks: (input) => withCliApi(async (api) => {
3938
- const taskIds = await Promise.all(
3939
- input.refs.map((ref) => resolveTaskId(api, ref))
3940
- );
4000
+ const taskIds = await resolveTaskIds(api, input.refs);
3941
4001
  return api.reorderTasks({
3942
4002
  taskIds,
3943
4003
  parentId: await resolveParentId(
@@ -3947,9 +4007,7 @@ function buildCli() {
3947
4007
  });
3948
4008
  }),
3949
4009
  previewReorderTasks: (input) => withCliApi(async (api) => {
3950
- const taskIds = await Promise.all(
3951
- input.refs.map((ref) => resolveTaskId(api, ref))
3952
- );
4010
+ const taskIds = await resolveTaskIds(api, input.refs);
3953
4011
  return api.previewReorderTasks({
3954
4012
  taskIds,
3955
4013
  parentId: await resolveParentId(
@@ -3997,6 +4055,7 @@ function buildCli() {
3997
4055
  },
3998
4056
  {
3999
4057
  resolveTaskRef: (ref) => resolveTaskId(api, ref),
4058
+ resolveTaskRefs: (refs) => resolveTaskIds(api, refs),
4000
4059
  listActiveDirectChildren: ({ wrapperId, cursor }) => api.listTasks({
4001
4060
  parentTaskId: wrapperId,
4002
4061
  archived: "active",
@@ -4278,8 +4337,10 @@ export {
4278
4337
  buildCli,
4279
4338
  isCliEntrypoint,
4280
4339
  resolveParentId,
4340
+ resolveTaskIds,
4281
4341
  resolveTaskRefFromSearchMatches,
4282
4342
  runCli,
4283
- runCliEntrypoint
4343
+ runCliEntrypoint,
4344
+ toTaskMutationDeadline
4284
4345
  };
4285
4346
  //# sourceMappingURL=index.js.map