@zinn-dev/cli 0.43.0 → 0.45.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.
Files changed (78) hide show
  1. package/README.md +1 -1
  2. package/index.js +3 -3
  3. package/package.json +7 -4
  4. package/skills/zinn/SKILL.md +7 -9
  5. package/src/actor.d.ts +8 -0
  6. package/src/actor.js +5 -1
  7. package/src/capabilities-schema.d.ts +6 -2
  8. package/src/column-hint.js +2 -5
  9. package/src/database.d.ts +1 -2
  10. package/src/database.js +1 -6
  11. package/src/duration-input.d.ts +7 -0
  12. package/src/duration-input.js +31 -0
  13. package/src/errors.d.ts +34 -3
  14. package/src/errors.js +49 -7
  15. package/src/expected-values.d.ts +48 -0
  16. package/src/expected-values.js +60 -0
  17. package/src/failure-log.d.ts +6 -0
  18. package/src/failure-log.js +167 -0
  19. package/src/follow.d.ts +9 -0
  20. package/src/follow.js +58 -0
  21. package/src/input.d.ts +10 -7
  22. package/src/input.js +57 -13
  23. package/src/lib.d.ts +12 -7
  24. package/src/lib.js +70 -41
  25. package/src/list-continuation.js +1 -4
  26. package/src/list-limit.d.ts +2 -2
  27. package/src/list-limit.js +2 -2
  28. package/src/overview.d.ts +10 -0
  29. package/src/overview.js +41 -0
  30. package/src/presentation/activity-presentation.d.ts +4 -0
  31. package/src/presentation/activity-presentation.js +154 -38
  32. package/src/presentation/column-presentation.d.ts +22 -2
  33. package/src/presentation/column-presentation.js +68 -12
  34. package/src/presentation/doctor-presentation.d.ts +4 -0
  35. package/src/presentation/doctor-presentation.js +24 -0
  36. package/src/presentation/info-presentation.js +36 -6
  37. package/src/presentation/relation-presentation.d.ts +6 -2
  38. package/src/presentation/relation-presentation.js +37 -26
  39. package/src/presentation/task-blame-presentation.d.ts +8 -0
  40. package/src/presentation/task-blame-presentation.js +56 -0
  41. package/src/presentation/task-presentation.d.ts +8 -1
  42. package/src/presentation/task-presentation.js +59 -10
  43. package/src/result-schemas.d.ts +780 -20
  44. package/src/result-schemas.js +99 -2
  45. package/src/results.d.ts +6 -2
  46. package/src/results.js +9 -3
  47. package/src/routes/activity-router.d.ts +21 -4
  48. package/src/routes/activity-router.js +107 -60
  49. package/src/routes/aliases.js +1 -0
  50. package/src/routes/comment-router.d.ts +24 -6
  51. package/src/routes/comment-router.js +15 -5
  52. package/src/routes/doctor-router.d.ts +39 -0
  53. package/src/routes/doctor-router.js +103 -0
  54. package/src/routes/info-router.js +3 -2
  55. package/src/routes/label-router.d.ts +39 -6
  56. package/src/routes/label-router.js +22 -5
  57. package/src/routes/migrate-router.js +2 -2
  58. package/src/routes/project-router.d.ts +61 -12
  59. package/src/routes/project-router.js +103 -45
  60. package/src/routes/restore-router.js +11 -5
  61. package/src/routes/router.js +25 -16
  62. package/src/routes/routes.d.ts +455 -41
  63. package/src/routes/routes.js +4 -0
  64. package/src/routes/skill-router.d.ts +25 -0
  65. package/src/routes/skill-router.js +96 -0
  66. package/src/routes/task-router.d.ts +272 -19
  67. package/src/routes/task-router.js +325 -40
  68. package/src/routes/whoami-router.js +1 -1
  69. package/src/run-facts.d.ts +14 -0
  70. package/src/run-facts.js +14 -0
  71. package/src/store-folder.d.ts +5 -0
  72. package/src/store-folder.js +16 -0
  73. package/src/telemetry.d.ts +31 -0
  74. package/src/telemetry.js +329 -0
  75. package/src/text-edit.d.ts +2 -2
  76. package/src/text-input.d.ts +19 -1
  77. package/src/text-input.js +27 -10
  78. package/src/types.d.ts +1 -1
@@ -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 { resolveTextInput, textFileHelp, textFileOption, textSourceConstraint, } from "../text-input.js";
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
- return { key: positionals[0], text: text };
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" } },
@@ -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,11 +223,14 @@ 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.",
@@ -0,0 +1,39 @@
1
+ export declare const doctorCommand: {
2
+ summary: string;
3
+ effects: {
4
+ domain: "none";
5
+ storage: "inspect";
6
+ };
7
+ confirmation: {
8
+ kind: "none";
9
+ };
10
+ input: {
11
+ readonly options: {};
12
+ readonly forms: readonly [{
13
+ readonly id: "default";
14
+ readonly positionals: readonly [];
15
+ }];
16
+ readonly constraints: readonly [];
17
+ };
18
+ results: {
19
+ findingsExitCode: 1;
20
+ selector: {
21
+ kind: "always";
22
+ } | {
23
+ kind: "booleanOption";
24
+ name: string;
25
+ value: boolean;
26
+ } | {
27
+ kind: "positionalCount";
28
+ name: string;
29
+ min: number;
30
+ max: number | null;
31
+ };
32
+ schemaRef: `#/schemas/definitions/${import("../result-schemas.js").ResultSchemaName}`;
33
+ mode: "json" | "json-lines";
34
+ stream: "stdout";
35
+ exitCode: 0;
36
+ }[];
37
+ run: (args: string[]) => void;
38
+ help: string;
39
+ };
@@ -0,0 +1,103 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { join } from "node:path";
4
+ import { parseArgs } from "node:util";
5
+ import { doctor, isMissingFileError } from "@zinn-dev/core";
6
+ import { generateCommandUsage, noInput } from "../input.js";
7
+ import { output, validatePositionals } from "../lib.js";
8
+ import { jsonResult } from "../results.js";
9
+ import { formatDoctor, presentDoctor } from "../presentation/doctor-presentation.js";
10
+ import { bundledSkillDirectory } from "./skill-router.js";
11
+ /** Where the `skills` CLI installs the Zinn workflow skill, inside the home folder */
12
+ const INSTALLED_SKILL_PATH = [".agents", "skills", "zinn", "SKILL.md"];
13
+ const SKILL_FILE_NAME = "SKILL.md";
14
+ const SKILL_INSTALL_REMEDY = "Update the skill with `zinn skill install`";
15
+ /** The YAML frontmatter block that opens a skill file */
16
+ const FRONTMATTER_PATTERN = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/;
17
+ /**
18
+ * The reviewed version under the frontmatter's `metadata:`
19
+ * map, quoted or plain
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;
27
+ }
28
+ const match = REVIEWED_VERSION_PATTERN.exec(frontmatter);
29
+ if (match === null) {
30
+ return null;
31
+ }
32
+ return match[1] ?? match[2] ?? match[3] ?? null;
33
+ }
34
+ function checkAgentSkill() {
35
+ const path = join(homedir(), ...INSTALLED_SKILL_PATH);
36
+ let skill;
37
+ try {
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
+ }
49
+ return {
50
+ id: "agent_skill",
51
+ status: "warning",
52
+ message: `The installed Zinn skill at ${path} cannot be read`,
53
+ remedy: SKILL_INSTALL_REMEDY,
54
+ };
55
+ }
56
+ const reviewedVersion = readReviewedVersion(skill);
57
+ // The skill `zinn skill install` installs. It ships with the CLI, and release checks guarantee its version.
58
+ const bundledVersion = readReviewedVersion(readFileSync(join(bundledSkillDirectory, SKILL_FILE_NAME), "utf8"));
59
+ if (reviewedVersion !== null && reviewedVersion === bundledVersion) {
60
+ return {
61
+ id: "agent_skill",
62
+ status: "ok",
63
+ message: `The installed Zinn skill matches the one this CLI installs (reviewed for CLI ${bundledVersion})`,
64
+ remedy: null,
65
+ };
66
+ }
67
+ const found = reviewedVersion === null
68
+ ? "names no reviewed CLI version"
69
+ : `was reviewed for CLI ${reviewedVersion}`;
70
+ return {
71
+ id: "agent_skill",
72
+ status: "warning",
73
+ message: `The installed Zinn skill at ${path} ${found}, and the skill this CLI installs was reviewed for CLI ${bundledVersion}`,
74
+ remedy: SKILL_INSTALL_REMEDY,
75
+ };
76
+ }
77
+ export const doctorCommand = {
78
+ summary: "Check the selected settings, database and installed agent skill for problems.",
79
+ effects: { domain: "none", storage: "inspect" },
80
+ confirmation: { kind: "none" },
81
+ input: noInput,
82
+ results: [{ ...jsonResult("Doctor"), findingsExitCode: 1 }],
83
+ run: (args) => {
84
+ const { positionals } = parseArgs({
85
+ options: noInput.options,
86
+ args,
87
+ strict: true,
88
+ allowPositionals: true,
89
+ });
90
+ validatePositionals(positionals, noInput.forms[0]);
91
+ const report = presentDoctor(doctor.check(), checkAgentSkill());
92
+ output(report, formatDoctor);
93
+ if (!report.ok) {
94
+ process.exitCode = 1;
95
+ }
96
+ },
97
+ help: `${generateCommandUsage("doctor", noInput)}
98
+
99
+ Check the selected settings, store folder, database, search index and installed agent skill for problems, and suggest a fix for each.
100
+
101
+ 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
+ Changes nothing: it creates no folder, database or settings file, and repairs nothing. SQLite may perform its normal file housekeeping.`,
103
+ };
@@ -5,7 +5,7 @@ import { generateCommandUsage, noInput } from "../input.js";
5
5
  import { output, validatePositionals } from "../lib.js";
6
6
  import { formatInfo, presentInfo } from "../presentation/info-presentation.js";
7
7
  export const infoCommand = {
8
- summary: "Show the selected store, settings sources, database schema state and CLI, core and runtime versions.",
8
+ summary: "Show the selected store, settings sources, telemetry state, database schema state and CLI, core and runtime versions.",
9
9
  effects: { domain: "none", storage: "inspect" },
10
10
  confirmation: { kind: "none" },
11
11
  input: noInput,
@@ -22,8 +22,9 @@ export const infoCommand = {
22
22
  },
23
23
  help: `${generateCommandUsage("info", noInput)}
24
24
 
25
- Show the selected store, settings sources, database schema state and CLI, core and runtime versions.
25
+ Show the selected store, settings sources, telemetry state, database schema state and CLI, core and runtime versions.
26
26
 
27
27
  Reports unusable settings and database errors and exits successfully.
28
+ Telemetry is local (collected on this machine, never sent) or off. A telemetry.mode in a settings file overrides DO_NOT_TRACK=1 (https://donottrack.sh/). The telemetry folder is reported but never created.
28
29
  SQLite may perform its normal file housekeeping when this command is triggered.`,
29
30
  };
@@ -47,7 +47,7 @@ export declare const labelRouter: {
47
47
  }];
48
48
  readonly constraints: readonly [{
49
49
  readonly kind: "exclusive";
50
- 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"];
51
51
  }];
52
52
  };
53
53
  results: import("../results.js").CommandResult[];
@@ -114,6 +114,36 @@ export declare const labelRouter: {
114
114
  };
115
115
  input: {
116
116
  readonly options: {
117
+ readonly "expect-name": {
118
+ readonly type: "string";
119
+ readonly value: {
120
+ readonly kind: "text";
121
+ readonly name: "text";
122
+ };
123
+ };
124
+ readonly "expect-description": {
125
+ readonly type: "string";
126
+ readonly value: {
127
+ readonly kind: "text";
128
+ readonly name: "text";
129
+ };
130
+ };
131
+ readonly "expect-color": {
132
+ readonly type: "string";
133
+ readonly value: {
134
+ readonly kind: "enum";
135
+ readonly name: "color";
136
+ readonly choices: ("red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray")[];
137
+ };
138
+ };
139
+ readonly "expect-description-file": {
140
+ readonly type: "string";
141
+ readonly value: {
142
+ readonly kind: "path";
143
+ readonly name: "path";
144
+ readonly description: "A UTF-8 file, or \"-\" for stdin. Trailing line breaks are dropped; empty or blank input is an error.";
145
+ };
146
+ };
117
147
  readonly color: {
118
148
  readonly type: "string";
119
149
  readonly value: {
@@ -171,18 +201,18 @@ export declare const labelRouter: {
171
201
  }];
172
202
  readonly constraints: readonly [{
173
203
  readonly kind: "exclusive";
174
- readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
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"];
175
205
  }, {
176
206
  readonly kind: "exclusive";
177
207
  readonly members: readonly ["option:append", "option:replacing"];
178
208
  }, {
179
209
  readonly kind: "requiresAny";
180
210
  readonly input: "option:append";
181
- readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
211
+ 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
212
  }, {
183
213
  readonly kind: "requiresAny";
184
214
  readonly input: "option:replacing";
185
- 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"];
186
216
  }, {
187
217
  readonly kind: "requires";
188
218
  readonly input: "option:all";
@@ -190,8 +220,11 @@ export declare const labelRouter: {
190
220
  }, {
191
221
  readonly kind: "atLeastOne";
192
222
  readonly members: `option:${string}`[];
193
- }];
194
- readonly notes: readonly [string];
223
+ }, ...{
224
+ readonly kind: "exclusive";
225
+ 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"];
226
+ }[]];
227
+ readonly notes: readonly [string, string];
195
228
  };
196
229
  results: import("../results.js").CommandResult[];
197
230
  run: (args: string[]) => Promise<void>;
@@ -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 { checkFieldsBeforeText, resolveTextInput, textFileHelp, textFileOption, textSourceConstraint, } from "../text-input.js";
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" } },
@@ -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
- const edited = label.edit(input, currentActor());
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,13 +225,16 @@ 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.",
@@ -1,6 +1,6 @@
1
1
  import { jsonResult } from "../results.js";
2
2
  import { parseArgs } from "node:util";
3
- import { migrate, MigrationRefusedError, getStorage } from "@zinn-dev/core";
3
+ import { migrate, MigrationRefusedError, getBackupStorage } 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";
@@ -20,7 +20,7 @@ export const migrateCommand = {
20
20
  });
21
21
  validatePositionals(positionals, noInput.forms[0]);
22
22
  // Resolved before the try, so a store that cannot be resolved fails without the note about backups.
23
- const { backupDirectory } = getStorage();
23
+ const { backupDirectory } = getBackupStorage();
24
24
  try {
25
25
  const result = migrate.run({
26
26
  client: "cli",
@@ -46,7 +46,7 @@ export declare const projectRouter: {
46
46
  }];
47
47
  readonly constraints: readonly [{
48
48
  readonly kind: "exclusive";
49
- readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
49
+ 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
50
  }];
51
51
  };
52
52
  results: import("../results.js").CommandResult[];
@@ -114,6 +114,28 @@ export declare const projectRouter: {
114
114
  };
115
115
  input: {
116
116
  readonly options: {
117
+ readonly "expect-name": {
118
+ readonly type: "string";
119
+ readonly value: {
120
+ readonly kind: "text";
121
+ readonly name: "text";
122
+ };
123
+ };
124
+ readonly "expect-description": {
125
+ readonly type: "string";
126
+ readonly value: {
127
+ readonly kind: "text";
128
+ readonly name: "text";
129
+ };
130
+ };
131
+ readonly "expect-description-file": {
132
+ readonly type: "string";
133
+ readonly value: {
134
+ readonly kind: "path";
135
+ readonly name: "path";
136
+ readonly description: "A UTF-8 file, or \"-\" for stdin. Trailing line breaks are dropped; empty or blank input is an error.";
137
+ };
138
+ };
117
139
  readonly append: {
118
140
  readonly type: "boolean";
119
141
  };
@@ -163,18 +185,18 @@ export declare const projectRouter: {
163
185
  }];
164
186
  readonly constraints: readonly [{
165
187
  readonly kind: "exclusive";
166
- readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
188
+ 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
189
  }, {
168
190
  readonly kind: "exclusive";
169
191
  readonly members: readonly ["option:append", "option:replacing"];
170
192
  }, {
171
193
  readonly kind: "requiresAny";
172
194
  readonly input: "option:append";
173
- readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
195
+ 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
196
  }, {
175
197
  readonly kind: "requiresAny";
176
198
  readonly input: "option:replacing";
177
- 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"];
178
200
  }, {
179
201
  readonly kind: "requires";
180
202
  readonly input: "option:all";
@@ -182,8 +204,11 @@ export declare const projectRouter: {
182
204
  }, {
183
205
  readonly kind: "atLeastOne";
184
206
  readonly members: readonly ["option:name", "option:description", "option:description-file"];
185
- }];
186
- readonly notes: readonly ["Omit the project key to use defaultProject from settings; otherwise a project key is required.", string];
207
+ }, ...{
208
+ readonly kind: "exclusive";
209
+ 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"];
210
+ }[]];
211
+ readonly notes: readonly ["Omit the project key to use defaultProject from settings; otherwise a project key is required.", string, string];
187
212
  };
188
213
  results: import("../results.js").CommandResult[];
189
214
  run: (args: string[]) => Promise<void>;
@@ -234,7 +259,17 @@ export declare const projectRouter: {
234
259
  kind: "none";
235
260
  };
236
261
  input: {
237
- readonly options: {};
262
+ readonly options: {
263
+ readonly category: {
264
+ readonly required: true;
265
+ readonly type: "string";
266
+ readonly value: {
267
+ readonly kind: "enum";
268
+ readonly name: "category";
269
+ readonly choices: ("done" | "backlog" | "todo" | "in_progress" | "review" | "cancelled")[];
270
+ };
271
+ };
272
+ };
238
273
  readonly forms: readonly [{
239
274
  readonly id: "default";
240
275
  readonly positionals: readonly [{
@@ -295,18 +330,29 @@ export declare const projectRouter: {
295
330
  storage: "normal-open";
296
331
  };
297
332
  confirmation: {
298
- kind: "none";
333
+ kind: "prompt";
334
+ description: string;
299
335
  };
300
336
  input: {
301
337
  readonly options: {
302
338
  readonly name: {
303
339
  readonly type: "string";
304
- readonly required: true;
305
340
  readonly value: {
306
341
  readonly kind: "text";
307
342
  readonly name: "text";
308
343
  };
309
344
  };
345
+ readonly category: {
346
+ readonly type: "string";
347
+ readonly value: {
348
+ readonly kind: "enum";
349
+ readonly name: "category";
350
+ readonly choices: ("done" | "backlog" | "todo" | "in_progress" | "review" | "cancelled")[];
351
+ };
352
+ };
353
+ readonly yes: {
354
+ readonly type: "boolean";
355
+ };
310
356
  };
311
357
  readonly forms: readonly [{
312
358
  readonly id: "default";
@@ -326,10 +372,13 @@ export declare const projectRouter: {
326
372
  };
327
373
  }];
328
374
  }];
329
- readonly constraints: readonly [];
375
+ readonly constraints: readonly [{
376
+ readonly kind: "atLeastOne";
377
+ readonly members: readonly ["option:name", "option:category"];
378
+ }];
330
379
  };
331
380
  results: import("../results.js").CommandResult[];
332
- run: (args: Array<string>) => void;
381
+ run: (args: Array<string>) => Promise<void>;
333
382
  help: string;
334
383
  };
335
384
  order: {
@@ -365,7 +414,7 @@ export declare const projectRouter: {
365
414
  readonly max: 1;
366
415
  readonly value: {
367
416
  readonly kind: "enum";
368
- readonly choices: ("first" | "previous" | "next" | "last")[];
417
+ readonly choices: ("next" | "first" | "previous" | "last")[];
369
418
  };
370
419
  }];
371
420
  }, {