@releasekit/notes 0.26.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,159 +57,154 @@ function parseJsonc(content) {
54
57
  return result;
55
58
  }
56
59
  var GitConfigSchema = z.object({
57
- remote: z.string().default("origin"),
58
- branch: z.string().default("main"),
59
- pushMethod: z.enum(["auto", "ssh", "https"]).default("auto"),
60
- /**
61
- * 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")
81
84
  });
82
85
  var VersionGroupSchema = z.object({
83
- /**
84
- * Package patterns (exact names, `@scope/*`, or globs) whose matched packages form this group.
85
- * The same matching rules as `version.packages` apply.
86
- */
87
- packages: z.array(z.string()).min(1),
88
- /** `fixed`: all members release together at the group version. `linked`: only changed members
89
- * release, all at the same version. See the version.groups reference for the full semantics. */
90
- sync: z.enum(["fixed", "linked"])
86
+ packages: z.array(z.string()).min(1).describe(
87
+ "Package patterns (exact names, @scope/*, or globs) whose matched packages form this group. Same matching rules as version.packages."
88
+ ),
89
+ sync: z.enum(["fixed", "linked"]).describe(
90
+ "fixed: all members release together at the shared group version. linked: only changed members release, all at the same computed version."
91
+ )
91
92
  });
92
93
  var VersionConfigSchema = z.object({
93
- tagTemplate: z.string().default("v{version}"),
94
- /**
95
- * Optional secondary tag template for an internal "baseline" marker that records the
96
- * release commit on the source branch. Use this when `tagTemplate` resolves to a tag that
97
- * gets force-moved off the source branch by a downstream step (for example, a GitHub
98
- * Action distributing built artifacts at the version tag) — the baseline tag stays on the
99
- * release commit so version-bump and changelog calculations can still find the previous
100
- * release in the working branch's history.
101
- *
102
- * Supports `${packageName}`, `${prefix}`, `${version}` substitutions. Leave unset for
103
- * single-tag workflows (the default).
104
- */
105
- baselineTagTemplate: z.string().refine((tpl) => tpl.includes("${version}"), {
94
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: intentional template-placeholder syntax
95
+ tagTemplate: z.string().default("${prefix}${version}").describe(
96
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: documenting placeholder syntax to the user
97
+ "Template for Git tags. Available variables: ${version} (version number), ${prefix} (versionPrefix value, e.g. 'v'), ${packageName} (sanitized package name, e.g. 'scope-pkg'). Example: \"${packageName}-${prefix}${version}\" produces \"scope-pkg-v1.2.3\"."
98
+ ),
99
+ baselineTagTemplate: z.string().regex(/.*\$\{version\}.*/, {
106
100
  message: (
107
101
  // biome-ignore lint/suspicious/noTemplateCurlyInString: documenting the expected placeholder syntax to the user
108
102
  'baselineTagTemplate must contain a ${version} placeholder so the prefix can be derived (e.g. "release/${prefix}${version}").'
109
103
  )
110
- }).optional(),
111
- packageSpecificTags: z.boolean().default(false),
112
- preset: z.string().default("conventional"),
113
- /**
114
- * Global lockstep versioning. `true` is sugar for one implicit `fixed` group of every package
115
- * (all packages version together) — it shares the exact same mechanism as `version.groups`.
116
- * When `version.groups` is set, `sync` should be `false`; an explicit `sync: true` alongside
117
- * groups is treated as the implicit all-packages fixed group taking precedence and is reported
118
- * as a config conflict.
119
- */
120
- sync: z.boolean().default(true),
121
- /**
122
- * Named version groups, each binding a set of package patterns to a `fixed` or `linked` sync
123
- * mode. Packages not matched by any group version independently (per-package). A package may
124
- * belong to at most one group; overlapping patterns that assign a package to two groups are a
125
- * config error. See the `version.groups` reference for fixed vs linked semantics.
126
- */
127
- groups: z.record(z.string(), VersionGroupSchema).optional(),
128
- packages: z.array(z.string()).default([]),
129
- mainPackage: z.string().optional(),
130
- updateInternalDependencies: z.enum(["major", "minor", "patch", "no-internal-update"]).default("minor"),
131
- skip: z.array(z.string()).optional(),
132
- commitMessage: z.string().optional(),
133
- versionStrategy: z.enum(["branchPattern", "commitMessage"]).default("commitMessage"),
134
- branchPatterns: z.array(BranchPatternSchema).optional(),
135
- defaultReleaseType: z.enum(["major", "minor", "patch", "prerelease"]).optional(),
136
- mismatchStrategy: z.enum(["error", "warn", "ignore", "prefer-package", "prefer-git"]).default("warn"),
137
- versionPrefix: z.string().default(""),
138
- prereleaseIdentifier: z.string().optional(),
139
- strictReachable: z.boolean().default(false),
140
- /** Pre-1.0 inferred-breaking bump policy ('spec' | 'strict'). See docs/configuration.md#versionzeromajor. */
141
- zeroMajor: z.enum(["spec", "strict"]).default("spec"),
142
- cargo: VersionCargoConfigSchema.optional()
104
+ }).optional().describe(
105
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: documenting placeholder syntax to the user
106
+ 'Optional secondary tag template for an internal \'baseline\' marker that records the release commit on the source branch. Use this when tagTemplate resolves to a tag that gets force-moved off the source branch by a downstream step (e.g. a GitHub Action distributing built artifacts at the version tag) \u2014 the baseline tag stays on the release commit so future version-bump and changelog calculations can still find the previous release. Must contain a ${version} placeholder so the baseline prefix can be derived. Supports the same variables as tagTemplate. Example: "release/${prefix}${version}" produces "release/v1.2.3".'
107
+ ),
108
+ packageSpecificTags: z.boolean().default(false).describe("Enable package-specific tagging"),
109
+ preset: z.string().default("conventional").describe("Commit convention preset"),
110
+ sync: z.boolean().default(true).describe(
111
+ "Global lockstep versioning. true is sugar for one implicit fixed group of every package \u2014 it shares the same mechanism as version.groups. Set to false when using version.groups; sync: true alongside groups is treated as the implicit all-packages fixed group taking precedence (a config conflict, warned about at runtime)."
112
+ ),
113
+ groups: z.record(z.string(), VersionGroupSchema).optional().describe(
114
+ "Named version groups. Each group binds a set of package patterns to a fixed or linked sync mode. fixed: any releasable change in any member releases ALL members at the shared group version (bump(max(member baselines))). linked: only members with releasable changes release, but every releasing member shares the same computed version. Packages not matched by any group version independently. A package may belong to at most one group. Set version.sync to false when using groups."
115
+ ),
116
+ packages: z.array(z.string()).default([]).describe("Packages to include in versioning"),
117
+ mainPackage: z.string().optional().describe("Package to use for version determination"),
118
+ updateInternalDependencies: z.enum(["major", "minor", "patch", "no-internal-update"]).default("minor").describe("How to bump internal dependencies"),
119
+ skip: z.array(z.string()).optional().describe("Packages to exclude from versioning"),
120
+ commitMessage: z.string().optional().describe("Template for release commit messages"),
121
+ versionStrategy: z.enum(["branchPattern", "commitMessage"]).default("commitMessage").describe("Strategy for determining version bumps"),
122
+ branchPatterns: z.array(BranchPatternSchema).optional().describe("Branch name patterns for version determination"),
123
+ defaultReleaseType: z.enum(["major", "minor", "patch", "prerelease"]).optional().describe("Default release type when no pattern matches"),
124
+ mismatchStrategy: z.enum(["error", "warn", "ignore", "prefer-package", "prefer-git"]).default("warn").describe("How to handle version mismatches"),
125
+ versionPrefix: z.string().default("").describe("Prefix for version tags"),
126
+ prereleaseIdentifier: z.string().optional().describe("Identifier for prerelease versions (e.g., 'alpha', 'beta')"),
127
+ strictReachable: z.boolean().default(false).describe("Only use reachable tags"),
128
+ zeroMajor: z.enum(["spec", "strict"]).default("spec").describe(
129
+ "Pre-1.0 handling of commit-inferred breaking changes. 'spec' (default): bump the 0.x minor (0.24.0 \u2192 0.25.0), per semver \xA74. 'strict': bump the next major (\u2192 1.0.0). Inferred path only \u2014 explicit overrides (--bump major, bump:major) always graduate to 1.0.0."
130
+ ),
131
+ cargo: VersionCargoConfigSchema.optional().describe("Cargo/Rust configuration"),
132
+ pub: VersionPubConfigSchema.optional().describe("Dart/Flutter pub configuration")
143
133
  });
144
134
  var NpmConfigSchema = z.object({
145
- enabled: z.boolean().default(true),
146
- auth: z.enum(["auto", "oidc", "token"]).default("auto"),
147
- provenance: z.boolean().default(true),
148
- access: z.enum(["public", "restricted"]).default("public"),
149
- registry: z.string().default("https://registry.npmjs.org"),
150
- copyFiles: z.array(z.string()).default(["LICENSE"]),
151
- tag: z.string().default("latest")
135
+ enabled: z.boolean().default(true).describe("Enable NPM publishing"),
136
+ auth: z.enum(["auto", "oidc", "token"]).default("auto").describe("Authentication method"),
137
+ provenance: z.boolean().default(true).describe("Enable npm provenance attestation"),
138
+ access: z.enum(["public", "restricted"]).default("public").describe("Package access level"),
139
+ registry: z.string().default("https://registry.npmjs.org").describe("NPM registry URL"),
140
+ copyFiles: z.array(z.string()).default(["LICENSE"]).describe("Files to copy to package before publishing"),
141
+ tag: z.string().default("latest").describe("NPM dist tag")
152
142
  });
153
143
  var CargoPublishConfigSchema = z.object({
154
- enabled: z.boolean().default(false),
155
- noVerify: z.boolean().default(false),
156
- publishOrder: z.array(z.string()).default([]),
157
- clean: z.boolean().default(false)
144
+ enabled: z.boolean().default(false).describe("Enable Cargo publishing"),
145
+ noVerify: z.boolean().default(false).describe("Skip verification before publish"),
146
+ publishOrder: z.array(z.string()).default([]).describe("Order in which to publish packages"),
147
+ clean: z.boolean().default(false).describe("Clean before publishing")
148
+ });
149
+ var PubPublishConfigSchema = z.object({
150
+ enabled: z.boolean().default(false).describe("Enable pub.dev publishing"),
151
+ publishOrder: z.array(z.string()).default([]).describe("Order in which to publish packages")
158
152
  });
159
153
  var PublishGitConfigSchema = z.object({
160
- push: z.boolean().default(true),
161
- pushMethod: z.enum(["auto", "ssh", "https"]).optional(),
162
- remote: z.string().optional(),
163
- branch: z.string().optional(),
164
- httpsTokenEnv: z.string().optional(),
165
- skipHooks: z.boolean().optional()
154
+ push: z.boolean().default(true).describe("Push tags and commits to remote"),
155
+ pushMethod: z.enum(["auto", "ssh", "https"]).optional().describe("Push method override"),
156
+ remote: z.string().optional().describe("Remote name override"),
157
+ branch: z.string().optional().describe("Branch name override"),
158
+ httpsTokenEnv: z.string().optional().describe("Environment variable name containing a GitHub token for HTTPS pushes"),
159
+ skipHooks: z.boolean().optional().describe("Skip Git hooks when committing")
166
160
  });
167
161
  var GitHubReleaseConfigSchema = z.object({
168
- enabled: z.boolean().default(true),
169
- draft: z.boolean().default(true),
170
- perPackage: z.boolean().default(true),
171
- prerelease: z.union([z.literal("auto"), z.boolean()]).default("auto"),
172
- /**
173
- * Controls the source for the GitHub release body.
174
- * - 'auto': Use release notes if enabled, else changelog, else GitHub auto-generated.
175
- * - 'releaseNotes': Use LLM-generated release notes (requires notes.releaseNotes.enabled: true).
176
- * - 'changelog': Use formatted changelog entries.
177
- * - 'generated': Use GitHub's auto-generated notes.
178
- * - 'none': No body.
179
- */
180
- body: z.enum(["auto", "releaseNotes", "changelog", "generated", "none"]).default("auto"),
181
- /**
182
- * Template string for the GitHub release title when a package name is resolved.
183
- * Available variables: ${packageName} (original scoped name), ${version} (e.g. "v1.0.0").
184
- * Version-only tags (e.g. "v1.0.0") always use the tag as-is.
185
- */
162
+ enabled: z.boolean().default(true).describe("Enable GitHub releases"),
163
+ draft: z.boolean().default(true).describe("Create as draft release"),
164
+ perPackage: z.boolean().default(true).describe("Create separate release per package"),
165
+ prerelease: z.union([z.boolean(), z.literal("auto")]).default("auto").describe("Mark as prerelease"),
166
+ body: z.enum(["auto", "releaseNotes", "changelog", "generated", "none"]).default("auto").describe(
167
+ "Source for GitHub release body. 'auto': use release notes if enabled, else changelog, else GitHub auto. 'releaseNotes': use LLM-generated release notes. 'changelog': use changelog entries. 'generated': GitHub auto-generated. 'none': no body."
168
+ ),
186
169
  /* biome-ignore lint/suspicious/noTemplateCurlyInString: default template value */
187
- titleTemplate: z.string().default("${packageName}: ${version}"),
188
- /**
189
- * Package names to exclude from GitHub release creation. Tags are still created
190
- * (so changelog range detection still works on the next release) and npm publish
191
- * still runs — only the `gh release create` call is skipped for these packages.
192
- * Useful for internal/utility packages that shouldn't appear in the GitHub releases UI.
193
- */
194
- 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")
181
+ });
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")
195
187
  });
196
- var VerifyRegistryConfigSchema = z.object({
197
- enabled: z.boolean().default(true),
198
- maxAttempts: z.number().int().positive().default(5),
199
- initialDelay: z.number().int().positive().default(15e3),
200
- backoffMultiplier: z.number().positive().default(2)
188
+ var VerifyRegistryPubConfigSchema = z.object({
189
+ enabled: z.boolean().default(true).describe("Verify Dart pub publish"),
190
+ maxAttempts: z.number().int().positive().default(10).describe("Maximum verification attempts"),
191
+ initialDelay: z.number().int().positive().default(3e4).describe("Initial delay in milliseconds"),
192
+ backoffMultiplier: z.number().positive().default(2).describe("Exponential backoff multiplier")
201
193
  });
202
194
  var VerifyConfigSchema = z.object({
203
- npm: VerifyRegistryConfigSchema.default({
195
+ npm: VerifyRegistryNpmConfigSchema.default({
204
196
  enabled: true,
205
197
  maxAttempts: 5,
206
198
  initialDelay: 15e3,
207
199
  backoffMultiplier: 2
208
200
  }),
209
- cargo: VerifyRegistryConfigSchema.default({
201
+ cargo: VerifyRegistryCargoConfigSchema.default({
202
+ enabled: true,
203
+ maxAttempts: 10,
204
+ initialDelay: 3e4,
205
+ backoffMultiplier: 2
206
+ }),
207
+ pub: VerifyRegistryPubConfigSchema.default({
210
208
  enabled: true,
211
209
  maxAttempts: 10,
212
210
  initialDelay: 3e4,
@@ -214,7 +212,7 @@ var VerifyConfigSchema = z.object({
214
212
  })
215
213
  });
216
214
  var PublishConfigSchema = z.object({
217
- git: PublishGitConfigSchema.optional(),
215
+ git: PublishGitConfigSchema.optional().describe("Git publishing options"),
218
216
  npm: NpmConfigSchema.default({
219
217
  enabled: true,
220
218
  auth: "auto",
@@ -223,13 +221,17 @@ var PublishConfigSchema = z.object({
223
221
  registry: "https://registry.npmjs.org",
224
222
  copyFiles: ["LICENSE"],
225
223
  tag: "latest"
226
- }),
224
+ }).describe("NPM publishing configuration"),
227
225
  cargo: CargoPublishConfigSchema.default({
228
226
  enabled: false,
229
227
  noVerify: false,
230
228
  publishOrder: [],
231
229
  clean: false
232
- }),
230
+ }).describe("Cargo publishing configuration"),
231
+ pub: PubPublishConfigSchema.default({
232
+ enabled: false,
233
+ publishOrder: []
234
+ }).describe("Dart/Flutter publishing configuration via pub"),
233
235
  githubRelease: GitHubReleaseConfigSchema.default({
234
236
  enabled: true,
235
237
  draft: true,
@@ -239,7 +241,7 @@ var PublishConfigSchema = z.object({
239
241
  /* biome-ignore lint/suspicious/noTemplateCurlyInString: default template value */
240
242
  titleTemplate: "${packageName}: ${version}",
241
243
  skipPackages: []
242
- }),
244
+ }).describe("GitHub Release configuration"),
243
245
  verify: VerifyConfigSchema.default({
244
246
  npm: {
245
247
  enabled: true,
@@ -252,68 +254,89 @@ var PublishConfigSchema = z.object({
252
254
  maxAttempts: 10,
253
255
  initialDelay: 3e4,
254
256
  backoffMultiplier: 2
257
+ },
258
+ pub: {
259
+ enabled: true,
260
+ maxAttempts: 10,
261
+ initialDelay: 3e4,
262
+ backoffMultiplier: 2
255
263
  }
256
- })
264
+ }).describe("Registry verification configuration")
257
265
  });
258
266
  var TemplateConfigSchema = z.object({
259
- path: z.string().optional(),
260
- engine: z.enum(["handlebars", "liquid", "ejs"]).optional()
267
+ path: z.string().optional().describe("Path to custom template"),
268
+ engine: z.enum(["handlebars", "liquid", "ejs"]).optional().describe("Template engine")
261
269
  });
262
270
  var LocationModeSchema = z.enum(["root", "packages", "both"]);
263
- var ChangelogConfigSchema = z.object({
264
- mode: LocationModeSchema.optional(),
265
- file: z.string().optional(),
266
- templates: TemplateConfigSchema.optional()
271
+ var ReleaseNotesFileConfigSchema = z.object({
272
+ dir: z.string().default("release-notes").describe("Directory for the per-version release-notes files.")
267
273
  });
274
+ var ChangelogConfigSchema = z.object({
275
+ mode: LocationModeSchema.optional().describe(
276
+ "Where to write changelog files. root: repo root only. packages: per-package (monorepos). both: repo root and per-package. When omitted entirely (no changelog config), defaults to root."
277
+ ),
278
+ file: z.string().optional().describe("Changelog file name override (default: CHANGELOG.md)"),
279
+ templates: TemplateConfigSchema.optional().describe("Template configuration for changelog")
280
+ }).describe("Changelog file configuration");
268
281
  var LLMOptionsSchema = z.object({
269
- timeout: z.number().optional(),
270
- maxTokens: z.number().optional(),
271
- temperature: z.number().optional()
282
+ timeout: z.number().int().optional().describe("Request timeout in ms"),
283
+ maxTokens: z.number().int().optional().describe("Max tokens to generate"),
284
+ temperature: z.number().optional().describe("Sampling temperature")
272
285
  });
273
286
  var LLMRetryConfigSchema = z.object({
274
- maxAttempts: z.number().int().positive().optional(),
275
- initialDelay: z.number().nonnegative().optional(),
276
- maxDelay: z.number().positive().optional(),
277
- 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")
278
295
  });
279
296
  var LLMTasksConfigSchema = z.object({
280
- summarize: z.boolean().optional(),
281
- enhance: z.boolean().optional(),
282
- categorize: z.boolean().optional(),
283
- releaseNotes: z.boolean().optional()
297
+ summarize: z.boolean().optional().describe("Enable summarization"),
298
+ enhance: z.boolean().optional().describe("Enable entry enhancement"),
299
+ categorize: z.boolean().optional().describe("Enable categorization"),
300
+ releaseNotes: z.boolean().optional().describe("Enable release note generation")
284
301
  });
285
302
  var LLMCategorySchema = z.object({
286
- name: z.string(),
287
- description: z.string(),
288
- scopes: z.array(z.string()).optional()
303
+ name: z.string().describe("Category label shown in release notes (e.g. 'Features')"),
304
+ description: z.string().describe("LLM instruction describing what commits belong in this category"),
305
+ scopes: z.array(z.string()).optional().describe("Conventional commit scopes assigned to this category")
289
306
  });
290
307
  var ScopeRulesSchema = z.object({
291
- allowed: z.array(z.string()).optional(),
292
- caseSensitive: z.boolean().default(false),
293
- invalidScopeAction: z.enum(["remove", "keep", "fallback"]).default("remove"),
294
- 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'")
295
314
  });
296
315
  var ScopeConfigSchema = z.object({
297
- mode: z.enum(["restricted", "packages", "none", "unrestricted"]).default("unrestricted"),
298
- 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")
299
320
  });
300
321
  var LLMPromptOverridesSchema = z.object({
301
- enhance: z.string().optional(),
302
- categorize: z.string().optional(),
303
- enhanceAndCategorize: z.string().optional(),
304
- summarize: z.string().optional(),
305
- releaseNotes: z.string().optional()
322
+ enhance: z.string().optional().describe("Instruction override for the enhance task"),
323
+ categorize: z.string().optional().describe("Instruction override for the categorize task"),
324
+ enhanceAndCategorize: z.string().optional().describe("Instruction override for the combined enhance + categorize task"),
325
+ summarize: z.string().optional().describe("Instruction override for the summarize task"),
326
+ releaseNotes: z.string().optional().describe("Instruction override for the release-notes task")
306
327
  });
307
328
  var LLMPromptsConfigSchema = z.object({
308
- instructions: LLMPromptOverridesSchema.optional()
329
+ instructions: LLMPromptOverridesSchema.optional().describe(
330
+ "Per-task instruction overrides appended to the built-in prompts."
331
+ )
309
332
  });
310
333
  var LLMConfigSchema = z.object({
311
- provider: z.string(),
312
- model: z.string(),
313
- baseURL: z.string().optional(),
314
- apiKey: z.string().optional(),
334
+ provider: z.string().describe("LLM provider"),
335
+ model: z.string().describe("Model identifier"),
336
+ baseURL: z.string().optional().describe("Custom API base URL"),
337
+ apiKey: z.string().optional().describe("API key"),
315
338
  options: LLMOptionsSchema.optional(),
316
- concurrency: z.number().int().positive().optional(),
339
+ concurrency: z.number().int().positive().optional().describe("Concurrent LLM requests"),
317
340
  retry: LLMRetryConfigSchema.optional(),
318
341
  tasks: LLMTasksConfigSchema.optional(),
319
342
  categories: z.array(LLMCategorySchema).default(() => [
@@ -325,82 +348,88 @@ var LLMConfigSchema = z.object({
325
348
  ]),
326
349
  style: z.string().default(
327
350
  'Write in past tense ("Added feature", not "Add feature"). Be concise and user-focused. Lead with the impact, not the implementation detail.'
328
- ),
351
+ ).describe("Writing style for LLM"),
329
352
  scopes: ScopeConfigSchema.optional(),
330
353
  prompts: LLMPromptsConfigSchema.optional(),
331
- examples: z.number().int().min(0).max(5).default(3),
354
+ examples: z.number().int().min(0).max(5).default(3).describe("Number of few-shot examples to include in LLM prompts (0\u20135)."),
332
355
  context: z.object({
333
- pullRequests: z.boolean().default(true)
334
- }).default({ pullRequests: true }),
335
- categoryOrder: z.array(z.string()).optional()
356
+ pullRequests: z.boolean().default(true).describe("Include linked pull request titles/bodies as context.")
357
+ }).default({ pullRequests: true }).describe("Additional context sources for the LLM."),
358
+ categoryOrder: z.array(z.string()).optional().describe(
359
+ "Explicit ordering of categories in the output. Categories not listed retain their configured order after the listed ones."
360
+ )
336
361
  });
337
362
  var ReleaseNotesConfigSchema = z.object({
338
- mode: LocationModeSchema.optional(),
339
- file: z.string().optional(),
340
- templates: TemplateConfigSchema.optional(),
341
- 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"),
342
370
  links: z.object({
343
- items: z.array(z.object({ label: z.string(), url: z.string().url() })).optional(),
344
- fromPRBodyMarker: z.string().optional(),
345
- title: z.string().optional()
346
- }).optional()
347
- });
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");
348
381
  var NotesInputConfigSchema = z.object({
349
382
  source: z.string().optional(),
350
383
  file: z.string().optional()
351
384
  });
352
385
  var NotesConfigSchema = z.object({
353
- changelog: z.union([z.literal(false), ChangelogConfigSchema]).optional(),
354
- releaseNotes: z.union([z.literal(false), ReleaseNotesConfigSchema]).optional(),
355
- updateStrategy: z.enum(["prepend", "regenerate"]).optional()
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
+ )
356
391
  });
357
392
  var CILabelsConfigSchema = z.object({
358
- stable: z.string().default("channel:stable"),
359
- prerelease: z.string().default("channel:prerelease"),
360
- skip: z.string().default("release:skip"),
361
- /** Bypass the standing PR for one merge — triggers a direct release. Standing-pr mode only. */
362
- immediate: z.string().default("release:immediate"),
363
- /** Retry a failed publish by re-applying it to a merged standing PR. Standing-pr mode only. */
364
- retry: z.string().default("release:retry"),
365
- major: z.string().default("bump:major"),
366
- minor: z.string().default("bump:minor"),
367
- 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")
368
401
  });
369
402
  var StandingPrConfigSchema = z.object({
370
- /** Branch name for the release PR. Default: 'release/next' */
371
- branch: z.string().default("release/next"),
372
- /**
373
- * Title template for the release PR. Variables: ${count} (publishable package count),
374
- * ${version} (raw version), ${tag} (version with tag prefix). Must start with 'chore: release'
375
- * to match default skip pattern on merge. When unset, the default depends on the versioning
376
- * strategy: 'chore: release ${tag}' in sync mode (the repo releases as one versioned unit),
377
- * 'chore: release ${count} package(s)' otherwise.
378
- */
379
- title: z.string().optional(),
380
- /** Labels to apply to the standing release PR */
381
- labels: z.array(z.string()).default(["release"]),
382
- /** Whether to auto-delete the release branch after PR merge. Default: true */
383
- deleteBranchOnMerge: z.boolean().default(true),
384
- /** Merge method to use when merging the standing release PR. Default: 'merge' */
385
- mergeMethod: z.enum(["merge", "squash", "rebase"]).default("merge"),
386
- /** Minimum age of the standing PR before it can be merged. Duration string (e.g. '6h', '30m', '1d'). Gate enforced via the releasekit/standing-pr status check. */
387
- minAge: z.string().optional(),
388
- /** Minimum number of packages with releasable changes required to create/maintain the standing PR. Below this threshold, the PR is closed and no new PR is created. */
389
- minPackages: z.number().int().positive().optional()
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
+ )
390
417
  });
391
418
  var CIConfigSchema = z.object({
392
- releaseStrategy: z.enum(["manual", "direct", "standing-pr"]).default("direct"),
393
- releaseTrigger: z.enum(["commit", "label"]).default("label"),
394
- prPreview: z.boolean().default(true),
395
- autoRelease: z.boolean().default(false),
396
- /**
397
- * Commit message prefixes that should not trigger a release.
398
- * Defaults to `['chore: release ']` to match the release commit template
399
- * (`chore: release ${packageName} v${version}`) and provide a
400
- * secondary loop-prevention guard alongside `[skip ci]`.
401
- */
402
- skipPatterns: z.array(z.string()).default(["chore: release "]),
403
- 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."),
404
433
  labels: CILabelsConfigSchema.default({
405
434
  stable: "channel:stable",
406
435
  prerelease: "channel:prerelease",
@@ -410,40 +439,36 @@ var CIConfigSchema = z.object({
410
439
  major: "bump:major",
411
440
  minor: "bump:minor",
412
441
  patch: "bump:patch"
413
- }),
414
- /**
415
- * Map of scope labels to package patterns.
416
- * When a PR has a label matching a key, only packages matching the corresponding pattern will be released.
417
- */
418
- scopeLabels: z.record(z.string(), z.string()).optional(),
419
- /** Configuration for the standing release PR feature. */
420
- 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
+ )
421
449
  });
422
450
  var ReleaseCIConfigSchema = z.object({
423
- skipPatterns: z.array(z.string().min(1)).optional(),
424
- minChanges: z.number().int().positive().optional(),
425
- /** Set to `false` to disable GitHub release creation in CI. */
426
- githubRelease: z.literal(false).optional(),
427
- /** Set to `false` to disable changelog generation in CI. */
428
- 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")
429
455
  });
430
456
  var ReleaseConfigSchema = z.object({
431
- /**
432
- * Optional steps to enable. The version step always runs; only 'notes' and
433
- * 'publish' can be opted out. Omitting a step is equivalent to --skip-<step>.
434
- */
435
- steps: z.array(z.enum(["notes", "publish"])).min(1).optional(),
436
- ci: ReleaseCIConfigSchema.optional()
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")
437
459
  });
438
460
  var ReleaseKitConfigSchema = z.object({
439
- git: GitConfigSchema.optional(),
440
- monorepo: MonorepoConfigSchema.optional(),
441
- version: VersionConfigSchema.optional(),
442
- publish: PublishConfigSchema.optional(),
443
- notes: NotesConfigSchema.optional(),
444
- ci: CIConfigSchema.optional(),
445
- release: ReleaseConfigSchema.optional()
446
- });
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");
447
472
  var MAX_INPUT_LENGTH = 1e4;
448
473
  function substituteVariables(value) {
449
474
  if (value.length > MAX_INPUT_LENGTH) {
@@ -517,6 +542,21 @@ function resolveConfigPath(cwd) {
517
542
  }
518
543
  return path3.join(cwd, CONFIG_FILES[0]);
519
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
+ }
520
560
  function loadConfigFile(configPath) {
521
561
  if (!fs3.existsSync(configPath)) {
522
562
  return {};
@@ -525,6 +565,7 @@ function loadConfigFile(configPath) {
525
565
  const content = fs3.readFileSync(configPath, "utf-8");
526
566
  const parsed = parseJsonc(content);
527
567
  const substituted = substituteInObject(parsed);
568
+ assertNoRemovedReleaseNotesFields(substituted);
528
569
  return ReleaseKitConfigSchema.parse(substituted);
529
570
  } catch (error2) {
530
571
  if (error2 instanceof z2.ZodError) {
@@ -606,7 +647,7 @@ function getExitCode(error2) {
606
647
  }
607
648
 
608
649
  // src/input/version-output.ts
609
- import * as fs4 from "fs";
650
+ import * as fs5 from "fs";
610
651
  function normalizeEntryType(type) {
611
652
  const typeMap = {
612
653
  added: "added",
@@ -663,7 +704,7 @@ function parseVersionOutput(json) {
663
704
  return versionOutputToChangelogInput(data);
664
705
  }
665
706
  function parseVersionOutputFile(filePath) {
666
- const content = fs4.readFileSync(filePath, "utf-8");
707
+ const content = fs5.readFileSync(filePath, "utf-8");
667
708
  return parseVersionOutput(content);
668
709
  }
669
710
  async function parseVersionOutputStdin() {
@@ -690,8 +731,8 @@ function getDefaultConfig() {
690
731
  }
691
732
 
692
733
  // src/core/pipeline.ts
693
- import * as fs10 from "fs";
694
- import * as path9 from "path";
734
+ import * as fs12 from "fs";
735
+ import * as path11 from "path";
695
736
 
696
737
  // src/llm/context/prFetcher.ts
697
738
  import { RequestError } from "@octokit/request-error";
@@ -805,9 +846,9 @@ var LLM_DEFAULTS = {
805
846
 
806
847
  // src/llm/examples/fetcher.ts
807
848
  import { createHash } from "crypto";
808
- import * as fs5 from "fs";
849
+ import * as fs6 from "fs";
809
850
  import * as os2 from "os";
810
- import * as path5 from "path";
851
+ import * as path6 from "path";
811
852
  import { RequestError as RequestError2 } from "@octokit/request-error";
812
853
  import { Octokit as Octokit2 } from "@octokit/rest";
813
854
 
@@ -863,16 +904,16 @@ ${blocks.join("\n")}
863
904
 
864
905
  // src/llm/examples/fetcher.ts
865
906
  function cacheDir() {
866
- return path5.join(os2.tmpdir(), "releasekit", "examples");
907
+ return path6.join(os2.tmpdir(), "releasekit", "examples");
867
908
  }
868
909
  function cacheKey(owner, repo, packageName) {
869
910
  const safe = packageName.replace(/[^a-zA-Z0-9-]/g, "_");
870
911
  const hash = createHash("sha256").update(packageName).digest("hex").slice(0, 8);
871
- return path5.join(cacheDir(), owner, repo, `${safe}_${hash}.json`);
912
+ return path6.join(cacheDir(), owner, repo, `${safe}_${hash}.json`);
872
913
  }
873
914
  function readCache(key, latestTag, count) {
874
915
  try {
875
- const raw = fs5.readFileSync(key, "utf-8");
916
+ const raw = fs6.readFileSync(key, "utf-8");
876
917
  const entry = JSON.parse(raw);
877
918
  if (entry.latestTag !== latestTag || entry.count < count) return null;
878
919
  return entry.examples;
@@ -882,8 +923,8 @@ function readCache(key, latestTag, count) {
882
923
  }
883
924
  function writeCache(key, latestTag, count, examples) {
884
925
  try {
885
- fs5.mkdirSync(path5.dirname(key), { recursive: true });
886
- 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");
887
928
  } catch {
888
929
  }
889
930
  }
@@ -1872,8 +1913,29 @@ function createProvider(config) {
1872
1913
  }
1873
1914
  }
1874
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
+
1875
1937
  // src/templates/ejs.ts
1876
- import * as fs6 from "fs";
1938
+ import * as fs8 from "fs";
1877
1939
  import ejs from "ejs";
1878
1940
  function renderEjs(template, context) {
1879
1941
  try {
@@ -1883,16 +1945,16 @@ function renderEjs(template, context) {
1883
1945
  }
1884
1946
  }
1885
1947
  function renderEjsFile(filePath, context) {
1886
- if (!fs6.existsSync(filePath)) {
1948
+ if (!fs8.existsSync(filePath)) {
1887
1949
  throw new TemplateError(`Template file not found: ${filePath}`);
1888
1950
  }
1889
- const template = fs6.readFileSync(filePath, "utf-8");
1951
+ const template = fs8.readFileSync(filePath, "utf-8");
1890
1952
  return renderEjs(template, context);
1891
1953
  }
1892
1954
 
1893
1955
  // src/templates/handlebars.ts
1894
- import * as fs7 from "fs";
1895
- import * as path6 from "path";
1956
+ import * as fs9 from "fs";
1957
+ import * as path8 from "path";
1896
1958
  import Handlebars from "handlebars";
1897
1959
  function registerHandlebarsHelpers() {
1898
1960
  Handlebars.registerHelper("capitalize", (str) => {
@@ -1918,28 +1980,28 @@ function renderHandlebars(template, context) {
1918
1980
  }
1919
1981
  }
1920
1982
  function renderHandlebarsFile(filePath, context) {
1921
- if (!fs7.existsSync(filePath)) {
1983
+ if (!fs9.existsSync(filePath)) {
1922
1984
  throw new TemplateError(`Template file not found: ${filePath}`);
1923
1985
  }
1924
- const template = fs7.readFileSync(filePath, "utf-8");
1986
+ const template = fs9.readFileSync(filePath, "utf-8");
1925
1987
  return renderHandlebars(template, context);
1926
1988
  }
1927
1989
  function renderHandlebarsComposable(templateDir, context) {
1928
1990
  registerHandlebarsHelpers();
1929
- const versionPath = path6.join(templateDir, "version.hbs");
1930
- const entryPath = path6.join(templateDir, "entry.hbs");
1931
- const documentPath = path6.join(templateDir, "document.hbs");
1932
- 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)) {
1933
1995
  throw new TemplateError(`Document template not found: ${documentPath}`);
1934
1996
  }
1935
- if (fs7.existsSync(versionPath)) {
1936
- Handlebars.registerPartial("version", fs7.readFileSync(versionPath, "utf-8"));
1997
+ if (fs9.existsSync(versionPath)) {
1998
+ Handlebars.registerPartial("version", fs9.readFileSync(versionPath, "utf-8"));
1937
1999
  }
1938
- if (fs7.existsSync(entryPath)) {
1939
- Handlebars.registerPartial("entry", fs7.readFileSync(entryPath, "utf-8"));
2000
+ if (fs9.existsSync(entryPath)) {
2001
+ Handlebars.registerPartial("entry", fs9.readFileSync(entryPath, "utf-8"));
1940
2002
  }
1941
2003
  try {
1942
- const compiled = Handlebars.compile(fs7.readFileSync(documentPath, "utf-8"));
2004
+ const compiled = Handlebars.compile(fs9.readFileSync(documentPath, "utf-8"));
1943
2005
  return compiled(context);
1944
2006
  } catch (error2) {
1945
2007
  throw new TemplateError(`Handlebars render error: ${error2 instanceof Error ? error2.message : String(error2)}`);
@@ -1947,8 +2009,8 @@ function renderHandlebarsComposable(templateDir, context) {
1947
2009
  }
1948
2010
 
1949
2011
  // src/templates/liquid.ts
1950
- import * as fs8 from "fs";
1951
- import * as path7 from "path";
2012
+ import * as fs10 from "fs";
2013
+ import * as path9 from "path";
1952
2014
  import { Liquid } from "liquidjs";
1953
2015
  function createLiquidEngine(root) {
1954
2016
  return new Liquid({
@@ -1966,15 +2028,15 @@ function renderLiquid(template, context) {
1966
2028
  }
1967
2029
  }
1968
2030
  function renderLiquidFile(filePath, context) {
1969
- if (!fs8.existsSync(filePath)) {
2031
+ if (!fs10.existsSync(filePath)) {
1970
2032
  throw new TemplateError(`Template file not found: ${filePath}`);
1971
2033
  }
1972
- const template = fs8.readFileSync(filePath, "utf-8");
2034
+ const template = fs10.readFileSync(filePath, "utf-8");
1973
2035
  return renderLiquid(template, context);
1974
2036
  }
1975
2037
  function renderLiquidComposable(templateDir, context) {
1976
- const documentPath = path7.join(templateDir, "document.liquid");
1977
- if (!fs8.existsSync(documentPath)) {
2038
+ const documentPath = path9.join(templateDir, "document.liquid");
2039
+ if (!fs10.existsSync(documentPath)) {
1978
2040
  throw new TemplateError(`Document template not found: ${documentPath}`);
1979
2041
  }
1980
2042
  const engine = createLiquidEngine(templateDir);
@@ -1986,10 +2048,10 @@ function renderLiquidComposable(templateDir, context) {
1986
2048
  }
1987
2049
 
1988
2050
  // src/templates/loader.ts
1989
- import * as fs9 from "fs";
1990
- import * as path8 from "path";
2051
+ import * as fs11 from "fs";
2052
+ import * as path10 from "path";
1991
2053
  function getEngineFromFile(filePath) {
1992
- const ext = path8.extname(filePath).toLowerCase();
2054
+ const ext = path10.extname(filePath).toLowerCase();
1993
2055
  switch (ext) {
1994
2056
  case ".liquid":
1995
2057
  return "liquid";
@@ -2023,10 +2085,10 @@ function getRenderFileFn(engine) {
2023
2085
  }
2024
2086
  }
2025
2087
  function detectTemplateMode(templatePath) {
2026
- if (!fs9.existsSync(templatePath)) {
2088
+ if (!fs11.existsSync(templatePath)) {
2027
2089
  throw new TemplateError(`Template path not found: ${templatePath}`);
2028
2090
  }
2029
- const stat = fs9.statSync(templatePath);
2091
+ const stat = fs11.statSync(templatePath);
2030
2092
  if (stat.isFile()) {
2031
2093
  return "single";
2032
2094
  }
@@ -2044,7 +2106,7 @@ function renderSingleFile(templatePath, context, engine) {
2044
2106
  };
2045
2107
  }
2046
2108
  function renderComposable(templateDir, context, engine) {
2047
- const files = fs9.readdirSync(templateDir);
2109
+ const files = fs11.readdirSync(templateDir);
2048
2110
  const engineMap = {
2049
2111
  liquid: { document: "document.liquid", version: "version.liquid", entry: "entry.liquid" },
2050
2112
  handlebars: { document: "document.hbs", version: "version.hbs", entry: "entry.hbs" },
@@ -2067,15 +2129,15 @@ function renderComposable(templateDir, context, engine) {
2067
2129
  return { content: renderHandlebarsComposable(templateDir, context), engine: resolvedEngine };
2068
2130
  }
2069
2131
  const expectedFiles = engineMap[resolvedEngine];
2070
- const documentPath = path8.join(templateDir, expectedFiles.document);
2071
- if (!fs9.existsSync(documentPath)) {
2132
+ const documentPath = path10.join(templateDir, expectedFiles.document);
2133
+ if (!fs11.existsSync(documentPath)) {
2072
2134
  throw new TemplateError(`Document template not found: ${expectedFiles.document}`);
2073
2135
  }
2074
- const versionPath = path8.join(templateDir, expectedFiles.version);
2075
- const entryPath = path8.join(templateDir, expectedFiles.entry);
2136
+ const versionPath = path10.join(templateDir, expectedFiles.version);
2137
+ const entryPath = path10.join(templateDir, expectedFiles.entry);
2076
2138
  const render = getRenderFn(resolvedEngine);
2077
- const entryTemplate = fs9.existsSync(entryPath) ? fs9.readFileSync(entryPath, "utf-8") : null;
2078
- 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;
2079
2141
  if (entryTemplate && versionTemplate) {
2080
2142
  const versionsWithEntries = context.versions.map((versionCtx) => {
2081
2143
  const entries = versionCtx.entries.map((entry) => {
@@ -2086,7 +2148,7 @@ function renderComposable(templateDir, context, engine) {
2086
2148
  });
2087
2149
  const docContext = { ...context, renderedVersions: versionsWithEntries };
2088
2150
  return {
2089
- content: render(fs9.readFileSync(documentPath, "utf-8"), docContext),
2151
+ content: render(fs11.readFileSync(documentPath, "utf-8"), docContext),
2090
2152
  engine: resolvedEngine
2091
2153
  };
2092
2154
  }
@@ -2332,17 +2394,17 @@ function getBuiltinTemplatePath(style) {
2332
2394
  let packageRoot;
2333
2395
  try {
2334
2396
  const currentUrl = import.meta.url;
2335
- packageRoot = path9.dirname(new URL(currentUrl).pathname);
2336
- packageRoot = path9.join(packageRoot, "..", "..");
2397
+ packageRoot = path11.dirname(new URL(currentUrl).pathname);
2398
+ packageRoot = path11.join(packageRoot, "..", "..");
2337
2399
  } catch {
2338
2400
  packageRoot = __dirname;
2339
2401
  }
2340
- return path9.join(packageRoot, "templates", style);
2402
+ return path11.join(packageRoot, "templates", style);
2341
2403
  }
2342
2404
  async function generateWithTemplate(contexts, templatesConfig, outputPath, repoUrl, dryRun) {
2343
2405
  let templatePath;
2344
2406
  if (templatesConfig?.path) {
2345
- templatePath = path9.resolve(templatesConfig.path);
2407
+ templatePath = path11.resolve(templatesConfig.path);
2346
2408
  } else {
2347
2409
  templatePath = getBuiltinTemplatePath("keep-a-changelog");
2348
2410
  }
@@ -2357,11 +2419,11 @@ async function generateWithTemplate(contexts, templatesConfig, outputPath, repoU
2357
2419
  process.stdout.write(result.content);
2358
2420
  return;
2359
2421
  }
2360
- const dir = path9.dirname(outputPath);
2361
- if (!fs10.existsSync(dir)) {
2362
- fs10.mkdirSync(dir, { recursive: true });
2422
+ const dir = path11.dirname(outputPath);
2423
+ if (!fs12.existsSync(dir)) {
2424
+ fs12.mkdirSync(dir, { recursive: true });
2363
2425
  }
2364
- fs10.writeFileSync(outputPath, result.content, "utf-8");
2426
+ fs12.writeFileSync(outputPath, result.content, "utf-8");
2365
2427
  const label = /changelog/i.test(outputPath) ? "Changelog" : "Release notes";
2366
2428
  success(`${label} written to ${outputPath} (using ${result.engine} template)`);
2367
2429
  }
@@ -2369,7 +2431,7 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
2369
2431
  debug(`Processing ${input.packages.length} package(s)`);
2370
2432
  let contexts = input.packages.map(createTemplateContext);
2371
2433
  const changelogConfig = config.changelog === false ? false : { mode: "root", ...config.changelog ?? {} };
2372
- 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;
2373
2435
  const llmConfig = releaseNotesConfig?.llm;
2374
2436
  if (llmConfig && !process.env.CHANGELOG_NO_LLM && !pipelineOptions?.skipReleaseNotes) {
2375
2437
  info("Processing with LLM enhancement");
@@ -2457,34 +2519,23 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
2457
2519
  warn(`Failed to write changelog: ${error2 instanceof Error ? error2.message : String(error2)}`);
2458
2520
  }
2459
2521
  }
2460
- if (!pipelineOptions?.skipReleaseNotes && releaseNotesConfig?.mode) {
2461
- const fileName = releaseNotesConfig.file ?? "RELEASE_NOTES.md";
2462
- const mode = releaseNotesConfig.mode;
2463
- 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}`);
2464
2525
  try {
2465
- 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) => {
2466
2529
  if (releaseNotesConfig.templates?.path) {
2467
- await generateWithTemplate(
2468
- contexts,
2469
- releaseNotesConfig.templates,
2470
- fileName,
2471
- contexts[0]?.repoUrl ?? void 0,
2472
- dryRun
2473
- );
2474
- } else {
2475
- 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;
2476
2533
  }
2477
- if (!dryRun) files.push(fileName);
2478
- }
2479
- if (mode === "packages" || mode === "both") {
2480
- const monoFiles = await writeMonorepoFiles(
2481
- contexts,
2482
- config,
2483
- dryRun,
2484
- releaseNotesConfig.file ?? "RELEASE_NOTES.md"
2485
- );
2486
- files.push(...monoFiles);
2487
- }
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);
2488
2539
  } catch (error2) {
2489
2540
  warn(`Failed to write release notes: ${error2 instanceof Error ? error2.message : String(error2)}`);
2490
2541
  }
@@ -2501,7 +2552,7 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
2501
2552
  } else if (releaseNotesConfig) {
2502
2553
  if (releaseNotesConfig.templates?.path) {
2503
2554
  try {
2504
- const templatePath = path9.resolve(releaseNotesConfig.templates.path);
2555
+ const templatePath = path11.resolve(releaseNotesConfig.templates.path);
2505
2556
  const docCtx = { ...createDocumentContext([ctx], void 0), perPackage: true };
2506
2557
  const rendered = renderTemplate(
2507
2558
  templatePath,
@@ -2553,14 +2604,14 @@ async function writeMonorepoFiles(contexts, config, dryRun, fileName) {
2553
2604
  }
2554
2605
 
2555
2606
  // src/command.ts
2556
- import * as fs11 from "fs";
2607
+ import * as fs13 from "fs";
2557
2608
  import * as readline from "readline";
2558
2609
  import { Command } from "commander";
2559
2610
  function createNotesCommand() {
2560
2611
  const cmd = new Command("notes").description(
2561
2612
  "Generate changelogs with LLM-powered enhancement and flexible templating"
2562
2613
  );
2563
- cmd.command("generate", { isDefault: true }).description("Generate changelog from input data").option("-i, --input <file>", "Input file (default: stdin)").option("--no-changelog", "Disable changelog generation").option("--changelog-mode <mode>", "Changelog location mode (root|packages|both)").option("--changelog-file <name>", "Changelog file name override").option("--release-notes-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) => {
2564
2615
  setVerbosity(options.verbose);
2565
2616
  if (options.quiet) setQuietMode(true);
2566
2617
  try {
@@ -2582,13 +2633,11 @@ function createNotesCommand() {
2582
2633
  }
2583
2634
  if (options.releaseNotes === false) {
2584
2635
  config.releaseNotes = false;
2585
- } else if (options.releaseNotesMode || options.releaseNotesFile) {
2636
+ } else if (options.releaseNotesDir) {
2586
2637
  const existing = config.releaseNotes !== false ? config.releaseNotes ?? {} : {};
2587
- const mode = options.releaseNotesMode ?? existing.mode ?? "root";
2588
2638
  config.releaseNotes = {
2589
2639
  ...existing,
2590
- mode,
2591
- ...options.releaseNotesFile ? { file: options.releaseNotesFile } : {}
2640
+ file: { dir: options.releaseNotesDir }
2592
2641
  };
2593
2642
  }
2594
2643
  if (config.changelog === false && (options.template || options.engine)) {
@@ -2656,7 +2705,7 @@ function createNotesCommand() {
2656
2705
  }
2657
2706
  let inputJson;
2658
2707
  if (options.input) {
2659
- inputJson = fs11.readFileSync(options.input, "utf-8");
2708
+ inputJson = fs13.readFileSync(options.input, "utf-8");
2660
2709
  } else {
2661
2710
  inputJson = await readStdin();
2662
2711
  }
@@ -2676,9 +2725,6 @@ function createNotesCommand() {
2676
2725
  if (config.changelog !== false && !options.changelogMode) {
2677
2726
  config.changelog = { ...config.changelog ?? {}, mode: monoMode };
2678
2727
  }
2679
- if (config.releaseNotes !== false && config.releaseNotes !== void 0 && !options.releaseNotesMode) {
2680
- config.releaseNotes = { ...config.releaseNotes, mode: monoMode };
2681
- }
2682
2728
  }
2683
2729
  await runPipeline(input, config, options.dryRun ?? false);
2684
2730
  if (options.dryRun) {