@zinn-dev/cli 0.45.0 → 0.46.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 +4 -0
- package/src/errors.d.ts +4 -0
- package/src/errors.js +18 -5
- package/src/lib.d.ts +2 -1
- package/src/lib.js +52 -20
- package/src/presentation/activity-presentation.js +2 -0
- package/src/presentation/doctor-presentation.d.ts +7 -1
- package/src/presentation/doctor-presentation.js +6 -2
- 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 +1 -0
- package/src/presentation/task-blame-presentation.js +3 -1
- package/src/presentation/task-presentation.d.ts +16 -4
- package/src/presentation/task-presentation.js +60 -33
- package/src/result-schemas.d.ts +137 -0
- package/src/result-schemas.js +51 -0
- package/src/routes/activity-router.d.ts +4 -2
- package/src/routes/activity-router.js +44 -17
- package/src/routes/backup-router.d.ts +1 -0
- package/src/routes/backup-router.js +4 -3
- package/src/routes/capabilities-router.d.ts +1 -0
- package/src/routes/capabilities-router.js +1 -1
- package/src/routes/comment-router.d.ts +5 -0
- package/src/routes/comment-router.js +5 -5
- package/src/routes/doctor-router.d.ts +1 -0
- package/src/routes/doctor-router.js +33 -53
- package/src/routes/info-router.d.ts +1 -0
- package/src/routes/info-router.js +1 -1
- package/src/routes/label-router.d.ts +5 -0
- package/src/routes/label-router.js +5 -5
- package/src/routes/migrate-router.d.ts +1 -0
- package/src/routes/migrate-router.js +5 -7
- package/src/routes/project-router.d.ts +10 -0
- package/src/routes/project-router.js +31 -24
- package/src/routes/reindex-router.d.ts +1 -0
- package/src/routes/reindex-router.js +1 -1
- package/src/routes/relation-router.d.ts +3 -0
- package/src/routes/relation-router.js +9 -6
- package/src/routes/restore-router.d.ts +1 -0
- package/src/routes/restore-router.js +3 -4
- package/src/routes/router.js +2 -2
- package/src/routes/routes.d.ts +113 -2
- package/src/routes/skill-router.d.ts +53 -2
- package/src/routes/skill-router.js +114 -31
- package/src/routes/task-router.d.ts +33 -0
- package/src/routes/task-router.js +182 -88
- package/src/routes/whoami-router.d.ts +1 -0
- package/src/routes/whoami-router.js +1 -1
- 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 +8 -3
- package/src/types.d.ts +4 -0
- package/src/types.js +6 -0
|
@@ -1,18 +1,18 @@
|
|
|
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
9
|
import { generateCommandUsage, taskKeyPositional, archiveConstraint, getOptionInputs, violatesConstraint, } from "../input.js";
|
|
10
|
-
import { confirmationDescription, confirmAction, dashValueHelp, diagnostic, output, outputChanges, quit, validatePositionals, validateOrderForms, requireStringOption, renameFlag, validateUniqueOptions, } from "../lib.js";
|
|
10
|
+
import { confirmationDescription, confirmAction, dashValueHelp, diagnostic, getOutputMode, output, outputChanges, quit, validatePositionals, validateTaskKey, validateOrderForms, requireStringOption, renameFlag, validateUniqueOptions, } 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
18
|
import { formatRelationList, presentRelations } from "../presentation/relation-presentation.js";
|
|
@@ -21,7 +21,7 @@ import { formatSection } from "../presentation/section.js";
|
|
|
21
21
|
import { abbreviateActivityIds, formatActivityList, presentActivities, } from "../presentation/activity-presentation.js";
|
|
22
22
|
import { formatTaskBlame } from "../presentation/task-blame-presentation.js";
|
|
23
23
|
import { createColumnBoard } from "../presentation/column-presentation.js";
|
|
24
|
-
import { formatTaskList, formatTaskTimestamps, presentTask, } from "../presentation/task-presentation.js";
|
|
24
|
+
import { formatTaskList, formatTaskTimestamps, 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({
|
|
@@ -34,6 +34,30 @@ function suggestTaskMove(args, options = {}) {
|
|
|
34
34
|
const columnWords = typeof guessedColumn === "string" ? [guessedColumn] : [];
|
|
35
35
|
return ["task", "move", ...positionals, ...columnWords];
|
|
36
36
|
}
|
|
37
|
+
// Project view lists the archived count beside the columns, so "Archived" reads like a move target.
|
|
38
|
+
const archiveTargetNames = ["archive", "archived"];
|
|
39
|
+
const searchMatchesConstraint = {
|
|
40
|
+
kind: "requires",
|
|
41
|
+
input: "option:with-matches",
|
|
42
|
+
requires: "option:json",
|
|
43
|
+
};
|
|
44
|
+
/** Moves tasks, and points a move to a missing Archived column at task archive. */
|
|
45
|
+
function moveOrPointToArchive(taskKeys, targetColumn, fromColumn) {
|
|
46
|
+
try {
|
|
47
|
+
return task.moveMany({ taskKeys, targetColumn, fromColumn }, currentActor());
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
const isMissingArchivedTarget = error instanceof CoreError &&
|
|
51
|
+
error.kind === "missing" &&
|
|
52
|
+
error.facts.entity === "column" &&
|
|
53
|
+
error.facts.key === targetColumn &&
|
|
54
|
+
archiveTargetNames.includes(targetColumn.toLowerCase());
|
|
55
|
+
if (!isMissingArchivedTarget) {
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
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);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
37
61
|
const priorityOption = {
|
|
38
62
|
type: "string",
|
|
39
63
|
value: {
|
|
@@ -182,6 +206,7 @@ const taskInputs = {
|
|
|
182
206
|
limit: listLimitOption,
|
|
183
207
|
label: { type: "string", multiple: true, value: { kind: "label-name", name: "name" } },
|
|
184
208
|
column: { type: "string", value: { kind: "column-name", name: "name" } },
|
|
209
|
+
"with-matches": { type: "boolean", description: "Include match excerpts in JSON results" },
|
|
185
210
|
},
|
|
186
211
|
forms: [
|
|
187
212
|
{
|
|
@@ -192,7 +217,7 @@ const taskInputs = {
|
|
|
192
217
|
],
|
|
193
218
|
},
|
|
194
219
|
],
|
|
195
|
-
constraints: [archiveConstraint, projectScopeConstraint],
|
|
220
|
+
constraints: [archiveConstraint, projectScopeConstraint, searchMatchesConstraint],
|
|
196
221
|
notes: [
|
|
197
222
|
projectScopeDescription,
|
|
198
223
|
"A query that is a task key ignores defaultProject unless a project was typed. --all-projects still excludes a typed project.",
|
|
@@ -369,7 +394,7 @@ const taskInputs = {
|
|
|
369
394
|
export const taskRouter = {
|
|
370
395
|
create: {
|
|
371
396
|
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" },
|
|
397
|
+
effects: { domain: "create", storage: "normal-open", external: [] },
|
|
373
398
|
confirmation: { kind: "none" },
|
|
374
399
|
input: taskInputs.create,
|
|
375
400
|
results: [jsonResult("Task")],
|
|
@@ -444,7 +469,7 @@ Examples:
|
|
|
444
469
|
},
|
|
445
470
|
list: {
|
|
446
471
|
summary: "List active tasks by default.",
|
|
447
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
472
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
448
473
|
confirmation: { kind: "none" },
|
|
449
474
|
input: taskInputs.list,
|
|
450
475
|
results: [jsonResult("TaskList")],
|
|
@@ -461,7 +486,10 @@ Examples:
|
|
|
461
486
|
if (violatesConstraint(archiveConstraint, getOptionInputs(values))) {
|
|
462
487
|
quit('Use either "--archived" or "--all", not both', undefined, { argument: "--archived" });
|
|
463
488
|
}
|
|
464
|
-
const
|
|
489
|
+
const projectChoice = chooseProjectKey(positionals[0], {
|
|
490
|
+
allProjects: values["all-projects"],
|
|
491
|
+
});
|
|
492
|
+
const projectKey = projectChoice?.key;
|
|
465
493
|
const archive = values.all ? "all" : values.archived ? "archived" : "active";
|
|
466
494
|
const limit = parseListLimit(values.limit);
|
|
467
495
|
const sort = taskSortSchema.optional().safeParse(values.sort);
|
|
@@ -474,23 +502,33 @@ Examples:
|
|
|
474
502
|
if (!state.success) {
|
|
475
503
|
quit(`Unknown state "${values.state}". Use ${taskStateFilterSchema.options.join(", ")}`, undefined, { argument: "--state" });
|
|
476
504
|
}
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
505
|
+
const deadlineFilters = parseDeadlineFilters(values);
|
|
506
|
+
const { presentedTasks, nextCursor, labelColorsByName } = readSnapshot(() => {
|
|
507
|
+
if (projectChoice !== undefined) {
|
|
508
|
+
checkDefaultProject(projectChoice);
|
|
509
|
+
}
|
|
510
|
+
const page = task.getPage({
|
|
511
|
+
...deadlineFilters,
|
|
512
|
+
limit,
|
|
513
|
+
sort: sort.data,
|
|
514
|
+
projectKey,
|
|
515
|
+
archive,
|
|
516
|
+
state: state.data,
|
|
517
|
+
labelNames: values.label,
|
|
518
|
+
columnName: values.column,
|
|
519
|
+
startingAfter: values["starting-after"],
|
|
520
|
+
});
|
|
521
|
+
return {
|
|
522
|
+
presentedTasks: presentTasks(page.tasks),
|
|
523
|
+
nextCursor: page.nextCursor,
|
|
524
|
+
labelColorsByName: getOutputMode() === "text" ? getLabelColorsByName() : undefined,
|
|
525
|
+
};
|
|
487
526
|
});
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
if (page.nextCursor !== undefined) {
|
|
527
|
+
output(presentedTasks, (entries) => formatTaskList(entries, { showsStatus: values.all, labelColorsByName }));
|
|
528
|
+
if (nextCursor !== undefined) {
|
|
491
529
|
const selectionTokens = tokens.filter((token) => token.kind !== "option" || token.name !== "all-projects");
|
|
492
530
|
const projectScope = projectKey === undefined ? ["--all-projects"] : [projectKey];
|
|
493
|
-
diagnostic(`More tasks. Continue with: ${formatListContinuation(["task", "list"], projectScope, selectionTokens, "starting-after",
|
|
531
|
+
diagnostic(`More tasks. Continue with: ${formatListContinuation(["task", "list"], projectScope, selectionTokens, "starting-after", nextCursor)}`);
|
|
494
532
|
}
|
|
495
533
|
},
|
|
496
534
|
help: `${generateCommandUsage("task list", taskInputs.list)}
|
|
@@ -516,11 +554,14 @@ Use 'task view' to see a task's full details, including its description and an e
|
|
|
516
554
|
Example: zinn task list MDR --label cli`,
|
|
517
555
|
},
|
|
518
556
|
search: {
|
|
519
|
-
summary: "Search task titles, descriptions, and comments
|
|
520
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
557
|
+
summary: "Search task titles, descriptions, and comments with excerpts from matching sources.",
|
|
558
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
521
559
|
confirmation: { kind: "none" },
|
|
522
560
|
input: taskInputs.search,
|
|
523
|
-
results: [
|
|
561
|
+
results: [
|
|
562
|
+
jsonResult("TaskList", { kind: "booleanOption", name: "with-matches", value: false }),
|
|
563
|
+
jsonResult("TaskSearchResults", { kind: "booleanOption", name: "with-matches", value: true }),
|
|
564
|
+
],
|
|
524
565
|
run: (args) => {
|
|
525
566
|
const { values, positionals, tokens } = parseArgs({
|
|
526
567
|
args,
|
|
@@ -535,36 +576,55 @@ Example: zinn task list MDR --label cli`,
|
|
|
535
576
|
if (violatesConstraint(archiveConstraint, getOptionInputs(values))) {
|
|
536
577
|
quit('Use either "--archived" or "--all", not both', undefined, { argument: "--archived" });
|
|
537
578
|
}
|
|
579
|
+
const isText = getOutputMode() === "text";
|
|
580
|
+
if (violatesConstraint(searchMatchesConstraint, {
|
|
581
|
+
...getOptionInputs(values),
|
|
582
|
+
"option:json": !isText,
|
|
583
|
+
})) {
|
|
584
|
+
quit("Add --json to use --with-matches.", undefined, { argument: "--with-matches" });
|
|
585
|
+
}
|
|
538
586
|
const archive = values.all ? "all" : values.archived ? "archived" : "active";
|
|
539
587
|
const isTaskKeyQuery = parseTaskKey(query.trim()) !== null;
|
|
540
|
-
const
|
|
588
|
+
const projectChoice = chooseProjectKey(positionals[1], {
|
|
541
589
|
allProjects: values["all-projects"],
|
|
542
590
|
useDefault: !isTaskKeyQuery,
|
|
543
591
|
});
|
|
544
592
|
const limit = parseListLimit(values.limit);
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
593
|
+
const deadlineFilters = parseDeadlineFilters(values);
|
|
594
|
+
const { presentedTasks, hiddenArchivedCount, labelColorsByName } = readSnapshot(() => {
|
|
595
|
+
if (projectChoice !== undefined) {
|
|
596
|
+
checkDefaultProject(projectChoice);
|
|
597
|
+
}
|
|
598
|
+
const result = task.search({
|
|
599
|
+
...deadlineFilters,
|
|
600
|
+
query,
|
|
601
|
+
projectKey: projectChoice?.key,
|
|
602
|
+
archive,
|
|
603
|
+
limit,
|
|
604
|
+
labelNames: values.label,
|
|
605
|
+
columnName: values.column,
|
|
606
|
+
includeMatches: isText || values["with-matches"] === true,
|
|
607
|
+
});
|
|
608
|
+
return {
|
|
609
|
+
presentedTasks: presentTaskSearchResults(result.tasks, result.matchesByTaskId),
|
|
610
|
+
hiddenArchivedCount: result.hiddenArchivedCount,
|
|
611
|
+
labelColorsByName: isText ? getLabelColorsByName() : undefined,
|
|
612
|
+
};
|
|
553
613
|
});
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
const count = result.hiddenArchivedCount;
|
|
614
|
+
output(presentedTasks, (entries) => formatTaskList(entries, { showsStatus: values.all, labelColorsByName }));
|
|
615
|
+
if (hiddenArchivedCount > 0) {
|
|
616
|
+
const count = hiddenArchivedCount;
|
|
558
617
|
const noun = count === 1 ? "match" : "matches";
|
|
559
618
|
diagnostic(`${count} archived ${noun} hidden, use --all to include them`);
|
|
560
619
|
}
|
|
561
620
|
},
|
|
562
621
|
help: `${generateCommandUsage("task search", taskInputs.search)}
|
|
563
622
|
|
|
564
|
-
Search task titles, descriptions, and comments.
|
|
623
|
+
Search task titles, descriptions, and comments. Comment excerpts include the comment key for 'task comment view'.
|
|
565
624
|
${projectScopeDescription}
|
|
566
625
|
Each word matches the start of a word, ignoring case and accents: e.g. "auth" finds "Authentication".
|
|
567
626
|
Every word must match. Quote a query with several words.
|
|
627
|
+
U+E000 is reserved for separating comments in the search index.
|
|
568
628
|
|
|
569
629
|
A task-key query overrides the configured default project; a typed project key still filters it.
|
|
570
630
|
|
|
@@ -574,11 +634,13 @@ Repeat --label to require every specified label, ignoring case.
|
|
|
574
634
|
--column matches an exact column name. Column and label matching ignore case.
|
|
575
635
|
${deadlineFilterHelp}
|
|
576
636
|
|
|
637
|
+
Use --json --with-matches to include excerpts and highlight ranges. --limit counts tasks.
|
|
638
|
+
|
|
577
639
|
Example: zinn task search 'refinement quota' MDR --limit 5`,
|
|
578
640
|
},
|
|
579
641
|
next: {
|
|
580
642
|
summary: "Show the next task that is ready to work on.",
|
|
581
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
643
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
582
644
|
confirmation: { kind: "none" },
|
|
583
645
|
input: taskInputs.next,
|
|
584
646
|
results: [jsonResult("NextTask")],
|
|
@@ -592,10 +654,20 @@ Example: zinn task search 'refinement quota' MDR --limit 5`,
|
|
|
592
654
|
});
|
|
593
655
|
validateUniqueOptions(tokens, taskInputs.next.options);
|
|
594
656
|
validatePositionals(positionals, taskInputs.next.forms[0]);
|
|
595
|
-
const
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
657
|
+
const projectChoice = chooseProjectKey(positionals[0], {
|
|
658
|
+
allProjects: values["all-projects"],
|
|
659
|
+
});
|
|
660
|
+
const { presentedTask, labelColorsByName } = readSnapshot(() => {
|
|
661
|
+
if (projectChoice !== undefined) {
|
|
662
|
+
checkDefaultProject(projectChoice);
|
|
663
|
+
}
|
|
664
|
+
const nextTask = task.next({ projectKey: projectChoice?.key, columnName: values.column });
|
|
665
|
+
return {
|
|
666
|
+
presentedTask: nextTask === null ? null : presentTask(nextTask),
|
|
667
|
+
labelColorsByName: nextTask !== null && getOutputMode() === "text" ? getLabelColorsByName() : undefined,
|
|
668
|
+
};
|
|
669
|
+
});
|
|
670
|
+
output(presentedTask, (entry) => entry === null ? "No task is ready." : formatTaskList([entry], { labelColorsByName }));
|
|
599
671
|
},
|
|
600
672
|
help: `${generateCommandUsage("task next", taskInputs.next)}
|
|
601
673
|
|
|
@@ -619,7 +691,7 @@ Examples:
|
|
|
619
691
|
},
|
|
620
692
|
view: {
|
|
621
693
|
summary: "Show a task with its description, relations, comments, and creation and update times.",
|
|
622
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
694
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
623
695
|
confirmation: { kind: "none" },
|
|
624
696
|
input: taskInputs.view,
|
|
625
697
|
results: taskDetailResults,
|
|
@@ -633,21 +705,33 @@ Examples:
|
|
|
633
705
|
});
|
|
634
706
|
validateUniqueOptions(tokens, taskInputs.view.options);
|
|
635
707
|
validatePositionals(positionals, taskInputs.view.forms[0]);
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
708
|
+
const taskKey = positionals[0];
|
|
709
|
+
validateTaskKey(taskKey);
|
|
710
|
+
const { viewedTask, history, labelColorsByName } = readSnapshot(() => {
|
|
711
|
+
const taskMatch = task.getByKey(taskKey);
|
|
712
|
+
const board = createColumnBoard();
|
|
713
|
+
const detail = {
|
|
714
|
+
...presentTask(taskMatch, board),
|
|
715
|
+
relations: presentRelations(taskMatch, board),
|
|
716
|
+
comments: presentComments(taskMatch.key),
|
|
717
|
+
};
|
|
718
|
+
const viewedTask = values.history === true
|
|
719
|
+
? {
|
|
720
|
+
...detail,
|
|
721
|
+
activity: task
|
|
722
|
+
.activity(taskMatch.key)
|
|
723
|
+
.sort((left, right) => right.created_at - left.created_at || right.id.localeCompare(left.id)),
|
|
724
|
+
}
|
|
725
|
+
: detail;
|
|
726
|
+
const isText = getOutputMode() === "text";
|
|
727
|
+
return {
|
|
728
|
+
viewedTask,
|
|
729
|
+
history: isText && "activity" in viewedTask
|
|
730
|
+
? presentActivities(viewedTask.activity, { keysFromEventsOnly: true })
|
|
731
|
+
: [],
|
|
732
|
+
labelColorsByName: isText ? getLabelColorsByName() : undefined,
|
|
733
|
+
};
|
|
734
|
+
});
|
|
651
735
|
output(viewedTask, (t) => {
|
|
652
736
|
const MIN_SECTION_SEPARATOR_WIDTH = 60;
|
|
653
737
|
const terminalWidth = process.stdout.columns;
|
|
@@ -663,6 +747,7 @@ Examples:
|
|
|
663
747
|
showsStatus: isArchived,
|
|
664
748
|
showsFullPriority: true,
|
|
665
749
|
showsClaimDetail: true,
|
|
750
|
+
labelColorsByName,
|
|
666
751
|
}),
|
|
667
752
|
];
|
|
668
753
|
if (t.description != null) {
|
|
@@ -674,11 +759,9 @@ Examples:
|
|
|
674
759
|
if (comments.length > 0) {
|
|
675
760
|
sections.push(formatSection("Comments", comments, sectionOptions));
|
|
676
761
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
sections.push(formatSection("History", history, sectionOptions));
|
|
681
|
-
}
|
|
762
|
+
const formattedHistory = formatActivityList(history);
|
|
763
|
+
if (formattedHistory.length > 0) {
|
|
764
|
+
sections.push(formatSection("History", formattedHistory, sectionOptions));
|
|
682
765
|
}
|
|
683
766
|
sections.push(formatTaskTimestamps(t));
|
|
684
767
|
return sections.join("\n\n");
|
|
@@ -702,7 +785,7 @@ Examples:
|
|
|
702
785
|
},
|
|
703
786
|
blame: {
|
|
704
787
|
summary: "Show the recorded authors of a task's current fields and description lines.",
|
|
705
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
788
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
706
789
|
confirmation: { kind: "none" },
|
|
707
790
|
input: taskInputs.blame,
|
|
708
791
|
results: [jsonResult("TaskBlame")],
|
|
@@ -714,16 +797,25 @@ Examples:
|
|
|
714
797
|
strict: true,
|
|
715
798
|
});
|
|
716
799
|
validatePositionals(positionals, taskInputs.blame.forms[0]);
|
|
717
|
-
|
|
800
|
+
const { blame, textOptions } = readSnapshot(() => {
|
|
801
|
+
const blame = task.blame(positionals[0]);
|
|
802
|
+
if (getOutputMode() === "json") {
|
|
803
|
+
return { blame };
|
|
804
|
+
}
|
|
718
805
|
const taskMatch = task.getByKey(blame.task.key);
|
|
719
806
|
const board = createColumnBoard();
|
|
720
|
-
return
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
807
|
+
return {
|
|
808
|
+
blame,
|
|
809
|
+
textOptions: {
|
|
810
|
+
relations: presentRelations(taskMatch, board),
|
|
811
|
+
columnCategory: board(taskMatch.project_id).find((boardColumn) => boardColumn.id === taskMatch.column_id)?.category ?? null,
|
|
812
|
+
isArchived: taskMatch.archived_at != null,
|
|
813
|
+
labelColorsByName: blame.fields.labels.value.length === 0 ? new Map() : getLabelColorsByName(),
|
|
814
|
+
activityIdPrefixes: abbreviateActivityIds(activity.getIds()),
|
|
815
|
+
},
|
|
816
|
+
};
|
|
726
817
|
});
|
|
818
|
+
output(blame, (entry) => formatTaskBlame(entry, textOptions));
|
|
727
819
|
},
|
|
728
820
|
help: `${generateCommandUsage("task blame", taskInputs.blame)}
|
|
729
821
|
|
|
@@ -739,7 +831,7 @@ Example: zinn task blame MDR-1`,
|
|
|
739
831
|
},
|
|
740
832
|
edit: {
|
|
741
833
|
summary: "Edit a task's title, description, priority, deadline, or label attachments.",
|
|
742
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
834
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
743
835
|
confirmation: { kind: "none" },
|
|
744
836
|
input: taskInputs.edit,
|
|
745
837
|
results: [jsonResult("TaskChange")],
|
|
@@ -811,7 +903,7 @@ Examples:
|
|
|
811
903
|
},
|
|
812
904
|
move: {
|
|
813
905
|
summary: "Move tasks to another column in their projects.",
|
|
814
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
906
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
815
907
|
confirmation: { kind: "none" },
|
|
816
908
|
input: taskInputs.move,
|
|
817
909
|
results: taskChangeResults,
|
|
@@ -827,7 +919,7 @@ Examples:
|
|
|
827
919
|
validatePositionals(positionals, taskInputs.move.forms[0]);
|
|
828
920
|
const taskKeys = positionals.slice(0, -1);
|
|
829
921
|
const targetColumn = positionals.at(-1);
|
|
830
|
-
const moves =
|
|
922
|
+
const moves = moveOrPointToArchive(taskKeys, targetColumn, values.from);
|
|
831
923
|
const board = createColumnBoard();
|
|
832
924
|
outputChanges(moves, (change) => presentTask(change.task, board), formatTaskList, (movedTask) => `${movedTask.key} was already in the ${movedTask.column} column`);
|
|
833
925
|
},
|
|
@@ -849,7 +941,7 @@ Examples:
|
|
|
849
941
|
},
|
|
850
942
|
order: {
|
|
851
943
|
summary: "Change task positions within their current column.",
|
|
852
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
944
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
853
945
|
confirmation: { kind: "none" },
|
|
854
946
|
input: taskInputs.order,
|
|
855
947
|
results: taskChangeResults,
|
|
@@ -890,7 +982,7 @@ Example: zinn task order MDR-2 before MDR-1`,
|
|
|
890
982
|
},
|
|
891
983
|
archive: {
|
|
892
984
|
summary: "Archive tasks so they no longer appear in active task lists.",
|
|
893
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
985
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
894
986
|
confirmation: { kind: "none" },
|
|
895
987
|
input: taskInputs.archive,
|
|
896
988
|
results: taskChangeResults,
|
|
@@ -913,7 +1005,7 @@ Example: zinn task archive MDR-1 MDR-2`,
|
|
|
913
1005
|
},
|
|
914
1006
|
unarchive: {
|
|
915
1007
|
summary: "Unarchive tasks at the bottom of their previous columns, in the order given.",
|
|
916
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
1008
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
917
1009
|
confirmation: { kind: "none" },
|
|
918
1010
|
input: taskInputs.archive,
|
|
919
1011
|
results: taskChangeResults,
|
|
@@ -936,7 +1028,7 @@ Example: zinn task unarchive MDR-1 MDR-2`,
|
|
|
936
1028
|
},
|
|
937
1029
|
claim: {
|
|
938
1030
|
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" },
|
|
1031
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
940
1032
|
confirmation: { kind: "none" },
|
|
941
1033
|
input: taskInputs.claim,
|
|
942
1034
|
results: [jsonResult("TaskChange")],
|
|
@@ -981,7 +1073,7 @@ Examples:
|
|
|
981
1073
|
},
|
|
982
1074
|
heartbeat: {
|
|
983
1075
|
summary: "Renew your claim on a task with its current lease.",
|
|
984
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
1076
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
985
1077
|
confirmation: { kind: "none" },
|
|
986
1078
|
input: taskInputs.heartbeat,
|
|
987
1079
|
results: [jsonResult("TaskChange")],
|
|
@@ -994,12 +1086,13 @@ Examples:
|
|
|
994
1086
|
Renew your claim on a task with its current lease.
|
|
995
1087
|
It fails when the task has no claim or someone else holds it.
|
|
996
1088
|
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.
|
|
1089
|
+
Your own expired claim renews, unless someone claimed the task since.
|
|
997
1090
|
|
|
998
1091
|
Example: zinn task heartbeat MDR-1`,
|
|
999
1092
|
},
|
|
1000
1093
|
release: {
|
|
1001
1094
|
summary: "Release your claim on a task.",
|
|
1002
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
1095
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
1003
1096
|
confirmation: { kind: "none" },
|
|
1004
1097
|
input: taskInputs.heartbeat,
|
|
1005
1098
|
results: [jsonResult("TaskChange")],
|
|
@@ -1009,15 +1102,16 @@ Example: zinn task heartbeat MDR-1`,
|
|
|
1009
1102
|
},
|
|
1010
1103
|
help: `${generateCommandUsage("task release", taskInputs.heartbeat)}
|
|
1011
1104
|
|
|
1012
|
-
Release your claim on a task.
|
|
1013
|
-
|
|
1105
|
+
Release your claim on a task, even after it expires.
|
|
1106
|
+
Someone else's claim is a conflict, even after it expires. Use task claim to replace an expired claim held by someone else.
|
|
1107
|
+
Releasing a task without a claim does not do anything.
|
|
1014
1108
|
With --json, changed is false when the task had no claim.
|
|
1015
1109
|
|
|
1016
1110
|
Example: zinn task release MDR-1`,
|
|
1017
1111
|
},
|
|
1018
1112
|
delete: {
|
|
1019
1113
|
summary: "Permanently delete tasks after confirmation.",
|
|
1020
|
-
effects: { domain: "delete", storage: "normal-open" },
|
|
1114
|
+
effects: { domain: "delete", storage: "normal-open", external: [] },
|
|
1021
1115
|
confirmation: { kind: "prompt", description: confirmationDescription },
|
|
1022
1116
|
input: taskInputs.delete,
|
|
1023
1117
|
results: [
|
|
@@ -1037,7 +1131,7 @@ Example: zinn task release MDR-1`,
|
|
|
1037
1131
|
const taskKeys = taskDeleteManySchema.parse(positionals);
|
|
1038
1132
|
const taskMatches = taskKeys.map((taskKey) => task.getByKey(taskKey));
|
|
1039
1133
|
const board = createColumnBoard();
|
|
1040
|
-
const presented = taskMatches
|
|
1134
|
+
const presented = presentTasks(taskMatches, board);
|
|
1041
1135
|
const canDelete = await confirmAction(`Are you sure you want to delete ${taskMatches.map((match) => match.key).join(", ")}?`, values.yes === true);
|
|
1042
1136
|
if (canDelete) {
|
|
1043
1137
|
task.deleteMany(taskKeys, currentActor());
|
|
@@ -1061,7 +1155,7 @@ Example: zinn task delete MDR-1 MDR-2`,
|
|
|
1061
1155
|
label: {
|
|
1062
1156
|
add: {
|
|
1063
1157
|
summary: "Add existing labels to a task. Label names are matched case-insensitively.",
|
|
1064
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
1158
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
1065
1159
|
confirmation: { kind: "none" },
|
|
1066
1160
|
input: taskInputs.label_add,
|
|
1067
1161
|
results: [jsonResult("TaskChange")],
|
|
@@ -1078,7 +1172,7 @@ With --json, changed is false when all the labels were already attached.`,
|
|
|
1078
1172
|
},
|
|
1079
1173
|
remove: {
|
|
1080
1174
|
summary: "Remove existing labels from a task. Label names are matched case-insensitively.",
|
|
1081
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
1175
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
1082
1176
|
confirmation: { kind: "none" },
|
|
1083
1177
|
input: taskInputs.label_add,
|
|
1084
1178
|
results: [jsonResult("TaskChange")],
|
|
@@ -6,7 +6,7 @@ import { formatActor, presentActor } from "../presentation/activity-presentation
|
|
|
6
6
|
import { jsonResult } from "../results.js";
|
|
7
7
|
export const whoamiCommand = {
|
|
8
8
|
summary: "Show the actor a change would record in the current environment and folder.",
|
|
9
|
-
effects: { domain: "none", storage: "none" },
|
|
9
|
+
effects: { domain: "none", storage: "none", external: [] },
|
|
10
10
|
confirmation: { kind: "none" },
|
|
11
11
|
input: noInput,
|
|
12
12
|
results: [jsonResult("Actor")],
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** The name the skills CLI and agents know the workflow skill by */
|
|
2
|
+
export declare const SKILL_NAME = "zinn";
|
|
3
|
+
/** The workflow skill folder that ships with the CLI */
|
|
4
|
+
export declare const bundledSkillDirectory: string;
|
|
5
|
+
export type SkillCopyScope = "home" | "project";
|
|
6
|
+
/** A single Zinn skill file an agent can load, seen via every path that resolves to it */
|
|
7
|
+
export type SkillCopy = {
|
|
8
|
+
/** First checked path that resolves to this file */
|
|
9
|
+
path: string;
|
|
10
|
+
/** The other checked paths that resolve to this file, in checking order */
|
|
11
|
+
links: Array<string>;
|
|
12
|
+
realPath: string;
|
|
13
|
+
/** Where this copy lives (e.g. project, user, or bundled) */
|
|
14
|
+
scope: SkillCopyScope;
|
|
15
|
+
/** False when the file exists on disk but could not be read */
|
|
16
|
+
readable: boolean;
|
|
17
|
+
reviewedVersion: string | null;
|
|
18
|
+
/** Whether its reviewed version matches the bundled skill */
|
|
19
|
+
matches: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type SkillCopies = {
|
|
22
|
+
/** The reviewed version of the skill `zinn skill install` installs */
|
|
23
|
+
bundledVersion: string | null;
|
|
24
|
+
copies: Array<SkillCopy>;
|
|
25
|
+
};
|
|
26
|
+
/** The command that replaces a copy in the given scope with the bundled skill */
|
|
27
|
+
export declare function skillInstallCommand(scope: SkillCopyScope, workingFolder: string): string;
|
|
28
|
+
/** A skill file's reviewed CLI version, `null` when the file has none that can be read */
|
|
29
|
+
export declare function readReviewedVersion(skill: string): string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Finds the Zinn skill copies in the home folder and the working folder and compares each with the bundled skill.
|
|
32
|
+
* Paths that lead to one file through links give one copy. A link that leads nowhere is no copy.
|
|
33
|
+
*/
|
|
34
|
+
export declare function findSkillCopies(home: string, workingFolder: string): SkillCopies;
|