@zinn-dev/cli 0.44.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 +7 -9
- package/src/actor.d.ts +1 -1
- package/src/actor.js +4 -1
- package/src/capabilities-schema.d.ts +9 -1
- package/src/column-hint.js +1 -3
- package/src/database.d.ts +1 -2
- package/src/database.js +1 -6
- package/src/duration-input.d.ts +7 -0
- package/src/duration-input.js +31 -0
- package/src/errors.d.ts +26 -0
- package/src/errors.js +46 -8
- package/src/expected-values.d.ts +48 -0
- package/src/expected-values.js +60 -0
- package/src/follow.d.ts +9 -0
- package/src/follow.js +58 -0
- package/src/input.d.ts +0 -8
- package/src/input.js +36 -16
- package/src/lib.d.ts +7 -3
- package/src/lib.js +70 -28
- package/src/list-continuation.js +1 -4
- package/src/presentation/activity-presentation.d.ts +2 -0
- package/src/presentation/activity-presentation.js +60 -3
- package/src/presentation/column-presentation.d.ts +9 -4
- package/src/presentation/column-presentation.js +29 -12
- package/src/presentation/doctor-presentation.d.ts +10 -0
- package/src/presentation/doctor-presentation.js +28 -0
- package/src/presentation/relation-presentation.js +2 -1
- 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 +2 -4
- package/src/presentation/task-blame-presentation.js +4 -2
- package/src/presentation/task-presentation.d.ts +18 -4
- package/src/presentation/task-presentation.js +94 -30
- package/src/result-schemas.d.ts +490 -58
- package/src/result-schemas.js +97 -2
- package/src/results.d.ts +6 -2
- package/src/results.js +9 -3
- package/src/routes/activity-router.d.ts +16 -5
- package/src/routes/activity-router.js +131 -70
- package/src/routes/aliases.js +1 -0
- 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 +29 -6
- package/src/routes/comment-router.js +20 -10
- package/src/routes/doctor-router.d.ts +40 -0
- package/src/routes/doctor-router.js +83 -0
- package/src/routes/info-router.d.ts +1 -0
- package/src/routes/info-router.js +1 -1
- package/src/routes/label-router.d.ts +44 -6
- package/src/routes/label-router.js +27 -10
- package/src/routes/migrate-router.d.ts +1 -0
- package/src/routes/migrate-router.js +5 -7
- package/src/routes/project-router.d.ts +70 -11
- package/src/routes/project-router.js +130 -56
- 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 +5 -6
- package/src/routes/router.js +5 -9
- package/src/routes/routes.d.ts +517 -35
- package/src/routes/routes.js +4 -0
- package/src/routes/skill-router.d.ts +76 -0
- package/src/routes/skill-router.js +179 -0
- package/src/routes/task-router.d.ts +264 -13
- package/src/routes/task-router.js +415 -93
- 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/text-edit.d.ts +2 -2
- package/src/text-input.d.ts +19 -1
- package/src/text-input.js +26 -5
- package/src/types.d.ts +4 -0
- package/src/types.js +6 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsonResult } from "../results.js";
|
|
2
2
|
import { parseArgs } from "node:util";
|
|
3
|
-
import { migrate,
|
|
3
|
+
import { migrate, DatabaseChangeAppliedError, MigrationRefusedError } from "@zinn-dev/core";
|
|
4
4
|
import { generateCommandUsage, noInput } from "../input.js";
|
|
5
5
|
import { reportLockWait } from "../database.js";
|
|
6
6
|
import { diagnostic, output, validatePositionals } from "../lib.js";
|
|
7
7
|
import packageJson from "../../package.json" with { type: "json" };
|
|
8
8
|
export const migrateCommand = {
|
|
9
9
|
summary: "Upgrade an existing database to the latest schema version.",
|
|
10
|
-
effects: { domain: "none", storage: "migrate" },
|
|
10
|
+
effects: { domain: "none", storage: "migrate", external: [] },
|
|
11
11
|
confirmation: { kind: "none" },
|
|
12
12
|
input: noInput,
|
|
13
13
|
results: [jsonResult("Migrate")],
|
|
@@ -19,8 +19,6 @@ export const migrateCommand = {
|
|
|
19
19
|
allowPositionals: true,
|
|
20
20
|
});
|
|
21
21
|
validatePositionals(positionals, noInput.forms[0]);
|
|
22
|
-
// Resolved before the try, so a store that cannot be resolved fails without the note about backups.
|
|
23
|
-
const { backupDirectory } = getBackupStorage();
|
|
24
22
|
try {
|
|
25
23
|
const result = migrate.run({
|
|
26
24
|
client: "cli",
|
|
@@ -32,9 +30,8 @@ export const migrateCommand = {
|
|
|
32
30
|
: `The database is already at schema version ${r.finalVersion}`);
|
|
33
31
|
}
|
|
34
32
|
catch (error) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
diagnostic(`The database is unchanged. Backups taken before each upgrade attempt are kept in ${backupDirectory}.`);
|
|
33
|
+
if (!(error instanceof MigrationRefusedError || error instanceof DatabaseChangeAppliedError)) {
|
|
34
|
+
diagnostic("The database is unchanged.");
|
|
38
35
|
}
|
|
39
36
|
throw error;
|
|
40
37
|
}
|
|
@@ -45,5 +42,6 @@ Upgrade an existing database to the latest schema version.
|
|
|
45
42
|
|
|
46
43
|
A backup is saved first, in the same place as \`zinn backup\`, and the upgrade is applied completely or not at all.
|
|
47
44
|
Does nothing when the database is already up to date.
|
|
45
|
+
Use this command to retry a paused automatic upgrade after fixing the cause of the failure.
|
|
48
46
|
Fails, leaving the database as it is, when there is no database with data yet, when it has no schema version, or when it is newer than this Zinn.`,
|
|
49
47
|
};
|
|
@@ -4,6 +4,7 @@ export declare const projectRouter: {
|
|
|
4
4
|
effects: {
|
|
5
5
|
domain: "create";
|
|
6
6
|
storage: "normal-open";
|
|
7
|
+
external: never[];
|
|
7
8
|
};
|
|
8
9
|
confirmation: {
|
|
9
10
|
kind: "none";
|
|
@@ -46,7 +47,7 @@ export declare const projectRouter: {
|
|
|
46
47
|
}];
|
|
47
48
|
readonly constraints: readonly [{
|
|
48
49
|
readonly kind: "exclusive";
|
|
49
|
-
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
50
|
+
readonly members: readonly ["option:description" | "option:text" | "option:expect-description" | "option:expect-text", "option:description-file" | "option:text-file" | "option:expect-description-file" | "option:expect-text-file"];
|
|
50
51
|
}];
|
|
51
52
|
};
|
|
52
53
|
results: import("../results.js").CommandResult[];
|
|
@@ -58,6 +59,7 @@ export declare const projectRouter: {
|
|
|
58
59
|
effects: {
|
|
59
60
|
domain: "read";
|
|
60
61
|
storage: "normal-open";
|
|
62
|
+
external: never[];
|
|
61
63
|
};
|
|
62
64
|
confirmation: {
|
|
63
65
|
kind: "none";
|
|
@@ -79,6 +81,7 @@ export declare const projectRouter: {
|
|
|
79
81
|
effects: {
|
|
80
82
|
domain: "read";
|
|
81
83
|
storage: "normal-open";
|
|
84
|
+
external: never[];
|
|
82
85
|
};
|
|
83
86
|
confirmation: {
|
|
84
87
|
kind: "none";
|
|
@@ -108,12 +111,35 @@ export declare const projectRouter: {
|
|
|
108
111
|
effects: {
|
|
109
112
|
domain: "update";
|
|
110
113
|
storage: "normal-open";
|
|
114
|
+
external: never[];
|
|
111
115
|
};
|
|
112
116
|
confirmation: {
|
|
113
117
|
kind: "none";
|
|
114
118
|
};
|
|
115
119
|
input: {
|
|
116
120
|
readonly options: {
|
|
121
|
+
readonly "expect-name": {
|
|
122
|
+
readonly type: "string";
|
|
123
|
+
readonly value: {
|
|
124
|
+
readonly kind: "text";
|
|
125
|
+
readonly name: "text";
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
readonly "expect-description": {
|
|
129
|
+
readonly type: "string";
|
|
130
|
+
readonly value: {
|
|
131
|
+
readonly kind: "text";
|
|
132
|
+
readonly name: "text";
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
readonly "expect-description-file": {
|
|
136
|
+
readonly type: "string";
|
|
137
|
+
readonly value: {
|
|
138
|
+
readonly kind: "path";
|
|
139
|
+
readonly name: "path";
|
|
140
|
+
readonly description: "A UTF-8 file, or \"-\" for stdin. Trailing line breaks are dropped; empty or blank input is an error.";
|
|
141
|
+
};
|
|
142
|
+
};
|
|
117
143
|
readonly append: {
|
|
118
144
|
readonly type: "boolean";
|
|
119
145
|
};
|
|
@@ -163,18 +189,18 @@ export declare const projectRouter: {
|
|
|
163
189
|
}];
|
|
164
190
|
readonly constraints: readonly [{
|
|
165
191
|
readonly kind: "exclusive";
|
|
166
|
-
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
192
|
+
readonly members: readonly ["option:description" | "option:text" | "option:expect-description" | "option:expect-text", "option:description-file" | "option:text-file" | "option:expect-description-file" | "option:expect-text-file"];
|
|
167
193
|
}, {
|
|
168
194
|
readonly kind: "exclusive";
|
|
169
195
|
readonly members: readonly ["option:append", "option:replacing"];
|
|
170
196
|
}, {
|
|
171
197
|
readonly kind: "requiresAny";
|
|
172
198
|
readonly input: "option:append";
|
|
173
|
-
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
199
|
+
readonly members: readonly ["option:description" | "option:text" | "option:expect-description" | "option:expect-text", "option:description-file" | "option:text-file" | "option:expect-description-file" | "option:expect-text-file"];
|
|
174
200
|
}, {
|
|
175
201
|
readonly kind: "requiresAny";
|
|
176
202
|
readonly input: "option:replacing";
|
|
177
|
-
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
203
|
+
readonly members: readonly ["option:description" | "option:text" | "option:expect-description" | "option:expect-text", "option:description-file" | "option:text-file" | "option:expect-description-file" | "option:expect-text-file"];
|
|
178
204
|
}, {
|
|
179
205
|
readonly kind: "requires";
|
|
180
206
|
readonly input: "option:all";
|
|
@@ -182,8 +208,11 @@ export declare const projectRouter: {
|
|
|
182
208
|
}, {
|
|
183
209
|
readonly kind: "atLeastOne";
|
|
184
210
|
readonly members: readonly ["option:name", "option:description", "option:description-file"];
|
|
185
|
-
}
|
|
186
|
-
|
|
211
|
+
}, ...{
|
|
212
|
+
readonly kind: "exclusive";
|
|
213
|
+
readonly members: readonly ["option:description" | "option:text" | "option:expect-description" | "option:expect-text", "option:description-file" | "option:text-file" | "option:expect-description-file" | "option:expect-text-file"];
|
|
214
|
+
}[]];
|
|
215
|
+
readonly notes: readonly ["Omit the project key to use defaultProject from settings; otherwise a project key is required.", string, string];
|
|
187
216
|
};
|
|
188
217
|
results: import("../results.js").CommandResult[];
|
|
189
218
|
run: (args: string[]) => Promise<void>;
|
|
@@ -194,6 +223,7 @@ export declare const projectRouter: {
|
|
|
194
223
|
effects: {
|
|
195
224
|
domain: "delete";
|
|
196
225
|
storage: "normal-open";
|
|
226
|
+
external: never[];
|
|
197
227
|
};
|
|
198
228
|
confirmation: {
|
|
199
229
|
kind: "project-delete";
|
|
@@ -229,12 +259,23 @@ export declare const projectRouter: {
|
|
|
229
259
|
effects: {
|
|
230
260
|
domain: "create";
|
|
231
261
|
storage: "normal-open";
|
|
262
|
+
external: never[];
|
|
232
263
|
};
|
|
233
264
|
confirmation: {
|
|
234
265
|
kind: "none";
|
|
235
266
|
};
|
|
236
267
|
input: {
|
|
237
|
-
readonly options: {
|
|
268
|
+
readonly options: {
|
|
269
|
+
readonly category: {
|
|
270
|
+
readonly required: true;
|
|
271
|
+
readonly type: "string";
|
|
272
|
+
readonly value: {
|
|
273
|
+
readonly kind: "enum";
|
|
274
|
+
readonly name: "category";
|
|
275
|
+
readonly choices: ("done" | "backlog" | "todo" | "in_progress" | "review" | "cancelled")[];
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
};
|
|
238
279
|
readonly forms: readonly [{
|
|
239
280
|
readonly id: "default";
|
|
240
281
|
readonly positionals: readonly [{
|
|
@@ -264,6 +305,7 @@ export declare const projectRouter: {
|
|
|
264
305
|
effects: {
|
|
265
306
|
domain: "read";
|
|
266
307
|
storage: "normal-open";
|
|
308
|
+
external: never[];
|
|
267
309
|
};
|
|
268
310
|
confirmation: {
|
|
269
311
|
kind: "none";
|
|
@@ -293,20 +335,32 @@ export declare const projectRouter: {
|
|
|
293
335
|
effects: {
|
|
294
336
|
domain: "update";
|
|
295
337
|
storage: "normal-open";
|
|
338
|
+
external: never[];
|
|
296
339
|
};
|
|
297
340
|
confirmation: {
|
|
298
|
-
kind: "
|
|
341
|
+
kind: "prompt";
|
|
342
|
+
description: string;
|
|
299
343
|
};
|
|
300
344
|
input: {
|
|
301
345
|
readonly options: {
|
|
302
346
|
readonly name: {
|
|
303
347
|
readonly type: "string";
|
|
304
|
-
readonly required: true;
|
|
305
348
|
readonly value: {
|
|
306
349
|
readonly kind: "text";
|
|
307
350
|
readonly name: "text";
|
|
308
351
|
};
|
|
309
352
|
};
|
|
353
|
+
readonly category: {
|
|
354
|
+
readonly type: "string";
|
|
355
|
+
readonly value: {
|
|
356
|
+
readonly kind: "enum";
|
|
357
|
+
readonly name: "category";
|
|
358
|
+
readonly choices: ("done" | "backlog" | "todo" | "in_progress" | "review" | "cancelled")[];
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
readonly yes: {
|
|
362
|
+
readonly type: "boolean";
|
|
363
|
+
};
|
|
310
364
|
};
|
|
311
365
|
readonly forms: readonly [{
|
|
312
366
|
readonly id: "default";
|
|
@@ -326,10 +380,13 @@ export declare const projectRouter: {
|
|
|
326
380
|
};
|
|
327
381
|
}];
|
|
328
382
|
}];
|
|
329
|
-
readonly constraints: readonly [
|
|
383
|
+
readonly constraints: readonly [{
|
|
384
|
+
readonly kind: "atLeastOne";
|
|
385
|
+
readonly members: readonly ["option:name", "option:category"];
|
|
386
|
+
}];
|
|
330
387
|
};
|
|
331
388
|
results: import("../results.js").CommandResult[];
|
|
332
|
-
run: (args: Array<string>) => void
|
|
389
|
+
run: (args: Array<string>) => Promise<void>;
|
|
333
390
|
help: string;
|
|
334
391
|
};
|
|
335
392
|
order: {
|
|
@@ -337,6 +394,7 @@ export declare const projectRouter: {
|
|
|
337
394
|
effects: {
|
|
338
395
|
domain: "update";
|
|
339
396
|
storage: "normal-open";
|
|
397
|
+
external: never[];
|
|
340
398
|
};
|
|
341
399
|
confirmation: {
|
|
342
400
|
kind: "none";
|
|
@@ -412,6 +470,7 @@ export declare const projectRouter: {
|
|
|
412
470
|
effects: {
|
|
413
471
|
domain: "delete";
|
|
414
472
|
storage: "normal-open";
|
|
473
|
+
external: never[];
|
|
415
474
|
};
|
|
416
475
|
confirmation: {
|
|
417
476
|
kind: "prompt";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsonResult } from "../results.js";
|
|
2
2
|
import { parseArgs } from "node:util";
|
|
3
|
-
import { column, project, columnOrderSchema, columnDeleteSchema, projectCreateSchema, projectEditSchema, } from "@zinn-dev/core";
|
|
3
|
+
import { column, project, readSnapshot, columnCategorySchema, columnOrderSchema, columnDeleteSchema, projectCreateSchema, projectEditSchema, } from "@zinn-dev/core";
|
|
4
4
|
import { CliError } from "../errors.js";
|
|
5
5
|
import { generateCommandUsage, getOptionInputs, noInput, violatesConstraint } from "../input.js";
|
|
6
6
|
import { confirmationDescription, canPrompt, confirmAction, dashValueHelp, diagnostic, output, outputChanges, quit, validatePositionals, validateOrderForms, requireStringOption, validateUniqueOptions, } from "../lib.js";
|
|
7
7
|
import { resolveTextEdit, textEditHelp, textEditOptions, textEditConstraints, } from "../text-edit.js";
|
|
8
|
-
import {
|
|
8
|
+
import { expectedValueFlags } from "../expected-values.js";
|
|
9
|
+
import { checkFieldsBeforeText, checkSingleStdinReader, resolveTextInput, textFileHelp, textFileOption, textSourceConstraint, } from "../text-input.js";
|
|
9
10
|
import { formatColumnList, presentColumn, presentColumnTaskCounts, } from "../presentation/column-presentation.js";
|
|
10
11
|
import { formatProjectList, presentProject } from "../presentation/project-presentation.js";
|
|
11
12
|
import { formatSection } from "../presentation/section.js";
|
|
@@ -15,6 +16,34 @@ const projectEditConstraint = {
|
|
|
15
16
|
kind: "atLeastOne",
|
|
16
17
|
members: ["option:name", "option:description", "option:description-file"],
|
|
17
18
|
};
|
|
19
|
+
const projectExpectations = expectedValueFlags({
|
|
20
|
+
name: { field: "name", option: { type: "string", value: { kind: "text", name: "text" } } },
|
|
21
|
+
description: { field: "description", text: true },
|
|
22
|
+
});
|
|
23
|
+
const columnCategoryOption = {
|
|
24
|
+
type: "string",
|
|
25
|
+
value: { kind: "enum", name: "category", choices: columnCategorySchema.options },
|
|
26
|
+
};
|
|
27
|
+
const columnCategoryValues = columnCategorySchema.options.join(", ");
|
|
28
|
+
const columnEditConstraint = {
|
|
29
|
+
kind: "atLeastOne",
|
|
30
|
+
members: ["option:name", "option:category"],
|
|
31
|
+
};
|
|
32
|
+
/** Asks before a category change that would change whether a column's tasks count as open or closed */
|
|
33
|
+
async function confirmCategoryChange(projectKey, columnName, category, isPreconfirmed) {
|
|
34
|
+
const columnMatch = column.getByName(projectKey, columnName);
|
|
35
|
+
const isSameCategory = columnMatch.category === category;
|
|
36
|
+
if (isPreconfirmed || isSameCategory) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
const { taskCount, archivedTaskCount } = column
|
|
40
|
+
.getTaskCountsByProjectKey(projectKey)
|
|
41
|
+
.columns.find((entry) => entry.column.id === columnMatch.id);
|
|
42
|
+
if (taskCount + archivedTaskCount === 0) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
return confirmAction(`Column "${columnMatch.name}" holds ${taskCount} active and ${archivedTaskCount} archived tasks. Change its category from ${columnMatch.category} to ${category}?`, false);
|
|
46
|
+
}
|
|
18
47
|
const projectInputs = {
|
|
19
48
|
create: {
|
|
20
49
|
options: {
|
|
@@ -48,6 +77,7 @@ const projectInputs = {
|
|
|
48
77
|
description: { type: "string", value: { kind: "text", name: "text" } },
|
|
49
78
|
"description-file": textFileOption,
|
|
50
79
|
...textEditOptions,
|
|
80
|
+
...projectExpectations.options,
|
|
51
81
|
},
|
|
52
82
|
forms: [
|
|
53
83
|
{
|
|
@@ -59,8 +89,9 @@ const projectInputs = {
|
|
|
59
89
|
textSourceConstraint("--description"),
|
|
60
90
|
...textEditConstraints("--description"),
|
|
61
91
|
projectEditConstraint,
|
|
92
|
+
...projectExpectations.constraints,
|
|
62
93
|
],
|
|
63
|
-
notes: [requiredProjectDescription, textEditHelp("--description")],
|
|
94
|
+
notes: [requiredProjectDescription, textEditHelp("--description"), projectExpectations.help],
|
|
64
95
|
},
|
|
65
96
|
delete: {
|
|
66
97
|
options: { yes: { type: "boolean" } },
|
|
@@ -74,7 +105,7 @@ const projectInputs = {
|
|
|
74
105
|
notes: [requiredProjectDescription],
|
|
75
106
|
},
|
|
76
107
|
column_create: {
|
|
77
|
-
options: {},
|
|
108
|
+
options: { category: { ...columnCategoryOption, required: true } },
|
|
78
109
|
forms: [
|
|
79
110
|
{
|
|
80
111
|
id: "default",
|
|
@@ -98,7 +129,11 @@ const projectInputs = {
|
|
|
98
129
|
notes: [requiredProjectDescription],
|
|
99
130
|
},
|
|
100
131
|
column_edit: {
|
|
101
|
-
options: {
|
|
132
|
+
options: {
|
|
133
|
+
name: { type: "string", value: { kind: "text", name: "text" } },
|
|
134
|
+
category: columnCategoryOption,
|
|
135
|
+
yes: { type: "boolean" },
|
|
136
|
+
},
|
|
102
137
|
forms: [
|
|
103
138
|
{
|
|
104
139
|
id: "default",
|
|
@@ -108,7 +143,7 @@ const projectInputs = {
|
|
|
108
143
|
],
|
|
109
144
|
},
|
|
110
145
|
],
|
|
111
|
-
constraints: [],
|
|
146
|
+
constraints: [columnEditConstraint],
|
|
112
147
|
},
|
|
113
148
|
column_delete: {
|
|
114
149
|
options: { yes: { type: "boolean" } },
|
|
@@ -160,7 +195,7 @@ const projectInputs = {
|
|
|
160
195
|
export const projectRouter = {
|
|
161
196
|
create: {
|
|
162
197
|
summary: "Create a project with the default columns.",
|
|
163
|
-
effects: { domain: "create", storage: "normal-open" },
|
|
198
|
+
effects: { domain: "create", storage: "normal-open", external: [] },
|
|
164
199
|
confirmation: { kind: "none" },
|
|
165
200
|
input: projectInputs.create,
|
|
166
201
|
results: [jsonResult("Project")],
|
|
@@ -201,7 +236,7 @@ Example: zinn project create MDR --name 'Macrodata Refinement'`,
|
|
|
201
236
|
},
|
|
202
237
|
list: {
|
|
203
238
|
summary: "List projects with active and archived task counts.",
|
|
204
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
239
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
205
240
|
confirmation: { kind: "none" },
|
|
206
241
|
input: projectInputs.list,
|
|
207
242
|
results: [jsonResult("ProjectList")],
|
|
@@ -228,7 +263,7 @@ Example: zinn project list`,
|
|
|
228
263
|
},
|
|
229
264
|
view: {
|
|
230
265
|
summary: "Show a project with its description and the number of tasks in each column.",
|
|
231
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
266
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
232
267
|
confirmation: { kind: "none" },
|
|
233
268
|
input: projectInputs.view,
|
|
234
269
|
results: [jsonResult("ProjectView")],
|
|
@@ -240,17 +275,21 @@ Example: zinn project list`,
|
|
|
240
275
|
strict: true,
|
|
241
276
|
});
|
|
242
277
|
validatePositionals(positionals, projectInputs.view.forms[0]);
|
|
243
|
-
const
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
278
|
+
const projectChoice = chooseProjectKey(positionals[0], { required: true });
|
|
279
|
+
const projectKey = projectChoice.key;
|
|
280
|
+
const presentedProject = readSnapshot(() => {
|
|
281
|
+
checkDefaultProject(projectChoice);
|
|
282
|
+
const projectMatch = project.getByKey(projectKey);
|
|
283
|
+
if (projectMatch == null) {
|
|
284
|
+
throw new CliError(`Project with key "${project.standardizeKey(projectKey)}" does not exist`, "not_found", { entity: "project", key: project.standardizeKey(projectKey), source: "explicit" });
|
|
285
|
+
}
|
|
286
|
+
const taskCounts = column.getTaskCountsByProjectKey(projectMatch.key);
|
|
287
|
+
return {
|
|
288
|
+
...presentProject(projectMatch),
|
|
289
|
+
columns: presentColumnTaskCounts(taskCounts),
|
|
290
|
+
archivedTaskCount: taskCounts.archivedTaskCount,
|
|
291
|
+
};
|
|
292
|
+
});
|
|
254
293
|
output(presentedProject, (viewedProject) => {
|
|
255
294
|
// The full description follows as its own section, so the row leaves out the preview.
|
|
256
295
|
const sections = [formatProjectList([viewedProject], { showsDescriptionPreview: false })];
|
|
@@ -277,7 +316,7 @@ Example: zinn project view MDR`,
|
|
|
277
316
|
},
|
|
278
317
|
edit: {
|
|
279
318
|
summary: "Change the supplied project fields. At least one edit flag is required.",
|
|
280
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
319
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
281
320
|
confirmation: { kind: "none" },
|
|
282
321
|
input: projectInputs.edit,
|
|
283
322
|
results: [jsonResult("ProjectChange")],
|
|
@@ -292,10 +331,13 @@ Example: zinn project view MDR`,
|
|
|
292
331
|
validateUniqueOptions(tokens, projectInputs.edit.options);
|
|
293
332
|
validatePositionals(positionals, projectInputs.edit.forms[0]);
|
|
294
333
|
const projectChoice = chooseProjectKey(positionals[0], { required: true });
|
|
334
|
+
const expected = projectExpectations.parseValues(values);
|
|
295
335
|
checkFieldsBeforeText(projectEditSchema, {
|
|
296
336
|
projectKey: projectChoice.key,
|
|
297
337
|
name: values.name,
|
|
338
|
+
expected,
|
|
298
339
|
});
|
|
340
|
+
checkSingleStdinReader(values, ["--description", ...projectExpectations.textFlags]);
|
|
299
341
|
const description = await resolveTextEdit(values, "--description");
|
|
300
342
|
// Without a text source nothing was read, so this usage error still comes before any input
|
|
301
343
|
if (violatesConstraint(projectEditConstraint, getOptionInputs(values))) {
|
|
@@ -304,7 +346,13 @@ Example: zinn project view MDR`,
|
|
|
304
346
|
});
|
|
305
347
|
}
|
|
306
348
|
checkDefaultProject(projectChoice);
|
|
307
|
-
const
|
|
349
|
+
const expectedText = await projectExpectations.resolveText(values);
|
|
350
|
+
const editedProject = project.edit({
|
|
351
|
+
projectKey: projectChoice.key,
|
|
352
|
+
name: values.name,
|
|
353
|
+
description,
|
|
354
|
+
expected: { ...expected, ...expectedText },
|
|
355
|
+
}, currentActor());
|
|
308
356
|
outputChanges([editedProject], (change) => presentProject(change.project), formatProjectList, (entry) => `Project ${entry.key} was unchanged`);
|
|
309
357
|
},
|
|
310
358
|
help: `${generateCommandUsage("project edit", projectInputs.edit)}
|
|
@@ -317,15 +365,18 @@ ${textFileHelp("--description")}
|
|
|
317
365
|
|
|
318
366
|
${textEditHelp("--description")}
|
|
319
367
|
|
|
368
|
+
${projectExpectations.help}
|
|
369
|
+
|
|
320
370
|
${dashValueHelp("--description")}
|
|
321
371
|
|
|
322
372
|
Examples:
|
|
323
373
|
zinn project edit MDR --name 'Macrodata Refinement'
|
|
324
|
-
zinn project edit MDR --description database --replacing board --all
|
|
374
|
+
zinn project edit MDR --description database --replacing board --all
|
|
375
|
+
zinn project edit MDR --name 'Macrodata Refinement' --expect-name 'Macrodata'`,
|
|
325
376
|
},
|
|
326
377
|
delete: {
|
|
327
378
|
summary: "Permanently delete a project and all of its columns and tasks after confirmation.",
|
|
328
|
-
effects: { domain: "delete", storage: "normal-open" },
|
|
379
|
+
effects: { domain: "delete", storage: "normal-open", external: [] },
|
|
329
380
|
confirmation: {
|
|
330
381
|
kind: "project-delete",
|
|
331
382
|
description: `${confirmationDescription} When the project key is omitted, deleting the configured default project always requires a terminal prompt; --yes is ignored.`,
|
|
@@ -388,38 +439,43 @@ Example: zinn project delete MDR`,
|
|
|
388
439
|
column: {
|
|
389
440
|
create: {
|
|
390
441
|
summary: "Add a column at the end of a project's board.",
|
|
391
|
-
effects: { domain: "create", storage: "normal-open" },
|
|
442
|
+
effects: { domain: "create", storage: "normal-open", external: [] },
|
|
392
443
|
confirmation: { kind: "none" },
|
|
393
444
|
input: projectInputs.column_create,
|
|
394
445
|
results: [jsonResult("Column")],
|
|
395
446
|
run: (args) => {
|
|
396
|
-
const { positionals } = parseArgs({
|
|
447
|
+
const { values, positionals, tokens } = parseArgs({
|
|
397
448
|
options: projectInputs.column_create.options,
|
|
398
449
|
args,
|
|
399
450
|
allowPositionals: true,
|
|
400
451
|
strict: true,
|
|
452
|
+
tokens: true,
|
|
401
453
|
});
|
|
454
|
+
validateUniqueOptions(tokens, projectInputs.column_create.options);
|
|
402
455
|
validatePositionals(positionals, projectInputs.column_create.forms[0]);
|
|
403
|
-
const
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
throw err;
|
|
411
|
-
}
|
|
456
|
+
const category = requireStringOption(projectInputs.column_create.options.category, values.category, "category", `Provide the column's category with --category: ${columnCategoryValues}`);
|
|
457
|
+
const createdColumn = column.create({
|
|
458
|
+
projectKey: positionals[0],
|
|
459
|
+
name: positionals[1],
|
|
460
|
+
category: category,
|
|
461
|
+
}, currentActor());
|
|
462
|
+
output(presentColumn(createdColumn), (entry) => formatColumnList([entry], { showsProject: true }));
|
|
412
463
|
},
|
|
413
464
|
help: `${generateCommandUsage("project column create", projectInputs.column_create)}
|
|
414
465
|
|
|
415
466
|
Add a column at the end of a project's board.
|
|
416
467
|
Names are trimmed, cannot be blank or contain line breaks or control characters, and must be unique within the project regardless of casing.
|
|
417
468
|
|
|
418
|
-
|
|
469
|
+
--category is required and says what the column's tasks are to Zinn, whatever the column is called.
|
|
470
|
+
Category values: ${columnCategoryValues}.
|
|
471
|
+
Tasks in done and cancelled columns are closed: task next skips them, and they no longer block tasks that depend on them.
|
|
472
|
+
task next hands out tasks in todo columns, then backlog columns.
|
|
473
|
+
|
|
474
|
+
Example: zinn project column create MDR Boardlog --category backlog`,
|
|
419
475
|
},
|
|
420
476
|
list: {
|
|
421
477
|
summary: "List a project's columns in board order with their unarchived task counts.",
|
|
422
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
478
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
423
479
|
confirmation: { kind: "none" },
|
|
424
480
|
input: projectInputs.column_list,
|
|
425
481
|
results: [jsonResult("ColumnList")],
|
|
@@ -431,8 +487,11 @@ Example: zinn project column create MDR Boardlog`,
|
|
|
431
487
|
strict: true,
|
|
432
488
|
});
|
|
433
489
|
validatePositionals(positionals, projectInputs.column_list.forms[0]);
|
|
434
|
-
const
|
|
435
|
-
const columns =
|
|
490
|
+
const projectChoice = chooseProjectKey(positionals[0], { required: true });
|
|
491
|
+
const columns = readSnapshot(() => {
|
|
492
|
+
checkDefaultProject(projectChoice);
|
|
493
|
+
return presentColumnTaskCounts(column.getTaskCountsByProjectKey(projectChoice.key));
|
|
494
|
+
});
|
|
436
495
|
output(columns, (presentedColumns) => formatColumnList(presentedColumns, {
|
|
437
496
|
showsTaskCounts: true,
|
|
438
497
|
}));
|
|
@@ -445,12 +504,15 @@ ${requiredProjectDescription}
|
|
|
445
504
|
Example: zinn project column list MDR`,
|
|
446
505
|
},
|
|
447
506
|
edit: {
|
|
448
|
-
summary: "Rename a column.",
|
|
449
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
450
|
-
confirmation: {
|
|
507
|
+
summary: "Rename a column or change its category.",
|
|
508
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
509
|
+
confirmation: {
|
|
510
|
+
kind: "prompt",
|
|
511
|
+
description: `Only asks when changing the category of a column that holds tasks. ${confirmationDescription}`,
|
|
512
|
+
},
|
|
451
513
|
input: projectInputs.column_edit,
|
|
452
514
|
results: [jsonResult("ColumnChange")],
|
|
453
|
-
run: (args) => {
|
|
515
|
+
run: async (args) => {
|
|
454
516
|
const { values, positionals, tokens } = parseArgs({
|
|
455
517
|
args,
|
|
456
518
|
options: projectInputs.column_edit.options,
|
|
@@ -460,19 +522,29 @@ Example: zinn project column list MDR`,
|
|
|
460
522
|
});
|
|
461
523
|
validateUniqueOptions(tokens, projectInputs.column_edit.options);
|
|
462
524
|
validatePositionals(positionals, projectInputs.column_edit.forms[0]);
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
525
|
+
if (violatesConstraint(columnEditConstraint, getOptionInputs(values))) {
|
|
526
|
+
quit("Provide an edit flag: --name or --category", undefined, { field: [] });
|
|
527
|
+
}
|
|
528
|
+
const projectKey = positionals[0];
|
|
529
|
+
const columnName = positionals[1];
|
|
530
|
+
const category = values.category;
|
|
531
|
+
if (category !== undefined) {
|
|
532
|
+
const isConfirmed = await confirmCategoryChange(projectKey, columnName, category, values.yes === true);
|
|
533
|
+
if (!isConfirmed) {
|
|
534
|
+
diagnostic("Column edit cancelled");
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
const editedColumn = column.edit({ projectKey, columnName, name: values.name, category }, currentActor());
|
|
469
539
|
outputChanges([editedColumn], (change) => presentColumn(change.column), (entries) => formatColumnList(entries, { showsProject: true }), (entry) => `Column "${entry.name}" was unchanged`);
|
|
470
540
|
},
|
|
471
541
|
help: `${generateCommandUsage("project column edit", projectInputs.column_edit)}
|
|
472
542
|
|
|
473
|
-
Rename a column.
|
|
474
|
-
|
|
475
|
-
|
|
543
|
+
Rename a column, change its category, or both.
|
|
544
|
+
Provide --name, --category or both.
|
|
545
|
+
Category values: ${columnCategoryValues}.
|
|
546
|
+
Changing the category of a column that holds tasks, active or archived, asks first: it changes which of them count as open or closed. Use --yes to change it without a prompt, including with --json or without a terminal.
|
|
547
|
+
With --json, changed is false when the name and category already match.
|
|
476
548
|
|
|
477
549
|
Columns are matched by name, and matching is case-insensitive.
|
|
478
550
|
Names are trimmed, and must remain unique within the same project.
|
|
@@ -480,11 +552,13 @@ Changing only the casing of a column's own name is allowed.
|
|
|
480
552
|
|
|
481
553
|
${dashValueHelp("--name")}
|
|
482
554
|
|
|
483
|
-
|
|
555
|
+
Examples:
|
|
556
|
+
zinn project column edit MDR Doing --name Refining
|
|
557
|
+
zinn project column edit MDR Shipped --category done --yes`,
|
|
484
558
|
},
|
|
485
559
|
order: {
|
|
486
560
|
summary: "Change a column's position on the project's board.",
|
|
487
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
561
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
488
562
|
confirmation: { kind: "none" },
|
|
489
563
|
input: projectInputs.column_order,
|
|
490
564
|
results: [jsonResult("ColumnChange")],
|
|
@@ -522,11 +596,11 @@ Columns are matched by name, and matching is case-insensitive.
|
|
|
522
596
|
Ordering to the current position, or before or after itself, leaves the column unchanged.
|
|
523
597
|
With --json, changed is false when the column was already in that position.
|
|
524
598
|
|
|
525
|
-
Example: zinn project column order MDR Review before
|
|
599
|
+
Example: zinn project column order MDR Review before Doing`,
|
|
526
600
|
},
|
|
527
601
|
delete: {
|
|
528
602
|
summary: "Delete an empty project column after confirmation.",
|
|
529
|
-
effects: { domain: "delete", storage: "normal-open" },
|
|
603
|
+
effects: { domain: "delete", storage: "normal-open", external: [] },
|
|
530
604
|
confirmation: { kind: "prompt", description: confirmationDescription },
|
|
531
605
|
input: projectInputs.column_delete,
|
|
532
606
|
results: [jsonResult("Column")],
|
|
@@ -6,7 +6,7 @@ import { generateCommandUsage, noInput } from "../input.js";
|
|
|
6
6
|
import { output, validatePositionals } from "../lib.js";
|
|
7
7
|
export const reindexCommand = {
|
|
8
8
|
summary: "Rebuild the search index that `zinn task search` uses from the tasks and their comments, archived tasks included.",
|
|
9
|
-
effects: { domain: "none", storage: "reindex" },
|
|
9
|
+
effects: { domain: "none", storage: "reindex", external: [] },
|
|
10
10
|
confirmation: { kind: "none" },
|
|
11
11
|
input: noInput,
|
|
12
12
|
results: [jsonResult("Reindex")],
|