@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
|
@@ -4,6 +4,7 @@ export declare const commentRouter: {
|
|
|
4
4
|
effects: {
|
|
5
5
|
domain: "create";
|
|
6
6
|
storage: "normal-open";
|
|
7
|
+
external: never[];
|
|
7
8
|
};
|
|
8
9
|
confirmation: {
|
|
9
10
|
kind: "none";
|
|
@@ -57,6 +58,7 @@ export declare const commentRouter: {
|
|
|
57
58
|
effects: {
|
|
58
59
|
domain: "read";
|
|
59
60
|
storage: "normal-open";
|
|
61
|
+
external: never[];
|
|
60
62
|
};
|
|
61
63
|
confirmation: {
|
|
62
64
|
kind: "none";
|
|
@@ -85,6 +87,7 @@ export declare const commentRouter: {
|
|
|
85
87
|
effects: {
|
|
86
88
|
domain: "read";
|
|
87
89
|
storage: "normal-open";
|
|
90
|
+
external: never[];
|
|
88
91
|
};
|
|
89
92
|
confirmation: {
|
|
90
93
|
kind: "none";
|
|
@@ -113,6 +116,7 @@ export declare const commentRouter: {
|
|
|
113
116
|
effects: {
|
|
114
117
|
domain: "update";
|
|
115
118
|
storage: "normal-open";
|
|
119
|
+
external: never[];
|
|
116
120
|
};
|
|
117
121
|
confirmation: {
|
|
118
122
|
kind: "none";
|
|
@@ -213,6 +217,7 @@ export declare const commentRouter: {
|
|
|
213
217
|
effects: {
|
|
214
218
|
domain: "delete";
|
|
215
219
|
storage: "normal-open";
|
|
220
|
+
external: never[];
|
|
216
221
|
};
|
|
217
222
|
confirmation: {
|
|
218
223
|
kind: "prompt";
|
|
@@ -121,7 +121,7 @@ const commentInputs = {
|
|
|
121
121
|
export const commentRouter = {
|
|
122
122
|
create: {
|
|
123
123
|
summary: "Add a comment to a task. Comment text cannot be blank.",
|
|
124
|
-
effects: { domain: "create", storage: "normal-open" },
|
|
124
|
+
effects: { domain: "create", storage: "normal-open", external: [] },
|
|
125
125
|
confirmation: { kind: "none" },
|
|
126
126
|
input: commentInputs.create,
|
|
127
127
|
results: [jsonResult("Comment")],
|
|
@@ -151,7 +151,7 @@ Example: zinn task comment create MDR-1 --text 'Ready for review'`,
|
|
|
151
151
|
},
|
|
152
152
|
list: {
|
|
153
153
|
summary: "List a task's comments by oldest first.",
|
|
154
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
154
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
155
155
|
confirmation: { kind: "none" },
|
|
156
156
|
input: commentInputs.list,
|
|
157
157
|
results: [jsonResult("CommentList")],
|
|
@@ -173,7 +173,7 @@ Example: zinn task comment list MDR-1`,
|
|
|
173
173
|
},
|
|
174
174
|
view: {
|
|
175
175
|
summary: "Show a comment's current text in full, keeping its line breaks.",
|
|
176
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
176
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
177
177
|
confirmation: { kind: "none" },
|
|
178
178
|
input: commentInputs.view,
|
|
179
179
|
results: [jsonResult("Comment")],
|
|
@@ -197,7 +197,7 @@ Example: zinn task comment view 'MDR-1#1'`,
|
|
|
197
197
|
},
|
|
198
198
|
edit: {
|
|
199
199
|
summary: "Replace a comment's text. Comment text cannot be blank.",
|
|
200
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
200
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
201
201
|
confirmation: { kind: "none" },
|
|
202
202
|
input: commentInputs.edit,
|
|
203
203
|
results: [jsonResult("CommentChange")],
|
|
@@ -234,7 +234,7 @@ Examples:
|
|
|
234
234
|
},
|
|
235
235
|
delete: {
|
|
236
236
|
summary: "Permanently delete a comment after confirmation.",
|
|
237
|
-
effects: { domain: "delete", storage: "normal-open" },
|
|
237
|
+
effects: { domain: "delete", storage: "normal-open", external: [] },
|
|
238
238
|
confirmation: { kind: "prompt", description: confirmationDescription },
|
|
239
239
|
input: commentInputs.delete,
|
|
240
240
|
results: [jsonResult("Comment")],
|
|
@@ -1,62 +1,36 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
1
|
import { homedir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
2
|
import { parseArgs } from "node:util";
|
|
5
|
-
import { doctor
|
|
3
|
+
import { doctor } from "@zinn-dev/core";
|
|
6
4
|
import { generateCommandUsage, noInput } from "../input.js";
|
|
7
5
|
import { output, validatePositionals } from "../lib.js";
|
|
8
6
|
import { jsonResult } from "../results.js";
|
|
9
7
|
import { formatDoctor, presentDoctor } from "../presentation/doctor-presentation.js";
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
const REVIEWED_VERSION_PATTERN = /^metadata:[ \t]*\r?\n(?:[ \t]+.*\r?\n)*?[ \t]+zinn-cli-reviewed-version:[ \t]*(?:"([^"\r\n]*)"|'([^'\r\n]*)'|([^\s#'"]+))/m;
|
|
22
|
-
/** A skill file's reviewed CLI version, `null` when the file has none that can be read */
|
|
23
|
-
function readReviewedVersion(skill) {
|
|
24
|
-
const frontmatter = FRONTMATTER_PATTERN.exec(skill)?.[1];
|
|
25
|
-
if (frontmatter === undefined) {
|
|
26
|
-
return null;
|
|
8
|
+
import { describeSkillCopy } from "../presentation/skill-status-presentation.js";
|
|
9
|
+
import { findSkillCopies, skillInstallCommand } from "../skill-copies.js";
|
|
10
|
+
/** How to replace the differing copies, by where they are */
|
|
11
|
+
function skillInstallRemedy(differing, workingFolder) {
|
|
12
|
+
const hasHomeCopy = differing.some(({ scope }) => scope === "home");
|
|
13
|
+
const hasProjectCopy = differing.some(({ scope }) => scope === "project");
|
|
14
|
+
const homeCommand = skillInstallCommand("home", workingFolder);
|
|
15
|
+
const projectCommand = skillInstallCommand("project", workingFolder);
|
|
16
|
+
if (hasHomeCopy && hasProjectCopy) {
|
|
17
|
+
return `Update the skill with ${homeCommand}, and with ${projectCommand}`;
|
|
27
18
|
}
|
|
28
|
-
|
|
29
|
-
if (match === null) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
return match[1] ?? match[2] ?? match[3] ?? null;
|
|
19
|
+
return `Update the skill with ${hasProjectCopy ? projectCommand : homeCommand}`;
|
|
33
20
|
}
|
|
34
21
|
function checkAgentSkill() {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
skill = readFileSync(path, "utf8");
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
if (isMissingFileError(error)) {
|
|
42
|
-
return {
|
|
43
|
-
id: "agent_skill",
|
|
44
|
-
status: "ok",
|
|
45
|
-
message: "No Zinn skill is installed for agents",
|
|
46
|
-
remedy: null,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
22
|
+
const workingFolder = process.cwd();
|
|
23
|
+
const { bundledVersion, copies } = findSkillCopies(homedir(), workingFolder);
|
|
24
|
+
if (copies.length === 0) {
|
|
49
25
|
return {
|
|
50
26
|
id: "agent_skill",
|
|
51
|
-
status: "
|
|
52
|
-
message:
|
|
53
|
-
remedy:
|
|
27
|
+
status: "ok",
|
|
28
|
+
message: "No Zinn skill is installed for agents",
|
|
29
|
+
remedy: null,
|
|
54
30
|
};
|
|
55
31
|
}
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
const bundledVersion = readReviewedVersion(readFileSync(join(bundledSkillDirectory, SKILL_FILE_NAME), "utf8"));
|
|
59
|
-
if (reviewedVersion !== null && reviewedVersion === bundledVersion) {
|
|
32
|
+
const differing = copies.filter(({ matches }) => !matches);
|
|
33
|
+
if (differing.length === 0) {
|
|
60
34
|
return {
|
|
61
35
|
id: "agent_skill",
|
|
62
36
|
status: "ok",
|
|
@@ -64,19 +38,25 @@ function checkAgentSkill() {
|
|
|
64
38
|
remedy: null,
|
|
65
39
|
};
|
|
66
40
|
}
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
41
|
+
const [first, ...others] = differing.map((copy) => `at ${copy.path} ${describeSkillCopy(copy)}`);
|
|
42
|
+
const differences = [
|
|
43
|
+
`The installed Zinn skill ${first}`,
|
|
44
|
+
...others.map((difference) => `the one ${difference}`),
|
|
45
|
+
];
|
|
46
|
+
const isOnlyUnreadable = differing.every(({ readable }) => !readable);
|
|
47
|
+
if (!isOnlyUnreadable) {
|
|
48
|
+
differences.push(`and the skill this CLI installs was reviewed for CLI ${bundledVersion}`);
|
|
49
|
+
}
|
|
70
50
|
return {
|
|
71
51
|
id: "agent_skill",
|
|
72
52
|
status: "warning",
|
|
73
|
-
message:
|
|
74
|
-
remedy:
|
|
53
|
+
message: differences.join(", "),
|
|
54
|
+
remedy: skillInstallRemedy(differing, workingFolder),
|
|
75
55
|
};
|
|
76
56
|
}
|
|
77
57
|
export const doctorCommand = {
|
|
78
58
|
summary: "Check the selected settings, database and installed agent skill for problems.",
|
|
79
|
-
effects: { domain: "none", storage: "inspect" },
|
|
59
|
+
effects: { domain: "none", storage: "inspect", external: [] },
|
|
80
60
|
confirmation: { kind: "none" },
|
|
81
61
|
input: noInput,
|
|
82
62
|
results: [{ ...jsonResult("Doctor"), findingsExitCode: 1 }],
|
|
@@ -96,7 +76,7 @@ export const doctorCommand = {
|
|
|
96
76
|
},
|
|
97
77
|
help: `${generateCommandUsage("doctor", noInput)}
|
|
98
78
|
|
|
99
|
-
Check the selected settings, store folder, database, search index and
|
|
79
|
+
Check the selected settings, store folder, database, search index and the Zinn agent skill copies in the home and working folders for problems, and suggest a fix for each.
|
|
100
80
|
|
|
101
81
|
Exits 0 when every check is ok and 1 when any reports a warning or problem. The checks print on standard output either way.
|
|
102
82
|
Changes nothing: it creates no folder, database or settings file, and repairs nothing. SQLite may perform its normal file housekeeping.`,
|
|
@@ -6,7 +6,7 @@ import { output, validatePositionals } from "../lib.js";
|
|
|
6
6
|
import { formatInfo, presentInfo } from "../presentation/info-presentation.js";
|
|
7
7
|
export const infoCommand = {
|
|
8
8
|
summary: "Show the selected store, settings sources, telemetry state, database schema state and CLI, core and runtime versions.",
|
|
9
|
-
effects: { domain: "none", storage: "inspect" },
|
|
9
|
+
effects: { domain: "none", storage: "inspect", external: [] },
|
|
10
10
|
confirmation: { kind: "none" },
|
|
11
11
|
input: noInput,
|
|
12
12
|
results: [jsonResult("Info")],
|
|
@@ -4,6 +4,7 @@ export declare const labelRouter: {
|
|
|
4
4
|
effects: {
|
|
5
5
|
domain: "create";
|
|
6
6
|
storage: "normal-open";
|
|
7
|
+
external: never[];
|
|
7
8
|
};
|
|
8
9
|
confirmation: {
|
|
9
10
|
kind: "none";
|
|
@@ -59,6 +60,7 @@ export declare const labelRouter: {
|
|
|
59
60
|
effects: {
|
|
60
61
|
domain: "read";
|
|
61
62
|
storage: "normal-open";
|
|
63
|
+
external: never[];
|
|
62
64
|
};
|
|
63
65
|
confirmation: {
|
|
64
66
|
kind: "none";
|
|
@@ -80,6 +82,7 @@ export declare const labelRouter: {
|
|
|
80
82
|
effects: {
|
|
81
83
|
domain: "read";
|
|
82
84
|
storage: "normal-open";
|
|
85
|
+
external: never[];
|
|
83
86
|
};
|
|
84
87
|
confirmation: {
|
|
85
88
|
kind: "none";
|
|
@@ -108,6 +111,7 @@ export declare const labelRouter: {
|
|
|
108
111
|
effects: {
|
|
109
112
|
domain: "update";
|
|
110
113
|
storage: "normal-open";
|
|
114
|
+
external: never[];
|
|
111
115
|
};
|
|
112
116
|
confirmation: {
|
|
113
117
|
kind: "none";
|
|
@@ -235,6 +239,7 @@ export declare const labelRouter: {
|
|
|
235
239
|
effects: {
|
|
236
240
|
domain: "delete";
|
|
237
241
|
storage: "normal-open";
|
|
242
|
+
external: never[];
|
|
238
243
|
};
|
|
239
244
|
confirmation: {
|
|
240
245
|
kind: "prompt";
|
|
@@ -84,7 +84,7 @@ const labelInputs = {
|
|
|
84
84
|
export const labelRouter = {
|
|
85
85
|
create: {
|
|
86
86
|
summary: "Create a global label. Names preserve casing, but uniqueness is case-insensitive.",
|
|
87
|
-
effects: { domain: "create", storage: "normal-open" },
|
|
87
|
+
effects: { domain: "create", storage: "normal-open", external: [] },
|
|
88
88
|
confirmation: { kind: "none" },
|
|
89
89
|
input: labelInputs.create,
|
|
90
90
|
results: [jsonResult("Label")],
|
|
@@ -125,7 +125,7 @@ Example: zinn label create bug --description 'Unexpected behavior' --color red`,
|
|
|
125
125
|
},
|
|
126
126
|
list: {
|
|
127
127
|
summary: "List all global label definitions.",
|
|
128
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
128
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
129
129
|
confirmation: { kind: "none" },
|
|
130
130
|
input: labelInputs.list,
|
|
131
131
|
results: [jsonResult("LabelList")],
|
|
@@ -147,7 +147,7 @@ Use label view <name> for the full description. --json keeps the full text.`,
|
|
|
147
147
|
},
|
|
148
148
|
view: {
|
|
149
149
|
summary: "Show a global label with its full description.",
|
|
150
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
150
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
151
151
|
confirmation: { kind: "none" },
|
|
152
152
|
input: labelInputs.view,
|
|
153
153
|
results: [jsonResult("Label")],
|
|
@@ -179,7 +179,7 @@ Example: zinn label view bug`,
|
|
|
179
179
|
},
|
|
180
180
|
edit: {
|
|
181
181
|
summary: "Change specified fields.",
|
|
182
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
182
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
183
183
|
confirmation: { kind: "none" },
|
|
184
184
|
input: labelInputs.edit,
|
|
185
185
|
results: [jsonResult("LabelChange")],
|
|
@@ -238,7 +238,7 @@ Examples:
|
|
|
238
238
|
},
|
|
239
239
|
delete: {
|
|
240
240
|
summary: "Delete a label definition and remove it from all tasks after confirmation.",
|
|
241
|
-
effects: { domain: "delete", storage: "normal-open" },
|
|
241
|
+
effects: { domain: "delete", storage: "normal-open", external: [] },
|
|
242
242
|
confirmation: { kind: "prompt", description: confirmationDescription },
|
|
243
243
|
input: labelInputs.delete,
|
|
244
244
|
results: [jsonResult("Label")],
|
|
@@ -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";
|
|
@@ -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,6 +111,7 @@ 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";
|
|
@@ -219,6 +223,7 @@ export declare const projectRouter: {
|
|
|
219
223
|
effects: {
|
|
220
224
|
domain: "delete";
|
|
221
225
|
storage: "normal-open";
|
|
226
|
+
external: never[];
|
|
222
227
|
};
|
|
223
228
|
confirmation: {
|
|
224
229
|
kind: "project-delete";
|
|
@@ -254,6 +259,7 @@ export declare const projectRouter: {
|
|
|
254
259
|
effects: {
|
|
255
260
|
domain: "create";
|
|
256
261
|
storage: "normal-open";
|
|
262
|
+
external: never[];
|
|
257
263
|
};
|
|
258
264
|
confirmation: {
|
|
259
265
|
kind: "none";
|
|
@@ -299,6 +305,7 @@ export declare const projectRouter: {
|
|
|
299
305
|
effects: {
|
|
300
306
|
domain: "read";
|
|
301
307
|
storage: "normal-open";
|
|
308
|
+
external: never[];
|
|
302
309
|
};
|
|
303
310
|
confirmation: {
|
|
304
311
|
kind: "none";
|
|
@@ -328,6 +335,7 @@ export declare const projectRouter: {
|
|
|
328
335
|
effects: {
|
|
329
336
|
domain: "update";
|
|
330
337
|
storage: "normal-open";
|
|
338
|
+
external: never[];
|
|
331
339
|
};
|
|
332
340
|
confirmation: {
|
|
333
341
|
kind: "prompt";
|
|
@@ -386,6 +394,7 @@ export declare const projectRouter: {
|
|
|
386
394
|
effects: {
|
|
387
395
|
domain: "update";
|
|
388
396
|
storage: "normal-open";
|
|
397
|
+
external: never[];
|
|
389
398
|
};
|
|
390
399
|
confirmation: {
|
|
391
400
|
kind: "none";
|
|
@@ -461,6 +470,7 @@ export declare const projectRouter: {
|
|
|
461
470
|
effects: {
|
|
462
471
|
domain: "delete";
|
|
463
472
|
storage: "normal-open";
|
|
473
|
+
external: never[];
|
|
464
474
|
};
|
|
465
475
|
confirmation: {
|
|
466
476
|
kind: "prompt";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsonResult } from "../results.js";
|
|
2
2
|
import { parseArgs } from "node:util";
|
|
3
|
-
import { column, project, columnCategorySchema, 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";
|
|
@@ -195,7 +195,7 @@ const projectInputs = {
|
|
|
195
195
|
export const projectRouter = {
|
|
196
196
|
create: {
|
|
197
197
|
summary: "Create a project with the default columns.",
|
|
198
|
-
effects: { domain: "create", storage: "normal-open" },
|
|
198
|
+
effects: { domain: "create", storage: "normal-open", external: [] },
|
|
199
199
|
confirmation: { kind: "none" },
|
|
200
200
|
input: projectInputs.create,
|
|
201
201
|
results: [jsonResult("Project")],
|
|
@@ -236,7 +236,7 @@ Example: zinn project create MDR --name 'Macrodata Refinement'`,
|
|
|
236
236
|
},
|
|
237
237
|
list: {
|
|
238
238
|
summary: "List projects with active and archived task counts.",
|
|
239
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
239
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
240
240
|
confirmation: { kind: "none" },
|
|
241
241
|
input: projectInputs.list,
|
|
242
242
|
results: [jsonResult("ProjectList")],
|
|
@@ -263,7 +263,7 @@ Example: zinn project list`,
|
|
|
263
263
|
},
|
|
264
264
|
view: {
|
|
265
265
|
summary: "Show a project with its description and the number of tasks in each column.",
|
|
266
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
266
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
267
267
|
confirmation: { kind: "none" },
|
|
268
268
|
input: projectInputs.view,
|
|
269
269
|
results: [jsonResult("ProjectView")],
|
|
@@ -275,17 +275,21 @@ Example: zinn project list`,
|
|
|
275
275
|
strict: true,
|
|
276
276
|
});
|
|
277
277
|
validatePositionals(positionals, projectInputs.view.forms[0]);
|
|
278
|
-
const
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
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
|
+
});
|
|
289
293
|
output(presentedProject, (viewedProject) => {
|
|
290
294
|
// The full description follows as its own section, so the row leaves out the preview.
|
|
291
295
|
const sections = [formatProjectList([viewedProject], { showsDescriptionPreview: false })];
|
|
@@ -312,7 +316,7 @@ Example: zinn project view MDR`,
|
|
|
312
316
|
},
|
|
313
317
|
edit: {
|
|
314
318
|
summary: "Change the supplied project fields. At least one edit flag is required.",
|
|
315
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
319
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
316
320
|
confirmation: { kind: "none" },
|
|
317
321
|
input: projectInputs.edit,
|
|
318
322
|
results: [jsonResult("ProjectChange")],
|
|
@@ -372,7 +376,7 @@ Examples:
|
|
|
372
376
|
},
|
|
373
377
|
delete: {
|
|
374
378
|
summary: "Permanently delete a project and all of its columns and tasks after confirmation.",
|
|
375
|
-
effects: { domain: "delete", storage: "normal-open" },
|
|
379
|
+
effects: { domain: "delete", storage: "normal-open", external: [] },
|
|
376
380
|
confirmation: {
|
|
377
381
|
kind: "project-delete",
|
|
378
382
|
description: `${confirmationDescription} When the project key is omitted, deleting the configured default project always requires a terminal prompt; --yes is ignored.`,
|
|
@@ -435,7 +439,7 @@ Example: zinn project delete MDR`,
|
|
|
435
439
|
column: {
|
|
436
440
|
create: {
|
|
437
441
|
summary: "Add a column at the end of a project's board.",
|
|
438
|
-
effects: { domain: "create", storage: "normal-open" },
|
|
442
|
+
effects: { domain: "create", storage: "normal-open", external: [] },
|
|
439
443
|
confirmation: { kind: "none" },
|
|
440
444
|
input: projectInputs.column_create,
|
|
441
445
|
results: [jsonResult("Column")],
|
|
@@ -471,7 +475,7 @@ Example: zinn project column create MDR Boardlog --category backlog`,
|
|
|
471
475
|
},
|
|
472
476
|
list: {
|
|
473
477
|
summary: "List a project's columns in board order with their unarchived task counts.",
|
|
474
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
478
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
475
479
|
confirmation: { kind: "none" },
|
|
476
480
|
input: projectInputs.column_list,
|
|
477
481
|
results: [jsonResult("ColumnList")],
|
|
@@ -483,8 +487,11 @@ Example: zinn project column create MDR Boardlog --category backlog`,
|
|
|
483
487
|
strict: true,
|
|
484
488
|
});
|
|
485
489
|
validatePositionals(positionals, projectInputs.column_list.forms[0]);
|
|
486
|
-
const
|
|
487
|
-
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
|
+
});
|
|
488
495
|
output(columns, (presentedColumns) => formatColumnList(presentedColumns, {
|
|
489
496
|
showsTaskCounts: true,
|
|
490
497
|
}));
|
|
@@ -498,7 +505,7 @@ Example: zinn project column list MDR`,
|
|
|
498
505
|
},
|
|
499
506
|
edit: {
|
|
500
507
|
summary: "Rename a column or change its category.",
|
|
501
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
508
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
502
509
|
confirmation: {
|
|
503
510
|
kind: "prompt",
|
|
504
511
|
description: `Only asks when changing the category of a column that holds tasks. ${confirmationDescription}`,
|
|
@@ -551,7 +558,7 @@ Examples:
|
|
|
551
558
|
},
|
|
552
559
|
order: {
|
|
553
560
|
summary: "Change a column's position on the project's board.",
|
|
554
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
561
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
555
562
|
confirmation: { kind: "none" },
|
|
556
563
|
input: projectInputs.column_order,
|
|
557
564
|
results: [jsonResult("ColumnChange")],
|
|
@@ -593,7 +600,7 @@ Example: zinn project column order MDR Review before Doing`,
|
|
|
593
600
|
},
|
|
594
601
|
delete: {
|
|
595
602
|
summary: "Delete an empty project column after confirmation.",
|
|
596
|
-
effects: { domain: "delete", storage: "normal-open" },
|
|
603
|
+
effects: { domain: "delete", storage: "normal-open", external: [] },
|
|
597
604
|
confirmation: { kind: "prompt", description: confirmationDescription },
|
|
598
605
|
input: projectInputs.column_delete,
|
|
599
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")],
|
|
@@ -4,6 +4,7 @@ export declare const relationRouter: {
|
|
|
4
4
|
effects: {
|
|
5
5
|
domain: "replace";
|
|
6
6
|
storage: "normal-open";
|
|
7
|
+
external: never[];
|
|
7
8
|
};
|
|
8
9
|
confirmation: {
|
|
9
10
|
kind: "prompt";
|
|
@@ -55,6 +56,7 @@ export declare const relationRouter: {
|
|
|
55
56
|
effects: {
|
|
56
57
|
domain: "read";
|
|
57
58
|
storage: "normal-open";
|
|
59
|
+
external: never[];
|
|
58
60
|
};
|
|
59
61
|
confirmation: {
|
|
60
62
|
kind: "none";
|
|
@@ -83,6 +85,7 @@ export declare const relationRouter: {
|
|
|
83
85
|
effects: {
|
|
84
86
|
domain: "delete";
|
|
85
87
|
storage: "normal-open";
|
|
88
|
+
external: never[];
|
|
86
89
|
};
|
|
87
90
|
confirmation: {
|
|
88
91
|
kind: "none";
|