@releasekit/notes 0.5.0 → 0.6.1

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.
@@ -1461,6 +1461,21 @@ function renderTemplate(templatePath, context, engine) {
1461
1461
  }
1462
1462
 
1463
1463
  // src/core/pipeline.ts
1464
+ function findCompoundTagSepPos(tag) {
1465
+ let pos = tag.lastIndexOf("-");
1466
+ while (pos > 0) {
1467
+ const afterDash = pos + 1;
1468
+ if (tag.charCodeAt(afterDash) >= 48 && tag.charCodeAt(afterDash) <= 57) {
1469
+ let dots = 0;
1470
+ for (let i = afterDash; i < tag.length; i++) {
1471
+ if (tag[i] === ".") dots++;
1472
+ }
1473
+ if (dots >= 2) return pos;
1474
+ }
1475
+ pos = tag.lastIndexOf("-", pos - 1);
1476
+ }
1477
+ return -1;
1478
+ }
1464
1479
  function generateCompareUrl(repoUrl, from, to, packageName) {
1465
1480
  const isPackageSpecific = from.includes("@") && packageName && from.includes(packageName);
1466
1481
  let fromVersion;
@@ -1469,8 +1484,21 @@ function generateCompareUrl(repoUrl, from, to, packageName) {
1469
1484
  fromVersion = from;
1470
1485
  toVersion = `${packageName}@${to.startsWith("v") ? "" : "v"}${to}`;
1471
1486
  } else {
1472
- fromVersion = from.replace(/^v/, "");
1473
- toVersion = to.replace(/^v/, "");
1487
+ const toClean = to.replace(/^v/, "");
1488
+ const dashVPos = from.lastIndexOf("-v");
1489
+ if (dashVPos > 0 && from.charCodeAt(dashVPos + 2) >= 48 && from.charCodeAt(dashVPos + 2) <= 57) {
1490
+ fromVersion = from;
1491
+ toVersion = `${from.slice(0, dashVPos + 1)}v${toClean}`;
1492
+ } else {
1493
+ const sepPos = findCompoundTagSepPos(from);
1494
+ if (sepPos > 0) {
1495
+ fromVersion = from;
1496
+ toVersion = `${from.slice(0, sepPos + 1)}${toClean}`;
1497
+ } else {
1498
+ fromVersion = from.replace(/^v/, "");
1499
+ toVersion = toClean;
1500
+ }
1501
+ }
1474
1502
  }
1475
1503
  if (/gitlab\.com/i.test(repoUrl)) {
1476
1504
  return `${repoUrl}/-/compare/${fromVersion}...${toVersion}`;
@@ -1711,6 +1739,29 @@ async function runPipeline(input, config, dryRun) {
1711
1739
  packageNotes[ctx.packageName] = formatVersion(ctx);
1712
1740
  if (ctx.enhanced?.releaseNotes) {
1713
1741
  releaseNotesResult[ctx.packageName] = ctx.enhanced.releaseNotes;
1742
+ } else if (releaseNotesConfig) {
1743
+ if (releaseNotesConfig.templates?.path) {
1744
+ try {
1745
+ const templatePath = path7.resolve(releaseNotesConfig.templates.path);
1746
+ const docCtx = { ...createDocumentContext([ctx], void 0), perPackage: true };
1747
+ const rendered = renderTemplate(
1748
+ templatePath,
1749
+ docCtx,
1750
+ releaseNotesConfig.templates.engine
1751
+ );
1752
+ releaseNotesResult[ctx.packageName] = rendered.content;
1753
+ } catch (err) {
1754
+ warn(
1755
+ `Failed to render release notes template for ${ctx.packageName}: ${err instanceof Error ? err.message : String(err)}`
1756
+ );
1757
+ warn(`Release notes preview will not be available for ${ctx.packageName} in the workflow summary`);
1758
+ }
1759
+ } else {
1760
+ info(
1761
+ `No LLM release notes or template output for ${ctx.packageName}, using formatted changelog as release notes preview`
1762
+ );
1763
+ releaseNotesResult[ctx.packageName] = formatVersion(ctx);
1764
+ }
1714
1765
  }
1715
1766
  }
1716
1767
  return {
package/dist/cli.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  parseVersionOutput,
7
7
  runPipeline,
8
8
  saveAuth
9
- } from "./chunk-GWVZNYHL.js";
9
+ } from "./chunk-UCE7GRJL.js";
10
10
  import {
11
11
  EXIT_CODES,
12
12
  error,
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  processInput,
17
17
  runPipeline,
18
18
  saveAuth
19
- } from "./chunk-GWVZNYHL.js";
19
+ } from "./chunk-UCE7GRJL.js";
20
20
  import {
21
21
  aggregateToRoot,
22
22
  detectMonorepo,
package/docs/templates.md CHANGED
@@ -67,6 +67,8 @@ The outermost template (`document`) receives:
67
67
  | `project.repoUrl` | `string \| null` | Repository URL |
68
68
  | `versions` | `TemplateContext[]` | All rendered versions, newest first |
69
69
  | `unreleased` | `TemplateContext \| undefined` | Unreleased changes, if any |
70
+ | `compareUrls` | `Record<string, string> \| undefined` | Map of version → compare URL for all versions |
71
+ | `perPackage` | `boolean \| undefined` | `true` when rendered inline for a single package (e.g. GitHub release body). Use this to suppress document-level headings that are redundant when the content is embedded in a release that already shows the package name and version. |
70
72
 
71
73
  ### Version context
72
74
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@releasekit/notes",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
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",