Files
openchamber/scripts/changelog/release-notes.mjs
T
Bohdan Triapitsyn 3d2bcf7ed6 chore(changelog): retire CHANGELOG.md as a dependency
The update dialog (server and desktop) now reads changelog/index.json and
renders title, intro and groups; the release workflow builds the GitHub
Release body and name from changelog/<version>.md; oc-dev, the issue-intake
agent, AGENTS.md and the changelog skill no longer point at the file.

CHANGELOG.md stays as a legacy copy for installs up to 1.22.1, which fetch
it for update notes. The generator refreshes it while it exists and never
recreates it, so deleting it after 2026-09-19 retires it for good.

Generated outputs hold released versions only, so editing unreleased.md
never makes them stale: agents write that file and nothing else, and
oc-dev create-release does the generation.

Claude-Session: https://claude.ai/code/session_01VqV56Hez25hTxXH4ipJfzH
2026-09-05 17:02:28 +03:00

31 lines
1.2 KiB
JavaScript

#!/usr/bin/env node
// GitHub Release body and name for one version, from `changelog/<version>.md`.
//
// node scripts/changelog/release-notes.mjs 1.2.3 artifacts/release-notes.md
//
// Writes the body to the given file and prints the release title on stdout.
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { loadReleases, renderReleaseNotes } from './lib.mjs';
const [version, outFile] = process.argv.slice(2);
if (!version || !outFile) {
console.error('usage: release-notes.mjs <version> <out-file>');
process.exit(2);
}
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
try {
const { releases } = loadReleases(path.join(repoRoot, 'changelog'));
const release = releases.find((entry) => entry.version === version);
if (!release) throw new Error(`changelog/${version}.md not found; run "oc-dev create-release" before tagging`);
fs.mkdirSync(path.dirname(outFile), { recursive: true });
fs.writeFileSync(outFile, renderReleaseNotes(release));
process.stdout.write(`${release.title}\n`);
} catch (error) {
console.error(error instanceof Error ? error.message : String(error));
process.exit(1);
}