@zinn-dev/cli 0.45.0 → 0.47.0
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 +1 -1
- package/package.json +3 -3
- package/skills/zinn/SKILL.md +2 -2
- package/src/actor.d.ts +1 -1
- package/src/actor.js +4 -1
- package/src/capabilities-schema.d.ts +78 -0
- package/src/capabilities-schema.js +44 -0
- package/src/capabilities.d.ts +2 -0
- package/src/capabilities.js +2 -0
- package/src/column-hint.js +2 -9
- package/src/errors.d.ts +5 -0
- package/src/errors.js +19 -5
- package/src/input.d.ts +30 -0
- package/src/input.js +18 -0
- package/src/lib.d.ts +75 -6
- package/src/lib.js +121 -33
- package/src/presentation/activity-presentation.d.ts +2 -1
- package/src/presentation/activity-presentation.js +23 -6
- package/src/presentation/color.d.ts +12 -0
- package/src/presentation/color.js +12 -0
- package/src/presentation/doctor-presentation.d.ts +7 -1
- package/src/presentation/doctor-presentation.js +6 -2
- package/src/presentation/project-presentation.d.ts +4 -1
- package/src/presentation/project-presentation.js +18 -0
- package/src/presentation/relation-presentation.js +8 -20
- package/src/presentation/section.d.ts +7 -4
- package/src/presentation/section.js +21 -7
- package/src/presentation/skill-status-presentation.d.ts +9 -0
- package/src/presentation/skill-status-presentation.js +43 -0
- package/src/presentation/task-blame-presentation.d.ts +3 -1
- package/src/presentation/task-blame-presentation.js +7 -5
- package/src/presentation/task-presentation.d.ts +28 -5
- package/src/presentation/task-presentation.js +120 -42
- package/src/result-schemas.d.ts +230 -14
- package/src/result-schemas.js +52 -0
- package/src/routes/activity-router.d.ts +5 -3
- package/src/routes/activity-router.js +44 -33
- package/src/routes/backup-router.d.ts +1 -0
- package/src/routes/backup-router.js +6 -12
- package/src/routes/capabilities-router.d.ts +1 -0
- package/src/routes/capabilities-router.js +3 -10
- package/src/routes/comment-router.d.ts +7 -6
- package/src/routes/comment-router.js +18 -66
- package/src/routes/doctor-router.d.ts +1 -0
- package/src/routes/doctor-router.js +35 -62
- package/src/routes/info-router.d.ts +1 -0
- package/src/routes/info-router.js +3 -10
- package/src/routes/label-router.d.ts +5 -0
- package/src/routes/label-router.js +11 -48
- package/src/routes/migrate-router.d.ts +1 -0
- package/src/routes/migrate-router.js +7 -16
- package/src/routes/project-router.d.ts +10 -0
- package/src/routes/project-router.js +42 -121
- package/src/routes/reindex-router.d.ts +1 -0
- package/src/routes/reindex-router.js +3 -10
- package/src/routes/relation-router.d.ts +13 -4
- package/src/routes/relation-router.js +15 -23
- package/src/routes/restore-router.d.ts +1 -0
- package/src/routes/restore-router.js +5 -15
- package/src/routes/router.js +33 -12
- package/src/routes/routes.d.ts +142 -32
- package/src/routes/skill-router.d.ts +53 -2
- package/src/routes/skill-router.js +103 -35
- package/src/routes/task-router.d.ts +61 -28
- package/src/routes/task-router.js +224 -263
- package/src/routes/whoami-router.d.ts +1 -0
- package/src/routes/whoami-router.js +3 -10
- package/src/skill-copies.d.ts +34 -0
- package/src/skill-copies.js +109 -0
- package/src/telemetry.d.ts +2 -2
- package/src/telemetry.js +11 -7
- package/src/types.d.ts +9 -1
- package/src/types.js +6 -0
- package/src/views.d.ts +117 -0
- package/src/views.js +54 -0
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { jsonResult, taskDetailResults, taskChangeResults } from "../results.js";
|
|
2
2
|
import { parseArgs } from "node:util";
|
|
3
|
-
import { activity, task, project, parseTaskKey, taskCreateSchema, taskEditSchema, taskDeleteManySchema, taskPrioritySchema, taskSortSchema, taskStateFilterSchema, CLAIM_WORK_LIMIT_MS, MIN_CLAIM_LEASE_MS, } from "@zinn-dev/core";
|
|
3
|
+
import { activity, task, project, readSnapshot, parseTaskKey, taskCreateSchema, taskEditSchema, taskDeleteManySchema, taskPrioritySchema, taskSortSchema, taskStateFilterSchema, CLAIM_WORK_LIMIT_MS, MIN_CLAIM_LEASE_MS, CoreError, } from "@zinn-dev/core";
|
|
4
4
|
import { listLimitOption, listLimitDescription, parseListLimit } from "../list-limit.js";
|
|
5
5
|
import { formatListContinuation } from "../list-continuation.js";
|
|
6
6
|
import { parseTimestampInput } from "../timestamp-input.js";
|
|
7
7
|
import { durationPattern, formatDurationInput, parseDurationInput } from "../duration-input.js";
|
|
8
8
|
import { CliError } from "../errors.js";
|
|
9
|
-
import { generateCommandUsage, taskKeyPositional, archiveConstraint, getOptionInputs, violatesConstraint, } from "../input.js";
|
|
10
|
-
import { confirmationDescription, confirmAction, dashValueHelp, diagnostic, output, outputChanges, quit,
|
|
9
|
+
import { generateCommandUsage, taskKeyPositional, archiveConstraint, getOptionInputs, parseArgsOptions, violatesConstraint, } from "../input.js";
|
|
10
|
+
import { confirmationDescription, confirmAction, dashValueHelp, diagnostic, getOutputMode, output, outputChanges, quit, parseCommandArgs, validateTaskKey, validateOrderForms, requireStringOption, } from "../lib.js";
|
|
11
11
|
import { resolveTextEdit, textEditHelp, textEditOptions, textEditConstraints, } from "../text-edit.js";
|
|
12
12
|
import { expectedValueFlags } from "../expected-values.js";
|
|
13
13
|
import { checkFieldsBeforeText, checkSingleStdinReader, resolveTextInput, textFileHelp, textFileOption, textSourceConstraint, } from "../text-input.js";
|
|
14
14
|
import { currentActor } from "../actor.js";
|
|
15
|
-
import { checkDefaultProject, chooseProjectKey,
|
|
15
|
+
import { checkDefaultProject, chooseProjectKey, projectScopeConstraint, requiredProjectDescription, projectScopeDescription, } from "../project.js";
|
|
16
16
|
import { relationRouter } from "./relation-router.js";
|
|
17
17
|
import { commentRouter } from "./comment-router.js";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { abbreviateActivityIds, formatActivityList, presentActivities, } from "../presentation/activity-presentation.js";
|
|
18
|
+
import { presentRelations } from "../presentation/relation-presentation.js";
|
|
19
|
+
import { presentComments } from "../presentation/comment-presentation.js";
|
|
20
|
+
import { abbreviateActivityIds, presentActivities } from "../presentation/activity-presentation.js";
|
|
22
21
|
import { formatTaskBlame } from "../presentation/task-blame-presentation.js";
|
|
22
|
+
import { readTerminalProps } from "../presentation/color.js";
|
|
23
23
|
import { createColumnBoard } from "../presentation/column-presentation.js";
|
|
24
|
-
import { formatTaskList,
|
|
24
|
+
import { formatTaskDetail, formatTaskList, getLabelColorsByName, presentTask, presentTaskSearchResults, presentTasks, } from "../presentation/task-presentation.js";
|
|
25
25
|
// A column is changed with task move, so a guessed --status or --column suggests it with the same task keys.
|
|
26
26
|
function suggestTaskMove(args, options = {}) {
|
|
27
27
|
const { values, positionals } = parseArgs({
|
|
@@ -32,7 +32,35 @@ function suggestTaskMove(args, options = {}) {
|
|
|
32
32
|
});
|
|
33
33
|
const guessedColumn = values.status ?? values.column;
|
|
34
34
|
const columnWords = typeof guessedColumn === "string" ? [guessedColumn] : [];
|
|
35
|
-
return
|
|
35
|
+
return {
|
|
36
|
+
args: ["task", "move", ...positionals, ...columnWords],
|
|
37
|
+
guidance: "Use task move with the destination column as a positional argument.",
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// Project view lists the archived count beside the columns, so "Archived" reads like a move target.
|
|
41
|
+
const archiveTargetNames = ["archive", "archived"];
|
|
42
|
+
const searchMatchesConstraint = {
|
|
43
|
+
kind: "requires",
|
|
44
|
+
input: "option:with-matches",
|
|
45
|
+
requires: "option:json",
|
|
46
|
+
};
|
|
47
|
+
const columnFilterHelp = "--column matches an exact name in the selected projects, ignoring case. An unknown name reports the available columns.";
|
|
48
|
+
/** Moves tasks, and points a move to a missing Archived column at task archive. */
|
|
49
|
+
function moveOrPointToArchive(taskKeys, targetColumn, fromColumn) {
|
|
50
|
+
try {
|
|
51
|
+
return task.moveMany({ taskKeys, targetColumn, fromColumn }, currentActor());
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
const isMissingArchivedTarget = error instanceof CoreError &&
|
|
55
|
+
error.kind === "missing" &&
|
|
56
|
+
error.facts.entity === "column" &&
|
|
57
|
+
error.facts.key === targetColumn &&
|
|
58
|
+
archiveTargetNames.includes(targetColumn.toLowerCase());
|
|
59
|
+
if (!isMissingArchivedTarget) {
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
throw new CliError(`${error.message}. Archive tasks with zinn task archive ${taskKeys.join(" ")}.`, "not_found", { entity: "column", key: targetColumn, source: "explicit" }, undefined, ["task", "archive"], error);
|
|
63
|
+
}
|
|
36
64
|
}
|
|
37
65
|
const priorityOption = {
|
|
38
66
|
type: "string",
|
|
@@ -107,11 +135,16 @@ const taskEditConstraint = {
|
|
|
107
135
|
"option:remove-label",
|
|
108
136
|
],
|
|
109
137
|
};
|
|
138
|
+
const taskDescriptionOption = {
|
|
139
|
+
type: "string",
|
|
140
|
+
value: { kind: "text", name: "text" },
|
|
141
|
+
aliases: ["body"],
|
|
142
|
+
};
|
|
110
143
|
const taskInputs = {
|
|
111
144
|
create: {
|
|
112
145
|
options: {
|
|
113
146
|
title: { type: "string", required: true, value: { kind: "text", name: "text" } },
|
|
114
|
-
description:
|
|
147
|
+
description: taskDescriptionOption,
|
|
115
148
|
"description-file": textFileOption,
|
|
116
149
|
priority: priorityOption,
|
|
117
150
|
due: dueOption,
|
|
@@ -182,6 +215,7 @@ const taskInputs = {
|
|
|
182
215
|
limit: listLimitOption,
|
|
183
216
|
label: { type: "string", multiple: true, value: { kind: "label-name", name: "name" } },
|
|
184
217
|
column: { type: "string", value: { kind: "column-name", name: "name" } },
|
|
218
|
+
"with-matches": { type: "boolean", description: "Include match excerpts in JSON results" },
|
|
185
219
|
},
|
|
186
220
|
forms: [
|
|
187
221
|
{
|
|
@@ -192,7 +226,7 @@ const taskInputs = {
|
|
|
192
226
|
],
|
|
193
227
|
},
|
|
194
228
|
],
|
|
195
|
-
constraints: [archiveConstraint, projectScopeConstraint],
|
|
229
|
+
constraints: [archiveConstraint, projectScopeConstraint, searchMatchesConstraint],
|
|
196
230
|
notes: [
|
|
197
231
|
projectScopeDescription,
|
|
198
232
|
"A query that is a task key ignores defaultProject unless a project was typed. --all-projects still excludes a typed project.",
|
|
@@ -230,7 +264,7 @@ const taskInputs = {
|
|
|
230
264
|
edit: {
|
|
231
265
|
options: {
|
|
232
266
|
title: { type: "string", value: { kind: "text", name: "text" } },
|
|
233
|
-
description:
|
|
267
|
+
description: taskDescriptionOption,
|
|
234
268
|
"description-file": textFileOption,
|
|
235
269
|
...textEditOptions,
|
|
236
270
|
priority: priorityOption,
|
|
@@ -369,32 +403,12 @@ const taskInputs = {
|
|
|
369
403
|
export const taskRouter = {
|
|
370
404
|
create: {
|
|
371
405
|
summary: "Create a task at the bottom of a column. Without --column, it starts in the project's first column.",
|
|
372
|
-
effects: { domain: "create", storage: "normal-open" },
|
|
406
|
+
effects: { domain: "create", storage: "normal-open", external: [] },
|
|
373
407
|
confirmation: { kind: "none" },
|
|
374
408
|
input: taskInputs.create,
|
|
375
409
|
results: [jsonResult("Task")],
|
|
376
|
-
guessedFlags: {
|
|
377
|
-
"--status": (args) => [
|
|
378
|
-
"task",
|
|
379
|
-
"create",
|
|
380
|
-
...renameFlag(args, taskInputs.create.options, "status", "column"),
|
|
381
|
-
],
|
|
382
|
-
"--body": (args) => [
|
|
383
|
-
"task",
|
|
384
|
-
"create",
|
|
385
|
-
...renameFlag(args, taskInputs.create.options, "body", "description"),
|
|
386
|
-
],
|
|
387
|
-
},
|
|
388
410
|
run: async (args) => {
|
|
389
|
-
const { values, positionals
|
|
390
|
-
args,
|
|
391
|
-
options: taskInputs.create.options,
|
|
392
|
-
allowPositionals: true,
|
|
393
|
-
strict: true,
|
|
394
|
-
tokens: true,
|
|
395
|
-
});
|
|
396
|
-
validateUniqueOptions(tokens, taskInputs.create.options);
|
|
397
|
-
validatePositionals(positionals, taskInputs.create.forms[0]);
|
|
411
|
+
const { values, positionals } = parseCommandArgs(args, taskInputs.create);
|
|
398
412
|
const projectChoice = chooseProjectKey(positionals[0], { required: true });
|
|
399
413
|
const title = requireStringOption(taskInputs.create.options.title, values.title, "title", "A task needs at least a title: use --title");
|
|
400
414
|
const priority = parsePriority(values.priority);
|
|
@@ -444,24 +458,19 @@ Examples:
|
|
|
444
458
|
},
|
|
445
459
|
list: {
|
|
446
460
|
summary: "List active tasks by default.",
|
|
447
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
461
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
448
462
|
confirmation: { kind: "none" },
|
|
449
463
|
input: taskInputs.list,
|
|
450
464
|
results: [jsonResult("TaskList")],
|
|
451
465
|
run: (args) => {
|
|
452
|
-
const { values, positionals, tokens } =
|
|
453
|
-
args,
|
|
454
|
-
options: taskInputs.list.options,
|
|
455
|
-
allowPositionals: true,
|
|
456
|
-
strict: true,
|
|
457
|
-
tokens: true,
|
|
458
|
-
});
|
|
459
|
-
validateUniqueOptions(tokens, taskInputs.list.options);
|
|
460
|
-
validatePositionals(positionals, taskInputs.list.forms[0]);
|
|
466
|
+
const { values, positionals, tokens } = parseCommandArgs(args, taskInputs.list);
|
|
461
467
|
if (violatesConstraint(archiveConstraint, getOptionInputs(values))) {
|
|
462
468
|
quit('Use either "--archived" or "--all", not both', undefined, { argument: "--archived" });
|
|
463
469
|
}
|
|
464
|
-
const
|
|
470
|
+
const projectChoice = chooseProjectKey(positionals[0], {
|
|
471
|
+
allProjects: values["all-projects"],
|
|
472
|
+
});
|
|
473
|
+
const projectKey = projectChoice?.key;
|
|
465
474
|
const archive = values.all ? "all" : values.archived ? "archived" : "active";
|
|
466
475
|
const limit = parseListLimit(values.limit);
|
|
467
476
|
const sort = taskSortSchema.optional().safeParse(values.sort);
|
|
@@ -474,23 +483,33 @@ Examples:
|
|
|
474
483
|
if (!state.success) {
|
|
475
484
|
quit(`Unknown state "${values.state}". Use ${taskStateFilterSchema.options.join(", ")}`, undefined, { argument: "--state" });
|
|
476
485
|
}
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
486
|
+
const deadlineFilters = parseDeadlineFilters(values);
|
|
487
|
+
const { presentedTasks, nextCursor, labelColorsByName } = readSnapshot(() => {
|
|
488
|
+
if (projectChoice !== undefined) {
|
|
489
|
+
checkDefaultProject(projectChoice);
|
|
490
|
+
}
|
|
491
|
+
const page = task.getPage({
|
|
492
|
+
...deadlineFilters,
|
|
493
|
+
limit,
|
|
494
|
+
sort: sort.data,
|
|
495
|
+
projectKey,
|
|
496
|
+
archive,
|
|
497
|
+
state: state.data,
|
|
498
|
+
labelNames: values.label,
|
|
499
|
+
columnName: values.column,
|
|
500
|
+
startingAfter: values["starting-after"],
|
|
501
|
+
});
|
|
502
|
+
return {
|
|
503
|
+
presentedTasks: presentTasks(page.tasks),
|
|
504
|
+
nextCursor: page.nextCursor,
|
|
505
|
+
labelColorsByName: getOutputMode() === "text" ? getLabelColorsByName() : undefined,
|
|
506
|
+
};
|
|
487
507
|
});
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
if (page.nextCursor !== undefined) {
|
|
508
|
+
output(presentedTasks, (entries) => formatTaskList(entries, { showsStatus: values.all, labelColorsByName }));
|
|
509
|
+
if (nextCursor !== undefined) {
|
|
491
510
|
const selectionTokens = tokens.filter((token) => token.kind !== "option" || token.name !== "all-projects");
|
|
492
511
|
const projectScope = projectKey === undefined ? ["--all-projects"] : [projectKey];
|
|
493
|
-
diagnostic(`More tasks. Continue with: ${formatListContinuation(["task", "list"], projectScope, selectionTokens, "starting-after",
|
|
512
|
+
diagnostic(`More tasks. Continue with: ${formatListContinuation(["task", "list"], projectScope, selectionTokens, "starting-after", nextCursor)}`);
|
|
494
513
|
}
|
|
495
514
|
},
|
|
496
515
|
help: `${generateCommandUsage("task list", taskInputs.list)}
|
|
@@ -499,8 +518,8 @@ List active tasks by default.
|
|
|
499
518
|
${projectScopeDescription}
|
|
500
519
|
--state open lists tasks outside done and cancelled columns, and --state closed lists tasks in them.
|
|
501
520
|
Use --archived to list archived tasks or --all to list both.
|
|
502
|
-
Repeat --label to require every specified label.
|
|
503
|
-
|
|
521
|
+
Repeat --label to require every specified label, ignoring case.
|
|
522
|
+
${columnFilterHelp}
|
|
504
523
|
All supplied filters must match.
|
|
505
524
|
--sort activity lists the most recently active tasks first, including comments and relations.
|
|
506
525
|
Equal activity times keep board order. Without --sort, board order is preserved.
|
|
@@ -516,86 +535,104 @@ Use 'task view' to see a task's full details, including its description and an e
|
|
|
516
535
|
Example: zinn task list MDR --label cli`,
|
|
517
536
|
},
|
|
518
537
|
search: {
|
|
519
|
-
summary: "Search task titles, descriptions, and comments
|
|
520
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
538
|
+
summary: "Search task titles, descriptions, and comments with excerpts from matching sources.",
|
|
539
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
521
540
|
confirmation: { kind: "none" },
|
|
522
541
|
input: taskInputs.search,
|
|
523
|
-
results: [
|
|
542
|
+
results: [
|
|
543
|
+
jsonResult("TaskList", { kind: "booleanOption", name: "with-matches", value: false }),
|
|
544
|
+
jsonResult("TaskSearchResults", { kind: "booleanOption", name: "with-matches", value: true }),
|
|
545
|
+
],
|
|
524
546
|
run: (args) => {
|
|
525
|
-
const { values, positionals
|
|
526
|
-
args,
|
|
527
|
-
options: taskInputs.search.options,
|
|
528
|
-
allowPositionals: true,
|
|
529
|
-
strict: true,
|
|
530
|
-
tokens: true,
|
|
531
|
-
});
|
|
532
|
-
validateUniqueOptions(tokens, taskInputs.search.options);
|
|
533
|
-
validatePositionals(positionals, taskInputs.search.forms[0]);
|
|
547
|
+
const { values, positionals } = parseCommandArgs(args, taskInputs.search);
|
|
534
548
|
const query = positionals[0];
|
|
535
549
|
if (violatesConstraint(archiveConstraint, getOptionInputs(values))) {
|
|
536
550
|
quit('Use either "--archived" or "--all", not both', undefined, { argument: "--archived" });
|
|
537
551
|
}
|
|
552
|
+
const isText = getOutputMode() === "text";
|
|
553
|
+
if (violatesConstraint(searchMatchesConstraint, {
|
|
554
|
+
...getOptionInputs(values),
|
|
555
|
+
"option:json": !isText,
|
|
556
|
+
})) {
|
|
557
|
+
quit("Add --json to use --with-matches.", undefined, { argument: "--with-matches" });
|
|
558
|
+
}
|
|
538
559
|
const archive = values.all ? "all" : values.archived ? "archived" : "active";
|
|
539
560
|
const isTaskKeyQuery = parseTaskKey(query.trim()) !== null;
|
|
540
|
-
const
|
|
561
|
+
const projectChoice = chooseProjectKey(positionals[1], {
|
|
541
562
|
allProjects: values["all-projects"],
|
|
542
563
|
useDefault: !isTaskKeyQuery,
|
|
543
564
|
});
|
|
544
565
|
const limit = parseListLimit(values.limit);
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
566
|
+
const deadlineFilters = parseDeadlineFilters(values);
|
|
567
|
+
const { presentedTasks, hiddenArchivedCount, labelColorsByName } = readSnapshot(() => {
|
|
568
|
+
if (projectChoice !== undefined) {
|
|
569
|
+
checkDefaultProject(projectChoice);
|
|
570
|
+
}
|
|
571
|
+
const result = task.search({
|
|
572
|
+
...deadlineFilters,
|
|
573
|
+
query,
|
|
574
|
+
projectKey: projectChoice?.key,
|
|
575
|
+
archive,
|
|
576
|
+
limit,
|
|
577
|
+
labelNames: values.label,
|
|
578
|
+
columnName: values.column,
|
|
579
|
+
includeMatches: isText || values["with-matches"] === true,
|
|
580
|
+
});
|
|
581
|
+
return {
|
|
582
|
+
presentedTasks: presentTaskSearchResults(result.tasks, result.matchesByTaskId),
|
|
583
|
+
hiddenArchivedCount: result.hiddenArchivedCount,
|
|
584
|
+
labelColorsByName: isText ? getLabelColorsByName() : undefined,
|
|
585
|
+
};
|
|
553
586
|
});
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
const count = result.hiddenArchivedCount;
|
|
587
|
+
output(presentedTasks, (entries) => formatTaskList(entries, { showsStatus: values.all, labelColorsByName }));
|
|
588
|
+
if (hiddenArchivedCount > 0) {
|
|
589
|
+
const count = hiddenArchivedCount;
|
|
558
590
|
const noun = count === 1 ? "match" : "matches";
|
|
559
591
|
diagnostic(`${count} archived ${noun} hidden, use --all to include them`);
|
|
560
592
|
}
|
|
561
593
|
},
|
|
562
594
|
help: `${generateCommandUsage("task search", taskInputs.search)}
|
|
563
595
|
|
|
564
|
-
Search task titles, descriptions, and comments.
|
|
596
|
+
Search task titles, descriptions, and comments. Comment excerpts include the comment key for 'task comment view'.
|
|
565
597
|
${projectScopeDescription}
|
|
566
598
|
Each word matches the start of a word, ignoring case and accents: e.g. "auth" finds "Authentication".
|
|
567
599
|
Every word must match. Quote a query with several words.
|
|
600
|
+
U+E000 is reserved for separating comments in the search index.
|
|
568
601
|
|
|
569
602
|
A task-key query overrides the configured default project; a typed project key still filters it.
|
|
570
603
|
|
|
571
604
|
By default, only active tasks are searched. Use --archived to search archived tasks or --all to search both.
|
|
572
605
|
--limit <n>: ${listLimitDescription}
|
|
573
606
|
Repeat --label to require every specified label, ignoring case.
|
|
574
|
-
|
|
607
|
+
${columnFilterHelp}
|
|
575
608
|
${deadlineFilterHelp}
|
|
576
609
|
|
|
610
|
+
Use --json --with-matches to include excerpts and highlight ranges. --limit counts tasks.
|
|
611
|
+
|
|
577
612
|
Example: zinn task search 'refinement quota' MDR --limit 5`,
|
|
578
613
|
},
|
|
579
614
|
next: {
|
|
580
615
|
summary: "Show the next task that is ready to work on.",
|
|
581
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
616
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
582
617
|
confirmation: { kind: "none" },
|
|
583
618
|
input: taskInputs.next,
|
|
584
619
|
results: [jsonResult("NextTask")],
|
|
585
620
|
run: (args) => {
|
|
586
|
-
const { values, positionals
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
allowPositionals: true,
|
|
590
|
-
strict: true,
|
|
591
|
-
tokens: true,
|
|
621
|
+
const { values, positionals } = parseCommandArgs(args, taskInputs.next);
|
|
622
|
+
const projectChoice = chooseProjectKey(positionals[0], {
|
|
623
|
+
allProjects: values["all-projects"],
|
|
592
624
|
});
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
625
|
+
const { presentedTask, labelColorsByName } = readSnapshot(() => {
|
|
626
|
+
if (projectChoice !== undefined) {
|
|
627
|
+
checkDefaultProject(projectChoice);
|
|
628
|
+
}
|
|
629
|
+
const nextTask = task.next({ projectKey: projectChoice?.key, columnName: values.column });
|
|
630
|
+
return {
|
|
631
|
+
presentedTask: nextTask === null ? null : presentTask(nextTask),
|
|
632
|
+
labelColorsByName: nextTask !== null && getOutputMode() === "text" ? getLabelColorsByName() : undefined,
|
|
633
|
+
};
|
|
634
|
+
});
|
|
635
|
+
output(presentedTask, (entry) => entry === null ? "No task is ready." : formatTaskList([entry], { labelColorsByName }));
|
|
599
636
|
},
|
|
600
637
|
help: `${generateCommandUsage("task next", taskInputs.next)}
|
|
601
638
|
|
|
@@ -605,7 +642,8 @@ Only dependency relations hold a task back. A task with a live claim is skipped,
|
|
|
605
642
|
Ready tasks in todo columns come before those in backlog columns, whatever their priority.
|
|
606
643
|
Within each, tasks are ordered by priority (urgent first, unset last), then the earliest deadline with undated tasks last, then the oldest task.
|
|
607
644
|
${projectScopeDescription}
|
|
608
|
-
|
|
645
|
+
${columnFilterHelp}
|
|
646
|
+
With --column, tasks in any matching column can qualify unless it is done or cancelled.
|
|
609
647
|
When no task is ready, the command exits 0. With --json, it prints null.
|
|
610
648
|
To take the task, move it with task move --from, which fails if another caller moved it first. Then show that you are working on it with task claim.
|
|
611
649
|
task next <project> --column <working column> returns in-progress work with no live claim.
|
|
@@ -619,70 +657,45 @@ Examples:
|
|
|
619
657
|
},
|
|
620
658
|
view: {
|
|
621
659
|
summary: "Show a task with its description, relations, comments, and creation and update times.",
|
|
622
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
660
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
623
661
|
confirmation: { kind: "none" },
|
|
624
662
|
input: taskInputs.view,
|
|
625
663
|
results: taskDetailResults,
|
|
626
664
|
run: (args) => {
|
|
627
|
-
const { values, positionals
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
const board = createColumnBoard();
|
|
638
|
-
const detail = {
|
|
639
|
-
...presentTask(taskMatch, board),
|
|
640
|
-
relations: presentRelations(taskMatch, board),
|
|
641
|
-
comments: presentComments(taskMatch.key),
|
|
642
|
-
};
|
|
643
|
-
const viewedTask = values.history === true
|
|
644
|
-
? {
|
|
645
|
-
...detail,
|
|
646
|
-
activity: task
|
|
647
|
-
.activity(taskMatch.key)
|
|
648
|
-
.sort((left, right) => right.created_at - left.created_at || right.id.localeCompare(left.id)),
|
|
649
|
-
}
|
|
650
|
-
: { ...detail };
|
|
651
|
-
output(viewedTask, (t) => {
|
|
652
|
-
const MIN_SECTION_SEPARATOR_WIDTH = 60;
|
|
653
|
-
const terminalWidth = process.stdout.columns;
|
|
654
|
-
const hasTerminalWidth = process.stdout.isTTY === true && terminalWidth > 0;
|
|
655
|
-
const sectionOptions = {
|
|
656
|
-
separatorWidth: hasTerminalWidth ? terminalWidth : MIN_SECTION_SEPARATOR_WIDTH,
|
|
665
|
+
const { values, positionals } = parseCommandArgs(args, taskInputs.view);
|
|
666
|
+
const taskKey = positionals[0];
|
|
667
|
+
validateTaskKey(taskKey);
|
|
668
|
+
const { viewedTask, history, labelColorsByName } = readSnapshot(() => {
|
|
669
|
+
const taskMatch = task.getByKey(taskKey);
|
|
670
|
+
const board = createColumnBoard();
|
|
671
|
+
const detail = {
|
|
672
|
+
...presentTask(taskMatch, board),
|
|
673
|
+
relations: presentRelations(taskMatch, board),
|
|
674
|
+
comments: presentComments(taskMatch.key),
|
|
657
675
|
};
|
|
658
|
-
const
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
if (t.description != null) {
|
|
669
|
-
sections.push(formatSection("Description", t.description, sectionOptions));
|
|
670
|
-
}
|
|
671
|
-
if (relations.length > 0) {
|
|
672
|
-
sections.push(formatSection("Relations", relations, sectionOptions));
|
|
673
|
-
}
|
|
674
|
-
if (comments.length > 0) {
|
|
675
|
-
sections.push(formatSection("Comments", comments, sectionOptions));
|
|
676
|
-
}
|
|
677
|
-
if ("activity" in t) {
|
|
678
|
-
const history = formatActivityList(presentActivities(t.activity, { keysFromEventsOnly: true }));
|
|
679
|
-
if (history.length > 0) {
|
|
680
|
-
sections.push(formatSection("History", history, sectionOptions));
|
|
676
|
+
const events = values.history === true
|
|
677
|
+
? task
|
|
678
|
+
.activity(taskMatch.key)
|
|
679
|
+
.sort((left, right) => right.created_at - left.created_at || right.id.localeCompare(left.id))
|
|
680
|
+
: [];
|
|
681
|
+
const isText = getOutputMode() === "text";
|
|
682
|
+
const viewedTask = values.history === true && !isText
|
|
683
|
+
? {
|
|
684
|
+
...detail,
|
|
685
|
+
activity: activity.attachTaskKeys(events),
|
|
681
686
|
}
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
687
|
+
: detail;
|
|
688
|
+
return {
|
|
689
|
+
viewedTask,
|
|
690
|
+
history: isText ? presentActivities(events, { keysFromEventsOnly: true }) : [],
|
|
691
|
+
labelColorsByName: isText ? getLabelColorsByName() : undefined,
|
|
692
|
+
};
|
|
685
693
|
});
|
|
694
|
+
output(viewedTask, (t) => formatTaskDetail(t, {
|
|
695
|
+
history,
|
|
696
|
+
labelColorsByName,
|
|
697
|
+
...readTerminalProps(),
|
|
698
|
+
}));
|
|
686
699
|
},
|
|
687
700
|
help: `${generateCommandUsage("task view", taskInputs.view)}
|
|
688
701
|
|
|
@@ -702,28 +715,31 @@ Examples:
|
|
|
702
715
|
},
|
|
703
716
|
blame: {
|
|
704
717
|
summary: "Show the recorded authors of a task's current fields and description lines.",
|
|
705
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
718
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
706
719
|
confirmation: { kind: "none" },
|
|
707
720
|
input: taskInputs.blame,
|
|
708
721
|
results: [jsonResult("TaskBlame")],
|
|
709
722
|
run: (args) => {
|
|
710
|
-
const { positionals } =
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
validatePositionals(positionals, taskInputs.blame.forms[0]);
|
|
717
|
-
output(task.blame(positionals[0]), (blame) => {
|
|
723
|
+
const { positionals } = parseCommandArgs(args, taskInputs.blame);
|
|
724
|
+
const { blame, textOptions } = readSnapshot(() => {
|
|
725
|
+
const blame = task.blame(positionals[0]);
|
|
726
|
+
if (getOutputMode() === "json") {
|
|
727
|
+
return { blame };
|
|
728
|
+
}
|
|
718
729
|
const taskMatch = task.getByKey(blame.task.key);
|
|
719
730
|
const board = createColumnBoard();
|
|
720
|
-
return
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
731
|
+
return {
|
|
732
|
+
blame,
|
|
733
|
+
textOptions: {
|
|
734
|
+
relations: presentRelations(taskMatch, board),
|
|
735
|
+
columnCategory: board(taskMatch.project_id).find((boardColumn) => boardColumn.id === taskMatch.column_id)?.category ?? null,
|
|
736
|
+
isArchived: taskMatch.archived_at != null,
|
|
737
|
+
labelColorsByName: blame.fields.labels.value.length === 0 ? new Map() : getLabelColorsByName(),
|
|
738
|
+
activityIdPrefixes: abbreviateActivityIds(activity.getIds()),
|
|
739
|
+
},
|
|
740
|
+
};
|
|
726
741
|
});
|
|
742
|
+
output(blame, (entry) => formatTaskBlame(entry, { ...textOptions, ...readTerminalProps() }));
|
|
727
743
|
},
|
|
728
744
|
help: `${generateCommandUsage("task blame", taskInputs.blame)}
|
|
729
745
|
|
|
@@ -739,20 +755,12 @@ Example: zinn task blame MDR-1`,
|
|
|
739
755
|
},
|
|
740
756
|
edit: {
|
|
741
757
|
summary: "Edit a task's title, description, priority, deadline, or label attachments.",
|
|
742
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
758
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
743
759
|
confirmation: { kind: "none" },
|
|
744
760
|
input: taskInputs.edit,
|
|
745
761
|
results: [jsonResult("TaskChange")],
|
|
746
762
|
run: async (args) => {
|
|
747
|
-
const { values, positionals
|
|
748
|
-
args,
|
|
749
|
-
options: taskInputs.edit.options,
|
|
750
|
-
allowPositionals: true,
|
|
751
|
-
strict: true,
|
|
752
|
-
tokens: true,
|
|
753
|
-
});
|
|
754
|
-
validateUniqueOptions(tokens, taskInputs.edit.options);
|
|
755
|
-
validatePositionals(positionals, taskInputs.edit.forms[0]);
|
|
763
|
+
const { values, positionals } = parseCommandArgs(args, taskInputs.edit);
|
|
756
764
|
const taskKey = positionals[0];
|
|
757
765
|
const fields = {
|
|
758
766
|
taskKey,
|
|
@@ -800,34 +808,21 @@ Examples:
|
|
|
800
808
|
zinn task edit MDR-1 --description 'Bring waffles.' --append
|
|
801
809
|
zinn task edit MDR-1 --title 'Refine the Cold Harbor file' --expect-title 'Refine the files'`,
|
|
802
810
|
guessedFlags: {
|
|
803
|
-
"--status": (args) => suggestTaskMove(args, taskInputs.edit.options),
|
|
804
|
-
"--column": (args) => suggestTaskMove(args, taskInputs.edit.options),
|
|
805
|
-
"--body": (args) => [
|
|
806
|
-
"task",
|
|
807
|
-
"edit",
|
|
808
|
-
...renameFlag(args, taskInputs.edit.options, "body", "description"),
|
|
809
|
-
],
|
|
811
|
+
"--status": (args) => suggestTaskMove(args, parseArgsOptions(taskInputs.edit.options)),
|
|
812
|
+
"--column": (args) => suggestTaskMove(args, parseArgsOptions(taskInputs.edit.options)),
|
|
810
813
|
},
|
|
811
814
|
},
|
|
812
815
|
move: {
|
|
813
816
|
summary: "Move tasks to another column in their projects.",
|
|
814
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
817
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
815
818
|
confirmation: { kind: "none" },
|
|
816
819
|
input: taskInputs.move,
|
|
817
820
|
results: taskChangeResults,
|
|
818
821
|
run: (args) => {
|
|
819
|
-
const { values, positionals
|
|
820
|
-
options: taskInputs.move.options,
|
|
821
|
-
args,
|
|
822
|
-
allowPositionals: true,
|
|
823
|
-
strict: true,
|
|
824
|
-
tokens: true,
|
|
825
|
-
});
|
|
826
|
-
validateUniqueOptions(tokens, taskInputs.move.options);
|
|
827
|
-
validatePositionals(positionals, taskInputs.move.forms[0]);
|
|
822
|
+
const { values, positionals } = parseCommandArgs(args, taskInputs.move);
|
|
828
823
|
const taskKeys = positionals.slice(0, -1);
|
|
829
824
|
const targetColumn = positionals.at(-1);
|
|
830
|
-
const moves =
|
|
825
|
+
const moves = moveOrPointToArchive(taskKeys, targetColumn, values.from);
|
|
831
826
|
const board = createColumnBoard();
|
|
832
827
|
outputChanges(moves, (change) => presentTask(change.task, board), formatTaskList, (movedTask) => `${movedTask.key} was already in the ${movedTask.column} column`);
|
|
833
828
|
},
|
|
@@ -849,17 +844,12 @@ Examples:
|
|
|
849
844
|
},
|
|
850
845
|
order: {
|
|
851
846
|
summary: "Change task positions within their current column.",
|
|
852
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
847
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
853
848
|
confirmation: { kind: "none" },
|
|
854
849
|
input: taskInputs.order,
|
|
855
850
|
results: taskChangeResults,
|
|
856
851
|
run: (args) => {
|
|
857
|
-
const { positionals } =
|
|
858
|
-
options: taskInputs.order.options,
|
|
859
|
-
args,
|
|
860
|
-
allowPositionals: true,
|
|
861
|
-
strict: true,
|
|
862
|
-
});
|
|
852
|
+
const { positionals } = parseCommandArgs(args, taskInputs.order);
|
|
863
853
|
const form = validateOrderForms(positionals, taskInputs.order.forms);
|
|
864
854
|
const taskKeys = positionals.slice(0, form.directionIndex);
|
|
865
855
|
let orders;
|
|
@@ -890,7 +880,7 @@ Example: zinn task order MDR-2 before MDR-1`,
|
|
|
890
880
|
},
|
|
891
881
|
archive: {
|
|
892
882
|
summary: "Archive tasks so they no longer appear in active task lists.",
|
|
893
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
883
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
894
884
|
confirmation: { kind: "none" },
|
|
895
885
|
input: taskInputs.archive,
|
|
896
886
|
results: taskChangeResults,
|
|
@@ -913,7 +903,7 @@ Example: zinn task archive MDR-1 MDR-2`,
|
|
|
913
903
|
},
|
|
914
904
|
unarchive: {
|
|
915
905
|
summary: "Unarchive tasks at the bottom of their previous columns, in the order given.",
|
|
916
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
906
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
917
907
|
confirmation: { kind: "none" },
|
|
918
908
|
input: taskInputs.archive,
|
|
919
909
|
results: taskChangeResults,
|
|
@@ -936,20 +926,12 @@ Example: zinn task unarchive MDR-1 MDR-2`,
|
|
|
936
926
|
},
|
|
937
927
|
claim: {
|
|
938
928
|
summary: "Claim a task for a lease, so other agents and people can see who works on it.",
|
|
939
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
929
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
940
930
|
confirmation: { kind: "none" },
|
|
941
931
|
input: taskInputs.claim,
|
|
942
932
|
results: [jsonResult("TaskChange")],
|
|
943
933
|
run: (args) => {
|
|
944
|
-
const { values, positionals
|
|
945
|
-
args,
|
|
946
|
-
options: taskInputs.claim.options,
|
|
947
|
-
allowPositionals: true,
|
|
948
|
-
strict: true,
|
|
949
|
-
tokens: true,
|
|
950
|
-
});
|
|
951
|
-
validateUniqueOptions(tokens, taskInputs.claim.options);
|
|
952
|
-
validatePositionals(positionals, taskInputs.claim.forms[0]);
|
|
934
|
+
const { values, positionals } = parseCommandArgs(args, taskInputs.claim);
|
|
953
935
|
const lease = requireStringOption(taskInputs.claim.options.lease, values.lease, "lease", "A claim needs a lease: use --lease, such as --lease 30m");
|
|
954
936
|
const leaseMs = parseDurationInput(lease, "--lease");
|
|
955
937
|
const isLeaseInRange = leaseMs >= MIN_CLAIM_LEASE_MS && leaseMs <= CLAIM_WORK_LIMIT_MS;
|
|
@@ -970,8 +952,8 @@ Claim a task for a lease, so other agents and people can see who works on it.
|
|
|
970
952
|
Any change the holder makes to the task, including a comment, renews the claim. So does task heartbeat.
|
|
971
953
|
A claim expires when its lease runs out, or ${formatDurationInput(CLAIM_WORK_LIMIT_MS)} after the holder last changed the task.
|
|
972
954
|
After that limit, only a change to the task renews it.
|
|
973
|
-
Claiming a task you hold renews
|
|
974
|
-
|
|
955
|
+
Claiming a task you hold renews your live claim or resumes your expired claim with the new lease.
|
|
956
|
+
Claiming someone else's expired claim replaces it. A live claim by someone else is a conflict, unless --force takes it over.
|
|
975
957
|
Agents are told apart by their session or thread, so an agent needs one its host sets, or ZINN_SESSION_ID.
|
|
976
958
|
Archived tasks cannot be claimed. Archiving a task or moving it to a done or cancelled column releases its claim.
|
|
977
959
|
|
|
@@ -981,7 +963,7 @@ Examples:
|
|
|
981
963
|
},
|
|
982
964
|
heartbeat: {
|
|
983
965
|
summary: "Renew your claim on a task with its current lease.",
|
|
984
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
966
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
985
967
|
confirmation: { kind: "none" },
|
|
986
968
|
input: taskInputs.heartbeat,
|
|
987
969
|
results: [jsonResult("TaskChange")],
|
|
@@ -994,12 +976,13 @@ Examples:
|
|
|
994
976
|
Renew your claim on a task with its current lease.
|
|
995
977
|
It fails when the task has no claim or someone else holds it.
|
|
996
978
|
It also fails ${formatDurationInput(CLAIM_WORK_LIMIT_MS)} after you last changed the task. After that, only a change to the task renews the claim.
|
|
979
|
+
A heartbeat resumes your expired claim unless someone else has claimed the task since.
|
|
997
980
|
|
|
998
981
|
Example: zinn task heartbeat MDR-1`,
|
|
999
982
|
},
|
|
1000
983
|
release: {
|
|
1001
984
|
summary: "Release your claim on a task.",
|
|
1002
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
985
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
1003
986
|
confirmation: { kind: "none" },
|
|
1004
987
|
input: taskInputs.heartbeat,
|
|
1005
988
|
results: [jsonResult("TaskChange")],
|
|
@@ -1009,15 +992,16 @@ Example: zinn task heartbeat MDR-1`,
|
|
|
1009
992
|
},
|
|
1010
993
|
help: `${generateCommandUsage("task release", taskInputs.heartbeat)}
|
|
1011
994
|
|
|
1012
|
-
Release your claim on a task.
|
|
1013
|
-
|
|
995
|
+
Release your claim on a task, even after it expires.
|
|
996
|
+
Someone else's claim is a conflict, even after it expires. Use task claim to replace an expired claim held by someone else.
|
|
997
|
+
Releasing a task without a claim does not do anything.
|
|
1014
998
|
With --json, changed is false when the task had no claim.
|
|
1015
999
|
|
|
1016
1000
|
Example: zinn task release MDR-1`,
|
|
1017
1001
|
},
|
|
1018
1002
|
delete: {
|
|
1019
1003
|
summary: "Permanently delete tasks after confirmation.",
|
|
1020
|
-
effects: { domain: "delete", storage: "normal-open" },
|
|
1004
|
+
effects: { domain: "delete", storage: "normal-open", external: [] },
|
|
1021
1005
|
confirmation: { kind: "prompt", description: confirmationDescription },
|
|
1022
1006
|
input: taskInputs.delete,
|
|
1023
1007
|
results: [
|
|
@@ -1025,19 +1009,11 @@ Example: zinn task release MDR-1`,
|
|
|
1025
1009
|
jsonResult("TaskList", { kind: "positionalCount", name: "task-key", min: 2, max: null }),
|
|
1026
1010
|
],
|
|
1027
1011
|
run: async (args) => {
|
|
1028
|
-
const { values, positionals
|
|
1029
|
-
args,
|
|
1030
|
-
options: taskInputs.delete.options,
|
|
1031
|
-
allowPositionals: true,
|
|
1032
|
-
strict: true,
|
|
1033
|
-
tokens: true,
|
|
1034
|
-
});
|
|
1035
|
-
validateUniqueOptions(tokens, taskInputs.delete.options);
|
|
1036
|
-
validatePositionals(positionals, taskInputs.delete.forms[0]);
|
|
1012
|
+
const { values, positionals } = parseCommandArgs(args, taskInputs.delete);
|
|
1037
1013
|
const taskKeys = taskDeleteManySchema.parse(positionals);
|
|
1038
1014
|
const taskMatches = taskKeys.map((taskKey) => task.getByKey(taskKey));
|
|
1039
1015
|
const board = createColumnBoard();
|
|
1040
|
-
const presented = taskMatches
|
|
1016
|
+
const presented = presentTasks(taskMatches, board);
|
|
1041
1017
|
const canDelete = await confirmAction(`Are you sure you want to delete ${taskMatches.map((match) => match.key).join(", ")}?`, values.yes === true);
|
|
1042
1018
|
if (canDelete) {
|
|
1043
1019
|
task.deleteMany(taskKeys, currentActor());
|
|
@@ -1061,7 +1037,7 @@ Example: zinn task delete MDR-1 MDR-2`,
|
|
|
1061
1037
|
label: {
|
|
1062
1038
|
add: {
|
|
1063
1039
|
summary: "Add existing labels to a task. Label names are matched case-insensitively.",
|
|
1064
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
1040
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
1065
1041
|
confirmation: { kind: "none" },
|
|
1066
1042
|
input: taskInputs.label_add,
|
|
1067
1043
|
results: [jsonResult("TaskChange")],
|
|
@@ -1078,7 +1054,7 @@ With --json, changed is false when all the labels were already attached.`,
|
|
|
1078
1054
|
},
|
|
1079
1055
|
remove: {
|
|
1080
1056
|
summary: "Remove existing labels from a task. Label names are matched case-insensitively.",
|
|
1081
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
1057
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
1082
1058
|
confirmation: { kind: "none" },
|
|
1083
1059
|
input: taskInputs.label_add,
|
|
1084
1060
|
results: [jsonResult("TaskChange")],
|
|
@@ -1096,38 +1072,23 @@ With --json, changed is false when none of the labels were attached.`,
|
|
|
1096
1072
|
},
|
|
1097
1073
|
};
|
|
1098
1074
|
function parseTaskKeys(args) {
|
|
1099
|
-
const { positionals } =
|
|
1100
|
-
options: taskInputs.archive.options,
|
|
1101
|
-
args,
|
|
1102
|
-
allowPositionals: true,
|
|
1103
|
-
strict: true,
|
|
1104
|
-
});
|
|
1105
|
-
validatePositionals(positionals, taskInputs.archive.forms[0]);
|
|
1075
|
+
const { positionals } = parseCommandArgs(args, taskInputs.archive);
|
|
1106
1076
|
return positionals;
|
|
1107
1077
|
}
|
|
1108
1078
|
function parseClaimedTaskKey(args) {
|
|
1109
|
-
const { positionals } =
|
|
1110
|
-
options: taskInputs.heartbeat.options,
|
|
1111
|
-
args,
|
|
1112
|
-
allowPositionals: true,
|
|
1113
|
-
strict: true,
|
|
1114
|
-
});
|
|
1115
|
-
validatePositionals(positionals, taskInputs.heartbeat.forms[0]);
|
|
1079
|
+
const { positionals } = parseCommandArgs(args, taskInputs.heartbeat);
|
|
1116
1080
|
return positionals[0];
|
|
1117
1081
|
}
|
|
1118
1082
|
/** Prints a claim command's task with its claim and when the lease ends */
|
|
1119
1083
|
function outputClaimChange(change, describeUnchanged) {
|
|
1120
1084
|
const board = createColumnBoard();
|
|
1121
|
-
outputChanges([change], (claimChange) => presentTask(claimChange.task, board), (entries) => formatTaskList(entries, {
|
|
1085
|
+
outputChanges([change], (claimChange) => presentTask(claimChange.task, board), (entries) => formatTaskList(entries, {
|
|
1086
|
+
showsClaimDetail: true,
|
|
1087
|
+
resumedExpiredClaim: change.resumedExpiredClaim,
|
|
1088
|
+
}), describeUnchanged);
|
|
1122
1089
|
}
|
|
1123
1090
|
function parseTaskLabelArgs(args) {
|
|
1124
|
-
const { positionals } =
|
|
1125
|
-
options: taskInputs.label_add.options,
|
|
1126
|
-
args,
|
|
1127
|
-
strict: true,
|
|
1128
|
-
allowPositionals: true,
|
|
1129
|
-
});
|
|
1130
|
-
validatePositionals(positionals, taskInputs.label_add.forms[0]);
|
|
1091
|
+
const { positionals } = parseCommandArgs(args, taskInputs.label_add);
|
|
1131
1092
|
return { taskKey: positionals[0], labelNames: positionals.slice(1) };
|
|
1132
1093
|
}
|
|
1133
1094
|
// The new task is the source of each relation, so a flag names the type from its point of view.
|