@dypt/cli 0.1.22 → 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 +58 -0
- package/dist/index.js +174 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,6 +16,18 @@ npm install -g @dypt/cli
|
|
|
16
16
|
|
|
17
17
|
## Basic usage
|
|
18
18
|
|
|
19
|
+
For a single admin diagnostic request, set `DYPT_DB_MEASUREMENT` to an opaque
|
|
20
|
+
`m_` identifier (12–64 letters, digits, underscores, or hyphens after the
|
|
21
|
+
prefix). For example:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
DYPT_DB_MEASUREMENT=m_cli_usage_20260927 dypt task list --limit 10
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The server accepts the header only for the authenticated admin CLI actor and
|
|
28
|
+
emits one Sentry measurement event for that request. Use a distinct identifier
|
|
29
|
+
for each invocation, including an idempotent replay.
|
|
30
|
+
|
|
19
31
|
### Sign in
|
|
20
32
|
|
|
21
33
|
Authenticate the CLI with your dypt account:
|
|
@@ -65,6 +77,34 @@ Branch filtering is query-time ancestry matching. It does not copy tags,
|
|
|
65
77
|
priority, status, deadlines, or time estimates onto descendants. Run
|
|
66
78
|
`dypt task list --help` for the branch priority, deadline, and tag flags.
|
|
67
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
|
+
|
|
68
108
|
### Create a task
|
|
69
109
|
|
|
70
110
|
Create a new task:
|
|
@@ -308,6 +348,16 @@ dypt agent install-instructions --append AGENTS.md
|
|
|
308
348
|
|
|
309
349
|
## Support policy
|
|
310
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
|
+
|
|
311
361
|
- the CLI is currently versioned as an early `0.x` release, so command shape and
|
|
312
362
|
output may still evolve
|
|
313
363
|
- the JSON output mode is intended for agent and automation use, but consumers
|
|
@@ -325,3 +375,11 @@ email [support@dypt.app](mailto:support@dypt.app).
|
|
|
325
375
|
|
|
326
376
|
This package is distributed under a custom proprietary license. See
|
|
327
377
|
[LICENSE](./LICENSE).
|
|
378
|
+
|
|
379
|
+
### Note-search workload limit
|
|
380
|
+
|
|
381
|
+
`dypt note search` returns a complete array for searches with at most 1,000
|
|
382
|
+
candidate notes. Broader searches fail with `CLI_NOTE_SEARCH_TOO_BROAD` and ask
|
|
383
|
+
you to narrow the query; results are never silently truncated. This is a fixed
|
|
384
|
+
workload limit, so retrying the same broad query will not help. Candidates
|
|
385
|
+
subsequently rejected by current permissions also count toward this limit.
|
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.25",
|
|
13
13
|
description: "Command-line interface for dypt task management",
|
|
14
14
|
license: "SEE LICENSE IN LICENSE",
|
|
15
15
|
homepage: "https://dypt.app",
|
|
@@ -521,9 +521,11 @@ async function createCliTrpcClient(options = {}) {
|
|
|
521
521
|
transformer: superjson,
|
|
522
522
|
fetch: fetchWithMaintenanceCheck,
|
|
523
523
|
headers() {
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
524
|
+
const measurementId = process.env.DYPT_DB_MEASUREMENT;
|
|
525
|
+
return {
|
|
526
|
+
...accessToken ? { Authorization: `Bearer ${accessToken}` } : {},
|
|
527
|
+
...measurementId ? { "x-dypt-db-measurement": measurementId } : {}
|
|
528
|
+
};
|
|
527
529
|
}
|
|
528
530
|
})
|
|
529
531
|
]
|
|
@@ -595,6 +597,7 @@ async function createCliApi(options = {}) {
|
|
|
595
597
|
getBranchFocusSignals: (input) => cliClient.cli.v1.tasks.planFocus.query(input),
|
|
596
598
|
listTasks: (input) => cliClient.cli.v1.tasks.list.query(input ?? {}),
|
|
597
599
|
searchTasks: (input) => cliClient.cli.v1.tasks.search.query(input),
|
|
600
|
+
searchManyTasks: (input) => cliClient.cli.v1.tasks.searchMany.query(input),
|
|
598
601
|
resolveTaskReferences: (input) => cliClient.cli.v1.tasks.resolveMany.query(input),
|
|
599
602
|
getTaskTree: (input) => cliClient.cli.v1.tasks.tree.query(input),
|
|
600
603
|
deleteTasks: (input) => cliClient.cli.v1.tasks.deleteMany.mutate(input),
|
|
@@ -1139,6 +1142,8 @@ function formatDependencyAddError(error) {
|
|
|
1139
1142
|
return "Cannot add that dependency because it would create a cycle.";
|
|
1140
1143
|
case "CLI_DEPENDENCY_ARCHIVED_TASK":
|
|
1141
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.";
|
|
1142
1147
|
default:
|
|
1143
1148
|
return message;
|
|
1144
1149
|
}
|
|
@@ -1528,6 +1533,32 @@ async function runTaskSearch(input, deps) {
|
|
|
1528
1533
|
}
|
|
1529
1534
|
});
|
|
1530
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
|
+
}
|
|
1531
1562
|
|
|
1532
1563
|
// src/commands/task/summary.ts
|
|
1533
1564
|
async function runTaskSummary(input, deps) {
|
|
@@ -2011,6 +2042,11 @@ function getCleanupWorkflowLabel(value) {
|
|
|
2011
2042
|
function isTaskCollection(value) {
|
|
2012
2043
|
return isRecord(value) && Array.isArray(value.items) && value.items.every(isTaskLike);
|
|
2013
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
|
+
}
|
|
2014
2050
|
function isAuthStatusLike(value) {
|
|
2015
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";
|
|
2016
2052
|
}
|
|
@@ -2178,9 +2214,7 @@ function formatPriority(priority, color) {
|
|
|
2178
2214
|
function renderInlineMarkdown(text, color) {
|
|
2179
2215
|
const codePlaceholders = [];
|
|
2180
2216
|
let rendered = text.replace(/`([^`\n]+)`/g, (_, code) => {
|
|
2181
|
-
const index = codePlaceholders.push(
|
|
2182
|
-
color ? colorize(code, "cyan", color) : code
|
|
2183
|
-
) - 1;
|
|
2217
|
+
const index = codePlaceholders.push(color ? colorize(code, "cyan", color) : code) - 1;
|
|
2184
2218
|
return `\0CODE${index}\0`;
|
|
2185
2219
|
});
|
|
2186
2220
|
rendered = rendered.replace(
|
|
@@ -2261,6 +2295,24 @@ function formatTaskLine(task, color) {
|
|
|
2261
2295
|
const suffix = details.length > 0 ? ` ${dim("\xB7", color)} ${details.join(` ${dim("\xB7", color)} `)}` : "";
|
|
2262
2296
|
return `${colorize(`#${task.id}`, "cyan", color)} ${formatStatusGlyph(task.status, color)} ${title}${suffix}`;
|
|
2263
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
|
+
}
|
|
2264
2316
|
function renderTaskList(value, color) {
|
|
2265
2317
|
const items = value.items;
|
|
2266
2318
|
if (items.length === 0) return "No tasks found.";
|
|
@@ -2272,7 +2324,7 @@ function renderTaskList(value, color) {
|
|
|
2272
2324
|
state: formatStatusGlyph(task.status, color),
|
|
2273
2325
|
statePlain: stripAnsi(formatStatusGlyph(task.status, false)),
|
|
2274
2326
|
title: truncateText(task.title, 120),
|
|
2275
|
-
path: task.pathTitles && task.pathTitles.length > 1 ? task.pathTitles
|
|
2327
|
+
path: task.pathTitles && task.pathTitles.length > 1 ? formatPathTitles(task.pathTitles) : null,
|
|
2276
2328
|
priority: task.priority ? formatPriority(task.priority, color) : dim("-", color),
|
|
2277
2329
|
priorityPlain: task.priority ? task.priority === "mid" ? "medium" : task.priority : "-",
|
|
2278
2330
|
due: task.deadline ? formatDateValue(task.deadline) : dim("-", color),
|
|
@@ -2284,18 +2336,34 @@ function renderTaskList(value, color) {
|
|
|
2284
2336
|
flags: formatTaskFlags(task, color) || dim("-", color),
|
|
2285
2337
|
flagsPlain: stripAnsi(formatTaskFlags(task, false)) || "-"
|
|
2286
2338
|
}));
|
|
2287
|
-
const taskWidth = Math.max(
|
|
2288
|
-
|
|
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
|
+
);
|
|
2289
2347
|
const titleWidth = Math.min(
|
|
2290
2348
|
40,
|
|
2291
|
-
Math.max(
|
|
2349
|
+
Math.max(
|
|
2350
|
+
"Title".length,
|
|
2351
|
+
18,
|
|
2352
|
+
...rows.map((row) => getDisplayWidth(row.title))
|
|
2353
|
+
)
|
|
2292
2354
|
);
|
|
2293
2355
|
const priorityWidth = Math.max(
|
|
2294
2356
|
"Priority".length,
|
|
2295
2357
|
...rows.map((row) => row.priorityPlain.length)
|
|
2296
2358
|
);
|
|
2297
|
-
const dueWidth = Math.max(
|
|
2298
|
-
|
|
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
|
+
);
|
|
2299
2367
|
const childrenWidth = Math.max(
|
|
2300
2368
|
"Children".length,
|
|
2301
2369
|
...rows.map((row) => row.childrenPlain.length)
|
|
@@ -2350,7 +2418,9 @@ function renderTaskList(value, color) {
|
|
|
2350
2418
|
lines.push("");
|
|
2351
2419
|
lines.push(dim(`Showing ${items.length} tasks (limit ${limit}).`, color));
|
|
2352
2420
|
if (value.nextCursor) {
|
|
2353
|
-
lines.push(
|
|
2421
|
+
lines.push(
|
|
2422
|
+
dim(`More tasks available after #${value.nextCursor.id}.`, color)
|
|
2423
|
+
);
|
|
2354
2424
|
const nextPageCommand = value.meta?.view === "search" ? [
|
|
2355
2425
|
"pnpm cli task search",
|
|
2356
2426
|
quoteCliArg(value.meta.query ?? ""),
|
|
@@ -2408,19 +2478,29 @@ function renderTaskDetailResponse(result, color) {
|
|
|
2408
2478
|
const sections = [renderTaskDetail(task, color)];
|
|
2409
2479
|
if (result.taskParents && result.taskParents.length > 1) {
|
|
2410
2480
|
sections.push(
|
|
2411
|
-
[
|
|
2481
|
+
[
|
|
2482
|
+
"Parents",
|
|
2483
|
+
...result.taskParents.map((task2) => `- ${formatTaskLine(task2, color)}`)
|
|
2484
|
+
].join("\n")
|
|
2412
2485
|
);
|
|
2413
2486
|
}
|
|
2414
2487
|
if (result.taskChildren && result.taskChildren.length > 0) {
|
|
2415
2488
|
sections.push(
|
|
2416
|
-
[
|
|
2489
|
+
[
|
|
2490
|
+
"Children",
|
|
2491
|
+
...result.taskChildren.map(
|
|
2492
|
+
(task2) => `- ${formatTaskLine(task2, color)}`
|
|
2493
|
+
)
|
|
2494
|
+
].join("\n")
|
|
2417
2495
|
);
|
|
2418
2496
|
}
|
|
2419
2497
|
if (result.taskAccessType) {
|
|
2420
2498
|
sections.push(`Access: ${result.taskAccessType}`);
|
|
2421
2499
|
}
|
|
2422
2500
|
if (result.note) {
|
|
2423
|
-
sections.push(
|
|
2501
|
+
sections.push(
|
|
2502
|
+
["Note", renderMarkdownNote(result.note.content, color)].join("\n")
|
|
2503
|
+
);
|
|
2424
2504
|
}
|
|
2425
2505
|
return sections.join("\n\n");
|
|
2426
2506
|
}
|
|
@@ -2453,7 +2533,9 @@ function renderTaskTreeResponse(value, color) {
|
|
|
2453
2533
|
);
|
|
2454
2534
|
lines.push("");
|
|
2455
2535
|
}
|
|
2456
|
-
lines.push(
|
|
2536
|
+
lines.push(
|
|
2537
|
+
...renderTreeNode(value.tree, color)
|
|
2538
|
+
);
|
|
2457
2539
|
return lines.join("\n");
|
|
2458
2540
|
}
|
|
2459
2541
|
function renderTaskSummary(value, color) {
|
|
@@ -2598,7 +2680,9 @@ function renderDeleteMany(result, color) {
|
|
|
2598
2680
|
`Task IDs: ${result.taskIds.join(", ")}`
|
|
2599
2681
|
];
|
|
2600
2682
|
if (result.affectedDependentIds && result.affectedDependentIds.length > 0) {
|
|
2601
|
-
lines.push(
|
|
2683
|
+
lines.push(
|
|
2684
|
+
`Affected dependents: ${result.affectedDependentIds.join(", ")}`
|
|
2685
|
+
);
|
|
2602
2686
|
}
|
|
2603
2687
|
return lines.join("\n");
|
|
2604
2688
|
}
|
|
@@ -2639,10 +2723,10 @@ function renderCleanupPreview(result, color) {
|
|
|
2639
2723
|
),
|
|
2640
2724
|
"",
|
|
2641
2725
|
...result.tasks.map((task) => {
|
|
2642
|
-
const pathLine = task.destinationParentTitle && task.destinationParentTitle !== task.currentParentTitle ? ` ${dim(
|
|
2643
|
-
`${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")}`,
|
|
2644
2728
|
color
|
|
2645
|
-
)}` : task.currentParentTitle ? ` ${dim(task.currentParentTitle, color)}` : "";
|
|
2729
|
+
)}` : task.currentParentTitle ? ` ${dim(task.currentParentTitle, color)}` : task.currentParentId != null ? ` ${dim("Hidden parent", color)}` : "";
|
|
2646
2730
|
const actionLabel = task.actions.length > 0 ? task.actions.join(", ") : "no-op";
|
|
2647
2731
|
const changeLines = task.changes?.map(
|
|
2648
2732
|
(change) => ` ${dim(
|
|
@@ -2810,6 +2894,9 @@ function formatHumanOutput(value, options = {}) {
|
|
|
2810
2894
|
if (isBranchFocusSignalsLike(value)) {
|
|
2811
2895
|
return renderBranchFocusSignals(value, color);
|
|
2812
2896
|
}
|
|
2897
|
+
if (isTaskSearchGroups(value)) {
|
|
2898
|
+
return renderTaskSearchGroups(value, color);
|
|
2899
|
+
}
|
|
2813
2900
|
if (isTaskCollection(value)) {
|
|
2814
2901
|
return renderTaskList(value, color);
|
|
2815
2902
|
}
|
|
@@ -3042,7 +3129,7 @@ function resolveTaskRefFromSearchMatches(ref, matches) {
|
|
|
3042
3129
|
}
|
|
3043
3130
|
if (publicIdMatches.length > 1) {
|
|
3044
3131
|
const formattedMatches = publicIdMatches.map((task) => {
|
|
3045
|
-
const path4 = task.pathTitles
|
|
3132
|
+
const path4 = (task.pathTitles ? formatPathTitles(task.pathTitles) : void 0) ?? [task.parentTitle, task.title].filter(Boolean).join(" > ") ?? task.title;
|
|
3046
3133
|
return `- #${task.id} ${path4}`;
|
|
3047
3134
|
}).join("\n");
|
|
3048
3135
|
throw new Error(
|
|
@@ -3060,7 +3147,7 @@ ${formattedMatches}`
|
|
|
3060
3147
|
}
|
|
3061
3148
|
if (exactMatches.length > 1) {
|
|
3062
3149
|
const formattedMatches = exactMatches.map((task) => {
|
|
3063
|
-
const path4 = task.pathTitles
|
|
3150
|
+
const path4 = (task.pathTitles ? formatPathTitles(task.pathTitles) : void 0) ?? (task.parentTitle ? `${task.parentTitle} > ${task.title}` : task.title);
|
|
3064
3151
|
return `- #${task.id} ${path4}`;
|
|
3065
3152
|
}).join("\n");
|
|
3066
3153
|
throw new Error(`Task reference is ambiguous: ${ref}
|
|
@@ -3588,7 +3675,10 @@ function buildCli() {
|
|
|
3588
3675
|
);
|
|
3589
3676
|
}
|
|
3590
3677
|
);
|
|
3591
|
-
task.command("search").argument(
|
|
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(
|
|
3592
3682
|
"after",
|
|
3593
3683
|
[
|
|
3594
3684
|
"",
|
|
@@ -3597,16 +3687,73 @@ function buildCli() {
|
|
|
3597
3687
|
" pnpm cli task search dypt --parent Work",
|
|
3598
3688
|
" pnpm cli task search dypt --scope Work",
|
|
3599
3689
|
" pnpm cli task search dypt --limit 8",
|
|
3600
|
-
" 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."
|
|
3601
3694
|
].join("\n")
|
|
3602
3695
|
).action(
|
|
3603
|
-
async (
|
|
3696
|
+
async (queries, options) => {
|
|
3604
3697
|
assertExclusiveHierarchyOptions(options.parent, options.scope);
|
|
3605
3698
|
if (options.cursorScore && !options.cursorId || options.cursorId && !options.cursorScore) {
|
|
3606
3699
|
throw new Error(
|
|
3607
3700
|
"Both --cursor-score and --cursor-id are required together"
|
|
3608
3701
|
);
|
|
3609
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;
|
|
3610
3757
|
await runTaskSearch(
|
|
3611
3758
|
{
|
|
3612
3759
|
query,
|