@zinn-dev/cli 0.40.0 → 0.41.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 (60) hide show
  1. package/README.md +166 -38
  2. package/index.js +24 -13
  3. package/package.json +7 -2
  4. package/skills/zinn/SKILL.md +63 -0
  5. package/src/actor.d.ts +2 -1
  6. package/src/actor.js +78 -11
  7. package/src/capabilities-schema.d.ts +163 -0
  8. package/src/capabilities-schema.js +124 -0
  9. package/src/capabilities.d.ts +21 -0
  10. package/src/capabilities.js +22 -0
  11. package/src/database.d.ts +1 -1
  12. package/src/database.js +4 -4
  13. package/src/errors.d.ts +158 -0
  14. package/src/errors.js +224 -0
  15. package/src/input.d.ts +116 -0
  16. package/src/input.js +119 -0
  17. package/src/lib.d.ts +42 -7
  18. package/src/lib.js +213 -17
  19. package/src/presentation/activity-presentation.js +16 -2
  20. package/src/presentation/column-presentation.d.ts +3 -5
  21. package/src/presentation/info-presentation.d.ts +4 -0
  22. package/src/presentation/info-presentation.js +96 -0
  23. package/src/presentation/task-presentation.d.ts +2 -10
  24. package/src/project.d.ts +6 -0
  25. package/src/project.js +23 -10
  26. package/src/result-schemas.d.ts +987 -0
  27. package/src/result-schemas.js +220 -0
  28. package/src/results.d.ts +23 -0
  29. package/src/results.js +17 -0
  30. package/src/routes/activity-router.d.ts +71 -0
  31. package/src/routes/activity-router.js +59 -11
  32. package/src/routes/backup-router.d.ts +17 -0
  33. package/src/routes/backup-router.js +15 -3
  34. package/src/routes/capabilities-router.d.ts +21 -0
  35. package/src/routes/capabilities-router.js +28 -0
  36. package/src/routes/comment-router.d.ts +183 -4
  37. package/src/routes/comment-router.js +136 -29
  38. package/src/routes/info-router.d.ts +21 -0
  39. package/src/routes/info-router.js +29 -0
  40. package/src/routes/label-router.d.ts +165 -0
  41. package/src/routes/label-router.js +111 -29
  42. package/src/routes/migrate-router.d.ts +17 -0
  43. package/src/routes/migrate-router.js +17 -5
  44. package/src/routes/project-router.d.ts +349 -0
  45. package/src/routes/project-router.js +278 -92
  46. package/src/routes/reindex-router.d.ts +17 -0
  47. package/src/routes/reindex-router.js +15 -3
  48. package/src/routes/relation-router.d.ts +108 -12
  49. package/src/routes/relation-router.js +74 -14
  50. package/src/routes/restore-router.d.ts +29 -0
  51. package/src/routes/restore-router.js +30 -13
  52. package/src/routes/router.d.ts +1 -1
  53. package/src/routes/router.js +44 -25
  54. package/src/routes/routes.d.ts +1565 -0
  55. package/src/routes/routes.js +5 -1
  56. package/src/routes/task-router.d.ts +861 -0
  57. package/src/routes/task-router.js +419 -163
  58. package/src/text-edit.d.ts +20 -2
  59. package/src/text-edit.js +22 -10
  60. package/src/types.d.ts +14 -0
@@ -6,18 +6,36 @@ export declare const textEditOptions: {
6
6
  };
7
7
  readonly replacing: {
8
8
  readonly type: "string";
9
+ readonly value: {
10
+ readonly kind: "text";
11
+ readonly name: "old";
12
+ };
9
13
  };
10
14
  readonly all: {
11
15
  readonly type: "boolean";
12
16
  };
13
17
  };
18
+ export declare function textEditConstraints(textFlag: "--description" | "--text"): readonly [{
19
+ readonly kind: "exclusive";
20
+ readonly members: readonly ["option:append", "option:replacing"];
21
+ }, {
22
+ readonly kind: "requires";
23
+ readonly input: "option:append";
24
+ readonly requires: `option:${string}`;
25
+ }, {
26
+ readonly kind: "requires";
27
+ readonly input: "option:replacing";
28
+ readonly requires: `option:${string}`;
29
+ }, {
30
+ readonly kind: "requires";
31
+ readonly input: "option:all";
32
+ readonly requires: "option:replacing";
33
+ }];
14
34
  type TextEditFlags = {
15
35
  append?: boolean | undefined;
16
36
  replacing?: string | undefined;
17
37
  all?: boolean | undefined;
18
38
  };
19
- /** The usage form of the text-edit flags, to follow the text flag in a usage line. */
20
- export declare const textEditUsage = "[--append|--replacing <old> [--all]]";
21
39
  /** Help paragraph for the text-edit flags of a command whose text flag is `textFlag`. */
22
40
  export declare function textEditHelp(textFlag: "--description" | "--text"): string;
23
41
  /** The value to send to core for a text flag: the full text, or one edit object. */
package/src/text-edit.js CHANGED
@@ -1,12 +1,20 @@
1
1
  import { quit } from "./lib.js";
2
+ import { getOptionInputs, violatesConstraint } from "./input.js";
2
3
  /** The flags that change how a text flag (--description, --text) is applied to the stored text. */
3
4
  export const textEditOptions = {
4
5
  append: { type: "boolean" },
5
- replacing: { type: "string" },
6
+ replacing: { type: "string", value: { kind: "text", name: "old" } },
6
7
  all: { type: "boolean" },
7
8
  };
8
- /** The usage form of the text-edit flags, to follow the text flag in a usage line. */
9
- export const textEditUsage = "[--append|--replacing <old> [--all]]";
9
+ export function textEditConstraints(textFlag) {
10
+ const textInput = `option:${textFlag.slice(2)}`;
11
+ return [
12
+ { kind: "exclusive", members: ["option:append", "option:replacing"] },
13
+ { kind: "requires", input: "option:append", requires: textInput },
14
+ { kind: "requires", input: "option:replacing", requires: textInput },
15
+ { kind: "requires", input: "option:all", requires: "option:replacing" },
16
+ ];
17
+ }
10
18
  /** Help paragraph for the text-edit flags of a command whose text flag is `textFlag`. */
11
19
  export function textEditHelp(textFlag) {
12
20
  return `With --append, the ${textFlag} text is added as a new paragraph.
@@ -19,16 +27,20 @@ An empty ${textFlag} with --replacing deletes the match.`;
19
27
  /** The value to send to core for a text flag: the full text, or one edit object. */
20
28
  export function resolveTextEdit(text, flags, textFlag) {
21
29
  const isAppending = flags.append === true;
22
- const isReplacing = flags.replacing !== undefined;
23
- if (isAppending && isReplacing) {
24
- quit(`Option "--append" cannot be used with "--replacing"`);
30
+ const [exclusiveModifiers, appendRequiresText, replacingRequiresText, allRequiresReplacing] = textEditConstraints(textFlag);
31
+ const inputs = getOptionInputs({ ...flags, [textFlag.slice(2)]: text });
32
+ if (violatesConstraint(exclusiveModifiers, inputs)) {
33
+ quit(`Option "--append" cannot be used with "--replacing"`, undefined, {
34
+ argument: "--append",
35
+ });
25
36
  }
26
- if ((isAppending || isReplacing) && text === undefined) {
37
+ if (violatesConstraint(appendRequiresText, inputs) ||
38
+ violatesConstraint(replacingRequiresText, inputs)) {
27
39
  const modifier = isAppending ? "--append" : "--replacing";
28
- quit(`Option "${modifier}" needs "${textFlag}"`);
40
+ quit(`Option "${modifier}" needs "${textFlag}"`, undefined, { argument: textFlag });
29
41
  }
30
- if (flags.all === true && !isReplacing) {
31
- quit(`Option "--all" needs "--replacing"`);
42
+ if (violatesConstraint(allRequiresReplacing, inputs)) {
43
+ quit(`Option "--all" needs "--replacing"`, undefined, { argument: "--all" });
32
44
  }
33
45
  if (text === undefined) {
34
46
  return undefined;
package/src/types.d.ts CHANGED
@@ -1,6 +1,20 @@
1
+ import type { CommandInput } from "./input.js";
2
+ import type { CommandResult } from "./results.js";
1
3
  export type Command = {
4
+ input: CommandInput;
5
+ results: readonly CommandResult[];
6
+ summary: string;
7
+ effects: {
8
+ domain: "read" | "create" | "update" | "delete" | "replace" | "none";
9
+ storage: "normal-open" | "backup" | "restore" | "migrate" | "reindex" | "inspect" | "none";
10
+ };
11
+ confirmation: {
12
+ kind: "none" | "prompt" | "project-delete";
13
+ description?: string;
14
+ };
2
15
  run: (args: Array<string>) => void | Promise<void>;
3
16
  help: string;
17
+ guessedFlags?: Record<string, (args: Array<string>) => Array<string>>;
4
18
  };
5
19
  export type ParsedRoute = {
6
20
  command: string;