@dypt/cli 0.1.23 → 0.1.25

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
@@ -77,6 +77,34 @@ Branch filtering is query-time ancestry matching. It does not copy tags,
77
77
  priority, status, deadlines, or time estimates onto descendants. Run
78
78
  `dypt task list --help` for the branch priority, deadline, and tag flags.
79
79
 
80
+ ### Search tasks
81
+
82
+ Search your task titles, tags and references:
83
+
84
+ ```bash
85
+ dypt task search "release notes"
86
+ dypt task search launch --parent Work
87
+ ```
88
+
89
+ To look for several topics, pass up to 10 queries of at most 80 characters
90
+ each in one call, quoting each multi-word query:
91
+
92
+ ```bash
93
+ dypt task search "turso usage" billing replica
94
+ dypt task search "turso usage" billing --json
95
+ ```
96
+
97
+ Each query is matched exactly as a single search would match it, and results
98
+ are grouped per query: human output prints a `Search: <query>` heading before
99
+ each group, and `--json` returns `{ "limit", "groups": [{ "query", "items",
100
+ "nextCursor" }] }`. The groups share one search's 100-result budget: without
101
+ `--limit`, each query gets `min(20, 100 / queries)` results (10 each for 10
102
+ queries), and `--limit` times the number of queries may not exceed 100. Queries
103
+ must differ, ignoring case and surrounding spaces. One multi-query call reads
104
+ your task titles once, so it is much cheaper than separate searches.
105
+ Pagination cursors work with a single query only; use the next-page command
106
+ printed under a group. A single query keeps the existing output.
107
+
80
108
  ### Create a task
81
109
 
82
110
  Create a new task:
@@ -320,6 +348,16 @@ dypt agent install-instructions --append AGENTS.md
320
348
 
321
349
  ## Support policy
322
350
 
351
+ Task list paths, search results and ambiguous references show `null` for an
352
+ unreadable or missing ancestor title in JSON and "Hidden parent" in human
353
+ output. Loads requiring more than 1,000 distinct foreign ancestors fail with
354
+ `CLI_PATH_TITLE_LIMIT_EXCEEDED`; narrow the task scope or page rather than
355
+ expecting truncated titles. Owned ancestors do not consume this foreign limit.
356
+ Path-title loads and preview metadata also reject paths longer than 1,000
357
+ characters or more than 10,000 combined ancestor occurrences with
358
+ `CLI_TASK_ANCESTRY_LIMIT_EXCEEDED`. These limits return a client error instead
359
+ of partial titles; use a smaller scope or page.
360
+
323
361
  - the CLI is currently versioned as an early `0.x` release, so command shape and
324
362
  output may still evolve
325
363
  - the JSON output mode is intended for agent and automation use, but consumers
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.23",
12
+ version: "0.1.25",
13
13
  description: "Command-line interface for dypt task management",
14
14
  license: "SEE LICENSE IN LICENSE",
15
15
  homepage: "https://dypt.app",
@@ -597,6 +597,7 @@ async function createCliApi(options = {}) {
597
597
  getBranchFocusSignals: (input) => cliClient.cli.v1.tasks.planFocus.query(input),
598
598
  listTasks: (input) => cliClient.cli.v1.tasks.list.query(input ?? {}),
599
599
  searchTasks: (input) => cliClient.cli.v1.tasks.search.query(input),
600
+ searchManyTasks: (input) => cliClient.cli.v1.tasks.searchMany.query(input),
600
601
  resolveTaskReferences: (input) => cliClient.cli.v1.tasks.resolveMany.query(input),
601
602
  getTaskTree: (input) => cliClient.cli.v1.tasks.tree.query(input),
602
603
  deleteTasks: (input) => cliClient.cli.v1.tasks.deleteMany.mutate(input),
@@ -1141,6 +1142,8 @@ function formatDependencyAddError(error) {
1141
1142
  return "Cannot add that dependency because it would create a cycle.";
1142
1143
  case "CLI_DEPENDENCY_ARCHIVED_TASK":
1143
1144
  return "Cannot add a dependency involving an archived task.";
1145
+ case "CLI_DEPENDENCY_BLOCKER_LIMIT":
1146
+ return "A task cannot have more than 100 blockers.";
1144
1147
  default:
1145
1148
  return message;
1146
1149
  }
@@ -1530,6 +1533,32 @@ async function runTaskSearch(input, deps) {
1530
1533
  }
1531
1534
  });
1532
1535
  }
1536
+ var MAX_TASK_SEARCH_QUERIES = 10;
1537
+ var MAX_TASK_SEARCH_QUERY_LENGTH = 80;
1538
+ var MAX_TASK_SEARCH_MULTI_RESULTS = 100;
1539
+ async function runTaskSearchMany(input, deps) {
1540
+ const result = await deps.searchManyTasks({
1541
+ queries: input.queries,
1542
+ parent: input.parent,
1543
+ scope: input.scope,
1544
+ limit: input.limit
1545
+ });
1546
+ if (input.json) {
1547
+ deps.printJson(result);
1548
+ return;
1549
+ }
1550
+ const record = typeof result === "object" && result !== null ? result : {};
1551
+ deps.printTable({
1552
+ ...record,
1553
+ meta: {
1554
+ // The server picks the per-query page size when --limit is omitted.
1555
+ limit: typeof record.limit === "number" ? record.limit : Number.parseInt(input.limit ?? "20", 10),
1556
+ parent: input.parent,
1557
+ scope: input.scope,
1558
+ view: "search-groups"
1559
+ }
1560
+ });
1561
+ }
1533
1562
 
1534
1563
  // src/commands/task/summary.ts
1535
1564
  async function runTaskSummary(input, deps) {
@@ -2013,6 +2042,11 @@ function getCleanupWorkflowLabel(value) {
2013
2042
  function isTaskCollection(value) {
2014
2043
  return isRecord(value) && Array.isArray(value.items) && value.items.every(isTaskLike);
2015
2044
  }
2045
+ function isTaskSearchGroups(value) {
2046
+ return isRecord(value) && Array.isArray(value.groups) && value.groups.every(
2047
+ (group) => isRecord(group) && typeof group.query === "string" && isTaskCollection(group)
2048
+ );
2049
+ }
2016
2050
  function isAuthStatusLike(value) {
2017
2051
  return isRecord(value) && isRecord(value.user) && typeof value.user.userId === "string" && isRecord(value.token) && typeof value.token.id === "number" && typeof value.token.label === "string" && typeof value.token.scope === "string";
2018
2052
  }
@@ -2180,9 +2214,7 @@ function formatPriority(priority, color) {
2180
2214
  function renderInlineMarkdown(text, color) {
2181
2215
  const codePlaceholders = [];
2182
2216
  let rendered = text.replace(/`([^`\n]+)`/g, (_, code) => {
2183
- const index = codePlaceholders.push(
2184
- color ? colorize(code, "cyan", color) : code
2185
- ) - 1;
2217
+ const index = codePlaceholders.push(color ? colorize(code, "cyan", color) : code) - 1;
2186
2218
  return `\0CODE${index}\0`;
2187
2219
  });
2188
2220
  rendered = rendered.replace(
@@ -2263,6 +2295,24 @@ function formatTaskLine(task, color) {
2263
2295
  const suffix = details.length > 0 ? ` ${dim("\xB7", color)} ${details.join(` ${dim("\xB7", color)} `)}` : "";
2264
2296
  return `${colorize(`#${task.id}`, "cyan", color)} ${formatStatusGlyph(task.status, color)} ${title}${suffix}`;
2265
2297
  }
2298
+ function formatPathTitles(titles) {
2299
+ return titles.map((title) => title ?? "Hidden parent").join(" > ");
2300
+ }
2301
+ function renderTaskSearchGroups(value, color) {
2302
+ return value.groups.map(
2303
+ (group) => [
2304
+ emphasize(`Search: ${group.query}`, "bold", color),
2305
+ renderTaskList(
2306
+ {
2307
+ items: group.items,
2308
+ nextCursor: group.nextCursor,
2309
+ meta: { ...value.meta, view: "search", query: group.query }
2310
+ },
2311
+ color
2312
+ )
2313
+ ].join("\n")
2314
+ ).join("\n\n");
2315
+ }
2266
2316
  function renderTaskList(value, color) {
2267
2317
  const items = value.items;
2268
2318
  if (items.length === 0) return "No tasks found.";
@@ -2274,7 +2324,7 @@ function renderTaskList(value, color) {
2274
2324
  state: formatStatusGlyph(task.status, color),
2275
2325
  statePlain: stripAnsi(formatStatusGlyph(task.status, false)),
2276
2326
  title: truncateText(task.title, 120),
2277
- path: task.pathTitles && task.pathTitles.length > 1 ? task.pathTitles.join(" > ") : null,
2327
+ path: task.pathTitles && task.pathTitles.length > 1 ? formatPathTitles(task.pathTitles) : null,
2278
2328
  priority: task.priority ? formatPriority(task.priority, color) : dim("-", color),
2279
2329
  priorityPlain: task.priority ? task.priority === "mid" ? "medium" : task.priority : "-",
2280
2330
  due: task.deadline ? formatDateValue(task.deadline) : dim("-", color),
@@ -2286,18 +2336,34 @@ function renderTaskList(value, color) {
2286
2336
  flags: formatTaskFlags(task, color) || dim("-", color),
2287
2337
  flagsPlain: stripAnsi(formatTaskFlags(task, false)) || "-"
2288
2338
  }));
2289
- const taskWidth = Math.max("Task".length, ...rows.map((row) => row.taskPlain.length));
2290
- const stateWidth = Math.max("State".length, ...rows.map((row) => row.statePlain.length));
2339
+ const taskWidth = Math.max(
2340
+ "Task".length,
2341
+ ...rows.map((row) => row.taskPlain.length)
2342
+ );
2343
+ const stateWidth = Math.max(
2344
+ "State".length,
2345
+ ...rows.map((row) => row.statePlain.length)
2346
+ );
2291
2347
  const titleWidth = Math.min(
2292
2348
  40,
2293
- Math.max("Title".length, 18, ...rows.map((row) => getDisplayWidth(row.title)))
2349
+ Math.max(
2350
+ "Title".length,
2351
+ 18,
2352
+ ...rows.map((row) => getDisplayWidth(row.title))
2353
+ )
2294
2354
  );
2295
2355
  const priorityWidth = Math.max(
2296
2356
  "Priority".length,
2297
2357
  ...rows.map((row) => row.priorityPlain.length)
2298
2358
  );
2299
- const dueWidth = Math.max("Due".length, ...rows.map((row) => row.duePlain.length));
2300
- const noteWidth = Math.max("Note".length, ...rows.map((row) => row.notePlain.length));
2359
+ const dueWidth = Math.max(
2360
+ "Due".length,
2361
+ ...rows.map((row) => row.duePlain.length)
2362
+ );
2363
+ const noteWidth = Math.max(
2364
+ "Note".length,
2365
+ ...rows.map((row) => row.notePlain.length)
2366
+ );
2301
2367
  const childrenWidth = Math.max(
2302
2368
  "Children".length,
2303
2369
  ...rows.map((row) => row.childrenPlain.length)
@@ -2352,7 +2418,9 @@ function renderTaskList(value, color) {
2352
2418
  lines.push("");
2353
2419
  lines.push(dim(`Showing ${items.length} tasks (limit ${limit}).`, color));
2354
2420
  if (value.nextCursor) {
2355
- lines.push(dim(`More tasks available after #${value.nextCursor.id}.`, color));
2421
+ lines.push(
2422
+ dim(`More tasks available after #${value.nextCursor.id}.`, color)
2423
+ );
2356
2424
  const nextPageCommand = value.meta?.view === "search" ? [
2357
2425
  "pnpm cli task search",
2358
2426
  quoteCliArg(value.meta.query ?? ""),
@@ -2410,19 +2478,29 @@ function renderTaskDetailResponse(result, color) {
2410
2478
  const sections = [renderTaskDetail(task, color)];
2411
2479
  if (result.taskParents && result.taskParents.length > 1) {
2412
2480
  sections.push(
2413
- ["Parents", ...result.taskParents.map((task2) => `- ${formatTaskLine(task2, color)}`)].join("\n")
2481
+ [
2482
+ "Parents",
2483
+ ...result.taskParents.map((task2) => `- ${formatTaskLine(task2, color)}`)
2484
+ ].join("\n")
2414
2485
  );
2415
2486
  }
2416
2487
  if (result.taskChildren && result.taskChildren.length > 0) {
2417
2488
  sections.push(
2418
- ["Children", ...result.taskChildren.map((task2) => `- ${formatTaskLine(task2, color)}`)].join("\n")
2489
+ [
2490
+ "Children",
2491
+ ...result.taskChildren.map(
2492
+ (task2) => `- ${formatTaskLine(task2, color)}`
2493
+ )
2494
+ ].join("\n")
2419
2495
  );
2420
2496
  }
2421
2497
  if (result.taskAccessType) {
2422
2498
  sections.push(`Access: ${result.taskAccessType}`);
2423
2499
  }
2424
2500
  if (result.note) {
2425
- sections.push(["Note", renderMarkdownNote(result.note.content, color)].join("\n"));
2501
+ sections.push(
2502
+ ["Note", renderMarkdownNote(result.note.content, color)].join("\n")
2503
+ );
2426
2504
  }
2427
2505
  return sections.join("\n\n");
2428
2506
  }
@@ -2455,7 +2533,9 @@ function renderTaskTreeResponse(value, color) {
2455
2533
  );
2456
2534
  lines.push("");
2457
2535
  }
2458
- lines.push(...renderTreeNode(value.tree, color));
2536
+ lines.push(
2537
+ ...renderTreeNode(value.tree, color)
2538
+ );
2459
2539
  return lines.join("\n");
2460
2540
  }
2461
2541
  function renderTaskSummary(value, color) {
@@ -2600,7 +2680,9 @@ function renderDeleteMany(result, color) {
2600
2680
  `Task IDs: ${result.taskIds.join(", ")}`
2601
2681
  ];
2602
2682
  if (result.affectedDependentIds && result.affectedDependentIds.length > 0) {
2603
- lines.push(`Affected dependents: ${result.affectedDependentIds.join(", ")}`);
2683
+ lines.push(
2684
+ `Affected dependents: ${result.affectedDependentIds.join(", ")}`
2685
+ );
2604
2686
  }
2605
2687
  return lines.join("\n");
2606
2688
  }
@@ -2641,10 +2723,10 @@ function renderCleanupPreview(result, color) {
2641
2723
  ),
2642
2724
  "",
2643
2725
  ...result.tasks.map((task) => {
2644
- const pathLine = task.destinationParentTitle && task.destinationParentTitle !== task.currentParentTitle ? ` ${dim(
2645
- `${task.currentParentTitle ?? "Root tasks"} -> ${task.destinationParentTitle}`,
2726
+ const pathLine = task.destinationParentTitle && task.destinationParentTitle !== task.currentParentTitle || task.actions.includes("move") && task.destinationParentId !== task.currentParentId ? ` ${dim(
2727
+ `${task.currentParentTitle ?? (task.currentParentId == null ? "Root tasks" : "Hidden parent")} -> ${task.destinationParentTitle ?? (task.destinationParentId == null ? "Root tasks" : "Hidden parent")}`,
2646
2728
  color
2647
- )}` : task.currentParentTitle ? ` ${dim(task.currentParentTitle, color)}` : "";
2729
+ )}` : task.currentParentTitle ? ` ${dim(task.currentParentTitle, color)}` : task.currentParentId != null ? ` ${dim("Hidden parent", color)}` : "";
2648
2730
  const actionLabel = task.actions.length > 0 ? task.actions.join(", ") : "no-op";
2649
2731
  const changeLines = task.changes?.map(
2650
2732
  (change) => ` ${dim(
@@ -2812,6 +2894,9 @@ function formatHumanOutput(value, options = {}) {
2812
2894
  if (isBranchFocusSignalsLike(value)) {
2813
2895
  return renderBranchFocusSignals(value, color);
2814
2896
  }
2897
+ if (isTaskSearchGroups(value)) {
2898
+ return renderTaskSearchGroups(value, color);
2899
+ }
2815
2900
  if (isTaskCollection(value)) {
2816
2901
  return renderTaskList(value, color);
2817
2902
  }
@@ -3044,7 +3129,7 @@ function resolveTaskRefFromSearchMatches(ref, matches) {
3044
3129
  }
3045
3130
  if (publicIdMatches.length > 1) {
3046
3131
  const formattedMatches = publicIdMatches.map((task) => {
3047
- const path4 = task.pathTitles?.join(" > ") ?? [task.parentTitle, task.title].filter(Boolean).join(" > ") ?? task.title;
3132
+ const path4 = (task.pathTitles ? formatPathTitles(task.pathTitles) : void 0) ?? [task.parentTitle, task.title].filter(Boolean).join(" > ") ?? task.title;
3048
3133
  return `- #${task.id} ${path4}`;
3049
3134
  }).join("\n");
3050
3135
  throw new Error(
@@ -3062,7 +3147,7 @@ ${formattedMatches}`
3062
3147
  }
3063
3148
  if (exactMatches.length > 1) {
3064
3149
  const formattedMatches = exactMatches.map((task) => {
3065
- const path4 = task.pathTitles?.join(" > ") ?? (task.parentTitle ? `${task.parentTitle} > ${task.title}` : task.title);
3150
+ const path4 = (task.pathTitles ? formatPathTitles(task.pathTitles) : void 0) ?? (task.parentTitle ? `${task.parentTitle} > ${task.title}` : task.title);
3066
3151
  return `- #${task.id} ${path4}`;
3067
3152
  }).join("\n");
3068
3153
  throw new Error(`Task reference is ambiguous: ${ref}
@@ -3590,7 +3675,10 @@ function buildCli() {
3590
3675
  );
3591
3676
  }
3592
3677
  );
3593
- task.command("search").argument("<query>").option("--parent <ref>", "only search direct children of the given task").option("--scope <ref>", "only search descendants of the given task").option("--limit <n>", "page size (1-100, default: 20)").option("--cursor-score <score>", "pagination cursor score").option("--cursor-id <id>", "pagination cursor task id").option("--json", "print JSON output").addHelpText(
3678
+ task.command("search").argument(
3679
+ "<query...>",
3680
+ "one or more queries; quote each multi-word query (at most 10, each at most 80 characters when several)"
3681
+ ).option("--parent <ref>", "only search direct children of the given task").option("--scope <ref>", "only search descendants of the given task").option("--limit <n>", "page size (1-100, default: 20)").option("--cursor-score <score>", "pagination cursor score").option("--cursor-id <id>", "pagination cursor task id").option("--json", "print JSON output").addHelpText(
3594
3682
  "after",
3595
3683
  [
3596
3684
  "",
@@ -3599,16 +3687,73 @@ function buildCli() {
3599
3687
  " pnpm cli task search dypt --parent Work",
3600
3688
  " pnpm cli task search dypt --scope Work",
3601
3689
  " pnpm cli task search dypt --limit 8",
3602
- " pnpm cli task search dypt --cursor-score 1 --cursor-id 45877 --limit 8"
3690
+ " pnpm cli task search dypt --cursor-score 1 --cursor-id 45877 --limit 8",
3691
+ ' pnpm cli task search "turso usage" billing replica',
3692
+ "",
3693
+ "Several queries share one search request and print grouped results."
3603
3694
  ].join("\n")
3604
3695
  ).action(
3605
- async (query, options) => {
3696
+ async (queries, options) => {
3606
3697
  assertExclusiveHierarchyOptions(options.parent, options.scope);
3607
3698
  if (options.cursorScore && !options.cursorId || options.cursorId && !options.cursorScore) {
3608
3699
  throw new Error(
3609
3700
  "Both --cursor-score and --cursor-id are required together"
3610
3701
  );
3611
3702
  }
3703
+ if (queries.length > 1) {
3704
+ if (queries.length > MAX_TASK_SEARCH_QUERIES) {
3705
+ throw new Error(
3706
+ `Search at most ${MAX_TASK_SEARCH_QUERIES} queries per call`
3707
+ );
3708
+ }
3709
+ if (queries.some((query2) => query2.length > MAX_TASK_SEARCH_QUERY_LENGTH)) {
3710
+ throw new Error(
3711
+ `Each query must be at most ${MAX_TASK_SEARCH_QUERY_LENGTH} characters when searching several queries`
3712
+ );
3713
+ }
3714
+ if (new Set(queries.map((query2) => query2.trim().toLowerCase())).size !== queries.length) {
3715
+ throw new Error("Each query must be different");
3716
+ }
3717
+ const limit = parseIntegerOption(options.limit, "limit", 1, 100);
3718
+ const maximumLimit = Math.floor(
3719
+ MAX_TASK_SEARCH_MULTI_RESULTS / queries.length
3720
+ );
3721
+ if (limit !== void 0 && limit > maximumLimit) {
3722
+ throw new Error(
3723
+ `Several queries share ${MAX_TASK_SEARCH_MULTI_RESULTS} results: use --limit ${maximumLimit} or less`
3724
+ );
3725
+ }
3726
+ if (options.cursorScore || options.cursorId) {
3727
+ throw new Error(
3728
+ "Pagination cursors work with a single query only; rerun the next-page command for that query"
3729
+ );
3730
+ }
3731
+ await runTaskSearchMany(
3732
+ {
3733
+ queries,
3734
+ parent: options.parent,
3735
+ scope: options.scope,
3736
+ limit: options.limit,
3737
+ json: Boolean(options.json)
3738
+ },
3739
+ {
3740
+ searchManyTasks: (input) => withCliApi(async (api) => {
3741
+ const parentTaskId = input.parent ? await resolveTaskId(api, input.parent) : void 0;
3742
+ const scopeTaskId = input.scope ? await resolveTaskId(api, input.scope) : void 0;
3743
+ return api.searchManyTasks({
3744
+ queries: input.queries,
3745
+ parentTaskId,
3746
+ scopeTaskId,
3747
+ limit
3748
+ });
3749
+ }),
3750
+ printJson,
3751
+ printTable
3752
+ }
3753
+ );
3754
+ return;
3755
+ }
3756
+ const [query] = queries;
3612
3757
  await runTaskSearch(
3613
3758
  {
3614
3759
  query,