@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
|
@@ -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";
|
|
@@ -39,7 +40,7 @@ export declare const commentRouter: {
|
|
|
39
40
|
}];
|
|
40
41
|
readonly constraints: readonly [{
|
|
41
42
|
readonly kind: "exclusive";
|
|
42
|
-
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
43
|
+
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"];
|
|
43
44
|
}, {
|
|
44
45
|
readonly kind: "atLeastOne";
|
|
45
46
|
readonly members: readonly ["option:text", "option:text-file"];
|
|
@@ -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,12 +116,28 @@ 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";
|
|
119
123
|
};
|
|
120
124
|
input: {
|
|
121
125
|
readonly options: {
|
|
126
|
+
readonly "expect-text": {
|
|
127
|
+
readonly type: "string";
|
|
128
|
+
readonly value: {
|
|
129
|
+
readonly kind: "text";
|
|
130
|
+
readonly name: "text";
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
readonly "expect-text-file": {
|
|
134
|
+
readonly type: "string";
|
|
135
|
+
readonly value: {
|
|
136
|
+
readonly kind: "path";
|
|
137
|
+
readonly name: "path";
|
|
138
|
+
readonly description: "A UTF-8 file, or \"-\" for stdin. Trailing line breaks are dropped; empty or blank input is an error.";
|
|
139
|
+
};
|
|
140
|
+
};
|
|
122
141
|
readonly append: {
|
|
123
142
|
readonly type: "boolean";
|
|
124
143
|
};
|
|
@@ -161,18 +180,18 @@ export declare const commentRouter: {
|
|
|
161
180
|
}];
|
|
162
181
|
readonly constraints: readonly [{
|
|
163
182
|
readonly kind: "exclusive";
|
|
164
|
-
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
183
|
+
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"];
|
|
165
184
|
}, {
|
|
166
185
|
readonly kind: "exclusive";
|
|
167
186
|
readonly members: readonly ["option:append", "option:replacing"];
|
|
168
187
|
}, {
|
|
169
188
|
readonly kind: "requiresAny";
|
|
170
189
|
readonly input: "option:append";
|
|
171
|
-
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
190
|
+
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"];
|
|
172
191
|
}, {
|
|
173
192
|
readonly kind: "requiresAny";
|
|
174
193
|
readonly input: "option:replacing";
|
|
175
|
-
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
194
|
+
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"];
|
|
176
195
|
}, {
|
|
177
196
|
readonly kind: "requires";
|
|
178
197
|
readonly input: "option:all";
|
|
@@ -180,8 +199,11 @@ export declare const commentRouter: {
|
|
|
180
199
|
}, {
|
|
181
200
|
readonly kind: "atLeastOne";
|
|
182
201
|
readonly members: readonly ["option:text", "option:text-file"];
|
|
183
|
-
}
|
|
184
|
-
|
|
202
|
+
}, ...{
|
|
203
|
+
readonly kind: "exclusive";
|
|
204
|
+
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"];
|
|
205
|
+
}[]];
|
|
206
|
+
readonly notes: readonly [string, string];
|
|
185
207
|
};
|
|
186
208
|
results: import("../results.js").CommandResult[];
|
|
187
209
|
guessedFlags: {
|
|
@@ -195,6 +217,7 @@ export declare const commentRouter: {
|
|
|
195
217
|
effects: {
|
|
196
218
|
domain: "delete";
|
|
197
219
|
storage: "normal-open";
|
|
220
|
+
external: never[];
|
|
198
221
|
};
|
|
199
222
|
confirmation: {
|
|
200
223
|
kind: "prompt";
|
|
@@ -4,13 +4,15 @@ import { comment } from "@zinn-dev/core";
|
|
|
4
4
|
import { generateCommandUsage, getOptionInputs, taskKeyPositional, violatesConstraint, } from "../input.js";
|
|
5
5
|
import { confirmationDescription, confirmAction, dashValueHelp, output, outputChanges, quit, renameFlag, validatePositionals, validateUniqueOptions, } from "../lib.js";
|
|
6
6
|
import { resolveTextEdit, textEditHelp, textEditOptions, textEditConstraints, } from "../text-edit.js";
|
|
7
|
-
import {
|
|
7
|
+
import { expectedValueFlags } from "../expected-values.js";
|
|
8
|
+
import { checkSingleStdinReader, resolveTextInput, textFileHelp, textFileOption, textSourceConstraint, } from "../text-input.js";
|
|
8
9
|
import { currentActor } from "../actor.js";
|
|
9
10
|
import { formatCommentList, presentComment, presentComments, } from "../presentation/comment-presentation.js";
|
|
10
11
|
const commentTextConstraint = {
|
|
11
12
|
kind: "atLeastOne",
|
|
12
13
|
members: ["option:text", "option:text-file"],
|
|
13
14
|
};
|
|
15
|
+
const commentExpectations = expectedValueFlags({ text: { field: "text", text: true } });
|
|
14
16
|
function requireCommentText(values) {
|
|
15
17
|
if (violatesConstraint(commentTextConstraint, getOptionInputs(values))) {
|
|
16
18
|
quit("Comment text must be specified with --text or --text-file", undefined, {
|
|
@@ -42,10 +44,13 @@ async function parseCommentEditArgs(args) {
|
|
|
42
44
|
});
|
|
43
45
|
validateUniqueOptions(tokens, commentInputs.edit.options);
|
|
44
46
|
validatePositionals(positionals, commentInputs.edit.forms[0]);
|
|
47
|
+
commentExpectations.parseValues(values);
|
|
48
|
+
checkSingleStdinReader(values, ["--text", ...commentExpectations.textFlags]);
|
|
45
49
|
const text = await resolveTextEdit(values, "--text");
|
|
46
50
|
// Without a text source nothing was read, so this usage error still comes before any input
|
|
47
51
|
requireCommentText(values);
|
|
48
|
-
|
|
52
|
+
const expected = await commentExpectations.resolveText(values);
|
|
53
|
+
return { key: positionals[0], text: text, expected };
|
|
49
54
|
}
|
|
50
55
|
const commentInputs = {
|
|
51
56
|
create: {
|
|
@@ -86,6 +91,7 @@ const commentInputs = {
|
|
|
86
91
|
text: { type: "string", value: { kind: "text", name: "text" } },
|
|
87
92
|
"text-file": textFileOption,
|
|
88
93
|
...textEditOptions,
|
|
94
|
+
...commentExpectations.options,
|
|
89
95
|
},
|
|
90
96
|
forms: [
|
|
91
97
|
{
|
|
@@ -97,8 +103,9 @@ const commentInputs = {
|
|
|
97
103
|
textSourceConstraint("--text"),
|
|
98
104
|
...textEditConstraints("--text"),
|
|
99
105
|
commentTextConstraint,
|
|
106
|
+
...commentExpectations.constraints,
|
|
100
107
|
],
|
|
101
|
-
notes: [textEditHelp("--text")],
|
|
108
|
+
notes: [textEditHelp("--text"), commentExpectations.help],
|
|
102
109
|
},
|
|
103
110
|
delete: {
|
|
104
111
|
options: { yes: { type: "boolean" } },
|
|
@@ -114,7 +121,7 @@ const commentInputs = {
|
|
|
114
121
|
export const commentRouter = {
|
|
115
122
|
create: {
|
|
116
123
|
summary: "Add a comment to a task. Comment text cannot be blank.",
|
|
117
|
-
effects: { domain: "create", storage: "normal-open" },
|
|
124
|
+
effects: { domain: "create", storage: "normal-open", external: [] },
|
|
118
125
|
confirmation: { kind: "none" },
|
|
119
126
|
input: commentInputs.create,
|
|
120
127
|
results: [jsonResult("Comment")],
|
|
@@ -144,7 +151,7 @@ Example: zinn task comment create MDR-1 --text 'Ready for review'`,
|
|
|
144
151
|
},
|
|
145
152
|
list: {
|
|
146
153
|
summary: "List a task's comments by oldest first.",
|
|
147
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
154
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
148
155
|
confirmation: { kind: "none" },
|
|
149
156
|
input: commentInputs.list,
|
|
150
157
|
results: [jsonResult("CommentList")],
|
|
@@ -166,7 +173,7 @@ Example: zinn task comment list MDR-1`,
|
|
|
166
173
|
},
|
|
167
174
|
view: {
|
|
168
175
|
summary: "Show a comment's current text in full, keeping its line breaks.",
|
|
169
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
176
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
170
177
|
confirmation: { kind: "none" },
|
|
171
178
|
input: commentInputs.view,
|
|
172
179
|
results: [jsonResult("Comment")],
|
|
@@ -190,7 +197,7 @@ Example: zinn task comment view 'MDR-1#1'`,
|
|
|
190
197
|
},
|
|
191
198
|
edit: {
|
|
192
199
|
summary: "Replace a comment's text. Comment text cannot be blank.",
|
|
193
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
200
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
194
201
|
confirmation: { kind: "none" },
|
|
195
202
|
input: commentInputs.edit,
|
|
196
203
|
results: [jsonResult("CommentChange")],
|
|
@@ -204,7 +211,7 @@ Example: zinn task comment view 'MDR-1#1'`,
|
|
|
204
211
|
},
|
|
205
212
|
run: async (args) => {
|
|
206
213
|
const props = await parseCommentEditArgs(args);
|
|
207
|
-
const edited = comment.edit({ commentKey: props.key, text: props.text }, currentActor());
|
|
214
|
+
const edited = comment.edit({ commentKey: props.key, text: props.text, expected: props.expected }, currentActor());
|
|
208
215
|
outputChanges([edited], (change) => presentComment(change.comment), (entries) => formatCommentList(entries, { showsCreatedAt: false, showsTextPreview: true }), (entry) => `Comment ${entry.key} was unchanged`);
|
|
209
216
|
},
|
|
210
217
|
help: `${generateCommandUsage("task comment edit", commentInputs.edit)}
|
|
@@ -216,15 +223,18 @@ The printed result is a preview. 'task comment view' shows the full text. --json
|
|
|
216
223
|
|
|
217
224
|
${textEditHelp("--text")}
|
|
218
225
|
|
|
226
|
+
${commentExpectations.help}
|
|
227
|
+
|
|
219
228
|
${dashValueHelp("--text")}
|
|
220
229
|
|
|
221
230
|
Examples:
|
|
222
231
|
zinn task comment edit 'MDR-1#2' --text Approved
|
|
223
|
-
zinn task comment edit 'MDR-1#2' --text 'Also approved.' --append
|
|
232
|
+
zinn task comment edit 'MDR-1#2' --text 'Also approved.' --append
|
|
233
|
+
zinn task comment edit 'MDR-1#2' --text Approved --expect-text 'Looks good'`,
|
|
224
234
|
},
|
|
225
235
|
delete: {
|
|
226
236
|
summary: "Permanently delete a comment after confirmation.",
|
|
227
|
-
effects: { domain: "delete", storage: "normal-open" },
|
|
237
|
+
effects: { domain: "delete", storage: "normal-open", external: [] },
|
|
228
238
|
confirmation: { kind: "prompt", description: confirmationDescription },
|
|
229
239
|
input: commentInputs.delete,
|
|
230
240
|
results: [jsonResult("Comment")],
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const doctorCommand: {
|
|
2
|
+
summary: string;
|
|
3
|
+
effects: {
|
|
4
|
+
domain: "none";
|
|
5
|
+
storage: "inspect";
|
|
6
|
+
external: never[];
|
|
7
|
+
};
|
|
8
|
+
confirmation: {
|
|
9
|
+
kind: "none";
|
|
10
|
+
};
|
|
11
|
+
input: {
|
|
12
|
+
readonly options: {};
|
|
13
|
+
readonly forms: readonly [{
|
|
14
|
+
readonly id: "default";
|
|
15
|
+
readonly positionals: readonly [];
|
|
16
|
+
}];
|
|
17
|
+
readonly constraints: readonly [];
|
|
18
|
+
};
|
|
19
|
+
results: {
|
|
20
|
+
findingsExitCode: 1;
|
|
21
|
+
selector: {
|
|
22
|
+
kind: "always";
|
|
23
|
+
} | {
|
|
24
|
+
kind: "booleanOption";
|
|
25
|
+
name: string;
|
|
26
|
+
value: boolean;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "positionalCount";
|
|
29
|
+
name: string;
|
|
30
|
+
min: number;
|
|
31
|
+
max: number | null;
|
|
32
|
+
};
|
|
33
|
+
schemaRef: `#/schemas/definitions/${import("../result-schemas.js").ResultSchemaName}`;
|
|
34
|
+
mode: "json" | "json-lines";
|
|
35
|
+
stream: "stdout";
|
|
36
|
+
exitCode: 0;
|
|
37
|
+
}[];
|
|
38
|
+
run: (args: string[]) => void;
|
|
39
|
+
help: string;
|
|
40
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { parseArgs } from "node:util";
|
|
3
|
+
import { doctor } from "@zinn-dev/core";
|
|
4
|
+
import { generateCommandUsage, noInput } from "../input.js";
|
|
5
|
+
import { output, validatePositionals } from "../lib.js";
|
|
6
|
+
import { jsonResult } from "../results.js";
|
|
7
|
+
import { formatDoctor, presentDoctor } from "../presentation/doctor-presentation.js";
|
|
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}`;
|
|
18
|
+
}
|
|
19
|
+
return `Update the skill with ${hasProjectCopy ? projectCommand : homeCommand}`;
|
|
20
|
+
}
|
|
21
|
+
function checkAgentSkill() {
|
|
22
|
+
const workingFolder = process.cwd();
|
|
23
|
+
const { bundledVersion, copies } = findSkillCopies(homedir(), workingFolder);
|
|
24
|
+
if (copies.length === 0) {
|
|
25
|
+
return {
|
|
26
|
+
id: "agent_skill",
|
|
27
|
+
status: "ok",
|
|
28
|
+
message: "No Zinn skill is installed for agents",
|
|
29
|
+
remedy: null,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const differing = copies.filter(({ matches }) => !matches);
|
|
33
|
+
if (differing.length === 0) {
|
|
34
|
+
return {
|
|
35
|
+
id: "agent_skill",
|
|
36
|
+
status: "ok",
|
|
37
|
+
message: `The installed Zinn skill matches the one this CLI installs (reviewed for CLI ${bundledVersion})`,
|
|
38
|
+
remedy: null,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
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
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
id: "agent_skill",
|
|
52
|
+
status: "warning",
|
|
53
|
+
message: differences.join(", "),
|
|
54
|
+
remedy: skillInstallRemedy(differing, workingFolder),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export const doctorCommand = {
|
|
58
|
+
summary: "Check the selected settings, database and installed agent skill for problems.",
|
|
59
|
+
effects: { domain: "none", storage: "inspect", external: [] },
|
|
60
|
+
confirmation: { kind: "none" },
|
|
61
|
+
input: noInput,
|
|
62
|
+
results: [{ ...jsonResult("Doctor"), findingsExitCode: 1 }],
|
|
63
|
+
run: (args) => {
|
|
64
|
+
const { positionals } = parseArgs({
|
|
65
|
+
options: noInput.options,
|
|
66
|
+
args,
|
|
67
|
+
strict: true,
|
|
68
|
+
allowPositionals: true,
|
|
69
|
+
});
|
|
70
|
+
validatePositionals(positionals, noInput.forms[0]);
|
|
71
|
+
const report = presentDoctor(doctor.check(), checkAgentSkill());
|
|
72
|
+
output(report, formatDoctor);
|
|
73
|
+
if (!report.ok) {
|
|
74
|
+
process.exitCode = 1;
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
help: `${generateCommandUsage("doctor", noInput)}
|
|
78
|
+
|
|
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.
|
|
80
|
+
|
|
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.
|
|
82
|
+
Changes nothing: it creates no folder, database or settings file, and repairs nothing. SQLite may perform its normal file housekeeping.`,
|
|
83
|
+
};
|
|
@@ -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";
|
|
@@ -47,7 +48,7 @@ export declare const labelRouter: {
|
|
|
47
48
|
}];
|
|
48
49
|
readonly constraints: readonly [{
|
|
49
50
|
readonly kind: "exclusive";
|
|
50
|
-
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
51
|
+
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"];
|
|
51
52
|
}];
|
|
52
53
|
};
|
|
53
54
|
results: import("../results.js").CommandResult[];
|
|
@@ -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,12 +111,43 @@ 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";
|
|
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-color": {
|
|
136
|
+
readonly type: "string";
|
|
137
|
+
readonly value: {
|
|
138
|
+
readonly kind: "enum";
|
|
139
|
+
readonly name: "color";
|
|
140
|
+
readonly choices: ("red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray")[];
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
readonly "expect-description-file": {
|
|
144
|
+
readonly type: "string";
|
|
145
|
+
readonly value: {
|
|
146
|
+
readonly kind: "path";
|
|
147
|
+
readonly name: "path";
|
|
148
|
+
readonly description: "A UTF-8 file, or \"-\" for stdin. Trailing line breaks are dropped; empty or blank input is an error.";
|
|
149
|
+
};
|
|
150
|
+
};
|
|
117
151
|
readonly color: {
|
|
118
152
|
readonly type: "string";
|
|
119
153
|
readonly value: {
|
|
@@ -171,18 +205,18 @@ export declare const labelRouter: {
|
|
|
171
205
|
}];
|
|
172
206
|
readonly constraints: readonly [{
|
|
173
207
|
readonly kind: "exclusive";
|
|
174
|
-
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
208
|
+
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"];
|
|
175
209
|
}, {
|
|
176
210
|
readonly kind: "exclusive";
|
|
177
211
|
readonly members: readonly ["option:append", "option:replacing"];
|
|
178
212
|
}, {
|
|
179
213
|
readonly kind: "requiresAny";
|
|
180
214
|
readonly input: "option:append";
|
|
181
|
-
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
215
|
+
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"];
|
|
182
216
|
}, {
|
|
183
217
|
readonly kind: "requiresAny";
|
|
184
218
|
readonly input: "option:replacing";
|
|
185
|
-
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
219
|
+
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"];
|
|
186
220
|
}, {
|
|
187
221
|
readonly kind: "requires";
|
|
188
222
|
readonly input: "option:all";
|
|
@@ -190,8 +224,11 @@ export declare const labelRouter: {
|
|
|
190
224
|
}, {
|
|
191
225
|
readonly kind: "atLeastOne";
|
|
192
226
|
readonly members: `option:${string}`[];
|
|
193
|
-
}
|
|
194
|
-
|
|
227
|
+
}, ...{
|
|
228
|
+
readonly kind: "exclusive";
|
|
229
|
+
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"];
|
|
230
|
+
}[]];
|
|
231
|
+
readonly notes: readonly [string, string];
|
|
195
232
|
};
|
|
196
233
|
results: import("../results.js").CommandResult[];
|
|
197
234
|
run: (args: string[]) => Promise<void>;
|
|
@@ -202,6 +239,7 @@ export declare const labelRouter: {
|
|
|
202
239
|
effects: {
|
|
203
240
|
domain: "delete";
|
|
204
241
|
storage: "normal-open";
|
|
242
|
+
external: never[];
|
|
205
243
|
};
|
|
206
244
|
confirmation: {
|
|
207
245
|
kind: "prompt";
|
|
@@ -5,7 +5,8 @@ import { CliError } from "../errors.js";
|
|
|
5
5
|
import { generateCommandUsage, noInput } from "../input.js";
|
|
6
6
|
import { confirmationDescription, confirmAction, dashValueHelp, output, outputChanges, validatePositionals, 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 { currentActor } from "../actor.js";
|
|
10
11
|
import { formatLabelList, presentLabel } from "../presentation/label-presentation.js";
|
|
11
12
|
const colorOption = {
|
|
@@ -16,6 +17,11 @@ const colorOption = {
|
|
|
16
17
|
choices: labelColorSchema.options,
|
|
17
18
|
},
|
|
18
19
|
};
|
|
20
|
+
const labelExpectations = expectedValueFlags({
|
|
21
|
+
name: { field: "name", option: { type: "string", value: { kind: "text", name: "text" } } },
|
|
22
|
+
description: { field: "description", text: true },
|
|
23
|
+
color: { field: "color", option: colorOption },
|
|
24
|
+
});
|
|
19
25
|
const labelInputs = {
|
|
20
26
|
create: {
|
|
21
27
|
options: {
|
|
@@ -46,6 +52,7 @@ const labelInputs = {
|
|
|
46
52
|
"description-file": textFileOption,
|
|
47
53
|
...textEditOptions,
|
|
48
54
|
color: colorOption,
|
|
55
|
+
...labelExpectations.options,
|
|
49
56
|
},
|
|
50
57
|
forms: [
|
|
51
58
|
{ id: "default", positionals: [{ name: "name", min: 1, max: 1, value: { kind: "name" } }] },
|
|
@@ -57,13 +64,14 @@ const labelInputs = {
|
|
|
57
64
|
kind: "atLeastOne",
|
|
58
65
|
// A description can also come from --description-file
|
|
59
66
|
members: Object.keys(labelEditSchema.shape)
|
|
60
|
-
.filter((name) => name !== "labelName")
|
|
67
|
+
.filter((name) => name !== "labelName" && name !== "expected")
|
|
61
68
|
.flatMap((name) => name === "description"
|
|
62
69
|
? textSourceConstraint("--description").members
|
|
63
70
|
: [`option:${name}`]),
|
|
64
71
|
},
|
|
72
|
+
...labelExpectations.constraints,
|
|
65
73
|
],
|
|
66
|
-
notes: [textEditHelp("--description")],
|
|
74
|
+
notes: [textEditHelp("--description"), labelExpectations.help],
|
|
67
75
|
},
|
|
68
76
|
delete: {
|
|
69
77
|
options: { yes: { type: "boolean" } },
|
|
@@ -76,7 +84,7 @@ const labelInputs = {
|
|
|
76
84
|
export const labelRouter = {
|
|
77
85
|
create: {
|
|
78
86
|
summary: "Create a global label. Names preserve casing, but uniqueness is case-insensitive.",
|
|
79
|
-
effects: { domain: "create", storage: "normal-open" },
|
|
87
|
+
effects: { domain: "create", storage: "normal-open", external: [] },
|
|
80
88
|
confirmation: { kind: "none" },
|
|
81
89
|
input: labelInputs.create,
|
|
82
90
|
results: [jsonResult("Label")],
|
|
@@ -117,7 +125,7 @@ Example: zinn label create bug --description 'Unexpected behavior' --color red`,
|
|
|
117
125
|
},
|
|
118
126
|
list: {
|
|
119
127
|
summary: "List all global label definitions.",
|
|
120
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
128
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
121
129
|
confirmation: { kind: "none" },
|
|
122
130
|
input: labelInputs.list,
|
|
123
131
|
results: [jsonResult("LabelList")],
|
|
@@ -139,7 +147,7 @@ Use label view <name> for the full description. --json keeps the full text.`,
|
|
|
139
147
|
},
|
|
140
148
|
view: {
|
|
141
149
|
summary: "Show a global label with its full description.",
|
|
142
|
-
effects: { domain: "read", storage: "normal-open" },
|
|
150
|
+
effects: { domain: "read", storage: "normal-open", external: [] },
|
|
143
151
|
confirmation: { kind: "none" },
|
|
144
152
|
input: labelInputs.view,
|
|
145
153
|
results: [jsonResult("Label")],
|
|
@@ -171,7 +179,7 @@ Example: zinn label view bug`,
|
|
|
171
179
|
},
|
|
172
180
|
edit: {
|
|
173
181
|
summary: "Change specified fields.",
|
|
174
|
-
effects: { domain: "update", storage: "normal-open" },
|
|
182
|
+
effects: { domain: "update", storage: "normal-open", external: [] },
|
|
175
183
|
confirmation: { kind: "none" },
|
|
176
184
|
input: labelInputs.edit,
|
|
177
185
|
results: [jsonResult("LabelChange")],
|
|
@@ -185,19 +193,25 @@ Example: zinn label view bug`,
|
|
|
185
193
|
});
|
|
186
194
|
validateUniqueOptions(tokens, labelInputs.edit.options);
|
|
187
195
|
validatePositionals(positionals, labelInputs.edit.forms[0]);
|
|
196
|
+
const expected = labelExpectations.parseValues(values);
|
|
188
197
|
checkFieldsBeforeText(labelEditSchema, {
|
|
189
198
|
labelName: positionals[0],
|
|
190
199
|
name: values.name,
|
|
191
200
|
color: values.color,
|
|
201
|
+
expected,
|
|
192
202
|
});
|
|
203
|
+
checkSingleStdinReader(values, ["--description", ...labelExpectations.textFlags]);
|
|
193
204
|
const description = await resolveTextEdit(values, "--description");
|
|
194
205
|
const input = labelEditSchema.parse({
|
|
195
206
|
labelName: positionals[0],
|
|
196
207
|
name: values.name,
|
|
197
208
|
description,
|
|
198
209
|
color: values.color,
|
|
210
|
+
expected,
|
|
199
211
|
});
|
|
200
|
-
|
|
212
|
+
// Read only after the parse, which refuses an edit without edit flags
|
|
213
|
+
const expectedText = await labelExpectations.resolveText(values);
|
|
214
|
+
const edited = label.edit({ ...input, expected: { ...input.expected, ...expectedText } }, currentActor());
|
|
201
215
|
outputChanges([edited], (change) => presentLabel(change.label), (entries) => formatLabelList(entries, { showsDescriptionPreview: true }), (entry) => `Label "${entry.name}" was unchanged`);
|
|
202
216
|
},
|
|
203
217
|
help: `${generateCommandUsage("label edit", labelInputs.edit)}
|
|
@@ -211,17 +225,20 @@ Valid colors: ${labelInputs.edit.options.color.value.choices.join(", ")}.
|
|
|
211
225
|
|
|
212
226
|
${textEditHelp("--description")}
|
|
213
227
|
|
|
228
|
+
${labelExpectations.help}
|
|
229
|
+
|
|
214
230
|
Label names match without case sensitivity.
|
|
215
231
|
|
|
216
232
|
${dashValueHelp("--description")}
|
|
217
233
|
|
|
218
234
|
Examples:
|
|
219
235
|
zinn label edit bug --name defect --color yellow
|
|
220
|
-
zinn label edit bug --description 'Reported by users.' --append
|
|
236
|
+
zinn label edit bug --description 'Reported by users.' --append
|
|
237
|
+
zinn label edit bug --color red --expect-color yellow`,
|
|
221
238
|
},
|
|
222
239
|
delete: {
|
|
223
240
|
summary: "Delete a label definition and remove it from all tasks after confirmation.",
|
|
224
|
-
effects: { domain: "delete", storage: "normal-open" },
|
|
241
|
+
effects: { domain: "delete", storage: "normal-open", external: [] },
|
|
225
242
|
confirmation: { kind: "prompt", description: confirmationDescription },
|
|
226
243
|
input: labelInputs.delete,
|
|
227
244
|
results: [jsonResult("Label")],
|