@dypt/cli 0.1.5 → 0.1.7

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
@@ -54,12 +54,15 @@ dypt task get 123 --json
54
54
 
55
55
  ### Update a task
56
56
 
57
- Change status, priority, or due date:
57
+ Change status, priority, due date, archive state, or parent:
58
58
 
59
59
  ```bash
60
60
  dypt task update 123 --status "in progress"
61
61
  dypt task update 123 --priority high
62
62
  dypt task update 123 --deadline 2026-05-01T09:00:00Z
63
+ dypt task update 123 --parent Work
64
+ dypt task update 123 --parent root --preview
65
+ dypt task update 123 --archive
63
66
  ```
64
67
 
65
68
  ## JSON output
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.5",
12
+ version: "0.1.7",
13
13
  description: "Command-line interface for dypt task management",
14
14
  license: "SEE LICENSE IN LICENSE",
15
15
  homepage: "https://dypt.app",
@@ -42,9 +42,9 @@ var package_default = {
42
42
  typecheck: "tsc --noEmit"
43
43
  },
44
44
  dependencies: {
45
- "@trpc/client": "^11.11.0",
46
- commander: "^13.1.0",
47
- "string-width": "^7.2.0",
45
+ "@trpc/client": "^11.17.0",
46
+ commander: "^14.0.3",
47
+ "string-width": "^8.2.1",
48
48
  superjson: "^2.2.6"
49
49
  },
50
50
  devDependencies: {
@@ -1093,15 +1093,36 @@ async function runTaskTree(input, deps) {
1093
1093
 
1094
1094
  // src/commands/task/update.ts
1095
1095
  async function runTaskUpdate(input, deps) {
1096
- const result = await deps.updateTask({
1096
+ 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;
1097
+ if (!hasMutations) {
1098
+ throw new Error(
1099
+ "No changes specified. Use --title, --status, --priority, --deadline, --expected-time, --actual-time, --archive, --unarchive, or --parent."
1100
+ );
1101
+ }
1102
+ if (input.preview && input.title !== void 0) {
1103
+ throw new Error("Preview is not supported for --title.");
1104
+ }
1105
+ const args = {
1097
1106
  ref: input.ref,
1098
1107
  title: input.title,
1099
1108
  status: input.status,
1100
1109
  priority: input.priority,
1101
1110
  deadline: input.deadline,
1102
1111
  expectedTimeTaken: input.expectedTimeTaken,
1103
- actualTimeTaken: input.actualTimeTaken
1104
- });
1112
+ actualTimeTaken: input.actualTimeTaken,
1113
+ archivedAt: input.archivedAt,
1114
+ parentRef: input.parentRef
1115
+ };
1116
+ const result = input.preview ? await deps.previewTask({
1117
+ ref: args.ref,
1118
+ status: args.status,
1119
+ priority: args.priority,
1120
+ deadline: args.deadline,
1121
+ expectedTimeTaken: args.expectedTimeTaken,
1122
+ actualTimeTaken: args.actualTimeTaken,
1123
+ archivedAt: args.archivedAt,
1124
+ parentRef: args.parentRef
1125
+ }) : await deps.updateTask(args);
1105
1126
  if (input.json) {
1106
1127
  deps.printJson(result);
1107
1128
  return;
@@ -2921,7 +2942,7 @@ function buildCli() {
2921
2942
  "--priority <priority>",
2922
2943
  `new priority (${taskPriorityChoices.join("|")})`
2923
2944
  ).choices([...taskPriorityChoices])
2924
- ).option("--deadline <deadline>", "ISO deadline").option("--expected-time <minutes>", "expected minutes").option("--actual-time <minutes>", "actual minutes").option("--json", "print JSON output").action(
2945
+ ).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("--preview", "preview the update without mutating").option("--json", "print JSON output").action(
2925
2946
  async (ref, options) => {
2926
2947
  await runTaskUpdate(
2927
2948
  {
@@ -2932,20 +2953,39 @@ function buildCli() {
2932
2953
  deadline: options.deadline,
2933
2954
  expectedTimeTaken: options.expectedTime,
2934
2955
  actualTimeTaken: options.actualTime,
2956
+ archivedAt: options.archive ? /* @__PURE__ */ new Date() : options.unarchive ? null : void 0,
2957
+ parentRef: options.parent,
2958
+ preview: Boolean(options.preview),
2935
2959
  json: Boolean(options.json)
2936
2960
  },
2937
2961
  {
2938
- updateTask: (input) => withCliApi(
2939
- async (api) => api.updateTask({
2962
+ updateTask: (input) => withCliApi(async (api) => {
2963
+ const normalizedParentRef = input.parentRef?.toLowerCase() === "root" ? null : input.parentRef;
2964
+ return api.updateTask({
2940
2965
  taskId: await resolveTaskId(api, String(input.ref)),
2941
2966
  title: input.title,
2942
2967
  status: normalizeStatus(input.status),
2943
2968
  priority: normalizePriority(input.priority),
2944
2969
  deadline: input.deadline ? new Date(String(input.deadline)) : void 0,
2945
2970
  expectedTimeTaken: input.expectedTimeTaken ? Number(input.expectedTimeTaken) : void 0,
2946
- actualTimeTaken: input.actualTimeTaken ? Number(input.actualTimeTaken) : void 0
2947
- })
2948
- ),
2971
+ actualTimeTaken: input.actualTimeTaken ? Number(input.actualTimeTaken) : void 0,
2972
+ archivedAt: input.archivedAt,
2973
+ parentId: normalizedParentRef === void 0 ? void 0 : normalizedParentRef === null ? null : await resolveTaskId(api, normalizedParentRef)
2974
+ });
2975
+ }),
2976
+ previewTask: (input) => withCliApi(async (api) => {
2977
+ const normalizedParentRef = input.parentRef?.toLowerCase() === "root" ? null : input.parentRef;
2978
+ return api.previewManyTasks({
2979
+ taskIds: [await resolveTaskId(api, String(input.ref))],
2980
+ status: normalizeStatus(input.status),
2981
+ priority: normalizePriority(input.priority),
2982
+ deadline: input.deadline ? new Date(String(input.deadline)) : void 0,
2983
+ expectedTimeTaken: input.expectedTimeTaken ? Number(input.expectedTimeTaken) : void 0,
2984
+ actualTimeTaken: input.actualTimeTaken ? Number(input.actualTimeTaken) : void 0,
2985
+ archivedAt: input.archivedAt,
2986
+ parentId: normalizedParentRef === void 0 ? void 0 : normalizedParentRef === null ? null : await resolveTaskId(api, normalizedParentRef)
2987
+ });
2988
+ }),
2949
2989
  printJson,
2950
2990
  printTable
2951
2991
  }