@releasekit/notes 0.20.0 → 0.21.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
@@ -19,9 +19,15 @@ Generates CHANGELOG.md and release notes from `@releasekit/version` output, with
19
19
 
20
20
  ## Installation
21
21
 
22
+ **npm:**
23
+
22
24
  ```bash
23
25
  npm install -g @releasekit/notes
24
- # or
26
+ ```
27
+
28
+ **pnpm:**
29
+
30
+ ```bash
25
31
  pnpm add -g @releasekit/notes
26
32
  ```
27
33
 
@@ -241,7 +241,9 @@ var LLMCategorySchema = z.object({
241
241
  });
242
242
  var ScopeRulesSchema = z.object({
243
243
  allowed: z.array(z.string()).optional(),
244
- caseSensitive: z.boolean().default(false)
244
+ caseSensitive: z.boolean().default(false),
245
+ invalidScopeAction: z.enum(["remove", "keep", "fallback"]).default("remove"),
246
+ fallbackScope: z.string().optional()
245
247
  });
246
248
  var ScopeConfigSchema = z.object({
247
249
  mode: z.enum(["restricted", "packages", "none", "unrestricted"]).default("unrestricted"),
@@ -305,9 +307,11 @@ var NotesConfigSchema = z.object({
305
307
  updateStrategy: z.enum(["prepend", "regenerate"]).optional()
306
308
  });
307
309
  var CILabelsConfigSchema = z.object({
308
- stable: z.string().default("release:stable"),
309
- prerelease: z.string().default("release:prerelease"),
310
+ stable: z.string().default("channel:stable"),
311
+ prerelease: z.string().default("channel:prerelease"),
310
312
  skip: z.string().default("release:skip"),
313
+ /** Bypass the standing PR for one merge — triggers a direct release. Standing-pr mode only. */
314
+ immediate: z.string().default("release:immediate"),
311
315
  major: z.string().default("bump:major"),
312
316
  minor: z.string().default("bump:minor"),
313
317
  patch: z.string().default("bump:patch")
@@ -322,8 +326,6 @@ var StandingPrConfigSchema = z.object({
322
326
  labels: z.array(z.string()).default(["release"]),
323
327
  /** Whether to auto-delete the release branch after PR merge. Default: true */
324
328
  deleteBranchOnMerge: z.boolean().default(true),
325
- /** Allow teams to edit the release notes section in the PR body before publishing. Default: false */
326
- editableNotes: z.boolean().default(false),
327
329
  /** Merge method to use when merging the standing release PR. Default: 'merge' */
328
330
  mergeMethod: z.enum(["merge", "squash", "rebase"]).default("merge"),
329
331
  /** 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. */
@@ -332,7 +334,7 @@ var StandingPrConfigSchema = z.object({
332
334
  minPackages: z.number().int().positive().optional()
333
335
  });
334
336
  var CIConfigSchema = z.object({
335
- releaseStrategy: z.enum(["manual", "direct", "standing-pr", "scheduled"]).default("direct"),
337
+ releaseStrategy: z.enum(["manual", "direct", "standing-pr"]).default("direct"),
336
338
  releaseTrigger: z.enum(["commit", "label"]).default("label"),
337
339
  prPreview: z.boolean().default(true),
338
340
  autoRelease: z.boolean().default(false),
@@ -345,9 +347,10 @@ var CIConfigSchema = z.object({
345
347
  skipPatterns: z.array(z.string()).default(["chore: release "]),
346
348
  minChanges: z.number().int().positive().default(1),
347
349
  labels: CILabelsConfigSchema.default({
348
- stable: "release:stable",
349
- prerelease: "release:prerelease",
350
+ stable: "channel:stable",
351
+ prerelease: "channel:prerelease",
350
352
  skip: "release:skip",
353
+ immediate: "release:immediate",
351
354
  major: "bump:major",
352
355
  minor: "bump:minor",
353
356
  patch: "bump:patch"
@@ -690,8 +693,14 @@ async function fetchPullRequestContext(owner, repo, issueNumbers, token, cache)
690
693
  const body = truncateBody(sanitiseBody(raw));
691
694
  cache.set(number, { number, title: data.title, body });
692
695
  } catch (error2) {
693
- if (error2 instanceof RequestError && (error2.status === 401 || error2.status === 403)) {
694
- warn(`GitHub API auth error fetching PR #${number} (${error2.status}): check GITHUB_TOKEN permissions`);
696
+ if (error2 instanceof RequestError) {
697
+ if (error2.status === 401 || error2.status === 403) {
698
+ warn(`GitHub API auth error fetching PR #${number} (${error2.status}): check GITHUB_TOKEN permissions`);
699
+ } else if (error2.status === 404) {
700
+ cache.set(number, null);
701
+ } else {
702
+ debug(`Failed to fetch PR #${number}: ${error2.message}`);
703
+ }
695
704
  } else {
696
705
  debug(`Failed to fetch PR #${number}: ${error2 instanceof Error ? error2.message : String(error2)}`);
697
706
  }
@@ -701,7 +710,7 @@ async function fetchPullRequestContext(owner, repo, issueNumbers, token, cache)
701
710
  }
702
711
  }
703
712
  function parseIssueNumbers(issueIds) {
704
- return issueIds.map((id) => parseInt(id.replace(/^#/, ""), 10)).filter((n) => !isNaN(n) && n > 0);
713
+ return issueIds.map((id) => parseInt(id.replace(/^#/, ""), 10)).filter((n) => !Number.isNaN(n) && n > 0);
705
714
  }
706
715
  function resolveGitHubToken() {
707
716
  return process.env.GITHUB_TOKEN || process.env.GH_TOKEN || void 0;
@@ -1308,7 +1317,14 @@ function validateEntryScopes(entries, scopeConfig, categories) {
1308
1317
  const allowedScopes = resolveAllowedScopes(scopeConfig, categories);
1309
1318
  if (allowedScopes === null) return { valid: true, entries, errors: [] };
1310
1319
  const caseSensitive = scopeConfig?.rules?.caseSensitive ?? false;
1320
+ const action = scopeConfig?.rules?.invalidScopeAction ?? "remove";
1321
+ const fallback = scopeConfig?.rules?.fallbackScope;
1311
1322
  const errors = [];
1323
+ if (action === "fallback" && fallback !== void 0 && validateScope(fallback, allowedScopes, caseSensitive) === void 0) {
1324
+ warn(
1325
+ `scopes.rules.fallbackScope "${fallback}" is not in the allowed scope list (${allowedScopes.length ? allowedScopes.join(", ") : "<empty>"}); substituted scopes will violate the allow-list. Add "${fallback}" to the allow list or change invalidScopeAction.`
1326
+ );
1327
+ }
1312
1328
  const validatedEntries = entries.map((entry, index) => {
1313
1329
  const cleaned = validateScope(entry.scope, allowedScopes, caseSensitive);
1314
1330
  if (entry.scope && cleaned === void 0) {
@@ -1317,11 +1333,12 @@ function validateEntryScopes(entries, scopeConfig, categories) {
1317
1333
  providedScope: entry.scope,
1318
1334
  allowedScopes
1319
1335
  });
1320
- return { ...entry, scope: void 0 };
1336
+ const replacement = action === "keep" ? entry.scope : action === "fallback" ? fallback : void 0;
1337
+ return { ...entry, scope: replacement };
1321
1338
  }
1322
1339
  return entry.scope !== cleaned ? { ...entry, scope: cleaned } : entry;
1323
1340
  });
1324
- return { valid: errors.length === 0, entries: validatedEntries, errors };
1341
+ return { valid: true, entries: validatedEntries, errors };
1325
1342
  }
1326
1343
 
1327
1344
  // src/llm/tasks/shared.ts
@@ -1434,11 +1451,11 @@ function makeValidator(entries, context) {
1434
1451
  return scope ? { ...entry, scope } : entry;
1435
1452
  });
1436
1453
  const scopeResult = validateEntryScopes(withScopes, context.scopes, context.categories);
1437
- if (!scopeResult.valid) {
1438
- const msg = scopeResult.errors.map(
1439
- (e) => `entry ${e.entryIndex} scope "${e.providedScope}" (${e.allowedScopes.length ? `valid: ${e.allowedScopes.join(", ")}` : "no scopes permitted"})`
1440
- ).join("; ");
1441
- return { valid: false, error: `Invalid scopes: ${msg}` };
1454
+ if (scopeResult.errors.length > 0) {
1455
+ const offenders = [...new Set(scopeResult.errors.map((e) => e.providedScope))];
1456
+ warn(
1457
+ `LLM returned ${scopeResult.errors.length} entries with disallowed scopes (${offenders.join(", ")}); resolved per invalidScopeAction.`
1458
+ );
1442
1459
  }
1443
1460
  return { valid: true, value: groupByCategory(zodResult.data.entries, scopeResult.entries) };
1444
1461
  };
@@ -1623,11 +1640,11 @@ function makeValidator2(entries, context) {
1623
1640
  };
1624
1641
  });
1625
1642
  const scopeResult = validateEntryScopes(enhancedEntries, context.scopes, context.categories);
1626
- if (!scopeResult.valid) {
1627
- const msg = scopeResult.errors.map(
1628
- (e) => `entry ${e.entryIndex} scope "${e.providedScope}" (${e.allowedScopes.length ? `valid: ${e.allowedScopes.join(", ")}` : "no scopes permitted"})`
1629
- ).join("; ");
1630
- return { valid: false, error: `Invalid scopes: ${msg}` };
1643
+ if (scopeResult.errors.length > 0) {
1644
+ const offenders = [...new Set(scopeResult.errors.map((e) => e.providedScope))];
1645
+ warn(
1646
+ `LLM returned ${scopeResult.errors.length} entries with disallowed scopes (${offenders.join(", ")}); resolved per invalidScopeAction.`
1647
+ );
1631
1648
  }
1632
1649
  const categories = groupByCategory(zodResult.data.entries, scopeResult.entries);
1633
1650
  return {
@@ -2278,13 +2295,13 @@ async function generateWithTemplate(contexts, templatesConfig, outputPath, repoU
2278
2295
  const label = /changelog/i.test(outputPath) ? "Changelog" : "Release notes";
2279
2296
  success(`${label} written to ${outputPath} (using ${result.engine} template)`);
2280
2297
  }
2281
- async function runPipeline(input, config, dryRun) {
2298
+ async function runPipeline(input, config, dryRun, pipelineOptions) {
2282
2299
  debug(`Processing ${input.packages.length} package(s)`);
2283
2300
  let contexts = input.packages.map(createTemplateContext);
2284
2301
  const changelogConfig = config.changelog === false ? false : { mode: "root", ...config.changelog ?? {} };
2285
2302
  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;
2286
2303
  const llmConfig = releaseNotesConfig?.llm;
2287
- if (llmConfig && !process.env.CHANGELOG_NO_LLM) {
2304
+ if (llmConfig && !process.env.CHANGELOG_NO_LLM && !pipelineOptions?.skipReleaseNotes) {
2288
2305
  info("Processing with LLM enhancement");
2289
2306
  const examplesCount = llmConfig.examples ?? 3;
2290
2307
  const repoUrl = contexts[0]?.repoUrl ?? input.metadata?.repoUrl;
@@ -2343,7 +2360,7 @@ async function runPipeline(input, config, dryRun) {
2343
2360
  categoryOrder: llmConfig?.categoryOrder,
2344
2361
  links: releaseNotesConfig?.links
2345
2362
  };
2346
- if (changelogConfig !== false && changelogConfig.mode) {
2363
+ if (!pipelineOptions?.skipChangelogs && changelogConfig !== false && changelogConfig.mode) {
2347
2364
  const fileName = changelogConfig.file ?? "CHANGELOG.md";
2348
2365
  const mode = changelogConfig.mode;
2349
2366
  info(`Generating changelog \u2192 ${fileName}`);
@@ -2370,7 +2387,7 @@ async function runPipeline(input, config, dryRun) {
2370
2387
  warn(`Failed to write changelog: ${error2 instanceof Error ? error2.message : String(error2)}`);
2371
2388
  }
2372
2389
  }
2373
- if (releaseNotesConfig?.mode) {
2390
+ if (!pipelineOptions?.skipReleaseNotes && releaseNotesConfig?.mode) {
2374
2391
  const fileName = releaseNotesConfig.file ?? "RELEASE_NOTES.md";
2375
2392
  const mode = releaseNotesConfig.mode;
2376
2393
  info(`Generating release notes \u2192 ${fileName}`);
@@ -2406,6 +2423,9 @@ async function runPipeline(input, config, dryRun) {
2406
2423
  const releaseNotesResult = {};
2407
2424
  for (const ctx of contexts) {
2408
2425
  packageNotes[ctx.packageName] = formatVersion(ctx);
2426
+ if (pipelineOptions?.skipReleaseNotes) {
2427
+ continue;
2428
+ }
2409
2429
  if (ctx.enhanced?.releaseNotes) {
2410
2430
  releaseNotesResult[ctx.packageName] = ctx.enhanced.releaseNotes;
2411
2431
  } else if (releaseNotesConfig) {
@@ -2439,9 +2459,9 @@ async function runPipeline(input, config, dryRun) {
2439
2459
  releaseNotes: Object.keys(releaseNotesResult).length > 0 ? releaseNotesResult : void 0
2440
2460
  };
2441
2461
  }
2442
- async function processInput(inputJson, config, dryRun) {
2462
+ async function processInput(inputJson, config, dryRun, pipelineOptions) {
2443
2463
  const input = parseVersionOutput(inputJson);
2444
- return runPipeline(input, config, dryRun);
2464
+ return runPipeline(input, config, dryRun, pipelineOptions);
2445
2465
  }
2446
2466
  async function writeMonorepoFiles(contexts, config, dryRun, fileName) {
2447
2467
  const { detectMonorepo, writeMonorepoChangelogs } = await import("./aggregator-GXJXPM7O.js");
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createNotesCommand
4
- } from "./chunk-UWUSIQSW.js";
4
+ } from "./chunk-VLRGPIOB.js";
5
5
  import {
6
6
  readPackageVersion
7
7
  } from "./chunk-QCJ545PJ.js";
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { createNotesCommand } from './command.ts';
2
2
  export { getDefaultConfig, loadAuth, loadConfig, saveAuth } from './core/config.ts';
3
- export { PipelineResult, createTemplateContext, processInput, runPipeline } from './core/pipeline.ts';
3
+ export { PipelineOptions, PipelineResult, createTemplateContext, processInput, runPipeline } from './core/pipeline.ts';
4
4
  export * from './core/types.ts';
5
5
  export * from './errors/index.ts';
6
6
  export { parseVersionOutput, parseVersionOutputFile, parseVersionOutputStdin, versionOutputToChangelogInput } from './input/version-output.ts';
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  runPipeline,
19
19
  saveAuth,
20
20
  versionOutputToChangelogInput
21
- } from "./chunk-UWUSIQSW.js";
21
+ } from "./chunk-VLRGPIOB.js";
22
22
  import {
23
23
  aggregateToRoot,
24
24
  detectMonorepo,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@releasekit/notes",
3
- "version": "0.20.0",
3
+ "version": "0.21.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",
@@ -47,7 +47,7 @@
47
47
  "access": "public"
48
48
  },
49
49
  "dependencies": {
50
- "@anthropic-ai/sdk": "^0.86.0",
50
+ "@anthropic-ai/sdk": "^0.93.0",
51
51
  "@octokit/request-error": "^7.1.0",
52
52
  "@octokit/rest": "^22.0.1",
53
53
  "chalk": "^5.6.2",
@@ -56,18 +56,18 @@
56
56
  "handlebars": "^4.7.9",
57
57
  "liquidjs": "^10.25.7",
58
58
  "minimatch": "^10.0.0",
59
- "openai": "^6.33.0",
59
+ "openai": "^6.36.0",
60
60
  "smol-toml": "^1.6.1",
61
- "zod": "^4.3.6"
61
+ "zod": "^4.4.3"
62
62
  },
63
63
  "devDependencies": {
64
- "@biomejs/biome": "^2.4.10",
64
+ "@biomejs/biome": "^2.4.14",
65
65
  "@types/ejs": "^3.1.5",
66
66
  "@types/node": "^22.19.17",
67
- "@vitest/coverage-v8": "^4.1.3",
67
+ "@vitest/coverage-v8": "^4.1.5",
68
68
  "tsup": "^8.5.1",
69
69
  "typescript": "^5.9.3",
70
- "vitest": "^4.1.3",
70
+ "vitest": "^4.1.5",
71
71
  "@releasekit/config": "0.0.0",
72
72
  "@releasekit/core": "0.0.0"
73
73
  },