@releasekit/notes 0.45.0 → 0.46.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.
@@ -1,22 +1,31 @@
1
1
  import {
2
+ BREAKING_SECTION,
2
3
  EXIT_CODES,
3
4
  ReleaseKitError,
4
5
  debug,
5
6
  detectMonorepo,
6
7
  error,
7
8
  formatVersion,
9
+ groupChangelogSections,
8
10
  info,
9
11
  isPathWithinRoot,
10
12
  parseGitHubOwnerRepo,
11
13
  removeDescriptionRefs,
14
+ renderBundledBlocks,
15
+ renderChangelogEntryLine,
12
16
  renderMarkdown,
17
+ resolveBundled,
13
18
  setLogLevel,
14
19
  setQuietMode,
20
+ sharedPackageBlock,
21
+ sharedPackageEntriesOf,
15
22
  success,
23
+ unlistedEntries,
16
24
  unwrapEnvelope,
25
+ versionSections,
17
26
  warn,
18
27
  writeChangelog
19
- } from "./chunk-66BANKM3.js";
28
+ } from "./chunk-EI7LLVJN.js";
20
29
 
21
30
  // ../config/dist/index.js
22
31
  import * as fs from "fs";
@@ -65,7 +74,6 @@ function parseJsonc(content) {
65
74
  }
66
75
  return result;
67
76
  }
68
- var DEFAULT_DEMOTE_SCOPES = ["deps", "deps-dev"];
69
77
  var GitConfigSchema = z.strictObject({
70
78
  remote: z.string().default("origin").describe("Git remote name"),
71
79
  branch: z.string().optional().describe(
@@ -146,13 +154,13 @@ var VersionConfigBaseSchema = z.strictObject({
146
154
  ),
147
155
  packages: z.array(z.string()).default([]).describe("Packages to include in versioning. Empty includes every discovered package."),
148
156
  sharedPackages: z.array(z.string()).optional().describe(
149
- 'Foundational packages whose changes belong in every package\u2019s changelog. A commit touching only a shared package (exact name or glob) is classified as repo-level and surfaced under "Project-wide changes" rather than attributed to that one package. Default: none \u2014 no package is treated as shared unless declared.'
157
+ 'Foundational packages whose changes belong in every package\u2019s notes, as exact names or globs. In async mode (`sync: false`, no `groups`, more than one package in the run), commits touching a shared package and no non-shared package are listed under "Project-wide changes" in each released package\u2019s changelog, release notes and release body, covering those since that package\u2019s previous release. A root changelog lists them once per run in such releases, alongside commits that touch no package. Default: none.'
150
158
  ),
151
159
  primaryPackages: z.array(z.string()).default([]).describe(
152
- "Packages users install, as exact names or globs. Each anchors a release unit with its group-mates and the internal dependencies it releases with. Used by the standing-PR selection list."
160
+ "Packages users install, as exact names or globs. Each anchors a release unit with its group-mates and the internal dependencies it releases with. Used by the standing-PR selection list. In async mode or grouped releases with per-package tags, each primary's release notes also list its group-mates' and internal dependencies' releases since its previous release."
153
161
  ),
154
162
  sharedChangelogFloor: z.enum(["union", "sinceLastRelease"]).default("union").describe(
155
- `How the "Project-wide changes" block is bounded in package-specific-tag mode. "union" (default): repo-level commits accrue from the union of the releasing packages' ranges, floored by the OLDEST unreleased baseline \u2014 so a genuinely-global commit recurs in every release until the oldest-baselined package is released past it. "sinceLastRelease": floor the block by the single nearest tag reachable across the repo, so global commits already shown by the most recent release don't recur (recommended for per-package-tag monorepos). No effect in sync mode, where one shared tag already consumes repo-level commits on each release.`
163
+ `How project-wide entries in the standing PR and the root changelog are bounded in async mode (see sharedPackages); each package's own notes list the shared-package entries since its previous release. "union" (default): repo-level commits accrue from the union of the releasing packages' ranges, floored by the OLDEST unreleased baseline \u2014 so a genuinely-global commit recurs in every release until the oldest-baselined package is released past it. "sinceLastRelease": floor the block by the single nearest tag reachable across the repo, so global commits already shown by the most recent release don't recur (recommended for per-package-tag monorepos).`
156
164
  ),
157
165
  mainPackage: z.string().optional().describe(
158
166
  "The package a single-mode release versions. In sync mode, the release bumps from this package's version and tag and, without packageSpecificTags, carries its name. The changelog still lists every commit in the release."
@@ -373,10 +381,7 @@ var ChangelogConfigSchema = z.strictObject({
373
381
  file: z.string().optional().describe("Changelog file name override (default: CHANGELOG.md)"),
374
382
  templates: TemplateConfigSchema.optional().describe("Template configuration for changelog"),
375
383
  refs: z.enum(["strip", "escape", "link"]).default("link").describe(
376
- "How `#NNN` issue/PR refs in the changelog are rendered. Applies to the whole entry \u2014 both the appended label and any bare `#N` carried over from the commit subject into the description (a description ref that also appears in the appended label is de-duplicated away). 'link' (default): the PR and the issues it closed are labelled as `(PR #503 \xB7 closes #500)`, where the PR links to its canonical /pull/ URL with `PR #503` as the visible text \u2014 this keeps the GitHub hovercard but stops the bare-token rich inline card that duplicated the entry; closed issues link to /issues/. An entry with no identifiable PR (a non-squash commit, or a non-GitHub repo) falls back to a plain ref list. 'escape': plain text \\#NNN (no link, no hovercard, no PR/closes labelling). 'strip': refs are removed entirely. Scoped-package / @user mentions in entry text are always neutralised regardless of this setting."
377
- ),
378
- demoteScopes: z.array(z.string()).default([...DEFAULT_DEMOTE_SCOPES]).describe(
379
- 'Conventional-commit scopes whose changelog entries move to a trailing "Dependencies & version bumps" subsection instead of mixing with Added / Changed / Fixed. A breaking change still comes first, under Breaking. Applies to the release preview comment and the standing-PR changelogs (each releasable row and the "Show all changes" footer). Entries are moved, not dropped, so the de-duplicated change count is unchanged. Default: ["deps", "deps-dev"], the scopes Dependabot uses. Set to [] to render every scope inline.'
384
+ "How `#NNN` issue/PR refs in changelog entries are rendered, wherever the entries appear. Applies to the whole entry \u2014 both the appended label and any bare `#N` carried over from the commit subject into the description (a description ref that also appears in the appended label is de-duplicated away). 'link' (default): the PR and the issues it closed are labelled as `(PR #503 \xB7 closes #500)`, where the PR links to its canonical /pull/ URL with `PR #503` as the visible text \u2014 this keeps the GitHub hovercard but stops the bare-token rich inline card that duplicated the entry; closed issues link to /issues/. An entry with no identifiable PR (a non-squash commit, or a non-GitHub repo) falls back to a plain ref list. 'escape': plain text \\#NNN (no link, no hovercard, no PR/closes labelling). 'strip': refs are removed entirely. Scoped-package / @user mentions in entry text are always neutralised regardless of this setting."
380
385
  )
381
386
  }).describe("Changelog file configuration");
382
387
  var LLMOptionsSchema = z.strictObject({
@@ -877,6 +882,9 @@ function loadConfig(options) {
877
882
  const configPath = options?.configPath ?? resolveConfigPath(cwd);
878
883
  return loadConfigFile(configPath);
879
884
  }
885
+ function configuredRefsMode(notes) {
886
+ return (notes?.changelog || void 0)?.refs ?? "link";
887
+ }
880
888
 
881
889
  // src/errors/index.ts
882
890
  var NotesError = class extends ReleaseKitError {
@@ -965,7 +973,8 @@ var VersionChangelogEntrySchema = z3.looseObject({
965
973
  prNumber: z3.string().optional(),
966
974
  scope: z3.string().optional(),
967
975
  originalType: z3.string().optional(),
968
- breaking: z3.boolean().optional()
976
+ breaking: z3.boolean().optional(),
977
+ sharedPackage: z3.boolean().optional()
969
978
  });
970
979
  var VersionPackageChangelogSchema = z3.looseObject({
971
980
  packageName: z3.string(),
@@ -974,7 +983,9 @@ var VersionPackageChangelogSchema = z3.looseObject({
974
983
  revisionRange: z3.string(),
975
984
  repoUrl: z3.string().nullable(),
976
985
  entries: z3.array(VersionChangelogEntrySchema),
977
- tag: z3.string().optional()
986
+ tag: z3.string().optional(),
987
+ sharedPackageEntries: z3.array(VersionChangelogEntrySchema).optional(),
988
+ bundled: z3.array(z3.looseObject({ packageName: z3.string(), versions: z3.array(z3.string()) })).optional()
978
989
  });
979
990
  var VersionPackageUpdateSchema = z3.looseObject({
980
991
  packageName: z3.string(),
@@ -987,6 +998,10 @@ var VersionOutputSchema = z3.looseObject({
987
998
  dryRun: z3.boolean(),
988
999
  updates: z3.array(VersionPackageUpdateSchema),
989
1000
  changelogs: z3.array(VersionPackageChangelogSchema),
1001
+ sharedEntries: z3.array(VersionChangelogEntrySchema).optional(),
1002
+ bundledReleases: z3.array(
1003
+ z3.looseObject({ packageName: z3.string(), version: z3.string(), entries: z3.array(VersionChangelogEntrySchema) })
1004
+ ).optional(),
990
1005
  commitMessage: z3.string().optional(),
991
1006
  tags: z3.array(z3.string()),
992
1007
  baselineTags: z3.array(z3.string()).optional(),
@@ -994,7 +1009,13 @@ var VersionOutputSchema = z3.looseObject({
994
1009
  });
995
1010
 
996
1011
  // src/input/version-output.ts
997
- var NotesVersionOutputSchema = VersionOutputSchema.pick({ changelogs: true, updates: true, tags: true }).partial({
1012
+ var NotesVersionOutputSchema = VersionOutputSchema.pick({
1013
+ changelogs: true,
1014
+ updates: true,
1015
+ tags: true,
1016
+ sharedEntries: true,
1017
+ bundledReleases: true
1018
+ }).partial({
998
1019
  updates: true,
999
1020
  tags: true
1000
1021
  });
@@ -1015,6 +1036,18 @@ function normalizeEntryType(type) {
1015
1036
  };
1016
1037
  return typeMap[type.toLowerCase()] ?? "changed";
1017
1038
  }
1039
+ function toChangelogEntry(entry) {
1040
+ return {
1041
+ type: normalizeEntryType(entry.type),
1042
+ description: entry.description,
1043
+ issueIds: entry.issueIds,
1044
+ prNumber: entry.prNumber,
1045
+ scope: entry.scope,
1046
+ originalType: entry.originalType,
1047
+ breaking: entry.breaking ?? entry.originalType?.includes("!") ?? false,
1048
+ ...entry.sharedPackage ? { sharedPackage: true } : {}
1049
+ };
1050
+ }
1018
1051
  function versionOutputToChangelogInput(data) {
1019
1052
  if (!data.changelogs || !Array.isArray(data.changelogs)) {
1020
1053
  throw new InputParseError('Input must contain a "changelogs" array');
@@ -1028,20 +1061,16 @@ function versionOutputToChangelogInput(data) {
1028
1061
  revisionRange: changelog.revisionRange,
1029
1062
  repoUrl: changelog.repoUrl,
1030
1063
  date: (/* @__PURE__ */ new Date()).toISOString().split("T")[0] ?? "",
1031
- entries: changelog.entries.map((entry) => ({
1032
- type: normalizeEntryType(entry.type),
1033
- description: entry.description,
1034
- issueIds: entry.issueIds,
1035
- prNumber: entry.prNumber,
1036
- scope: entry.scope,
1037
- originalType: entry.originalType,
1038
- breaking: entry.breaking ?? entry.originalType?.includes("!") ?? false
1039
- }))
1064
+ entries: changelog.entries.map(toChangelogEntry),
1065
+ sharedPackageEntries: changelog.sharedPackageEntries?.map(toChangelogEntry),
1066
+ bundled: changelog.bundled
1040
1067
  }));
1041
1068
  const repoUrl = packages[0]?.repoUrl ?? null;
1042
1069
  return {
1043
1070
  source: "version",
1044
1071
  packages,
1072
+ sharedEntries: data.sharedEntries?.map(toChangelogEntry),
1073
+ bundledReleases: data.bundledReleases?.map((r) => ({ ...r, entries: r.entries.map(toChangelogEntry) })),
1045
1074
  metadata: {
1046
1075
  repoUrl: repoUrl ?? void 0
1047
1076
  }
@@ -1747,7 +1776,7 @@ function parseReleaseBodyToExample(markdown, version) {
1747
1776
  }
1748
1777
  const heading = /^#{2,4} (.+)/.exec(line)?.[1];
1749
1778
  if (heading) {
1750
- currentCategory = heading.trim();
1779
+ currentCategory = heading.trim().replace(/:$/, "");
1751
1780
  continue;
1752
1781
  }
1753
1782
  if (line.startsWith("#")) {
@@ -1763,7 +1792,7 @@ function parseReleaseBodyToExample(markdown, version) {
1763
1792
  if (leadInMatch) {
1764
1793
  entry.leadIn = leadInMatch[1];
1765
1794
  }
1766
- if (/\*\*BREAKING\*\*/i.test(text)) {
1795
+ if (currentCategory === BREAKING_SECTION || /\*\*BREAKING\*\*/i.test(text)) {
1767
1796
  entry.breaking = true;
1768
1797
  }
1769
1798
  entries.push(entry);
@@ -3283,7 +3312,33 @@ function createTemplateContext(pkg) {
3283
3312
  isFirstRelease: pkg.previousVersion === null
3284
3313
  };
3285
3314
  }
3286
- function createDocumentContext(contexts, repoUrl) {
3315
+ function toTemplateVersion(ctx, options) {
3316
+ const refs = options.refs ?? "link";
3317
+ const withLine = (entry) => ({
3318
+ ...entry,
3319
+ line: renderChangelogEntryLine(entry, refs, ctx.repoUrl)
3320
+ });
3321
+ const toTemplateSection = (s) => ({
3322
+ label: s.label,
3323
+ entries: s.items.map(withLine)
3324
+ });
3325
+ const { enhanced, sharedEntries, bundled, ...rest } = ctx;
3326
+ const { categories: _, ...prose } = enhanced ?? {};
3327
+ return {
3328
+ ...rest,
3329
+ entries: ctx.entries.map(withLine),
3330
+ sections: versionSections(ctx, options.categoryOrder).map(toTemplateSection),
3331
+ shared: groupChangelogSections(sharedEntries ?? [], (e) => e).map(toTemplateSection),
3332
+ bundled: (bundled ?? []).map(({ entries, ...pkg }) => ({
3333
+ ...pkg,
3334
+ sections: groupChangelogSections(entries, (e) => e).map(toTemplateSection)
3335
+ })),
3336
+ // Set even when absent: EJS throws on a bare `enhanced` that isn't a key.
3337
+ enhanced: prose.summary || prose.releaseNotes ? prose : void 0
3338
+ };
3339
+ }
3340
+ function createDocumentContext(contexts, repoUrl, options, sharedEntries = []) {
3341
+ const refs = options.refs ?? "link";
3287
3342
  const compareUrls = {};
3288
3343
  for (const ctx of contexts) {
3289
3344
  if (ctx.compareUrl) {
@@ -3295,8 +3350,15 @@ function createDocumentContext(contexts, repoUrl) {
3295
3350
  name: contexts[0]?.packageName ?? "project",
3296
3351
  repoUrl
3297
3352
  },
3298
- versions: contexts,
3299
- compareUrls: Object.keys(compareUrls).length > 0 ? compareUrls : void 0
3353
+ versions: contexts.map((ctx) => toTemplateVersion(ctx, options)),
3354
+ compareUrls: Object.keys(compareUrls).length > 0 ? compareUrls : void 0,
3355
+ shared: groupChangelogSections(sharedEntries, (e) => e).map((s) => ({
3356
+ label: s.label,
3357
+ entries: s.items.map((entry) => ({
3358
+ ...entry,
3359
+ line: renderChangelogEntryLine(entry, refs, repoUrl ?? null)
3360
+ }))
3361
+ }))
3300
3362
  };
3301
3363
  }
3302
3364
  async function processWithLLM(context, llmConfig, examples, packageNames) {
@@ -3410,10 +3472,21 @@ async function processWithLLM(context, llmConfig, examples, packageNames) {
3410
3472
  function renderReleaseNotes(ctx, output, releaseNotesConfig, fmtOpts) {
3411
3473
  if (releaseNotesConfig.templates?.path) {
3412
3474
  const templatePath = path12.resolve(releaseNotesConfig.templates.path);
3413
- const docCtx = { ...createDocumentContext([ctx], ctx.repoUrl ?? void 0), perPackage: true, output };
3475
+ const docCtx = {
3476
+ ...createDocumentContext([ctx], ctx.repoUrl ?? void 0, fmtOpts),
3477
+ perPackage: true,
3478
+ output
3479
+ };
3414
3480
  return renderTemplate(templatePath, docCtx, releaseNotesConfig.templates.engine).content;
3415
3481
  }
3416
- return ctx.enhanced?.releaseNotes || formatVersion(ctx, fmtOpts);
3482
+ const refs = fmtOpts.refs ?? "link";
3483
+ const prose = ctx.enhanced?.releaseNotes;
3484
+ const own = prose ? [prose.trimEnd(), sharedPackageBlock(ctx, refs)] : [formatVersion(ctx, fmtOpts).trimEnd()];
3485
+ const blocks = [...own, ...renderBundledBlocks(ctx.bundled ?? [], 3, refs, ctx.repoUrl)].filter(
3486
+ (block) => !!block
3487
+ );
3488
+ return prose && blocks.length === 1 ? prose : `${blocks.join("\n\n")}
3489
+ `;
3417
3490
  }
3418
3491
  async function runPipeline(input, config, dryRun, pipelineOptions) {
3419
3492
  debug(`Processing ${input.packages.length} package(s)`);
@@ -3483,27 +3556,49 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
3483
3556
  (ctx) => processWithLLM(ctx, llmConfig, examplesByPackage.get(ctx.packageName) ?? [], allPackageNames)
3484
3557
  );
3485
3558
  }
3559
+ const sharedEntries = input.sharedEntries ?? [];
3560
+ const packages = new Map(input.packages.map((pkg) => [pkg.packageName, pkg]));
3561
+ const withShared = (ctx) => {
3562
+ const pkg = packages.get(ctx.packageName);
3563
+ const shared = pkg ? sharedPackageEntriesOf(pkg, sharedEntries) : [];
3564
+ return shared.length > 0 ? { ...ctx, sharedEntries: shared } : ctx;
3565
+ };
3566
+ const releases = [...input.bundledReleases ?? [], ...input.packages];
3567
+ const withBundled = (ctx) => {
3568
+ const bundled = resolveBundled(packages.get(ctx.packageName)?.bundled, releases);
3569
+ if (bundled.length === 0) {
3570
+ return ctx;
3571
+ }
3572
+ const entries = ctx.entries.filter((e) => e.description !== `Update version to ${ctx.version}`);
3573
+ return { ...ctx, entries, bundled };
3574
+ };
3575
+ releaseNotesContexts = releaseNotesContexts.map(withShared).map(withBundled);
3486
3576
  const files = [];
3487
3577
  const fmtOpts = {
3488
3578
  includePackageName: input.packages.length > 1 || changelogContexts.some((c) => c.packageName.includes("/")),
3489
3579
  categoryOrder: llmConfig?.categoryOrder,
3490
3580
  links: releaseNotesConfig?.links,
3491
3581
  firstRelease: releaseNotesConfig?.firstRelease,
3492
- refs: (changelogConfig !== false ? changelogConfig.refs : void 0) ?? "link"
3582
+ refs: configuredRefsMode(config)
3493
3583
  };
3494
3584
  if (!pipelineOptions?.skipChangelogs && !releaseNotesFor && changelogConfig !== false && changelogConfig.mode) {
3495
3585
  const fileName = changelogConfig.file ?? "CHANGELOG.md";
3496
3586
  const mode = changelogConfig.mode;
3497
3587
  const templates = changelogConfig.templates;
3498
- const renderChangelog = (ctxs, options) => templates?.path ? renderTemplate(
3588
+ const renderChangelog = (ctxs, options, runSharedEntries) => templates?.path ? renderTemplate(
3499
3589
  path12.resolve(templates.path),
3500
- createDocumentContext(ctxs, ctxs[0]?.repoUrl ?? void 0),
3590
+ createDocumentContext(ctxs, ctxs[0]?.repoUrl ?? void 0, options, runSharedEntries),
3501
3591
  templates.engine
3502
- ).content : renderMarkdown(ctxs, options);
3592
+ ).content : renderMarkdown(ctxs, options, runSharedEntries);
3503
3593
  info(`Generating changelog \u2192 ${fileName}`);
3504
3594
  try {
3505
3595
  if (mode === "root" || mode === "both") {
3506
- writeChangelog(fileName, renderChangelog(changelogContexts, fmtOpts), dryRun);
3596
+ const runEntries = changelogContexts.flatMap((ctx) => ctx.entries);
3597
+ writeChangelog(
3598
+ fileName,
3599
+ renderChangelog(changelogContexts, fmtOpts, unlistedEntries(sharedEntries, runEntries)),
3600
+ dryRun
3601
+ );
3507
3602
  if (!dryRun) {
3508
3603
  files.push(fileName);
3509
3604
  }
@@ -3511,7 +3606,7 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
3511
3606
  if (mode === "packages" || mode === "both") {
3512
3607
  const refs = fmtOpts.refs;
3513
3608
  const monoFiles = await writeMonorepoFiles(
3514
- changelogContexts,
3609
+ changelogContexts.map(withShared),
3515
3610
  config,
3516
3611
  dryRun,
3517
3612
  fileName,
@@ -3543,7 +3638,7 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
3543
3638
  const packageNotes = Object.fromEntries(
3544
3639
  changelogContexts.map((ctx) => [
3545
3640
  ctx.packageName,
3546
- formatVersion(ctx, { firstRelease: releaseNotesConfig?.firstRelease })
3641
+ formatVersion(withShared(ctx), { firstRelease: releaseNotesConfig?.firstRelease })
3547
3642
  ])
3548
3643
  );
3549
3644
  const releaseNotesResult = {};
@@ -3571,7 +3666,7 @@ async function processInput(inputJson, config, dryRun, pipelineOptions) {
3571
3666
  return runPipeline(input, config, dryRun, pipelineOptions);
3572
3667
  }
3573
3668
  async function writeMonorepoFiles(contexts, config, dryRun, fileName, render) {
3574
- const { detectMonorepo: detectMonorepo2, writeMonorepoChangelogs } = await import("./aggregator-T5ZE72Y6.js");
3669
+ const { detectMonorepo: detectMonorepo2, writeMonorepoChangelogs } = await import("./aggregator-XM2XIYDF.js");
3575
3670
  const cwd = process.cwd();
3576
3671
  const detected = detectMonorepo2(cwd);
3577
3672
  if (!detected.isMonorepo) {
package/dist/cli.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createNotesCommand
4
- } from "./chunk-CJRSZUD4.js";
4
+ } from "./chunk-JOA56Y7A.js";
5
5
  import {
6
6
  readPackageVersion
7
- } from "./chunk-66BANKM3.js";
7
+ } from "./chunk-EI7LLVJN.js";
8
8
 
9
9
  // src/cli.ts
10
10
  import * as fs from "fs";
package/dist/index.d.ts CHANGED
@@ -11,6 +11,13 @@ declare function loadAuth(): Record<string, string>;
11
11
  declare function saveAuth(provider: string, apiKey: string): void;
12
12
 
13
13
  type ChangelogRefsMode = 'strip' | 'escape' | 'link';
14
+ interface BundledPackage<T> {
15
+ packageName: string;
16
+ /** Set when the package released more than once in the range. */
17
+ firstVersion?: string;
18
+ version: string;
19
+ entries: T[];
20
+ }
14
21
 
15
22
  declare abstract class ReleaseKitError extends Error {
16
23
  abstract readonly code: string;
@@ -41,6 +48,8 @@ interface VersionChangelogEntry {
41
48
  * extraction-error fallback, which isn't a no-change carry.
42
49
  */
43
50
  synthetic?: boolean;
51
+ /** On a `sharedEntries` entry: its commit touched a `sharedPackages` package. Absent for a repo-level entry. */
52
+ sharedPackage?: boolean;
44
53
  }
45
54
  interface VersionPackageChangelog {
46
55
  packageName: string;
@@ -51,6 +60,23 @@ interface VersionPackageChangelog {
51
60
  entries: VersionChangelogEntry[];
52
61
  /** The tag this changelog releases: the package's own, or a sync release's shared one. Absent in older manifests. */
53
62
  tag?: string;
63
+ /**
64
+ * Entries from commits in this changelog's range that touch a `sharedPackages` package and no non-shared package,
65
+ * leaving out commits under this package's own directories. Recorded, possibly empty, by async-mode releases with
66
+ * shared packages; absent otherwise and in older manifests.
67
+ */
68
+ sharedPackageEntries?: VersionChangelogEntry[];
69
+ /** A primary's bundled packages, each with the versions of that package the primary's notes include, oldest first. */
70
+ bundled?: VersionBundledPackage[];
71
+ }
72
+ interface VersionBundledPackage {
73
+ packageName: string;
74
+ versions: string[];
75
+ }
76
+ interface VersionBundledRelease {
77
+ packageName: string;
78
+ version: string;
79
+ entries: VersionChangelogEntry[];
54
80
  }
55
81
  /** `'graduated'`: a prerelease promoted to stable, ignoring any requested bump. `'first-release'`: no prior tag. */
56
82
  type VersionAction = 'first-release' | 'graduated' | 'bumped';
@@ -68,6 +94,11 @@ interface VersionOutput {
68
94
  /** Entries from commits that touch no package outside `sharedPackages`, counting the directories a package
69
95
  * versions through `cargo.paths` / `pub.paths`. */
70
96
  sharedEntries?: VersionChangelogEntry[];
97
+ /**
98
+ * Earlier releases a primary's `bundled` packages made since its previous release, each stored once however many
99
+ * primaries include it. A bundled package's release in this run is its own changelog record.
100
+ */
101
+ bundledReleases?: VersionBundledRelease[];
71
102
  commitMessage?: string;
72
103
  /** Consumer-facing tags from `tagTemplate`. */
73
104
  tags: string[];
@@ -142,6 +173,8 @@ interface ChangelogEntry {
142
173
  originalType?: string;
143
174
  breaking?: boolean;
144
175
  leadIn?: string;
176
+ /** On a project-wide entry: its commit touched a `sharedPackages` package, so every package's notes list it. */
177
+ sharedPackage?: boolean;
145
178
  /** Populated upstream of LLM tasks; never serialised to disk. */
146
179
  context?: {
147
180
  prs: PRContext[];
@@ -156,11 +189,19 @@ interface PackageChangelog {
156
189
  repoUrl: string | null;
157
190
  date: string;
158
191
  entries: ChangelogEntry[];
192
+ sharedPackageEntries?: ChangelogEntry[];
193
+ bundled?: VersionBundledPackage[];
159
194
  }
195
+ type BundledRelease = Omit<VersionBundledRelease, 'entries'> & {
196
+ entries: ChangelogEntry[];
197
+ };
160
198
  type InputSource = 'version';
161
199
  interface ChangelogInput {
162
200
  source: InputSource;
163
201
  packages: PackageChangelog[];
202
+ /** Project-wide entries, from commits that touch no package outside `sharedPackages`. */
203
+ sharedEntries?: ChangelogEntry[];
204
+ bundledReleases?: BundledRelease[];
164
205
  metadata?: {
165
206
  repoUrl?: string;
166
207
  defaultBranch?: string;
@@ -185,15 +226,47 @@ interface TemplateContext {
185
226
  compareUrl?: string;
186
227
  enhanced?: EnhancedData;
187
228
  isFirstRelease?: boolean;
229
+ /** Shared-package entries, listed after the version's own. */
230
+ sharedEntries?: ChangelogEntry[];
231
+ /** A primary's bundled packages. Release notes only: the changelog never lists them. */
232
+ bundled?: BundledPackage<ChangelogEntry>[];
233
+ }
234
+ interface TemplateEntry extends ChangelogEntry {
235
+ /** The built-in renderer's line: refs rendered, mentions and comment openers escaped. */
236
+ line: string;
237
+ }
238
+ interface TemplateSection {
239
+ label: string;
240
+ entries: TemplateEntry[];
241
+ }
242
+ /** What a template sees for one version. */
243
+ interface TemplateBundledPackage {
244
+ packageName: string;
245
+ /** Set when the package released more than once since the primary's previous release. */
246
+ firstVersion?: string;
247
+ version: string;
248
+ sections: TemplateSection[];
249
+ }
250
+ interface TemplateVersion extends Omit<TemplateContext, 'entries' | 'enhanced' | 'sharedEntries' | 'bundled'> {
251
+ entries: TemplateEntry[];
252
+ /** LLM categories when `categorize` ran, otherwise commit-type groups. Breaking leads unless `categoryOrder` places it. */
253
+ sections: TemplateSection[];
254
+ /** Shared-package entries in commit-type groups. Empty in a root changelog. */
255
+ shared: TemplateSection[];
256
+ /** A primary's bundled packages, each in commit-type groups. Empty outside release notes. */
257
+ bundled: TemplateBundledPackage[];
258
+ enhanced?: Omit<EnhancedData, 'categories'>;
188
259
  }
189
260
  interface DocumentContext {
190
261
  project: {
191
262
  name: string;
192
263
  repoUrl?: string;
193
264
  };
194
- versions: TemplateContext[];
195
- unreleased?: TemplateContext;
265
+ versions: TemplateVersion[];
266
+ unreleased?: TemplateVersion;
196
267
  compareUrls?: Record<string, string>;
268
+ /** A root changelog's project-wide entries for the run, in commit-type groups. Empty otherwise. */
269
+ shared: TemplateSection[];
197
270
  /** Templates can use this to suppress document-level headings that are redundant
198
271
  * when the content is embedded in a release that already shows the package/version. */
199
272
  perPackage?: boolean;
@@ -317,6 +390,19 @@ interface ReleaseNotesConfig {
317
390
  declare function loadConfig(projectDir?: string, configFile?: string): Config;
318
391
  declare function getDefaultConfig(): Config;
319
392
 
393
+ interface FormatVersionOptions {
394
+ includePackageName?: boolean;
395
+ /** Order to render LLM-categorised sections. */
396
+ categoryOrder?: string[];
397
+ links?: LinksConfig;
398
+ firstRelease?: FirstReleaseConfig | false;
399
+ refs?: ChangelogRefsMode;
400
+ }
401
+ declare function formatVersion(context: TemplateContext, options?: FormatVersionOptions): string;
402
+ /** `sharedEntries` are listed once, after the versions, under a dated heading of their own. */
403
+ declare function renderMarkdown(contexts: TemplateContext[], options?: FormatVersionOptions, sharedEntries?: ChangelogEntry[]): string;
404
+ declare function writeChangelog(outputPath: string, content: string, dryRun: boolean): void;
405
+
320
406
  declare function createTemplateContext(pkg: PackageChangelog): TemplateContext;
321
407
  interface PipelineResult {
322
408
  /** Per-package rendered markdown keyed by package name. */
@@ -378,7 +464,7 @@ declare class ConfigError extends NotesError {
378
464
  }
379
465
  declare function getExitCode(error: NotesError): number;
380
466
 
381
- declare function versionOutputToChangelogInput(data: Pick<VersionOutput, 'changelogs'> & Partial<Pick<VersionOutput, 'updates' | 'tags'>>): ChangelogInput;
467
+ declare function versionOutputToChangelogInput(data: Pick<VersionOutput, 'changelogs'> & Partial<Pick<VersionOutput, 'updates' | 'tags' | 'sharedEntries' | 'bundledReleases'>>): ChangelogInput;
382
468
  declare function parseVersionOutput(json: string): ChangelogInput;
383
469
  declare function parseVersionOutputFile(filePath: string): ChangelogInput;
384
470
  declare function parseVersionOutputStdin(): Promise<ChangelogInput>;
@@ -398,18 +484,6 @@ declare function detectMonorepo(cwd: string): {
398
484
  declare function renderJson(contexts: TemplateContext[]): string;
399
485
  declare function writeJson(outputPath: string, contexts: TemplateContext[], dryRun: boolean): void;
400
486
 
401
- interface FormatVersionOptions {
402
- includePackageName?: boolean;
403
- /** Order to render LLM-categorised sections. */
404
- categoryOrder?: string[];
405
- links?: LinksConfig;
406
- firstRelease?: FirstReleaseConfig | false;
407
- refs?: ChangelogRefsMode;
408
- }
409
- declare function formatVersion(context: TemplateContext, options?: FormatVersionOptions): string;
410
- declare function renderMarkdown(contexts: TemplateContext[], options?: FormatVersionOptions): string;
411
- declare function writeChangelog(outputPath: string, content: string, dryRun: boolean): void;
412
-
413
487
  /** `packageCount` is the release's, not the run's: see `writeVersionedNotes`. */
414
488
  declare function nestsReleaseNotes(packageCount: number): boolean;
415
489
  /**
@@ -423,4 +497,4 @@ declare function writeVersionedNotes<T extends {
423
497
  }>(contexts: T[], directory: string, dryRun: boolean, nested: boolean, renderContent: (ctx: T) => string): string[];
424
498
 
425
499
  export { ConfigError, GitHubError, InputParseError, InputValidationError, LLMError, NotesError, TemplateError, aggregateToRoot, createTemplateContext, detectMonorepo, formatVersion, getDefaultConfig, getExitCode, loadAuth, loadConfig, nestsReleaseNotes, parseVersionOutput, parseVersionOutputFile, parseVersionOutputStdin, processInput, renderJson, renderMarkdown, runPipeline, saveAuth, versionOutputToChangelogInput, writeChangelog, writeJson, writeMonorepoChangelogs, writeVersionedNotes };
426
- export type { ChangelogConfig, ChangelogEntry, ChangelogInput, ChangelogType, CompleteOptions, Config, DocumentContext, EnhancedCategory, EnhancedData, FirstReleaseConfig, InputSource, JSONSchema, LLMCategory, LLMConfig, LLMOptions, LLMPromptOverrides, LLMPromptsConfig, LinksConfig, LocationMode, PRContext, PackageChangelog, PipelineOptions, PipelineResult, ReleaseNotesConfig, ReleaseNotesFileConfig, RetryOptions, ScopeConfig, ScopeRules, TemplateConfig, TemplateContext, TemplateEngine };
500
+ export type { BundledRelease, ChangelogConfig, ChangelogEntry, ChangelogInput, ChangelogType, CompleteOptions, Config, DocumentContext, EnhancedCategory, EnhancedData, FirstReleaseConfig, InputSource, JSONSchema, LLMCategory, LLMConfig, LLMOptions, LLMPromptOverrides, LLMPromptsConfig, LinksConfig, LocationMode, PRContext, PackageChangelog, PipelineOptions, PipelineResult, ReleaseNotesConfig, ReleaseNotesFileConfig, RetryOptions, ScopeConfig, ScopeRules, TemplateBundledPackage, TemplateConfig, TemplateContext, TemplateEngine, TemplateEntry, TemplateSection, TemplateVersion };
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  saveAuth,
22
22
  versionOutputToChangelogInput,
23
23
  writeVersionedNotes
24
- } from "./chunk-CJRSZUD4.js";
24
+ } from "./chunk-JOA56Y7A.js";
25
25
  import {
26
26
  aggregateToRoot,
27
27
  debug,
@@ -32,7 +32,7 @@ import {
32
32
  success,
33
33
  writeChangelog,
34
34
  writeMonorepoChangelogs
35
- } from "./chunk-66BANKM3.js";
35
+ } from "./chunk-EI7LLVJN.js";
36
36
 
37
37
  // src/output/json.ts
38
38
  import * as fs from "fs";
@@ -143,7 +143,7 @@ Entry descriptions are processed in parallel (default concurrency: `5`). Adjust
143
143
  { "concurrency": 3 }
144
144
  ```
145
145
 
146
- When `enhance` and `categorize` are both enabled, the pipeline runs a single combined `enhanceAndCategorize` call — see [Combined enhance + categorize](#combined-enhance--categorize). The combined call also generates `leadIn` phrases, scope assignments, and breaking flags. These drive scope grouping, breaking change re-routing, and `**leadIn**: description` formatting in the built-in renderer — none of which are available when running `enhance` alone. Routine fixes and bumps receive no `leadIn`.
146
+ When `enhance` and `categorize` are both enabled, the pipeline runs a single combined `enhanceAndCategorize` call — see [Combined enhance + categorize](#combined-enhance--categorize). The combined call also generates `leadIn` phrases, scope assignments, and breaking flags. These drive breaking change re-routing and `**leadIn**: description` formatting in the built-in renderer, neither of which is available when running `enhance` alone. Routine fixes and bumps receive no `leadIn`.
147
147
 
148
148
  ### `summarize`
149
149
 
@@ -155,7 +155,7 @@ Generates a one-paragraph summary of the entire release, added to the template c
155
155
 
156
156
  ### `categorize`
157
157
 
158
- Groups entries into user-friendly categories rather than conventional commit types. The result is available in templates as `enhanced.categories`.
158
+ Groups entries into user-friendly categories rather than conventional commit types. The result is available in release-notes templates as `sections`.
159
159
 
160
160
  ```json
161
161
  { "tasks": { "categorize": true } }