@tallyrelease/cli 0.1.0-beta.4 → 0.1.0-beta.5

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/dist/ci/base.js CHANGED
@@ -103,8 +103,11 @@ export const resolveBuildBase = async (input) => {
103
103
  const defaultRef = async () => {
104
104
  const candidates = [await git.defaultBranch(), ...DEFAULT_REFS];
105
105
  for (const candidate of candidates) {
106
- if (candidate !== undefined &&
107
- (await git.resolve(candidate)) !== undefined) {
106
+ if (candidate === undefined) {
107
+ continue;
108
+ }
109
+ // eslint-disable-next-line no-await-in-loop -- first match wins
110
+ if ((await git.resolve(candidate)) !== undefined) {
108
111
  return candidate;
109
112
  }
110
113
  }
@@ -24,5 +24,6 @@ export const loadConfig = (fs, path) => {
24
24
  issues: result.error.issues,
25
25
  });
26
26
  }
27
- return result.data;
27
+ const { $schema: _, ...config } = result.data;
28
+ return config;
28
29
  };
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  /** Schema of `tallyrelease.yaml`. */
3
3
  export declare const configSchema: z.ZodObject<{
4
+ $schema: z.ZodExactOptional<z.ZodString>;
4
5
  plugins: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
5
6
  defaults: z.ZodExactOptional<z.ZodObject<{
6
7
  release: z.ZodExactOptional<z.ZodBoolean>;
@@ -37,3 +38,105 @@ export declare const configSchema: z.ZodObject<{
37
38
  ignore: z.ZodExactOptional<z.ZodArray<z.ZodString>>;
38
39
  globalInputs: z.ZodExactOptional<z.ZodArray<z.ZodString>>;
39
40
  }, z.core.$strict>;
41
+ /** JSON schema (draft-07) of `tallyrelease.yaml` as published for editors. */
42
+ export declare const configJsonSchema: () => {
43
+ $id: string;
44
+ title: string;
45
+ "~standard": z.core.ZodStandardSchemaWithJSON<z.ZodObject<{
46
+ $schema: z.ZodExactOptional<z.ZodString>;
47
+ plugins: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
48
+ defaults: z.ZodExactOptional<z.ZodObject<{
49
+ release: z.ZodExactOptional<z.ZodBoolean>;
50
+ tagFormat: z.ZodExactOptional<z.ZodString>;
51
+ propagate: z.ZodExactOptional<z.ZodEnum<{
52
+ auto: "auto";
53
+ patch: "patch";
54
+ rebuild: "rebuild";
55
+ }>>;
56
+ }, z.core.$strict>>;
57
+ units: z.ZodExactOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
58
+ id: z.ZodExactOptional<z.ZodString>;
59
+ include: z.ZodExactOptional<z.ZodArray<z.ZodString>>;
60
+ exclude: z.ZodExactOptional<z.ZodArray<z.ZodString>>;
61
+ release: z.ZodExactOptional<z.ZodBoolean>;
62
+ version: z.ZodExactOptional<z.ZodEnum<{
63
+ file: "file";
64
+ tag: "tag";
65
+ }>>;
66
+ scheme: z.ZodExactOptional<z.ZodString>;
67
+ tagFormat: z.ZodExactOptional<z.ZodString>;
68
+ propagate: z.ZodExactOptional<z.ZodEnum<{
69
+ auto: "auto";
70
+ patch: "patch";
71
+ rebuild: "rebuild";
72
+ }>>;
73
+ }, z.core.$strict>>>;
74
+ deps: z.ZodExactOptional<z.ZodArray<z.ZodObject<{
75
+ from: z.ZodString;
76
+ to: z.ZodString;
77
+ pinned: z.ZodExactOptional<z.ZodBoolean>;
78
+ reason: z.ZodExactOptional<z.ZodString>;
79
+ }, z.core.$strict>>>;
80
+ ignore: z.ZodExactOptional<z.ZodArray<z.ZodString>>;
81
+ globalInputs: z.ZodExactOptional<z.ZodArray<z.ZodString>>;
82
+ }, z.core.$strict>>;
83
+ $schema?: "https://json-schema.org/draft/2020-12/schema" | "http://json-schema.org/draft-07/schema#" | "http://json-schema.org/draft-04/schema#";
84
+ $anchor?: string;
85
+ $ref?: string;
86
+ $dynamicRef?: string;
87
+ $dynamicAnchor?: string;
88
+ $vocabulary?: Record<string, boolean>;
89
+ $comment?: string;
90
+ $defs?: Record<string, z.core.JSONSchema.JSONSchema>;
91
+ type?: z.core.JSONSchema.SchemaType | z.core.JSONSchema.SchemaType[];
92
+ additionalItems?: z.core.JSONSchema._JSONSchema;
93
+ unevaluatedItems?: z.core.JSONSchema._JSONSchema;
94
+ prefixItems?: z.core.JSONSchema._JSONSchema[];
95
+ items?: z.core.JSONSchema._JSONSchema | z.core.JSONSchema._JSONSchema[];
96
+ contains?: z.core.JSONSchema._JSONSchema;
97
+ additionalProperties?: z.core.JSONSchema._JSONSchema;
98
+ unevaluatedProperties?: z.core.JSONSchema._JSONSchema;
99
+ properties?: Record<string, z.core.JSONSchema._JSONSchema>;
100
+ patternProperties?: Record<string, z.core.JSONSchema._JSONSchema>;
101
+ dependentSchemas?: Record<string, z.core.JSONSchema._JSONSchema>;
102
+ propertyNames?: z.core.JSONSchema._JSONSchema;
103
+ if?: z.core.JSONSchema._JSONSchema;
104
+ then?: z.core.JSONSchema._JSONSchema;
105
+ else?: z.core.JSONSchema._JSONSchema;
106
+ allOf?: z.core.JSONSchema.JSONSchema[];
107
+ anyOf?: z.core.JSONSchema.JSONSchema[];
108
+ oneOf?: z.core.JSONSchema.JSONSchema[];
109
+ not?: z.core.JSONSchema._JSONSchema;
110
+ multipleOf?: number;
111
+ maximum?: number;
112
+ exclusiveMaximum?: number | boolean;
113
+ minimum?: number;
114
+ exclusiveMinimum?: number | boolean;
115
+ maxLength?: number;
116
+ minLength?: number;
117
+ pattern?: string;
118
+ maxItems?: number;
119
+ minItems?: number;
120
+ uniqueItems?: boolean;
121
+ maxContains?: number;
122
+ minContains?: number;
123
+ maxProperties?: number;
124
+ minProperties?: number;
125
+ required?: string[];
126
+ dependentRequired?: Record<string, string[]>;
127
+ enum?: Array<string | number | boolean | null>;
128
+ const?: string | number | boolean | null;
129
+ id?: string;
130
+ description?: string;
131
+ default?: unknown;
132
+ deprecated?: boolean;
133
+ readOnly?: boolean;
134
+ writeOnly?: boolean;
135
+ nullable?: boolean;
136
+ examples?: unknown[];
137
+ format?: string;
138
+ contentMediaType?: string;
139
+ contentEncoding?: string;
140
+ contentSchema?: z.core.JSONSchema.JSONSchema;
141
+ _prefault?: unknown;
142
+ };
@@ -1,43 +1,105 @@
1
1
  import { z } from "zod";
2
2
  const globs = z.array(z.string()).exactOptional();
3
- const propagate = z.enum(["auto", "patch", "rebuild"]);
3
+ const propagate = z.enum(["auto", "patch", "rebuild"]).meta({
4
+ description: "Policy for this unit when a dependency is released: patch (at least a patch bump), rebuild (rebuild only) or auto (patch if the edge is pinned, else rebuild).",
5
+ });
6
+ const tagFormat = z.string().meta({
7
+ description: "Tag template. Defaults to {id}-v{version}, or v{version} for the root unit.",
8
+ });
4
9
  const unitOverlay = z.strictObject({
5
- id: z.string().exactOptional(),
6
- include: globs,
7
- exclude: globs,
8
- release: z.boolean().exactOptional(),
10
+ id: z
11
+ .string()
12
+ .meta({
13
+ description: "Unit id (letters, digits, dot, underscore, dash). Defaults to the discovered id, or the repo name for the root unit.",
14
+ })
15
+ .exactOptional(),
16
+ include: globs.meta({
17
+ description: "Globs of files owned by the unit. Replaces the default (the unit root).",
18
+ }),
19
+ exclude: globs.meta({
20
+ description: "Globs excluded from the unit, appended to the default (roots of nested units).",
21
+ }),
22
+ release: z
23
+ .boolean()
24
+ .meta({
25
+ description: "Whether the unit is versioned and tagged. Default false (build-only).",
26
+ })
27
+ .exactOptional(),
9
28
  version: z
10
29
  .enum(["file", "tag"], {
11
30
  error: (issue) => issue.input === "none"
12
31
  ? 'version "none" is not supported, use release: false'
13
32
  : undefined,
33
+ })
34
+ .meta({
35
+ description: "Where a released unit's version lives. file: version file written by the plugin. tag: git tags only. Defaults to the plugin's version source.",
14
36
  })
15
37
  .exactOptional(),
16
- scheme: z.string().exactOptional(),
17
- tagFormat: z.string().exactOptional(),
38
+ scheme: z
39
+ .string()
40
+ .meta({ description: "Versioning scheme. Defaults to semver." })
41
+ .exactOptional(),
42
+ tagFormat: tagFormat.exactOptional(),
18
43
  propagate: propagate.exactOptional(),
19
44
  });
20
45
  /** Schema of `tallyrelease.yaml`. */
21
46
  export const configSchema = z.strictObject({
47
+ $schema: z
48
+ .string()
49
+ .meta({ description: "Schema reference for editors, ignored." })
50
+ .exactOptional(),
22
51
  plugins: z
23
52
  .record(z.string(), z.record(z.string(), z.unknown()).nullable())
53
+ .meta({
54
+ description: "Enabled plugins and their options, run in the listed order. Only listed plugins run.",
55
+ })
24
56
  .default({}),
25
57
  defaults: z
26
58
  .strictObject({
27
- release: z.boolean().exactOptional(),
28
- tagFormat: z.string().exactOptional(),
59
+ release: z
60
+ .boolean()
61
+ .meta({
62
+ description: "Release all units unless a unit sets release: false. Default false.",
63
+ })
64
+ .exactOptional(),
65
+ tagFormat: tagFormat.exactOptional(),
29
66
  propagate: propagate.exactOptional(),
67
+ })
68
+ .meta({ description: "Defaults applied to every unit." })
69
+ .exactOptional(),
70
+ units: z
71
+ .record(z.string(), unitOverlay)
72
+ .meta({
73
+ description: "Unit overlays keyed by root path. A root without a discovered unit becomes a config-only unit.",
30
74
  })
31
75
  .exactOptional(),
32
- units: z.record(z.string(), unitOverlay).exactOptional(),
33
76
  deps: z
34
77
  .array(z.strictObject({
35
- from: z.string(),
36
- to: z.string(),
37
- pinned: z.boolean().exactOptional(),
38
- reason: z.string().exactOptional(),
78
+ from: z.string().meta({ description: "Id of the dependency." }),
79
+ to: z.string().meta({ description: "Id of the dependent unit." }),
80
+ pinned: z
81
+ .boolean()
82
+ .meta({
83
+ description: "Whether the dependent pins an exact version.",
84
+ })
85
+ .exactOptional(),
86
+ reason: z
87
+ .string()
88
+ .meta({ description: "Why the edge exists." })
89
+ .exactOptional(),
39
90
  }))
91
+ .meta({ description: "Extra dependency edges between units." })
40
92
  .exactOptional(),
41
- ignore: globs,
42
- globalInputs: globs,
93
+ ignore: globs.meta({
94
+ description: "Globs of files that never affect any unit, for example docs.",
95
+ }),
96
+ globalInputs: globs.meta({
97
+ description: "Globs of files whose change affects all units, unioned with plugin defaults.",
98
+ }),
99
+ });
100
+ /** JSON schema (draft-07) of `tallyrelease.yaml` as published for editors. */
101
+ export const configJsonSchema = () => ({
102
+ ...z.toJSONSchema(configSchema, { target: "draft-7", io: "input" }),
103
+ $id: "https://cdn.jsdelivr.net/npm/@tallyrelease/cli@0/dist/tallyrelease.schema.json",
104
+ title: "tallyrelease.yaml",
43
105
  });
@@ -0,0 +1,163 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "$schema": {
6
+ "type": "string",
7
+ "description": "Schema reference for editors, ignored."
8
+ },
9
+ "plugins": {
10
+ "default": {},
11
+ "type": "object",
12
+ "propertyNames": {
13
+ "type": "string"
14
+ },
15
+ "additionalProperties": {
16
+ "anyOf": [
17
+ {
18
+ "type": "object",
19
+ "propertyNames": {
20
+ "type": "string"
21
+ },
22
+ "additionalProperties": {}
23
+ },
24
+ {
25
+ "type": "null"
26
+ }
27
+ ]
28
+ },
29
+ "description": "Enabled plugins and their options, run in the listed order. Only listed plugins run."
30
+ },
31
+ "defaults": {
32
+ "type": "object",
33
+ "properties": {
34
+ "release": {
35
+ "type": "boolean",
36
+ "description": "Release all units unless a unit sets release: false. Default false."
37
+ },
38
+ "tagFormat": {
39
+ "type": "string",
40
+ "description": "Tag template. Defaults to {id}-v{version}, or v{version} for the root unit."
41
+ },
42
+ "propagate": {
43
+ "type": "string",
44
+ "enum": [
45
+ "auto",
46
+ "patch",
47
+ "rebuild"
48
+ ],
49
+ "description": "Policy for this unit when a dependency is released: patch (at least a patch bump), rebuild (rebuild only) or auto (patch if the edge is pinned, else rebuild)."
50
+ }
51
+ },
52
+ "additionalProperties": false,
53
+ "description": "Defaults applied to every unit."
54
+ },
55
+ "units": {
56
+ "type": "object",
57
+ "propertyNames": {
58
+ "type": "string"
59
+ },
60
+ "additionalProperties": {
61
+ "type": "object",
62
+ "properties": {
63
+ "id": {
64
+ "type": "string",
65
+ "description": "Unit id (letters, digits, dot, underscore, dash). Defaults to the discovered id, or the repo name for the root unit."
66
+ },
67
+ "include": {
68
+ "description": "Globs of files owned by the unit. Replaces the default (the unit root).",
69
+ "type": "array",
70
+ "items": {
71
+ "type": "string"
72
+ }
73
+ },
74
+ "exclude": {
75
+ "description": "Globs excluded from the unit, appended to the default (roots of nested units).",
76
+ "type": "array",
77
+ "items": {
78
+ "type": "string"
79
+ }
80
+ },
81
+ "release": {
82
+ "type": "boolean",
83
+ "description": "Whether the unit is versioned and tagged. Default false (build-only)."
84
+ },
85
+ "version": {
86
+ "type": "string",
87
+ "enum": [
88
+ "file",
89
+ "tag"
90
+ ],
91
+ "description": "Where a released unit's version lives. file: version file written by the plugin. tag: git tags only. Defaults to the plugin's version source."
92
+ },
93
+ "scheme": {
94
+ "type": "string",
95
+ "description": "Versioning scheme. Defaults to semver."
96
+ },
97
+ "tagFormat": {
98
+ "type": "string",
99
+ "description": "Tag template. Defaults to {id}-v{version}, or v{version} for the root unit."
100
+ },
101
+ "propagate": {
102
+ "type": "string",
103
+ "enum": [
104
+ "auto",
105
+ "patch",
106
+ "rebuild"
107
+ ],
108
+ "description": "Policy for this unit when a dependency is released: patch (at least a patch bump), rebuild (rebuild only) or auto (patch if the edge is pinned, else rebuild)."
109
+ }
110
+ },
111
+ "additionalProperties": false
112
+ },
113
+ "description": "Unit overlays keyed by root path. A root without a discovered unit becomes a config-only unit."
114
+ },
115
+ "deps": {
116
+ "type": "array",
117
+ "items": {
118
+ "type": "object",
119
+ "properties": {
120
+ "from": {
121
+ "type": "string",
122
+ "description": "Id of the dependency."
123
+ },
124
+ "to": {
125
+ "type": "string",
126
+ "description": "Id of the dependent unit."
127
+ },
128
+ "pinned": {
129
+ "type": "boolean",
130
+ "description": "Whether the dependent pins an exact version."
131
+ },
132
+ "reason": {
133
+ "type": "string",
134
+ "description": "Why the edge exists."
135
+ }
136
+ },
137
+ "required": [
138
+ "from",
139
+ "to"
140
+ ],
141
+ "additionalProperties": false
142
+ },
143
+ "description": "Extra dependency edges between units."
144
+ },
145
+ "ignore": {
146
+ "description": "Globs of files that never affect any unit, for example docs.",
147
+ "type": "array",
148
+ "items": {
149
+ "type": "string"
150
+ }
151
+ },
152
+ "globalInputs": {
153
+ "description": "Globs of files whose change affects all units, unioned with plugin defaults.",
154
+ "type": "array",
155
+ "items": {
156
+ "type": "string"
157
+ }
158
+ }
159
+ },
160
+ "additionalProperties": false,
161
+ "$id": "https://cdn.jsdelivr.net/npm/@tallyrelease/cli@0/dist/tallyrelease.schema.json",
162
+ "title": "tallyrelease.yaml"
163
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tallyrelease/cli",
3
- "version": "0.1.0-beta.4",
3
+ "version": "0.1.0-beta.5",
4
4
  "description": "Command line interface of tallyrelease",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,8 @@
20
20
  "import": "./dist/index.js",
21
21
  "default": "./dist/index.js"
22
22
  },
23
- "./affected.schema.json": "./dist/affected.schema.json"
23
+ "./affected.schema.json": "./dist/affected.schema.json",
24
+ "./tallyrelease.schema.json": "./dist/tallyrelease.schema.json"
24
25
  },
25
26
  "bin": {
26
27
  "tallyrelease": "./dist/bin.js"
@@ -59,6 +60,7 @@
59
60
  "@internal/tsconfig": "0.0.0",
60
61
  "@types/node": "^24.0.0",
61
62
  "@vitest/coverage-v8": "^5.0.3",
63
+ "ajv": "^8.20.0",
62
64
  "eslint": "^10.12.0",
63
65
  "prettier": "^3.9.9",
64
66
  "typescript": "^6.0.3",
@@ -76,7 +78,8 @@
76
78
  "import": "./dist/index.js",
77
79
  "default": "./dist/index.js"
78
80
  },
79
- "./affected.schema.json": "./dist/affected.schema.json"
81
+ "./affected.schema.json": "./dist/affected.schema.json",
82
+ "./tallyrelease.schema.json": "./dist/tallyrelease.schema.json"
80
83
  },
81
84
  "npm": true
82
85
  }