@zinn-dev/cli 0.44.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 (56) hide show
  1. package/package.json +2 -2
  2. package/skills/zinn/SKILL.md +7 -9
  3. package/src/capabilities-schema.d.ts +5 -1
  4. package/src/column-hint.js +1 -3
  5. package/src/database.d.ts +1 -2
  6. package/src/database.js +1 -6
  7. package/src/duration-input.d.ts +7 -0
  8. package/src/duration-input.js +31 -0
  9. package/src/errors.d.ts +22 -0
  10. package/src/errors.js +30 -5
  11. package/src/expected-values.d.ts +48 -0
  12. package/src/expected-values.js +60 -0
  13. package/src/follow.d.ts +9 -0
  14. package/src/follow.js +58 -0
  15. package/src/input.d.ts +0 -8
  16. package/src/input.js +36 -16
  17. package/src/lib.d.ts +5 -2
  18. package/src/lib.js +18 -8
  19. package/src/list-continuation.js +1 -4
  20. package/src/presentation/activity-presentation.d.ts +2 -0
  21. package/src/presentation/activity-presentation.js +58 -3
  22. package/src/presentation/column-presentation.d.ts +9 -4
  23. package/src/presentation/column-presentation.js +29 -12
  24. package/src/presentation/doctor-presentation.d.ts +4 -0
  25. package/src/presentation/doctor-presentation.js +24 -0
  26. package/src/presentation/relation-presentation.js +2 -1
  27. package/src/presentation/task-blame-presentation.d.ts +1 -4
  28. package/src/presentation/task-blame-presentation.js +1 -1
  29. package/src/presentation/task-presentation.d.ts +2 -0
  30. package/src/presentation/task-presentation.js +39 -2
  31. package/src/result-schemas.d.ts +353 -58
  32. package/src/result-schemas.js +46 -2
  33. package/src/results.d.ts +6 -2
  34. package/src/results.js +9 -3
  35. package/src/routes/activity-router.d.ts +12 -3
  36. package/src/routes/activity-router.js +93 -59
  37. package/src/routes/aliases.js +1 -0
  38. package/src/routes/comment-router.d.ts +24 -6
  39. package/src/routes/comment-router.js +15 -5
  40. package/src/routes/doctor-router.d.ts +39 -0
  41. package/src/routes/doctor-router.js +103 -0
  42. package/src/routes/label-router.d.ts +39 -6
  43. package/src/routes/label-router.js +22 -5
  44. package/src/routes/project-router.d.ts +60 -11
  45. package/src/routes/project-router.js +100 -33
  46. package/src/routes/restore-router.js +2 -2
  47. package/src/routes/router.js +3 -7
  48. package/src/routes/routes.d.ts +404 -33
  49. package/src/routes/routes.js +4 -0
  50. package/src/routes/skill-router.d.ts +25 -0
  51. package/src/routes/skill-router.js +96 -0
  52. package/src/routes/task-router.d.ts +231 -13
  53. package/src/routes/task-router.js +247 -19
  54. package/src/text-edit.d.ts +2 -2
  55. package/src/text-input.d.ts +19 -1
  56. package/src/text-input.js +26 -5
@@ -7,8 +7,10 @@ import { restoreCommand } from "./restore-router.js";
7
7
  import { migrateCommand } from "./migrate-router.js";
8
8
  import { reindexCommand } from "./reindex-router.js";
9
9
  import { infoCommand } from "./info-router.js";
10
+ import { doctorCommand } from "./doctor-router.js";
10
11
  import { whoamiCommand } from "./whoami-router.js";
11
12
  import { capabilitiesCommand } from "./capabilities-router.js";
13
+ import { skillRouter } from "./skill-router.js";
12
14
  import { parseRoutes } from "./router.js";
13
15
  // TODO: lazy load?
14
16
  export const routes = {
@@ -21,7 +23,9 @@ export const routes = {
21
23
  migrate: migrateCommand,
22
24
  reindex: reindexCommand,
23
25
  info: infoCommand,
26
+ doctor: doctorCommand,
24
27
  whoami: whoamiCommand,
28
+ skill: skillRouter,
25
29
  capabilities: capabilitiesCommand,
26
30
  };
27
31
  export const parsedRoutes = parseRoutes(routes);
@@ -0,0 +1,25 @@
1
+ /** The workflow skill folder that ships with the CLI */
2
+ export declare const bundledSkillDirectory: string;
3
+ export declare const skillRouter: {
4
+ install: {
5
+ summary: string;
6
+ effects: {
7
+ domain: "none";
8
+ storage: "none";
9
+ };
10
+ confirmation: {
11
+ kind: "none";
12
+ };
13
+ input: {
14
+ readonly options: {};
15
+ readonly forms: readonly [{
16
+ readonly id: "default";
17
+ readonly positionals: readonly [];
18
+ }];
19
+ readonly constraints: readonly [];
20
+ };
21
+ results: import("../results.js").CommandResult[];
22
+ run: (args: string[]) => Promise<void>;
23
+ help: string;
24
+ };
25
+ };
@@ -0,0 +1,96 @@
1
+ import { spawn } from "node:child_process";
2
+ import { fileURLToPath } from "node:url";
3
+ import { parseArgs } from "node:util";
4
+ import { CliError } from "../errors.js";
5
+ import { generateCommandUsage, noInput } from "../input.js";
6
+ import { diagnostic, getOutputMode, output, validatePositionals } from "../lib.js";
7
+ import { jsonResult } from "../results.js";
8
+ /** The workflow skill folder that ships with the CLI */
9
+ export const bundledSkillDirectory = fileURLToPath(new URL("../../skills/zinn", import.meta.url));
10
+ /** On Windows npx is `npx.cmd`, which Node only starts through a shell */
11
+ const needsShell = process.platform === "win32";
12
+ /** Starts npx with one argument per array item, or on Windows as one command line for the shell */
13
+ function startNpx(args, stdio) {
14
+ if (needsShell) {
15
+ // Node warns when an argument array is combined with a shell (DEP0190), so the line is built here.
16
+ // Windows paths cannot contain double quotes, so quoting each argument keeps spaces inside it.
17
+ const commandLine = ["npx", ...args.map((arg) => `"${arg}"`)].join(" ");
18
+ return spawn(commandLine, { stdio, shell: true });
19
+ }
20
+ return spawn("npx", args, { stdio });
21
+ }
22
+ /**
23
+ * Runs the skills CLI and resolves with its exit code
24
+ * If a signal ends it, it's `null`
25
+ */
26
+ function runSkillsCli(skillDirectory) {
27
+ const isJson = getOutputMode() === "json";
28
+ // JSON output keeps stdout for the result and stderr for one error document,
29
+ // so the skills CLI's output is captured and reported as notices.
30
+ const child = startNpx(["--yes", "skills", "add", skillDirectory, "-g", "-y"], ["inherit", isJson ? "pipe" : "inherit", isJson ? "pipe" : "inherit"]);
31
+ const captured = [];
32
+ // Decoding per stream keeps a character whose bytes arrive in two chunks intact.
33
+ for (const stream of [child.stdout, child.stderr]) {
34
+ stream?.setEncoding("utf8");
35
+ stream?.on("data", (text) => captured.push(text));
36
+ }
37
+ return new Promise((resolve, reject) => {
38
+ child.once("error", (error) => {
39
+ if (error.code === "ENOENT") {
40
+ const message = "npx was not found. zinn skill install needs npx, which comes with npm.";
41
+ reject(new CliError(message, "not_found", undefined, undefined, undefined, error));
42
+ }
43
+ else {
44
+ reject(error);
45
+ }
46
+ });
47
+ child.once("close", (code) => {
48
+ const lines = captured
49
+ .join("")
50
+ .split(/\r?\n/)
51
+ .filter((line) => line.trim().length > 0);
52
+ for (const line of lines) {
53
+ diagnostic(line);
54
+ }
55
+ resolve(code);
56
+ });
57
+ });
58
+ }
59
+ export const skillRouter = {
60
+ install: {
61
+ summary: "Install the agent skill bundled with this CLI using the skills CLI.",
62
+ effects: { domain: "none", storage: "none" },
63
+ confirmation: { kind: "none" },
64
+ input: noInput,
65
+ results: [jsonResult("SkillInstall")],
66
+ run: async (args) => {
67
+ const { positionals } = parseArgs({
68
+ options: noInput.options,
69
+ args,
70
+ strict: true,
71
+ allowPositionals: true,
72
+ });
73
+ validatePositionals(positionals, noInput.forms[0]);
74
+ const exitCode = await runSkillsCli(bundledSkillDirectory);
75
+ if (exitCode !== 0) {
76
+ const endedBySignal = exitCode === null;
77
+ const failure = new CliError(endedBySignal
78
+ ? "The skills CLI was stopped."
79
+ : `The skills CLI exited with code ${exitCode}.`, "internal", { path: bundledSkillDirectory, ...(endedBySignal ? {} : { exitCode }) });
80
+ if (!endedBySignal) {
81
+ failure.exitCode = exitCode;
82
+ }
83
+ throw failure;
84
+ }
85
+ const installed = { source: bundledSkillDirectory };
86
+ output(installed, () => "");
87
+ },
88
+ help: `${generateCommandUsage("skill install", noInput)}
89
+
90
+ Install the agent skill bundled with this CLI using the skills CLI (https://github.com/vercel-labs/skills).
91
+
92
+ Runs npx --yes skills add <skill folder> -g -y, where the skill folder is the one inside this CLI's package, and passes the skills CLI's output and exit code through.
93
+ Rerun it after upgrading Zinn, or run npx skills update -g, which reads the same folder.
94
+ With --json, the skills CLI's output is reported as notices: on stderr after the result, or in error.diagnostics when it fails.`,
95
+ },
96
+ };
@@ -112,7 +112,7 @@ export declare const taskRouter: {
112
112
  }];
113
113
  readonly constraints: readonly [{
114
114
  readonly kind: "exclusive";
115
- readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
115
+ 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"];
116
116
  }];
117
117
  readonly notes: readonly ["Omit the project key to use defaultProject from settings; otherwise a project key is required."];
118
118
  };
@@ -152,6 +152,14 @@ export declare const taskRouter: {
152
152
  readonly choices: ("activity" | "due")[];
153
153
  };
154
154
  };
155
+ readonly state: {
156
+ readonly type: "string";
157
+ readonly value: {
158
+ readonly kind: "enum";
159
+ readonly name: "state";
160
+ readonly choices: ("all" | "open" | "closed")[];
161
+ };
162
+ };
155
163
  readonly archived: {
156
164
  readonly type: "boolean";
157
165
  };
@@ -317,6 +325,49 @@ export declare const taskRouter: {
317
325
  run: (args: string[]) => void;
318
326
  help: string;
319
327
  };
328
+ next: {
329
+ summary: string;
330
+ effects: {
331
+ domain: "read";
332
+ storage: "normal-open";
333
+ };
334
+ confirmation: {
335
+ kind: "none";
336
+ };
337
+ input: {
338
+ readonly options: {
339
+ readonly "all-projects": {
340
+ readonly type: "boolean";
341
+ };
342
+ readonly column: {
343
+ readonly type: "string";
344
+ readonly value: {
345
+ readonly kind: "column-name";
346
+ readonly name: "name";
347
+ };
348
+ };
349
+ };
350
+ readonly forms: readonly [{
351
+ readonly id: "default";
352
+ readonly positionals: readonly [{
353
+ readonly name: "project-key";
354
+ readonly min: 0;
355
+ readonly max: 1;
356
+ readonly value: {
357
+ readonly kind: "project-key";
358
+ };
359
+ }];
360
+ }];
361
+ readonly constraints: readonly [{
362
+ readonly kind: "exclusive";
363
+ readonly members: readonly ["positional:project-key", "option:all-projects"];
364
+ }];
365
+ readonly notes: readonly ["An omitted project key uses defaultProject, or all projects if unset. --all-projects overrides the default and cannot be combined with a project key."];
366
+ };
367
+ results: import("../results.js").CommandResult[];
368
+ run: (args: string[]) => void;
369
+ help: string;
370
+ };
320
371
  view: {
321
372
  summary: string;
322
373
  effects: {
@@ -388,6 +439,46 @@ export declare const taskRouter: {
388
439
  };
389
440
  input: {
390
441
  readonly options: {
442
+ readonly "expect-description": {
443
+ readonly type: "string";
444
+ readonly value: {
445
+ readonly kind: "text";
446
+ readonly name: "text";
447
+ };
448
+ };
449
+ readonly "expect-title": {
450
+ readonly type: "string";
451
+ readonly value: {
452
+ readonly kind: "text";
453
+ readonly name: "text";
454
+ };
455
+ };
456
+ readonly "expect-priority": {
457
+ readonly type: "string";
458
+ readonly value: {
459
+ readonly description: "none expects no priority.";
460
+ readonly kind: "enum";
461
+ readonly name: "priority";
462
+ readonly choices: readonly [...("low" | "medium" | "high" | "urgent")[], "none"];
463
+ readonly caseInsensitive: true;
464
+ };
465
+ };
466
+ readonly "expect-due": {
467
+ readonly type: "string";
468
+ readonly value: {
469
+ readonly description: "Same formats as --due. none expects no deadline, ignoring case.";
470
+ readonly kind: "timestamp";
471
+ readonly name: "timestamp";
472
+ };
473
+ };
474
+ readonly "expect-description-file": {
475
+ readonly type: "string";
476
+ readonly value: {
477
+ readonly kind: "path";
478
+ readonly name: "path";
479
+ readonly description: "A UTF-8 file, or \"-\" for stdin. Trailing line breaks are dropped; empty or blank input is an error.";
480
+ };
481
+ };
391
482
  readonly priority: {
392
483
  readonly type: "string";
393
484
  readonly value: {
@@ -471,18 +562,18 @@ export declare const taskRouter: {
471
562
  }];
472
563
  readonly constraints: readonly [{
473
564
  readonly kind: "exclusive";
474
- readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
565
+ 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"];
475
566
  }, {
476
567
  readonly kind: "exclusive";
477
568
  readonly members: readonly ["option:append", "option:replacing"];
478
569
  }, {
479
570
  readonly kind: "requiresAny";
480
571
  readonly input: "option:append";
481
- readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
572
+ 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"];
482
573
  }, {
483
574
  readonly kind: "requiresAny";
484
575
  readonly input: "option:replacing";
485
- readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
576
+ 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"];
486
577
  }, {
487
578
  readonly kind: "requires";
488
579
  readonly input: "option:all";
@@ -490,8 +581,11 @@ export declare const taskRouter: {
490
581
  }, {
491
582
  readonly kind: "atLeastOne";
492
583
  readonly members: readonly ["option:title", "option:description", "option:description-file", "option:priority", "option:due", "option:add-label", "option:remove-label"];
493
- }];
494
- readonly notes: readonly [string];
584
+ }, ...{
585
+ readonly kind: "exclusive";
586
+ 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"];
587
+ }[]];
588
+ readonly notes: readonly [string, string];
495
589
  };
496
590
  results: import("../results.js").CommandResult[];
497
591
  run: (args: string[]) => Promise<void>;
@@ -512,7 +606,15 @@ export declare const taskRouter: {
512
606
  kind: "none";
513
607
  };
514
608
  input: {
515
- readonly options: {};
609
+ readonly options: {
610
+ readonly from: {
611
+ readonly type: "string";
612
+ readonly value: {
613
+ readonly kind: "column-name";
614
+ readonly name: "column";
615
+ };
616
+ };
617
+ };
516
618
  readonly forms: readonly [{
517
619
  readonly id: "default";
518
620
  readonly positionals: readonly [{
@@ -676,6 +778,104 @@ export declare const taskRouter: {
676
778
  run: (args: Array<string>) => void;
677
779
  help: string;
678
780
  };
781
+ claim: {
782
+ summary: string;
783
+ effects: {
784
+ domain: "update";
785
+ storage: "normal-open";
786
+ };
787
+ confirmation: {
788
+ kind: "none";
789
+ };
790
+ input: {
791
+ readonly options: {
792
+ readonly lease: {
793
+ readonly type: "string";
794
+ readonly required: true;
795
+ readonly value: {
796
+ readonly kind: "duration";
797
+ readonly name: "duration";
798
+ readonly pattern: "^\\d+[mh]$";
799
+ readonly description: `Whole minutes or hours, such as 30m or 2h, from ${string} through ${string}.`;
800
+ };
801
+ };
802
+ readonly force: {
803
+ readonly type: "boolean";
804
+ };
805
+ };
806
+ readonly forms: readonly [{
807
+ readonly id: "default";
808
+ readonly positionals: readonly [{
809
+ readonly name: "task-key";
810
+ readonly min: 1;
811
+ readonly max: 1;
812
+ readonly value: {
813
+ readonly kind: "task-key";
814
+ };
815
+ }];
816
+ }];
817
+ readonly constraints: readonly [];
818
+ };
819
+ results: import("../results.js").CommandResult[];
820
+ run: (args: string[]) => void;
821
+ help: string;
822
+ };
823
+ heartbeat: {
824
+ summary: string;
825
+ effects: {
826
+ domain: "update";
827
+ storage: "normal-open";
828
+ };
829
+ confirmation: {
830
+ kind: "none";
831
+ };
832
+ input: {
833
+ readonly options: {};
834
+ readonly forms: readonly [{
835
+ readonly id: "default";
836
+ readonly positionals: readonly [{
837
+ readonly name: "task-key";
838
+ readonly min: 1;
839
+ readonly max: 1;
840
+ readonly value: {
841
+ readonly kind: "task-key";
842
+ };
843
+ }];
844
+ }];
845
+ readonly constraints: readonly [];
846
+ };
847
+ results: import("../results.js").CommandResult[];
848
+ run: (args: string[]) => void;
849
+ help: string;
850
+ };
851
+ release: {
852
+ summary: string;
853
+ effects: {
854
+ domain: "update";
855
+ storage: "normal-open";
856
+ };
857
+ confirmation: {
858
+ kind: "none";
859
+ };
860
+ input: {
861
+ readonly options: {};
862
+ readonly forms: readonly [{
863
+ readonly id: "default";
864
+ readonly positionals: readonly [{
865
+ readonly name: "task-key";
866
+ readonly min: 1;
867
+ readonly max: 1;
868
+ readonly value: {
869
+ readonly kind: "task-key";
870
+ };
871
+ }];
872
+ }];
873
+ readonly constraints: readonly [];
874
+ };
875
+ results: import("../results.js").CommandResult[];
876
+ run: (args: string[]) => void;
877
+ help: string;
878
+ };
679
879
  delete: {
680
880
  summary: string;
681
881
  effects: {
@@ -878,7 +1078,7 @@ export declare const taskRouter: {
878
1078
  }];
879
1079
  readonly constraints: readonly [{
880
1080
  readonly kind: "exclusive";
881
- readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
1081
+ 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"];
882
1082
  }, {
883
1083
  readonly kind: "atLeastOne";
884
1084
  readonly members: readonly ["option:text", "option:text-file"];
@@ -958,6 +1158,21 @@ export declare const taskRouter: {
958
1158
  };
959
1159
  input: {
960
1160
  readonly options: {
1161
+ readonly "expect-text": {
1162
+ readonly type: "string";
1163
+ readonly value: {
1164
+ readonly kind: "text";
1165
+ readonly name: "text";
1166
+ };
1167
+ };
1168
+ readonly "expect-text-file": {
1169
+ readonly type: "string";
1170
+ readonly value: {
1171
+ readonly kind: "path";
1172
+ readonly name: "path";
1173
+ readonly description: "A UTF-8 file, or \"-\" for stdin. Trailing line breaks are dropped; empty or blank input is an error.";
1174
+ };
1175
+ };
961
1176
  readonly append: {
962
1177
  readonly type: "boolean";
963
1178
  };
@@ -1000,18 +1215,18 @@ export declare const taskRouter: {
1000
1215
  }];
1001
1216
  readonly constraints: readonly [{
1002
1217
  readonly kind: "exclusive";
1003
- readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
1218
+ 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"];
1004
1219
  }, {
1005
1220
  readonly kind: "exclusive";
1006
1221
  readonly members: readonly ["option:append", "option:replacing"];
1007
1222
  }, {
1008
1223
  readonly kind: "requiresAny";
1009
1224
  readonly input: "option:append";
1010
- readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
1225
+ 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"];
1011
1226
  }, {
1012
1227
  readonly kind: "requiresAny";
1013
1228
  readonly input: "option:replacing";
1014
- readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
1229
+ 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"];
1015
1230
  }, {
1016
1231
  readonly kind: "requires";
1017
1232
  readonly input: "option:all";
@@ -1019,8 +1234,11 @@ export declare const taskRouter: {
1019
1234
  }, {
1020
1235
  readonly kind: "atLeastOne";
1021
1236
  readonly members: readonly ["option:text", "option:text-file"];
1022
- }];
1023
- readonly notes: readonly [string];
1237
+ }, ...{
1238
+ readonly kind: "exclusive";
1239
+ 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"];
1240
+ }[]];
1241
+ readonly notes: readonly [string, string];
1024
1242
  };
1025
1243
  results: import("../results.js").CommandResult[];
1026
1244
  guessedFlags: {