@dypt/cli 0.1.18 → 0.1.20

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
@@ -25,6 +25,21 @@ dypt auth login
25
25
  dypt auth status
26
26
  ```
27
27
 
28
+ By default on macOS, dypt stores CLI credentials in Keychain and falls back to
29
+ the URL-scoped file under `~/.config/dypt/tokens` only when Keychain is
30
+ unavailable. To deliberately use one file and skip Keychain entirely, set an
31
+ absolute path:
32
+
33
+ ```bash
34
+ DYPT_TOKEN_FILE=/absolute/path/to/dypt-token.json dypt auth login
35
+ ```
36
+
37
+ Keep `DYPT_TOKEN_FILE` set to the same path for subsequent commands and
38
+ `dypt auth logout`. When explicitly configured, a missing or invalid file does
39
+ not fall back to Keychain or another identity. The token file is created with
40
+ owner-only permissions; its containing directory and any sandbox access to the
41
+ file remain the user's responsibility.
42
+
28
43
  ### List tasks
29
44
 
30
45
  See tasks from your account:
@@ -83,12 +98,32 @@ Change status, priority, due date, archive state, or parent:
83
98
  dypt task update 123 --status "in progress"
84
99
  dypt task update 123 --priority high
85
100
  dypt task update 123 --deadline 2026-05-01T09:00:00Z
101
+ dypt task update 123 --clear-deadline --preview
102
+ dypt task update 123 --clear-deadline
86
103
  dypt task update 123 --parent Work
87
104
  dypt task update 123 --parent root --preview
88
105
  dypt task update 123 --position 0
89
106
  dypt task update 123 --archive
90
107
  ```
91
108
 
109
+ `dypt task update-many` (including `--preview`) accepts at most 100 task IDs
110
+ per request, including repeated IDs. Apply commits the whole request and its
111
+ sync history atomically: if any task or journal write fails, no part of that
112
+ request is committed. Split larger updates into explicit batches; separate
113
+ requests are not one transaction. A lost response is still an uncertain
114
+ outcome—inspect the tasks before retrying.
115
+
116
+ Use `--clear-deadline` to remove an existing deadline. It can be previewed for
117
+ single or bulk updates:
118
+
119
+ ```bash
120
+ dypt task update-many 123 456 --clear-deadline --preview
121
+ dypt task update-many 123 456 --clear-deadline
122
+ ```
123
+
124
+ `--deadline` and `--clear-deadline` are mutually exclusive. Omitting both
125
+ leaves the current deadline unchanged.
126
+
92
127
  ### Reorder tasks
93
128
 
94
129
  Set visible sibling order from an explicit task list. Preview first for safe
@@ -103,6 +138,14 @@ dypt task reorder 71595 71594 71598 --parent Work
103
138
  Dependencies and blockers are not changed by reordering; use `dypt dep` commands
104
139
  for execution dependencies.
105
140
 
141
+ Reorder and its preview accept at most 100 submitted IDs and require the
142
+ **complete sibling set**, including omitted and archived siblings, to contain
143
+ at most 100 tasks. Selected tasks come first; omitted siblings keep their
144
+ relative order afterwards. Larger sibling sets are rejected with
145
+ `CLI_BULK_TASK_LIMIT_EXCEEDED` before writes, not truncated or automatically
146
+ chunked (chunking would change the meaning of the reorder). Reorder writes and
147
+ sync history commit atomically, using the same rollback contract as bulk updates.
148
+
106
149
  ### Manage reminders
107
150
 
108
151
  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.20",
13
13
  description: "Command-line interface for dypt task management",
14
14
  license: "SEE LICENSE IN LICENSE",
15
15
  homepage: "https://dypt.app",
@@ -67,6 +67,17 @@ function getScopedTokenFilePath(baseUrl) {
67
67
  const scope = `${url.protocol.slice(0, -1)}-${url.hostname}${url.port ? `-${url.port}` : ""}`.replace(/[^a-zA-Z0-9.-]/g, "-").toLowerCase();
68
68
  return path.join(getConfigDir(), "tokens", `${scope}.json`);
69
69
  }
70
+ function getConfiguredTokenFilePath() {
71
+ const configuredPath = process.env.DYPT_TOKEN_FILE;
72
+ if (configuredPath === void 0) {
73
+ return null;
74
+ }
75
+ const normalizedPath = configuredPath.trim();
76
+ if (!normalizedPath || !path.isAbsolute(normalizedPath)) {
77
+ throw new Error("DYPT_TOKEN_FILE must be a non-empty absolute path");
78
+ }
79
+ return path.normalize(normalizedPath);
80
+ }
70
81
  function getBaseUrl() {
71
82
  return (process.env.DYPT_BASE_URL ?? process.env.NEXT_PUBLIC_URL ?? "https://dypt.app").replace(/\/+$/, "");
72
83
  }
@@ -101,6 +112,19 @@ async function removeFallbackTokenFile(filePath) {
101
112
  }
102
113
  }
103
114
  }
115
+ function resolveTokenStorage(baseUrl, filePath) {
116
+ if (filePath !== void 0) {
117
+ return { filePath, useKeychain: true };
118
+ }
119
+ const configuredFilePath = getConfiguredTokenFilePath();
120
+ if (configuredFilePath) {
121
+ return { filePath: configuredFilePath, useKeychain: false };
122
+ }
123
+ return {
124
+ filePath: getScopedTokenFilePath(baseUrl),
125
+ useKeychain: true
126
+ };
127
+ }
104
128
  function getCredentialScope(baseUrl = getBaseUrl()) {
105
129
  const url = new URL(baseUrl);
106
130
  return `${url.protocol}//${url.host}`;
@@ -174,13 +198,16 @@ async function clearMacOsKeychainToken(baseUrl) {
174
198
  }
175
199
  }
176
200
  }
177
- async function readCliToken(baseUrl = getBaseUrl(), filePath = getScopedTokenFilePath(baseUrl)) {
178
- const keychainRecord = await readMacOsKeychainToken(baseUrl);
179
- if (keychainRecord) {
180
- return keychainRecord;
201
+ async function readCliToken(baseUrl = getBaseUrl(), filePath) {
202
+ const storage = resolveTokenStorage(baseUrl, filePath);
203
+ if (storage.useKeychain) {
204
+ const keychainRecord = await readMacOsKeychainToken(baseUrl);
205
+ if (keychainRecord) {
206
+ return keychainRecord;
207
+ }
181
208
  }
182
209
  try {
183
- const raw = await readFile(filePath, "utf8");
210
+ const raw = await readFile(storage.filePath, "utf8");
184
211
  const parsed = JSON.parse(raw);
185
212
  if (!parsed.accessToken || !parsed.expiresAt) {
186
213
  return null;
@@ -196,19 +223,22 @@ async function readCliToken(baseUrl = getBaseUrl(), filePath = getScopedTokenFil
196
223
  throw error;
197
224
  }
198
225
  }
199
- async function saveCliToken(accessToken, expiresAt, baseUrl = getBaseUrl(), filePath = getScopedTokenFilePath(baseUrl)) {
200
- const wroteToKeychain = await saveMacOsKeychainToken(
201
- accessToken,
202
- expiresAt,
203
- baseUrl
204
- );
205
- if (wroteToKeychain) {
206
- await removeFallbackTokenFile(filePath);
207
- return;
226
+ async function saveCliToken(accessToken, expiresAt, baseUrl = getBaseUrl(), filePath) {
227
+ const storage = resolveTokenStorage(baseUrl, filePath);
228
+ if (storage.useKeychain) {
229
+ const wroteToKeychain = await saveMacOsKeychainToken(
230
+ accessToken,
231
+ expiresAt,
232
+ baseUrl
233
+ );
234
+ if (wroteToKeychain) {
235
+ await removeFallbackTokenFile(storage.filePath);
236
+ return;
237
+ }
208
238
  }
209
- await ensureParentDirectory(filePath);
239
+ await ensureParentDirectory(storage.filePath);
210
240
  await writeFile(
211
- filePath,
241
+ storage.filePath,
212
242
  `${JSON.stringify({ accessToken, expiresAt }, null, 2)}
213
243
  `,
214
244
  {
@@ -216,15 +246,18 @@ async function saveCliToken(accessToken, expiresAt, baseUrl = getBaseUrl(), file
216
246
  }
217
247
  );
218
248
  }
219
- async function clearCliToken(baseUrl = getBaseUrl(), filePath = getScopedTokenFilePath(baseUrl)) {
249
+ async function clearCliToken(baseUrl = getBaseUrl(), filePath) {
250
+ const storage = resolveTokenStorage(baseUrl, filePath);
220
251
  const cleanupErrors = [];
221
- try {
222
- await clearMacOsKeychainToken(baseUrl);
223
- } catch (error) {
224
- cleanupErrors.push(error);
252
+ if (storage.useKeychain) {
253
+ try {
254
+ await clearMacOsKeychainToken(baseUrl);
255
+ } catch (error) {
256
+ cleanupErrors.push(error);
257
+ }
225
258
  }
226
259
  try {
227
- await removeFallbackTokenFile(filePath);
260
+ await removeFallbackTokenFile(storage.filePath);
228
261
  } catch (error) {
229
262
  cleanupErrors.push(error);
230
263
  }
@@ -486,6 +519,7 @@ async function createCliApi(options = {}) {
486
519
  getBranchFocusSignals: (input) => cliClient.cli.v1.tasks.planFocus.query(input),
487
520
  listTasks: (input) => cliClient.cli.v1.tasks.list.query(input ?? {}),
488
521
  searchTasks: (input) => cliClient.cli.v1.tasks.search.query(input),
522
+ resolveTaskReferences: (input) => cliClient.cli.v1.tasks.resolveMany.query(input),
489
523
  getTaskTree: (input) => cliClient.cli.v1.tasks.tree.query(input),
490
524
  deleteTasks: (input) => cliClient.cli.v1.tasks.deleteMany.mutate(input),
491
525
  addDependency: (input) => cliClient.cli.v1.dependencies.add.mutate(input),
@@ -505,7 +539,8 @@ async function createCliApi(options = {}) {
505
539
  deleteTag: (input) => cliClient.cli.v1.tags.delete.mutate(input),
506
540
  mergeTag: (input) => cliClient.cli.v1.tags.merge.mutate(input),
507
541
  getTaskTags: (input) => cliClient.cli.v1.tags.forTask.query(input),
508
- assignTaskTags: (input) => cliClient.cli.v1.tags.assign.mutate(input)
542
+ assignTaskTags: (input) => cliClient.cli.v1.tags.assign.mutate(input),
543
+ assignManyTaskTags: (input) => cliClient.cli.v1.tags.assignMany.mutate(input)
509
544
  };
510
545
  }
511
546
 
@@ -1244,7 +1279,10 @@ async function runTaskArchive(input, deps) {
1244
1279
 
1245
1280
  // src/commands/task/delete.ts
1246
1281
  async function runTaskDelete(input, deps) {
1247
- if (deps.isTty && !input.yes) {
1282
+ if (!input.yes && !deps.isTty) {
1283
+ throw new Error("Non-interactive task deletion requires --yes.");
1284
+ }
1285
+ if (!input.yes) {
1248
1286
  const accepted = await deps.confirm(`Delete task ${input.ref}?`);
1249
1287
  if (!accepted) {
1250
1288
  return;
@@ -1255,10 +1293,11 @@ async function runTaskDelete(input, deps) {
1255
1293
 
1256
1294
  // src/commands/task/deleteMany.ts
1257
1295
  async function runTaskDeleteMany(input, deps) {
1258
- if (deps.isTty && !input.yes) {
1259
- const accepted = await deps.confirm(
1260
- `Delete ${input.refs.length} tasks?`
1261
- );
1296
+ if (!input.yes && !deps.isTty) {
1297
+ throw new Error("Non-interactive bulk deletion requires --yes.");
1298
+ }
1299
+ if (!input.yes) {
1300
+ const accepted = await deps.confirm(`Delete ${input.refs.length} tasks?`);
1262
1301
  if (!accepted) {
1263
1302
  return;
1264
1303
  }
@@ -1468,7 +1507,7 @@ async function runTaskUpdate(input, deps) {
1468
1507
  const hasMutations = input.title !== void 0 || hasSharedTaskMutationFields(sharedArgs) || input.position !== void 0;
1469
1508
  if (!hasMutations) {
1470
1509
  throw new Error(
1471
- "No changes specified. Use --title, --status, --priority, --deadline, --expected-time, --actual-time, --archive, --unarchive, --parent, or --position."
1510
+ "No changes specified. Use --title, --status, --priority, --deadline, --clear-deadline, --expected-time, --actual-time, --archive, --unarchive, --parent, or --position."
1472
1511
  );
1473
1512
  }
1474
1513
  if (input.preview && input.title !== void 0) {
@@ -1498,7 +1537,7 @@ async function runTaskUpdateMany(input, deps) {
1498
1537
  const hasMutations = hasSharedTaskMutationFields(sharedArgs);
1499
1538
  if (!hasMutations) {
1500
1539
  throw new Error(
1501
- "No changes specified. Use --status, --priority, --deadline, --expected-time, --actual-time, --archive, --unarchive, or --parent."
1540
+ "No changes specified. Use --status, --priority, --deadline, --clear-deadline, --expected-time, --actual-time, --archive, --unarchive, or --parent."
1502
1541
  );
1503
1542
  }
1504
1543
  const args = {
@@ -1557,7 +1596,10 @@ async function runTaskCleanupApply(input, deps) {
1557
1596
  plan: input.plan,
1558
1597
  planFile: input.planFile
1559
1598
  });
1560
- if (!input.yes && deps.isTty) {
1599
+ if (!input.yes && !deps.isTty) {
1600
+ throw new Error("Non-interactive cleanup apply requires --yes.");
1601
+ }
1602
+ if (!input.yes) {
1561
1603
  const confirmed = await deps.confirm(
1562
1604
  `Apply cleanup plan with ${summarizeCleanupPlan(plan)}?`
1563
1605
  );
@@ -1630,18 +1672,26 @@ async function runTaskCleanupRelocateCollapse(input, deps) {
1630
1672
  "Provide at least one surviving task with --tasks <refs...>."
1631
1673
  );
1632
1674
  }
1633
- const wrapperId = await deps.resolveTaskRef(input.wrapper);
1634
- const toParentId = input.to === "root" ? null : await deps.resolveTaskRef(input.to);
1675
+ const refsToResolve = [
1676
+ input.wrapper,
1677
+ ...input.to === "root" ? [] : [input.to],
1678
+ ...input.tasks
1679
+ ];
1680
+ const resolvedRefs = deps.resolveTaskRefs ? await deps.resolveTaskRefs(refsToResolve) : await Promise.all(refsToResolve.map((ref) => deps.resolveTaskRef(ref)));
1681
+ let resolvedIndex = 0;
1682
+ const wrapperId = resolvedRefs[resolvedIndex++];
1683
+ const toParentId = input.to === "root" ? null : resolvedRefs[resolvedIndex++];
1635
1684
  if (toParentId === wrapperId) {
1636
1685
  throw new Error("Destination cannot be the wrapper itself.");
1637
1686
  }
1638
- const movingTaskIds = dedupeTaskIds(
1639
- await Promise.all(input.tasks.map((ref) => deps.resolveTaskRef(ref)))
1640
- );
1687
+ const movingTaskIds = dedupeTaskIds(resolvedRefs.slice(resolvedIndex));
1641
1688
  if (toParentId !== null && movingTaskIds.includes(toParentId)) {
1642
1689
  throw new Error("Destination cannot be one of the tasks being moved.");
1643
1690
  }
1644
- const activeDirectChildren = await loadAllActiveDirectChildren(wrapperId, deps);
1691
+ const activeDirectChildren = await loadAllActiveDirectChildren(
1692
+ wrapperId,
1693
+ deps
1694
+ );
1645
1695
  const activeDirectChildIds = new Set(
1646
1696
  activeDirectChildren.map((child) => child.id)
1647
1697
  );
@@ -1687,6 +1737,16 @@ function print(result, json, deps) {
1687
1737
  if (json) deps.printJson(result);
1688
1738
  else deps.printTable(result);
1689
1739
  }
1740
+ function normalizeBulkAssignmentOutput(result) {
1741
+ if (!Array.isArray(result)) return result;
1742
+ const taskTags = result.map((item) => {
1743
+ if (typeof item === "object" && item !== null && "tags" in item && Array.isArray(item.tags)) {
1744
+ return item.tags;
1745
+ }
1746
+ return item;
1747
+ });
1748
+ return taskTags.length === 1 ? taskTags[0] : taskTags;
1749
+ }
1690
1750
  async function runTagList(input, deps) {
1691
1751
  const result = await deps.listTags({
1692
1752
  query: input.query,
@@ -1726,6 +1786,14 @@ async function runTagMerge(input, deps) {
1726
1786
  deps
1727
1787
  );
1728
1788
  }
1789
+ async function runTaskTagsAssign(input, deps) {
1790
+ const result = await deps.assignTags({
1791
+ taskIds: input.taskIds,
1792
+ tagPublicIds: input.tagPublicIds,
1793
+ mode: input.clear ? "clear" : "add"
1794
+ });
1795
+ print(normalizeBulkAssignmentOutput(result), input.json, deps);
1796
+ }
1729
1797
 
1730
1798
  // src/lib/banner.ts
1731
1799
  var BANNER_LINES = [
@@ -2939,6 +3007,32 @@ async function resolveTaskId(api, ref) {
2939
3007
  const matches = result.items ?? [];
2940
3008
  return resolveTaskRefFromSearchMatches(ref, matches);
2941
3009
  }
3010
+ var MAX_BULK_NON_NUMERIC_TASK_REFERENCES = 100;
3011
+ async function resolveTaskIds(api, refs) {
3012
+ const nonNumericRefs = refs.filter((ref) => !/^\d+$/.test(ref));
3013
+ if (nonNumericRefs.length > MAX_BULK_NON_NUMERIC_TASK_REFERENCES) {
3014
+ throw new Error(
3015
+ `Resolve at most ${MAX_BULK_NON_NUMERIC_TASK_REFERENCES} non-numeric task references per command`
3016
+ );
3017
+ }
3018
+ const result = nonNumericRefs.length ? await api.resolveTaskReferences({
3019
+ refs: nonNumericRefs,
3020
+ archived: "all"
3021
+ }) : { items: [] };
3022
+ const resolvedItems = result.items ?? [];
3023
+ if (resolvedItems.length !== nonNumericRefs.length) {
3024
+ throw new Error("Task reference resolution returned an incomplete result");
3025
+ }
3026
+ let nonNumericIndex = 0;
3027
+ return refs.map((ref) => {
3028
+ if (/^\d+$/.test(ref)) return assertTaskId(ref);
3029
+ const item = resolvedItems[nonNumericIndex++];
3030
+ if (!item || item.ref !== ref) {
3031
+ throw new Error("Task reference resolution returned an invalid order");
3032
+ }
3033
+ return resolveTaskRefFromSearchMatches(ref, item.matches);
3034
+ });
3035
+ }
2942
3036
  async function resolveParentId(parentRef, resolveRef) {
2943
3037
  if (parentRef === void 0) {
2944
3038
  return void 0;
@@ -2958,6 +3052,15 @@ function assertExclusiveArchiveOptions(archive, unarchive) {
2958
3052
  throw new Error("Use either --archive or --unarchive, not both");
2959
3053
  }
2960
3054
  }
3055
+ function assertExclusiveDeadlineOptions(deadline, clearDeadline) {
3056
+ if (deadline && clearDeadline) {
3057
+ throw new Error("Use either --deadline or --clear-deadline, not both");
3058
+ }
3059
+ }
3060
+ function toTaskMutationDeadline(deadline) {
3061
+ if (deadline === null) return null;
3062
+ return deadline ? new Date(deadline) : void 0;
3063
+ }
2961
3064
  async function withCliApi(callback) {
2962
3065
  const api = await createCliApi();
2963
3066
  return callback(api);
@@ -3150,20 +3253,18 @@ function buildCli() {
3150
3253
  );
3151
3254
  tag.command("assign").argument("<task-refs...>").option(
3152
3255
  "--tag <name>",
3153
- "existing tag name; repeat to assign multiple",
3256
+ "existing tag to add; repeat to assign multiple",
3154
3257
  (value, values = []) => [...values, value]
3155
- ).option("--clear", "remove all tags from the task").option("--json", "print JSON output").action(
3258
+ ).option("--clear", "remove all tags from the selected tasks").option("--json", "print JSON output").action(
3156
3259
  async (taskRefs, options) => {
3157
3260
  if (!options.clear && !options.tag?.length)
3158
3261
  throw new Error("Provide at least one --tag or use --clear.");
3159
3262
  await withCliApi(async (api) => {
3160
- const taskIds = await Promise.all(
3161
- taskRefs.map((taskRef) => resolveTaskId(api, taskRef))
3162
- );
3163
- const catalogue = await api.listTags({});
3263
+ const taskIds = await resolveTaskIds(api, taskRefs);
3164
3264
  const requested = (options.tag ?? []).map(
3165
3265
  (name) => name.trim().replace(/\s+/g, " ").toLowerCase()
3166
3266
  );
3267
+ const catalogue = requested.length ? await api.listTags({}) : [];
3167
3268
  const matched = requested.map(
3168
3269
  (name) => catalogue.find((tag2) => tag2.name === name)
3169
3270
  );
@@ -3172,14 +3273,19 @@ function buildCli() {
3172
3273
  "Every --tag must name an existing tag. Use `dypt tag create` first."
3173
3274
  );
3174
3275
  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
- )
3276
+ await runTaskTagsAssign(
3277
+ {
3278
+ taskIds,
3279
+ tagPublicIds,
3280
+ clear: Boolean(options.clear),
3281
+ json: Boolean(options.json)
3282
+ },
3283
+ {
3284
+ assignTags: (input) => api.assignManyTaskTags(input),
3285
+ printJson,
3286
+ printTable
3287
+ }
3179
3288
  );
3180
- const output = results.length === 1 ? results[0] : results;
3181
- if (options.json) printJson(output);
3182
- else printTable(output);
3183
3289
  });
3184
3290
  }
3185
3291
  );
@@ -3719,9 +3825,7 @@ function buildCli() {
3719
3825
  readLine: promptLine
3720
3826
  }),
3721
3827
  deleteTasks: (taskRefs) => withCliApi(async (api) => {
3722
- const taskIds = await Promise.all(
3723
- taskRefs.map((ref) => resolveTaskId(api, ref))
3724
- );
3828
+ const taskIds = await resolveTaskIds(api, taskRefs);
3725
3829
  return api.deleteTasks({ taskIds });
3726
3830
  }),
3727
3831
  printJson,
@@ -3740,16 +3844,17 @@ function buildCli() {
3740
3844
  "--priority <priority>",
3741
3845
  `new priority (${taskPriorityChoices.join("|")})`
3742
3846
  ).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(
3847
+ ).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
3848
  async (ref, options) => {
3745
3849
  assertExclusiveArchiveOptions(options.archive, options.unarchive);
3850
+ assertExclusiveDeadlineOptions(options.deadline, options.clearDeadline);
3746
3851
  await runTaskUpdate(
3747
3852
  {
3748
3853
  ref,
3749
3854
  title: options.title,
3750
3855
  status: options.status,
3751
3856
  priority: options.priority,
3752
- deadline: options.deadline ? parseDateOption(options.deadline, "start").toISOString() : void 0,
3857
+ deadline: options.clearDeadline ? null : options.deadline ? parseDateOption(options.deadline, "start").toISOString() : void 0,
3753
3858
  expectedTimeTaken: options.expectedTime,
3754
3859
  actualTimeTaken: options.actualTime,
3755
3860
  archivedAt: options.archive ? /* @__PURE__ */ new Date() : options.unarchive ? null : void 0,
@@ -3765,7 +3870,7 @@ function buildCli() {
3765
3870
  title: input.title,
3766
3871
  status: normalizeStatus(input.status),
3767
3872
  priority: normalizePriority(input.priority),
3768
- deadline: input.deadline ? new Date(String(input.deadline)) : void 0,
3873
+ deadline: toTaskMutationDeadline(input.deadline),
3769
3874
  expectedTimeTaken: parseIntegerOption(
3770
3875
  input.expectedTimeTaken,
3771
3876
  "expected-time",
@@ -3789,7 +3894,7 @@ function buildCli() {
3789
3894
  taskIds: [await resolveTaskId(api, String(input.ref))],
3790
3895
  status: normalizeStatus(input.status),
3791
3896
  priority: normalizePriority(input.priority),
3792
- deadline: input.deadline ? new Date(String(input.deadline)) : void 0,
3897
+ deadline: toTaskMutationDeadline(input.deadline),
3793
3898
  expectedTimeTaken: parseIntegerOption(
3794
3899
  input.expectedTimeTaken,
3795
3900
  "expected-time",
@@ -3846,15 +3951,16 @@ function buildCli() {
3846
3951
  "--priority <priority>",
3847
3952
  `new priority (${taskPriorityChoices.join("|")})`
3848
3953
  ).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(
3954
+ ).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
3955
  async (refs, options) => {
3851
3956
  assertExclusiveArchiveOptions(options.archive, options.unarchive);
3957
+ assertExclusiveDeadlineOptions(options.deadline, options.clearDeadline);
3852
3958
  await runTaskUpdateMany(
3853
3959
  {
3854
3960
  refs,
3855
3961
  status: options.status,
3856
3962
  priority: options.priority,
3857
- deadline: options.deadline ? parseDateOption(options.deadline, "start").toISOString() : void 0,
3963
+ deadline: options.clearDeadline ? null : options.deadline ? parseDateOption(options.deadline, "start").toISOString() : void 0,
3858
3964
  expectedTimeTaken: options.expectedTime,
3859
3965
  actualTimeTaken: options.actualTime,
3860
3966
  archivedAt: options.archive ? /* @__PURE__ */ new Date() : options.unarchive ? null : void 0,
@@ -3864,14 +3970,12 @@ function buildCli() {
3864
3970
  },
3865
3971
  {
3866
3972
  updateManyTasks: (input) => withCliApi(async (api) => {
3867
- const taskIds = await Promise.all(
3868
- input.refs.map((ref) => resolveTaskId(api, ref))
3869
- );
3973
+ const taskIds = await resolveTaskIds(api, input.refs);
3870
3974
  return api.updateManyTasks({
3871
3975
  taskIds,
3872
3976
  status: normalizeStatus(input.status),
3873
3977
  priority: normalizePriority(input.priority),
3874
- deadline: input.deadline ? new Date(String(input.deadline)) : void 0,
3978
+ deadline: toTaskMutationDeadline(input.deadline),
3875
3979
  expectedTimeTaken: parseIntegerOption(
3876
3980
  input.expectedTimeTaken,
3877
3981
  "expected-time",
@@ -3890,14 +3994,12 @@ function buildCli() {
3890
3994
  });
3891
3995
  }),
3892
3996
  previewManyTasks: (input) => withCliApi(async (api) => {
3893
- const taskIds = await Promise.all(
3894
- input.refs.map((ref) => resolveTaskId(api, ref))
3895
- );
3997
+ const taskIds = await resolveTaskIds(api, input.refs);
3896
3998
  return api.previewManyTasks({
3897
3999
  taskIds,
3898
4000
  status: normalizeStatus(input.status),
3899
4001
  priority: normalizePriority(input.priority),
3900
- deadline: input.deadline ? new Date(String(input.deadline)) : void 0,
4002
+ deadline: toTaskMutationDeadline(input.deadline),
3901
4003
  expectedTimeTaken: parseIntegerOption(
3902
4004
  input.expectedTimeTaken,
3903
4005
  "expected-time",
@@ -3935,9 +4037,7 @@ function buildCli() {
3935
4037
  },
3936
4038
  {
3937
4039
  reorderTasks: (input) => withCliApi(async (api) => {
3938
- const taskIds = await Promise.all(
3939
- input.refs.map((ref) => resolveTaskId(api, ref))
3940
- );
4040
+ const taskIds = await resolveTaskIds(api, input.refs);
3941
4041
  return api.reorderTasks({
3942
4042
  taskIds,
3943
4043
  parentId: await resolveParentId(
@@ -3947,9 +4047,7 @@ function buildCli() {
3947
4047
  });
3948
4048
  }),
3949
4049
  previewReorderTasks: (input) => withCliApi(async (api) => {
3950
- const taskIds = await Promise.all(
3951
- input.refs.map((ref) => resolveTaskId(api, ref))
3952
- );
4050
+ const taskIds = await resolveTaskIds(api, input.refs);
3953
4051
  return api.previewReorderTasks({
3954
4052
  taskIds,
3955
4053
  parentId: await resolveParentId(
@@ -3997,6 +4095,7 @@ function buildCli() {
3997
4095
  },
3998
4096
  {
3999
4097
  resolveTaskRef: (ref) => resolveTaskId(api, ref),
4098
+ resolveTaskRefs: (refs) => resolveTaskIds(api, refs),
4000
4099
  listActiveDirectChildren: ({ wrapperId, cursor }) => api.listTasks({
4001
4100
  parentTaskId: wrapperId,
4002
4101
  archived: "active",
@@ -4278,8 +4377,10 @@ export {
4278
4377
  buildCli,
4279
4378
  isCliEntrypoint,
4280
4379
  resolveParentId,
4380
+ resolveTaskIds,
4281
4381
  resolveTaskRefFromSearchMatches,
4282
4382
  runCli,
4283
- runCliEntrypoint
4383
+ runCliEntrypoint,
4384
+ toTaskMutationDeadline
4284
4385
  };
4285
4386
  //# sourceMappingURL=index.js.map