@releasekit/notes 0.46.0 → 0.46.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.
@@ -467,7 +467,7 @@ var LLMConfigBaseSchema = z.strictObject({
467
467
  "Number of the project's past GitHub Releases (0\u20135) used as style examples in the combined enhance and categorize prompt and the releaseNotes prompt. Needs GITHUB_TOKEN or GH_TOKEN."
468
468
  ),
469
469
  context: z.strictObject({
470
- pullRequests: z.boolean().default(true).describe("Fetch the title and body of each entry's linked PR as LLM context. Needs GITHUB_TOKEN or GH_TOKEN.")
470
+ pullRequests: z.boolean().default(true).describe("Fetch the title and body of each entry's own PR as LLM context. Needs GITHUB_TOKEN or GH_TOKEN.")
471
471
  }).default({ pullRequests: true }).describe("Additional context sources for the LLM."),
472
472
  categoryOrder: z.array(z.string()).optional().describe(
473
473
  "Order of the rendered categories. Listed ones come first; the rest keep their order in categories, except Breaking, which stays first unless listed."
@@ -501,7 +501,7 @@ var ReleaseNotesConfigSchema = z.strictObject({
501
501
  })
502
502
  ).optional().describe("Static links, each { label, url }, listed first."),
503
503
  fromPRBodyMarker: z.string().optional().describe(
504
- "Also collect links from linked PR bodies: each line starting with this marker adds its markdown link or bare URL, skipping URLs already listed. Needs llm.context.pullRequests."
504
+ "Also collect links from each entry's own PR body: each line starting with this marker adds its markdown link or bare URL, skipping URLs already listed. Needs llm.context.pullRequests."
505
505
  ),
506
506
  title: z.string().optional().describe("Heading for the links section. Default: Links.")
507
507
  }).optional().describe(
@@ -3225,6 +3225,9 @@ async function withRetry(fn, options = {}) {
3225
3225
  }
3226
3226
 
3227
3227
  // src/core/pipeline.ts
3228
+ function ownPrNumber(entry) {
3229
+ return entry.prNumber ? parseIssueNumbers([entry.prNumber])[0] : void 0;
3230
+ }
3228
3231
  function findCompoundTagSepPos(tag) {
3229
3232
  let pos = tag.lastIndexOf("-");
3230
3233
  while (pos > 0) {
@@ -3523,19 +3526,17 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
3523
3526
  const prCache = /* @__PURE__ */ new Map();
3524
3527
  const pullRequestsEnabled = llmConfig.context?.pullRequests !== false;
3525
3528
  if (pullRequestsEnabled && ownerRepo) {
3526
- const allIssueNumbers = [
3527
- ...new Set(
3528
- releaseNotesContexts.flatMap((ctx) => ctx.entries.flatMap((e) => parseIssueNumbers(e.issueIds ?? [])))
3529
- )
3529
+ const allPrNumbers = [
3530
+ ...new Set(releaseNotesContexts.flatMap((ctx) => ctx.entries.flatMap((e) => ownPrNumber(e) ?? [])))
3530
3531
  ];
3531
- if (allIssueNumbers.length > 0) {
3532
+ if (allPrNumbers.length > 0) {
3532
3533
  const token = resolveGitHubToken();
3533
3534
  if (!token) {
3534
3535
  warn("No GitHub token available \u2014 skipping PR context fetch (set GITHUB_TOKEN to enable)");
3535
3536
  } else {
3536
- debug(`Fetching PR context for ${allIssueNumbers.length} issue(s)`);
3537
- await fetchPullRequestContext(ownerRepo.owner, ownerRepo.repo, allIssueNumbers, token, prCache);
3538
- debug(`Loaded PR context for ${prCache.size} issue(s)`);
3537
+ debug(`Fetching PR context for ${allPrNumbers.length} PR(s)`);
3538
+ await fetchPullRequestContext(ownerRepo.owner, ownerRepo.repo, allPrNumbers, token, prCache);
3539
+ debug(`Loaded PR context for ${prCache.size} PR(s)`);
3539
3540
  }
3540
3541
  }
3541
3542
  }
@@ -3543,8 +3544,9 @@ async function runPipeline(input, config, dryRun, pipelineOptions) {
3543
3544
  releaseNotesContexts = releaseNotesContexts.map((ctx) => ({
3544
3545
  ...ctx,
3545
3546
  entries: ctx.entries.map((entry) => {
3546
- const prs = parseIssueNumbers(entry.issueIds ?? []).map((n) => prCache.get(n)).filter((pr) => pr != null);
3547
- return prs.length > 0 ? { ...entry, context: { prs } } : entry;
3547
+ const number = ownPrNumber(entry);
3548
+ const pr = number === void 0 ? void 0 : prCache.get(number);
3549
+ return pr ? { ...entry, context: { prs: [pr] } } : entry;
3548
3550
  })
3549
3551
  }));
3550
3552
  }
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createNotesCommand
4
- } from "./chunk-JOA56Y7A.js";
4
+ } from "./chunk-RGY5RDF2.js";
5
5
  import {
6
6
  readPackageVersion
7
7
  } from "./chunk-EI7LLVJN.js";
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  saveAuth,
22
22
  versionOutputToChangelogInput,
23
23
  writeVersionedNotes
24
- } from "./chunk-JOA56Y7A.js";
24
+ } from "./chunk-RGY5RDF2.js";
25
25
  import {
26
26
  aggregateToRoot,
27
27
  debug,
@@ -265,7 +265,7 @@ Invalid scopes trigger a corrective retry — the LLM is told which scopes are v
265
265
 
266
266
  ## PR body context (`context.pullRequests`)
267
267
 
268
- When `context.pullRequests` is `true` (the default), the pipeline fetches the body of each linked pull request from GitHub and includes it in the LLM prompt. This gives the LLM additional context — PR descriptions, linked issues, migration notes — for writing accurate enhanced entries.
268
+ When `context.pullRequests` is `true` (the default), the pipeline fetches the body of each entry's own pull request (the `(#N)` on a squash-merge subject) and includes it in the LLM prompt. This gives the LLM additional context — PR descriptions, linked issues, migration notes — for writing accurate enhanced entries.
269
269
 
270
270
  Requires `GITHUB_TOKEN` or `GH_TOKEN`. If no token is available, PR fetching is silently skipped and a warning is logged.
271
271
 
@@ -316,7 +316,7 @@ The built-in renderer can append a links section at the bottom of each release.
316
316
  Two sources of links can be combined:
317
317
 
318
318
  - **`items`** — static label/URL pairs hardcoded in config
319
- - **`fromPRBodyMarker`** — scans all linked PR bodies for lines starting with the marker string and extracts markdown links or bare URLs from them
319
+ - **`fromPRBodyMarker`** — scans each entry's own PR body for lines starting with the marker string and extracts markdown links or bare URLs from them
320
320
 
321
321
  ```json
322
322
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@releasekit/notes",
3
- "version": "0.46.0",
3
+ "version": "0.46.1",
4
4
  "description": "Changelog and release notes generation with flexible templating and optional LLM-enhanced release notes",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",