@releasekit/notes 0.26.0 → 0.28.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/README.md +2 -4
- package/dist/{chunk-E63A2Q5L.js → chunk-5TPZELKB.js} +458 -361
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/docs/configuration.md +22 -12
- package/docs/llm-release-notes.md +1 -1
- package/docs/monorepo.md +24 -13
- package/docs/templates.md +12 -0
- package/package.json +2 -1
|
@@ -26,6 +26,9 @@ import * as os from "os";
|
|
|
26
26
|
import * as path2 from "path";
|
|
27
27
|
import path4 from "path";
|
|
28
28
|
import { minimatch } from "minimatch";
|
|
29
|
+
import * as fs4 from "fs";
|
|
30
|
+
import * as path5 from "path";
|
|
31
|
+
import * as yaml from "yaml";
|
|
29
32
|
var ConfigError = class extends ReleaseKitError {
|
|
30
33
|
code = "CONFIG_ERROR";
|
|
31
34
|
suggestions;
|
|
@@ -54,159 +57,154 @@ function parseJsonc(content) {
|
|
|
54
57
|
return result;
|
|
55
58
|
}
|
|
56
59
|
var GitConfigSchema = z.object({
|
|
57
|
-
remote: z.string().default("origin"),
|
|
58
|
-
branch: z.string().default("main"),
|
|
59
|
-
pushMethod: z.enum(["auto", "ssh", "https"]).default("auto"),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
*/
|
|
64
|
-
httpsTokenEnv: z.string().optional(),
|
|
65
|
-
push: z.boolean().optional(),
|
|
66
|
-
skipHooks: z.boolean().optional()
|
|
60
|
+
remote: z.string().default("origin").describe("Git remote name"),
|
|
61
|
+
branch: z.string().default("main").describe("Default branch name"),
|
|
62
|
+
pushMethod: z.enum(["auto", "ssh", "https"]).default("auto").describe("Method for pushing to remote"),
|
|
63
|
+
push: z.boolean().optional().describe("Whether to push changes to remote"),
|
|
64
|
+
httpsTokenEnv: z.string().optional().describe("Environment variable name containing a GitHub token for HTTPS pushes"),
|
|
65
|
+
skipHooks: z.boolean().optional().describe("Skip Git hooks when committing")
|
|
67
66
|
});
|
|
68
67
|
var MonorepoConfigSchema = z.object({
|
|
69
|
-
mode: z.enum(["root", "packages", "both"]).optional(),
|
|
70
|
-
rootPath: z.string().optional(),
|
|
71
|
-
packagesPath: z.string().optional(),
|
|
72
|
-
mainPackage: z.string().optional()
|
|
68
|
+
mode: z.enum(["root", "packages", "both"]).optional().describe("Changelog aggregation mode"),
|
|
69
|
+
rootPath: z.string().optional().describe("Path to root changelog"),
|
|
70
|
+
packagesPath: z.string().optional().describe("Path to packages directory"),
|
|
71
|
+
mainPackage: z.string().optional().describe("Main package name for versioning")
|
|
73
72
|
});
|
|
74
73
|
var BranchPatternSchema = z.object({
|
|
75
|
-
pattern: z.string(),
|
|
76
|
-
releaseType: z.enum(["major", "minor", "patch", "prerelease"])
|
|
74
|
+
pattern: z.string().describe("Glob or regex matched against the branch name (e.g. 'release/*')"),
|
|
75
|
+
releaseType: z.enum(["major", "minor", "patch", "prerelease"]).describe("Version bump type applied when this pattern matches")
|
|
77
76
|
});
|
|
78
77
|
var VersionCargoConfigSchema = z.object({
|
|
79
|
-
enabled: z.boolean().default(true),
|
|
80
|
-
paths: z.array(z.string()).optional()
|
|
78
|
+
enabled: z.boolean().default(true).describe("Enable Cargo.toml version handling"),
|
|
79
|
+
paths: z.array(z.string()).optional().describe("Directories to search for Cargo.toml files")
|
|
80
|
+
});
|
|
81
|
+
var VersionPubConfigSchema = z.object({
|
|
82
|
+
enabled: z.boolean().default(true).describe("Enable pubspec.yaml version handling"),
|
|
83
|
+
paths: z.array(z.string()).optional().describe("Directories to search for pubspec.yaml files")
|
|
81
84
|
});
|
|
82
85
|
var VersionGroupSchema = z.object({
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
* release, all at the same version. See the version.groups reference for the full semantics. */
|
|
90
|
-
sync: z.enum(["fixed", "linked"])
|
|
86
|
+
packages: z.array(z.string()).min(1).describe(
|
|
87
|
+
"Package patterns (exact names, @scope/*, or globs) whose matched packages form this group. Same matching rules as version.packages."
|
|
88
|
+
),
|
|
89
|
+
sync: z.enum(["fixed", "linked"]).describe(
|
|
90
|
+
"fixed: all members release together at the shared group version. linked: only changed members release, all at the same computed version."
|
|
91
|
+
)
|
|
91
92
|
});
|
|
92
93
|
var VersionConfigSchema = z.object({
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
* release commit so version-bump and changelog calculations can still find the previous
|
|
100
|
-
* release in the working branch's history.
|
|
101
|
-
*
|
|
102
|
-
* Supports `${packageName}`, `${prefix}`, `${version}` substitutions. Leave unset for
|
|
103
|
-
* single-tag workflows (the default).
|
|
104
|
-
*/
|
|
105
|
-
baselineTagTemplate: z.string().refine((tpl) => tpl.includes("${version}"), {
|
|
94
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: intentional template-placeholder syntax
|
|
95
|
+
tagTemplate: z.string().default("${prefix}${version}").describe(
|
|
96
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: documenting placeholder syntax to the user
|
|
97
|
+
"Template for Git tags. Available variables: ${version} (version number), ${prefix} (versionPrefix value, e.g. 'v'), ${packageName} (sanitized package name, e.g. 'scope-pkg'). Example: \"${packageName}-${prefix}${version}\" produces \"scope-pkg-v1.2.3\"."
|
|
98
|
+
),
|
|
99
|
+
baselineTagTemplate: z.string().regex(/.*\$\{version\}.*/, {
|
|
106
100
|
message: (
|
|
107
101
|
// biome-ignore lint/suspicious/noTemplateCurlyInString: documenting the expected placeholder syntax to the user
|
|
108
102
|
'baselineTagTemplate must contain a ${version} placeholder so the prefix can be derived (e.g. "release/${prefix}${version}").'
|
|
109
103
|
)
|
|
110
|
-
}).optional()
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
strictReachable: z.boolean().default(false),
|
|
140
|
-
/** Pre-1.0 inferred-breaking bump policy ('spec' | 'strict'). See docs/configuration.md#versionzeromajor. */
|
|
141
|
-
zeroMajor: z.enum(["spec", "strict"]).default("spec"),
|
|
142
|
-
cargo: VersionCargoConfigSchema.optional()
|
|
104
|
+
}).optional().describe(
|
|
105
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: documenting placeholder syntax to the user
|
|
106
|
+
'Optional secondary tag template for an internal \'baseline\' marker that records the release commit on the source branch. Use this when tagTemplate resolves to a tag that gets force-moved off the source branch by a downstream step (e.g. a GitHub Action distributing built artifacts at the version tag) \u2014 the baseline tag stays on the release commit so future version-bump and changelog calculations can still find the previous release. Must contain a ${version} placeholder so the baseline prefix can be derived. Supports the same variables as tagTemplate. Example: "release/${prefix}${version}" produces "release/v1.2.3".'
|
|
107
|
+
),
|
|
108
|
+
packageSpecificTags: z.boolean().default(false).describe("Enable package-specific tagging"),
|
|
109
|
+
preset: z.string().default("conventional").describe("Commit convention preset"),
|
|
110
|
+
sync: z.boolean().default(true).describe(
|
|
111
|
+
"Global lockstep versioning. true is sugar for one implicit fixed group of every package \u2014 it shares the same mechanism as version.groups. Set to false when using version.groups; sync: true alongside groups is treated as the implicit all-packages fixed group taking precedence (a config conflict, warned about at runtime)."
|
|
112
|
+
),
|
|
113
|
+
groups: z.record(z.string(), VersionGroupSchema).optional().describe(
|
|
114
|
+
"Named version groups. Each group binds a set of package patterns to a fixed or linked sync mode. fixed: any releasable change in any member releases ALL members at the shared group version (bump(max(member baselines))). linked: only members with releasable changes release, but every releasing member shares the same computed version. Packages not matched by any group version independently. A package may belong to at most one group. Set version.sync to false when using groups."
|
|
115
|
+
),
|
|
116
|
+
packages: z.array(z.string()).default([]).describe("Packages to include in versioning"),
|
|
117
|
+
mainPackage: z.string().optional().describe("Package to use for version determination"),
|
|
118
|
+
updateInternalDependencies: z.enum(["major", "minor", "patch", "no-internal-update"]).default("minor").describe("How to bump internal dependencies"),
|
|
119
|
+
skip: z.array(z.string()).optional().describe("Packages to exclude from versioning"),
|
|
120
|
+
commitMessage: z.string().optional().describe("Template for release commit messages"),
|
|
121
|
+
versionStrategy: z.enum(["branchPattern", "commitMessage"]).default("commitMessage").describe("Strategy for determining version bumps"),
|
|
122
|
+
branchPatterns: z.array(BranchPatternSchema).optional().describe("Branch name patterns for version determination"),
|
|
123
|
+
defaultReleaseType: z.enum(["major", "minor", "patch", "prerelease"]).optional().describe("Default release type when no pattern matches"),
|
|
124
|
+
mismatchStrategy: z.enum(["error", "warn", "ignore", "prefer-package", "prefer-git"]).default("warn").describe("How to handle version mismatches"),
|
|
125
|
+
versionPrefix: z.string().default("").describe("Prefix for version tags"),
|
|
126
|
+
prereleaseIdentifier: z.string().optional().describe("Identifier for prerelease versions (e.g., 'alpha', 'beta')"),
|
|
127
|
+
strictReachable: z.boolean().default(false).describe("Only use reachable tags"),
|
|
128
|
+
zeroMajor: z.enum(["spec", "strict"]).default("spec").describe(
|
|
129
|
+
"Pre-1.0 handling of commit-inferred breaking changes. 'spec' (default): bump the 0.x minor (0.24.0 \u2192 0.25.0), per semver \xA74. 'strict': bump the next major (\u2192 1.0.0). Inferred path only \u2014 explicit overrides (--bump major, bump:major) always graduate to 1.0.0."
|
|
130
|
+
),
|
|
131
|
+
cargo: VersionCargoConfigSchema.optional().describe("Cargo/Rust configuration"),
|
|
132
|
+
pub: VersionPubConfigSchema.optional().describe("Dart/Flutter pub configuration")
|
|
143
133
|
});
|
|
144
134
|
var NpmConfigSchema = z.object({
|
|
145
|
-
enabled: z.boolean().default(true),
|
|
146
|
-
auth: z.enum(["auto", "oidc", "token"]).default("auto"),
|
|
147
|
-
provenance: z.boolean().default(true),
|
|
148
|
-
access: z.enum(["public", "restricted"]).default("public"),
|
|
149
|
-
registry: z.string().default("https://registry.npmjs.org"),
|
|
150
|
-
copyFiles: z.array(z.string()).default(["LICENSE"]),
|
|
151
|
-
tag: z.string().default("latest")
|
|
135
|
+
enabled: z.boolean().default(true).describe("Enable NPM publishing"),
|
|
136
|
+
auth: z.enum(["auto", "oidc", "token"]).default("auto").describe("Authentication method"),
|
|
137
|
+
provenance: z.boolean().default(true).describe("Enable npm provenance attestation"),
|
|
138
|
+
access: z.enum(["public", "restricted"]).default("public").describe("Package access level"),
|
|
139
|
+
registry: z.string().default("https://registry.npmjs.org").describe("NPM registry URL"),
|
|
140
|
+
copyFiles: z.array(z.string()).default(["LICENSE"]).describe("Files to copy to package before publishing"),
|
|
141
|
+
tag: z.string().default("latest").describe("NPM dist tag")
|
|
152
142
|
});
|
|
153
143
|
var CargoPublishConfigSchema = z.object({
|
|
154
|
-
enabled: z.boolean().default(false),
|
|
155
|
-
noVerify: z.boolean().default(false),
|
|
156
|
-
publishOrder: z.array(z.string()).default([]),
|
|
157
|
-
clean: z.boolean().default(false)
|
|
144
|
+
enabled: z.boolean().default(false).describe("Enable Cargo publishing"),
|
|
145
|
+
noVerify: z.boolean().default(false).describe("Skip verification before publish"),
|
|
146
|
+
publishOrder: z.array(z.string()).default([]).describe("Order in which to publish packages"),
|
|
147
|
+
clean: z.boolean().default(false).describe("Clean before publishing")
|
|
148
|
+
});
|
|
149
|
+
var PubPublishConfigSchema = z.object({
|
|
150
|
+
enabled: z.boolean().default(false).describe("Enable pub.dev publishing"),
|
|
151
|
+
publishOrder: z.array(z.string()).default([]).describe("Order in which to publish packages")
|
|
158
152
|
});
|
|
159
153
|
var PublishGitConfigSchema = z.object({
|
|
160
|
-
push: z.boolean().default(true),
|
|
161
|
-
pushMethod: z.enum(["auto", "ssh", "https"]).optional(),
|
|
162
|
-
remote: z.string().optional(),
|
|
163
|
-
branch: z.string().optional(),
|
|
164
|
-
httpsTokenEnv: z.string().optional(),
|
|
165
|
-
skipHooks: z.boolean().optional()
|
|
154
|
+
push: z.boolean().default(true).describe("Push tags and commits to remote"),
|
|
155
|
+
pushMethod: z.enum(["auto", "ssh", "https"]).optional().describe("Push method override"),
|
|
156
|
+
remote: z.string().optional().describe("Remote name override"),
|
|
157
|
+
branch: z.string().optional().describe("Branch name override"),
|
|
158
|
+
httpsTokenEnv: z.string().optional().describe("Environment variable name containing a GitHub token for HTTPS pushes"),
|
|
159
|
+
skipHooks: z.boolean().optional().describe("Skip Git hooks when committing")
|
|
166
160
|
});
|
|
167
161
|
var GitHubReleaseConfigSchema = z.object({
|
|
168
|
-
enabled: z.boolean().default(true),
|
|
169
|
-
draft: z.boolean().default(true),
|
|
170
|
-
perPackage: z.boolean().default(true),
|
|
171
|
-
prerelease: z.union([z.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
* - 'releaseNotes': Use LLM-generated release notes (requires notes.releaseNotes.enabled: true).
|
|
176
|
-
* - 'changelog': Use formatted changelog entries.
|
|
177
|
-
* - 'generated': Use GitHub's auto-generated notes.
|
|
178
|
-
* - 'none': No body.
|
|
179
|
-
*/
|
|
180
|
-
body: z.enum(["auto", "releaseNotes", "changelog", "generated", "none"]).default("auto"),
|
|
181
|
-
/**
|
|
182
|
-
* Template string for the GitHub release title when a package name is resolved.
|
|
183
|
-
* Available variables: ${packageName} (original scoped name), ${version} (e.g. "v1.0.0").
|
|
184
|
-
* Version-only tags (e.g. "v1.0.0") always use the tag as-is.
|
|
185
|
-
*/
|
|
162
|
+
enabled: z.boolean().default(true).describe("Enable GitHub releases"),
|
|
163
|
+
draft: z.boolean().default(true).describe("Create as draft release"),
|
|
164
|
+
perPackage: z.boolean().default(true).describe("Create separate release per package"),
|
|
165
|
+
prerelease: z.union([z.boolean(), z.literal("auto")]).default("auto").describe("Mark as prerelease"),
|
|
166
|
+
body: z.enum(["auto", "releaseNotes", "changelog", "generated", "none"]).default("auto").describe(
|
|
167
|
+
"Source for GitHub release body. 'auto': use release notes if enabled, else changelog, else GitHub auto. 'releaseNotes': use LLM-generated release notes. 'changelog': use changelog entries. 'generated': GitHub auto-generated. 'none': no body."
|
|
168
|
+
),
|
|
186
169
|
/* biome-ignore lint/suspicious/noTemplateCurlyInString: default template value */
|
|
187
|
-
titleTemplate: z.string().default("${packageName}: ${version}")
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
170
|
+
titleTemplate: z.string().default("${packageName}: ${version}").describe(
|
|
171
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: documenting placeholder syntax to the user
|
|
172
|
+
"Template for the GitHub release title when a package name is resolved. Available variables: ${packageName} (original scoped name, e.g. '@scope/pkg'), ${version} (e.g. 'v1.0.0'). Version-only tags always use the tag string directly."
|
|
173
|
+
),
|
|
174
|
+
skipPackages: z.array(z.string()).default([]).describe("Package names to exclude from GitHub release creation")
|
|
175
|
+
});
|
|
176
|
+
var VerifyRegistryNpmConfigSchema = z.object({
|
|
177
|
+
enabled: z.boolean().default(true).describe("Verify NPM publish"),
|
|
178
|
+
maxAttempts: z.number().int().positive().default(5).describe("Maximum verification attempts"),
|
|
179
|
+
initialDelay: z.number().int().positive().default(15e3).describe("Initial delay in milliseconds"),
|
|
180
|
+
backoffMultiplier: z.number().positive().default(2).describe("Exponential backoff multiplier")
|
|
195
181
|
});
|
|
196
|
-
var
|
|
197
|
-
enabled: z.boolean().default(true),
|
|
198
|
-
maxAttempts: z.number().int().positive().default(
|
|
199
|
-
initialDelay: z.number().int().positive().default(
|
|
200
|
-
backoffMultiplier: z.number().positive().default(2)
|
|
182
|
+
var VerifyRegistryCargoConfigSchema = z.object({
|
|
183
|
+
enabled: z.boolean().default(true).describe("Verify Cargo publish"),
|
|
184
|
+
maxAttempts: z.number().int().positive().default(10).describe("Maximum verification attempts"),
|
|
185
|
+
initialDelay: z.number().int().positive().default(3e4).describe("Initial delay in milliseconds"),
|
|
186
|
+
backoffMultiplier: z.number().positive().default(2).describe("Exponential backoff multiplier")
|
|
187
|
+
});
|
|
188
|
+
var VerifyRegistryPubConfigSchema = z.object({
|
|
189
|
+
enabled: z.boolean().default(true).describe("Verify Dart pub publish"),
|
|
190
|
+
maxAttempts: z.number().int().positive().default(10).describe("Maximum verification attempts"),
|
|
191
|
+
initialDelay: z.number().int().positive().default(3e4).describe("Initial delay in milliseconds"),
|
|
192
|
+
backoffMultiplier: z.number().positive().default(2).describe("Exponential backoff multiplier")
|
|
201
193
|
});
|
|
202
194
|
var VerifyConfigSchema = z.object({
|
|
203
|
-
npm:
|
|
195
|
+
npm: VerifyRegistryNpmConfigSchema.default({
|
|
204
196
|
enabled: true,
|
|
205
197
|
maxAttempts: 5,
|
|
206
198
|
initialDelay: 15e3,
|
|
207
199
|
backoffMultiplier: 2
|
|
208
200
|
}),
|
|
209
|
-
cargo:
|
|
201
|
+
cargo: VerifyRegistryCargoConfigSchema.default({
|
|
202
|
+
enabled: true,
|
|
203
|
+
maxAttempts: 10,
|
|
204
|
+
initialDelay: 3e4,
|
|
205
|
+
backoffMultiplier: 2
|
|
206
|
+
}),
|
|
207
|
+
pub: VerifyRegistryPubConfigSchema.default({
|
|
210
208
|
enabled: true,
|
|
211
209
|
maxAttempts: 10,
|
|
212
210
|
initialDelay: 3e4,
|
|
@@ -214,7 +212,7 @@ var VerifyConfigSchema = z.object({
|
|
|
214
212
|
})
|
|
215
213
|
});
|
|
216
214
|
var PublishConfigSchema = z.object({
|
|
217
|
-
git: PublishGitConfigSchema.optional(),
|
|
215
|
+
git: PublishGitConfigSchema.optional().describe("Git publishing options"),
|
|
218
216
|
npm: NpmConfigSchema.default({
|
|
219
217
|
enabled: true,
|
|
220
218
|
auth: "auto",
|
|
@@ -223,13 +221,17 @@ var PublishConfigSchema = z.object({
|
|
|
223
221
|
registry: "https://registry.npmjs.org",
|
|
224
222
|
copyFiles: ["LICENSE"],
|
|
225
223
|
tag: "latest"
|
|
226
|
-
}),
|
|
224
|
+
}).describe("NPM publishing configuration"),
|
|
227
225
|
cargo: CargoPublishConfigSchema.default({
|
|
228
226
|
enabled: false,
|
|
229
227
|
noVerify: false,
|
|
230
228
|
publishOrder: [],
|
|
231
229
|
clean: false
|
|
232
|
-
}),
|
|
230
|
+
}).describe("Cargo publishing configuration"),
|
|
231
|
+
pub: PubPublishConfigSchema.default({
|
|
232
|
+
enabled: false,
|
|
233
|
+
publishOrder: []
|
|
234
|
+
}).describe("Dart/Flutter publishing configuration via pub"),
|
|
233
235
|
githubRelease: GitHubReleaseConfigSchema.default({
|
|
234
236
|
enabled: true,
|
|
235
237
|
draft: true,
|
|
@@ -239,7 +241,7 @@ var PublishConfigSchema = z.object({
|
|
|
239
241
|
/* biome-ignore lint/suspicious/noTemplateCurlyInString: default template value */
|
|
240
242
|
titleTemplate: "${packageName}: ${version}",
|
|
241
243
|
skipPackages: []
|
|
242
|
-
}),
|
|
244
|
+
}).describe("GitHub Release configuration"),
|
|
243
245
|
verify: VerifyConfigSchema.default({
|
|
244
246
|
npm: {
|
|
245
247
|
enabled: true,
|
|
@@ -252,68 +254,89 @@ var PublishConfigSchema = z.object({
|
|
|
252
254
|
maxAttempts: 10,
|
|
253
255
|
initialDelay: 3e4,
|
|
254
256
|
backoffMultiplier: 2
|
|
257
|
+
},
|
|
258
|
+
pub: {
|
|
259
|
+
enabled: true,
|
|
260
|
+
maxAttempts: 10,
|
|
261
|
+
initialDelay: 3e4,
|
|
262
|
+
backoffMultiplier: 2
|
|
255
263
|
}
|
|
256
|
-
})
|
|
264
|
+
}).describe("Registry verification configuration")
|
|
257
265
|
});
|
|
258
266
|
var TemplateConfigSchema = z.object({
|
|
259
|
-
path: z.string().optional(),
|
|
260
|
-
engine: z.enum(["handlebars", "liquid", "ejs"]).optional()
|
|
267
|
+
path: z.string().optional().describe("Path to custom template"),
|
|
268
|
+
engine: z.enum(["handlebars", "liquid", "ejs"]).optional().describe("Template engine")
|
|
261
269
|
});
|
|
262
270
|
var LocationModeSchema = z.enum(["root", "packages", "both"]);
|
|
263
|
-
var
|
|
264
|
-
|
|
265
|
-
file: z.string().optional(),
|
|
266
|
-
templates: TemplateConfigSchema.optional()
|
|
271
|
+
var ReleaseNotesFileConfigSchema = z.object({
|
|
272
|
+
dir: z.string().default("release-notes").describe("Directory for the per-version release-notes files.")
|
|
267
273
|
});
|
|
274
|
+
var ChangelogConfigSchema = z.object({
|
|
275
|
+
mode: LocationModeSchema.optional().describe(
|
|
276
|
+
"Where to write changelog files. root: repo root only. packages: per-package (monorepos). both: repo root and per-package. When omitted entirely (no changelog config), defaults to root."
|
|
277
|
+
),
|
|
278
|
+
file: z.string().optional().describe("Changelog file name override (default: CHANGELOG.md)"),
|
|
279
|
+
templates: TemplateConfigSchema.optional().describe("Template configuration for changelog")
|
|
280
|
+
}).describe("Changelog file configuration");
|
|
268
281
|
var LLMOptionsSchema = z.object({
|
|
269
|
-
timeout: z.number().optional(),
|
|
270
|
-
maxTokens: z.number().optional(),
|
|
271
|
-
temperature: z.number().optional()
|
|
282
|
+
timeout: z.number().int().optional().describe("Request timeout in ms"),
|
|
283
|
+
maxTokens: z.number().int().optional().describe("Max tokens to generate"),
|
|
284
|
+
temperature: z.number().optional().describe("Sampling temperature")
|
|
272
285
|
});
|
|
273
286
|
var LLMRetryConfigSchema = z.object({
|
|
274
|
-
maxAttempts: z.number().int().positive().optional(),
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
287
|
+
maxAttempts: z.number().int().positive().optional().describe("Maximum number of attempts"),
|
|
288
|
+
// `.int()` here matches the generated JSON Schema (`type: integer`, `minimum`),
|
|
289
|
+
// and closes a pre-generator gap where the Zod runtime accepted floats. Keep
|
|
290
|
+
// these in sync with scripts/generate-schema.ts — relaxing one without the
|
|
291
|
+
// other re-introduces the divergence.
|
|
292
|
+
initialDelay: z.number().int().nonnegative().optional().describe("Initial delay in ms"),
|
|
293
|
+
maxDelay: z.number().int().positive().optional().describe("Maximum delay in ms"),
|
|
294
|
+
backoffFactor: z.number().positive().optional().describe("Delay multiplier per attempt")
|
|
278
295
|
});
|
|
279
296
|
var LLMTasksConfigSchema = z.object({
|
|
280
|
-
summarize: z.boolean().optional(),
|
|
281
|
-
enhance: z.boolean().optional(),
|
|
282
|
-
categorize: z.boolean().optional(),
|
|
283
|
-
releaseNotes: z.boolean().optional()
|
|
297
|
+
summarize: z.boolean().optional().describe("Enable summarization"),
|
|
298
|
+
enhance: z.boolean().optional().describe("Enable entry enhancement"),
|
|
299
|
+
categorize: z.boolean().optional().describe("Enable categorization"),
|
|
300
|
+
releaseNotes: z.boolean().optional().describe("Enable release note generation")
|
|
284
301
|
});
|
|
285
302
|
var LLMCategorySchema = z.object({
|
|
286
|
-
name: z.string(),
|
|
287
|
-
description: z.string(),
|
|
288
|
-
scopes: z.array(z.string()).optional()
|
|
303
|
+
name: z.string().describe("Category label shown in release notes (e.g. 'Features')"),
|
|
304
|
+
description: z.string().describe("LLM instruction describing what commits belong in this category"),
|
|
305
|
+
scopes: z.array(z.string()).optional().describe("Conventional commit scopes assigned to this category")
|
|
289
306
|
});
|
|
290
307
|
var ScopeRulesSchema = z.object({
|
|
291
|
-
allowed: z.array(z.string()).optional(),
|
|
292
|
-
caseSensitive: z.boolean().default(false),
|
|
293
|
-
invalidScopeAction: z.enum(["remove", "keep", "fallback"]).default("remove")
|
|
294
|
-
|
|
308
|
+
allowed: z.array(z.string()).optional().describe("Explicit list of valid scope names; commits with unlisted scopes trigger invalidScopeAction"),
|
|
309
|
+
caseSensitive: z.boolean().default(false).describe("Whether scope comparison is case-sensitive"),
|
|
310
|
+
invalidScopeAction: z.enum(["remove", "keep", "fallback"]).default("remove").describe(
|
|
311
|
+
"Action for commits whose scope is not in the allowed list: 'remove' strips the scope, 'keep' leaves it, 'fallback' substitutes fallbackScope"
|
|
312
|
+
),
|
|
313
|
+
fallbackScope: z.string().optional().describe("Scope substituted when invalidScopeAction is 'fallback'")
|
|
295
314
|
});
|
|
296
315
|
var ScopeConfigSchema = z.object({
|
|
297
|
-
mode: z.enum(["restricted", "packages", "none", "unrestricted"]).default("unrestricted")
|
|
298
|
-
|
|
316
|
+
mode: z.enum(["restricted", "packages", "none", "unrestricted"]).default("unrestricted").describe(
|
|
317
|
+
"Scope allowlist source: 'restricted' uses rules.allowed, 'packages' derives scopes from workspace package names, 'none' strips all scopes, 'unrestricted' allows any scope"
|
|
318
|
+
),
|
|
319
|
+
rules: ScopeRulesSchema.optional().describe("Scope validation and transformation rules")
|
|
299
320
|
});
|
|
300
321
|
var LLMPromptOverridesSchema = z.object({
|
|
301
|
-
enhance: z.string().optional(),
|
|
302
|
-
categorize: z.string().optional(),
|
|
303
|
-
enhanceAndCategorize: z.string().optional(),
|
|
304
|
-
summarize: z.string().optional(),
|
|
305
|
-
releaseNotes: z.string().optional()
|
|
322
|
+
enhance: z.string().optional().describe("Instruction override for the enhance task"),
|
|
323
|
+
categorize: z.string().optional().describe("Instruction override for the categorize task"),
|
|
324
|
+
enhanceAndCategorize: z.string().optional().describe("Instruction override for the combined enhance + categorize task"),
|
|
325
|
+
summarize: z.string().optional().describe("Instruction override for the summarize task"),
|
|
326
|
+
releaseNotes: z.string().optional().describe("Instruction override for the release-notes task")
|
|
306
327
|
});
|
|
307
328
|
var LLMPromptsConfigSchema = z.object({
|
|
308
|
-
instructions: LLMPromptOverridesSchema.optional()
|
|
329
|
+
instructions: LLMPromptOverridesSchema.optional().describe(
|
|
330
|
+
"Per-task instruction overrides appended to the built-in prompts."
|
|
331
|
+
)
|
|
309
332
|
});
|
|
310
333
|
var LLMConfigSchema = z.object({
|
|
311
|
-
provider: z.string(),
|
|
312
|
-
model: z.string(),
|
|
313
|
-
baseURL: z.string().optional(),
|
|
314
|
-
apiKey: z.string().optional(),
|
|
334
|
+
provider: z.string().describe("LLM provider"),
|
|
335
|
+
model: z.string().describe("Model identifier"),
|
|
336
|
+
baseURL: z.string().optional().describe("Custom API base URL"),
|
|
337
|
+
apiKey: z.string().optional().describe("API key"),
|
|
315
338
|
options: LLMOptionsSchema.optional(),
|
|
316
|
-
concurrency: z.number().int().positive().optional(),
|
|
339
|
+
concurrency: z.number().int().positive().optional().describe("Concurrent LLM requests"),
|
|
317
340
|
retry: LLMRetryConfigSchema.optional(),
|
|
318
341
|
tasks: LLMTasksConfigSchema.optional(),
|
|
319
342
|
categories: z.array(LLMCategorySchema).default(() => [
|
|
@@ -325,82 +348,91 @@ var LLMConfigSchema = z.object({
|
|
|
325
348
|
]),
|
|
326
349
|
style: z.string().default(
|
|
327
350
|
'Write in past tense ("Added feature", not "Add feature"). Be concise and user-focused. Lead with the impact, not the implementation detail.'
|
|
328
|
-
),
|
|
351
|
+
).describe("Writing style for LLM"),
|
|
329
352
|
scopes: ScopeConfigSchema.optional(),
|
|
330
353
|
prompts: LLMPromptsConfigSchema.optional(),
|
|
331
|
-
examples: z.number().int().min(0).max(5).default(3),
|
|
354
|
+
examples: z.number().int().min(0).max(5).default(3).describe("Number of few-shot examples to include in LLM prompts (0\u20135)."),
|
|
332
355
|
context: z.object({
|
|
333
|
-
pullRequests: z.boolean().default(true)
|
|
334
|
-
}).default({ pullRequests: true }),
|
|
335
|
-
categoryOrder: z.array(z.string()).optional()
|
|
356
|
+
pullRequests: z.boolean().default(true).describe("Include linked pull request titles/bodies as context.")
|
|
357
|
+
}).default({ pullRequests: true }).describe("Additional context sources for the LLM."),
|
|
358
|
+
categoryOrder: z.array(z.string()).optional().describe(
|
|
359
|
+
"Explicit ordering of categories in the output. Categories not listed retain their configured order after the listed ones."
|
|
360
|
+
),
|
|
361
|
+
cache: z.boolean().default(false).describe(
|
|
362
|
+
"Cache LLM responses on disk (under the OS temp dir), keyed by a hash of the provider, model, prompt, and request options. A re-run or backfill with the same inputs reuses the cached generation instead of re-calling the provider. Off by default."
|
|
363
|
+
)
|
|
336
364
|
});
|
|
337
365
|
var ReleaseNotesConfigSchema = z.object({
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
366
|
+
file: ReleaseNotesFileConfigSchema.optional().describe(
|
|
367
|
+
"Optional in-repo file output. Omit to keep release notes only on the GitHub release body (the default). When set, writes one immutable Markdown file per version under `dir` \u2014 release-notes/<package>/<version>.md in a monorepo, release-notes/<version>.md in a single-package repo \u2014 giving a browsable, provider-independent per-release history."
|
|
368
|
+
),
|
|
369
|
+
templates: TemplateConfigSchema.optional().describe(
|
|
370
|
+
"Template for rendering release notes (e.g. to add docs-site frontmatter). Takes precedence over LLM prose and the default formatted section."
|
|
371
|
+
),
|
|
372
|
+
llm: LLMConfigSchema.optional().describe("LLM configuration for release notes"),
|
|
342
373
|
links: z.object({
|
|
343
|
-
items: z.array(
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
})
|
|
374
|
+
items: z.array(
|
|
375
|
+
z.object({
|
|
376
|
+
label: z.string().describe("Link text"),
|
|
377
|
+
url: z.string().url().describe("Link URL")
|
|
378
|
+
})
|
|
379
|
+
).optional().describe("Static list of links to append."),
|
|
380
|
+
fromPRBodyMarker: z.string().optional().describe("Marker string in PR bodies; content after it is extracted and appended as links."),
|
|
381
|
+
title: z.string().optional().describe("Heading for the links section.")
|
|
382
|
+
}).optional().describe("Extra links to append to the release notes.")
|
|
383
|
+
}).describe("Release notes configuration");
|
|
348
384
|
var NotesInputConfigSchema = z.object({
|
|
349
385
|
source: z.string().optional(),
|
|
350
386
|
file: z.string().optional()
|
|
351
387
|
});
|
|
352
388
|
var NotesConfigSchema = z.object({
|
|
353
|
-
changelog: z.union([z.literal(false), ChangelogConfigSchema]).optional(),
|
|
354
|
-
releaseNotes: z.union([z.literal(false), ReleaseNotesConfigSchema]).optional(),
|
|
355
|
-
updateStrategy: z.enum(["prepend", "regenerate"]).optional()
|
|
389
|
+
changelog: z.union([z.literal(false).describe("Set to false to disable changelog generation"), ChangelogConfigSchema]).optional(),
|
|
390
|
+
releaseNotes: z.union([z.literal(false).describe("Set to false to disable release notes"), ReleaseNotesConfigSchema]).optional(),
|
|
391
|
+
updateStrategy: z.enum(["prepend", "regenerate"]).optional().describe(
|
|
392
|
+
"How to update existing changelog files. 'prepend' adds new entries to the top; 'regenerate' rewrites the file from scratch."
|
|
393
|
+
)
|
|
356
394
|
});
|
|
357
395
|
var CILabelsConfigSchema = z.object({
|
|
358
|
-
stable: z.string().default("channel:stable"),
|
|
359
|
-
prerelease: z.string().default("channel:prerelease"),
|
|
360
|
-
skip: z.string().default("release:skip"),
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
minor: z.string().default("bump:minor"),
|
|
367
|
-
patch: z.string().default("bump:patch")
|
|
396
|
+
stable: z.string().default("channel:stable").describe("Label to graduate a prerelease to stable"),
|
|
397
|
+
prerelease: z.string().default("channel:prerelease").describe("Label to create a prerelease"),
|
|
398
|
+
skip: z.string().default("release:skip").describe("Label to suppress a release on this PR"),
|
|
399
|
+
immediate: z.string().default("release:immediate").describe("Label to bypass the standing PR for one merge \u2014 triggers a direct release. Standing-pr mode only."),
|
|
400
|
+
retry: z.string().default("release:retry").describe("Label to retry a failed publish by re-applying it to a merged standing PR. Standing-pr mode only."),
|
|
401
|
+
major: z.string().default("bump:major").describe("Label to force a major bump"),
|
|
402
|
+
minor: z.string().default("bump:minor").describe("Label to force a minor bump"),
|
|
403
|
+
patch: z.string().default("bump:patch").describe("Label to force a patch bump")
|
|
368
404
|
});
|
|
369
405
|
var StandingPrConfigSchema = z.object({
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
/** Merge method to use when merging the standing release PR. Default: 'merge' */
|
|
385
|
-
mergeMethod: z.enum(["merge", "squash", "rebase"]).default("merge"),
|
|
386
|
-
/** Minimum age of the standing PR before it can be merged. Duration string (e.g. '6h', '30m', '1d'). Gate enforced via the releasekit/standing-pr status check. */
|
|
387
|
-
minAge: z.string().optional(),
|
|
388
|
-
/** Minimum number of packages with releasable changes required to create/maintain the standing PR. Below this threshold, the PR is closed and no new PR is created. */
|
|
389
|
-
minPackages: z.number().int().positive().optional()
|
|
406
|
+
branch: z.string().default("release/next").describe("Branch name for the standing release PR."),
|
|
407
|
+
title: z.string().optional().describe(
|
|
408
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: documenting placeholder syntax to the user
|
|
409
|
+
"PR title template. Variables: ${count} (publishable package count), ${version} (raw version), ${tag} (version with tag prefix). Must start with 'chore: release' to match the default skip pattern on squash merge. Default depends on the versioning strategy: 'chore: release ${tag}' in sync mode, 'chore: release ${count} package(s)' otherwise."
|
|
410
|
+
),
|
|
411
|
+
labels: z.array(z.string()).default(["release"]).describe("Labels to apply to the standing release PR."),
|
|
412
|
+
deleteBranchOnMerge: z.boolean().default(true).describe("Whether to auto-delete the release branch after the PR is merged."),
|
|
413
|
+
mergeMethod: z.enum(["merge", "squash", "rebase"]).default("merge").describe("Merge method to use when merging the standing release PR via CLI."),
|
|
414
|
+
minAge: z.string().optional().describe(
|
|
415
|
+
"Minimum age of the standing PR before it can be merged. Duration string, e.g. '6h', '30m', '1d'. Gate enforced via the releasekit/standing-pr commit status check; configure it as a required status check in branch protection to block merges."
|
|
416
|
+
),
|
|
417
|
+
minPackages: z.number().int().positive().optional().describe(
|
|
418
|
+
"Minimum number of packages with releasable changes required to create or maintain the standing PR. Below this threshold the PR is closed and no new PR is opened."
|
|
419
|
+
)
|
|
390
420
|
});
|
|
391
421
|
var CIConfigSchema = z.object({
|
|
392
|
-
releaseStrategy: z.enum(["manual", "direct", "standing-pr"]).default("direct")
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
skipPatterns: z.array(z.string()).default(["chore: release "])
|
|
403
|
-
|
|
422
|
+
releaseStrategy: z.enum(["manual", "direct", "standing-pr"]).default("direct").describe(
|
|
423
|
+
"How releases are delivered. 'direct': release on merge to main. 'manual': releases triggered manually (e.g. workflow_dispatch). 'standing-pr': changes accumulate in a release PR; gate mode acts as the immediate-release evaluator, firing only for merges labelled with the immediate label."
|
|
424
|
+
),
|
|
425
|
+
releaseTrigger: z.enum(["commit", "label"]).default("label").describe(
|
|
426
|
+
"What triggers a release. 'label': a PR bump label (bump:patch/minor/major) is required. 'commit': conventional commits drive the bump automatically; every merge can trigger a release."
|
|
427
|
+
),
|
|
428
|
+
prPreview: z.boolean().default(true).describe(
|
|
429
|
+
"Enable PR preview comments showing what would be released if the PR is merged. Set to false to disable."
|
|
430
|
+
),
|
|
431
|
+
autoRelease: z.boolean().default(false).describe("Automatically trigger a release when CI conditions are met, without manual intervention."),
|
|
432
|
+
skipPatterns: z.array(z.string()).default(["chore: release "]).describe(
|
|
433
|
+
"Commit message prefixes that suppress a release. The default matches the release commit template to prevent release loops."
|
|
434
|
+
),
|
|
435
|
+
minChanges: z.number().int().positive().default(1).describe("Minimum number of packages with releasable changes required to trigger a release."),
|
|
404
436
|
labels: CILabelsConfigSchema.default({
|
|
405
437
|
stable: "channel:stable",
|
|
406
438
|
prerelease: "channel:prerelease",
|
|
@@ -410,40 +442,36 @@ var CIConfigSchema = z.object({
|
|
|
410
442
|
major: "bump:major",
|
|
411
443
|
minor: "bump:minor",
|
|
412
444
|
patch: "bump:patch"
|
|
413
|
-
}),
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
standingPr: StandingPrConfigSchema.optional()
|
|
445
|
+
}).describe("PR label names used for release control. Override to match your repository's label conventions."),
|
|
446
|
+
scopeLabels: z.record(z.string(), z.string()).optional().describe(
|
|
447
|
+
"Map of scope labels to package patterns. When a PR has a label matching a key, only packages matching the corresponding pattern are released."
|
|
448
|
+
),
|
|
449
|
+
standingPr: StandingPrConfigSchema.optional().describe(
|
|
450
|
+
"Configuration for the standing release PR feature (ci.releaseStrategy: 'standing-pr')."
|
|
451
|
+
)
|
|
421
452
|
});
|
|
422
453
|
var ReleaseCIConfigSchema = z.object({
|
|
423
|
-
skipPatterns: z.array(z.string().min(1)).optional(),
|
|
424
|
-
minChanges: z.number().int().positive().optional(),
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
/** Set to `false` to disable changelog generation in CI. */
|
|
428
|
-
notes: z.literal(false).optional()
|
|
454
|
+
skipPatterns: z.array(z.string().min(1)).optional().describe("Commit message prefixes that prevent a release (e.g. 'chore(deps):', 'ci:')"),
|
|
455
|
+
minChanges: z.number().int().positive().optional().describe("Minimum number of packages with releasable changes required to trigger a release"),
|
|
456
|
+
githubRelease: z.literal(false).optional().describe("Set to false to disable GitHub release creation in CI"),
|
|
457
|
+
notes: z.literal(false).optional().describe("Set to false to disable changelog generation in CI")
|
|
429
458
|
});
|
|
430
459
|
var ReleaseConfigSchema = z.object({
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
* 'publish' can be opted out. Omitting a step is equivalent to --skip-<step>.
|
|
434
|
-
*/
|
|
435
|
-
steps: z.array(z.enum(["notes", "publish"])).min(1).optional(),
|
|
436
|
-
ci: ReleaseCIConfigSchema.optional()
|
|
460
|
+
steps: z.array(z.enum(["notes", "publish"])).min(1).optional().describe("Which steps to run by default. Omitting a step is equivalent to --skip-<step>."),
|
|
461
|
+
ci: ReleaseCIConfigSchema.optional().describe("CI-specific automation settings")
|
|
437
462
|
});
|
|
438
463
|
var ReleaseKitConfigSchema = z.object({
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
464
|
+
$schema: z.string().optional().describe("JSON schema reference URL"),
|
|
465
|
+
git: GitConfigSchema.optional().describe("Git configuration"),
|
|
466
|
+
monorepo: MonorepoConfigSchema.optional().describe("Monorepo configuration"),
|
|
467
|
+
version: VersionConfigSchema.optional().describe("Versioning configuration"),
|
|
468
|
+
publish: PublishConfigSchema.optional().describe("Publishing configuration"),
|
|
469
|
+
notes: NotesConfigSchema.optional().describe("Changelog and release notes configuration"),
|
|
470
|
+
ci: CIConfigSchema.optional().describe(
|
|
471
|
+
"CI automation configuration for release triggers, PR previews, and label management"
|
|
472
|
+
),
|
|
473
|
+
release: ReleaseConfigSchema.optional().describe("Release pipeline automation configuration")
|
|
474
|
+
}).describe("Configuration schema for ReleaseKit - Automated versioning, changelog generation, and publishing");
|
|
447
475
|
var MAX_INPUT_LENGTH = 1e4;
|
|
448
476
|
function substituteVariables(value) {
|
|
449
477
|
if (value.length > MAX_INPUT_LENGTH) {
|
|
@@ -517,6 +545,21 @@ function resolveConfigPath(cwd) {
|
|
|
517
545
|
}
|
|
518
546
|
return path3.join(cwd, CONFIG_FILES[0]);
|
|
519
547
|
}
|
|
548
|
+
function isRecord(value) {
|
|
549
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
550
|
+
}
|
|
551
|
+
function assertNoRemovedReleaseNotesFields(config) {
|
|
552
|
+
if (!isRecord(config) || !isRecord(config.notes) || !isRecord(config.notes.releaseNotes)) return;
|
|
553
|
+
const rn = config.notes.releaseNotes;
|
|
554
|
+
const removed = [];
|
|
555
|
+
if ("mode" in rn) removed.push("mode");
|
|
556
|
+
if ("directory" in rn) removed.push("directory");
|
|
557
|
+
if (typeof rn.file === "string") removed.push("file (string)");
|
|
558
|
+
if (removed.length === 0) return;
|
|
559
|
+
throw new ConfigError(
|
|
560
|
+
`notes.releaseNotes no longer supports ${removed.join(", ")}. Release notes go to the GitHub release body by default; for in-repo per-version files set notes.releaseNotes.file to { "dir": "release-notes" }. For a cumulative changelog file, use changelog.mode.`
|
|
561
|
+
);
|
|
562
|
+
}
|
|
520
563
|
function loadConfigFile(configPath) {
|
|
521
564
|
if (!fs3.existsSync(configPath)) {
|
|
522
565
|
return {};
|
|
@@ -525,6 +568,7 @@ function loadConfigFile(configPath) {
|
|
|
525
568
|
const content = fs3.readFileSync(configPath, "utf-8");
|
|
526
569
|
const parsed = parseJsonc(content);
|
|
527
570
|
const substituted = substituteInObject(parsed);
|
|
571
|
+
assertNoRemovedReleaseNotesFields(substituted);
|
|
528
572
|
return ReleaseKitConfigSchema.parse(substituted);
|
|
529
573
|
} catch (error2) {
|
|
530
574
|
if (error2 instanceof z2.ZodError) {
|
|
@@ -606,7 +650,7 @@ function getExitCode(error2) {
|
|
|
606
650
|
}
|
|
607
651
|
|
|
608
652
|
// src/input/version-output.ts
|
|
609
|
-
import * as
|
|
653
|
+
import * as fs5 from "fs";
|
|
610
654
|
function normalizeEntryType(type) {
|
|
611
655
|
const typeMap = {
|
|
612
656
|
added: "added",
|
|
@@ -663,7 +707,7 @@ function parseVersionOutput(json) {
|
|
|
663
707
|
return versionOutputToChangelogInput(data);
|
|
664
708
|
}
|
|
665
709
|
function parseVersionOutputFile(filePath) {
|
|
666
|
-
const content =
|
|
710
|
+
const content = fs5.readFileSync(filePath, "utf-8");
|
|
667
711
|
return parseVersionOutput(content);
|
|
668
712
|
}
|
|
669
713
|
async function parseVersionOutputStdin() {
|
|
@@ -690,8 +734,55 @@ function getDefaultConfig() {
|
|
|
690
734
|
}
|
|
691
735
|
|
|
692
736
|
// src/core/pipeline.ts
|
|
693
|
-
import * as
|
|
694
|
-
import * as
|
|
737
|
+
import * as fs13 from "fs";
|
|
738
|
+
import * as path12 from "path";
|
|
739
|
+
|
|
740
|
+
// src/llm/cache.ts
|
|
741
|
+
import { createHash } from "crypto";
|
|
742
|
+
import * as fs6 from "fs/promises";
|
|
743
|
+
import * as os2 from "os";
|
|
744
|
+
import * as path6 from "path";
|
|
745
|
+
function defaultCacheDir() {
|
|
746
|
+
return path6.join(os2.tmpdir(), "releasekit", "llm-cache");
|
|
747
|
+
}
|
|
748
|
+
function stableStringify(value) {
|
|
749
|
+
return JSON.stringify(
|
|
750
|
+
value,
|
|
751
|
+
(_key, val) => val && typeof val === "object" && !Array.isArray(val) ? Object.fromEntries(Object.entries(val).sort(([a], [b]) => a < b ? -1 : 1)) : val
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
function withContentHashCache(provider, identity, dir = defaultCacheDir()) {
|
|
755
|
+
return {
|
|
756
|
+
name: provider.name,
|
|
757
|
+
capabilities: provider.capabilities,
|
|
758
|
+
async complete(messages, options) {
|
|
759
|
+
const key = createHash("sha256").update(
|
|
760
|
+
stableStringify({
|
|
761
|
+
provider: provider.name,
|
|
762
|
+
model: identity.model,
|
|
763
|
+
baseURL: identity.baseURL,
|
|
764
|
+
messages,
|
|
765
|
+
temperature: options?.temperature,
|
|
766
|
+
maxTokens: options?.maxTokens,
|
|
767
|
+
schema: options?.schema,
|
|
768
|
+
toolName: options?.toolName
|
|
769
|
+
})
|
|
770
|
+
).digest("hex");
|
|
771
|
+
const file = path6.join(dir, `${key}.json`);
|
|
772
|
+
try {
|
|
773
|
+
return JSON.parse(await fs6.readFile(file, "utf-8"));
|
|
774
|
+
} catch {
|
|
775
|
+
}
|
|
776
|
+
const result = await provider.complete(messages, options);
|
|
777
|
+
try {
|
|
778
|
+
await fs6.mkdir(dir, { recursive: true });
|
|
779
|
+
await fs6.writeFile(file, JSON.stringify(result));
|
|
780
|
+
} catch {
|
|
781
|
+
}
|
|
782
|
+
return result;
|
|
783
|
+
}
|
|
784
|
+
};
|
|
785
|
+
}
|
|
695
786
|
|
|
696
787
|
// src/llm/context/prFetcher.ts
|
|
697
788
|
import { RequestError } from "@octokit/request-error";
|
|
@@ -804,10 +895,10 @@ var LLM_DEFAULTS = {
|
|
|
804
895
|
};
|
|
805
896
|
|
|
806
897
|
// src/llm/examples/fetcher.ts
|
|
807
|
-
import { createHash } from "crypto";
|
|
808
|
-
import * as
|
|
809
|
-
import * as
|
|
810
|
-
import * as
|
|
898
|
+
import { createHash as createHash2 } from "crypto";
|
|
899
|
+
import * as fs7 from "fs";
|
|
900
|
+
import * as os3 from "os";
|
|
901
|
+
import * as path7 from "path";
|
|
811
902
|
import { RequestError as RequestError2 } from "@octokit/request-error";
|
|
812
903
|
import { Octokit as Octokit2 } from "@octokit/rest";
|
|
813
904
|
|
|
@@ -863,16 +954,16 @@ ${blocks.join("\n")}
|
|
|
863
954
|
|
|
864
955
|
// src/llm/examples/fetcher.ts
|
|
865
956
|
function cacheDir() {
|
|
866
|
-
return
|
|
957
|
+
return path7.join(os3.tmpdir(), "releasekit", "examples");
|
|
867
958
|
}
|
|
868
959
|
function cacheKey(owner, repo, packageName) {
|
|
869
960
|
const safe = packageName.replace(/[^a-zA-Z0-9-]/g, "_");
|
|
870
|
-
const hash =
|
|
871
|
-
return
|
|
961
|
+
const hash = createHash2("sha256").update(packageName).digest("hex").slice(0, 8);
|
|
962
|
+
return path7.join(cacheDir(), owner, repo, `${safe}_${hash}.json`);
|
|
872
963
|
}
|
|
873
964
|
function readCache(key, latestTag, count) {
|
|
874
965
|
try {
|
|
875
|
-
const raw =
|
|
966
|
+
const raw = fs7.readFileSync(key, "utf-8");
|
|
876
967
|
const entry = JSON.parse(raw);
|
|
877
968
|
if (entry.latestTag !== latestTag || entry.count < count) return null;
|
|
878
969
|
return entry.examples;
|
|
@@ -882,8 +973,8 @@ function readCache(key, latestTag, count) {
|
|
|
882
973
|
}
|
|
883
974
|
function writeCache(key, latestTag, count, examples) {
|
|
884
975
|
try {
|
|
885
|
-
|
|
886
|
-
|
|
976
|
+
fs7.mkdirSync(path7.dirname(key), { recursive: true });
|
|
977
|
+
fs7.writeFileSync(key, JSON.stringify({ latestTag, count, examples }), "utf-8");
|
|
887
978
|
} catch {
|
|
888
979
|
}
|
|
889
980
|
}
|
|
@@ -1038,6 +1129,16 @@ var AnthropicProvider = class extends BaseLLMProvider {
|
|
|
1038
1129
|
}
|
|
1039
1130
|
};
|
|
1040
1131
|
|
|
1132
|
+
// src/utils/json.ts
|
|
1133
|
+
function extractJsonFromResponse(response) {
|
|
1134
|
+
const stripped = response.replace(/^```(?:json)?\n?/, "").replace(/\n?```$/, "").trim();
|
|
1135
|
+
const objectMatch = stripped.match(/\{[\s\S]*\}/);
|
|
1136
|
+
if (objectMatch) return objectMatch[0];
|
|
1137
|
+
const arrayMatch = stripped.match(/\[[\s\S]*\]/);
|
|
1138
|
+
if (arrayMatch) return arrayMatch[0];
|
|
1139
|
+
return stripped;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1041
1142
|
// src/llm/ollama.ts
|
|
1042
1143
|
var OllamaProvider = class extends BaseLLMProvider {
|
|
1043
1144
|
name = "ollama";
|
|
@@ -1100,7 +1201,7 @@ var OllamaProvider = class extends BaseLLMProvider {
|
|
|
1100
1201
|
const content = data.message.content;
|
|
1101
1202
|
if (options?.schema) {
|
|
1102
1203
|
try {
|
|
1103
|
-
const structured = JSON.parse(content);
|
|
1204
|
+
const structured = JSON.parse(extractJsonFromResponse(content));
|
|
1104
1205
|
return { content, structured };
|
|
1105
1206
|
} catch (e) {
|
|
1106
1207
|
debug(`Ollama: failed to parse structured response: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -1167,7 +1268,7 @@ var OpenAIProvider = class extends BaseLLMProvider {
|
|
|
1167
1268
|
}
|
|
1168
1269
|
if (options?.schema) {
|
|
1169
1270
|
try {
|
|
1170
|
-
const structured = JSON.parse(content);
|
|
1271
|
+
const structured = JSON.parse(extractJsonFromResponse(content));
|
|
1171
1272
|
return { content, structured };
|
|
1172
1273
|
} catch (e) {
|
|
1173
1274
|
debug(`OpenAI: failed to parse structured response: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -1226,16 +1327,6 @@ var OpenAICompatibleProvider = class extends BaseLLMProvider {
|
|
|
1226
1327
|
}
|
|
1227
1328
|
};
|
|
1228
1329
|
|
|
1229
|
-
// src/utils/json.ts
|
|
1230
|
-
function extractJsonFromResponse(response) {
|
|
1231
|
-
const stripped = response.replace(/^```(?:json)?\n?/, "").replace(/\n?```$/, "").trim();
|
|
1232
|
-
const objectMatch = stripped.match(/\{[\s\S]*\}/);
|
|
1233
|
-
if (objectMatch) return objectMatch[0];
|
|
1234
|
-
const arrayMatch = stripped.match(/\[[\s\S]*\]/);
|
|
1235
|
-
if (arrayMatch) return arrayMatch[0];
|
|
1236
|
-
return stripped;
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
1330
|
// src/llm/correctiveRetry.ts
|
|
1240
1331
|
async function withCorrectiveRetry(call, validate, buildCorrectionMessages3, initialMessages, maxCorrectiveAttempts = 2) {
|
|
1241
1332
|
let messages = initialMessages;
|
|
@@ -1872,8 +1963,29 @@ function createProvider(config) {
|
|
|
1872
1963
|
}
|
|
1873
1964
|
}
|
|
1874
1965
|
|
|
1966
|
+
// src/output/versioned.ts
|
|
1967
|
+
import * as fs8 from "fs";
|
|
1968
|
+
import * as path8 from "path";
|
|
1969
|
+
function writeVersionedNotes(contexts, directory, dryRun, nested, renderContent) {
|
|
1970
|
+
const written = [];
|
|
1971
|
+
for (const ctx of contexts) {
|
|
1972
|
+
const outputPath = nested ? path8.join(directory, ctx.packageName, `${ctx.version}.md`) : path8.join(directory, `${ctx.version}.md`);
|
|
1973
|
+
const content = renderContent(ctx);
|
|
1974
|
+
if (dryRun) {
|
|
1975
|
+
info(`[DRY RUN] Release notes (would write to ${outputPath}):`);
|
|
1976
|
+
info(content);
|
|
1977
|
+
continue;
|
|
1978
|
+
}
|
|
1979
|
+
fs8.mkdirSync(path8.dirname(outputPath), { recursive: true });
|
|
1980
|
+
fs8.writeFileSync(outputPath, content, "utf-8");
|
|
1981
|
+
success(`Release notes written to ${outputPath}`);
|
|
1982
|
+
written.push(outputPath);
|
|
1983
|
+
}
|
|
1984
|
+
return written;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1875
1987
|
// src/templates/ejs.ts
|
|
1876
|
-
import * as
|
|
1988
|
+
import * as fs9 from "fs";
|
|
1877
1989
|
import ejs from "ejs";
|
|
1878
1990
|
function renderEjs(template, context) {
|
|
1879
1991
|
try {
|
|
@@ -1883,16 +1995,16 @@ function renderEjs(template, context) {
|
|
|
1883
1995
|
}
|
|
1884
1996
|
}
|
|
1885
1997
|
function renderEjsFile(filePath, context) {
|
|
1886
|
-
if (!
|
|
1998
|
+
if (!fs9.existsSync(filePath)) {
|
|
1887
1999
|
throw new TemplateError(`Template file not found: ${filePath}`);
|
|
1888
2000
|
}
|
|
1889
|
-
const template =
|
|
2001
|
+
const template = fs9.readFileSync(filePath, "utf-8");
|
|
1890
2002
|
return renderEjs(template, context);
|
|
1891
2003
|
}
|
|
1892
2004
|
|
|
1893
2005
|
// src/templates/handlebars.ts
|
|
1894
|
-
import * as
|
|
1895
|
-
import * as
|
|
2006
|
+
import * as fs10 from "fs";
|
|
2007
|
+
import * as path9 from "path";
|
|
1896
2008
|
import Handlebars from "handlebars";
|
|
1897
2009
|
function registerHandlebarsHelpers() {
|
|
1898
2010
|
Handlebars.registerHelper("capitalize", (str) => {
|
|
@@ -1918,28 +2030,28 @@ function renderHandlebars(template, context) {
|
|
|
1918
2030
|
}
|
|
1919
2031
|
}
|
|
1920
2032
|
function renderHandlebarsFile(filePath, context) {
|
|
1921
|
-
if (!
|
|
2033
|
+
if (!fs10.existsSync(filePath)) {
|
|
1922
2034
|
throw new TemplateError(`Template file not found: ${filePath}`);
|
|
1923
2035
|
}
|
|
1924
|
-
const template =
|
|
2036
|
+
const template = fs10.readFileSync(filePath, "utf-8");
|
|
1925
2037
|
return renderHandlebars(template, context);
|
|
1926
2038
|
}
|
|
1927
2039
|
function renderHandlebarsComposable(templateDir, context) {
|
|
1928
2040
|
registerHandlebarsHelpers();
|
|
1929
|
-
const versionPath =
|
|
1930
|
-
const entryPath =
|
|
1931
|
-
const documentPath =
|
|
1932
|
-
if (!
|
|
2041
|
+
const versionPath = path9.join(templateDir, "version.hbs");
|
|
2042
|
+
const entryPath = path9.join(templateDir, "entry.hbs");
|
|
2043
|
+
const documentPath = path9.join(templateDir, "document.hbs");
|
|
2044
|
+
if (!fs10.existsSync(documentPath)) {
|
|
1933
2045
|
throw new TemplateError(`Document template not found: ${documentPath}`);
|
|
1934
2046
|
}
|
|
1935
|
-
if (
|
|
1936
|
-
Handlebars.registerPartial("version",
|
|
2047
|
+
if (fs10.existsSync(versionPath)) {
|
|
2048
|
+
Handlebars.registerPartial("version", fs10.readFileSync(versionPath, "utf-8"));
|
|
1937
2049
|
}
|
|
1938
|
-
if (
|
|
1939
|
-
Handlebars.registerPartial("entry",
|
|
2050
|
+
if (fs10.existsSync(entryPath)) {
|
|
2051
|
+
Handlebars.registerPartial("entry", fs10.readFileSync(entryPath, "utf-8"));
|
|
1940
2052
|
}
|
|
1941
2053
|
try {
|
|
1942
|
-
const compiled = Handlebars.compile(
|
|
2054
|
+
const compiled = Handlebars.compile(fs10.readFileSync(documentPath, "utf-8"));
|
|
1943
2055
|
return compiled(context);
|
|
1944
2056
|
} catch (error2) {
|
|
1945
2057
|
throw new TemplateError(`Handlebars render error: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
@@ -1947,8 +2059,8 @@ function renderHandlebarsComposable(templateDir, context) {
|
|
|
1947
2059
|
}
|
|
1948
2060
|
|
|
1949
2061
|
// src/templates/liquid.ts
|
|
1950
|
-
import * as
|
|
1951
|
-
import * as
|
|
2062
|
+
import * as fs11 from "fs";
|
|
2063
|
+
import * as path10 from "path";
|
|
1952
2064
|
import { Liquid } from "liquidjs";
|
|
1953
2065
|
function createLiquidEngine(root) {
|
|
1954
2066
|
return new Liquid({
|
|
@@ -1966,15 +2078,15 @@ function renderLiquid(template, context) {
|
|
|
1966
2078
|
}
|
|
1967
2079
|
}
|
|
1968
2080
|
function renderLiquidFile(filePath, context) {
|
|
1969
|
-
if (!
|
|
2081
|
+
if (!fs11.existsSync(filePath)) {
|
|
1970
2082
|
throw new TemplateError(`Template file not found: ${filePath}`);
|
|
1971
2083
|
}
|
|
1972
|
-
const template =
|
|
2084
|
+
const template = fs11.readFileSync(filePath, "utf-8");
|
|
1973
2085
|
return renderLiquid(template, context);
|
|
1974
2086
|
}
|
|
1975
2087
|
function renderLiquidComposable(templateDir, context) {
|
|
1976
|
-
const documentPath =
|
|
1977
|
-
if (!
|
|
2088
|
+
const documentPath = path10.join(templateDir, "document.liquid");
|
|
2089
|
+
if (!fs11.existsSync(documentPath)) {
|
|
1978
2090
|
throw new TemplateError(`Document template not found: ${documentPath}`);
|
|
1979
2091
|
}
|
|
1980
2092
|
const engine = createLiquidEngine(templateDir);
|
|
@@ -1986,10 +2098,10 @@ function renderLiquidComposable(templateDir, context) {
|
|
|
1986
2098
|
}
|
|
1987
2099
|
|
|
1988
2100
|
// src/templates/loader.ts
|
|
1989
|
-
import * as
|
|
1990
|
-
import * as
|
|
2101
|
+
import * as fs12 from "fs";
|
|
2102
|
+
import * as path11 from "path";
|
|
1991
2103
|
function getEngineFromFile(filePath) {
|
|
1992
|
-
const ext =
|
|
2104
|
+
const ext = path11.extname(filePath).toLowerCase();
|
|
1993
2105
|
switch (ext) {
|
|
1994
2106
|
case ".liquid":
|
|
1995
2107
|
return "liquid";
|
|
@@ -2023,10 +2135,10 @@ function getRenderFileFn(engine) {
|
|
|
2023
2135
|
}
|
|
2024
2136
|
}
|
|
2025
2137
|
function detectTemplateMode(templatePath) {
|
|
2026
|
-
if (!
|
|
2138
|
+
if (!fs12.existsSync(templatePath)) {
|
|
2027
2139
|
throw new TemplateError(`Template path not found: ${templatePath}`);
|
|
2028
2140
|
}
|
|
2029
|
-
const stat =
|
|
2141
|
+
const stat = fs12.statSync(templatePath);
|
|
2030
2142
|
if (stat.isFile()) {
|
|
2031
2143
|
return "single";
|
|
2032
2144
|
}
|
|
@@ -2044,7 +2156,7 @@ function renderSingleFile(templatePath, context, engine) {
|
|
|
2044
2156
|
};
|
|
2045
2157
|
}
|
|
2046
2158
|
function renderComposable(templateDir, context, engine) {
|
|
2047
|
-
const files =
|
|
2159
|
+
const files = fs12.readdirSync(templateDir);
|
|
2048
2160
|
const engineMap = {
|
|
2049
2161
|
liquid: { document: "document.liquid", version: "version.liquid", entry: "entry.liquid" },
|
|
2050
2162
|
handlebars: { document: "document.hbs", version: "version.hbs", entry: "entry.hbs" },
|
|
@@ -2067,15 +2179,15 @@ function renderComposable(templateDir, context, engine) {
|
|
|
2067
2179
|
return { content: renderHandlebarsComposable(templateDir, context), engine: resolvedEngine };
|
|
2068
2180
|
}
|
|
2069
2181
|
const expectedFiles = engineMap[resolvedEngine];
|
|
2070
|
-
const documentPath =
|
|
2071
|
-
if (!
|
|
2182
|
+
const documentPath = path11.join(templateDir, expectedFiles.document);
|
|
2183
|
+
if (!fs12.existsSync(documentPath)) {
|
|
2072
2184
|
throw new TemplateError(`Document template not found: ${expectedFiles.document}`);
|
|
2073
2185
|
}
|
|
2074
|
-
const versionPath =
|
|
2075
|
-
const entryPath =
|
|
2186
|
+
const versionPath = path11.join(templateDir, expectedFiles.version);
|
|
2187
|
+
const entryPath = path11.join(templateDir, expectedFiles.entry);
|
|
2076
2188
|
const render = getRenderFn(resolvedEngine);
|
|
2077
|
-
const entryTemplate =
|
|
2078
|
-
const versionTemplate =
|
|
2189
|
+
const entryTemplate = fs12.existsSync(entryPath) ? fs12.readFileSync(entryPath, "utf-8") : null;
|
|
2190
|
+
const versionTemplate = fs12.existsSync(versionPath) ? fs12.readFileSync(versionPath, "utf-8") : null;
|
|
2079
2191
|
if (entryTemplate && versionTemplate) {
|
|
2080
2192
|
const versionsWithEntries = context.versions.map((versionCtx) => {
|
|
2081
2193
|
const entries = versionCtx.entries.map((entry) => {
|
|
@@ -2086,7 +2198,7 @@ function renderComposable(templateDir, context, engine) {
|
|
|
2086
2198
|
});
|
|
2087
2199
|
const docContext = { ...context, renderedVersions: versionsWithEntries };
|
|
2088
2200
|
return {
|
|
2089
|
-
content: render(
|
|
2201
|
+
content: render(fs12.readFileSync(documentPath, "utf-8"), docContext),
|
|
2090
2202
|
engine: resolvedEngine
|
|
2091
2203
|
};
|
|
2092
2204
|
}
|
|
@@ -2271,12 +2383,13 @@ async function processWithLLM(context, llmConfig, examples) {
|
|
|
2271
2383
|
info(`LLM base URL: ${llmConfig.baseURL}`);
|
|
2272
2384
|
}
|
|
2273
2385
|
const rawProvider = createProvider(llmConfig);
|
|
2386
|
+
const baseProvider = llmConfig.cache ? withContentHashCache(rawProvider, { model: llmConfig.model, baseURL: llmConfig.baseURL }) : rawProvider;
|
|
2274
2387
|
const retryOpts = llmConfig.retry ?? LLM_DEFAULTS.retry;
|
|
2275
2388
|
const configOptions = llmConfig.options;
|
|
2276
2389
|
const provider = {
|
|
2277
|
-
name:
|
|
2278
|
-
capabilities:
|
|
2279
|
-
complete: (messages, opts) => withRetry(() =>
|
|
2390
|
+
name: baseProvider.name,
|
|
2391
|
+
capabilities: baseProvider.capabilities,
|
|
2392
|
+
complete: (messages, opts) => withRetry(() => baseProvider.complete(messages, { ...configOptions, ...opts }), retryOpts)
|
|
2280
2393
|
};
|
|
2281
2394
|
const activeTasks = Object.entries(tasks).filter(([, enabled]) => enabled).map(([name]) => name);
|
|
2282
2395
|
info(`Running LLM tasks: ${activeTasks.join(", ")}`);
|
|
@@ -2332,17 +2445,17 @@ function getBuiltinTemplatePath(style) {
|
|
|
2332
2445
|
let packageRoot;
|
|
2333
2446
|
try {
|
|
2334
2447
|
const currentUrl = import.meta.url;
|
|
2335
|
-
packageRoot =
|
|
2336
|
-
packageRoot =
|
|
2448
|
+
packageRoot = path12.dirname(new URL(currentUrl).pathname);
|
|
2449
|
+
packageRoot = path12.join(packageRoot, "..", "..");
|
|
2337
2450
|
} catch {
|
|
2338
2451
|
packageRoot = __dirname;
|
|
2339
2452
|
}
|
|
2340
|
-
return
|
|
2453
|
+
return path12.join(packageRoot, "templates", style);
|
|
2341
2454
|
}
|
|
2342
2455
|
async function generateWithTemplate(contexts, templatesConfig, outputPath, repoUrl, dryRun) {
|
|
2343
2456
|
let templatePath;
|
|
2344
2457
|
if (templatesConfig?.path) {
|
|
2345
|
-
templatePath =
|
|
2458
|
+
templatePath = path12.resolve(templatesConfig.path);
|
|
2346
2459
|
} else {
|
|
2347
2460
|
templatePath = getBuiltinTemplatePath("keep-a-changelog");
|
|
2348
2461
|
}
|
|
@@ -2357,11 +2470,11 @@ async function generateWithTemplate(contexts, templatesConfig, outputPath, repoU
|
|
|
2357
2470
|
process.stdout.write(result.content);
|
|
2358
2471
|
return;
|
|
2359
2472
|
}
|
|
2360
|
-
const dir =
|
|
2361
|
-
if (!
|
|
2362
|
-
|
|
2473
|
+
const dir = path12.dirname(outputPath);
|
|
2474
|
+
if (!fs13.existsSync(dir)) {
|
|
2475
|
+
fs13.mkdirSync(dir, { recursive: true });
|
|
2363
2476
|
}
|
|
2364
|
-
|
|
2477
|
+
fs13.writeFileSync(outputPath, result.content, "utf-8");
|
|
2365
2478
|
const label = /changelog/i.test(outputPath) ? "Changelog" : "Release notes";
|
|
2366
2479
|
success(`${label} written to ${outputPath} (using ${result.engine} template)`);
|
|
2367
2480
|
}
|
|
@@ -2369,7 +2482,7 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
|
|
|
2369
2482
|
debug(`Processing ${input.packages.length} package(s)`);
|
|
2370
2483
|
let contexts = input.packages.map(createTemplateContext);
|
|
2371
2484
|
const changelogConfig = config.changelog === false ? false : { mode: "root", ...config.changelog ?? {} };
|
|
2372
|
-
const releaseNotesConfig = config.releaseNotes === false || config.releaseNotes === void 0 ? void 0 : config.releaseNotes
|
|
2485
|
+
const releaseNotesConfig = config.releaseNotes === false || config.releaseNotes === void 0 ? void 0 : config.releaseNotes;
|
|
2373
2486
|
const llmConfig = releaseNotesConfig?.llm;
|
|
2374
2487
|
if (llmConfig && !process.env.CHANGELOG_NO_LLM && !pipelineOptions?.skipReleaseNotes) {
|
|
2375
2488
|
info("Processing with LLM enhancement");
|
|
@@ -2457,34 +2570,23 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
|
|
|
2457
2570
|
warn(`Failed to write changelog: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
2458
2571
|
}
|
|
2459
2572
|
}
|
|
2460
|
-
if (!pipelineOptions?.skipReleaseNotes && releaseNotesConfig?.
|
|
2461
|
-
const
|
|
2462
|
-
|
|
2463
|
-
info(`Generating release notes \u2192 ${fileName}`);
|
|
2573
|
+
if (!pipelineOptions?.skipReleaseNotes && releaseNotesConfig?.file?.dir) {
|
|
2574
|
+
const dir = releaseNotesConfig.file.dir;
|
|
2575
|
+
info(`Generating release notes \u2192 ${dir}`);
|
|
2464
2576
|
try {
|
|
2465
|
-
|
|
2577
|
+
const { detectMonorepo } = await import("./aggregator-GXJXPM7O.js");
|
|
2578
|
+
const nested = detectMonorepo(process.cwd()).isMonorepo || contexts.length > 1;
|
|
2579
|
+
const renderContent = (ctx) => {
|
|
2466
2580
|
if (releaseNotesConfig.templates?.path) {
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
fileName,
|
|
2471
|
-
contexts[0]?.repoUrl ?? void 0,
|
|
2472
|
-
dryRun
|
|
2473
|
-
);
|
|
2474
|
-
} else {
|
|
2475
|
-
writeMarkdown(fileName, contexts, config, dryRun, fmtOpts);
|
|
2581
|
+
const templatePath = path12.resolve(releaseNotesConfig.templates.path);
|
|
2582
|
+
const docCtx = { ...createDocumentContext([ctx], void 0), perPackage: true, output: "file" };
|
|
2583
|
+
return renderTemplate(templatePath, docCtx, releaseNotesConfig.templates.engine).content;
|
|
2476
2584
|
}
|
|
2477
|
-
if (
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
config,
|
|
2483
|
-
dryRun,
|
|
2484
|
-
releaseNotesConfig.file ?? "RELEASE_NOTES.md"
|
|
2485
|
-
);
|
|
2486
|
-
files.push(...monoFiles);
|
|
2487
|
-
}
|
|
2585
|
+
if (ctx.enhanced?.releaseNotes) return ctx.enhanced.releaseNotes;
|
|
2586
|
+
return formatVersion(ctx, fmtOpts);
|
|
2587
|
+
};
|
|
2588
|
+
const versionedFiles = writeVersionedNotes(contexts, dir, dryRun, nested, renderContent);
|
|
2589
|
+
files.push(...versionedFiles);
|
|
2488
2590
|
} catch (error2) {
|
|
2489
2591
|
warn(`Failed to write release notes: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
2490
2592
|
}
|
|
@@ -2501,8 +2603,8 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
|
|
|
2501
2603
|
} else if (releaseNotesConfig) {
|
|
2502
2604
|
if (releaseNotesConfig.templates?.path) {
|
|
2503
2605
|
try {
|
|
2504
|
-
const templatePath =
|
|
2505
|
-
const docCtx = { ...createDocumentContext([ctx], void 0), perPackage: true };
|
|
2606
|
+
const templatePath = path12.resolve(releaseNotesConfig.templates.path);
|
|
2607
|
+
const docCtx = { ...createDocumentContext([ctx], void 0), perPackage: true, output: "release" };
|
|
2506
2608
|
const rendered = renderTemplate(
|
|
2507
2609
|
templatePath,
|
|
2508
2610
|
docCtx,
|
|
@@ -2553,14 +2655,14 @@ async function writeMonorepoFiles(contexts, config, dryRun, fileName) {
|
|
|
2553
2655
|
}
|
|
2554
2656
|
|
|
2555
2657
|
// src/command.ts
|
|
2556
|
-
import * as
|
|
2658
|
+
import * as fs14 from "fs";
|
|
2557
2659
|
import * as readline from "readline";
|
|
2558
2660
|
import { Command } from "commander";
|
|
2559
2661
|
function createNotesCommand() {
|
|
2560
2662
|
const cmd = new Command("notes").description(
|
|
2561
2663
|
"Generate changelogs with LLM-powered enhancement and flexible templating"
|
|
2562
2664
|
);
|
|
2563
|
-
cmd.command("generate", { isDefault: true }).description("Generate changelog from input data").option("-i, --input <file>", "Input file (default: stdin)").option("--no-changelog", "Disable changelog generation").option("--changelog-mode <mode>", "Changelog location mode (root|packages|both)").option("--changelog-file <name>", "Changelog file name override").option("--release-notes-
|
|
2665
|
+
cmd.command("generate", { isDefault: true }).description("Generate changelog from input data").option("-i, --input <file>", "Input file (default: stdin)").option("--no-changelog", "Disable changelog generation").option("--changelog-mode <mode>", "Changelog location mode (root|packages|both)").option("--changelog-file <name>", "Changelog file name override").option("--release-notes-dir <dir>", "Write per-version release-notes files to this directory").option("--no-release-notes", "Disable release notes generation").option("-t, --template <path>", "Template file or directory").option("-e, --engine <engine>", "Template engine (handlebars|liquid|ejs)").option("--monorepo <mode>", "Monorepo mode (root|packages|both)").option("--llm-provider <provider>", "LLM provider").option("--llm-model <model>", "LLM model").option("--llm-base-url <url>", "LLM base URL (for openai-compatible provider)").option("--llm-tasks <tasks>", "Comma-separated LLM tasks").option("--no-llm", "Disable LLM processing").option("--target <package>", "Filter to a specific package name").option("--config <path>", "Config file path").option("--regenerate", "Regenerate entire changelog instead of prepending new entries").option("--dry-run", "Preview without writing").option("-v, --verbose", "Increase verbosity", increaseVerbosity, 0).option("-q, --quiet", "Suppress non-error output").action(async (options) => {
|
|
2564
2666
|
setVerbosity(options.verbose);
|
|
2565
2667
|
if (options.quiet) setQuietMode(true);
|
|
2566
2668
|
try {
|
|
@@ -2582,13 +2684,11 @@ function createNotesCommand() {
|
|
|
2582
2684
|
}
|
|
2583
2685
|
if (options.releaseNotes === false) {
|
|
2584
2686
|
config.releaseNotes = false;
|
|
2585
|
-
} else if (options.
|
|
2687
|
+
} else if (options.releaseNotesDir) {
|
|
2586
2688
|
const existing = config.releaseNotes !== false ? config.releaseNotes ?? {} : {};
|
|
2587
|
-
const mode = options.releaseNotesMode ?? existing.mode ?? "root";
|
|
2588
2689
|
config.releaseNotes = {
|
|
2589
2690
|
...existing,
|
|
2590
|
-
|
|
2591
|
-
...options.releaseNotesFile ? { file: options.releaseNotesFile } : {}
|
|
2691
|
+
file: { dir: options.releaseNotesDir }
|
|
2592
2692
|
};
|
|
2593
2693
|
}
|
|
2594
2694
|
if (config.changelog === false && (options.template || options.engine)) {
|
|
@@ -2656,7 +2756,7 @@ function createNotesCommand() {
|
|
|
2656
2756
|
}
|
|
2657
2757
|
let inputJson;
|
|
2658
2758
|
if (options.input) {
|
|
2659
|
-
inputJson =
|
|
2759
|
+
inputJson = fs14.readFileSync(options.input, "utf-8");
|
|
2660
2760
|
} else {
|
|
2661
2761
|
inputJson = await readStdin();
|
|
2662
2762
|
}
|
|
@@ -2676,9 +2776,6 @@ function createNotesCommand() {
|
|
|
2676
2776
|
if (config.changelog !== false && !options.changelogMode) {
|
|
2677
2777
|
config.changelog = { ...config.changelog ?? {}, mode: monoMode };
|
|
2678
2778
|
}
|
|
2679
|
-
if (config.releaseNotes !== false && config.releaseNotes !== void 0 && !options.releaseNotesMode) {
|
|
2680
|
-
config.releaseNotes = { ...config.releaseNotes, mode: monoMode };
|
|
2681
|
-
}
|
|
2682
2779
|
}
|
|
2683
2780
|
await runPipeline(input, config, options.dryRun ?? false);
|
|
2684
2781
|
if (options.dryRun) {
|