@releasekit/notes 0.10.3 → 0.11.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
@@ -180,6 +180,58 @@ releasekit-notes --changelog-mode both
180
180
 
181
181
  See **[Monorepo guide](./docs/monorepo.md)** for details on file placement and aggregation behaviour.
182
182
 
183
+ ## Programmatic API
184
+
185
+ `@releasekit/notes` can be used as a library in Node.js code.
186
+
187
+ ### With a `VersionOutput` object (recommended)
188
+
189
+ When integrating with `@releasekit/version` programmatically, pass the typed output directly — no JSON round-trip needed:
190
+
191
+ ```ts
192
+ import { versionOutputToChangelogInput, runPipeline, loadConfig } from '@releasekit/notes';
193
+ import type { VersionOutput } from '@releasekit/version';
194
+
195
+ // versionOutput comes from getJsonData() after running VersionEngine
196
+ const input = versionOutputToChangelogInput(versionOutput);
197
+
198
+ const config = loadConfig('/path/to/project');
199
+ const result = await runPipeline(input, config, /* dryRun */ false);
200
+
201
+ // result.packageNotes — per-package rendered markdown, keyed by package name
202
+ // result.releaseNotes — per-package release notes (when configured)
203
+ // result.files — file paths written to disk
204
+ ```
205
+
206
+ ### From JSON
207
+
208
+ When reading version output from a file or stdin:
209
+
210
+ ```ts
211
+ import {
212
+ parseVersionOutput, // from a JSON string
213
+ parseVersionOutputFile, // from a file path
214
+ parseVersionOutputStdin, // from stdin
215
+ runPipeline,
216
+ loadConfig,
217
+ } from '@releasekit/notes';
218
+
219
+ const input = parseVersionOutputFile('./version-output.json');
220
+ const config = loadConfig();
221
+ const result = await runPipeline(input, config, false);
222
+ ```
223
+
224
+ ### Key exports
225
+
226
+ | Export | Description |
227
+ |--------|-------------|
228
+ | `versionOutputToChangelogInput(data)` | Transform a `VersionOutput` to `ChangelogInput` directly |
229
+ | `parseVersionOutput(json)` | Parse a JSON string into `ChangelogInput` |
230
+ | `parseVersionOutputFile(path)` | Read a file and parse it into `ChangelogInput` |
231
+ | `parseVersionOutputStdin()` | Read stdin and parse it into `ChangelogInput` |
232
+ | `runPipeline(input, config, dryRun)` | Run the full notes pipeline (templates, LLM, file writes) |
233
+ | `loadConfig(projectDir?, configFile?)` | Load `notes` config from `releasekit.config.json` |
234
+
183
235
  ## Documentation
184
236
 
185
237
  **Getting Started**
@@ -516,13 +516,7 @@ function normalizeEntryType(type) {
516
516
  };
517
517
  return typeMap[type.toLowerCase()] ?? "changed";
518
518
  }
519
- function parseVersionOutput(json) {
520
- let data;
521
- try {
522
- data = JSON.parse(json);
523
- } catch (error2) {
524
- throw new InputParseError(`Invalid JSON input: ${error2 instanceof Error ? error2.message : String(error2)}`);
525
- }
519
+ function versionOutputToChangelogInput(data) {
526
520
  if (!data.changelogs || !Array.isArray(data.changelogs)) {
527
521
  throw new InputParseError('Input must contain a "changelogs" array');
528
522
  }
@@ -551,6 +545,15 @@ function parseVersionOutput(json) {
551
545
  }
552
546
  };
553
547
  }
548
+ function parseVersionOutput(json) {
549
+ let data;
550
+ try {
551
+ data = JSON.parse(json);
552
+ } catch (error2) {
553
+ throw new InputParseError(`Invalid JSON input: ${error2 instanceof Error ? error2.message : String(error2)}`);
554
+ }
555
+ return versionOutputToChangelogInput(data);
556
+ }
554
557
  function parseVersionOutputFile(filePath) {
555
558
  const content = fs4.readFileSync(filePath, "utf-8");
556
559
  return parseVersionOutput(content);
@@ -2012,6 +2015,7 @@ export {
2012
2015
  GitHubError,
2013
2016
  ConfigError2 as ConfigError,
2014
2017
  getExitCode,
2018
+ versionOutputToChangelogInput,
2015
2019
  parseVersionOutput,
2016
2020
  parseVersionOutputFile,
2017
2021
  parseVersionOutputStdin,
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createNotesCommand
4
- } from "./chunk-R6IWJNYC.js";
4
+ } from "./chunk-KLSAU45H.js";
5
5
  import {
6
6
  readPackageVersion
7
7
  } from "./chunk-7TJSPQPW.js";
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { getDefaultConfig, loadAuth, loadConfig, saveAuth } from './core/config.
3
3
  export { PipelineResult, createTemplateContext, processInput, runPipeline } from './core/pipeline.ts';
4
4
  export * from './core/types.ts';
5
5
  export * from './errors/index.ts';
6
- export { parseVersionOutput, parseVersionOutputFile, parseVersionOutputStdin } from './input/version-output.ts';
6
+ export { parseVersionOutput, parseVersionOutputFile, parseVersionOutputStdin, versionOutputToChangelogInput } from './input/version-output.ts';
7
7
  export { aggregateToRoot, detectMonorepo, writeMonorepoChangelogs } from './monorepo/aggregator.ts';
8
8
  export { renderJson, writeJson } from './output/json.ts';
9
9
  export { formatVersion, renderMarkdown, writeMarkdown } from './output/markdown.ts';
package/dist/index.js CHANGED
@@ -16,8 +16,9 @@ import {
16
16
  parseVersionOutputStdin,
17
17
  processInput,
18
18
  runPipeline,
19
- saveAuth
20
- } from "./chunk-R6IWJNYC.js";
19
+ saveAuth,
20
+ versionOutputToChangelogInput
21
+ } from "./chunk-KLSAU45H.js";
21
22
  import {
22
23
  aggregateToRoot,
23
24
  detectMonorepo,
@@ -91,6 +92,7 @@ export {
91
92
  renderMarkdown,
92
93
  runPipeline,
93
94
  saveAuth,
95
+ versionOutputToChangelogInput,
94
96
  writeJson,
95
97
  writeMarkdown,
96
98
  writeMonorepoChangelogs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@releasekit/notes",
3
- "version": "0.10.3",
3
+ "version": "0.11.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",
@@ -66,8 +66,8 @@
66
66
  "tsup": "^8.5.1",
67
67
  "typescript": "^5.9.3",
68
68
  "vitest": "^4.1.2",
69
- "@releasekit/config": "0.0.0",
70
- "@releasekit/core": "0.0.0"
69
+ "@releasekit/core": "0.0.0",
70
+ "@releasekit/config": "0.0.0"
71
71
  },
72
72
  "engines": {
73
73
  "node": ">=20"