@capraconsulting/cals-cli 3.17.2 → 3.18.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/lib/cals-cli.mjs CHANGED
@@ -16,10 +16,10 @@ import { Octokit } from '@octokit/rest';
16
16
  import pLimit from 'p-limit';
17
17
  import { findUp } from 'find-up';
18
18
  import yaml from 'js-yaml';
19
- import AJV from 'ajv';
19
+ import { z } from 'zod';
20
20
  import { execa } from 'execa';
21
21
 
22
- var version = "3.17.2";
22
+ var version = "3.18.0";
23
23
  var engines = {
24
24
  node: ">=22.14.0"
25
25
  };
@@ -596,111 +596,39 @@ const command$4 = {
596
596
  },
597
597
  };
598
598
 
599
- var type = "object";
600
- var properties = {
601
- projects: {
602
- type: "array",
603
- items: {
604
- $ref: "#/definitions/Project"
605
- }
606
- }
607
- };
608
- var required = [
609
- "projects"
610
- ];
611
- var definitions = {
612
- Project: {
613
- type: "object",
614
- properties: {
615
- name: {
616
- type: "string"
617
- },
618
- github: {
619
- type: "array",
620
- items: {
621
- type: "object",
622
- properties: {
623
- organization: {
624
- type: "string"
625
- },
626
- repos: {
627
- type: "array",
628
- items: {
629
- $ref: "#/definitions/DefinitionRepo"
630
- }
631
- }
632
- },
633
- required: [
634
- "organization"
635
- ]
636
- }
637
- },
638
- tags: {
639
- type: "array",
640
- items: {
641
- type: "string"
642
- }
643
- }
644
- },
645
- required: [
646
- "github",
647
- "name"
648
- ]
649
- },
650
- DefinitionRepo: {
651
- type: "object",
652
- properties: {
653
- name: {
654
- type: "string"
655
- },
656
- previousNames: {
657
- type: "array",
658
- items: {
659
- $ref: "#/definitions/DefinitionRepoPreviousName"
660
- }
661
- },
662
- archived: {
663
- type: "boolean"
664
- }
665
- },
666
- required: [
667
- "name"
668
- ]
669
- },
670
- DefinitionRepoPreviousName: {
671
- type: "object",
672
- properties: {
673
- name: {
674
- type: "string"
675
- },
676
- project: {
677
- type: "string"
678
- }
679
- },
680
- required: [
681
- "name",
682
- "project"
683
- ]
684
- }
685
- };
686
- var $schema = "http://json-schema.org/draft-07/schema#";
687
- var schema = {
688
- type: type,
689
- properties: properties,
690
- required: required,
691
- definitions: definitions,
692
- $schema: $schema
693
- };
599
+ const definitionRepoPreviousNameSchema = z.object({
600
+ name: z.string(),
601
+ project: z.string(),
602
+ });
603
+ const definitionRepoSchema = z.object({
604
+ name: z.string(),
605
+ previousNames: z.array(definitionRepoPreviousNameSchema).optional(),
606
+ archived: z.boolean().optional(),
607
+ });
608
+ const projectSchema = z.object({
609
+ name: z.string(),
610
+ github: z.array(z.object({
611
+ organization: z.string(),
612
+ repos: z.array(definitionRepoSchema).optional(),
613
+ })),
614
+ tags: z.array(z.string()).optional(),
615
+ });
616
+ const definitionSchema = z.object({
617
+ projects: z.array(projectSchema),
618
+ });
694
619
 
695
620
  function getRepoId(orgName, repoName) {
696
621
  return `${orgName}/${repoName}`;
697
622
  }
698
623
  function checkAgainstSchema(value) {
699
- const ajv = new AJV({ allErrors: true });
700
- const valid = ajv.validate(schema, value);
701
- return valid
702
- ? { definition: value }
703
- : { error: ajv.errorsText() ?? "Unknown error" };
624
+ const result = definitionSchema.safeParse(value);
625
+ return result.success
626
+ ? { definition: result.data }
627
+ : {
628
+ error: result.error.issues
629
+ .map((issue) => `${issue.path.join(".")}: ${issue.message}`)
630
+ .join(", "),
631
+ };
704
632
  }
705
633
  function requireValidDefinition(definition) {
706
634
  // Verify no duplicates in project names.
@@ -1538,7 +1466,7 @@ async function main() {
1538
1466
  process__default.exit(1);
1539
1467
  }
1540
1468
  await yargs(hideBin(process__default.argv))
1541
- .usage(`cals v${version} (build: ${"2026-02-20T12:50:11.575Z"})
1469
+ .usage(`cals v${version} (build: ${"2026-02-23T11:17:30.623Z"})
1542
1470
 
1543
1471
  A CLI for managing GitHub repositories.
1544
1472
 
@@ -1 +1 @@
1
- {"version":3,"file":"cals-cli.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,4 @@
1
- import schema from "../definition-schema.json";
2
1
  import type { Definition, GetReposResponse } from "./types";
3
- export { schema };
4
2
  export declare function getRepoId(orgName: string, repoName: string): string;
5
3
  export declare class DefinitionFile {
6
4
  private readonly path;
@@ -1,26 +1,56 @@
1
- export interface Definition {
2
- projects: Project[];
3
- }
4
- export interface Project {
5
- name: string;
6
- github: {
7
- organization: string;
8
- repos?: DefinitionRepo[];
9
- }[];
10
- tags?: string[];
11
- }
12
- export interface DefinitionRepo {
13
- name: string;
14
- previousNames?: DefinitionRepoPreviousName[];
15
- archived?: boolean;
16
- }
17
- export interface DefinitionRepoPreviousName {
18
- name: string;
19
- project: string;
20
- }
1
+ import { z } from "zod";
2
+ declare const definitionRepoPreviousNameSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ project: z.ZodString;
5
+ }, z.core.$strip>;
6
+ declare const definitionRepoSchema: z.ZodObject<{
7
+ name: z.ZodString;
8
+ previousNames: z.ZodOptional<z.ZodArray<z.ZodObject<{
9
+ name: z.ZodString;
10
+ project: z.ZodString;
11
+ }, z.core.$strip>>>;
12
+ archived: z.ZodOptional<z.ZodBoolean>;
13
+ }, z.core.$strip>;
14
+ declare const projectSchema: z.ZodObject<{
15
+ name: z.ZodString;
16
+ github: z.ZodArray<z.ZodObject<{
17
+ organization: z.ZodString;
18
+ repos: z.ZodOptional<z.ZodArray<z.ZodObject<{
19
+ name: z.ZodString;
20
+ previousNames: z.ZodOptional<z.ZodArray<z.ZodObject<{
21
+ name: z.ZodString;
22
+ project: z.ZodString;
23
+ }, z.core.$strip>>>;
24
+ archived: z.ZodOptional<z.ZodBoolean>;
25
+ }, z.core.$strip>>>;
26
+ }, z.core.$strip>>;
27
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
28
+ }, z.core.$strip>;
29
+ export declare const definitionSchema: z.ZodObject<{
30
+ projects: z.ZodArray<z.ZodObject<{
31
+ name: z.ZodString;
32
+ github: z.ZodArray<z.ZodObject<{
33
+ organization: z.ZodString;
34
+ repos: z.ZodOptional<z.ZodArray<z.ZodObject<{
35
+ name: z.ZodString;
36
+ previousNames: z.ZodOptional<z.ZodArray<z.ZodObject<{
37
+ name: z.ZodString;
38
+ project: z.ZodString;
39
+ }, z.core.$strip>>>;
40
+ archived: z.ZodOptional<z.ZodBoolean>;
41
+ }, z.core.$strip>>>;
42
+ }, z.core.$strip>>;
43
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
44
+ }, z.core.$strip>>;
45
+ }, z.core.$strip>;
46
+ export type Definition = z.infer<typeof definitionSchema>;
47
+ export type Project = z.infer<typeof projectSchema>;
48
+ export type DefinitionRepo = z.infer<typeof definitionRepoSchema>;
49
+ export type DefinitionRepoPreviousName = z.infer<typeof definitionRepoPreviousNameSchema>;
21
50
  export interface GetReposResponse {
22
51
  id: string;
23
52
  orgName: string;
24
53
  project: Project;
25
54
  repo: DefinitionRepo;
26
55
  }
56
+ export {};
package/lib/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import fs from 'node:fs';
2
- import AJV from 'ajv';
3
2
  import yaml from 'js-yaml';
3
+ import { z } from 'zod';
4
4
  import { Buffer } from 'node:buffer';
5
5
  import { performance } from 'node:perf_hooks';
6
6
  import * as process from 'node:process';
@@ -9,117 +9,45 @@ import { Octokit } from '@octokit/rest';
9
9
  import pLimit from 'p-limit';
10
10
  import keytar from 'keytar';
11
11
 
12
- var version = "3.17.2";
12
+ var version = "3.18.0";
13
13
 
14
14
  function uniq(array) {
15
15
  return Array.from(new Set(array));
16
16
  }
17
17
 
18
- var type = "object";
19
- var properties = {
20
- projects: {
21
- type: "array",
22
- items: {
23
- $ref: "#/definitions/Project"
24
- }
25
- }
26
- };
27
- var required = [
28
- "projects"
29
- ];
30
- var definitions = {
31
- Project: {
32
- type: "object",
33
- properties: {
34
- name: {
35
- type: "string"
36
- },
37
- github: {
38
- type: "array",
39
- items: {
40
- type: "object",
41
- properties: {
42
- organization: {
43
- type: "string"
44
- },
45
- repos: {
46
- type: "array",
47
- items: {
48
- $ref: "#/definitions/DefinitionRepo"
49
- }
50
- }
51
- },
52
- required: [
53
- "organization"
54
- ]
55
- }
56
- },
57
- tags: {
58
- type: "array",
59
- items: {
60
- type: "string"
61
- }
62
- }
63
- },
64
- required: [
65
- "github",
66
- "name"
67
- ]
68
- },
69
- DefinitionRepo: {
70
- type: "object",
71
- properties: {
72
- name: {
73
- type: "string"
74
- },
75
- previousNames: {
76
- type: "array",
77
- items: {
78
- $ref: "#/definitions/DefinitionRepoPreviousName"
79
- }
80
- },
81
- archived: {
82
- type: "boolean"
83
- }
84
- },
85
- required: [
86
- "name"
87
- ]
88
- },
89
- DefinitionRepoPreviousName: {
90
- type: "object",
91
- properties: {
92
- name: {
93
- type: "string"
94
- },
95
- project: {
96
- type: "string"
97
- }
98
- },
99
- required: [
100
- "name",
101
- "project"
102
- ]
103
- }
104
- };
105
- var $schema = "http://json-schema.org/draft-07/schema#";
106
- var schema = {
107
- type: type,
108
- properties: properties,
109
- required: required,
110
- definitions: definitions,
111
- $schema: $schema
112
- };
18
+ const definitionRepoPreviousNameSchema = z.object({
19
+ name: z.string(),
20
+ project: z.string(),
21
+ });
22
+ const definitionRepoSchema = z.object({
23
+ name: z.string(),
24
+ previousNames: z.array(definitionRepoPreviousNameSchema).optional(),
25
+ archived: z.boolean().optional(),
26
+ });
27
+ const projectSchema = z.object({
28
+ name: z.string(),
29
+ github: z.array(z.object({
30
+ organization: z.string(),
31
+ repos: z.array(definitionRepoSchema).optional(),
32
+ })),
33
+ tags: z.array(z.string()).optional(),
34
+ });
35
+ const definitionSchema = z.object({
36
+ projects: z.array(projectSchema),
37
+ });
113
38
 
114
39
  function getRepoId(orgName, repoName) {
115
40
  return `${orgName}/${repoName}`;
116
41
  }
117
42
  function checkAgainstSchema(value) {
118
- const ajv = new AJV({ allErrors: true });
119
- const valid = ajv.validate(schema, value);
120
- return valid
121
- ? { definition: value }
122
- : { error: ajv.errorsText() ?? "Unknown error" };
43
+ const result = definitionSchema.safeParse(value);
44
+ return result.success
45
+ ? { definition: result.data }
46
+ : {
47
+ error: result.error.issues
48
+ .map((issue) => `${issue.path.join(".")}: ${issue.message}`)
49
+ .join(", "),
50
+ };
123
51
  }
124
52
  function requireValidDefinition(definition) {
125
53
  // Verify no duplicates in project names.
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import fs from 'node:fs';
2
- import AJV from 'ajv';
3
2
  import yaml from 'js-yaml';
3
+ import { z } from 'zod';
4
4
  import { Buffer } from 'node:buffer';
5
5
  import { performance } from 'node:perf_hooks';
6
6
  import * as process from 'node:process';
@@ -9,117 +9,45 @@ import { Octokit } from '@octokit/rest';
9
9
  import pLimit from 'p-limit';
10
10
  import keytar from 'keytar';
11
11
 
12
- var version = "3.17.2";
12
+ var version = "3.18.0";
13
13
 
14
14
  function uniq(array) {
15
15
  return Array.from(new Set(array));
16
16
  }
17
17
 
18
- var type = "object";
19
- var properties = {
20
- projects: {
21
- type: "array",
22
- items: {
23
- $ref: "#/definitions/Project"
24
- }
25
- }
26
- };
27
- var required = [
28
- "projects"
29
- ];
30
- var definitions = {
31
- Project: {
32
- type: "object",
33
- properties: {
34
- name: {
35
- type: "string"
36
- },
37
- github: {
38
- type: "array",
39
- items: {
40
- type: "object",
41
- properties: {
42
- organization: {
43
- type: "string"
44
- },
45
- repos: {
46
- type: "array",
47
- items: {
48
- $ref: "#/definitions/DefinitionRepo"
49
- }
50
- }
51
- },
52
- required: [
53
- "organization"
54
- ]
55
- }
56
- },
57
- tags: {
58
- type: "array",
59
- items: {
60
- type: "string"
61
- }
62
- }
63
- },
64
- required: [
65
- "github",
66
- "name"
67
- ]
68
- },
69
- DefinitionRepo: {
70
- type: "object",
71
- properties: {
72
- name: {
73
- type: "string"
74
- },
75
- previousNames: {
76
- type: "array",
77
- items: {
78
- $ref: "#/definitions/DefinitionRepoPreviousName"
79
- }
80
- },
81
- archived: {
82
- type: "boolean"
83
- }
84
- },
85
- required: [
86
- "name"
87
- ]
88
- },
89
- DefinitionRepoPreviousName: {
90
- type: "object",
91
- properties: {
92
- name: {
93
- type: "string"
94
- },
95
- project: {
96
- type: "string"
97
- }
98
- },
99
- required: [
100
- "name",
101
- "project"
102
- ]
103
- }
104
- };
105
- var $schema = "http://json-schema.org/draft-07/schema#";
106
- var schema = {
107
- type: type,
108
- properties: properties,
109
- required: required,
110
- definitions: definitions,
111
- $schema: $schema
112
- };
18
+ const definitionRepoPreviousNameSchema = z.object({
19
+ name: z.string(),
20
+ project: z.string(),
21
+ });
22
+ const definitionRepoSchema = z.object({
23
+ name: z.string(),
24
+ previousNames: z.array(definitionRepoPreviousNameSchema).optional(),
25
+ archived: z.boolean().optional(),
26
+ });
27
+ const projectSchema = z.object({
28
+ name: z.string(),
29
+ github: z.array(z.object({
30
+ organization: z.string(),
31
+ repos: z.array(definitionRepoSchema).optional(),
32
+ })),
33
+ tags: z.array(z.string()).optional(),
34
+ });
35
+ const definitionSchema = z.object({
36
+ projects: z.array(projectSchema),
37
+ });
113
38
 
114
39
  function getRepoId(orgName, repoName) {
115
40
  return `${orgName}/${repoName}`;
116
41
  }
117
42
  function checkAgainstSchema(value) {
118
- const ajv = new AJV({ allErrors: true });
119
- const valid = ajv.validate(schema, value);
120
- return valid
121
- ? { definition: value }
122
- : { error: ajv.errorsText() ?? "Unknown error" };
43
+ const result = definitionSchema.safeParse(value);
44
+ return result.success
45
+ ? { definition: result.data }
46
+ : {
47
+ error: result.error.issues
48
+ .map((issue) => `${issue.path.join(".")}: ${issue.message}`)
49
+ .join(", "),
50
+ };
123
51
  }
124
52
  function requireValidDefinition(definition) {
125
53
  // Verify no duplicates in project names.
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@capraconsulting/cals-cli",
3
- "version": "3.17.2",
3
+ "version": "3.18.0",
4
4
  "description": "CLI for repeatable tasks in CALS",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "scripts": {
8
- "prepare": "node scripts/create-definition-schema.ts && husky",
8
+ "prepare": "husky",
9
9
  "build": "rollup -c",
10
10
  "test": "vitest run --coverage src",
11
11
  "test:watch": "vitest --coverage src",
@@ -16,7 +16,7 @@
16
16
  "prepack": "./scripts/build-and-verify.sh",
17
17
  "semantic-release": "semantic-release",
18
18
  "watch": "rollup -c -w",
19
- "upgrade-deps": "ncu --upgrade --install=always"
19
+ "upgrade-deps": "ncu --upgrade --install=always --reject @types/node"
20
20
  },
21
21
  "main": "lib/index.js",
22
22
  "module": "lib/index.es.js",
@@ -26,20 +26,20 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@octokit/rest": "^22.0.1",
29
- "ajv": "^8.18.0",
30
29
  "cachedir": "^2.4.0",
31
30
  "chalk": "5.6.2",
32
31
  "execa": "^9.6.1",
33
32
  "find-up": "^8.0.0",
34
33
  "js-yaml": "^4.1.1",
35
34
  "keytar": "^7.9.0",
36
- "p-limit": "^7.2.0",
37
- "yargs": "18.0.0"
35
+ "p-limit": "^7.3.0",
36
+ "yargs": "18.0.0",
37
+ "zod": "^4.3.6"
38
38
  },
39
39
  "devDependencies": {
40
- "@biomejs/biome": "2.3.13",
41
- "@commitlint/cli": "20.3.1",
42
- "@commitlint/config-conventional": "20.3.1",
40
+ "@biomejs/biome": "2.4.4",
41
+ "@commitlint/cli": "20.4.2",
42
+ "@commitlint/config-conventional": "20.4.2",
43
43
  "@octokit/types": "16.0.0",
44
44
  "@rollup/plugin-alias": "6.0.0",
45
45
  "@rollup/plugin-json": "6.1.0",
@@ -49,12 +49,11 @@
49
49
  "@types/yargs": "17.0.35",
50
50
  "@vitest/coverage-v8": "4.0.18",
51
51
  "husky": "9.1.7",
52
- "npm-check-updates": "19.3.2",
53
- "rollup": "4.57.0",
52
+ "npm-check-updates": "19.4.1",
53
+ "rollup": "4.59.0",
54
54
  "rollup-plugin-typescript2": "0.36.0",
55
- "semantic-release": "25.0.2",
55
+ "semantic-release": "25.0.3",
56
56
  "typescript": "5.9.3",
57
- "typescript-json-schema": "0.67.1",
58
57
  "vitest": "4.0.18"
59
58
  },
60
59
  "files": [