@releasekit/notes 0.25.0 → 0.27.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.
@@ -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,133 +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
- * Optional env var name containing a GitHub token for HTTPS pushes.
62
- * When set, publish steps can use this token without mutating git remotes.
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")
84
+ });
85
+ var VersionGroupSchema = z.object({
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
+ )
81
92
  });
82
93
  var VersionConfigSchema = z.object({
83
- tagTemplate: z.string().default("v{version}"),
84
- /**
85
- * Optional secondary tag template for an internal "baseline" marker that records the
86
- * release commit on the source branch. Use this when `tagTemplate` resolves to a tag that
87
- * gets force-moved off the source branch by a downstream step (for example, a GitHub
88
- * Action distributing built artifacts at the version tag) — the baseline tag stays on the
89
- * release commit so version-bump and changelog calculations can still find the previous
90
- * release in the working branch's history.
91
- *
92
- * Supports `${packageName}`, `${prefix}`, `${version}` substitutions. Leave unset for
93
- * single-tag workflows (the default).
94
- */
95
- 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\}.*/, {
96
100
  message: (
97
101
  // biome-ignore lint/suspicious/noTemplateCurlyInString: documenting the expected placeholder syntax to the user
98
102
  'baselineTagTemplate must contain a ${version} placeholder so the prefix can be derived (e.g. "release/${prefix}${version}").'
99
103
  )
100
- }).optional(),
101
- packageSpecificTags: z.boolean().default(false),
102
- preset: z.string().default("conventional"),
103
- sync: z.boolean().default(true),
104
- packages: z.array(z.string()).default([]),
105
- mainPackage: z.string().optional(),
106
- updateInternalDependencies: z.enum(["major", "minor", "patch", "no-internal-update"]).default("minor"),
107
- skip: z.array(z.string()).optional(),
108
- commitMessage: z.string().optional(),
109
- versionStrategy: z.enum(["branchPattern", "commitMessage"]).default("commitMessage"),
110
- branchPatterns: z.array(BranchPatternSchema).optional(),
111
- defaultReleaseType: z.enum(["major", "minor", "patch", "prerelease"]).optional(),
112
- mismatchStrategy: z.enum(["error", "warn", "ignore", "prefer-package", "prefer-git"]).default("warn"),
113
- versionPrefix: z.string().default(""),
114
- prereleaseIdentifier: z.string().optional(),
115
- strictReachable: z.boolean().default(false),
116
- 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")
117
133
  });
118
134
  var NpmConfigSchema = z.object({
119
- enabled: z.boolean().default(true),
120
- auth: z.enum(["auto", "oidc", "token"]).default("auto"),
121
- provenance: z.boolean().default(true),
122
- access: z.enum(["public", "restricted"]).default("public"),
123
- registry: z.string().default("https://registry.npmjs.org"),
124
- copyFiles: z.array(z.string()).default(["LICENSE"]),
125
- 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")
126
142
  });
127
143
  var CargoPublishConfigSchema = z.object({
128
- enabled: z.boolean().default(false),
129
- noVerify: z.boolean().default(false),
130
- publishOrder: z.array(z.string()).default([]),
131
- 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")
132
152
  });
133
153
  var PublishGitConfigSchema = z.object({
134
- push: z.boolean().default(true),
135
- pushMethod: z.enum(["auto", "ssh", "https"]).optional(),
136
- remote: z.string().optional(),
137
- branch: z.string().optional(),
138
- httpsTokenEnv: z.string().optional(),
139
- 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")
140
160
  });
141
161
  var GitHubReleaseConfigSchema = z.object({
142
- enabled: z.boolean().default(true),
143
- draft: z.boolean().default(true),
144
- perPackage: z.boolean().default(true),
145
- prerelease: z.union([z.literal("auto"), z.boolean()]).default("auto"),
146
- /**
147
- * Controls the source for the GitHub release body.
148
- * - 'auto': Use release notes if enabled, else changelog, else GitHub auto-generated.
149
- * - 'releaseNotes': Use LLM-generated release notes (requires notes.releaseNotes.enabled: true).
150
- * - 'changelog': Use formatted changelog entries.
151
- * - 'generated': Use GitHub's auto-generated notes.
152
- * - 'none': No body.
153
- */
154
- body: z.enum(["auto", "releaseNotes", "changelog", "generated", "none"]).default("auto"),
155
- /**
156
- * Template string for the GitHub release title when a package name is resolved.
157
- * Available variables: ${packageName} (original scoped name), ${version} (e.g. "v1.0.0").
158
- * Version-only tags (e.g. "v1.0.0") always use the tag as-is.
159
- */
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
+ ),
160
169
  /* biome-ignore lint/suspicious/noTemplateCurlyInString: default template value */
161
- titleTemplate: z.string().default("${packageName}: ${version}"),
162
- /**
163
- * Package names to exclude from GitHub release creation. Tags are still created
164
- * (so changelog range detection still works on the next release) and npm publish
165
- * still runs — only the `gh release create` call is skipped for these packages.
166
- * Useful for internal/utility packages that shouldn't appear in the GitHub releases UI.
167
- */
168
- skipPackages: z.array(z.string()).default([])
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")
169
181
  });
170
- var VerifyRegistryConfigSchema = z.object({
171
- enabled: z.boolean().default(true),
172
- maxAttempts: z.number().int().positive().default(5),
173
- initialDelay: z.number().int().positive().default(15e3),
174
- 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")
175
193
  });
176
194
  var VerifyConfigSchema = z.object({
177
- npm: VerifyRegistryConfigSchema.default({
195
+ npm: VerifyRegistryNpmConfigSchema.default({
178
196
  enabled: true,
179
197
  maxAttempts: 5,
180
198
  initialDelay: 15e3,
181
199
  backoffMultiplier: 2
182
200
  }),
183
- cargo: VerifyRegistryConfigSchema.default({
201
+ cargo: VerifyRegistryCargoConfigSchema.default({
202
+ enabled: true,
203
+ maxAttempts: 10,
204
+ initialDelay: 3e4,
205
+ backoffMultiplier: 2
206
+ }),
207
+ pub: VerifyRegistryPubConfigSchema.default({
184
208
  enabled: true,
185
209
  maxAttempts: 10,
186
210
  initialDelay: 3e4,
@@ -188,7 +212,7 @@ var VerifyConfigSchema = z.object({
188
212
  })
189
213
  });
190
214
  var PublishConfigSchema = z.object({
191
- git: PublishGitConfigSchema.optional(),
215
+ git: PublishGitConfigSchema.optional().describe("Git publishing options"),
192
216
  npm: NpmConfigSchema.default({
193
217
  enabled: true,
194
218
  auth: "auto",
@@ -197,13 +221,17 @@ var PublishConfigSchema = z.object({
197
221
  registry: "https://registry.npmjs.org",
198
222
  copyFiles: ["LICENSE"],
199
223
  tag: "latest"
200
- }),
224
+ }).describe("NPM publishing configuration"),
201
225
  cargo: CargoPublishConfigSchema.default({
202
226
  enabled: false,
203
227
  noVerify: false,
204
228
  publishOrder: [],
205
229
  clean: false
206
- }),
230
+ }).describe("Cargo publishing configuration"),
231
+ pub: PubPublishConfigSchema.default({
232
+ enabled: false,
233
+ publishOrder: []
234
+ }).describe("Dart/Flutter publishing configuration via pub"),
207
235
  githubRelease: GitHubReleaseConfigSchema.default({
208
236
  enabled: true,
209
237
  draft: true,
@@ -213,7 +241,7 @@ var PublishConfigSchema = z.object({
213
241
  /* biome-ignore lint/suspicious/noTemplateCurlyInString: default template value */
214
242
  titleTemplate: "${packageName}: ${version}",
215
243
  skipPackages: []
216
- }),
244
+ }).describe("GitHub Release configuration"),
217
245
  verify: VerifyConfigSchema.default({
218
246
  npm: {
219
247
  enabled: true,
@@ -226,68 +254,89 @@ var PublishConfigSchema = z.object({
226
254
  maxAttempts: 10,
227
255
  initialDelay: 3e4,
228
256
  backoffMultiplier: 2
257
+ },
258
+ pub: {
259
+ enabled: true,
260
+ maxAttempts: 10,
261
+ initialDelay: 3e4,
262
+ backoffMultiplier: 2
229
263
  }
230
- })
264
+ }).describe("Registry verification configuration")
231
265
  });
232
266
  var TemplateConfigSchema = z.object({
233
- path: z.string().optional(),
234
- 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")
235
269
  });
236
270
  var LocationModeSchema = z.enum(["root", "packages", "both"]);
237
- var ChangelogConfigSchema = z.object({
238
- mode: LocationModeSchema.optional(),
239
- file: z.string().optional(),
240
- templates: TemplateConfigSchema.optional()
271
+ var ReleaseNotesFileConfigSchema = z.object({
272
+ dir: z.string().default("release-notes").describe("Directory for the per-version release-notes files.")
241
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");
242
281
  var LLMOptionsSchema = z.object({
243
- timeout: z.number().optional(),
244
- maxTokens: z.number().optional(),
245
- 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")
246
285
  });
247
286
  var LLMRetryConfigSchema = z.object({
248
- maxAttempts: z.number().int().positive().optional(),
249
- initialDelay: z.number().nonnegative().optional(),
250
- maxDelay: z.number().positive().optional(),
251
- backoffFactor: z.number().positive().optional()
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")
252
295
  });
253
296
  var LLMTasksConfigSchema = z.object({
254
- summarize: z.boolean().optional(),
255
- enhance: z.boolean().optional(),
256
- categorize: z.boolean().optional(),
257
- 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")
258
301
  });
259
302
  var LLMCategorySchema = z.object({
260
- name: z.string(),
261
- description: z.string(),
262
- 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")
263
306
  });
264
307
  var ScopeRulesSchema = z.object({
265
- allowed: z.array(z.string()).optional(),
266
- caseSensitive: z.boolean().default(false),
267
- invalidScopeAction: z.enum(["remove", "keep", "fallback"]).default("remove"),
268
- fallbackScope: z.string().optional()
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'")
269
314
  });
270
315
  var ScopeConfigSchema = z.object({
271
- mode: z.enum(["restricted", "packages", "none", "unrestricted"]).default("unrestricted"),
272
- rules: ScopeRulesSchema.optional()
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")
273
320
  });
274
321
  var LLMPromptOverridesSchema = z.object({
275
- enhance: z.string().optional(),
276
- categorize: z.string().optional(),
277
- enhanceAndCategorize: z.string().optional(),
278
- summarize: z.string().optional(),
279
- 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")
280
327
  });
281
328
  var LLMPromptsConfigSchema = z.object({
282
- instructions: LLMPromptOverridesSchema.optional()
329
+ instructions: LLMPromptOverridesSchema.optional().describe(
330
+ "Per-task instruction overrides appended to the built-in prompts."
331
+ )
283
332
  });
284
333
  var LLMConfigSchema = z.object({
285
- provider: z.string(),
286
- model: z.string(),
287
- baseURL: z.string().optional(),
288
- 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"),
289
338
  options: LLMOptionsSchema.optional(),
290
- concurrency: z.number().int().positive().optional(),
339
+ concurrency: z.number().int().positive().optional().describe("Concurrent LLM requests"),
291
340
  retry: LLMRetryConfigSchema.optional(),
292
341
  tasks: LLMTasksConfigSchema.optional(),
293
342
  categories: z.array(LLMCategorySchema).default(() => [
@@ -299,82 +348,88 @@ var LLMConfigSchema = z.object({
299
348
  ]),
300
349
  style: z.string().default(
301
350
  'Write in past tense ("Added feature", not "Add feature"). Be concise and user-focused. Lead with the impact, not the implementation detail.'
302
- ),
351
+ ).describe("Writing style for LLM"),
303
352
  scopes: ScopeConfigSchema.optional(),
304
353
  prompts: LLMPromptsConfigSchema.optional(),
305
- 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)."),
306
355
  context: z.object({
307
- pullRequests: z.boolean().default(true)
308
- }).default({ pullRequests: true }),
309
- 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
+ )
310
361
  });
311
362
  var ReleaseNotesConfigSchema = z.object({
312
- mode: LocationModeSchema.optional(),
313
- file: z.string().optional(),
314
- templates: TemplateConfigSchema.optional(),
315
- llm: LLMConfigSchema.optional(),
363
+ file: ReleaseNotesFileConfigSchema.optional().describe(
364
+ "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."
365
+ ),
366
+ templates: TemplateConfigSchema.optional().describe(
367
+ "Template for rendering release notes (e.g. to add docs-site frontmatter). Takes precedence over LLM prose and the default formatted section."
368
+ ),
369
+ llm: LLMConfigSchema.optional().describe("LLM configuration for release notes"),
316
370
  links: z.object({
317
- items: z.array(z.object({ label: z.string(), url: z.string().url() })).optional(),
318
- fromPRBodyMarker: z.string().optional(),
319
- title: z.string().optional()
320
- }).optional()
321
- });
371
+ items: z.array(
372
+ z.object({
373
+ label: z.string().describe("Link text"),
374
+ url: z.string().url().describe("Link URL")
375
+ })
376
+ ).optional().describe("Static list of links to append."),
377
+ fromPRBodyMarker: z.string().optional().describe("Marker string in PR bodies; content after it is extracted and appended as links."),
378
+ title: z.string().optional().describe("Heading for the links section.")
379
+ }).optional().describe("Extra links to append to the release notes.")
380
+ }).describe("Release notes configuration");
322
381
  var NotesInputConfigSchema = z.object({
323
382
  source: z.string().optional(),
324
383
  file: z.string().optional()
325
384
  });
326
385
  var NotesConfigSchema = z.object({
327
- changelog: z.union([z.literal(false), ChangelogConfigSchema]).optional(),
328
- releaseNotes: z.union([z.literal(false), ReleaseNotesConfigSchema]).optional(),
329
- updateStrategy: z.enum(["prepend", "regenerate"]).optional()
386
+ changelog: z.union([z.literal(false).describe("Set to false to disable changelog generation"), ChangelogConfigSchema]).optional(),
387
+ releaseNotes: z.union([z.literal(false).describe("Set to false to disable release notes"), ReleaseNotesConfigSchema]).optional(),
388
+ updateStrategy: z.enum(["prepend", "regenerate"]).optional().describe(
389
+ "How to update existing changelog files. 'prepend' adds new entries to the top; 'regenerate' rewrites the file from scratch."
390
+ )
330
391
  });
331
392
  var CILabelsConfigSchema = z.object({
332
- stable: z.string().default("channel:stable"),
333
- prerelease: z.string().default("channel:prerelease"),
334
- skip: z.string().default("release:skip"),
335
- /** Bypass the standing PR for one merge — triggers a direct release. Standing-pr mode only. */
336
- immediate: z.string().default("release:immediate"),
337
- /** Retry a failed publish by re-applying it to a merged standing PR. Standing-pr mode only. */
338
- retry: z.string().default("release:retry"),
339
- major: z.string().default("bump:major"),
340
- minor: z.string().default("bump:minor"),
341
- patch: z.string().default("bump:patch")
393
+ stable: z.string().default("channel:stable").describe("Label to graduate a prerelease to stable"),
394
+ prerelease: z.string().default("channel:prerelease").describe("Label to create a prerelease"),
395
+ skip: z.string().default("release:skip").describe("Label to suppress a release on this PR"),
396
+ 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."),
397
+ 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."),
398
+ major: z.string().default("bump:major").describe("Label to force a major bump"),
399
+ minor: z.string().default("bump:minor").describe("Label to force a minor bump"),
400
+ patch: z.string().default("bump:patch").describe("Label to force a patch bump")
342
401
  });
343
402
  var StandingPrConfigSchema = z.object({
344
- /** Branch name for the release PR. Default: 'release/next' */
345
- branch: z.string().default("release/next"),
346
- /**
347
- * Title template for the release PR. Variables: ${count} (publishable package count),
348
- * ${version} (raw version), ${tag} (version with tag prefix). Must start with 'chore: release'
349
- * to match default skip pattern on merge. When unset, the default depends on the versioning
350
- * strategy: 'chore: release ${tag}' in sync mode (the repo releases as one versioned unit),
351
- * 'chore: release ${count} package(s)' otherwise.
352
- */
353
- title: z.string().optional(),
354
- /** Labels to apply to the standing release PR */
355
- labels: z.array(z.string()).default(["release"]),
356
- /** Whether to auto-delete the release branch after PR merge. Default: true */
357
- deleteBranchOnMerge: z.boolean().default(true),
358
- /** Merge method to use when merging the standing release PR. Default: 'merge' */
359
- mergeMethod: z.enum(["merge", "squash", "rebase"]).default("merge"),
360
- /** 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. */
361
- minAge: z.string().optional(),
362
- /** 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. */
363
- minPackages: z.number().int().positive().optional()
403
+ branch: z.string().default("release/next").describe("Branch name for the standing release PR."),
404
+ title: z.string().optional().describe(
405
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: documenting placeholder syntax to the user
406
+ "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."
407
+ ),
408
+ labels: z.array(z.string()).default(["release"]).describe("Labels to apply to the standing release PR."),
409
+ deleteBranchOnMerge: z.boolean().default(true).describe("Whether to auto-delete the release branch after the PR is merged."),
410
+ mergeMethod: z.enum(["merge", "squash", "rebase"]).default("merge").describe("Merge method to use when merging the standing release PR via CLI."),
411
+ minAge: z.string().optional().describe(
412
+ "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."
413
+ ),
414
+ minPackages: z.number().int().positive().optional().describe(
415
+ "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."
416
+ )
364
417
  });
365
418
  var CIConfigSchema = z.object({
366
- releaseStrategy: z.enum(["manual", "direct", "standing-pr"]).default("direct"),
367
- releaseTrigger: z.enum(["commit", "label"]).default("label"),
368
- prPreview: z.boolean().default(true),
369
- autoRelease: z.boolean().default(false),
370
- /**
371
- * Commit message prefixes that should not trigger a release.
372
- * Defaults to `['chore: release ']` to match the release commit template
373
- * (`chore: release ${packageName} v${version}`) and provide a
374
- * secondary loop-prevention guard alongside `[skip ci]`.
375
- */
376
- skipPatterns: z.array(z.string()).default(["chore: release "]),
377
- minChanges: z.number().int().positive().default(1),
419
+ releaseStrategy: z.enum(["manual", "direct", "standing-pr"]).default("direct").describe(
420
+ "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."
421
+ ),
422
+ releaseTrigger: z.enum(["commit", "label"]).default("label").describe(
423
+ "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."
424
+ ),
425
+ prPreview: z.boolean().default(true).describe(
426
+ "Enable PR preview comments showing what would be released if the PR is merged. Set to false to disable."
427
+ ),
428
+ autoRelease: z.boolean().default(false).describe("Automatically trigger a release when CI conditions are met, without manual intervention."),
429
+ skipPatterns: z.array(z.string()).default(["chore: release "]).describe(
430
+ "Commit message prefixes that suppress a release. The default matches the release commit template to prevent release loops."
431
+ ),
432
+ minChanges: z.number().int().positive().default(1).describe("Minimum number of packages with releasable changes required to trigger a release."),
378
433
  labels: CILabelsConfigSchema.default({
379
434
  stable: "channel:stable",
380
435
  prerelease: "channel:prerelease",
@@ -384,40 +439,36 @@ var CIConfigSchema = z.object({
384
439
  major: "bump:major",
385
440
  minor: "bump:minor",
386
441
  patch: "bump:patch"
387
- }),
388
- /**
389
- * Map of scope labels to package patterns.
390
- * When a PR has a label matching a key, only packages matching the corresponding pattern will be released.
391
- */
392
- scopeLabels: z.record(z.string(), z.string()).optional(),
393
- /** Configuration for the standing release PR feature. */
394
- standingPr: StandingPrConfigSchema.optional()
442
+ }).describe("PR label names used for release control. Override to match your repository's label conventions."),
443
+ scopeLabels: z.record(z.string(), z.string()).optional().describe(
444
+ "Map of scope labels to package patterns. When a PR has a label matching a key, only packages matching the corresponding pattern are released."
445
+ ),
446
+ standingPr: StandingPrConfigSchema.optional().describe(
447
+ "Configuration for the standing release PR feature (ci.releaseStrategy: 'standing-pr')."
448
+ )
395
449
  });
396
450
  var ReleaseCIConfigSchema = z.object({
397
- skipPatterns: z.array(z.string().min(1)).optional(),
398
- minChanges: z.number().int().positive().optional(),
399
- /** Set to `false` to disable GitHub release creation in CI. */
400
- githubRelease: z.literal(false).optional(),
401
- /** Set to `false` to disable changelog generation in CI. */
402
- notes: z.literal(false).optional()
451
+ skipPatterns: z.array(z.string().min(1)).optional().describe("Commit message prefixes that prevent a release (e.g. 'chore(deps):', 'ci:')"),
452
+ minChanges: z.number().int().positive().optional().describe("Minimum number of packages with releasable changes required to trigger a release"),
453
+ githubRelease: z.literal(false).optional().describe("Set to false to disable GitHub release creation in CI"),
454
+ notes: z.literal(false).optional().describe("Set to false to disable changelog generation in CI")
403
455
  });
404
456
  var ReleaseConfigSchema = z.object({
405
- /**
406
- * Optional steps to enable. The version step always runs; only 'notes' and
407
- * 'publish' can be opted out. Omitting a step is equivalent to --skip-<step>.
408
- */
409
- steps: z.array(z.enum(["notes", "publish"])).min(1).optional(),
410
- ci: ReleaseCIConfigSchema.optional()
457
+ 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>."),
458
+ ci: ReleaseCIConfigSchema.optional().describe("CI-specific automation settings")
411
459
  });
412
460
  var ReleaseKitConfigSchema = z.object({
413
- git: GitConfigSchema.optional(),
414
- monorepo: MonorepoConfigSchema.optional(),
415
- version: VersionConfigSchema.optional(),
416
- publish: PublishConfigSchema.optional(),
417
- notes: NotesConfigSchema.optional(),
418
- ci: CIConfigSchema.optional(),
419
- release: ReleaseConfigSchema.optional()
420
- });
461
+ $schema: z.string().optional().describe("JSON schema reference URL"),
462
+ git: GitConfigSchema.optional().describe("Git configuration"),
463
+ monorepo: MonorepoConfigSchema.optional().describe("Monorepo configuration"),
464
+ version: VersionConfigSchema.optional().describe("Versioning configuration"),
465
+ publish: PublishConfigSchema.optional().describe("Publishing configuration"),
466
+ notes: NotesConfigSchema.optional().describe("Changelog and release notes configuration"),
467
+ ci: CIConfigSchema.optional().describe(
468
+ "CI automation configuration for release triggers, PR previews, and label management"
469
+ ),
470
+ release: ReleaseConfigSchema.optional().describe("Release pipeline automation configuration")
471
+ }).describe("Configuration schema for ReleaseKit - Automated versioning, changelog generation, and publishing");
421
472
  var MAX_INPUT_LENGTH = 1e4;
422
473
  function substituteVariables(value) {
423
474
  if (value.length > MAX_INPUT_LENGTH) {
@@ -491,6 +542,21 @@ function resolveConfigPath(cwd) {
491
542
  }
492
543
  return path3.join(cwd, CONFIG_FILES[0]);
493
544
  }
545
+ function isRecord(value) {
546
+ return typeof value === "object" && value !== null && !Array.isArray(value);
547
+ }
548
+ function assertNoRemovedReleaseNotesFields(config) {
549
+ if (!isRecord(config) || !isRecord(config.notes) || !isRecord(config.notes.releaseNotes)) return;
550
+ const rn = config.notes.releaseNotes;
551
+ const removed = [];
552
+ if ("mode" in rn) removed.push("mode");
553
+ if ("directory" in rn) removed.push("directory");
554
+ if (typeof rn.file === "string") removed.push("file (string)");
555
+ if (removed.length === 0) return;
556
+ throw new ConfigError(
557
+ `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.`
558
+ );
559
+ }
494
560
  function loadConfigFile(configPath) {
495
561
  if (!fs3.existsSync(configPath)) {
496
562
  return {};
@@ -499,6 +565,7 @@ function loadConfigFile(configPath) {
499
565
  const content = fs3.readFileSync(configPath, "utf-8");
500
566
  const parsed = parseJsonc(content);
501
567
  const substituted = substituteInObject(parsed);
568
+ assertNoRemovedReleaseNotesFields(substituted);
502
569
  return ReleaseKitConfigSchema.parse(substituted);
503
570
  } catch (error2) {
504
571
  if (error2 instanceof z2.ZodError) {
@@ -580,7 +647,7 @@ function getExitCode(error2) {
580
647
  }
581
648
 
582
649
  // src/input/version-output.ts
583
- import * as fs4 from "fs";
650
+ import * as fs5 from "fs";
584
651
  function normalizeEntryType(type) {
585
652
  const typeMap = {
586
653
  added: "added",
@@ -637,7 +704,7 @@ function parseVersionOutput(json) {
637
704
  return versionOutputToChangelogInput(data);
638
705
  }
639
706
  function parseVersionOutputFile(filePath) {
640
- const content = fs4.readFileSync(filePath, "utf-8");
707
+ const content = fs5.readFileSync(filePath, "utf-8");
641
708
  return parseVersionOutput(content);
642
709
  }
643
710
  async function parseVersionOutputStdin() {
@@ -664,8 +731,8 @@ function getDefaultConfig() {
664
731
  }
665
732
 
666
733
  // src/core/pipeline.ts
667
- import * as fs10 from "fs";
668
- import * as path9 from "path";
734
+ import * as fs12 from "fs";
735
+ import * as path11 from "path";
669
736
 
670
737
  // src/llm/context/prFetcher.ts
671
738
  import { RequestError } from "@octokit/request-error";
@@ -779,9 +846,9 @@ var LLM_DEFAULTS = {
779
846
 
780
847
  // src/llm/examples/fetcher.ts
781
848
  import { createHash } from "crypto";
782
- import * as fs5 from "fs";
849
+ import * as fs6 from "fs";
783
850
  import * as os2 from "os";
784
- import * as path5 from "path";
851
+ import * as path6 from "path";
785
852
  import { RequestError as RequestError2 } from "@octokit/request-error";
786
853
  import { Octokit as Octokit2 } from "@octokit/rest";
787
854
 
@@ -837,16 +904,16 @@ ${blocks.join("\n")}
837
904
 
838
905
  // src/llm/examples/fetcher.ts
839
906
  function cacheDir() {
840
- return path5.join(os2.tmpdir(), "releasekit", "examples");
907
+ return path6.join(os2.tmpdir(), "releasekit", "examples");
841
908
  }
842
909
  function cacheKey(owner, repo, packageName) {
843
910
  const safe = packageName.replace(/[^a-zA-Z0-9-]/g, "_");
844
911
  const hash = createHash("sha256").update(packageName).digest("hex").slice(0, 8);
845
- return path5.join(cacheDir(), owner, repo, `${safe}_${hash}.json`);
912
+ return path6.join(cacheDir(), owner, repo, `${safe}_${hash}.json`);
846
913
  }
847
914
  function readCache(key, latestTag, count) {
848
915
  try {
849
- const raw = fs5.readFileSync(key, "utf-8");
916
+ const raw = fs6.readFileSync(key, "utf-8");
850
917
  const entry = JSON.parse(raw);
851
918
  if (entry.latestTag !== latestTag || entry.count < count) return null;
852
919
  return entry.examples;
@@ -856,8 +923,8 @@ function readCache(key, latestTag, count) {
856
923
  }
857
924
  function writeCache(key, latestTag, count, examples) {
858
925
  try {
859
- fs5.mkdirSync(path5.dirname(key), { recursive: true });
860
- fs5.writeFileSync(key, JSON.stringify({ latestTag, count, examples }), "utf-8");
926
+ fs6.mkdirSync(path6.dirname(key), { recursive: true });
927
+ fs6.writeFileSync(key, JSON.stringify({ latestTag, count, examples }), "utf-8");
861
928
  } catch {
862
929
  }
863
930
  }
@@ -1846,8 +1913,29 @@ function createProvider(config) {
1846
1913
  }
1847
1914
  }
1848
1915
 
1916
+ // src/output/versioned.ts
1917
+ import * as fs7 from "fs";
1918
+ import * as path7 from "path";
1919
+ function writeVersionedNotes(contexts, directory, dryRun, nested, renderContent) {
1920
+ const written = [];
1921
+ for (const ctx of contexts) {
1922
+ const outputPath = nested ? path7.join(directory, ctx.packageName, `${ctx.version}.md`) : path7.join(directory, `${ctx.version}.md`);
1923
+ const content = renderContent(ctx);
1924
+ if (dryRun) {
1925
+ info(`[DRY RUN] Release notes (would write to ${outputPath}):`);
1926
+ info(content);
1927
+ continue;
1928
+ }
1929
+ fs7.mkdirSync(path7.dirname(outputPath), { recursive: true });
1930
+ fs7.writeFileSync(outputPath, content, "utf-8");
1931
+ success(`Release notes written to ${outputPath}`);
1932
+ written.push(outputPath);
1933
+ }
1934
+ return written;
1935
+ }
1936
+
1849
1937
  // src/templates/ejs.ts
1850
- import * as fs6 from "fs";
1938
+ import * as fs8 from "fs";
1851
1939
  import ejs from "ejs";
1852
1940
  function renderEjs(template, context) {
1853
1941
  try {
@@ -1857,16 +1945,16 @@ function renderEjs(template, context) {
1857
1945
  }
1858
1946
  }
1859
1947
  function renderEjsFile(filePath, context) {
1860
- if (!fs6.existsSync(filePath)) {
1948
+ if (!fs8.existsSync(filePath)) {
1861
1949
  throw new TemplateError(`Template file not found: ${filePath}`);
1862
1950
  }
1863
- const template = fs6.readFileSync(filePath, "utf-8");
1951
+ const template = fs8.readFileSync(filePath, "utf-8");
1864
1952
  return renderEjs(template, context);
1865
1953
  }
1866
1954
 
1867
1955
  // src/templates/handlebars.ts
1868
- import * as fs7 from "fs";
1869
- import * as path6 from "path";
1956
+ import * as fs9 from "fs";
1957
+ import * as path8 from "path";
1870
1958
  import Handlebars from "handlebars";
1871
1959
  function registerHandlebarsHelpers() {
1872
1960
  Handlebars.registerHelper("capitalize", (str) => {
@@ -1892,28 +1980,28 @@ function renderHandlebars(template, context) {
1892
1980
  }
1893
1981
  }
1894
1982
  function renderHandlebarsFile(filePath, context) {
1895
- if (!fs7.existsSync(filePath)) {
1983
+ if (!fs9.existsSync(filePath)) {
1896
1984
  throw new TemplateError(`Template file not found: ${filePath}`);
1897
1985
  }
1898
- const template = fs7.readFileSync(filePath, "utf-8");
1986
+ const template = fs9.readFileSync(filePath, "utf-8");
1899
1987
  return renderHandlebars(template, context);
1900
1988
  }
1901
1989
  function renderHandlebarsComposable(templateDir, context) {
1902
1990
  registerHandlebarsHelpers();
1903
- const versionPath = path6.join(templateDir, "version.hbs");
1904
- const entryPath = path6.join(templateDir, "entry.hbs");
1905
- const documentPath = path6.join(templateDir, "document.hbs");
1906
- if (!fs7.existsSync(documentPath)) {
1991
+ const versionPath = path8.join(templateDir, "version.hbs");
1992
+ const entryPath = path8.join(templateDir, "entry.hbs");
1993
+ const documentPath = path8.join(templateDir, "document.hbs");
1994
+ if (!fs9.existsSync(documentPath)) {
1907
1995
  throw new TemplateError(`Document template not found: ${documentPath}`);
1908
1996
  }
1909
- if (fs7.existsSync(versionPath)) {
1910
- Handlebars.registerPartial("version", fs7.readFileSync(versionPath, "utf-8"));
1997
+ if (fs9.existsSync(versionPath)) {
1998
+ Handlebars.registerPartial("version", fs9.readFileSync(versionPath, "utf-8"));
1911
1999
  }
1912
- if (fs7.existsSync(entryPath)) {
1913
- Handlebars.registerPartial("entry", fs7.readFileSync(entryPath, "utf-8"));
2000
+ if (fs9.existsSync(entryPath)) {
2001
+ Handlebars.registerPartial("entry", fs9.readFileSync(entryPath, "utf-8"));
1914
2002
  }
1915
2003
  try {
1916
- const compiled = Handlebars.compile(fs7.readFileSync(documentPath, "utf-8"));
2004
+ const compiled = Handlebars.compile(fs9.readFileSync(documentPath, "utf-8"));
1917
2005
  return compiled(context);
1918
2006
  } catch (error2) {
1919
2007
  throw new TemplateError(`Handlebars render error: ${error2 instanceof Error ? error2.message : String(error2)}`);
@@ -1921,8 +2009,8 @@ function renderHandlebarsComposable(templateDir, context) {
1921
2009
  }
1922
2010
 
1923
2011
  // src/templates/liquid.ts
1924
- import * as fs8 from "fs";
1925
- import * as path7 from "path";
2012
+ import * as fs10 from "fs";
2013
+ import * as path9 from "path";
1926
2014
  import { Liquid } from "liquidjs";
1927
2015
  function createLiquidEngine(root) {
1928
2016
  return new Liquid({
@@ -1940,15 +2028,15 @@ function renderLiquid(template, context) {
1940
2028
  }
1941
2029
  }
1942
2030
  function renderLiquidFile(filePath, context) {
1943
- if (!fs8.existsSync(filePath)) {
2031
+ if (!fs10.existsSync(filePath)) {
1944
2032
  throw new TemplateError(`Template file not found: ${filePath}`);
1945
2033
  }
1946
- const template = fs8.readFileSync(filePath, "utf-8");
2034
+ const template = fs10.readFileSync(filePath, "utf-8");
1947
2035
  return renderLiquid(template, context);
1948
2036
  }
1949
2037
  function renderLiquidComposable(templateDir, context) {
1950
- const documentPath = path7.join(templateDir, "document.liquid");
1951
- if (!fs8.existsSync(documentPath)) {
2038
+ const documentPath = path9.join(templateDir, "document.liquid");
2039
+ if (!fs10.existsSync(documentPath)) {
1952
2040
  throw new TemplateError(`Document template not found: ${documentPath}`);
1953
2041
  }
1954
2042
  const engine = createLiquidEngine(templateDir);
@@ -1960,10 +2048,10 @@ function renderLiquidComposable(templateDir, context) {
1960
2048
  }
1961
2049
 
1962
2050
  // src/templates/loader.ts
1963
- import * as fs9 from "fs";
1964
- import * as path8 from "path";
2051
+ import * as fs11 from "fs";
2052
+ import * as path10 from "path";
1965
2053
  function getEngineFromFile(filePath) {
1966
- const ext = path8.extname(filePath).toLowerCase();
2054
+ const ext = path10.extname(filePath).toLowerCase();
1967
2055
  switch (ext) {
1968
2056
  case ".liquid":
1969
2057
  return "liquid";
@@ -1997,10 +2085,10 @@ function getRenderFileFn(engine) {
1997
2085
  }
1998
2086
  }
1999
2087
  function detectTemplateMode(templatePath) {
2000
- if (!fs9.existsSync(templatePath)) {
2088
+ if (!fs11.existsSync(templatePath)) {
2001
2089
  throw new TemplateError(`Template path not found: ${templatePath}`);
2002
2090
  }
2003
- const stat = fs9.statSync(templatePath);
2091
+ const stat = fs11.statSync(templatePath);
2004
2092
  if (stat.isFile()) {
2005
2093
  return "single";
2006
2094
  }
@@ -2018,7 +2106,7 @@ function renderSingleFile(templatePath, context, engine) {
2018
2106
  };
2019
2107
  }
2020
2108
  function renderComposable(templateDir, context, engine) {
2021
- const files = fs9.readdirSync(templateDir);
2109
+ const files = fs11.readdirSync(templateDir);
2022
2110
  const engineMap = {
2023
2111
  liquid: { document: "document.liquid", version: "version.liquid", entry: "entry.liquid" },
2024
2112
  handlebars: { document: "document.hbs", version: "version.hbs", entry: "entry.hbs" },
@@ -2041,15 +2129,15 @@ function renderComposable(templateDir, context, engine) {
2041
2129
  return { content: renderHandlebarsComposable(templateDir, context), engine: resolvedEngine };
2042
2130
  }
2043
2131
  const expectedFiles = engineMap[resolvedEngine];
2044
- const documentPath = path8.join(templateDir, expectedFiles.document);
2045
- if (!fs9.existsSync(documentPath)) {
2132
+ const documentPath = path10.join(templateDir, expectedFiles.document);
2133
+ if (!fs11.existsSync(documentPath)) {
2046
2134
  throw new TemplateError(`Document template not found: ${expectedFiles.document}`);
2047
2135
  }
2048
- const versionPath = path8.join(templateDir, expectedFiles.version);
2049
- const entryPath = path8.join(templateDir, expectedFiles.entry);
2136
+ const versionPath = path10.join(templateDir, expectedFiles.version);
2137
+ const entryPath = path10.join(templateDir, expectedFiles.entry);
2050
2138
  const render = getRenderFn(resolvedEngine);
2051
- const entryTemplate = fs9.existsSync(entryPath) ? fs9.readFileSync(entryPath, "utf-8") : null;
2052
- const versionTemplate = fs9.existsSync(versionPath) ? fs9.readFileSync(versionPath, "utf-8") : null;
2139
+ const entryTemplate = fs11.existsSync(entryPath) ? fs11.readFileSync(entryPath, "utf-8") : null;
2140
+ const versionTemplate = fs11.existsSync(versionPath) ? fs11.readFileSync(versionPath, "utf-8") : null;
2053
2141
  if (entryTemplate && versionTemplate) {
2054
2142
  const versionsWithEntries = context.versions.map((versionCtx) => {
2055
2143
  const entries = versionCtx.entries.map((entry) => {
@@ -2060,7 +2148,7 @@ function renderComposable(templateDir, context, engine) {
2060
2148
  });
2061
2149
  const docContext = { ...context, renderedVersions: versionsWithEntries };
2062
2150
  return {
2063
- content: render(fs9.readFileSync(documentPath, "utf-8"), docContext),
2151
+ content: render(fs11.readFileSync(documentPath, "utf-8"), docContext),
2064
2152
  engine: resolvedEngine
2065
2153
  };
2066
2154
  }
@@ -2306,17 +2394,17 @@ function getBuiltinTemplatePath(style) {
2306
2394
  let packageRoot;
2307
2395
  try {
2308
2396
  const currentUrl = import.meta.url;
2309
- packageRoot = path9.dirname(new URL(currentUrl).pathname);
2310
- packageRoot = path9.join(packageRoot, "..", "..");
2397
+ packageRoot = path11.dirname(new URL(currentUrl).pathname);
2398
+ packageRoot = path11.join(packageRoot, "..", "..");
2311
2399
  } catch {
2312
2400
  packageRoot = __dirname;
2313
2401
  }
2314
- return path9.join(packageRoot, "templates", style);
2402
+ return path11.join(packageRoot, "templates", style);
2315
2403
  }
2316
2404
  async function generateWithTemplate(contexts, templatesConfig, outputPath, repoUrl, dryRun) {
2317
2405
  let templatePath;
2318
2406
  if (templatesConfig?.path) {
2319
- templatePath = path9.resolve(templatesConfig.path);
2407
+ templatePath = path11.resolve(templatesConfig.path);
2320
2408
  } else {
2321
2409
  templatePath = getBuiltinTemplatePath("keep-a-changelog");
2322
2410
  }
@@ -2331,11 +2419,11 @@ async function generateWithTemplate(contexts, templatesConfig, outputPath, repoU
2331
2419
  process.stdout.write(result.content);
2332
2420
  return;
2333
2421
  }
2334
- const dir = path9.dirname(outputPath);
2335
- if (!fs10.existsSync(dir)) {
2336
- fs10.mkdirSync(dir, { recursive: true });
2422
+ const dir = path11.dirname(outputPath);
2423
+ if (!fs12.existsSync(dir)) {
2424
+ fs12.mkdirSync(dir, { recursive: true });
2337
2425
  }
2338
- fs10.writeFileSync(outputPath, result.content, "utf-8");
2426
+ fs12.writeFileSync(outputPath, result.content, "utf-8");
2339
2427
  const label = /changelog/i.test(outputPath) ? "Changelog" : "Release notes";
2340
2428
  success(`${label} written to ${outputPath} (using ${result.engine} template)`);
2341
2429
  }
@@ -2343,7 +2431,7 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
2343
2431
  debug(`Processing ${input.packages.length} package(s)`);
2344
2432
  let contexts = input.packages.map(createTemplateContext);
2345
2433
  const changelogConfig = config.changelog === false ? false : { mode: "root", ...config.changelog ?? {} };
2346
- const releaseNotesConfig = config.releaseNotes === false || config.releaseNotes === void 0 ? void 0 : config.releaseNotes.mode !== void 0 || config.releaseNotes.file !== void 0 ? { mode: "root", ...config.releaseNotes } : config.releaseNotes;
2434
+ const releaseNotesConfig = config.releaseNotes === false || config.releaseNotes === void 0 ? void 0 : config.releaseNotes;
2347
2435
  const llmConfig = releaseNotesConfig?.llm;
2348
2436
  if (llmConfig && !process.env.CHANGELOG_NO_LLM && !pipelineOptions?.skipReleaseNotes) {
2349
2437
  info("Processing with LLM enhancement");
@@ -2431,34 +2519,23 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
2431
2519
  warn(`Failed to write changelog: ${error2 instanceof Error ? error2.message : String(error2)}`);
2432
2520
  }
2433
2521
  }
2434
- if (!pipelineOptions?.skipReleaseNotes && releaseNotesConfig?.mode) {
2435
- const fileName = releaseNotesConfig.file ?? "RELEASE_NOTES.md";
2436
- const mode = releaseNotesConfig.mode;
2437
- info(`Generating release notes \u2192 ${fileName}`);
2522
+ if (!pipelineOptions?.skipReleaseNotes && releaseNotesConfig?.file?.dir) {
2523
+ const dir = releaseNotesConfig.file.dir;
2524
+ info(`Generating release notes \u2192 ${dir}`);
2438
2525
  try {
2439
- if (mode === "root" || mode === "both") {
2526
+ const { detectMonorepo } = await import("./aggregator-GXJXPM7O.js");
2527
+ const nested = detectMonorepo(process.cwd()).isMonorepo || contexts.length > 1;
2528
+ const renderContent = (ctx) => {
2440
2529
  if (releaseNotesConfig.templates?.path) {
2441
- await generateWithTemplate(
2442
- contexts,
2443
- releaseNotesConfig.templates,
2444
- fileName,
2445
- contexts[0]?.repoUrl ?? void 0,
2446
- dryRun
2447
- );
2448
- } else {
2449
- writeMarkdown(fileName, contexts, config, dryRun, fmtOpts);
2530
+ const templatePath = path11.resolve(releaseNotesConfig.templates.path);
2531
+ const docCtx = { ...createDocumentContext([ctx], void 0), perPackage: true };
2532
+ return renderTemplate(templatePath, docCtx, releaseNotesConfig.templates.engine).content;
2450
2533
  }
2451
- if (!dryRun) files.push(fileName);
2452
- }
2453
- if (mode === "packages" || mode === "both") {
2454
- const monoFiles = await writeMonorepoFiles(
2455
- contexts,
2456
- config,
2457
- dryRun,
2458
- releaseNotesConfig.file ?? "RELEASE_NOTES.md"
2459
- );
2460
- files.push(...monoFiles);
2461
- }
2534
+ if (ctx.enhanced?.releaseNotes) return ctx.enhanced.releaseNotes;
2535
+ return formatVersion(ctx, fmtOpts);
2536
+ };
2537
+ const versionedFiles = writeVersionedNotes(contexts, dir, dryRun, nested, renderContent);
2538
+ files.push(...versionedFiles);
2462
2539
  } catch (error2) {
2463
2540
  warn(`Failed to write release notes: ${error2 instanceof Error ? error2.message : String(error2)}`);
2464
2541
  }
@@ -2475,7 +2552,7 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
2475
2552
  } else if (releaseNotesConfig) {
2476
2553
  if (releaseNotesConfig.templates?.path) {
2477
2554
  try {
2478
- const templatePath = path9.resolve(releaseNotesConfig.templates.path);
2555
+ const templatePath = path11.resolve(releaseNotesConfig.templates.path);
2479
2556
  const docCtx = { ...createDocumentContext([ctx], void 0), perPackage: true };
2480
2557
  const rendered = renderTemplate(
2481
2558
  templatePath,
@@ -2527,14 +2604,14 @@ async function writeMonorepoFiles(contexts, config, dryRun, fileName) {
2527
2604
  }
2528
2605
 
2529
2606
  // src/command.ts
2530
- import * as fs11 from "fs";
2607
+ import * as fs13 from "fs";
2531
2608
  import * as readline from "readline";
2532
2609
  import { Command } from "commander";
2533
2610
  function createNotesCommand() {
2534
2611
  const cmd = new Command("notes").description(
2535
2612
  "Generate changelogs with LLM-powered enhancement and flexible templating"
2536
2613
  );
2537
- 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-mode <mode>", "Enable release notes and set location (root|packages|both)").option("--release-notes-file <name>", "Release notes file name override").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) => {
2614
+ 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) => {
2538
2615
  setVerbosity(options.verbose);
2539
2616
  if (options.quiet) setQuietMode(true);
2540
2617
  try {
@@ -2556,13 +2633,11 @@ function createNotesCommand() {
2556
2633
  }
2557
2634
  if (options.releaseNotes === false) {
2558
2635
  config.releaseNotes = false;
2559
- } else if (options.releaseNotesMode || options.releaseNotesFile) {
2636
+ } else if (options.releaseNotesDir) {
2560
2637
  const existing = config.releaseNotes !== false ? config.releaseNotes ?? {} : {};
2561
- const mode = options.releaseNotesMode ?? existing.mode ?? "root";
2562
2638
  config.releaseNotes = {
2563
2639
  ...existing,
2564
- mode,
2565
- ...options.releaseNotesFile ? { file: options.releaseNotesFile } : {}
2640
+ file: { dir: options.releaseNotesDir }
2566
2641
  };
2567
2642
  }
2568
2643
  if (config.changelog === false && (options.template || options.engine)) {
@@ -2630,7 +2705,7 @@ function createNotesCommand() {
2630
2705
  }
2631
2706
  let inputJson;
2632
2707
  if (options.input) {
2633
- inputJson = fs11.readFileSync(options.input, "utf-8");
2708
+ inputJson = fs13.readFileSync(options.input, "utf-8");
2634
2709
  } else {
2635
2710
  inputJson = await readStdin();
2636
2711
  }
@@ -2650,9 +2725,6 @@ function createNotesCommand() {
2650
2725
  if (config.changelog !== false && !options.changelogMode) {
2651
2726
  config.changelog = { ...config.changelog ?? {}, mode: monoMode };
2652
2727
  }
2653
- if (config.releaseNotes !== false && config.releaseNotes !== void 0 && !options.releaseNotesMode) {
2654
- config.releaseNotes = { ...config.releaseNotes, mode: monoMode };
2655
- }
2656
2728
  }
2657
2729
  await runPipeline(input, config, options.dryRun ?? false);
2658
2730
  if (options.dryRun) {