@dypt/cli 0.1.7 → 0.1.9

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
@@ -62,9 +62,24 @@ dypt task update 123 --priority high
62
62
  dypt task update 123 --deadline 2026-05-01T09:00:00Z
63
63
  dypt task update 123 --parent Work
64
64
  dypt task update 123 --parent root --preview
65
+ dypt task update 123 --position 0
65
66
  dypt task update 123 --archive
66
67
  ```
67
68
 
69
+ ### Reorder tasks
70
+
71
+ Set visible sibling order from an explicit task list. Preview first for safe
72
+ bulk changes:
73
+
74
+ ```bash
75
+ dypt task reorder 71595 71594 71598 --preview
76
+ dypt task reorder 71595 71594 71598
77
+ dypt task reorder 71595 71594 71598 --parent Work
78
+ ```
79
+
80
+ Dependencies and blockers are not changed by reordering; use `dypt dep` commands
81
+ for execution dependencies.
82
+
68
83
  ## JSON output
69
84
 
70
85
  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.7",
12
+ version: "0.1.9",
13
13
  description: "Command-line interface for dypt task management",
14
14
  license: "SEE LICENSE IN LICENSE",
15
15
  homepage: "https://dypt.app",
@@ -294,6 +294,8 @@ async function createCliApi(options = {}) {
294
294
  getAuthStatus: () => cliClient.cli.v1.auth.status.query(),
295
295
  createTask: (input) => cliClient.cli.v1.tasks.create.mutate(input),
296
296
  updateTask: (input) => cliClient.cli.v1.tasks.update.mutate(input),
297
+ reorderTasks: (input) => cliClient.cli.v1.tasks.reorder.mutate(input),
298
+ previewReorderTasks: (input) => cliClient.cli.v1.tasks.previewReorder.query(input),
297
299
  archiveTask: (input) => cliClient.cli.v1.tasks.archive.mutate(input),
298
300
  unarchiveTask: (input) => cliClient.cli.v1.tasks.unarchive.mutate(input),
299
301
  updateManyTasks: (input) => cliClient.cli.v1.tasks.updateMany.mutate(input),
@@ -451,6 +453,9 @@ When working on repo tasks:
451
453
  - Do not create a parallel markdown TODO tracker.
452
454
  - Do not set leaf tasks to in progress; dypt derives in progress for parent
453
455
  tasks from child state.
456
+ - When creating a task tree from an implementation plan, set task positions to
457
+ match the recommended execution order. Use visible order for sequencing and
458
+ dependencies only for true blocker relationships.
454
459
  - Preview cleanup or bulk changes before applying them when preview is
455
460
  available.
456
461
  - If the dypt-cli skill is available, use it for dypt task workflows.
@@ -478,6 +483,9 @@ dypt dep list <ref>
478
483
  dypt task plan next-actions <ref>
479
484
  dypt task plan focus <ref>
480
485
  dypt task plan metadata <ref> --leaves-only
486
+ dypt task update <ref> --position <n>
487
+ dypt task reorder <ref-1> <ref-2> <ref-3> --preview
488
+ dypt task reorder <ref-1> <ref-2> <ref-3>
481
489
  \`\`\`
482
490
  `;
483
491
  function metadataPath(targetPath) {
@@ -1093,10 +1101,10 @@ async function runTaskTree(input, deps) {
1093
1101
 
1094
1102
  // src/commands/task/update.ts
1095
1103
  async function runTaskUpdate(input, deps) {
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;
1104
+ 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 || input.position !== void 0;
1097
1105
  if (!hasMutations) {
1098
1106
  throw new Error(
1099
- "No changes specified. Use --title, --status, --priority, --deadline, --expected-time, --actual-time, --archive, --unarchive, or --parent."
1107
+ "No changes specified. Use --title, --status, --priority, --deadline, --expected-time, --actual-time, --archive, --unarchive, --parent, or --position."
1100
1108
  );
1101
1109
  }
1102
1110
  if (input.preview && input.title !== void 0) {
@@ -1111,7 +1119,8 @@ async function runTaskUpdate(input, deps) {
1111
1119
  expectedTimeTaken: input.expectedTimeTaken,
1112
1120
  actualTimeTaken: input.actualTimeTaken,
1113
1121
  archivedAt: input.archivedAt,
1114
- parentRef: input.parentRef
1122
+ parentRef: input.parentRef,
1123
+ position: input.position
1115
1124
  };
1116
1125
  const result = input.preview ? await deps.previewTask({
1117
1126
  ref: args.ref,
@@ -1121,7 +1130,8 @@ async function runTaskUpdate(input, deps) {
1121
1130
  expectedTimeTaken: args.expectedTimeTaken,
1122
1131
  actualTimeTaken: args.actualTimeTaken,
1123
1132
  archivedAt: args.archivedAt,
1124
- parentRef: args.parentRef
1133
+ parentRef: args.parentRef,
1134
+ position: args.position
1125
1135
  }) : await deps.updateTask(args);
1126
1136
  if (input.json) {
1127
1137
  deps.printJson(result);
@@ -1156,6 +1166,23 @@ async function runTaskUpdateMany(input, deps) {
1156
1166
  deps.printTable(result);
1157
1167
  }
1158
1168
 
1169
+ // src/commands/task/reorder.ts
1170
+ async function runTaskReorder(input, deps) {
1171
+ if (input.refs.length < 2) {
1172
+ throw new Error("Reorder requires at least two task refs.");
1173
+ }
1174
+ const args = {
1175
+ refs: input.refs,
1176
+ parentRef: input.parentRef
1177
+ };
1178
+ const result = input.preview ? await deps.previewReorderTasks(args) : await deps.reorderTasks(args);
1179
+ if (input.json) {
1180
+ deps.printJson(result);
1181
+ return;
1182
+ }
1183
+ deps.printTable(result);
1184
+ }
1185
+
1159
1186
  // src/commands/task/cleanupPlan.ts
1160
1187
  import { readFile as readFile3 } from "fs/promises";
1161
1188
  async function loadCleanupPlan(input) {
@@ -2392,6 +2419,15 @@ async function resolveTaskId(api, ref) {
2392
2419
  const matches = result.items ?? [];
2393
2420
  return resolveTaskRefFromSearchMatches(ref, matches);
2394
2421
  }
2422
+ async function resolveParentId(parentRef, resolveRef) {
2423
+ if (parentRef === void 0) {
2424
+ return void 0;
2425
+ }
2426
+ if (parentRef.toLowerCase() === "root") {
2427
+ return null;
2428
+ }
2429
+ return resolveRef(parentRef);
2430
+ }
2395
2431
  function assertExclusiveHierarchyOptions(parent, scope) {
2396
2432
  if (parent && scope) {
2397
2433
  throw new Error("Use either --parent or --scope, not both");
@@ -2711,7 +2747,7 @@ function buildCli() {
2711
2747
  {
2712
2748
  ref,
2713
2749
  json: Boolean(options.json),
2714
- depth: options.depth ? Number(options.depth) : void 0,
2750
+ depth: parseIntegerOption(options.depth, "depth", 0),
2715
2751
  full: Boolean(options.full)
2716
2752
  },
2717
2753
  {
@@ -2942,7 +2978,7 @@ function buildCli() {
2942
2978
  "--priority <priority>",
2943
2979
  `new priority (${taskPriorityChoices.join("|")})`
2944
2980
  ).choices([...taskPriorityChoices])
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(
2981
+ ).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(
2946
2982
  async (ref, options) => {
2947
2983
  await runTaskUpdate(
2948
2984
  {
@@ -2955,12 +2991,12 @@ function buildCli() {
2955
2991
  actualTimeTaken: options.actualTime,
2956
2992
  archivedAt: options.archive ? /* @__PURE__ */ new Date() : options.unarchive ? null : void 0,
2957
2993
  parentRef: options.parent,
2994
+ position: options.position,
2958
2995
  preview: Boolean(options.preview),
2959
2996
  json: Boolean(options.json)
2960
2997
  },
2961
2998
  {
2962
2999
  updateTask: (input) => withCliApi(async (api) => {
2963
- const normalizedParentRef = input.parentRef?.toLowerCase() === "root" ? null : input.parentRef;
2964
3000
  return api.updateTask({
2965
3001
  taskId: await resolveTaskId(api, String(input.ref)),
2966
3002
  title: input.title,
@@ -2970,11 +3006,14 @@ function buildCli() {
2970
3006
  expectedTimeTaken: input.expectedTimeTaken ? Number(input.expectedTimeTaken) : void 0,
2971
3007
  actualTimeTaken: input.actualTimeTaken ? Number(input.actualTimeTaken) : void 0,
2972
3008
  archivedAt: input.archivedAt,
2973
- parentId: normalizedParentRef === void 0 ? void 0 : normalizedParentRef === null ? null : await resolveTaskId(api, normalizedParentRef)
3009
+ parentId: await resolveParentId(
3010
+ input.parentRef,
3011
+ (ref2) => resolveTaskId(api, ref2)
3012
+ ),
3013
+ position: parseIntegerOption(input.position, "--position")
2974
3014
  });
2975
3015
  }),
2976
3016
  previewTask: (input) => withCliApi(async (api) => {
2977
- const normalizedParentRef = input.parentRef?.toLowerCase() === "root" ? null : input.parentRef;
2978
3017
  return api.previewManyTasks({
2979
3018
  taskIds: [await resolveTaskId(api, String(input.ref))],
2980
3019
  status: normalizeStatus(input.status),
@@ -2983,7 +3022,11 @@ function buildCli() {
2983
3022
  expectedTimeTaken: input.expectedTimeTaken ? Number(input.expectedTimeTaken) : void 0,
2984
3023
  actualTimeTaken: input.actualTimeTaken ? Number(input.actualTimeTaken) : void 0,
2985
3024
  archivedAt: input.archivedAt,
2986
- parentId: normalizedParentRef === void 0 ? void 0 : normalizedParentRef === null ? null : await resolveTaskId(api, normalizedParentRef)
3025
+ parentId: await resolveParentId(
3026
+ input.parentRef,
3027
+ (ref2) => resolveTaskId(api, ref2)
3028
+ ),
3029
+ position: parseIntegerOption(input.position, "--position")
2987
3030
  });
2988
3031
  }),
2989
3032
  printJson,
@@ -3044,7 +3087,6 @@ function buildCli() {
3044
3087
  const taskIds = await Promise.all(
3045
3088
  input.refs.map((ref) => resolveTaskId(api, ref))
3046
3089
  );
3047
- const normalizedParentRef = input.parentRef?.toLowerCase() === "root" ? null : input.parentRef;
3048
3090
  return api.updateManyTasks({
3049
3091
  taskIds,
3050
3092
  status: normalizeStatus(input.status),
@@ -3053,14 +3095,16 @@ function buildCli() {
3053
3095
  expectedTimeTaken: input.expectedTimeTaken ? Number(input.expectedTimeTaken) : void 0,
3054
3096
  actualTimeTaken: input.actualTimeTaken ? Number(input.actualTimeTaken) : void 0,
3055
3097
  archivedAt: input.archivedAt,
3056
- parentId: normalizedParentRef === void 0 ? void 0 : normalizedParentRef === null ? null : await resolveTaskId(api, normalizedParentRef)
3098
+ parentId: await resolveParentId(
3099
+ input.parentRef,
3100
+ (ref) => resolveTaskId(api, ref)
3101
+ )
3057
3102
  });
3058
3103
  }),
3059
3104
  previewManyTasks: (input) => withCliApi(async (api) => {
3060
3105
  const taskIds = await Promise.all(
3061
3106
  input.refs.map((ref) => resolveTaskId(api, ref))
3062
3107
  );
3063
- const normalizedParentRef = input.parentRef?.toLowerCase() === "root" ? null : input.parentRef;
3064
3108
  return api.previewManyTasks({
3065
3109
  taskIds,
3066
3110
  status: normalizeStatus(input.status),
@@ -3069,7 +3113,50 @@ function buildCli() {
3069
3113
  expectedTimeTaken: input.expectedTimeTaken ? Number(input.expectedTimeTaken) : void 0,
3070
3114
  actualTimeTaken: input.actualTimeTaken ? Number(input.actualTimeTaken) : void 0,
3071
3115
  archivedAt: input.archivedAt,
3072
- parentId: normalizedParentRef === void 0 ? void 0 : normalizedParentRef === null ? null : await resolveTaskId(api, normalizedParentRef)
3116
+ parentId: await resolveParentId(
3117
+ input.parentRef,
3118
+ (ref) => resolveTaskId(api, ref)
3119
+ )
3120
+ });
3121
+ }),
3122
+ printJson,
3123
+ printTable
3124
+ }
3125
+ );
3126
+ }
3127
+ );
3128
+ task.command("reorder").argument("<refs...>").option("--parent <ref>", 'validate task order under the given parent or "root"').option("--preview", "preview the reorder without mutating").option("--json", "print JSON output").action(
3129
+ async (refs, options) => {
3130
+ await runTaskReorder(
3131
+ {
3132
+ refs,
3133
+ parentRef: options.parent,
3134
+ preview: Boolean(options.preview),
3135
+ json: Boolean(options.json)
3136
+ },
3137
+ {
3138
+ reorderTasks: (input) => withCliApi(async (api) => {
3139
+ const taskIds = await Promise.all(
3140
+ input.refs.map((ref) => resolveTaskId(api, ref))
3141
+ );
3142
+ return api.reorderTasks({
3143
+ taskIds,
3144
+ parentId: await resolveParentId(
3145
+ input.parentRef,
3146
+ (ref) => resolveTaskId(api, ref)
3147
+ )
3148
+ });
3149
+ }),
3150
+ previewReorderTasks: (input) => withCliApi(async (api) => {
3151
+ const taskIds = await Promise.all(
3152
+ input.refs.map((ref) => resolveTaskId(api, ref))
3153
+ );
3154
+ return api.previewReorderTasks({
3155
+ taskIds,
3156
+ parentId: await resolveParentId(
3157
+ input.parentRef,
3158
+ (ref) => resolveTaskId(api, ref)
3159
+ )
3073
3160
  });
3074
3161
  }),
3075
3162
  printJson,
@@ -3312,6 +3399,7 @@ if (isCliEntrypoint(process.argv[1], import.meta.url)) {
3312
3399
  export {
3313
3400
  buildCli,
3314
3401
  isCliEntrypoint,
3402
+ resolveParentId,
3315
3403
  resolveTaskRefFromSearchMatches,
3316
3404
  runCli
3317
3405
  };