@zinn-dev/cli 0.42.0 → 0.44.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/index.js +3 -3
- package/package.json +6 -4
- package/skills/zinn/SKILL.md +1 -1
- package/src/actor.d.ts +8 -0
- package/src/actor.js +5 -1
- package/src/capabilities-schema.d.ts +4 -4
- package/src/column-hint.js +3 -4
- package/src/errors.d.ts +40 -3
- package/src/errors.js +93 -21
- package/src/failure-log.d.ts +6 -0
- package/src/failure-log.js +167 -0
- package/src/input.d.ts +11 -0
- package/src/input.js +25 -1
- package/src/lib.d.ts +21 -10
- package/src/lib.js +116 -62
- package/src/list-continuation.d.ts +11 -0
- package/src/list-continuation.js +18 -0
- package/src/list-limit.d.ts +11 -0
- package/src/list-limit.js +17 -0
- package/src/overview.d.ts +10 -0
- package/src/overview.js +41 -0
- package/src/presentation/activity-presentation.d.ts +2 -0
- package/src/presentation/activity-presentation.js +112 -38
- package/src/presentation/column-presentation.d.ts +17 -2
- package/src/presentation/column-presentation.js +45 -6
- package/src/presentation/description-presentation.d.ts +3 -16
- package/src/presentation/description-presentation.js +22 -21
- package/src/presentation/info-presentation.js +36 -6
- package/src/presentation/project-presentation.d.ts +6 -2
- package/src/presentation/project-presentation.js +9 -1
- package/src/presentation/relation-presentation.d.ts +12 -3
- package/src/presentation/relation-presentation.js +50 -26
- package/src/presentation/row-layout.d.ts +1 -1
- package/src/presentation/row-layout.js +6 -5
- package/src/presentation/task-blame-presentation.d.ts +11 -0
- package/src/presentation/task-blame-presentation.js +56 -0
- package/src/presentation/task-presentation.d.ts +6 -1
- package/src/presentation/task-presentation.js +28 -10
- package/src/presentation/text-width.d.ts +2 -0
- package/src/presentation/text-width.js +43 -0
- package/src/presentation/time.d.ts +3 -1
- package/src/presentation/time.js +5 -2
- package/src/result-schemas.d.ts +529 -18
- package/src/result-schemas.js +66 -4
- package/src/routes/activity-router.d.ts +53 -1
- package/src/routes/activity-router.js +126 -15
- package/src/routes/info-router.js +3 -2
- package/src/routes/migrate-router.js +2 -2
- package/src/routes/project-router.d.ts +41 -1
- package/src/routes/project-router.js +76 -24
- package/src/routes/relation-router.d.ts +7 -3
- package/src/routes/relation-router.js +73 -56
- package/src/routes/restore-router.js +10 -7
- package/src/routes/router.js +77 -37
- package/src/routes/routes.d.ts +213 -8
- package/src/routes/task-router.d.ts +119 -6
- package/src/routes/task-router.js +177 -32
- package/src/routes/whoami-router.js +1 -1
- package/src/run-facts.d.ts +14 -0
- package/src/run-facts.js +14 -0
- package/src/store-folder.d.ts +5 -0
- package/src/store-folder.js +16 -0
- package/src/telemetry.d.ts +31 -0
- package/src/telemetry.js +329 -0
- package/src/text-input.js +1 -5
- package/src/timestamp-input.d.ts +3 -0
- package/src/timestamp-input.js +31 -0
- package/src/types.d.ts +4 -4
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { jsonResult, taskDetailResults, taskChangeResults } from "../results.js";
|
|
2
2
|
import { parseArgs } from "node:util";
|
|
3
|
-
import { task, project,
|
|
3
|
+
import { activity, task, project, parseTaskKey, taskCreateSchema, taskEditSchema, taskDeleteManySchema, taskPrioritySchema, taskSortSchema, } from "@zinn-dev/core";
|
|
4
|
+
import { listLimitOption, listLimitDescription, parseListLimit } from "../list-limit.js";
|
|
5
|
+
import { formatListContinuation } from "../list-continuation.js";
|
|
6
|
+
import { parseTimestampInput } from "../timestamp-input.js";
|
|
4
7
|
import { CliError } from "../errors.js";
|
|
5
8
|
import { generateCommandUsage, taskKeyPositional, archiveConstraint, getOptionInputs, violatesConstraint, } from "../input.js";
|
|
6
9
|
import { confirmationDescription, confirmAction, dashValueHelp, diagnostic, output, outputChanges, quit, validatePositionals, validateOrderForms, requireStringOption, renameFlag, validateUniqueOptions, } from "../lib.js";
|
|
@@ -13,7 +16,9 @@ import { commentRouter } from "./comment-router.js";
|
|
|
13
16
|
import { formatRelationList, presentRelations } from "../presentation/relation-presentation.js";
|
|
14
17
|
import { formatCommentList, presentComments } from "../presentation/comment-presentation.js";
|
|
15
18
|
import { formatSection } from "../presentation/section.js";
|
|
16
|
-
import { formatActivityList, presentActivities } from "../presentation/activity-presentation.js";
|
|
19
|
+
import { abbreviateActivityIds, formatActivityList, presentActivities, } from "../presentation/activity-presentation.js";
|
|
20
|
+
import { formatTaskBlame } from "../presentation/task-blame-presentation.js";
|
|
21
|
+
import { columnPlacement, createColumnBoard } from "../presentation/column-presentation.js";
|
|
17
22
|
import { formatTaskList, formatTaskTimestamps, presentTask, } from "../presentation/task-presentation.js";
|
|
18
23
|
// A column is changed with task move, so a guessed --status or --column suggests it with the same task keys.
|
|
19
24
|
function suggestTaskMove(args, options = {}) {
|
|
@@ -37,6 +42,34 @@ const priorityOption = {
|
|
|
37
42
|
description: "Omission leaves priority unassigned on creation and unchanged on edit. none clears priority; JSON uses null.",
|
|
38
43
|
},
|
|
39
44
|
};
|
|
45
|
+
const dueOption = {
|
|
46
|
+
type: "string",
|
|
47
|
+
value: {
|
|
48
|
+
kind: "timestamp",
|
|
49
|
+
name: "timestamp",
|
|
50
|
+
description: "Integer epoch milliseconds or YYYY-MM-DDTHH:mm:ss[.SSS] with Z or a numeric offset. Fractions have 1 to 3 digits. none clears the deadline, ignoring case. Omission leaves it unset on creation and unchanged on edit.",
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
const deadlineFilterOptions = {
|
|
54
|
+
"due-since": {
|
|
55
|
+
type: "string",
|
|
56
|
+
value: {
|
|
57
|
+
kind: "timestamp",
|
|
58
|
+
name: "timestamp",
|
|
59
|
+
description: "Inclusive lower deadline bound. Integer epoch milliseconds or a timestamp with seconds and Z or a numeric offset. Fractions have 1 to 3 digits. Undated tasks do not match.",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
"due-until": {
|
|
63
|
+
type: "string",
|
|
64
|
+
value: {
|
|
65
|
+
kind: "timestamp",
|
|
66
|
+
name: "timestamp",
|
|
67
|
+
description: "Inclusive upper deadline bound in the same formats as --due-since. Must be at or after --due-since. Undated tasks do not match.",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
const deadlineHelp = "--due accepts integer epoch milliseconds or YYYY-MM-DDTHH:mm:ss[.SSS] with Z or a numeric offset such as +01:00. Fractional seconds have 1 to 3 digits. Use --due none to clear it. Omission leaves it unset on creation and unchanged on edit.";
|
|
72
|
+
const deadlineFilterHelp = "--due-since and --due-until select deadlines inclusively, using integer epoch milliseconds or timestamps with seconds and Z or a numeric offset. Fractional seconds have 1 to 3 digits. Either bound may appear alone. --due-until must be at or after --due-since. Undated tasks do not match. All filters apply before --limit.";
|
|
40
73
|
const taskEditConstraint = {
|
|
41
74
|
kind: "atLeastOne",
|
|
42
75
|
members: [
|
|
@@ -44,6 +77,7 @@ const taskEditConstraint = {
|
|
|
44
77
|
"option:description",
|
|
45
78
|
"option:description-file",
|
|
46
79
|
"option:priority",
|
|
80
|
+
"option:due",
|
|
47
81
|
"option:add-label",
|
|
48
82
|
"option:remove-label",
|
|
49
83
|
],
|
|
@@ -55,6 +89,7 @@ const taskInputs = {
|
|
|
55
89
|
description: { type: "string", value: { kind: "text", name: "text" } },
|
|
56
90
|
"description-file": textFileOption,
|
|
57
91
|
priority: priorityOption,
|
|
92
|
+
due: dueOption,
|
|
58
93
|
label: { type: "string", multiple: true, value: { kind: "label-name", name: "name" } },
|
|
59
94
|
column: { type: "string", value: { kind: "column-name", name: "name" } },
|
|
60
95
|
parent: { type: "string", value: { kind: "task-key", name: "task-key" } },
|
|
@@ -77,11 +112,25 @@ const taskInputs = {
|
|
|
77
112
|
},
|
|
78
113
|
list: {
|
|
79
114
|
options: {
|
|
115
|
+
...deadlineFilterOptions,
|
|
116
|
+
limit: listLimitOption,
|
|
117
|
+
sort: {
|
|
118
|
+
type: "string",
|
|
119
|
+
value: { kind: "enum", name: "key", choices: taskSortSchema.options },
|
|
120
|
+
},
|
|
80
121
|
archived: { type: "boolean" },
|
|
81
122
|
all: { type: "boolean" },
|
|
82
123
|
"all-projects": { type: "boolean" },
|
|
83
124
|
label: { type: "string", multiple: true, value: { kind: "label-name", name: "name" } },
|
|
84
125
|
column: { type: "string", value: { kind: "column-name", name: "name" } },
|
|
126
|
+
"starting-after": {
|
|
127
|
+
type: "string",
|
|
128
|
+
value: {
|
|
129
|
+
kind: "task-cursor",
|
|
130
|
+
name: "cursor",
|
|
131
|
+
description: "Cursor from the continuation command that task list prints on stderr when more tasks remain",
|
|
132
|
+
},
|
|
133
|
+
},
|
|
85
134
|
},
|
|
86
135
|
forms: [
|
|
87
136
|
{
|
|
@@ -90,18 +139,20 @@ const taskInputs = {
|
|
|
90
139
|
},
|
|
91
140
|
],
|
|
92
141
|
constraints: [archiveConstraint, projectScopeConstraint],
|
|
93
|
-
notes: [
|
|
142
|
+
notes: [
|
|
143
|
+
projectScopeDescription,
|
|
144
|
+
"A --starting-after cursor works only with the --sort it was made for. Filters may change between pages.",
|
|
145
|
+
],
|
|
94
146
|
},
|
|
95
147
|
search: {
|
|
96
148
|
options: {
|
|
149
|
+
...deadlineFilterOptions,
|
|
97
150
|
archived: { type: "boolean" },
|
|
98
151
|
all: { type: "boolean" },
|
|
99
152
|
"all-projects": { type: "boolean" },
|
|
100
|
-
limit:
|
|
101
|
-
type: "string",
|
|
102
|
-
value: { kind: "positive-integer", name: "n", pattern: `^${positiveIntegerPattern}$` },
|
|
103
|
-
},
|
|
153
|
+
limit: listLimitOption,
|
|
104
154
|
label: { type: "string", multiple: true, value: { kind: "label-name", name: "name" } },
|
|
155
|
+
column: { type: "string", value: { kind: "column-name", name: "name" } },
|
|
105
156
|
},
|
|
106
157
|
forms: [
|
|
107
158
|
{
|
|
@@ -128,6 +179,11 @@ const taskInputs = {
|
|
|
128
179
|
],
|
|
129
180
|
constraints: [],
|
|
130
181
|
},
|
|
182
|
+
blame: {
|
|
183
|
+
options: {},
|
|
184
|
+
forms: [{ id: "default", positionals: [taskKeyPositional] }],
|
|
185
|
+
constraints: [],
|
|
186
|
+
},
|
|
131
187
|
edit: {
|
|
132
188
|
options: {
|
|
133
189
|
title: { type: "string", value: { kind: "text", name: "text" } },
|
|
@@ -135,6 +191,7 @@ const taskInputs = {
|
|
|
135
191
|
"description-file": textFileOption,
|
|
136
192
|
...textEditOptions,
|
|
137
193
|
priority: priorityOption,
|
|
194
|
+
due: dueOption,
|
|
138
195
|
"add-label": { type: "string", multiple: true, value: { kind: "label-name", name: "name" } },
|
|
139
196
|
"remove-label": {
|
|
140
197
|
type: "string",
|
|
@@ -275,6 +332,7 @@ export const taskRouter = {
|
|
|
275
332
|
const fields = {
|
|
276
333
|
title,
|
|
277
334
|
priority,
|
|
335
|
+
due_at: parseDue(values.due),
|
|
278
336
|
labelNames: values.label,
|
|
279
337
|
columnName: values.column,
|
|
280
338
|
relations: parseNewTaskRelations(values),
|
|
@@ -297,6 +355,7 @@ Create a task at the bottom of a column. Without --column, it starts in the proj
|
|
|
297
355
|
${requiredProjectDescription}
|
|
298
356
|
|
|
299
357
|
Priority values: ${priorityOption.value.choices.join(", ")}; defaults to none.
|
|
358
|
+
${deadlineHelp}
|
|
300
359
|
Repeat --label to attach multiple existing labels.
|
|
301
360
|
${textFileHelp("--description")}
|
|
302
361
|
|
|
@@ -305,6 +364,8 @@ ${dashValueHelp("--description")}
|
|
|
305
364
|
The new task is a subtask of --parent, depends on --depends-on,
|
|
306
365
|
is a duplicate of --duplicate-of, and is related to --related.
|
|
307
366
|
Repeat --depends-on and --related to name several tasks.
|
|
367
|
+
Each target may have one relation type. Identical repeated requests count once.
|
|
368
|
+
Different relation types for the same target abort creation.
|
|
308
369
|
Unknown columns, labels or related tasks abort creation.
|
|
309
370
|
|
|
310
371
|
Examples:
|
|
@@ -333,13 +394,30 @@ Examples:
|
|
|
333
394
|
}
|
|
334
395
|
const projectKey = resolveProjectKey(positionals[0], { allProjects: values["all-projects"] });
|
|
335
396
|
const archive = values.all ? "all" : values.archived ? "archived" : "active";
|
|
336
|
-
const
|
|
397
|
+
const limit = parseListLimit(values.limit);
|
|
398
|
+
const sort = taskSortSchema.optional().safeParse(values.sort);
|
|
399
|
+
if (!sort.success) {
|
|
400
|
+
quit(`Unknown sort "${values.sort}". Use ${taskSortSchema.options.join(", ")}`, undefined, {
|
|
401
|
+
argument: "--sort",
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
const page = task.getPage({
|
|
405
|
+
...parseDeadlineFilters(values),
|
|
406
|
+
limit,
|
|
407
|
+
sort: sort.data,
|
|
337
408
|
projectKey,
|
|
338
409
|
archive,
|
|
339
410
|
labelNames: values.label,
|
|
340
411
|
columnName: values.column,
|
|
412
|
+
startingAfter: values["starting-after"],
|
|
341
413
|
});
|
|
342
|
-
|
|
414
|
+
const board = createColumnBoard();
|
|
415
|
+
output(page.tasks.map((taskMatch) => presentTask(taskMatch, board)), (presentedTasks) => formatTaskList(presentedTasks, { showsStatus: values.all }));
|
|
416
|
+
if (page.nextCursor !== undefined) {
|
|
417
|
+
const selectionTokens = tokens.filter((token) => token.kind !== "option" || token.name !== "all-projects");
|
|
418
|
+
const projectScope = projectKey === undefined ? ["--all-projects"] : [projectKey];
|
|
419
|
+
diagnostic(`More tasks. Continue with: ${formatListContinuation(["task", "list"], projectScope, selectionTokens, "starting-after", page.nextCursor)}`);
|
|
420
|
+
}
|
|
343
421
|
},
|
|
344
422
|
help: `${generateCommandUsage("task list", taskInputs.list)}
|
|
345
423
|
|
|
@@ -349,6 +427,14 @@ Use --archived to list archived tasks or --all to list both.
|
|
|
349
427
|
Repeat --label to require every specified label.
|
|
350
428
|
--column matches an exact column name. Column and label matching ignore case.
|
|
351
429
|
All supplied filters must match.
|
|
430
|
+
--sort activity lists the most recently active tasks first, including comments and relations.
|
|
431
|
+
Equal activity times keep board order. Without --sort, board order is preserved.
|
|
432
|
+
--sort due lists earliest deadlines first, with undated tasks last. Equal deadlines keep board order. Task positions stay unchanged.
|
|
433
|
+
${deadlineFilterHelp}
|
|
434
|
+
--limit <n>: ${listLimitDescription}
|
|
435
|
+
When additional matches remain after --limit, stderr gives a shell-quoted command to continue, including with --json.
|
|
436
|
+
--starting-after <cursor>: Continue after the position a cursor records. Copy the cursor from that command.
|
|
437
|
+
A cursor works only with the --sort it was made for. Changes to other tasks between commands can still cause repeats or skips.
|
|
352
438
|
|
|
353
439
|
Use 'task view' to see a task's full details, including its description.
|
|
354
440
|
|
|
@@ -375,24 +461,23 @@ Example: zinn task list MDR --label cli`,
|
|
|
375
461
|
quit('Use either "--archived" or "--all", not both', undefined, { argument: "--archived" });
|
|
376
462
|
}
|
|
377
463
|
const archive = values.all ? "all" : values.archived ? "archived" : "active";
|
|
378
|
-
const limitPattern = new RegExp(taskInputs.search.options.limit.value.pattern);
|
|
379
|
-
if (values.limit !== undefined && !limitPattern.test(values.limit)) {
|
|
380
|
-
quit(searchLimitMessage, undefined, { argument: "--limit" });
|
|
381
|
-
}
|
|
382
464
|
const isTaskKeyQuery = parseTaskKey(query.trim()) !== null;
|
|
383
465
|
const projectKey = resolveProjectKey(positionals[1], {
|
|
384
466
|
allProjects: values["all-projects"],
|
|
385
467
|
useDefault: !isTaskKeyQuery,
|
|
386
468
|
});
|
|
387
|
-
const limit =
|
|
469
|
+
const limit = parseListLimit(values.limit);
|
|
388
470
|
const result = task.search({
|
|
471
|
+
...parseDeadlineFilters(values),
|
|
389
472
|
query,
|
|
390
473
|
projectKey,
|
|
391
474
|
archive,
|
|
392
475
|
limit,
|
|
393
476
|
labelNames: values.label,
|
|
477
|
+
columnName: values.column,
|
|
394
478
|
});
|
|
395
|
-
|
|
479
|
+
const board = createColumnBoard();
|
|
480
|
+
output(result.tasks.map((taskMatch) => presentTask(taskMatch, board)), (presentedTasks) => formatTaskList(presentedTasks, { showsStatus: values.all }));
|
|
396
481
|
if (result.hiddenArchivedCount > 0) {
|
|
397
482
|
const count = result.hiddenArchivedCount;
|
|
398
483
|
const noun = count === 1 ? "match" : "matches";
|
|
@@ -409,8 +494,10 @@ Every word must match. Quote a query with several words.
|
|
|
409
494
|
A task-key query overrides the configured default project; a typed project key still filters it.
|
|
410
495
|
|
|
411
496
|
By default, only active tasks are searched. Use --archived to search archived tasks or --all to search both.
|
|
412
|
-
|
|
497
|
+
--limit <n>: ${listLimitDescription}
|
|
413
498
|
Repeat --label to require every specified label, ignoring case.
|
|
499
|
+
--column matches an exact column name. Column and label matching ignore case.
|
|
500
|
+
${deadlineFilterHelp}
|
|
414
501
|
|
|
415
502
|
Example: zinn task search 'refinement quota' MDR --limit 5`,
|
|
416
503
|
},
|
|
@@ -431,11 +518,10 @@ Example: zinn task search 'refinement quota' MDR --limit 5`,
|
|
|
431
518
|
validateUniqueOptions(tokens, taskInputs.view.options);
|
|
432
519
|
validatePositionals(positionals, taskInputs.view.forms[0]);
|
|
433
520
|
const taskMatch = task.getByKey(positionals[0]);
|
|
521
|
+
const board = createColumnBoard();
|
|
434
522
|
const detail = {
|
|
435
|
-
...presentTask(taskMatch),
|
|
436
|
-
|
|
437
|
-
updated_at: taskMatch.updated_at,
|
|
438
|
-
relations: presentRelations(taskMatch),
|
|
523
|
+
...presentTask(taskMatch, board),
|
|
524
|
+
relations: presentRelations(taskMatch, board),
|
|
439
525
|
comments: presentComments(taskMatch.key),
|
|
440
526
|
};
|
|
441
527
|
const viewedTask = values.history === true
|
|
@@ -469,7 +555,7 @@ Example: zinn task search 'refinement quota' MDR --limit 5`,
|
|
|
469
555
|
sections.push(formatSection("Comments", comments, sectionOptions));
|
|
470
556
|
}
|
|
471
557
|
if ("activity" in t) {
|
|
472
|
-
const history = formatActivityList(presentActivities(t.activity));
|
|
558
|
+
const history = formatActivityList(presentActivities(t.activity, { keysFromEventsOnly: true }));
|
|
473
559
|
if (history.length > 0) {
|
|
474
560
|
sections.push(formatSection("History", history, sectionOptions));
|
|
475
561
|
}
|
|
@@ -492,9 +578,46 @@ Without --history, JSON omits activity.
|
|
|
492
578
|
Examples:
|
|
493
579
|
zinn task view MDR-1
|
|
494
580
|
zinn task view MDR-1 --history`,
|
|
581
|
+
},
|
|
582
|
+
blame: {
|
|
583
|
+
summary: "Show the recorded authors of a task's current fields and description lines.",
|
|
584
|
+
effects: { domain: "read", storage: "normal-open" },
|
|
585
|
+
confirmation: { kind: "none" },
|
|
586
|
+
input: taskInputs.blame,
|
|
587
|
+
results: [jsonResult("TaskBlame")],
|
|
588
|
+
run: (args) => {
|
|
589
|
+
const { positionals } = parseArgs({
|
|
590
|
+
args,
|
|
591
|
+
options: taskInputs.blame.options,
|
|
592
|
+
allowPositionals: true,
|
|
593
|
+
strict: true,
|
|
594
|
+
});
|
|
595
|
+
validatePositionals(positionals, taskInputs.blame.forms[0]);
|
|
596
|
+
output(task.blame(positionals[0]), (blame) => {
|
|
597
|
+
const taskMatch = task.getByKey(blame.task.key);
|
|
598
|
+
const board = createColumnBoard();
|
|
599
|
+
return formatTaskBlame(blame, {
|
|
600
|
+
relations: presentRelations(taskMatch, board),
|
|
601
|
+
columnPlacement: columnPlacement(board(taskMatch.project_id), taskMatch.column_id),
|
|
602
|
+
isArchived: taskMatch.archived_at != null,
|
|
603
|
+
activityIdPrefixes: abbreviateActivityIds(activity.getIds()),
|
|
604
|
+
});
|
|
605
|
+
});
|
|
606
|
+
},
|
|
607
|
+
help: `${generateCommandUsage("task blame", taskInputs.blame)}
|
|
608
|
+
|
|
609
|
+
Show the recorded authors of a task's current fields, label membership, parent, relations and description lines.
|
|
610
|
+
Active and archived tasks are readable. A reused key selects its current task only.
|
|
611
|
+
Unchanged description lines keep their attribution through exact-line comparisons, including whitespace.
|
|
612
|
+
A terminal newline does not add a line or change its attribution. Missing history is unrecorded.
|
|
613
|
+
Recorded identities are kept as stored. Use activity view <activity-id> to inspect a recorded event.
|
|
614
|
+
With --json, fields contain value and nullable attribution, relations contain their attribution,
|
|
615
|
+
and description contains numbered text lines with nullable attribution.
|
|
616
|
+
|
|
617
|
+
Example: zinn task blame MDR-1`,
|
|
495
618
|
},
|
|
496
619
|
edit: {
|
|
497
|
-
summary: "Edit a task's title, description, priority, or label attachments.",
|
|
620
|
+
summary: "Edit a task's title, description, priority, deadline, or label attachments.",
|
|
498
621
|
effects: { domain: "update", storage: "normal-open" },
|
|
499
622
|
confirmation: { kind: "none" },
|
|
500
623
|
input: taskInputs.edit,
|
|
@@ -514,6 +637,7 @@ Examples:
|
|
|
514
637
|
taskKey,
|
|
515
638
|
title: values.title,
|
|
516
639
|
priority: parsePriority(values.priority),
|
|
640
|
+
due_at: parseDue(values.due),
|
|
517
641
|
addLabelNames: values["add-label"],
|
|
518
642
|
removeLabelNames: values["remove-label"],
|
|
519
643
|
};
|
|
@@ -521,14 +645,16 @@ Examples:
|
|
|
521
645
|
const description = await resolveTextEdit(values, "--description");
|
|
522
646
|
// Without a text source nothing was read, so this usage error still comes before any input.
|
|
523
647
|
if (violatesConstraint(taskEditConstraint, getOptionInputs(values))) {
|
|
524
|
-
quit("Provide at least one edit flag: --title, --description, --description-file, --priority, --add-label, or --remove-label", undefined, { field: [] });
|
|
648
|
+
quit("Provide at least one edit flag: --title, --description, --description-file, --priority, --due, --add-label, or --remove-label", undefined, { field: [] });
|
|
525
649
|
}
|
|
526
650
|
const editedTask = task.edit({ ...fields, description }, currentActor());
|
|
527
|
-
|
|
651
|
+
const board = createColumnBoard();
|
|
652
|
+
outputChanges([editedTask], (change) => presentTask(change.task, board), formatTaskList, (entry) => `${entry.key} was unchanged`);
|
|
528
653
|
},
|
|
529
654
|
help: `${generateCommandUsage("task edit", taskInputs.edit)}
|
|
530
655
|
|
|
531
|
-
Edit a task's title, description, priority, or label attachments.
|
|
656
|
+
Edit a task's title, description, priority, deadline, or label attachments.
|
|
657
|
+
${deadlineHelp}
|
|
532
658
|
Use --priority none to clear priority.
|
|
533
659
|
Priority values: ${priorityOption.value.choices.join(", ")}.
|
|
534
660
|
Provide at least one edit flag. Use --description '' to clear the description.
|
|
@@ -573,7 +699,8 @@ Examples:
|
|
|
573
699
|
const taskKeys = positionals.slice(0, -1);
|
|
574
700
|
const targetColumn = positionals.at(-1);
|
|
575
701
|
const moves = task.moveMany({ taskKeys, targetColumn }, currentActor());
|
|
576
|
-
|
|
702
|
+
const board = createColumnBoard();
|
|
703
|
+
outputChanges(moves, (change) => presentTask(change.task, board), formatTaskList, (movedTask) => `${movedTask.key} was already in the ${movedTask.column} column`);
|
|
577
704
|
},
|
|
578
705
|
help: `${generateCommandUsage("task move", taskInputs.move)}
|
|
579
706
|
|
|
@@ -614,7 +741,8 @@ Example: zinn task move MDR-1 MDR-2 'In Progress'`,
|
|
|
614
741
|
else {
|
|
615
742
|
orders = task.orderMany({ taskKeys, direction: form.direction }, currentActor());
|
|
616
743
|
}
|
|
617
|
-
|
|
744
|
+
const board = createColumnBoard();
|
|
745
|
+
outputChanges(orders, (change) => presentTask(change.task, board), formatTaskList, (entry) => `${entry.key} was already in that position`);
|
|
618
746
|
},
|
|
619
747
|
help: `${generateCommandUsage("task order", taskInputs.order)}
|
|
620
748
|
|
|
@@ -637,7 +765,8 @@ Example: zinn task order MDR-2 before MDR-1`,
|
|
|
637
765
|
run: (args) => {
|
|
638
766
|
const taskKeys = parseTaskKeys(args);
|
|
639
767
|
const archives = task.archiveMany(taskKeys, currentActor());
|
|
640
|
-
|
|
768
|
+
const board = createColumnBoard();
|
|
769
|
+
outputChanges(archives, (change) => presentTask(change.task, board), (entries) => formatTaskList(entries, { showsStatus: true }), (archivedTask) => `${archivedTask.key} was already archived`);
|
|
641
770
|
},
|
|
642
771
|
help: `${generateCommandUsage("task archive", taskInputs.archive)}
|
|
643
772
|
|
|
@@ -659,7 +788,8 @@ Example: zinn task archive MDR-1 MDR-2`,
|
|
|
659
788
|
run: (args) => {
|
|
660
789
|
const taskKeys = parseTaskKeys(args);
|
|
661
790
|
const unarchives = task.unarchiveMany(taskKeys, currentActor());
|
|
662
|
-
|
|
791
|
+
const board = createColumnBoard();
|
|
792
|
+
outputChanges(unarchives, (change) => presentTask(change.task, board), (entries) => formatTaskList(entries, { showsStatus: true }), (unarchivedTask) => `${unarchivedTask.key} was already active`);
|
|
663
793
|
},
|
|
664
794
|
help: `${generateCommandUsage("task unarchive", taskInputs.archive)}
|
|
665
795
|
|
|
@@ -693,7 +823,8 @@ Example: zinn task unarchive MDR-1 MDR-2`,
|
|
|
693
823
|
validatePositionals(positionals, taskInputs.delete.forms[0]);
|
|
694
824
|
const taskKeys = taskDeleteManySchema.parse(positionals);
|
|
695
825
|
const taskMatches = taskKeys.map((taskKey) => task.getByKey(taskKey));
|
|
696
|
-
const
|
|
826
|
+
const board = createColumnBoard();
|
|
827
|
+
const presented = taskMatches.map((taskMatch) => presentTask(taskMatch, board));
|
|
697
828
|
const canDelete = await confirmAction(`Are you sure you want to delete ${taskMatches.map((match) => match.key).join(", ")}?`, values.yes === true);
|
|
698
829
|
if (canDelete) {
|
|
699
830
|
task.deleteMany(taskKeys, currentActor());
|
|
@@ -723,7 +854,8 @@ Example: zinn task delete MDR-1 MDR-2`,
|
|
|
723
854
|
results: [jsonResult("TaskChange")],
|
|
724
855
|
run: (args) => {
|
|
725
856
|
const props = parseTaskLabelArgs(args);
|
|
726
|
-
|
|
857
|
+
const board = createColumnBoard();
|
|
858
|
+
outputChanges([task.label.add(props, currentActor())], (change) => presentTask(change.task, board), formatTaskList, (entry) => `${entry.key} already had those labels`);
|
|
727
859
|
},
|
|
728
860
|
help: `${generateCommandUsage("task label add", taskInputs.label_add)}
|
|
729
861
|
|
|
@@ -739,7 +871,8 @@ With --json, changed is false when all the labels were already attached.`,
|
|
|
739
871
|
results: [jsonResult("TaskChange")],
|
|
740
872
|
run: (args) => {
|
|
741
873
|
const props = parseTaskLabelArgs(args);
|
|
742
|
-
|
|
874
|
+
const board = createColumnBoard();
|
|
875
|
+
outputChanges([task.label.remove(props, currentActor())], (change) => presentTask(change.task, board), formatTaskList, (entry) => `${entry.key} had none of those labels`);
|
|
743
876
|
},
|
|
744
877
|
help: `${generateCommandUsage("task label remove", taskInputs.label_add)}
|
|
745
878
|
|
|
@@ -779,6 +912,18 @@ function parseNewTaskRelations(flags) {
|
|
|
779
912
|
];
|
|
780
913
|
return targetsByType.flatMap(([relation_type, targetTaskKeys]) => targetTaskKeys.map((targetTaskKey) => ({ relation_type, targetTaskKey })));
|
|
781
914
|
}
|
|
915
|
+
function parseDue(value) {
|
|
916
|
+
return value?.toLowerCase() === "none" ? null : parseTimestampInput(value, "--due");
|
|
917
|
+
}
|
|
918
|
+
function parseDeadlineFilters(values) {
|
|
919
|
+
const dueSince = parseTimestampInput(values["due-since"], "--due-since");
|
|
920
|
+
const dueUntil = parseTimestampInput(values["due-until"], "--due-until");
|
|
921
|
+
const hasReversedBounds = dueSince !== undefined && dueUntil !== undefined && dueSince > dueUntil;
|
|
922
|
+
if (hasReversedBounds) {
|
|
923
|
+
quit("--due-until must be at or after --due-since", undefined, { argument: "--due-until" });
|
|
924
|
+
}
|
|
925
|
+
return { dueSince, dueUntil };
|
|
926
|
+
}
|
|
782
927
|
function parsePriority(value) {
|
|
783
928
|
const normalizedPriority = value?.toLowerCase();
|
|
784
929
|
if (normalizedPriority === undefined) {
|
|
@@ -23,7 +23,7 @@ export const whoamiCommand = {
|
|
|
23
23
|
help: `${generateCommandUsage("whoami", noInput)}
|
|
24
24
|
|
|
25
25
|
Show the actor a change would record in the current environment and folder.
|
|
26
|
-
Includes name, email, kind, source, session, thread, agent, model and
|
|
26
|
+
Includes name, email, kind, source, session, thread, agent, model, effort and client.
|
|
27
27
|
Git identity is read from the current folder.
|
|
28
28
|
|
|
29
29
|
Works without reading settings or opening storage.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** The runtime's name and version, reported the same way by `zinn info`, failure logs and telemetry */
|
|
2
|
+
export declare function currentRuntime(): {
|
|
3
|
+
name: "Node";
|
|
4
|
+
version: string;
|
|
5
|
+
} | {
|
|
6
|
+
name: "Bun";
|
|
7
|
+
version: string;
|
|
8
|
+
};
|
|
9
|
+
/** When this process started and how long it has run, in milliseconds */
|
|
10
|
+
export declare function readRunClock(): {
|
|
11
|
+
now: Date;
|
|
12
|
+
elapsedMs: number;
|
|
13
|
+
startedAt: Date;
|
|
14
|
+
};
|
package/src/run-facts.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const MS_PER_SECOND = 1000;
|
|
2
|
+
/** The runtime's name and version, reported the same way by `zinn info`, failure logs and telemetry */
|
|
3
|
+
export function currentRuntime() {
|
|
4
|
+
const { bun, node } = process.versions;
|
|
5
|
+
return bun === undefined
|
|
6
|
+
? { name: "Node", version: node }
|
|
7
|
+
: { name: "Bun", version: bun };
|
|
8
|
+
}
|
|
9
|
+
/** When this process started and how long it has run, in milliseconds */
|
|
10
|
+
export function readRunClock() {
|
|
11
|
+
const elapsedMs = Math.round(process.uptime() * MS_PER_SECOND);
|
|
12
|
+
const now = new Date();
|
|
13
|
+
return { now, elapsedMs, startedAt: new Date(now.getTime() - elapsedMs) };
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { mkdirSync } from "node:fs";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a folder if its store exists.
|
|
4
|
+
* ! It never creates the store, which **read** commands avoid
|
|
5
|
+
*/
|
|
6
|
+
export function ensureFolderInStore(folder) {
|
|
7
|
+
try {
|
|
8
|
+
mkdirSync(folder);
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
const alreadyExists = error.code === "EEXIST";
|
|
12
|
+
if (!alreadyExists) {
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ClassifiedFailure } from "./errors.js";
|
|
2
|
+
import type { ParsedRoute } from "./types.js";
|
|
3
|
+
type RunOutcome = {
|
|
4
|
+
failure?: ClassifiedFailure;
|
|
5
|
+
logFileName?: string;
|
|
6
|
+
};
|
|
7
|
+
type UnmatchedRun = {
|
|
8
|
+
namespace: string;
|
|
9
|
+
unmatchedWord?: string;
|
|
10
|
+
help: boolean;
|
|
11
|
+
};
|
|
12
|
+
type MatchedRun = {
|
|
13
|
+
match: ParsedRoute;
|
|
14
|
+
typedRoute: string;
|
|
15
|
+
commandArgs: Array<string>;
|
|
16
|
+
help: boolean;
|
|
17
|
+
};
|
|
18
|
+
/** A successful run of a command that declares one of these only reads or reports, and leaves no record */
|
|
19
|
+
export declare const UNRECORDED_STORAGE_EFFECTS: ReadonlyArray<ParsedRoute["effects"]["storage"]>;
|
|
20
|
+
export declare function noteMatchedRun(run: MatchedRun): void;
|
|
21
|
+
/** An option-shaped word is left out of `unmatchedWord` because it can carry a value. `options` names it */
|
|
22
|
+
export declare function noteUnmatchedRun({ namespace, unmatchedWord, help }: UnmatchedRun): void;
|
|
23
|
+
export declare function noteParseArgsThrew(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Appends this run's record to the current record file in the store's `telemetry` folder.
|
|
26
|
+
* A run that starts a new file first deletes old ones, so the newest records are the ones kept.
|
|
27
|
+
* It never throws, so recording cannot change a run's result.
|
|
28
|
+
* Returns one sentence saying what went wrong, or undefined when nothing did or no record was due.
|
|
29
|
+
*/
|
|
30
|
+
export declare function writeRunRecord(outcome: RunOutcome): string | undefined;
|
|
31
|
+
export {};
|