@releasekit/notes 0.42.1 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -34,7 +34,7 @@ npm install -g @releasekit/notes
34
34
  pnpm add -g @releasekit/notes
35
35
  ```
36
36
 
37
- > **Note:** ESM only. Requires Node.js 20+.
37
+ > **Note:** ESM only. Requires Node.js 22.12+.
38
38
 
39
39
  ## Quick Start
40
40
 
@@ -2,8 +2,8 @@ import {
2
2
  aggregateToRoot,
3
3
  detectMonorepo,
4
4
  writeMonorepoChangelogs
5
- } from "./chunk-KQQPQQSS.js";
6
- import "./chunk-CBMVDKDR.js";
5
+ } from "./chunk-YNGSEWF6.js";
6
+ import "./chunk-TNTTAFQ4.js";
7
7
  export {
8
8
  aggregateToRoot,
9
9
  detectMonorepo,
@@ -14,7 +14,7 @@ import {
14
14
  unwrapEnvelope,
15
15
  warn,
16
16
  writeMarkdown
17
- } from "./chunk-CBMVDKDR.js";
17
+ } from "./chunk-TNTTAFQ4.js";
18
18
 
19
19
  // ../config/dist/index.js
20
20
  import * as fs from "fs";
@@ -84,13 +84,17 @@ var VersionCargoConfigSchema = z.object({
84
84
  enabled: z.boolean().default(true).describe(
85
85
  "Version Cargo.toml manifests. Detected Rust packages are versioned by default; set false to opt out (e.g. a vendored crate, or Rust versioning handled elsewhere)."
86
86
  ),
87
- paths: z.array(z.string()).optional().describe("Directories to search for Cargo.toml files")
87
+ paths: z.array(z.string()).optional().describe(
88
+ "Directories, relative to each package, to bump a Cargo.toml in instead of the package's own directory. Ignored in group mode."
89
+ )
88
90
  });
89
91
  var VersionPubConfigSchema = z.object({
90
92
  enabled: z.boolean().default(true).describe(
91
93
  "Version pubspec.yaml manifests. Detected Dart/Flutter packages are versioned by default; set false to opt out."
92
94
  ),
93
- paths: z.array(z.string()).optional().describe("Directories to search for pubspec.yaml files")
95
+ paths: z.array(z.string()).optional().describe(
96
+ "Directories, relative to each package, to bump a pubspec.yaml in instead of the package's own directory. Ignored in group mode."
97
+ )
94
98
  });
95
99
  var VersionGroupSchema = z.object({
96
100
  packages: z.array(z.string()).min(1).describe(
@@ -530,14 +534,14 @@ var CIConfigSchema = z.object({
530
534
  z.boolean(),
531
535
  z.object({
532
536
  enabled: z.boolean().default(true).describe("Whether PR preview comments are posted."),
533
- refreshAfterRelease: z.boolean().default(false).describe(
534
- 'After a release completes, replay the preview comment on still-open feeder PRs so their "what would release" estimate is not left stale against the moved baseline. Cosmetic and best-effort \u2014 a failure here never fails the release. Driven automatically in-process after a successful release (both the direct and standing-PR publish paths); the standalone `refresh-after-release` command also performs it for setups that run it as a separate step.'
537
+ markStaleAfterRelease: z.boolean().default(false).describe(
538
+ "After a standing-PR publish, or a `releasekit release` that pushes the release branch, mark the preview on open PRs into that branch as stale until the PR's next push or label change. `releasekit publish` on its own doesn't. Best-effort: a failure never fails the release."
535
539
  )
536
540
  })
537
541
  ]).default(true).transform(
538
- (v) => typeof v === "boolean" ? { enabled: v, refreshAfterRelease: false } : { enabled: v.enabled ?? true, refreshAfterRelease: v.refreshAfterRelease ?? false }
542
+ (v) => typeof v === "boolean" ? { enabled: v, markStaleAfterRelease: false } : { enabled: v.enabled ?? true, markStaleAfterRelease: v.markStaleAfterRelease ?? false }
539
543
  ).describe(
540
- "PR preview comments showing what would be released if the PR is merged. `true`/`false` toggles them; the object form additionally enables `refreshAfterRelease` to refresh feeder-PR previews after a release."
544
+ "PR preview comments showing what would be released if the PR is merged. `true`/`false` toggles them; the object form additionally enables `markStaleAfterRelease` to mark feeder-PR previews stale after a release."
541
545
  ),
542
546
  labels: CILabelsConfigSchema.default({
543
547
  graduate: "release:graduate",
@@ -710,6 +714,11 @@ function assertNoRemovedTopLevelFields(config) {
710
714
  `ci no longer supports ${removed.join(", ")}. autoRelease was removed (it had no effect); skipPatterns and minChanges live under release.ci (release.ci.skipPatterns / release.ci.minChanges).`
711
715
  );
712
716
  }
717
+ if (isRecord(config.ci.prPreview) && "refreshAfterRelease" in config.ci.prPreview) {
718
+ throw new ConfigError(
719
+ "ci.prPreview.refreshAfterRelease was renamed to markStaleAfterRelease. It now marks open PRs' previews stale after a release instead of recomputing them."
720
+ );
721
+ }
713
722
  }
714
723
  if (isRecord(config.monorepo) && "mainPackage" in config.monorepo) {
715
724
  throw new ConfigError("monorepo.mainPackage was removed \u2014 use version.mainPackage instead.");
@@ -762,6 +771,10 @@ var InputParseError = class extends NotesError {
762
771
  "Use --input-source to specify format"
763
772
  ];
764
773
  };
774
+ var InputValidationError = class extends NotesError {
775
+ code = "INPUT_VALIDATION_ERROR";
776
+ suggestions = ["Pass `releasekit version --json` output unchanged"];
777
+ };
765
778
  var TemplateError = class extends NotesError {
766
779
  code = "TEMPLATE_ERROR";
767
780
  suggestions = [
@@ -809,6 +822,7 @@ function getExitCode(error2) {
809
822
  case "CONFIG_ERROR":
810
823
  return EXIT_CODES.CONFIG_ERROR;
811
824
  case "INPUT_PARSE_ERROR":
825
+ case "INPUT_VALIDATION_ERROR":
812
826
  return EXIT_CODES.INPUT_ERROR;
813
827
  case "TEMPLATE_ERROR":
814
828
  return EXIT_CODES.TEMPLATE_ERROR;
@@ -823,6 +837,44 @@ function getExitCode(error2) {
823
837
 
824
838
  // src/input/version-output.ts
825
839
  import * as fs5 from "fs";
840
+
841
+ // ../core/dist/version-output-schema.js
842
+ import { z as z3 } from "zod";
843
+ var VersionChangelogEntrySchema = z3.looseObject({
844
+ type: z3.string(),
845
+ description: z3.string(),
846
+ issueIds: z3.array(z3.string()).optional(),
847
+ prNumber: z3.string().optional(),
848
+ scope: z3.string().optional(),
849
+ originalType: z3.string().optional(),
850
+ breaking: z3.boolean().optional()
851
+ });
852
+ var VersionPackageChangelogSchema = z3.looseObject({
853
+ packageName: z3.string(),
854
+ version: z3.string(),
855
+ previousVersion: z3.string().nullable(),
856
+ revisionRange: z3.string(),
857
+ repoUrl: z3.string().nullable(),
858
+ entries: z3.array(VersionChangelogEntrySchema)
859
+ });
860
+ var VersionPackageUpdateSchema = z3.looseObject({
861
+ packageName: z3.string(),
862
+ newVersion: z3.string(),
863
+ filePath: z3.string(),
864
+ files: z3.array(z3.string()).optional(),
865
+ tag: z3.string().optional()
866
+ });
867
+ var VersionOutputSchema = z3.looseObject({
868
+ dryRun: z3.boolean(),
869
+ updates: z3.array(VersionPackageUpdateSchema),
870
+ changelogs: z3.array(VersionPackageChangelogSchema),
871
+ commitMessage: z3.string().optional(),
872
+ tags: z3.array(z3.string()),
873
+ baselineTags: z3.array(z3.string()).optional()
874
+ });
875
+
876
+ // src/input/version-output.ts
877
+ var NotesVersionOutputSchema = VersionOutputSchema.pick({ changelogs: true });
826
878
  function normalizeEntryType(type) {
827
879
  const typeMap = {
828
880
  added: "added",
@@ -882,7 +934,13 @@ function parseVersionOutput(json) {
882
934
  } catch (error2) {
883
935
  throw new InputParseError(error2 instanceof Error ? error2.message : String(error2));
884
936
  }
885
- return versionOutputToChangelogInput(data);
937
+ const result = NotesVersionOutputSchema.safeParse(data);
938
+ if (!result.success) {
939
+ const issues = result.error.issues.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`).join("\n");
940
+ throw new InputValidationError(`Version output failed schema validation:
941
+ ${issues}`);
942
+ }
943
+ return versionOutputToChangelogInput(result.data);
886
944
  }
887
945
  function parseVersionOutputFile(filePath) {
888
946
  const content = fs5.readFileSync(filePath, "utf-8");
@@ -985,7 +1043,6 @@ function isBotComment(comment) {
985
1043
  }
986
1044
  var REPO_PERMISSIONS = ["admin", "maintain", "write", "triage", "read", "none"];
987
1045
  var MAX_RELEASE_PAGES = 3;
988
- var MAX_OPEN_PR_PAGES = 5;
989
1046
  function labelNames(labels) {
990
1047
  return (labels ?? []).map((label) => typeof label === "string" ? label : label.name ?? "");
991
1048
  }
@@ -1039,25 +1096,27 @@ var GitHubForge = class {
1039
1096
  });
1040
1097
  return data.map((pr) => ({ number: pr.number, mergedAt: pr.merged_at }));
1041
1098
  }
1042
- async listOpenPullRequests() {
1099
+ async listOpenPullRequests(base, limit) {
1043
1100
  const prs = [];
1044
- for (let page = 1; page <= MAX_OPEN_PR_PAGES; page++) {
1101
+ const perPage = Math.min(limit, 100);
1102
+ for (let page = 1; prs.length < limit; page++) {
1045
1103
  const { data } = await this.octokit.rest.pulls.list({
1046
1104
  ...this.base,
1047
1105
  state: "open",
1106
+ base,
1048
1107
  sort: "updated",
1049
1108
  direction: "desc",
1050
- per_page: 100,
1109
+ per_page: perPage,
1051
1110
  page
1052
1111
  });
1053
1112
  for (const pr of data) {
1054
- prs.push({ number: pr.number, headRef: pr.head.ref, draft: pr.draft ?? false, baseSha: pr.base.sha });
1113
+ prs.push({ number: pr.number, headRef: pr.head.ref, baseRef: pr.base.ref });
1055
1114
  }
1056
- if (data.length < 100) {
1115
+ if (data.length < perPage) {
1057
1116
  break;
1058
1117
  }
1059
1118
  }
1060
- return prs;
1119
+ return prs.slice(0, limit);
1061
1120
  }
1062
1121
  async getIssue(issueNumber) {
1063
1122
  const { data } = await this.octokit.rest.issues.get({ ...this.base, issue_number: issueNumber });
@@ -1070,7 +1129,7 @@ var GitHubForge = class {
1070
1129
  }
1071
1130
  async getPullRequest(prNumber) {
1072
1131
  const { data } = await this.octokit.rest.pulls.get({ ...this.base, pull_number: prNumber });
1073
- return { body: data.body ?? "", labels: labelNames(data.labels), headSha: data.head?.sha };
1132
+ return { body: data.body ?? "", labels: labelNames(data.labels), headSha: data.head?.sha, baseRef: data.base?.ref };
1074
1133
  }
1075
1134
  async createPullRequest(pr) {
1076
1135
  const { data } = await this.octokit.rest.pulls.create({ ...this.base, ...pr });
@@ -2148,23 +2207,23 @@ ${instructions}`;
2148
2207
  }
2149
2208
 
2150
2209
  // src/llm/schemas.ts
2151
- import { z as z3 } from "zod";
2152
- var EntryOutputSchema = z3.object({
2153
- description: z3.string(),
2154
- category: z3.string(),
2155
- scope: z3.string().nullable(),
2156
- breaking: z3.boolean().nullable(),
2157
- leadIn: z3.string().nullable()
2210
+ import { z as z4 } from "zod";
2211
+ var EntryOutputSchema = z4.object({
2212
+ description: z4.string(),
2213
+ category: z4.string(),
2214
+ scope: z4.string().nullable(),
2215
+ breaking: z4.boolean().nullable(),
2216
+ leadIn: z4.string().nullable()
2158
2217
  });
2159
- var EnhanceAndCategorizeOutputSchema = z3.object({
2160
- entries: z3.array(EntryOutputSchema)
2218
+ var EnhanceAndCategorizeOutputSchema = z4.object({
2219
+ entries: z4.array(EntryOutputSchema)
2161
2220
  });
2162
- var CategorizeEntryOutputSchema = z3.object({
2163
- category: z3.string(),
2164
- scope: z3.string().nullable()
2221
+ var CategorizeEntryOutputSchema = z4.object({
2222
+ category: z4.string(),
2223
+ scope: z4.string().nullable()
2165
2224
  });
2166
- var CategorizeOutputSchema = z3.object({
2167
- entries: z3.array(CategorizeEntryOutputSchema)
2225
+ var CategorizeOutputSchema = z4.object({
2226
+ entries: z4.array(CategorizeEntryOutputSchema)
2168
2227
  });
2169
2228
  function nullableString() {
2170
2229
  return { anyOf: [{ type: "string" }, { type: "null" }] };
@@ -3364,7 +3423,7 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
3364
3423
  const dir = releaseNotesConfig.file.dir;
3365
3424
  info(`Generating release notes \u2192 ${dir}`);
3366
3425
  try {
3367
- const { detectMonorepo } = await import("./aggregator-DYYIWNIK.js");
3426
+ const { detectMonorepo } = await import("./aggregator-FLRONORL.js");
3368
3427
  const nested = detectMonorepo(process.cwd()).isMonorepo || contexts.length > 1;
3369
3428
  const renderContent = (ctx) => {
3370
3429
  if (releaseNotesConfig.templates?.path) {
@@ -3428,7 +3487,7 @@ async function processInput(inputJson, config, dryRun, pipelineOptions) {
3428
3487
  return runPipeline(input, config, dryRun, pipelineOptions);
3429
3488
  }
3430
3489
  async function writeMonorepoFiles(contexts, config, dryRun, fileName, refs) {
3431
- const { detectMonorepo, writeMonorepoChangelogs } = await import("./aggregator-DYYIWNIK.js");
3490
+ const { detectMonorepo, writeMonorepoChangelogs } = await import("./aggregator-FLRONORL.js");
3432
3491
  const cwd = process.cwd();
3433
3492
  const detected = detectMonorepo(cwd);
3434
3493
  if (!detected.isMonorepo) {
@@ -3657,6 +3716,7 @@ export {
3657
3716
  saveAuth,
3658
3717
  NotesError,
3659
3718
  InputParseError,
3719
+ InputValidationError,
3660
3720
  TemplateError,
3661
3721
  LLMError,
3662
3722
  GitHubError,
@@ -4,7 +4,7 @@ import {
4
4
  prependVersions,
5
5
  renderMarkdown,
6
6
  success
7
- } from "./chunk-CBMVDKDR.js";
7
+ } from "./chunk-TNTTAFQ4.js";
8
8
 
9
9
  // src/monorepo/aggregator.ts
10
10
  import * as fs from "fs";
package/dist/cli.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createNotesCommand
4
- } from "./chunk-OTH3XXI4.js";
4
+ } from "./chunk-U5JUUEEQ.js";
5
5
  import {
6
6
  readPackageVersion
7
- } from "./chunk-CBMVDKDR.js";
7
+ } from "./chunk-TNTTAFQ4.js";
8
8
 
9
9
  // src/cli.ts
10
10
  import * as fs from "fs";
package/dist/index.d.ts CHANGED
@@ -84,6 +84,8 @@ interface VersionPackageUpdate {
84
84
  */
85
85
  previousVersion?: string;
86
86
  filePath: string;
87
+ /** Every manifest bumped in this directory, `filePath` included. Absent in older manifests. */
88
+ files?: string[];
87
89
  /** Absent when all packages share one tag. */
88
90
  tag?: string;
89
91
  /**
@@ -337,6 +339,10 @@ declare class InputParseError extends NotesError {
337
339
  readonly code = "INPUT_PARSE_ERROR";
338
340
  readonly suggestions: string[];
339
341
  }
342
+ declare class InputValidationError extends NotesError {
343
+ readonly code = "INPUT_VALIDATION_ERROR";
344
+ readonly suggestions: string[];
345
+ }
340
346
  declare class TemplateError extends NotesError {
341
347
  readonly code = "TEMPLATE_ERROR";
342
348
  readonly suggestions: string[];
@@ -361,7 +367,7 @@ declare class ConfigError extends NotesError {
361
367
  }
362
368
  declare function getExitCode(error: NotesError): number;
363
369
 
364
- declare function versionOutputToChangelogInput(data: VersionOutput): ChangelogInput;
370
+ declare function versionOutputToChangelogInput(data: Pick<VersionOutput, 'changelogs'>): ChangelogInput;
365
371
  declare function parseVersionOutput(json: string): ChangelogInput;
366
372
  declare function parseVersionOutputFile(filePath: string): ChangelogInput;
367
373
  declare function parseVersionOutputStdin(): Promise<ChangelogInput>;
@@ -396,5 +402,5 @@ declare function formatVersion(context: TemplateContext, options?: FormatVersion
396
402
  declare function renderMarkdown(contexts: TemplateContext[], options?: FormatVersionOptions): string;
397
403
  declare function writeMarkdown(outputPath: string, contexts: TemplateContext[], config: Config, dryRun: boolean, options?: FormatVersionOptions): void;
398
404
 
399
- export { ConfigError, GitHubError, InputParseError, LLMError, NotesError, TemplateError, aggregateToRoot, createTemplateContext, detectMonorepo, formatVersion, getDefaultConfig, getExitCode, loadAuth, loadConfig, parseVersionOutput, parseVersionOutputFile, parseVersionOutputStdin, processInput, renderJson, renderMarkdown, runPipeline, saveAuth, versionOutputToChangelogInput, writeJson, writeMarkdown, writeMonorepoChangelogs };
405
+ export { ConfigError, GitHubError, InputParseError, InputValidationError, LLMError, NotesError, TemplateError, aggregateToRoot, createTemplateContext, detectMonorepo, formatVersion, getDefaultConfig, getExitCode, loadAuth, loadConfig, parseVersionOutput, parseVersionOutputFile, parseVersionOutputStdin, processInput, renderJson, renderMarkdown, runPipeline, saveAuth, versionOutputToChangelogInput, writeJson, writeMarkdown, writeMonorepoChangelogs };
400
406
  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, UpdateStrategy };
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ import {
2
2
  ConfigError,
3
3
  GitHubError,
4
4
  InputParseError,
5
+ InputValidationError,
5
6
  LLMError,
6
7
  NotesError,
7
8
  TemplateError,
@@ -18,12 +19,12 @@ import {
18
19
  runPipeline,
19
20
  saveAuth,
20
21
  versionOutputToChangelogInput
21
- } from "./chunk-OTH3XXI4.js";
22
+ } from "./chunk-U5JUUEEQ.js";
22
23
  import {
23
24
  aggregateToRoot,
24
25
  detectMonorepo,
25
26
  writeMonorepoChangelogs
26
- } from "./chunk-KQQPQQSS.js";
27
+ } from "./chunk-YNGSEWF6.js";
27
28
  import {
28
29
  debug,
29
30
  formatVersion,
@@ -31,7 +32,7 @@ import {
31
32
  renderMarkdown,
32
33
  success,
33
34
  writeMarkdown
34
- } from "./chunk-CBMVDKDR.js";
35
+ } from "./chunk-TNTTAFQ4.js";
35
36
 
36
37
  // src/output/json.ts
37
38
  import * as fs from "fs";
@@ -72,6 +73,7 @@ export {
72
73
  ConfigError,
73
74
  GitHubError,
74
75
  InputParseError,
76
+ InputValidationError,
75
77
  LLMError,
76
78
  NotesError,
77
79
  TemplateError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@releasekit/notes",
3
- "version": "0.42.1",
3
+ "version": "0.43.0",
4
4
  "description": "Release notes and changelog generation with LLM-powered enhancement and flexible templating",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
File without changes