@dypt/cli 0.1.23 → 0.1.26
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 +38 -0
- package/dist/index.js +196 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.
|
|
12
|
+
version: "0.1.26",
|
|
13
13
|
description: "Command-line interface for dypt task management",
|
|
14
14
|
license: "SEE LICENSE IN LICENSE",
|
|
15
15
|
homepage: "https://dypt.app",
|
|
@@ -330,7 +330,28 @@ var CliTransportError = class extends Error {
|
|
|
330
330
|
[this.category, this.retryableRead] = this.causeCode ? causes[this.causeCode] : ["unknown", false];
|
|
331
331
|
}
|
|
332
332
|
};
|
|
333
|
+
var CliHttpError = class extends Error {
|
|
334
|
+
constructor(httpStatus) {
|
|
335
|
+
const reason = httpStatus === 414 ? "Request-URI Too Long" : "Request Header Fields Too Large";
|
|
336
|
+
super(
|
|
337
|
+
`dypt request failed (HTTP ${httpStatus}: ${reason}). Reduce the request size or update the CLI.`
|
|
338
|
+
);
|
|
339
|
+
this.httpStatus = httpStatus;
|
|
340
|
+
this.code = "CLI_HTTP_ERROR";
|
|
341
|
+
this.name = "CliHttpError";
|
|
342
|
+
}
|
|
343
|
+
};
|
|
333
344
|
function formatTransportFailure(error, json) {
|
|
345
|
+
const http = errorChain(error).find(
|
|
346
|
+
(item) => item instanceof CliHttpError
|
|
347
|
+
);
|
|
348
|
+
if (http) {
|
|
349
|
+
const { code: code2, message: message2, httpStatus } = http;
|
|
350
|
+
return {
|
|
351
|
+
exitCode: 1,
|
|
352
|
+
output: json ? JSON.stringify({ error: { code: code2, message: message2, httpStatus } }) : message2
|
|
353
|
+
};
|
|
354
|
+
}
|
|
334
355
|
const transport = errorChain(error).find(
|
|
335
356
|
(item) => item instanceof CliTransportError
|
|
336
357
|
);
|
|
@@ -399,6 +420,9 @@ async function fetchWithMaintenanceCheck(input, init) {
|
|
|
399
420
|
}
|
|
400
421
|
const maintenanceError = await getMaintenanceError(response);
|
|
401
422
|
if (maintenanceError) throw maintenanceError;
|
|
423
|
+
if (response.status === 414 || response.status === 431) {
|
|
424
|
+
throw new CliHttpError(response.status);
|
|
425
|
+
}
|
|
402
426
|
return response;
|
|
403
427
|
}
|
|
404
428
|
function findCliReadRateLimitError(error) {
|
|
@@ -519,6 +543,9 @@ async function createCliTrpcClient(options = {}) {
|
|
|
519
543
|
httpBatchLink({
|
|
520
544
|
url: `${baseUrl}/api/trpc`,
|
|
521
545
|
transformer: superjson,
|
|
546
|
+
methodOverride: "POST",
|
|
547
|
+
maxURLLength: 8192,
|
|
548
|
+
maxItems: 10,
|
|
522
549
|
fetch: fetchWithMaintenanceCheck,
|
|
523
550
|
headers() {
|
|
524
551
|
const measurementId = process.env.DYPT_DB_MEASUREMENT;
|
|
@@ -597,6 +624,7 @@ async function createCliApi(options = {}) {
|
|
|
597
624
|
getBranchFocusSignals: (input) => cliClient.cli.v1.tasks.planFocus.query(input),
|
|
598
625
|
listTasks: (input) => cliClient.cli.v1.tasks.list.query(input ?? {}),
|
|
599
626
|
searchTasks: (input) => cliClient.cli.v1.tasks.search.query(input),
|
|
627
|
+
searchManyTasks: (input) => cliClient.cli.v1.tasks.searchMany.query(input),
|
|
600
628
|
resolveTaskReferences: (input) => cliClient.cli.v1.tasks.resolveMany.query(input),
|
|
601
629
|
getTaskTree: (input) => cliClient.cli.v1.tasks.tree.query(input),
|
|
602
630
|
deleteTasks: (input) => cliClient.cli.v1.tasks.deleteMany.mutate(input),
|
|
@@ -1141,6 +1169,8 @@ function formatDependencyAddError(error) {
|
|
|
1141
1169
|
return "Cannot add that dependency because it would create a cycle.";
|
|
1142
1170
|
case "CLI_DEPENDENCY_ARCHIVED_TASK":
|
|
1143
1171
|
return "Cannot add a dependency involving an archived task.";
|
|
1172
|
+
case "CLI_DEPENDENCY_BLOCKER_LIMIT":
|
|
1173
|
+
return "A task cannot have more than 100 blockers.";
|
|
1144
1174
|
default:
|
|
1145
1175
|
return message;
|
|
1146
1176
|
}
|
|
@@ -1530,6 +1560,32 @@ async function runTaskSearch(input, deps) {
|
|
|
1530
1560
|
}
|
|
1531
1561
|
});
|
|
1532
1562
|
}
|
|
1563
|
+
var MAX_TASK_SEARCH_QUERIES = 10;
|
|
1564
|
+
var MAX_TASK_SEARCH_QUERY_LENGTH = 80;
|
|
1565
|
+
var MAX_TASK_SEARCH_MULTI_RESULTS = 100;
|
|
1566
|
+
async function runTaskSearchMany(input, deps) {
|
|
1567
|
+
const result = await deps.searchManyTasks({
|
|
1568
|
+
queries: input.queries,
|
|
1569
|
+
parent: input.parent,
|
|
1570
|
+
scope: input.scope,
|
|
1571
|
+
limit: input.limit
|
|
1572
|
+
});
|
|
1573
|
+
if (input.json) {
|
|
1574
|
+
deps.printJson(result);
|
|
1575
|
+
return;
|
|
1576
|
+
}
|
|
1577
|
+
const record = typeof result === "object" && result !== null ? result : {};
|
|
1578
|
+
deps.printTable({
|
|
1579
|
+
...record,
|
|
1580
|
+
meta: {
|
|
1581
|
+
// The server picks the per-query page size when --limit is omitted.
|
|
1582
|
+
limit: typeof record.limit === "number" ? record.limit : Number.parseInt(input.limit ?? "20", 10),
|
|
1583
|
+
parent: input.parent,
|
|
1584
|
+
scope: input.scope,
|
|
1585
|
+
view: "search-groups"
|
|
1586
|
+
}
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1533
1589
|
|
|
1534
1590
|
// src/commands/task/summary.ts
|
|
1535
1591
|
async function runTaskSummary(input, deps) {
|
|
@@ -2013,6 +2069,11 @@ function getCleanupWorkflowLabel(value) {
|
|
|
2013
2069
|
function isTaskCollection(value) {
|
|
2014
2070
|
return isRecord(value) && Array.isArray(value.items) && value.items.every(isTaskLike);
|
|
2015
2071
|
}
|
|
2072
|
+
function isTaskSearchGroups(value) {
|
|
2073
|
+
return isRecord(value) && Array.isArray(value.groups) && value.groups.every(
|
|
2074
|
+
(group) => isRecord(group) && typeof group.query === "string" && isTaskCollection(group)
|
|
2075
|
+
);
|
|
2076
|
+
}
|
|
2016
2077
|
function isAuthStatusLike(value) {
|
|
2017
2078
|
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
2079
|
}
|
|
@@ -2180,9 +2241,7 @@ function formatPriority(priority, color) {
|
|
|
2180
2241
|
function renderInlineMarkdown(text, color) {
|
|
2181
2242
|
const codePlaceholders = [];
|
|
2182
2243
|
let rendered = text.replace(/`([^`\n]+)`/g, (_, code) => {
|
|
2183
|
-
const index = codePlaceholders.push(
|
|
2184
|
-
color ? colorize(code, "cyan", color) : code
|
|
2185
|
-
) - 1;
|
|
2244
|
+
const index = codePlaceholders.push(color ? colorize(code, "cyan", color) : code) - 1;
|
|
2186
2245
|
return `\0CODE${index}\0`;
|
|
2187
2246
|
});
|
|
2188
2247
|
rendered = rendered.replace(
|
|
@@ -2263,6 +2322,24 @@ function formatTaskLine(task, color) {
|
|
|
2263
2322
|
const suffix = details.length > 0 ? ` ${dim("\xB7", color)} ${details.join(` ${dim("\xB7", color)} `)}` : "";
|
|
2264
2323
|
return `${colorize(`#${task.id}`, "cyan", color)} ${formatStatusGlyph(task.status, color)} ${title}${suffix}`;
|
|
2265
2324
|
}
|
|
2325
|
+
function formatPathTitles(titles) {
|
|
2326
|
+
return titles.map((title) => title ?? "Hidden parent").join(" > ");
|
|
2327
|
+
}
|
|
2328
|
+
function renderTaskSearchGroups(value, color) {
|
|
2329
|
+
return value.groups.map(
|
|
2330
|
+
(group) => [
|
|
2331
|
+
emphasize(`Search: ${group.query}`, "bold", color),
|
|
2332
|
+
renderTaskList(
|
|
2333
|
+
{
|
|
2334
|
+
items: group.items,
|
|
2335
|
+
nextCursor: group.nextCursor,
|
|
2336
|
+
meta: { ...value.meta, view: "search", query: group.query }
|
|
2337
|
+
},
|
|
2338
|
+
color
|
|
2339
|
+
)
|
|
2340
|
+
].join("\n")
|
|
2341
|
+
).join("\n\n");
|
|
2342
|
+
}
|
|
2266
2343
|
function renderTaskList(value, color) {
|
|
2267
2344
|
const items = value.items;
|
|
2268
2345
|
if (items.length === 0) return "No tasks found.";
|
|
@@ -2274,7 +2351,7 @@ function renderTaskList(value, color) {
|
|
|
2274
2351
|
state: formatStatusGlyph(task.status, color),
|
|
2275
2352
|
statePlain: stripAnsi(formatStatusGlyph(task.status, false)),
|
|
2276
2353
|
title: truncateText(task.title, 120),
|
|
2277
|
-
path: task.pathTitles && task.pathTitles.length > 1 ? task.pathTitles
|
|
2354
|
+
path: task.pathTitles && task.pathTitles.length > 1 ? formatPathTitles(task.pathTitles) : null,
|
|
2278
2355
|
priority: task.priority ? formatPriority(task.priority, color) : dim("-", color),
|
|
2279
2356
|
priorityPlain: task.priority ? task.priority === "mid" ? "medium" : task.priority : "-",
|
|
2280
2357
|
due: task.deadline ? formatDateValue(task.deadline) : dim("-", color),
|
|
@@ -2286,18 +2363,34 @@ function renderTaskList(value, color) {
|
|
|
2286
2363
|
flags: formatTaskFlags(task, color) || dim("-", color),
|
|
2287
2364
|
flagsPlain: stripAnsi(formatTaskFlags(task, false)) || "-"
|
|
2288
2365
|
}));
|
|
2289
|
-
const taskWidth = Math.max(
|
|
2290
|
-
|
|
2366
|
+
const taskWidth = Math.max(
|
|
2367
|
+
"Task".length,
|
|
2368
|
+
...rows.map((row) => row.taskPlain.length)
|
|
2369
|
+
);
|
|
2370
|
+
const stateWidth = Math.max(
|
|
2371
|
+
"State".length,
|
|
2372
|
+
...rows.map((row) => row.statePlain.length)
|
|
2373
|
+
);
|
|
2291
2374
|
const titleWidth = Math.min(
|
|
2292
2375
|
40,
|
|
2293
|
-
Math.max(
|
|
2376
|
+
Math.max(
|
|
2377
|
+
"Title".length,
|
|
2378
|
+
18,
|
|
2379
|
+
...rows.map((row) => getDisplayWidth(row.title))
|
|
2380
|
+
)
|
|
2294
2381
|
);
|
|
2295
2382
|
const priorityWidth = Math.max(
|
|
2296
2383
|
"Priority".length,
|
|
2297
2384
|
...rows.map((row) => row.priorityPlain.length)
|
|
2298
2385
|
);
|
|
2299
|
-
const dueWidth = Math.max(
|
|
2300
|
-
|
|
2386
|
+
const dueWidth = Math.max(
|
|
2387
|
+
"Due".length,
|
|
2388
|
+
...rows.map((row) => row.duePlain.length)
|
|
2389
|
+
);
|
|
2390
|
+
const noteWidth = Math.max(
|
|
2391
|
+
"Note".length,
|
|
2392
|
+
...rows.map((row) => row.notePlain.length)
|
|
2393
|
+
);
|
|
2301
2394
|
const childrenWidth = Math.max(
|
|
2302
2395
|
"Children".length,
|
|
2303
2396
|
...rows.map((row) => row.childrenPlain.length)
|
|
@@ -2352,7 +2445,9 @@ function renderTaskList(value, color) {
|
|
|
2352
2445
|
lines.push("");
|
|
2353
2446
|
lines.push(dim(`Showing ${items.length} tasks (limit ${limit}).`, color));
|
|
2354
2447
|
if (value.nextCursor) {
|
|
2355
|
-
lines.push(
|
|
2448
|
+
lines.push(
|
|
2449
|
+
dim(`More tasks available after #${value.nextCursor.id}.`, color)
|
|
2450
|
+
);
|
|
2356
2451
|
const nextPageCommand = value.meta?.view === "search" ? [
|
|
2357
2452
|
"pnpm cli task search",
|
|
2358
2453
|
quoteCliArg(value.meta.query ?? ""),
|
|
@@ -2410,19 +2505,29 @@ function renderTaskDetailResponse(result, color) {
|
|
|
2410
2505
|
const sections = [renderTaskDetail(task, color)];
|
|
2411
2506
|
if (result.taskParents && result.taskParents.length > 1) {
|
|
2412
2507
|
sections.push(
|
|
2413
|
-
[
|
|
2508
|
+
[
|
|
2509
|
+
"Parents",
|
|
2510
|
+
...result.taskParents.map((task2) => `- ${formatTaskLine(task2, color)}`)
|
|
2511
|
+
].join("\n")
|
|
2414
2512
|
);
|
|
2415
2513
|
}
|
|
2416
2514
|
if (result.taskChildren && result.taskChildren.length > 0) {
|
|
2417
2515
|
sections.push(
|
|
2418
|
-
[
|
|
2516
|
+
[
|
|
2517
|
+
"Children",
|
|
2518
|
+
...result.taskChildren.map(
|
|
2519
|
+
(task2) => `- ${formatTaskLine(task2, color)}`
|
|
2520
|
+
)
|
|
2521
|
+
].join("\n")
|
|
2419
2522
|
);
|
|
2420
2523
|
}
|
|
2421
2524
|
if (result.taskAccessType) {
|
|
2422
2525
|
sections.push(`Access: ${result.taskAccessType}`);
|
|
2423
2526
|
}
|
|
2424
2527
|
if (result.note) {
|
|
2425
|
-
sections.push(
|
|
2528
|
+
sections.push(
|
|
2529
|
+
["Note", renderMarkdownNote(result.note.content, color)].join("\n")
|
|
2530
|
+
);
|
|
2426
2531
|
}
|
|
2427
2532
|
return sections.join("\n\n");
|
|
2428
2533
|
}
|
|
@@ -2455,7 +2560,9 @@ function renderTaskTreeResponse(value, color) {
|
|
|
2455
2560
|
);
|
|
2456
2561
|
lines.push("");
|
|
2457
2562
|
}
|
|
2458
|
-
lines.push(
|
|
2563
|
+
lines.push(
|
|
2564
|
+
...renderTreeNode(value.tree, color)
|
|
2565
|
+
);
|
|
2459
2566
|
return lines.join("\n");
|
|
2460
2567
|
}
|
|
2461
2568
|
function renderTaskSummary(value, color) {
|
|
@@ -2600,7 +2707,9 @@ function renderDeleteMany(result, color) {
|
|
|
2600
2707
|
`Task IDs: ${result.taskIds.join(", ")}`
|
|
2601
2708
|
];
|
|
2602
2709
|
if (result.affectedDependentIds && result.affectedDependentIds.length > 0) {
|
|
2603
|
-
lines.push(
|
|
2710
|
+
lines.push(
|
|
2711
|
+
`Affected dependents: ${result.affectedDependentIds.join(", ")}`
|
|
2712
|
+
);
|
|
2604
2713
|
}
|
|
2605
2714
|
return lines.join("\n");
|
|
2606
2715
|
}
|
|
@@ -2641,10 +2750,10 @@ function renderCleanupPreview(result, color) {
|
|
|
2641
2750
|
),
|
|
2642
2751
|
"",
|
|
2643
2752
|
...result.tasks.map((task) => {
|
|
2644
|
-
const pathLine = task.destinationParentTitle && task.destinationParentTitle !== task.currentParentTitle ? ` ${dim(
|
|
2645
|
-
`${task.currentParentTitle ?? "Root tasks"} -> ${task.destinationParentTitle}`,
|
|
2753
|
+
const pathLine = task.destinationParentTitle && task.destinationParentTitle !== task.currentParentTitle || task.actions.includes("move") && task.destinationParentId !== task.currentParentId ? ` ${dim(
|
|
2754
|
+
`${task.currentParentTitle ?? (task.currentParentId == null ? "Root tasks" : "Hidden parent")} -> ${task.destinationParentTitle ?? (task.destinationParentId == null ? "Root tasks" : "Hidden parent")}`,
|
|
2646
2755
|
color
|
|
2647
|
-
)}` : task.currentParentTitle ? ` ${dim(task.currentParentTitle, color)}` : "";
|
|
2756
|
+
)}` : task.currentParentTitle ? ` ${dim(task.currentParentTitle, color)}` : task.currentParentId != null ? ` ${dim("Hidden parent", color)}` : "";
|
|
2648
2757
|
const actionLabel = task.actions.length > 0 ? task.actions.join(", ") : "no-op";
|
|
2649
2758
|
const changeLines = task.changes?.map(
|
|
2650
2759
|
(change) => ` ${dim(
|
|
@@ -2812,6 +2921,9 @@ function formatHumanOutput(value, options = {}) {
|
|
|
2812
2921
|
if (isBranchFocusSignalsLike(value)) {
|
|
2813
2922
|
return renderBranchFocusSignals(value, color);
|
|
2814
2923
|
}
|
|
2924
|
+
if (isTaskSearchGroups(value)) {
|
|
2925
|
+
return renderTaskSearchGroups(value, color);
|
|
2926
|
+
}
|
|
2815
2927
|
if (isTaskCollection(value)) {
|
|
2816
2928
|
return renderTaskList(value, color);
|
|
2817
2929
|
}
|
|
@@ -3044,7 +3156,7 @@ function resolveTaskRefFromSearchMatches(ref, matches) {
|
|
|
3044
3156
|
}
|
|
3045
3157
|
if (publicIdMatches.length > 1) {
|
|
3046
3158
|
const formattedMatches = publicIdMatches.map((task) => {
|
|
3047
|
-
const path4 = task.pathTitles
|
|
3159
|
+
const path4 = (task.pathTitles ? formatPathTitles(task.pathTitles) : void 0) ?? [task.parentTitle, task.title].filter(Boolean).join(" > ") ?? task.title;
|
|
3048
3160
|
return `- #${task.id} ${path4}`;
|
|
3049
3161
|
}).join("\n");
|
|
3050
3162
|
throw new Error(
|
|
@@ -3062,7 +3174,7 @@ ${formattedMatches}`
|
|
|
3062
3174
|
}
|
|
3063
3175
|
if (exactMatches.length > 1) {
|
|
3064
3176
|
const formattedMatches = exactMatches.map((task) => {
|
|
3065
|
-
const path4 = task.pathTitles
|
|
3177
|
+
const path4 = (task.pathTitles ? formatPathTitles(task.pathTitles) : void 0) ?? (task.parentTitle ? `${task.parentTitle} > ${task.title}` : task.title);
|
|
3066
3178
|
return `- #${task.id} ${path4}`;
|
|
3067
3179
|
}).join("\n");
|
|
3068
3180
|
throw new Error(`Task reference is ambiguous: ${ref}
|
|
@@ -3590,7 +3702,10 @@ function buildCli() {
|
|
|
3590
3702
|
);
|
|
3591
3703
|
}
|
|
3592
3704
|
);
|
|
3593
|
-
task.command("search").argument(
|
|
3705
|
+
task.command("search").argument(
|
|
3706
|
+
"<query...>",
|
|
3707
|
+
"one or more queries; quote each multi-word query (at most 10, each at most 80 characters when several)"
|
|
3708
|
+
).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
3709
|
"after",
|
|
3595
3710
|
[
|
|
3596
3711
|
"",
|
|
@@ -3599,16 +3714,73 @@ function buildCli() {
|
|
|
3599
3714
|
" pnpm cli task search dypt --parent Work",
|
|
3600
3715
|
" pnpm cli task search dypt --scope Work",
|
|
3601
3716
|
" pnpm cli task search dypt --limit 8",
|
|
3602
|
-
" pnpm cli task search dypt --cursor-score 1 --cursor-id 45877 --limit 8"
|
|
3717
|
+
" pnpm cli task search dypt --cursor-score 1 --cursor-id 45877 --limit 8",
|
|
3718
|
+
' pnpm cli task search "turso usage" billing replica',
|
|
3719
|
+
"",
|
|
3720
|
+
"Several queries share one search request and print grouped results."
|
|
3603
3721
|
].join("\n")
|
|
3604
3722
|
).action(
|
|
3605
|
-
async (
|
|
3723
|
+
async (queries, options) => {
|
|
3606
3724
|
assertExclusiveHierarchyOptions(options.parent, options.scope);
|
|
3607
3725
|
if (options.cursorScore && !options.cursorId || options.cursorId && !options.cursorScore) {
|
|
3608
3726
|
throw new Error(
|
|
3609
3727
|
"Both --cursor-score and --cursor-id are required together"
|
|
3610
3728
|
);
|
|
3611
3729
|
}
|
|
3730
|
+
if (queries.length > 1) {
|
|
3731
|
+
if (queries.length > MAX_TASK_SEARCH_QUERIES) {
|
|
3732
|
+
throw new Error(
|
|
3733
|
+
`Search at most ${MAX_TASK_SEARCH_QUERIES} queries per call`
|
|
3734
|
+
);
|
|
3735
|
+
}
|
|
3736
|
+
if (queries.some((query2) => query2.length > MAX_TASK_SEARCH_QUERY_LENGTH)) {
|
|
3737
|
+
throw new Error(
|
|
3738
|
+
`Each query must be at most ${MAX_TASK_SEARCH_QUERY_LENGTH} characters when searching several queries`
|
|
3739
|
+
);
|
|
3740
|
+
}
|
|
3741
|
+
if (new Set(queries.map((query2) => query2.trim().toLowerCase())).size !== queries.length) {
|
|
3742
|
+
throw new Error("Each query must be different");
|
|
3743
|
+
}
|
|
3744
|
+
const limit = parseIntegerOption(options.limit, "limit", 1, 100);
|
|
3745
|
+
const maximumLimit = Math.floor(
|
|
3746
|
+
MAX_TASK_SEARCH_MULTI_RESULTS / queries.length
|
|
3747
|
+
);
|
|
3748
|
+
if (limit !== void 0 && limit > maximumLimit) {
|
|
3749
|
+
throw new Error(
|
|
3750
|
+
`Several queries share ${MAX_TASK_SEARCH_MULTI_RESULTS} results: use --limit ${maximumLimit} or less`
|
|
3751
|
+
);
|
|
3752
|
+
}
|
|
3753
|
+
if (options.cursorScore || options.cursorId) {
|
|
3754
|
+
throw new Error(
|
|
3755
|
+
"Pagination cursors work with a single query only; rerun the next-page command for that query"
|
|
3756
|
+
);
|
|
3757
|
+
}
|
|
3758
|
+
await runTaskSearchMany(
|
|
3759
|
+
{
|
|
3760
|
+
queries,
|
|
3761
|
+
parent: options.parent,
|
|
3762
|
+
scope: options.scope,
|
|
3763
|
+
limit: options.limit,
|
|
3764
|
+
json: Boolean(options.json)
|
|
3765
|
+
},
|
|
3766
|
+
{
|
|
3767
|
+
searchManyTasks: (input) => withCliApi(async (api) => {
|
|
3768
|
+
const parentTaskId = input.parent ? await resolveTaskId(api, input.parent) : void 0;
|
|
3769
|
+
const scopeTaskId = input.scope ? await resolveTaskId(api, input.scope) : void 0;
|
|
3770
|
+
return api.searchManyTasks({
|
|
3771
|
+
queries: input.queries,
|
|
3772
|
+
parentTaskId,
|
|
3773
|
+
scopeTaskId,
|
|
3774
|
+
limit
|
|
3775
|
+
});
|
|
3776
|
+
}),
|
|
3777
|
+
printJson,
|
|
3778
|
+
printTable
|
|
3779
|
+
}
|
|
3780
|
+
);
|
|
3781
|
+
return;
|
|
3782
|
+
}
|
|
3783
|
+
const [query] = queries;
|
|
3612
3784
|
await runTaskSearch(
|
|
3613
3785
|
{
|
|
3614
3786
|
query,
|