@releasekit/notes 0.43.1 → 0.44.1

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.
@@ -14,12 +14,14 @@ import {
14
14
  unwrapEnvelope,
15
15
  warn,
16
16
  writeMarkdown
17
- } from "./chunk-YIHEHXCU.js";
17
+ } from "./chunk-VD3TYCTF.js";
18
18
 
19
19
  // ../config/dist/index.js
20
20
  import * as fs from "fs";
21
21
  import * as path from "path";
22
22
  import * as TOML from "smol-toml";
23
+ import { execFile } from "child_process";
24
+ import { promisify } from "util";
23
25
  import * as fs3 from "fs";
24
26
  import * as path3 from "path";
25
27
  import { z as z2 } from "zod";
@@ -44,6 +46,7 @@ var ConfigError = class extends ReleaseKitError {
44
46
  ];
45
47
  }
46
48
  };
49
+ var execFileAsync = promisify(execFile);
47
50
  function parseJsonc(content) {
48
51
  try {
49
52
  return JSON.parse(content);
@@ -61,7 +64,7 @@ function parseJsonc(content) {
61
64
  return result;
62
65
  }
63
66
  var DEFAULT_DEMOTE_SCOPES = ["deps", "deps-dev"];
64
- var GitConfigSchema = z.object({
67
+ var GitConfigSchema = z.strictObject({
65
68
  remote: z.string().default("origin").describe("Git remote name"),
66
69
  branch: z.string().optional().describe(
67
70
  "Branch that releases land on: a direct release pushes its commit here, and the standing release PR targets it. When unset, a direct release pushes the current branch and the standing PR targets main."
@@ -69,18 +72,21 @@ var GitConfigSchema = z.object({
69
72
  pushMethod: z.enum(["auto", "ssh", "https"]).default("auto").describe("Method for pushing to remote"),
70
73
  push: z.boolean().optional().describe("Whether to push changes to remote"),
71
74
  httpsTokenEnv: z.string().optional().describe("Environment variable name containing a GitHub token for HTTPS pushes"),
72
- skipHooks: z.boolean().optional().describe("Skip Git hooks when committing")
75
+ skipHooks: z.boolean().optional().describe("Skip Git hooks when committing"),
76
+ formatCommand: z.string().optional().describe(
77
+ "Formatter to run on the files a release writes, before committing them, e.g. `npx biome format --write`. ReleaseKit appends their paths and runs the command without a shell: quote an argument that contains spaces, and run a project-local tool through npx or pnpm exec, since the GitHub Action doesn't put node_modules/.bin on the PATH. Pass a flag that skips files the formatter can't handle, e.g. Prettier's `--ignore-unknown`. A non-zero exit fails the release before anything is committed."
78
+ )
73
79
  });
74
- var MonorepoConfigSchema = z.object({
80
+ var MonorepoConfigSchema = z.strictObject({
75
81
  rootPath: z.string().optional().describe("Path to root changelog"),
76
82
  packagesPath: z.string().optional().describe("Path to packages directory")
77
83
  });
78
- var VersionNpmConfigSchema = z.object({
84
+ var VersionNpmConfigSchema = z.strictObject({
79
85
  enabled: z.boolean().default(true).describe(
80
86
  "Version package.json manifests. Detected npm packages are versioned by default; set false to opt out (e.g. npm versioning handled elsewhere)."
81
87
  )
82
88
  });
83
- var VersionCargoConfigSchema = z.object({
89
+ var VersionCargoConfigSchema = z.strictObject({
84
90
  enabled: z.boolean().default(true).describe(
85
91
  "Version Cargo.toml manifests. Detected Rust packages are versioned by default; set false to opt out (e.g. a vendored crate, or Rust versioning handled elsewhere)."
86
92
  ),
@@ -88,15 +94,15 @@ var VersionCargoConfigSchema = z.object({
88
94
  "Directories, relative to each package, to bump a Cargo.toml in instead of the package's own directory. Not searched recursively. Ignored in group mode."
89
95
  )
90
96
  });
91
- var VersionPubConfigSchema = z.object({
97
+ var VersionPubConfigSchema = z.strictObject({
92
98
  enabled: z.boolean().default(true).describe(
93
- "Version pubspec.yaml manifests. Detected Dart/Flutter packages are versioned by default; set false to opt out, which also stops a pubspec.yaml beside a package.json from publishing."
99
+ "Version pubspec.yaml manifests. Detected Dart/Flutter packages are versioned by default; set false to opt out."
94
100
  ),
95
101
  paths: z.array(z.string()).optional().describe(
96
102
  "Directories, relative to each package, to bump a pubspec.yaml in instead of the package's own directory. Not searched recursively. Ignored in group mode."
97
103
  )
98
104
  });
99
- var VersionGroupSchema = z.object({
105
+ var VersionGroupSchema = z.strictObject({
100
106
  packages: z.array(z.string()).min(1).describe(
101
107
  "Package patterns (exact names, @scope/*, or globs) whose matched packages form this group. Same matching rules as version.packages."
102
108
  ),
@@ -106,22 +112,29 @@ var VersionGroupSchema = z.object({
106
112
  });
107
113
  var PresetSchema = z.enum(["angular", "conventionalcommits"]);
108
114
  var DEFAULT_PRESET = "conventionalcommits";
109
- var VersionConfigSchema = z.object({
110
- // biome-ignore lint/suspicious/noTemplateCurlyInString: intentional template-placeholder syntax
111
- tagTemplate: z.string().default("${prefix}${version}").describe(
115
+ var VersionConfigBaseSchema = z.strictObject({
116
+ tagTemplate: z.string().regex(/\$\{version\}$/, {
117
+ message: (
118
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: documenting the expected placeholder syntax to the user
119
+ "tagTemplate must end with ${version}: tags are found by the text before it, so text after it breaks the next release."
120
+ )
121
+ }).optional().describe(
112
122
  // biome-ignore lint/suspicious/noTemplateCurlyInString: documenting placeholder syntax to the user
113
- "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\"."
123
+ 'Template for Git tags, ending with ${version}. 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". Defaults to "${packageName}@${prefix}${version}" with packageSpecificTags, otherwise "${prefix}${version}".'
114
124
  ),
115
- baselineTagTemplate: z.string().regex(/.*\$\{version\}.*/, {
125
+ baselineTagTemplate: z.string().regex(/\$\{version\}$/, {
116
126
  message: (
117
127
  // biome-ignore lint/suspicious/noTemplateCurlyInString: documenting the expected placeholder syntax to the user
118
- 'baselineTagTemplate must contain a ${version} placeholder so the prefix can be derived (e.g. "release/${prefix}${version}").'
128
+ 'baselineTagTemplate must end with ${version} so the prefix can be derived (e.g. "release/${prefix}${version}").'
119
129
  )
120
130
  }).optional().describe(
121
131
  // biome-ignore lint/suspicious/noTemplateCurlyInString: documenting placeholder syntax to the user
122
- '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".'
132
+ '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 end with ${version} so the baseline prefix can be derived. Supports the same variables as tagTemplate. Example: "release/${prefix}${version}" produces "release/v1.2.3".'
133
+ ),
134
+ packageSpecificTags: z.boolean().default(false).describe(
135
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: documenting placeholder syntax to the user
136
+ 'Tag each package separately, e.g. "scope-pkg@v1.2.3". tagTemplate must then contain ${packageName}.'
123
137
  ),
124
- packageSpecificTags: z.boolean().default(false).describe("Enable package-specific tagging"),
125
138
  preset: PresetSchema.default(DEFAULT_PRESET).describe("Commit convention preset"),
126
139
  sync: z.boolean().default(true).describe(
127
140
  "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)."
@@ -136,24 +149,26 @@ var VersionConfigSchema = z.object({
136
149
  sharedChangelogFloor: z.enum(["union", "sinceLastRelease"]).default("union").describe(
137
150
  `How the "Project-wide changes" block is bounded in package-specific-tag mode. "union" (default): repo-level commits accrue from the union of the releasing packages' ranges, floored by the OLDEST unreleased baseline \u2014 so a genuinely-global commit recurs in every release until the oldest-baselined package is released past it. "sinceLastRelease": floor the block by the single nearest tag reachable across the repo, so global commits already shown by the most recent release don't recur (recommended for per-package-tag monorepos). No effect in sync mode, where one shared tag already consumes repo-level commits on each release.`
138
151
  ),
139
- mainPackage: z.string().optional().describe("Package to use for version determination"),
152
+ mainPackage: z.string().optional().describe(
153
+ "The package a single-mode release versions. In sync mode, the release bumps from this package's version and tag and, without packageSpecificTags, carries its name. The changelog still lists every commit in the release."
154
+ ),
140
155
  skip: z.array(z.string()).optional().describe(
141
156
  'Packages to exclude from versioning (glob patterns or exact names). Private packages ("private": true) are skipped automatically \u2014 see includePrivate \u2014 so they do not need to be listed here.'
142
157
  ),
143
158
  includePrivate: z.boolean().default(false).describe(
144
- 'Include npm packages marked "private": true (in package.json) in the release flow. Default false: private packages are skipped at discovery \u2014 they cannot be published to any registry, mirroring the Cargo `publish = false` and pub `publish_to: none` skips already applied during discovery. Set true to version a private package for internal tracking. Packages explicitly named in version.packages are always included regardless of this setting.'
159
+ 'Include npm packages marked "private": true (in package.json) in the release flow. Default false: private packages are skipped at discovery \u2014 they cannot be published to any registry, mirroring the Cargo `publish = false` and pub `publish_to: none` skips already applied during discovery. Set true to version a private package for internal tracking. A private package listed in version.packages by its exact package name or exact directory path (e.g. "packages/app") is always included regardless of this setting; one matched only by a glob (e.g. "packages/*" or "@scope/*") is still skipped.'
145
160
  ),
146
161
  commitMessage: z.string().optional().describe(
147
162
  // biome-ignore lint/suspicious/noTemplateCurlyInString: documenting placeholder syntax to the user
148
163
  "Template for the release commit message. Supports ${version} and ${packageName}. Default: 'chore: release ${packageName} v${version}' for sync and single-package releases; otherwise 'chore: release' followed by each released package and version."
149
164
  ),
150
165
  mismatchStrategy: z.enum(["error", "warn", "ignore", "prefer-package", "prefer-git"]).default("warn").describe("How to handle version mismatches"),
151
- versionPrefix: z.string().default("").describe("Prefix for version tags"),
166
+ versionPrefix: z.string().default("v").describe('Prefix for version tags. Set "" for tags like "1.2.3".'),
152
167
  prereleaseIdentifier: z.string().optional().describe("Identifier for prerelease versions (e.g., 'alpha', 'beta')"),
153
168
  allowFirstBump: z.boolean().default(false).describe(
154
169
  'Acknowledge applying a bump on a first release with an already-stable manifest. On a first release (no prior tag), `--stable --bump <type>` applies the bump (e.g. 1.0.0 \u2192 2.0.0) rather than graduating, which can silently overshoot the staged first version. By default this is flagged per `mismatchStrategy` (warn, or abort under "error"); set true (or pass --allow-first-bump) to apply the bump silently \u2014 legitimate when importing a package with prior external version history.'
155
170
  ),
156
- strictReachable: z.boolean().default(false).describe("Only use reachable tags"),
171
+ strictReachable: z.boolean().default(false).describe("Fail the run when the previous release tag isn't reachable from HEAD, instead of falling back."),
157
172
  zeroMajor: z.enum(["spec", "strict"]).default("spec").describe(
158
173
  "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."
159
174
  ),
@@ -161,7 +176,28 @@ var VersionConfigSchema = z.object({
161
176
  cargo: VersionCargoConfigSchema.optional().describe("Cargo/Rust configuration"),
162
177
  pub: VersionPubConfigSchema.optional().describe("Dart/Flutter pub configuration")
163
178
  });
164
- var NpmConfigSchema = z.object({
179
+ var VersionConfigSchema = VersionConfigBaseSchema.superRefine((cfg, ctx) => {
180
+ if (cfg.packageSpecificTags && cfg.tagTemplate !== void 0 && !cfg.tagTemplate.includes("${packageName}")) {
181
+ ctx.addIssue({
182
+ code: z.ZodIssueCode.custom,
183
+ path: ["tagTemplate"],
184
+ message: (
185
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: documenting the expected placeholder syntax to the user
186
+ 'tagTemplate must contain ${packageName} when packageSpecificTags is true, or every package gets the same tag. Remove tagTemplate to use "${packageName}@${prefix}${version}".'
187
+ )
188
+ });
189
+ }
190
+ for (const key of ["tagTemplate", "baselineTagTemplate"]) {
191
+ if (/\d+\.\d+\.\d+/.test(cfg[key]?.split("${version}")[0] ?? "")) {
192
+ ctx.addIssue({
193
+ code: z.ZodIssueCode.custom,
194
+ path: [key],
195
+ message: `${key} can't contain a version before \${version}: a tag's version is read as the first one in it.`
196
+ });
197
+ }
198
+ }
199
+ });
200
+ var NpmConfigSchema = z.strictObject({
165
201
  enabled: z.boolean().default(true).describe(
166
202
  "Publish to npm. Detected npm packages are published by default; set false to opt out (version and tag only)."
167
203
  ),
@@ -173,7 +209,7 @@ var NpmConfigSchema = z.object({
173
209
  tag: z.string().default("latest").describe("NPM dist tag"),
174
210
  publishOrder: z.array(z.string()).default([]).describe("Explicit publish order for npm packages; empty auto-sorts dependencies first")
175
211
  });
176
- var CargoPublishConfigSchema = z.object({
212
+ var CargoPublishConfigSchema = z.strictObject({
177
213
  enabled: z.boolean().default(true).describe(
178
214
  "Publish to crates.io. Detected Rust packages are published by default; set false to opt out (version and tag only)."
179
215
  ),
@@ -185,21 +221,22 @@ var CargoPublishConfigSchema = z.object({
185
221
  ),
186
222
  clean: z.boolean().default(false).describe("Run cargo clean in each crate's directory before publishing.")
187
223
  });
188
- var PubPublishConfigSchema = z.object({
224
+ var PubPublishConfigSchema = z.strictObject({
189
225
  enabled: z.boolean().default(true).describe(
190
226
  "Publish to pub.dev. Detected Dart/Flutter packages are published by default; set false to opt out (version and tag only)."
191
227
  ),
192
228
  publishOrder: z.array(z.string()).default([]).describe("Package names to publish first, in this order; the rest follow in discovery order.")
193
229
  });
194
- var PublishGitConfigSchema = z.object({
230
+ var PublishGitConfigSchema = z.strictObject({
195
231
  push: z.boolean().optional().describe("Push tags and commits to remote. When unset, inherits the top-level git.push (which defaults to push)."),
196
232
  pushMethod: z.enum(["auto", "ssh", "https"]).optional().describe("Push method override"),
197
233
  remote: z.string().optional().describe("Remote name override"),
198
234
  branch: z.string().optional().describe("Branch name override"),
199
235
  httpsTokenEnv: z.string().optional().describe("Environment variable name containing a GitHub token for HTTPS pushes"),
200
- skipHooks: z.boolean().optional().describe("Skip Git hooks when committing")
236
+ skipHooks: z.boolean().optional().describe("Skip Git hooks when committing"),
237
+ formatCommand: z.string().optional().describe("Format command override")
201
238
  });
202
- var GitHubReleaseConfigSchema = z.object({
239
+ var GitHubReleaseConfigSchema = z.strictObject({
203
240
  enabled: z.boolean().default(true).describe("Enable GitHub releases"),
204
241
  draft: z.boolean().default(true).describe("Create as draft release"),
205
242
  perPackage: z.boolean().default(true).describe("Create separate release per package"),
@@ -216,25 +253,25 @@ var GitHubReleaseConfigSchema = z.object({
216
253
  "Package names to exclude from GitHub release creation. The name as tags spell it also matches, e.g. 'scope-pkg' for '@scope/pkg'."
217
254
  )
218
255
  });
219
- var VerifyRegistryNpmConfigSchema = z.object({
256
+ var VerifyRegistryNpmConfigSchema = z.strictObject({
220
257
  enabled: z.boolean().default(true).describe("Verify NPM publish"),
221
258
  maxAttempts: z.number().int().positive().default(5).describe("Maximum verification attempts"),
222
259
  initialDelay: z.number().int().positive().default(15e3).describe("Wait in ms after the first failed check; each later wait is multiplied by backoffMultiplier."),
223
260
  backoffMultiplier: z.number().positive().default(2).describe("Exponential backoff multiplier")
224
261
  });
225
- var VerifyRegistryCargoConfigSchema = z.object({
262
+ var VerifyRegistryCargoConfigSchema = z.strictObject({
226
263
  enabled: z.boolean().default(true).describe("Verify Cargo publish"),
227
264
  maxAttempts: z.number().int().positive().default(10).describe("Maximum verification attempts"),
228
265
  initialDelay: z.number().int().positive().default(3e4).describe("Wait in ms after the first failed check; each later wait is multiplied by backoffMultiplier."),
229
266
  backoffMultiplier: z.number().positive().default(2).describe("Exponential backoff multiplier")
230
267
  });
231
- var VerifyRegistryPubConfigSchema = z.object({
268
+ var VerifyRegistryPubConfigSchema = z.strictObject({
232
269
  enabled: z.boolean().default(true).describe("Verify Dart pub publish"),
233
270
  maxAttempts: z.number().int().positive().default(10).describe("Maximum verification attempts"),
234
271
  initialDelay: z.number().int().positive().default(3e4).describe("Wait in ms after the first failed check; each later wait is multiplied by backoffMultiplier."),
235
272
  backoffMultiplier: z.number().positive().default(2).describe("Exponential backoff multiplier")
236
273
  });
237
- var VerifyConfigSchema = z.object({
274
+ var VerifyConfigSchema = z.strictObject({
238
275
  npm: VerifyRegistryNpmConfigSchema.default({
239
276
  enabled: true,
240
277
  maxAttempts: 5,
@@ -256,7 +293,7 @@ var VerifyConfigSchema = z.object({
256
293
  backoffMultiplier: 2
257
294
  }).describe("Poll pub.dev after each publish until the new version is visible.")
258
295
  });
259
- var PublishConfigSchema = z.object({
296
+ var PublishConfigSchema = z.strictObject({
260
297
  git: PublishGitConfigSchema.optional().describe("Git publishing options"),
261
298
  npm: NpmConfigSchema.default({
262
299
  enabled: true,
@@ -309,15 +346,20 @@ var PublishConfigSchema = z.object({
309
346
  }
310
347
  }).describe("Registry verification configuration")
311
348
  });
312
- var TemplateConfigSchema = z.object({
349
+ var TemplateConfigSchema = z.strictObject({
313
350
  path: z.string().optional().describe("Template file, or a directory of composable templates."),
314
351
  engine: z.enum(["handlebars", "liquid", "ejs"]).optional().describe("Template engine. Detected from the template files when omitted; ignored without path.")
315
352
  });
316
353
  var LocationModeSchema = z.enum(["root", "packages", "both"]);
317
- var ReleaseNotesFileConfigSchema = z.object({
318
- dir: z.string().default("release-notes").describe("Directory for the per-version release-notes files.")
319
- });
320
- var ChangelogConfigSchema = z.object({
354
+ var ReleaseNotesFileConfigSchema = z.strictObject(
355
+ {
356
+ dir: z.string().default("release-notes").describe("Directory for the per-version release-notes files.")
357
+ },
358
+ {
359
+ error: (issue) => issue.code === "invalid_type" && typeof issue.input === "string" ? 'the string form was removed - set it to { "dir": "release-notes" } for per-version files, or use notes.changelog.mode for a cumulative changelog' : void 0
360
+ }
361
+ );
362
+ var ChangelogConfigSchema = z.strictObject({
321
363
  mode: LocationModeSchema.optional().describe(
322
364
  "Where to write changelog files: 'root' (the default) at the repo root, 'packages' in each package (monorepos only), or 'both'."
323
365
  ),
@@ -327,32 +369,32 @@ var ChangelogConfigSchema = z.object({
327
369
  "How `#NNN` issue/PR refs in the changelog are rendered. Applies to the whole entry \u2014 both the appended label and any bare `#N` carried over from the commit subject into the description (a description ref that also appears in the appended label is de-duplicated away). 'link' (default): the PR and the issues it closed are labelled as `(PR #503 \xB7 closes #500)`, where the PR links to its canonical /pull/ URL with `PR #503` as the visible text \u2014 this keeps the GitHub hovercard but stops the bare-token rich inline card that duplicated the entry; closed issues link to /issues/. An entry with no identifiable PR (a non-squash commit, or a non-GitHub repo) falls back to a plain ref list. 'escape': plain text \\#NNN (no link, no hovercard, no PR/closes labelling). 'strip': refs are removed entirely. Scoped-package / @user mentions in entry text are always neutralised regardless of this setting."
328
370
  ),
329
371
  demoteScopes: z.array(z.string()).default([...DEFAULT_DEMOTE_SCOPES]).describe(
330
- 'Conventional-commit scopes whose changelog entries move to a trailing "Dependencies & version bumps" subsection instead of mixing with Added / Fixed / Changed. A breaking change still comes first, under Breaking. Applies to the release preview comment and the standing-PR changelogs (each releasable row and the "Show all changes" footer). Entries are moved, not dropped, so the de-duplicated change count is unchanged. Default: ["deps", "deps-dev"], the scopes Dependabot uses. Set to [] to render every scope inline.'
372
+ 'Conventional-commit scopes whose changelog entries move to a trailing "Dependencies & version bumps" subsection instead of mixing with Added / Changed / Fixed. A breaking change still comes first, under Breaking. Applies to the release preview comment and the standing-PR changelogs (each releasable row and the "Show all changes" footer). Entries are moved, not dropped, so the de-duplicated change count is unchanged. Default: ["deps", "deps-dev"], the scopes Dependabot uses. Set to [] to render every scope inline.'
331
373
  )
332
374
  }).describe("Changelog file configuration");
333
- var LLMOptionsSchema = z.object({
375
+ var LLMOptionsSchema = z.strictObject({
334
376
  timeout: z.number().int().optional().describe("Idle timeout in ms: a streamed response fails only when nothing arrives for this long. Default: 60000."),
335
377
  maxTokens: z.number().int().optional().describe("Max tokens to generate. Default: 16384."),
336
378
  temperature: z.number().optional().describe("Sampling temperature. Default: 0.7; the anthropic provider ignores it.")
337
379
  });
338
- var LLMRetryConfigSchema = z.object({
380
+ var LLMRetryConfigSchema = z.strictObject({
339
381
  maxAttempts: z.number().int().positive().optional().describe("Maximum number of attempts, including the first. Default: 3."),
340
382
  initialDelay: z.number().int().nonnegative().optional().describe("Delay in ms before the first retry. Default: 1000."),
341
383
  maxDelay: z.number().int().positive().optional().describe("Maximum delay in ms between attempts. Default: 30000."),
342
384
  backoffFactor: z.number().positive().optional().describe("Delay multiplier per attempt. Default: 2.")
343
385
  });
344
- var LLMTasksConfigSchema = z.object({
386
+ var LLMTasksConfigSchema = z.strictObject({
345
387
  summarize: z.boolean().optional().describe("Write a 2\u20133 sentence summary of the release."),
346
388
  enhance: z.boolean().optional().describe("Rewrite each entry's description to be clearer for users."),
347
389
  categorize: z.boolean().optional().describe("Group entries into the configured categories."),
348
390
  releaseNotes: z.boolean().optional().describe("Write prose release notes for the GitHub Release body and any release-notes files.")
349
391
  });
350
- var LLMCategorySchema = z.object({
392
+ var LLMCategorySchema = z.strictObject({
351
393
  name: z.string().describe("Category label shown in release notes (e.g. 'Features')"),
352
394
  description: z.string().describe("LLM instruction describing what commits belong in this category"),
353
395
  scopes: z.array(z.string()).optional().describe("Conventional commit scopes assigned to this category")
354
396
  });
355
- var ScopeRulesSchema = z.object({
397
+ var ScopeRulesSchema = z.strictObject({
356
398
  allowed: z.array(z.string()).optional().describe("Explicit list of valid scope names; commits with unlisted scopes trigger invalidScopeAction"),
357
399
  caseSensitive: z.boolean().default(false).describe("Whether scope comparison is case-sensitive"),
358
400
  invalidScopeAction: z.enum(["remove", "keep", "fallback"]).default("remove").describe(
@@ -360,28 +402,28 @@ var ScopeRulesSchema = z.object({
360
402
  ),
361
403
  fallbackScope: z.string().optional().describe("Scope substituted when invalidScopeAction is 'fallback'")
362
404
  });
363
- var ScopeConfigSchema = z.object({
405
+ var ScopeConfigSchema = z.strictObject({
364
406
  mode: z.enum(["restricted", "packages", "none", "unrestricted"]).default("unrestricted").describe(
365
407
  "Scope allowlist source: 'restricted' uses rules.allowed, 'packages' derives scopes from workspace package names, 'none' strips all scopes, 'unrestricted' allows any scope"
366
408
  ),
367
409
  rules: ScopeRulesSchema.optional().describe("Scope validation and transformation rules")
368
410
  });
369
- var LLMPromptOverridesSchema = z.object({
411
+ var LLMPromptOverridesSchema = z.strictObject({
370
412
  enhance: z.string().optional().describe("For the enhance task when categorize is off."),
371
413
  categorize: z.string().optional().describe("For the categorize task when enhance is off."),
372
414
  enhanceAndCategorize: z.string().optional().describe("For the combined task that replaces enhance and categorize when both are on."),
373
415
  summarize: z.string().optional().describe("For the summarize task."),
374
416
  releaseNotes: z.string().optional().describe("For the releaseNotes task.")
375
417
  });
376
- var LLMPromptsConfigSchema = z.object({
418
+ var LLMPromptsConfigSchema = z.strictObject({
377
419
  instructions: LLMPromptOverridesSchema.optional().describe(
378
420
  "Extra instructions appended to a task's built-in system prompt. The task's output format is unchanged."
379
421
  )
380
422
  });
381
- var LLMConfigBaseSchema = z.object({
423
+ var LLMConfigBaseSchema = z.strictObject({
382
424
  provider: z.enum(["openai", "openai-compatible", "anthropic", "ollama"]).describe("LLM provider"),
383
- model: z.string().min(1, "model must be a non-empty string \u2014 set it to a model the provider serves.").describe(
384
- "Model identifier for the selected provider. Required \u2014 releasekit ships no default, so enabling LLM enhancement needs an explicit, current model (a missing model fails config validation)."
425
+ model: z.string().min(1, "model must be a non-empty string \u2014 set it to a model the provider serves.").optional().describe(
426
+ "Model identifier for the selected provider; releasekit ships no default. Checked only when a run calls the LLM, so other runs work without it."
385
427
  ),
386
428
  baseURL: z.string().optional().describe("Custom API base URL. Required for the openai-compatible provider."),
387
429
  apiKey: z.string().optional().describe(
@@ -412,7 +454,7 @@ var LLMConfigBaseSchema = z.object({
412
454
  examples: z.number().int().min(0).max(5).default(3).describe(
413
455
  "Number of the project's past GitHub Releases (0\u20135) used as style examples in the combined enhance and categorize prompt and the releaseNotes prompt. Needs GITHUB_TOKEN or GH_TOKEN."
414
456
  ),
415
- context: z.object({
457
+ context: z.strictObject({
416
458
  pullRequests: z.boolean().default(true).describe("Fetch the title and body of each entry's linked PR as LLM context. Needs GITHUB_TOKEN or GH_TOKEN.")
417
459
  }).default({ pullRequests: true }).describe("Additional context sources for the LLM."),
418
460
  categoryOrder: z.array(z.string()).optional().describe(
@@ -431,7 +473,7 @@ var LLMConfigSchema = LLMConfigBaseSchema.superRefine((cfg, ctx) => {
431
473
  });
432
474
  }
433
475
  });
434
- var ReleaseNotesConfigSchema = z.object({
476
+ var ReleaseNotesConfigSchema = z.strictObject({
435
477
  file: ReleaseNotesFileConfigSchema.optional().describe(
436
478
  "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."
437
479
  ),
@@ -439,9 +481,9 @@ var ReleaseNotesConfigSchema = z.object({
439
481
  "Template for rendering release notes (e.g. to add docs-site frontmatter). Takes precedence over LLM prose and the default formatted section."
440
482
  ),
441
483
  llm: LLMConfigSchema.optional().describe("LLM configuration for release notes"),
442
- links: z.object({
484
+ links: z.strictObject({
443
485
  items: z.array(
444
- z.object({
486
+ z.strictObject({
445
487
  label: z.string().describe("Link text"),
446
488
  url: z.string().url().describe("Link URL")
447
489
  })
@@ -455,7 +497,7 @@ var ReleaseNotesConfigSchema = z.object({
455
497
  ),
456
498
  firstRelease: z.union([
457
499
  z.literal(false).describe("Set to false to disable the first-release placeholder intro."),
458
- z.object({
500
+ z.strictObject({
459
501
  text: z.string().optional().describe(
460
502
  // biome-ignore lint/suspicious/noTemplateCurlyInString: documenting placeholder syntax to the user
461
503
  "Placeholder intro line for a package's first release. Supports ${packageName} and ${version}. Default: '_First release of ${packageName}._'."
@@ -465,11 +507,7 @@ var ReleaseNotesConfigSchema = z.object({
465
507
  "First-release placeholder intro, shown when a package has no prior version (previousVersion is null). Default-on with a factual line; set to false to disable."
466
508
  )
467
509
  }).describe("Release notes configuration");
468
- var NotesInputConfigSchema = z.object({
469
- source: z.string().optional(),
470
- file: z.string().optional()
471
- });
472
- var NotesConfigSchema = z.object({
510
+ var NotesConfigSchema = z.strictObject({
473
511
  changelog: z.union([z.literal(false).describe("Set to false to disable changelog generation"), ChangelogConfigSchema]).optional().describe("Changelog generation, on by default. Set to false to disable."),
474
512
  releaseNotes: z.union([z.literal(false).describe("Set to false to disable release notes"), ReleaseNotesConfigSchema]).optional().describe(
475
513
  "Release notes for the GitHub Release body and optional per-version files. Off unless set. {} turns them on using each version's changelog section; set llm or templates to change the content."
@@ -478,7 +516,7 @@ var NotesConfigSchema = z.object({
478
516
  "How to update existing changelog files. 'prepend' (the default) adds the new entries at the top; 'regenerate' overwrites the file with this run's output."
479
517
  )
480
518
  });
481
- var CILabelsConfigSchema = z.object({
519
+ var CILabelsConfigSchema = z.strictObject({
482
520
  graduate: z.string().default("release:graduate").describe(
483
521
  "Label that graduates a prerelease to its stable base version (e.g. 1.0.0-next.6 \u2192 1.0.0). A standalone release trigger in label/direct mode; in standing-pr mode it sets the next merge to graduate."
484
522
  ),
@@ -501,7 +539,7 @@ var CILabelsConfigSchema = z.object({
501
539
  "Label on the standing PR that also releases the changed prerequisites (transitive internal dependencies) of the targeted/scoped packages \u2014 each at its own commit-driven bump. Standing-pr mode only."
502
540
  )
503
541
  });
504
- var StandingPrConfigSchema = z.object({
542
+ var StandingPrConfigSchema = z.strictObject({
505
543
  branch: z.string().default("release/next").describe(
506
544
  "Branch name for the standing release PR. Each update resets it to the base branch and force-pushes it, so don't commit to it."
507
545
  ),
@@ -524,7 +562,7 @@ var StandingPrConfigSchema = z.object({
524
562
  minPackages: z.number().int().positive().optional().describe(
525
563
  "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."
526
564
  ),
527
- authorization: z.object({
565
+ authorization: z.strictObject({
528
566
  requiredPermission: z.enum(["admin", "maintain", "write"]).default("admin").describe(
529
567
  "Minimum repository permission an actor needs to steer the standing PR \u2014 tick/untick selection checkboxes, flip per-row channel toggles, apply release labels, and (with branch protection) merge. Default: admin."
530
568
  ),
@@ -537,7 +575,7 @@ var StandingPrConfigSchema = z.object({
537
575
  'Extra actors authorized regardless of permission level: GitHub usernames, or "@org/team-slug" to authorize a whole team. Team-membership checks need a token with read:org scope (a PAT or GitHub App), not the default GITHUB_TOKEN; without it, team entries fail closed \u2014 the 403 is surfaced as a warning and the actor is not authorized.'
538
576
  ),
539
577
  enforceMergeAuthor: z.boolean().default(true).describe(
540
- "Refuse to publish the standing PR when the actor who merged it is not authorized (defense-in-depth behind a branch-protection ruleset, which is the primary merge gate). Set false to rely on branch protection alone."
578
+ "Refuse to publish the standing PR when the actor who merged it is not authorized or cannot be determined (defense-in-depth behind a branch-protection ruleset, which is the primary merge gate). Set false to rely on branch protection alone."
541
579
  )
542
580
  }).optional().describe(
543
581
  "Restrict who can steer the standing PR \u2014 its selection checkboxes, per-row channel toggles, release labels, and merge. Omit to allow anyone with the GitHub permission GitHub itself requires for each action."
@@ -549,16 +587,16 @@ var StandingPrConfigSchema = z.object({
549
587
  "How the selection list renders when primaryPackages is set. streamlined: one checkbox per primary, coupled members shown read-only in a collapsed pane, and a held-back primary cascades to its unit. granular: every package keeps its own checkbox, nested under its primary, with no cascade. No effect when primaryPackages is empty."
550
588
  ),
551
589
  combinedChangelogFooter: z.boolean().default(true).describe(
552
- "Append the de-duplicated combined-changelog footer to the standing PR: every change listed once, flat across packages and grouped by change type (Added/Fixed/Changed), breaking changes first. It complements the per-row changelogs co-located with each releasable row. Set false to suppress this redundant per-package summary \u2014 the per-row changelogs remain, project-wide (shared) changes are still shown in their own block, and sync releases (which have no per-row changelogs) always show the combined changelog regardless of this setting."
590
+ "Append the de-duplicated combined-changelog footer to the standing PR: every change listed once, flat across packages and grouped by change type (Added/Changed/Fixed), breaking changes first. Set false to rely on the per-row changelogs; project-wide (shared) changes still show in their own block. Sync releases, which have no per-row changelogs, always show the footer."
553
591
  ),
554
592
  channelToggle: z.boolean().default(false).describe(
555
- "Add a per-row channel toggle to the standing-PR selection list: a nested checkbox under each releasable row to ship a stable package as a prerelease (\u2192 X.Y.Z-next.0 on the `next` dist-tag) or graduate a prerelease package to its stable base \u2014 shifting just that package (and its group) without narrowing the release. Off by default so repos that do not need it keep the tight one-line-per-package list. A held-back (unticked) row hides its channel toggle. No effect on sync releases (which ship atomically as one unit)."
593
+ "Add a per-row channel toggle to the standing-PR selection list: a nested checkbox under each releasable row to ship a stable package as a prerelease (\u2192 X.Y.Z-next.0 on the `next` dist-tag) or graduate a prerelease package to its stable base \u2014 shifting just that package (and its group) without narrowing the release. Off by default so repos that do not need it keep the tight one-line-per-package list. A held-back (unticked) row hides its channel toggle. A sync release, which ships as one unit, instead gets a single graduate-to-stable checkbox under its queued changes when it is on a prerelease line."
556
594
  ),
557
595
  summaryTable: z.boolean().default(false).describe(
558
596
  'Render a collapsed "Version summary" table near the top of the standing PR: one row per publishing package showing its current version, next version, bump magnitude, and dist-tag. A scannable from \u2192 to overview (the Dependabot mental model) that complements the interactive checkbox list \u2014 which GitHub only renders as a list, never in a table cell. Off by default.'
559
597
  )
560
598
  });
561
- var CIConfigSchema = z.object({
599
+ var CIConfigSchema = z.strictObject({
562
600
  releaseStrategy: z.enum(["manual", "direct", "standing-pr"]).default("direct").describe(
563
601
  "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."
564
602
  ),
@@ -567,7 +605,7 @@ var CIConfigSchema = z.object({
567
605
  ),
568
606
  prPreview: z.union([
569
607
  z.boolean(),
570
- z.object({
608
+ z.strictObject({
571
609
  enabled: z.boolean().default(true).describe("Whether PR preview comments are posted."),
572
610
  markStaleAfterRelease: z.boolean().default(false).describe(
573
611
  "After a standing-PR publish, or a `releasekit release` that pushes the release branch, mark the preview on open PRs into that branch as stale until the PR's next push or label change. `releasekit publish` on its own doesn't. Best-effort: a failure never fails the release."
@@ -598,7 +636,7 @@ var CIConfigSchema = z.object({
598
636
  "Configuration for the standing release PR feature (ci.releaseStrategy: 'standing-pr')."
599
637
  )
600
638
  });
601
- var ReleaseCIConfigSchema = z.object({
639
+ var ReleaseCIConfigSchema = z.strictObject({
602
640
  skipPatterns: z.array(z.string().min(1)).optional().describe(
603
641
  "Strings that skip a release, gate run or standing-PR update when found anywhere in the HEAD commit's subject. When unset, only standing-PR updates skip, and only on 'chore: release '."
604
642
  ),
@@ -606,11 +644,11 @@ var ReleaseCIConfigSchema = z.object({
606
644
  githubRelease: z.literal(false).optional().describe("Set to false to disable GitHub release creation in CI"),
607
645
  notes: z.literal(false).optional().describe("Set to false to disable changelog generation in CI")
608
646
  });
609
- var ReleaseConfigSchema = z.object({
647
+ var ReleaseConfigSchema = z.strictObject({
610
648
  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>."),
611
649
  ci: ReleaseCIConfigSchema.optional().describe("CI-specific automation settings")
612
650
  });
613
- var ReleaseKitConfigSchema = z.object({
651
+ var ReleaseKitConfigSchema = z.strictObject({
614
652
  $schema: z.string().optional().describe("JSON schema reference URL"),
615
653
  git: GitConfigSchema.optional().describe("Git configuration"),
616
654
  monorepo: MonorepoConfigSchema.optional().describe("Monorepo configuration"),
@@ -648,26 +686,33 @@ function substituteVariables(value, rootDir = process.cwd()) {
648
686
  });
649
687
  return result;
650
688
  }
651
- var SOLE_REFERENCE_PATTERN = /^\{(?:env|file):[^}]+\}$/;
652
- function substituteInObject(obj, rootDir = process.cwd()) {
653
- if (typeof obj === "string") {
654
- const result = substituteVariables(obj, rootDir);
655
- if (result === "" && SOLE_REFERENCE_PATTERN.test(obj)) {
689
+ var SOLE_REFERENCE_PATTERN = /^\{(env|file):([^}]+)\}$/;
690
+ function substituteInObject(obj, rootDir = process.cwd(), onUnsetEnv) {
691
+ return substituteAt(obj, rootDir, [], onUnsetEnv);
692
+ }
693
+ function substituteAt(value, rootDir, path62, onUnsetEnv) {
694
+ if (typeof value === "string") {
695
+ const result = substituteVariables(value, rootDir);
696
+ const sole = SOLE_REFERENCE_PATTERN.exec(value);
697
+ if (result === "" && sole) {
698
+ if (sole[1] === "env") {
699
+ onUnsetEnv?.(path62, sole[2]);
700
+ }
656
701
  return void 0;
657
702
  }
658
703
  return result;
659
704
  }
660
- if (Array.isArray(obj)) {
661
- return obj.map((item) => substituteInObject(item, rootDir));
705
+ if (Array.isArray(value)) {
706
+ return value.map((item, index) => substituteAt(item, rootDir, [...path62, index], onUnsetEnv));
662
707
  }
663
- if (obj && typeof obj === "object") {
708
+ if (value && typeof value === "object") {
664
709
  const result = {};
665
- for (const [key, value] of Object.entries(obj)) {
666
- result[key] = substituteInObject(value, rootDir);
710
+ for (const [key, item] of Object.entries(value)) {
711
+ result[key] = substituteAt(item, rootDir, [...path62, key], onUnsetEnv);
667
712
  }
668
713
  return result;
669
714
  }
670
- return obj;
715
+ return value;
671
716
  }
672
717
  var AUTH_DIR = path2.join(os.homedir(), ".config", "releasekit");
673
718
  var AUTH_FILE = path2.join(AUTH_DIR, "auth.json");
@@ -690,100 +735,133 @@ function saveAuth(provider, apiKey) {
690
735
  existing[provider] = apiKey;
691
736
  fs2.writeFileSync(AUTH_FILE, JSON.stringify(existing, null, 2), { encoding: "utf-8", mode: 384 });
692
737
  }
693
- var CONFIG_FILES = ["releasekit.config.json", "releasekit.config.jsonc"];
694
- function resolveConfigPath(cwd) {
695
- for (const file of CONFIG_FILES) {
696
- const candidate = path3.join(cwd, file);
697
- if (fs3.existsSync(candidate)) {
698
- return candidate;
738
+ var LLM_MODEL_PATH = ["notes", "releaseNotes", "llm", "model"];
739
+ var RELEASE_NOTES_OUTPUT = 'release notes go to the GitHub release body by default; for in-repo per-version files set notes.releaseNotes.file to { "dir": "release-notes" }, and for a cumulative changelog use notes.changelog.mode';
740
+ var VERSION_BUMPS = "use Conventional Commits or --bump for version bumps, version.groups for coupled packages, and release:with-prerequisites / --include-prerequisites to release a package's changed dependencies";
741
+ var REMOVED_KEYS = /* @__PURE__ */ new Map([
742
+ ["notes.releaseNotes.mode", `removed - ${RELEASE_NOTES_OUTPUT}`],
743
+ ["notes.releaseNotes.directory", `removed - ${RELEASE_NOTES_OUTPUT}`],
744
+ [
745
+ "notes.releaseNotes.llm.prompts.templates",
746
+ "removed - use notes.releaseNotes.llm.prompts.instructions to add to the built-in prompts"
747
+ ],
748
+ ["version.versionStrategy", `removed - ${VERSION_BUMPS}`],
749
+ ["version.branchPatterns", `removed - ${VERSION_BUMPS}`],
750
+ ["version.defaultReleaseType", `removed - ${VERSION_BUMPS}`],
751
+ ["version.updateInternalDependencies", `removed - ${VERSION_BUMPS}`],
752
+ ["version.baseBranch", "moved to git.branch"],
753
+ ["version.skipHooks", "moved to git.skipHooks"],
754
+ ["ci.autoRelease", "removed - it had no effect"],
755
+ ["ci.skipPatterns", "moved to release.ci.skipPatterns"],
756
+ ["ci.minChanges", "moved to release.ci.minChanges"],
757
+ [
758
+ "ci.prPreview.refreshAfterRelease",
759
+ "renamed to markStaleAfterRelease, which marks open PRs' previews stale after a release instead of recomputing them"
760
+ ],
761
+ ["ci.labels.stable", "renamed to ci.labels.graduate"],
762
+ ["monorepo.mainPackage", "moved to version.mainPackage"],
763
+ ["monorepo.mode", "removed - changelog aggregation is set by notes.changelog.mode"]
764
+ ]);
765
+ var unsetEnvByOwner = /* @__PURE__ */ new WeakMap();
766
+ function configValidationError(issues) {
767
+ const lines = issues.map((issue) => ` ${issue.path.join(".")}: ${issue.message}`).join("\n");
768
+ return new ConfigError(`Config validation errors:
769
+ ${lines}`);
770
+ }
771
+ function unsetEnvMessage(name) {
772
+ return `{env:${name}} is not set`;
773
+ }
774
+ function isRootTypeMismatch(issue) {
775
+ return issue.path.length === 0 && (issue.code === "invalid_type" || issue.code === "invalid_value");
776
+ }
777
+ function flattenIssues(issues, unsetEnv, prefix = []) {
778
+ return issues.flatMap((issue) => {
779
+ const path62 = [...prefix, ...issue.path];
780
+ if (issue.code === "invalid_union") {
781
+ const matched = issue.errors.filter((branch) => !branch.every(isRootTypeMismatch));
782
+ if (matched.length === 1) {
783
+ return flattenIssues(matched[0], unsetEnv, path62);
784
+ }
785
+ }
786
+ if (issue.code === "unrecognized_keys") {
787
+ return issue.keys.map((key) => {
788
+ const keyPath = [...path62, key];
789
+ return { path: keyPath, message: REMOVED_KEYS.get(keyPath.join(".")) ?? "unknown key" };
790
+ });
699
791
  }
700
- }
701
- return path3.join(cwd, CONFIG_FILES[0]);
792
+ const ref = unsetEnv.find((r) => samePath(r.path, path62));
793
+ if (ref) {
794
+ return [{ path: path62, message: unsetEnvMessage(ref.name) }];
795
+ }
796
+ return [{ path: path62, message: issue.message }];
797
+ });
702
798
  }
703
- function isRecord(value) {
704
- return typeof value === "object" && value !== null && !Array.isArray(value);
799
+ function samePath(a, b) {
800
+ return a.length === b.length && a.every((key, i) => key === b[i]);
705
801
  }
706
- function assertNoRemovedReleaseNotesFields(config) {
707
- if (!isRecord(config) || !isRecord(config.notes) || !isRecord(config.notes.releaseNotes)) {
708
- return;
709
- }
710
- const rn = config.notes.releaseNotes;
711
- const removed = [];
712
- if ("mode" in rn) {
713
- removed.push("mode");
714
- }
715
- if ("directory" in rn) {
716
- removed.push("directory");
717
- }
718
- if (typeof rn.file === "string") {
719
- removed.push("file (string)");
720
- }
721
- if (removed.length === 0) {
722
- return;
723
- }
724
- throw new ConfigError(
725
- `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.`
726
- );
802
+ function zodConfigError(error2, unsetEnv) {
803
+ return configValidationError(flattenIssues(error2.issues, unsetEnv));
727
804
  }
728
- function assertNoRemovedVersionFields(config) {
729
- if (!isRecord(config) || !isRecord(config.version)) {
730
- return;
805
+ function rememberUnsetEnv(config, unsetEnv) {
806
+ for (const { path: path62, name } of unsetEnv) {
807
+ const owner = path62.slice(0, -1).reduce(
808
+ (node, key) => node && typeof node === "object" ? node[key] : void 0,
809
+ config
810
+ );
811
+ if (owner && typeof owner === "object") {
812
+ const refs = unsetEnvByOwner.get(owner) ?? /* @__PURE__ */ new Map();
813
+ refs.set(path62[path62.length - 1], name);
814
+ unsetEnvByOwner.set(owner, refs);
815
+ }
731
816
  }
732
- const v = config.version;
733
- const removed = ["versionStrategy", "branchPatterns", "defaultReleaseType", "updateInternalDependencies"].filter(
734
- (k) => k in v
735
- );
736
- if (removed.length === 0) {
737
- return;
817
+ }
818
+ function copyUnsetEnv(from, to) {
819
+ const refs = unsetEnvByOwner.get(from);
820
+ if (refs) {
821
+ unsetEnvByOwner.set(to, new Map(refs));
738
822
  }
739
- throw new ConfigError(
740
- `version no longer supports ${removed.join(", ")}. Branch-pattern versioning was never functional \u2014 use Conventional Commits or --bump for version bumps. For coupled packages use version.groups; to release a package's changed dependencies use release:with-prerequisites / --include-prerequisites.`
741
- );
742
823
  }
743
- function assertNoRemovedTopLevelFields(config) {
744
- if (!isRecord(config)) {
824
+ function runsLlmTasks(llm, skipReleaseNotes) {
825
+ return llm !== void 0 && !process.env.CHANGELOG_NO_LLM && !skipReleaseNotes && Object.values(llm.tasks ?? {}).some(Boolean);
826
+ }
827
+ function assertLlmModel(llm) {
828
+ if (llm.model) {
745
829
  return;
746
830
  }
747
- if (isRecord(config.ci)) {
748
- const removed = ["autoRelease", "skipPatterns", "minChanges"].filter((k) => k in config.ci);
749
- if (removed.length > 0) {
750
- throw new ConfigError(
751
- `ci no longer supports ${removed.join(", ")}. autoRelease was removed (it had no effect); skipPatterns and minChanges live under release.ci (release.ci.skipPatterns / release.ci.minChanges).`
752
- );
753
- }
754
- if (isRecord(config.ci.prPreview) && "refreshAfterRelease" in config.ci.prPreview) {
755
- throw new ConfigError(
756
- "ci.prPreview.refreshAfterRelease was renamed to markStaleAfterRelease. It now marks open PRs' previews stale after a release instead of recomputing them."
757
- );
758
- }
759
- }
760
- if (isRecord(config.monorepo) && "mainPackage" in config.monorepo) {
761
- throw new ConfigError("monorepo.mainPackage was removed \u2014 use version.mainPackage instead.");
762
- }
831
+ const name = unsetEnvByOwner.get(llm)?.get("model");
832
+ throw configValidationError([
833
+ { path: LLM_MODEL_PATH, message: name ? unsetEnvMessage(name) : "required to run LLM tasks" }
834
+ ]);
763
835
  }
764
- function assertNoRemovedMonorepoMode(config) {
765
- if (isRecord(config) && isRecord(config.monorepo) && "mode" in config.monorepo) {
766
- throw new ConfigError("monorepo.mode was removed \u2014 changelog aggregation is controlled by notes.changelog.mode.");
836
+ var CONFIG_FILES = ["releasekit.config.json", "releasekit.config.jsonc"];
837
+ function resolveConfigPath(cwd) {
838
+ for (const file of CONFIG_FILES) {
839
+ const candidate = path3.join(cwd, file);
840
+ if (fs3.existsSync(candidate)) {
841
+ return candidate;
842
+ }
767
843
  }
844
+ return path3.join(cwd, CONFIG_FILES[0]);
768
845
  }
769
846
  function loadConfigFile(configPath) {
770
847
  if (!fs3.existsSync(configPath)) {
771
848
  return {};
772
849
  }
850
+ const unsetEnv = [];
773
851
  try {
774
852
  const content = fs3.readFileSync(configPath, "utf-8");
775
853
  const parsed = parseJsonc(content);
776
- const substituted = substituteInObject(parsed, path3.dirname(configPath));
777
- assertNoRemovedReleaseNotesFields(substituted);
778
- assertNoRemovedVersionFields(substituted);
779
- assertNoRemovedTopLevelFields(substituted);
780
- assertNoRemovedMonorepoMode(substituted);
781
- return ReleaseKitConfigSchema.parse(substituted);
854
+ const substituted = substituteInObject(
855
+ parsed,
856
+ path3.dirname(configPath),
857
+ (refPath, name) => unsetEnv.push({ path: refPath, name })
858
+ );
859
+ const config = ReleaseKitConfigSchema.parse(substituted);
860
+ rememberUnsetEnv(config, unsetEnv);
861
+ return config;
782
862
  } catch (error2) {
783
863
  if (error2 instanceof z2.ZodError) {
784
- const issues = error2.issues.map((i) => ` ${i.path.join(".")}: ${i.message}`).join("\n");
785
- throw new ConfigError(`Config validation errors:
786
- ${issues}`);
864
+ throw zodConfigError(error2, unsetEnv);
787
865
  }
788
866
  if (error2 instanceof SyntaxError) {
789
867
  throw new ConfigError(`Invalid JSON in config file: ${error2.message}`);
@@ -892,7 +970,8 @@ var VersionPackageChangelogSchema = z3.looseObject({
892
970
  previousVersion: z3.string().nullable(),
893
971
  revisionRange: z3.string(),
894
972
  repoUrl: z3.string().nullable(),
895
- entries: z3.array(VersionChangelogEntrySchema)
973
+ entries: z3.array(VersionChangelogEntrySchema),
974
+ tag: z3.string().optional()
896
975
  });
897
976
  var VersionPackageUpdateSchema = z3.looseObject({
898
977
  packageName: z3.string(),
@@ -907,11 +986,15 @@ var VersionOutputSchema = z3.looseObject({
907
986
  changelogs: z3.array(VersionPackageChangelogSchema),
908
987
  commitMessage: z3.string().optional(),
909
988
  tags: z3.array(z3.string()),
910
- baselineTags: z3.array(z3.string()).optional()
989
+ baselineTags: z3.array(z3.string()).optional(),
990
+ additionalFiles: z3.array(z3.string()).optional()
911
991
  });
912
992
 
913
993
  // src/input/version-output.ts
914
- var NotesVersionOutputSchema = VersionOutputSchema.pick({ changelogs: true });
994
+ var NotesVersionOutputSchema = VersionOutputSchema.pick({ changelogs: true, updates: true, tags: true }).partial({
995
+ updates: true,
996
+ tags: true
997
+ });
915
998
  function normalizeEntryType(type) {
916
999
  const typeMap = {
917
1000
  added: "added",
@@ -933,10 +1016,12 @@ function versionOutputToChangelogInput(data) {
933
1016
  if (!data.changelogs || !Array.isArray(data.changelogs)) {
934
1017
  throw new InputParseError('Input must contain a "changelogs" array');
935
1018
  }
1019
+ const soleTag = data.tags?.length === 1 && !data.updates?.some((u) => u.tag) ? data.tags[0] : void 0;
936
1020
  const packages = data.changelogs.map((changelog) => ({
937
1021
  packageName: changelog.packageName,
938
1022
  version: changelog.version,
939
1023
  previousVersion: changelog.previousVersion,
1024
+ tag: changelog.tag ?? data.updates?.find((u) => u.packageName === changelog.packageName)?.tag ?? soleTag,
940
1025
  revisionRange: changelog.revisionRange,
941
1026
  repoUrl: changelog.repoUrl,
942
1027
  date: (/* @__PURE__ */ new Date()).toISOString().split("T")[0] ?? "",
@@ -1171,7 +1256,9 @@ var GitHubForge = class {
1171
1256
  labels: labelNames(data.labels),
1172
1257
  headSha: data.head?.sha,
1173
1258
  headRef: data.head?.ref,
1174
- baseRef: data.base?.ref
1259
+ baseRef: data.base?.ref,
1260
+ mergeCommitSha: data.merge_commit_sha ?? void 0,
1261
+ mergedBy: data.merged_by ? { login: data.merged_by.login, type: data.merged_by.type } : void 0
1175
1262
  };
1176
1263
  }
1177
1264
  async createPullRequest(pr) {
@@ -1181,8 +1268,8 @@ var GitHubForge = class {
1181
1268
  async updatePullRequest(prNumber, changes) {
1182
1269
  await this.octokit.rest.pulls.update({ ...this.base, pull_number: prNumber, ...changes });
1183
1270
  }
1184
- async mergePullRequest(prNumber, method) {
1185
- await this.octokit.rest.pulls.merge({ ...this.base, pull_number: prNumber, merge_method: method });
1271
+ async mergePullRequest(prNumber, method, sha) {
1272
+ await this.octokit.rest.pulls.merge({ ...this.base, pull_number: prNumber, merge_method: method, sha });
1186
1273
  }
1187
1274
  async createIssue(issue) {
1188
1275
  const { data } = await this.octokit.rest.issues.create({ ...this.base, ...issue });
@@ -3134,41 +3221,37 @@ function isVersionStartAt(tag, i) {
3134
3221
  }
3135
3222
  return false;
3136
3223
  }
3137
- function generateCompareUrl(repoUrl, from, to, packageName) {
3224
+ function generateCompareUrl(repoUrl, from, to, packageName, tag) {
3138
3225
  const isPackageSpecific = from.includes("@") && packageName && from.includes(packageName);
3139
- let fromVersion;
3140
3226
  let toVersion;
3141
- if (isPackageSpecific) {
3142
- fromVersion = from;
3227
+ if (tag) {
3228
+ toVersion = tag;
3229
+ } else if (isPackageSpecific) {
3143
3230
  toVersion = `${packageName}@${to.startsWith("v") ? "" : "v"}${to}`;
3144
3231
  } else {
3145
3232
  const toClean = to.replace(/^v/, "");
3146
3233
  const atPos = from.lastIndexOf("@");
3147
3234
  const dashVPos = from.lastIndexOf("-v");
3148
3235
  if (atPos > 0 && isVersionStartAt(from, atPos + 1)) {
3149
- fromVersion = from;
3150
3236
  toVersion = `${from.slice(0, atPos + 1)}${from[atPos + 1] === "v" ? "v" : ""}${toClean}`;
3151
3237
  } else if (dashVPos > 0 && from.charCodeAt(dashVPos + 2) >= 48 && from.charCodeAt(dashVPos + 2) <= 57) {
3152
- fromVersion = from;
3153
3238
  toVersion = `${from.slice(0, dashVPos + 1)}v${toClean}`;
3154
3239
  } else {
3155
3240
  const sepPos = findCompoundTagSepPos(from);
3156
3241
  if (sepPos > 0) {
3157
- fromVersion = from;
3158
3242
  toVersion = `${from.slice(0, sepPos + 1)}${toClean}`;
3159
3243
  } else {
3160
- fromVersion = from.replace(/^v/, "");
3161
- toVersion = toClean;
3244
+ toVersion = `${from.startsWith("v") ? "v" : ""}${toClean}`;
3162
3245
  }
3163
3246
  }
3164
3247
  }
3165
3248
  if (/gitlab\.com/i.test(repoUrl)) {
3166
- return `${repoUrl}/-/compare/${fromVersion}...${toVersion}`;
3249
+ return `${repoUrl}/-/compare/${from}...${toVersion}`;
3167
3250
  }
3168
3251
  if (/bitbucket\.org/i.test(repoUrl)) {
3169
- return `${repoUrl}/branches/compare/${fromVersion}..${toVersion}`;
3252
+ return `${repoUrl}/branches/compare/${from}..${toVersion}`;
3170
3253
  }
3171
- return `${repoUrl}/compare/${fromVersion}...${toVersion}`;
3254
+ return `${repoUrl}/compare/${from}...${toVersion}`;
3172
3255
  }
3173
3256
  function buildOrderedCategories(rawCategories, configCategories) {
3174
3257
  const order = configCategories?.map((c) => c.name) ?? [];
@@ -3183,7 +3266,7 @@ function buildOrderedCategories(rawCategories, configCategories) {
3183
3266
  });
3184
3267
  }
3185
3268
  function createTemplateContext(pkg) {
3186
- const compareUrl = pkg.repoUrl && pkg.previousVersion ? generateCompareUrl(pkg.repoUrl, pkg.previousVersion, pkg.version, pkg.packageName) : void 0;
3269
+ const compareUrl = pkg.repoUrl && pkg.previousVersion ? generateCompareUrl(pkg.repoUrl, pkg.previousVersion, pkg.version, pkg.packageName, pkg.tag) : void 0;
3187
3270
  return {
3188
3271
  packageName: pkg.packageName,
3189
3272
  version: pkg.version,
@@ -3362,7 +3445,8 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
3362
3445
  const changelogConfig = config.changelog === false ? false : { mode: "root", ...config.changelog ?? {} };
3363
3446
  const releaseNotesConfig = config.releaseNotes === false || config.releaseNotes === void 0 ? void 0 : config.releaseNotes;
3364
3447
  const llmConfig = releaseNotesConfig?.llm;
3365
- if (llmConfig && !process.env.CHANGELOG_NO_LLM && !pipelineOptions?.skipReleaseNotes) {
3448
+ if (llmConfig && runsLlmTasks(llmConfig, pipelineOptions?.skipReleaseNotes)) {
3449
+ assertLlmModel(llmConfig);
3366
3450
  info("Processing with LLM enhancement");
3367
3451
  const examplesCount = llmConfig.examples ?? 3;
3368
3452
  const repoUrl = contexts[0]?.repoUrl ?? input.metadata?.repoUrl;
@@ -3466,7 +3550,7 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
3466
3550
  const dir = releaseNotesConfig.file.dir;
3467
3551
  info(`Generating release notes \u2192 ${dir}`);
3468
3552
  try {
3469
- const { detectMonorepo } = await import("./aggregator-SCGIHWXW.js");
3553
+ const { detectMonorepo } = await import("./aggregator-JHRFNT67.js");
3470
3554
  const nested = detectMonorepo(process.cwd()).isMonorepo || contexts.length > 1;
3471
3555
  const renderContent = (ctx) => {
3472
3556
  if (releaseNotesConfig.templates?.path) {
@@ -3530,7 +3614,7 @@ async function processInput(inputJson, config, dryRun, pipelineOptions) {
3530
3614
  return runPipeline(input, config, dryRun, pipelineOptions);
3531
3615
  }
3532
3616
  async function writeMonorepoFiles(contexts, config, dryRun, fileName, refs) {
3533
- const { detectMonorepo, writeMonorepoChangelogs } = await import("./aggregator-SCGIHWXW.js");
3617
+ const { detectMonorepo, writeMonorepoChangelogs } = await import("./aggregator-JHRFNT67.js");
3534
3618
  const cwd = process.cwd();
3535
3619
  const detected = detectMonorepo(cwd);
3536
3620
  if (!detected.isMonorepo) {
@@ -3653,6 +3737,9 @@ function createNotesCommand() {
3653
3737
  const detail = issues?.map((i) => i.message).join("; ") ?? (err instanceof Error ? err.message : String(err));
3654
3738
  throw new Error(`Invalid LLM configuration from --llm-* flags: ${detail}`);
3655
3739
  }
3740
+ if (existingLlm) {
3741
+ copyUnsetEnv(existingLlm, validatedLlm);
3742
+ }
3656
3743
  config.releaseNotes = {
3657
3744
  ...existingRn,
3658
3745
  llm: validatedLlm