Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(release): generate release notes from conventional commits

Steven Enamakeld59c042cc847
diff --git a/scripts/__tests__/generate-release-notes.test.mjs b/scripts/__tests__/generate-release-notes.test.mjs
index c8f1228e0f..37851b3fca 100644
--- a/scripts/__tests__/generate-release-notes.test.mjs
+++ b/scripts/__tests__/generate-release-notes.test.mjs
@@ -1,9 +1,9 @@
-import assert from 'node:assert/strict';
-import { execFileSync } from 'node:child_process';
-import { mkdtempSync, rmSync } from 'node:fs';
-import { tmpdir } from 'node:os';
-import { join } from 'node:path';
-import { test } from 'node:test';
+import assert from "node:assert/strict";
+import { execFileSync } from "node:child_process";
+import { mkdtempSync, rmSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { test } from "node:test";
import {
buildOpenAiRequest,
@@ -18,164 +18,247 @@ import {
parseGitHubRepoFromRemote,
parseGitLog,
renderDeterministicNotes,
-} from '../release/generate-release-notes.mjs';
+} from "../release/generate-release-notes.mjs";
-test('release notes args default to the latest GitHub release as the start ref', () => {
- assert.equal(parseArgs([]).from, 'latest-release');
+test("release notes args default to the latest GitHub release as the start ref", () => {
+ assert.equal(parseArgs([]).from, "latest-release");
- const parsed = parseArgs(['--from', 'v1.0.0', '--to', 'main', '--no-ai']);
- assert.equal(parsed.from, 'v1.0.0');
- assert.equal(parsed.to, 'main');
+ const parsed = parseArgs(["--from", "v1.0.0", "--to", "main", "--no-ai"]);
+ assert.equal(parsed.from, "v1.0.0");
+ assert.equal(parsed.to, "main");
assert.equal(parsed.noAi, true);
assert.equal(parsed.maxPrs, undefined);
});
-test('GitHub repo is inferred from ssh and https remotes', () => {
- assert.equal(parseGitHubRepoFromRemote('[email protected]:tinyhumansai/openhuman.git'), 'tinyhumansai/openhuman');
- assert.equal(parseGitHubRepoFromRemote('https://github.com/tinyhumansai/openhuman.git'), 'tinyhumansai/openhuman');
+test("GitHub repo is inferred from ssh and https remotes", () => {
+ assert.equal(
+ parseGitHubRepoFromRemote("[email protected]:tinyhumansai/openhuman.git"),
+ "tinyhumansai/openhuman",
+ );
+ assert.equal(
+ parseGitHubRepoFromRemote("https://github.com/tinyhumansai/openhuman.git"),
+ "tinyhumansai/openhuman",
+ );
});
-test('pull request numbers preserve all linked PRs and pick the last as primary', () => {
- assert.deepEqual(extractPullRequestNumbers('feat(voice): global push-to-talk hotkey (#3090) (#3349)'), [
- 3090,
- 3349,
- ]);
+test("pull request numbers preserve all linked PRs and pick the last as primary", () => {
+ assert.deepEqual(
+ extractPullRequestNumbers(
+ "feat(voice): global push-to-talk hotkey (#3090) (#3349)",
+ ),
+ [3090, 3349],
+ );
const [commit] = parseGitLog(
- 'abc123def456\x1ffeat(voice): global push-to-talk hotkey (#3090) (#3349)\x1fCodeGhost21\[email protected]\x1f2026-06-01T00:00:00Z\x1e',
+ "abc123def456\x1ffeat(voice): global push-to-talk hotkey (#3090) (#3349)\x1fCodeGhost21\[email protected]\x1f2026-06-01T00:00:00Z\x1e",
);
assert.equal(commit.primaryPrNumber, 3349);
- assert.deepEqual(extractPullRequestNumbers('Merge pull request #6638 from contributor/feature'), [6638]);
+ assert.deepEqual(
+ extractPullRequestNumbers(
+ "Merge pull request #6638 from contributor/feature",
+ ),
+ [6638],
+ );
});
-test('release notes collect only first-parent pull request merges', async (t) => {
- const repo = mkdtempSync(join(tmpdir(), 'release-notes-merges-'));
+test("release notes collect only first-parent pull request merges", async (t) => {
+ const repo = mkdtempSync(join(tmpdir(), "release-notes-merges-"));
t.after(() => rmSync(repo, { recursive: true, force: true }));
- const git = (...args) => execFileSync('git', args, {
- cwd: repo,
- encoding: 'utf8',
- env: {
- ...process.env,
- GIT_CONFIG_GLOBAL: '/dev/null',
- GIT_CONFIG_SYSTEM: '/dev/null',
- GIT_MERGE_AUTOEDIT: 'no',
- },
- });
- git('init', '--quiet', '--initial-branch', 'main');
- git('config', 'user.name', 'Range Fixture');
- git('config', 'user.email', '[email protected]');
- git('config', 'commit.gpgsign', 'false');
- git('config', 'tag.gpgSign', 'false');
- git('commit', '--allow-empty', '--quiet', '-m', 'base');
- git('tag', 'start');
- git('switch', '--quiet', '-c', 'feature');
- git('commit', '--allow-empty', '--quiet', '-m', 'feat: branch change (#100)');
- git('switch', '--quiet', '-c', 'nested-feature');
- git('commit', '--allow-empty', '--quiet', '-m', 'feat: nested branch change (#99)');
- git('switch', '--quiet', 'feature');
- git('merge', '--quiet', '--no-ff', '-m', 'Merge pull request #99 from contributor/nested-feature', 'nested-feature');
- git('switch', '--quiet', 'main');
- git('merge', '--quiet', '--no-ff', '-m', 'Merge pull request #100 from contributor/feature', 'feature');
- git('commit', '--allow-empty', '--quiet', '-m', 'chore: direct change (#101)');
- git('switch', '--quiet', '-c', 'nested');
- git('commit', '--allow-empty', '--quiet', '-m', 'feat: nested change (#102)');
- git('switch', '--quiet', 'main');
- git('merge', '--quiet', '--no-ff', '-m', 'Merge branch nested', 'nested');
- git('tag', 'end');
+ const git = (...args) =>
+ execFileSync("git", args, {
+ cwd: repo,
+ encoding: "utf8",
+ env: {
+ ...process.env,
+ GIT_CONFIG_GLOBAL: "/dev/null",
+ GIT_CONFIG_SYSTEM: "/dev/null",
+ GIT_MERGE_AUTOEDIT: "no",
+ },
+ });
+ git("init", "--quiet", "--initial-branch", "main");
+ git("config", "user.name", "Range Fixture");
+ git("config", "user.email", "[email protected]");
+ git("config", "commit.gpgsign", "false");
+ git("config", "tag.gpgSign", "false");
+ git("commit", "--allow-empty", "--quiet", "-m", "base");
+ git("tag", "start");
+ git("switch", "--quiet", "-c", "feature");
+ git("commit", "--allow-empty", "--quiet", "-m", "feat: branch change (#100)");
+ git("switch", "--quiet", "-c", "nested-feature");
+ git(
+ "commit",
+ "--allow-empty",
+ "--quiet",
+ "-m",
+ "feat: nested branch change (#99)",
+ );
+ git("switch", "--quiet", "feature");
+ git(
+ "merge",
+ "--quiet",
+ "--no-ff",
+ "-m",
+ "Merge pull request #99 from contributor/nested-feature",
+ "nested-feature",
+ );
+ git("switch", "--quiet", "main");
+ git(
+ "merge",
+ "--quiet",
+ "--no-ff",
+ "-m",
+ "Merge pull request #100 from contributor/feature",
+ "feature",
+ );
+ git(
+ "commit",
+ "--allow-empty",
+ "--quiet",
+ "-m",
+ "chore: direct change (#101)",
+ );
+ git("switch", "--quiet", "-c", "nested");
+ git("commit", "--allow-empty", "--quiet", "-m", "feat: nested change (#102)");
+ git("switch", "--quiet", "main");
+ git("merge", "--quiet", "--no-ff", "-m", "Merge branch nested", "nested");
+ git("tag", "end");
const previousCwd = process.cwd();
process.chdir(repo);
t.after(() => process.chdir(previousCwd));
- const commits = await collectCommits('start', 'end');
- assert.deepEqual(commits.map((commit) => commit.primaryPrNumber), [100]);
+ const commits = await collectCommits("start", "end");
+ assert.deepEqual(
+ commits.map((commit) => commit.primaryPrNumber),
+ [100],
+ );
});
-test('contributor credits use PR authors instead of merge authors', () => {
+test("contributor credits use PR authors instead of merge authors", () => {
const contributors = collectContributorStats([
- { number: 100, author: 'new-contributor', authorAssociation: 'FIRST_TIME_CONTRIBUTOR' },
- { number: 101, author: 'returning-contributor', authorAssociation: 'CONTRIBUTOR' },
- { number: 102, author: 'new-contributor', authorAssociation: 'CONTRIBUTOR' },
+ {
+ number: 100,
+ author: "new-contributor",
+ authorAssociation: "FIRST_TIME_CONTRIBUTOR",
+ },
+ {
+ number: 101,
+ author: "returning-contributor",
+ authorAssociation: "CONTRIBUTOR",
+ },
+ {
+ number: 102,
+ author: "new-contributor",
+ authorAssociation: "CONTRIBUTOR",
+ },
]);
assert.deepEqual(contributors, [
- { name: 'new-contributor', commits: 2, prs: [100, 102], isNew: true },
- { name: 'returning-contributor', commits: 1, prs: [101], isNew: false },
+ { name: "new-contributor", commits: 2, prs: [100, 102], isNew: true },
+ { name: "returning-contributor", commits: 1, prs: [101], isNew: false },
]);
});
-test('release highlights do not classify removed desktop voice controls as current voice features', () => {
+test("release highlights do not classify removed desktop voice controls as current voice features", () => {
const groups = groupPullRequestsByHighlight([
- { number: 1, title: 'Remove the push-to-talk hotkey', labels: [] },
- { number: 2, title: 'Retire the notch window', labels: [] },
- { number: 3, title: 'Remove wake word support', labels: [] },
- { number: 4, title: 'Remove PTT overlay', labels: [] },
- { number: 5, title: 'Improve voice transcription', labels: [] },
+ { number: 1, title: "Remove the push-to-talk hotkey", labels: [] },
+ { number: 2, title: "Retire the notch window", labels: [] },
+ { number: 3, title: "Remove wake word support", labels: [] },
+ { number: 4, title: "Remove PTT overlay", labels: [] },
+ { number: 5, title: "Improve voice transcription", labels: [] },
]);
- assert.deepEqual(groups.map(({ title, pullRequests }) => [title, pullRequests.map(({ number }) => number)]), [
- ['πŸŽ™οΈ Voice & hands-free control', [5]],
- ['🧩 Integrations, UI & developer foundations', [1, 2, 3, 4]],
- ]);
+ assert.deepEqual(
+ groups.map(({ title, pullRequests }) => [
+ title,
+ pullRequests.map(({ number }) => number),
+ ]),
+ [
+ ["πŸŽ™οΈ Voice & hands-free control", [5]],
+ ["🧩 Integrations, UI & developer foundations", [1, 2, 3, 4]],
+ ],
+ );
});
-test('OpenAI request contains required release sections and compare payload', () => {
+test("OpenAI request contains required release sections and compare payload", () => {
const payload = buildReleasePayload({
- from: 'v1.0.0',
- to: 'main',
- resolvedTo: 'main',
- repo: 'tinyhumansai/openhuman',
+ from: "v1.0.0",
+ to: "main",
+ resolvedTo: "main",
+ repo: "tinyhumansai/openhuman",
commits: [],
contributors: [],
pullRequests: [],
});
- const request = buildOpenAiRequest({ model: 'gpt-5.2', title: 'v1.0.0 to main', payload });
+ const request = buildOpenAiRequest({
+ model: "gpt-5.2",
+ title: "v1.0.0 to main",
+ payload,
+ });
- assert.equal(request.model, 'gpt-5.2');
+ assert.equal(request.model, "gpt-5.2");
assert.match(request.input[1].content, /exciting H1 title/);
- assert.match(request.input[1].content, /Do not use the tag range as the title/);
- assert.match(request.input[1].content, /multiple high-level highlight subsections/);
+ assert.match(
+ request.input[1].content,
+ /Do not use the tag range as the title/,
+ );
+ assert.match(
+ request.input[1].content,
+ /multiple high-level highlight subsections/,
+ );
assert.match(request.input[1].content, /one or two short paragraphs maximum/);
- assert.match(request.input[1].content, /Do not add a "## Pull Requests" section/);
- assert.match(request.input[1].content, /https:\/\/github\.com\/tinyhumansai\/openhuman\/compare\/v1\.0\.0\.\.\.main/);
+ assert.match(
+ request.input[1].content,
+ /Do not add a "## Pull Requests" section/,
+ );
+ assert.match(
+ request.input[1].content,
+ /https:\/\/github\.com\/tinyhumansai\/openhuman\/compare\/v1\.0\.0\.\.\.main/,
+ );
});
-test('OpenAI request compacts release ranges larger than the prompt budget', () => {
+test("OpenAI request compacts release ranges larger than the prompt budget", () => {
const pullRequests = Array.from({ length: 300 }, (_, index) => ({
number: index + 1,
title: `Release improvement ${index + 1}`,
url: `https://github.com/tinyhumansai/openhuman/pull/${index + 1}`,
author: `contributor-${index + 1}`,
- labels: ['enhancement'],
- body: 'x'.repeat(700),
- commits: [{ sha: `${index + 1}`, subject: `Release improvement ${index + 1}` }],
+ labels: ["enhancement"],
+ body: "x".repeat(700),
+ commits: [
+ { sha: `${index + 1}`, subject: `Release improvement ${index + 1}` },
+ ],
}));
const payload = buildReleasePayload({
- from: 'v1.0.0',
- to: 'main',
- resolvedTo: 'main',
- repo: 'tinyhumansai/openhuman',
+ from: "v1.0.0",
+ to: "main",
+ resolvedTo: "main",
+ repo: "tinyhumansai/openhuman",
commits: [],
contributors: [],
pullRequests,
});
- const request = buildOpenAiRequest({ model: 'gpt-5.2', title: 'Large release', payload });
+ const request = buildOpenAiRequest({
+ model: "gpt-5.2",
+ title: "Large release",
+ payload,
+ });
assert.match(request.input[1].content, /Release improvement 300/);
assert.doesNotMatch(request.input[1].content, /x{700}/);
});
-test('release payload omits contributor emails before AI summarization', () => {
+test("release payload omits contributor emails before AI summarization", () => {
const payload = buildReleasePayload({
- from: 'v1.0.0',
- to: 'main',
- resolvedTo: 'main',
- repo: 'tinyhumansai/openhuman',
+ from: "v1.0.0",
+ to: "main",
+ resolvedTo: "main",
+ repo: "tinyhumansai/openhuman",
commits: [],
contributors: [
{
- name: 'Privacy First',
- email: '[email protected]',
+ name: "Privacy First",
+ email: "[email protected]",
commits: 1,
prs: [12],
isNew: false,
@@ -188,23 +271,23 @@ test('release payload omits contributor emails before AI summarization', () => {
assert.doesNotMatch(JSON.stringify(payload), /privacy@example\.com/);
});
-test('deterministic notes credit contributors and link every PR', () => {
+test("deterministic notes credit contributors and link every PR", () => {
const payload = buildReleasePayload({
- from: 'v1.0.0',
- to: 'main',
- resolvedTo: 'main',
- repo: 'tinyhumansai/openhuman',
+ from: "v1.0.0",
+ to: "main",
+ resolvedTo: "main",
+ repo: "tinyhumansai/openhuman",
commits: [
{
- shortSha: 'abc123def',
- subject: 'feat: ship something (#123)',
+ shortSha: "abc123def",
+ subject: "feat: ship something (#123)",
prNumbers: [123],
},
],
contributors: [
{
- name: 'New Contributor',
- email: '[email protected]',
+ name: "New Contributor",
+ email: "[email protected]",
commits: 1,
prs: [123],
isNew: true,
@@ -213,20 +296,26 @@ test('deterministic notes credit contributors and link every PR', () => {
pullRequests: [
{
number: 123,
- title: 'Ship something',
- url: 'https://github.com/tinyhumansai/openhuman/pull/123',
- author: 'newbie',
+ title: "Ship something",
+ url: "https://github.com/tinyhumansai/openhuman/pull/123",
+ author: "newbie",
},
],
});
- const markdown = renderDeterministicNotes({ title: 'v1.0.0 to main', payload });
+ const markdown = renderDeterministicNotes({
+ title: "v1.0.0 to main",
+ payload,
+ });
assert.match(markdown, /^# The Intelligence Upgrade/);
assert.match(markdown, /Welcome New Contributor/);
assert.match(markdown, /Thank you for \[#123\].*Ship something/);
assert.match(markdown, /Discord for exclusive roles and contributor rewards/);
- assert.match(markdown, /\[#123\]\(https:\/\/github\.com\/tinyhumansai\/openhuman\/pull\/123\)/);
- const highlightsSection = markdown.split('## New Contributors')[0];
+ assert.match(
+ markdown,
+ /\[#123\]\(https:\/\/github\.com\/tinyhumansai\/openhuman\/pull\/123\)/,
+ );
+ const highlightsSection = markdown.split("## New Contributors")[0];
assert.match(highlightsSection, /Thank you @newbie/);
assert.match(highlightsSection, /### /);
assert.doesNotMatch(highlightsSection, /\n- /);
@@ -234,52 +323,64 @@ test('deterministic notes credit contributors and link every PR', () => {
assert.match(markdown, /πŸŽ‰/);
});
-test('missing model links are appended as an included PR section', () => {
- const markdown = ensureAllPullRequestsLinked('## Highlights\n\nGreat release.\n\n## Contributor Credits\n\nThanks.', [
- {
- number: 42,
- title: 'Fix launch',
- url: 'https://github.com/tinyhumansai/openhuman/pull/42',
- author: 'alice',
- },
- ]);
+test("missing model links are appended as an included PR section", () => {
+ const markdown = ensureAllPullRequestsLinked(
+ "## Highlights\n\nGreat release.\n\n## Contributor Credits\n\nThanks.",
+ [
+ {
+ number: 42,
+ title: "Fix launch",
+ url: "https://github.com/tinyhumansai/openhuman/pull/42",
+ author: "alice",
+ },
+ ],
+ );
assert.match(markdown, /### Additional highlights/);
- assert.match(markdown, /\[#42\]\(https:\/\/github\.com\/tinyhumansai\/openhuman\/pull\/42\).*Thank you @alice/);
- assert.doesNotMatch(markdown.split('## Contributor Credits')[0], /\n- /);
+ assert.match(
+ markdown,
+ /\[#42\]\(https:\/\/github\.com\/tinyhumansai\/openhuman\/pull\/42\).*Thank you @alice/,
+ );
+ assert.doesNotMatch(markdown.split("## Contributor Credits")[0], /\n- /);
});
-test('missing PR detection does not treat prefix matches as exact links', () => {
- const markdown = ensureAllPullRequestsLinked('## Highlights\n\n([#123](https://github.com/tinyhumansai/openhuman/pull/123))', [
- {
- number: 12,
- title: 'Fix prefix collision',
- url: 'https://github.com/tinyhumansai/openhuman/pull/12',
- author: 'alice',
- },
- {
- number: 123,
- title: 'Existing link',
- url: 'https://github.com/tinyhumansai/openhuman/pull/123',
- author: 'bob',
- },
- ]);
+test("missing PR detection does not treat prefix matches as exact links", () => {
+ const markdown = ensureAllPullRequestsLinked(
+ "## Highlights\n\n([#123](https://github.com/tinyhumansai/openhuman/pull/123))",
+ [
+ {
+ number: 12,
+ title: "Fix prefix collision",
+ url: "https://github.com/tinyhumansai/openhuman/pull/12",
+ author: "alice",
+ },
+ {
+ number: 123,
+ title: "Existing link",
+ url: "https://github.com/tinyhumansai/openhuman/pull/123",
+ author: "bob",
+ },
+ ],
+ );
- assert.match(markdown, /\[#12\]\(https:\/\/github\.com\/tinyhumansai\/openhuman\/pull\/12\)/);
+ assert.match(
+ markdown,
+ /\[#12\]\(https:\/\/github\.com\/tinyhumansai\/openhuman\/pull\/12\)/,
+ );
assert.equal(markdown.match(/\[#123\]/g)?.length, 1);
});
-test('deterministic notes omit new contributors section when there are none', () => {
+test("deterministic notes omit new contributors section when there are none", () => {
const payload = buildReleasePayload({
- from: 'v1.0.0',
- to: 'main',
- resolvedTo: 'main',
- repo: 'tinyhumansai/openhuman',
+ from: "v1.0.0",
+ to: "main",
+ resolvedTo: "main",
+ repo: "tinyhumansai/openhuman",
commits: [],
contributors: [
{
- name: 'Returning Contributor',
- email: '[email protected]',
+ name: "Returning Contributor",
+ email: "[email protected]",
commits: 1,
prs: [7],
isNew: false,
@@ -288,69 +389,83 @@ test('deterministic notes omit new contributors section when there are none', ()
pullRequests: [],
});
- const markdown = renderDeterministicNotes({ title: 'v1.0.0 to main', payload });
+ const markdown = renderDeterministicNotes({
+ title: "v1.0.0 to main",
+ payload,
+ });
assert.doesNotMatch(markdown, /## New Contributors/);
});
-test('record splitter reassembles records across chunk boundaries', () => {
+test("record splitter reassembles records across chunk boundaries", () => {
const records = [];
- const splitter = createRecordSplitter('\x1e', (record) => records.push(record));
+ const splitter = createRecordSplitter("\x1e", (record) =>
+ records.push(record),
+ );
// A separator straddling two chunks is the failure mode a naive
// `chunk.split(sep)` reader gets wrong, so feed one byte at a time.
- const stream = 'alpha\x1ebeta\x1egamma';
+ const stream = "alpha\x1ebeta\x1egamma";
for (const character of stream) {
splitter.push(character);
}
- assert.deepEqual(records, ['alpha', 'beta']);
+ assert.deepEqual(records, ["alpha", "beta"]);
// The final record has no trailing separator; end() must still emit it.
splitter.end();
- assert.deepEqual(records, ['alpha', 'beta', 'gamma']);
+ assert.deepEqual(records, ["alpha", "beta", "gamma"]);
// end() is idempotent β€” a second call must not re-emit.
splitter.end();
- assert.deepEqual(records, ['alpha', 'beta', 'gamma']);
+ assert.deepEqual(records, ["alpha", "beta", "gamma"]);
});
-test('merge collection survives a git log larger than the 1 MiB spawn buffer', async (t) => {
+test("merge collection survives a git log larger than the 1 MiB spawn buffer", async (t) => {
// Regression guard for the v0.63.21 release failure: `execFileSync` buffers the
// child's whole stdout and throws `spawnSync git ENOBUFS` past Node's 1 MiB
// `maxBuffer` default. The release span grows with every unpublished tag, so the
// collector must not have a fixed output ceiling at all.
const MAX_BUFFER_BYTES = 1024 * 1024;
- const repo = mkdtempSync(join(tmpdir(), 'release-notes-enobufs-'));
+ const repo = mkdtempSync(join(tmpdir(), "release-notes-enobufs-"));
t.after(() => rmSync(repo, { recursive: true, force: true }));
// Ignore the ambient git config: a developer's global `commit.gpgsign` or
// `tag.gpgSign` would otherwise make the fixture prompt or fail.
const git = (...args) =>
- execFileSync('git', args, {
+ execFileSync("git", args, {
cwd: repo,
- encoding: 'utf8',
- stdio: ['ignore', 'pipe', 'pipe'],
- env: { ...process.env, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_SYSTEM: '/dev/null' },
+ encoding: "utf8",
+ stdio: ["ignore", "pipe", "pipe"],
+ env: {
+ ...process.env,
+ GIT_CONFIG_GLOBAL: "/dev/null",
+ GIT_CONFIG_SYSTEM: "/dev/null",
+ },
});
- git('init', '--quiet', '--initial-branch', 'main');
- git('config', 'user.name', 'Range Fixture');
- git('config', 'user.email', '[email protected]');
- git('config', 'commit.gpgsign', 'false');
- git('config', 'tag.gpgSign', 'false');
- git('commit', '--allow-empty', '--quiet', '-m', 'base');
- git('tag', 'start');
+ git("init", "--quiet", "--initial-branch", "main");
+ git("config", "user.name", "Range Fixture");
+ git("config", "user.email", "[email protected]");
+ git("config", "commit.gpgsign", "false");
+ git("config", "tag.gpgSign", "false");
+ git("commit", "--allow-empty", "--quiet", "-m", "base");
+ git("tag", "start");
const COMMITS = 150;
const SUBJECT_PADDING = 8000;
for (let index = 0; index < COMMITS; index += 1) {
- git('switch', '--quiet', '-c', `feature-${index}`);
- git('commit', '--allow-empty', '--quiet', '-m', `feature ${index}`);
- git('switch', '--quiet', 'main');
- git('merge', '--quiet', '--no-ff', '-m',
- `Merge pull request #${1000 + index} from contributor/feature-${index} ${'x'.repeat(SUBJECT_PADDING)}`,
- `feature-${index}`);
+ git("switch", "--quiet", "-c", `feature-${index}`);
+ git("commit", "--allow-empty", "--quiet", "-m", `feature ${index}`);
+ git("switch", "--quiet", "main");
+ git(
+ "merge",
+ "--quiet",
+ "--no-ff",
+ "-m",
+ `Merge pull request #${1000 + index} from contributor/feature-${index} ${"x".repeat(SUBJECT_PADDING)}`,
+ `feature-${index}`,
+ );
}
- git('tag', 'end');
+ git("tag", "end");
const previousCwd = process.cwd();
process.chdir(repo);
@@ -360,13 +475,24 @@ test('merge collection survives a git log larger than the 1 MiB spawn buffer', a
// the old implementation used.
const rawBytes = Buffer.byteLength(
execFileSync(
- 'git',
- ['log', 'start..end', '--first-parent', '--merges', '--reverse', '--format=%H%x1f%s%x1f%an%x1f%ae%x1f%aI%x1e'],
+ "git",
+ [
+ "log",
+ "start..end",
+ "--first-parent",
+ "--merges",
+ "--reverse",
+ "--format=%H%x1f%s%x1f%an%x1f%ae%x1f%aI%x1e",
+ ],
{
cwd: repo,
- encoding: 'utf8',
+ encoding: "utf8",
maxBuffer: 64 * 1024 * 1024,
- env: { ...process.env, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_SYSTEM: '/dev/null' },
+ env: {
+ ...process.env,
+ GIT_CONFIG_GLOBAL: "/dev/null",
+ GIT_CONFIG_SYSTEM: "/dev/null",
+ },
},
),
);
@@ -375,10 +501,9 @@ test('merge collection survives a git log larger than the 1 MiB spawn buffer', a
`fixture must exceed the 1 MiB spawn buffer, got ${rawBytes} bytes`,
);
- const commits = await collectCommits('start', 'end');
+ const commits = await collectCommits("start", "end");
assert.equal(commits.length, COMMITS);
assert.equal(commits.at(0).primaryPrNumber, 1000);
assert.equal(commits.at(-1).primaryPrNumber, 1000 + COMMITS - 1);
assert.ok(commits.every((commit) => commit.sha.length === 40));
-
});
diff --git a/scripts/release/generate-release-notes.mjs b/scripts/release/generate-release-notes.mjs
index e00e33e71b..a07e2fcb15 100644
--- a/scripts/release/generate-release-notes.mjs
+++ b/scripts/release/generate-release-notes.mjs
@@ -1,12 +1,12 @@
#!/usr/bin/env node
-import { execFileSync, spawn } from 'node:child_process';
-import { existsSync, writeFileSync } from 'node:fs';
-import { basename, resolve } from 'node:path';
-import { pathToFileURL } from 'node:url';
-
-const DEFAULT_MODEL = 'gpt-5.2';
-const DEFAULT_FROM = 'latest-release';
-const DEFAULT_TO = 'latest-tag';
+import { execFileSync, spawn } from "node:child_process";
+import { existsSync, writeFileSync } from "node:fs";
+import { basename, resolve } from "node:path";
+import { pathToFileURL } from "node:url";
+
+const DEFAULT_MODEL = "gpt-5.2";
+const DEFAULT_FROM = "latest-release";
+const DEFAULT_TO = "latest-tag";
const MAX_PROMPT_CHARS = 120_000;
const MAX_PR_BODY_CHARS = 700;
@@ -39,7 +39,7 @@ Examples:
}
export function parseArgs(argv) {
- if (argv[0] === '--') {
+ if (argv[0] === "--") {
argv = argv.slice(1);
}
@@ -57,29 +57,29 @@ export function parseArgs(argv) {
const arg = argv[index];
const readValue = (name) => {
const value = argv[index + 1];
- if (!value || value.startsWith('--')) {
+ if (!value || value.startsWith("--")) {
throw new Error(`${name} requires a value`);
}
index += 1;
return value;
};
- if (arg === '--help' || arg === '-h') {
+ if (arg === "--help" || arg === "-h") {
return { ...options, help: true };
}
- if (arg === '--from') {
+ if (arg === "--from") {
options.from = readValue(arg);
- } else if (arg === '--to') {
+ } else if (arg === "--to") {
options.to = readValue(arg);
- } else if (arg === '--repo') {
+ } else if (arg === "--repo") {
options.repo = readValue(arg);
- } else if (arg === '--model') {
+ } else if (arg === "--model") {
options.model = readValue(arg);
- } else if (arg === '--output' || arg === '-o') {
+ } else if (arg === "--output" || arg === "-o") {
options.output = readValue(arg);
- } else if (arg === '--no-ai') {
+ } else if (arg === "--no-ai") {
options.noAi = true;
- } else if (arg === '--dry-run') {
+ } else if (arg === "--dry-run") {
options.dryRun = true;
} else {
throw new Error(`Unknown option: ${arg}`);
@@ -90,20 +90,20 @@ export function parseArgs(argv) {
}
function runGit(args, options = {}) {
- return execFileSync('git', args, {
- encoding: 'utf8',
- stdio: ['ignore', 'pipe', options.allowFailure ? 'pipe' : 'inherit'],
+ return execFileSync("git", args, {
+ encoding: "utf8",
+ stdio: ["ignore", "pipe", options.allowFailure ? "pipe" : "inherit"],
}).trim();
}
function runGh(args, options = {}) {
- return execFileSync('gh', args, {
- encoding: 'utf8',
- stdio: ['ignore', 'pipe', options.allowFailure ? 'pipe' : 'inherit'],
+ return execFileSync("gh", args, {
+ encoding: "utf8",
+ stdio: ["ignore", "pipe", options.allowFailure ? "pipe" : "inherit"],
}).trim();
}
-const RECORD_SEPARATOR = '\x1e';
+const RECORD_SEPARATOR = "\x1e";
/**
* Split a byte stream into separator-delimited records without ever holding the
@@ -111,7 +111,7 @@ const RECORD_SEPARATOR = '\x1e';
* record, so the tail of each chunk is carried into the next one.
*/
export function createRecordSplitter(separator, onRecord) {
- let pending = '';
+ let pending = "";
return {
push(chunk) {
pending += chunk;
@@ -125,7 +125,7 @@ export function createRecordSplitter(separator, onRecord) {
end() {
if (pending) {
onRecord(pending);
- pending = '';
+ pending = "";
}
},
};
@@ -142,12 +142,12 @@ export function createRecordSplitter(separator, onRecord) {
function streamGitRecords(args, onRecord, options = {}) {
const separator = options.separator || RECORD_SEPARATOR;
return new Promise((resolvePromise, reject) => {
- const child = spawn('git', args, { stdio: ['ignore', 'pipe', 'pipe'] });
+ const child = spawn("git", args, { stdio: ["ignore", "pipe", "pipe"] });
const splitter = createRecordSplitter(separator, onRecord);
- let stderr = '';
+ let stderr = "";
- child.stdout.setEncoding('utf8');
- child.stdout.on('data', (chunk) => {
+ child.stdout.setEncoding("utf8");
+ child.stdout.on("data", (chunk) => {
try {
splitter.push(chunk);
} catch (error) {
@@ -155,15 +155,19 @@ function streamGitRecords(args, onRecord, options = {}) {
reject(error);
}
});
- child.stderr.setEncoding('utf8');
- child.stderr.on('data', (chunk) => {
+ child.stderr.setEncoding("utf8");
+ child.stderr.on("data", (chunk) => {
stderr += chunk;
});
- child.on('error', reject);
- child.on('close', (code) => {
+ child.on("error", reject);
+ child.on("close", (code) => {
if (code !== 0) {
- reject(new Error(`git ${args.join(' ')} exited with code ${code}${stderr ? `: ${stderr.trim()}` : ''}`));
+ reject(
+ new Error(
+ `git ${args.join(" ")} exited with code ${code}${stderr ? `: ${stderr.trim()}` : ""}`,
+ ),
+ );
return;
}
try {
@@ -178,7 +182,9 @@ function streamGitRecords(args, onRecord, options = {}) {
}
export function parseGitHubRepoFromRemote(remoteUrl) {
- const cleaned = String(remoteUrl || '').trim().replace(/\.git$/, '');
+ const cleaned = String(remoteUrl || "")
+ .trim()
+ .replace(/\.git$/, "");
const sshMatch = cleaned.match(/github\.com[:/]([^/\s]+\/[^/\s]+)$/);
if (sshMatch) {
return sshMatch[1];
@@ -190,9 +196,9 @@ function resolveRepo(explicitRepo) {
if (explicitRepo) {
return explicitRepo;
}
- for (const remote of ['upstream', 'origin']) {
+ for (const remote of ["upstream", "origin"]) {
try {
- const url = runGit(['remote', 'get-url', remote], { allowFailure: true });
+ const url = runGit(["remote", "get-url", remote], { allowFailure: true });
const repo = parseGitHubRepoFromRemote(url);
if (repo) {
return repo;
@@ -201,27 +207,36 @@ function resolveRepo(explicitRepo) {
// Try the next remote.
}
}
- throw new Error('Could not infer GitHub repo. Pass --repo owner/repo.');
+ throw new Error("Could not infer GitHub repo. Pass --repo owner/repo.");
}
function resolveEndRef(to) {
- if (to !== 'latest-tag') {
+ if (to !== "latest-tag") {
return to;
}
- const tag = runGit(['describe', '--tags', '--abbrev=0']);
+ const tag = runGit(["describe", "--tags", "--abbrev=0"]);
if (!tag) {
- throw new Error('Could not resolve latest tag');
+ throw new Error("Could not resolve latest tag");
}
return tag;
}
function resolveStartRef(repo, from) {
- if (from !== 'latest-release') {
+ if (from !== "latest-release") {
return from;
}
- const tag = runGh(['release', 'view', '--repo', repo, '--json', 'tagName', '--jq', '.tagName']);
+ const tag = runGh([
+ "release",
+ "view",
+ "--repo",
+ repo,
+ "--json",
+ "tagName",
+ "--jq",
+ ".tagName",
+ ]);
if (!tag) {
throw new Error(`Could not resolve latest GitHub Release tag for ${repo}`);
}
@@ -230,23 +245,30 @@ function resolveStartRef(repo, from) {
function assertRefExists(ref, label) {
try {
- runGit(['rev-parse', '--verify', `${ref}^{commit}`], { allowFailure: true });
+ runGit(["rev-parse", "--verify", `${ref}^{commit}`], {
+ allowFailure: true,
+ });
} catch {
throw new Error(`${label} ref not found: ${ref}`);
}
}
export function extractPullRequestNumbers(subject) {
- const text = String(subject || '');
+ const text = String(subject || "");
const matches = [
...text.matchAll(/\(#(\d+)\)/g),
...text.matchAll(/^Merge pull request #(\d+)\b/g),
];
- return [...new Set(matches.map((match) => Number(match[1])).filter(Number.isInteger))];
+ return [
+ ...new Set(
+ matches.map((match) => Number(match[1])).filter(Number.isInteger),
+ ),
+ ];
}
function parseCommitRecord(entry) {
- const [sha, subject, authorName, authorEmail, authoredAt] = entry.split('\x1f');
+ const [sha, subject, authorName, authorEmail, authoredAt] =
+ entry.split("\x1f");
const prNumbers = extractPullRequestNumbers(subject);
return {
sha,
@@ -273,17 +295,27 @@ export function parseGitLog(logText) {
}
export async function collectCommits(from, to) {
- const format = '%H%x1f%s%x1f%an%x1f%ae%x1f%aI%x1e';
+ const format = "%H%x1f%s%x1f%an%x1f%ae%x1f%aI%x1e";
const commits = [];
- await streamGitRecords(['log', `${from}..${to}`, '--first-parent', '--merges', '--reverse', `--format=${format}`], (entry) => {
- const trimmed = entry.trim();
- if (trimmed) {
- const commit = parseCommitRecord(trimmed);
- if (commit.primaryPrNumber) {
- commits.push(commit);
+ await streamGitRecords(
+ [
+ "log",
+ `${from}..${to}`,
+ "--first-parent",
+ "--merges",
+ "--reverse",
+ `--format=${format}`,
+ ],
+ (entry) => {
+ const trimmed = entry.trim();
+ if (trimmed) {
+ const commit = parseCommitRecord(trimmed);
+ if (commit.primaryPrNumber) {
+ commits.push(commit);
+ }
}
- }
- });
+ },
+ );
return commits;
}
@@ -305,7 +337,9 @@ export function collectContributorStats(pullRequests) {
const contributor = contributors.get(key);
contributor.commits += 1;
contributor.prs.add(pullRequest.number);
- contributor.isNew ||= ['FIRST_TIMER', 'FIRST_TIME_CONTRIBUTOR'].includes(pullRequest.authorAssociation);
+ contributor.isNew ||= ["FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR"].includes(
+ pullRequest.authorAssociation,
+ );
}
return [...contributors.values()]
@@ -333,7 +367,7 @@ function collectPrCommits(commits) {
function fetchPullRequest(repo, number) {
try {
- const [owner, name] = repo.split('/');
+ const [owner, name] = repo.split("/");
const query = `query($owner: String!, $name: String!, $number: Int!) {
repository(owner: $owner, name: $name) {
pullRequest(number: $number) {
@@ -345,17 +379,22 @@ function fetchPullRequest(repo, number) {
}`;
const json = runGh(
[
- 'api', 'graphql',
- '-f', `query=${query}`,
- '-f', `owner=${owner}`,
- '-f', `name=${name}`,
- '-F', `number=${number}`,
+ "api",
+ "graphql",
+ "-f",
+ `query=${query}`,
+ "-f",
+ `owner=${owner}`,
+ "-f",
+ `name=${name}`,
+ "-F",
+ `number=${number}`,
],
{ allowFailure: true },
);
const detail = JSON.parse(json)?.data?.repository?.pullRequest;
if (!detail) {
- throw new Error('GitHub returned no pull request');
+ throw new Error("GitHub returned no pull request");
}
return { ...detail, labels: detail.labels?.nodes || [] };
} catch (error) {
@@ -381,7 +420,9 @@ function collectPullRequests(repo, commits) {
return numbers.map((number) => {
const detail = fetchPullRequest(repo, number);
const commitsForPr = prCommits.get(number) || [];
- const fallbackTitle = commitsForPr.at(-1)?.subject.replace(/(?:\s+\(#\d+\))+\s*$/g, '') || `PR #${number}`;
+ const fallbackTitle =
+ commitsForPr.at(-1)?.subject.replace(/(?:\s+\(#\d+\))+\s*$/g, "") ||
+ `PR #${number}`;
return {
number,
title: detail.title || fallbackTitle,
@@ -389,7 +430,9 @@ function collectPullRequests(repo, commits) {
author: detail.author?.login || commitsForPr.at(-1)?.authorName || null,
authorAssociation: detail.authorAssociation || null,
mergedAt: detail.mergedAt || commitsForPr.at(-1)?.authoredAt || null,
- labels: (detail.labels || []).map((label) => label.name || label).filter(Boolean),
+ labels: (detail.labels || [])
+ .map((label) => label.name || label)
+ .filter(Boolean),
body: trimBody(detail.body),
commits: commitsForPr.map((commit) => ({
sha: commit.shortSha,
@@ -402,22 +445,30 @@ function collectPullRequests(repo, commits) {
}
function trimBody(body) {
- if (!body || typeof body !== 'string') {
- return '';
+ if (!body || typeof body !== "string") {
+ return "";
}
return body
- .replace(/<!--[\s\S]*?-->/g, '')
- .replace(/\r\n/g, '\n')
+ .replace(/<!--[\s\S]*?-->/g, "")
+ .replace(/\r\n/g, "\n")
.trim()
.slice(0, MAX_PR_BODY_CHARS);
}
function releaseTitle(from, to, resolvedTo) {
- const toLabel = to === 'latest-tag' ? resolvedTo : to;
+ const toLabel = to === "latest-tag" ? resolvedTo : to;
return `${from} to ${toLabel}`;
}
-export function buildReleasePayload({ from, to, resolvedTo, repo, commits, pullRequests, contributors }) {
+export function buildReleasePayload({
+ from,
+ to,
+ resolvedTo,
+ repo,
+ commits,
+ pullRequests,
+ contributors,
+}) {
return {
repo,
range: {
@@ -430,7 +481,8 @@ export function buildReleasePayload({ from, to, resolvedTo, repo, commits, pullR
commits: commits.length,
pullRequests: pullRequests.length,
contributors: contributors.length,
- newContributors: contributors.filter((contributor) => contributor.isNew).length,
+ newContributors: contributors.filter((contributor) => contributor.isNew)
+ .length,
},
contributors: contributors.map((contributor) => ({
name: contributor.name,
@@ -456,12 +508,12 @@ export function buildOpenAiRequest({ model, title, payload }) {
model,
input: [
{
- role: 'developer',
+ role: "developer",
content:
- 'You write polished but concrete desktop-app release notes. Keep the tone warm, crisp, factual, and celebratory. Use tasteful excitement emojis in headings, but do not overdo them. Never invent changes not present in the input. Preserve every PR link somewhere in the output.',
+ "You write polished but concrete desktop-app release notes. Keep the tone warm, crisp, factual, and celebratory. Use tasteful excitement emojis in headings, but do not overdo them. Never invent changes not present in the input. Preserve every PR link somewhere in the output.",
},
{
- role: 'user',
+ role: "user",
content: `Create Markdown release notes for "${title}" from this JSON payload.
Required structure:
@@ -493,18 +545,25 @@ function serializeOpenAiPayload(payload) {
const compact = {
...payload,
- contributors: payload.contributors.map(({ name, isNew }) => ({ name, isNew })),
- pullRequests: payload.pullRequests.map(({ number, title, url, author, labels }) => ({
- number,
- title,
- url,
- author,
- labels,
- })),
- uncategorizedCommits: payload.uncategorizedCommits.map(({ subject, authorName }) => ({
- subject,
- authorName,
+ contributors: payload.contributors.map(({ name, isNew }) => ({
+ name,
+ isNew,
})),
+ pullRequests: payload.pullRequests.map(
+ ({ number, title, url, author, labels }) => ({
+ number,
+ title,
+ url,
+ author,
+ labels,
+ }),
+ ),
+ uncategorizedCommits: payload.uncategorizedCommits.map(
+ ({ subject, authorName }) => ({
+ subject,
+ authorName,
+ }),
+ ),
};
const compactPayload = JSON.stringify(compact);
if (compactPayload.length <= MAX_PROMPT_CHARS) {
@@ -533,32 +592,36 @@ function getOpenAiKey() {
return process.env.OPENAI_API_KEY;
}
if (process.env.OPENAI_API) {
- console.error('[release-notes] Using OPENAI_API; prefer OPENAI_API_KEY for consistency with OpenAI tooling.');
+ console.error(
+ "[release-notes] Using OPENAI_API; prefer OPENAI_API_KEY for consistency with OpenAI tooling.",
+ );
return process.env.OPENAI_API;
}
return null;
}
function extractResponseText(responseJson) {
- if (typeof responseJson.output_text === 'string') {
+ if (typeof responseJson.output_text === "string") {
return responseJson.output_text;
}
const parts = [];
for (const item of responseJson.output || []) {
for (const content of item.content || []) {
- if (typeof content.text === 'string') {
+ if (typeof content.text === "string") {
parts.push(content.text);
}
}
}
- return parts.join('\n').trim();
+ return parts.join("\n").trim();
}
async function summarizeWithOpenAi(request) {
const key = getOpenAiKey();
if (!key) {
- throw new Error('OPENAI_API_KEY is required unless --no-ai or --dry-run is used');
+ throw new Error(
+ "OPENAI_API_KEY is required unless --no-ai or --dry-run is used",
+ );
}
const timeoutMs = 300_000;
@@ -566,17 +629,17 @@ async function summarizeWithOpenAi(request) {
const timeout = setTimeout(() => controller.abort(), timeoutMs);
let response;
try {
- response = await fetch('https://api.openai.com/v1/responses', {
- method: 'POST',
+ response = await fetch("https://api.openai.com/v1/responses", {
+ method: "POST",
signal: controller.signal,
headers: {
Authorization: `Bearer ${key}`,
- 'Content-Type': 'application/json',
+ "Content-Type": "application/json",
},
body: JSON.stringify(request),
});
} catch (error) {
- if (error?.name === 'AbortError') {
+ if (error?.name === "AbortError") {
throw new Error(`OpenAI Responses API timed out after ${timeoutMs}ms`);
}
throw error;
@@ -594,35 +657,47 @@ async function summarizeWithOpenAi(request) {
if (!response.ok) {
const message = json?.error?.message || body;
- throw new Error(`OpenAI Responses API failed (${response.status}): ${message}`);
+ throw new Error(
+ `OpenAI Responses API failed (${response.status}): ${message}`,
+ );
}
const text = extractResponseText(json);
if (!text) {
- throw new Error('OpenAI response did not contain output text');
+ throw new Error("OpenAI response did not contain output text");
}
return text;
}
export function renderDeterministicNotes({ title, payload }) {
- const newContributors = payload.contributors.filter((contributor) => contributor.isNew);
+ const newContributors = payload.contributors.filter(
+ (contributor) => contributor.isNew,
+ );
const newContributorsSection = newContributors.length
? `
## New Contributors 🌟
-${newContributors.map((contributor) => renderNewContributorLine(contributor, payload.pullRequests)).join('\n')}
+${newContributors.map((contributor) => renderNewContributorLine(contributor, payload.pullRequests)).join("\n")}
Hope you join the Discord for exclusive roles and contributor rewards!
`
- : '';
+ : "";
const contributorLinks = payload.contributors.map((contributor) => {
- const prList = contributor.prs.map((number) => `#${number}`).join(', ');
- return `- ${contributor.name}${prList ? ` (${prList})` : ''}`;
+ const prList = contributor.prs.map((number) => `#${number}`).join(", ");
+ return `- ${contributor.name}${prList ? ` (${prList})` : ""}`;
});
- const highlightSections = groupPullRequestsByHighlight(payload.pullRequests).map(({ title, summary, pullRequests }) => {
- const links = pullRequests.map((pr) => `[#${pr.number}](${pr.url})`).join(', ');
- const authors = [...new Set(pullRequests.map((pr) => pr.author).filter(Boolean))];
- const thanks = authors.length ? `Thank you ${formatHandleList(authors)}!` : 'Thank you to everyone who contributed!';
+ const highlightSections = groupPullRequestsByHighlight(
+ payload.pullRequests,
+ ).map(({ title, summary, pullRequests }) => {
+ const links = pullRequests
+ .map((pr) => `[#${pr.number}](${pr.url})`)
+ .join(", ");
+ const authors = [
+ ...new Set(pullRequests.map((pr) => pr.author).filter(Boolean)),
+ ];
+ const thanks = authors.length
+ ? `Thank you ${formatHandleList(authors)}!`
+ : "Thank you to everyone who contributed!";
return `### ${title}\n\n${summary} (${links}) β€” ${thanks}`;
});
@@ -632,12 +707,12 @@ ${title} brings ${payload.totals.pullRequests} PRs across ${payload.totals.commi
## Highlights πŸš€
-${highlightSections.join('\n\n') || 'No PRs found in this range.'}
+${highlightSections.join("\n\n") || "No PRs found in this range."}
${newContributorsSection}
## Contributor Credits πŸ™Œ
-${contributorLinks.map((line) => `${line} β€” thank you!`).join('\n') || '- No contributors found.'}
+${contributorLinks.map((line) => `${line} β€” thank you!`).join("\n") || "- No contributors found."}
## Full Compare 🧭
@@ -648,53 +723,110 @@ ${payload.range.compareUrl}
function formatHandleList(handles) {
const names = handles.map((handle) => `@${handle}`);
if (names.length <= 2) {
- return names.join(' and ');
+ return names.join(" and ");
}
- return `${names.slice(0, -1).join(', ')}, and ${names.at(-1)}`;
+ return `${names.slice(0, -1).join(", ")}, and ${names.at(-1)}`;
}
export function groupPullRequestsByHighlight(pullRequests) {
const groups = [
{
- title: 'πŸŽ™οΈ Voice & hands-free control',
- keywords: ['voice', 'vad', 'stt', 'desktop control', 'automate', 'accessibility', 'vision'],
+ title: "πŸŽ™οΈ Voice & hands-free control",
+ keywords: [
+ "voice",
+ "vad",
+ "stt",
+ "desktop control",
+ "automate",
+ "accessibility",
+ "vision",
+ ],
summary:
- 'Voice and hands-free control get more useful across the desktop, with always-on listening, global push-to-talk, faster command routing, and stronger automation paths for interacting with apps.',
+ "Voice and hands-free control get more useful across the desktop, with always-on listening, global push-to-talk, faster command routing, and stronger automation paths for interacting with apps.",
pullRequests: [],
},
{
- title: '🧠 Memory & intelligence',
- keywords: ['memory', 'embed', 'embedding', 'notion', 'sync', 'source', 'intelligence', 'vault'],
+ title: "🧠 Memory & intelligence",
+ keywords: [
+ "memory",
+ "embed",
+ "embedding",
+ "notion",
+ "sync",
+ "source",
+ "intelligence",
+ "vault",
+ ],
summary:
- 'Memory and intelligence flows are faster, clearer, and more resilient, from source sync controls and richer ingest to batched embeddings and delegated memory retrieval.',
+ "Memory and intelligence flows are faster, clearer, and more resilient, from source sync controls and richer ingest to batched embeddings and delegated memory retrieval.",
pullRequests: [],
},
{
- title: 'βœ… Tasks, chat & agent workflows',
- keywords: ['task', 'chat', 'thread', 'agent', 'subagent', 'run', 'council', 'workflow', 'skill', 'skills'],
+ title: "βœ… Tasks, chat & agent workflows",
+ keywords: [
+ "task",
+ "chat",
+ "thread",
+ "agent",
+ "subagent",
+ "run",
+ "council",
+ "workflow",
+ "skill",
+ "skills",
+ ],
summary:
- 'Task, chat, and agent workflows become easier to steer and inspect, with better task boards, persistent run state, safer delegation, and clearer model/thread controls.',
+ "Task, chat, and agent workflows become easier to steer and inspect, with better task boards, persistent run state, safer delegation, and clearer model/thread controls.",
pullRequests: [],
},
{
- title: 'πŸ” Reliability, security & platform polish',
- keywords: ['keyring', 'security', 'sandbox', 'action_dir', 'auth', 'session', 'cron', 'cef', 'windows', 'release', 'sentry', 'credential'],
+ title: "πŸ” Reliability, security & platform polish",
+ keywords: [
+ "keyring",
+ "security",
+ "sandbox",
+ "action_dir",
+ "auth",
+ "session",
+ "cron",
+ "cef",
+ "windows",
+ "release",
+ "sentry",
+ "credential",
+ ],
summary:
- 'Reliability and platform behavior are tightened across security policy, credential handling, session health, CEF startup, Windows filesystem edge cases, and release-only build paths.',
+ "Reliability and platform behavior are tightened across security policy, credential handling, session health, CEF startup, Windows filesystem edge cases, and release-only build paths.",
pullRequests: [],
},
{
- title: '🧩 Integrations, UI & developer foundations',
- keywords: ['integration', 'composio', 'mcp', 'meeting', 'ui', 'onboarding', 'font', 'docs', 'readme', 'refactor', 'module', 'artifact', 'presentation'],
+ title: "🧩 Integrations, UI & developer foundations",
+ keywords: [
+ "integration",
+ "composio",
+ "mcp",
+ "meeting",
+ "ui",
+ "onboarding",
+ "font",
+ "docs",
+ "readme",
+ "refactor",
+ "module",
+ "artifact",
+ "presentation",
+ ],
summary:
- 'Integrations, UI polish, and developer foundations also move forward, including clearer connected-account surfaces, meeting-agent wiring, presentation/artifact improvements, and cleaner docs/code organization.',
+ "Integrations, UI polish, and developer foundations also move forward, including clearer connected-account surfaces, meeting-agent wiring, presentation/artifact improvements, and cleaner docs/code organization.",
pullRequests: [],
},
];
for (const pr of pullRequests) {
- const haystack = `${pr.title} ${(pr.labels || []).join(' ')}`.toLowerCase();
- const group = groups.find((candidate) => candidate.keywords.some((keyword) => haystack.includes(keyword)));
+ const haystack = `${pr.title} ${(pr.labels || []).join(" ")}`.toLowerCase();
+ const group = groups.find((candidate) =>
+ candidate.keywords.some((keyword) => haystack.includes(keyword)),
+ );
(group || groups.at(-1)).pullRequests.push(pr);
}
@@ -705,27 +837,33 @@ function renderNewContributorLine(contributor, pullRequests) {
const contributed = pullRequests
.filter((pr) => contributor.prs.includes(pr.number))
.map((pr) => `[#${pr.number}](${pr.url}) ${pr.title}`);
- const brief = contributed.length ? ` for ${contributed.join('; ')}` : '';
+ const brief = contributed.length ? ` for ${contributed.join("; ")}` : "";
return `- Welcome ${contributor.name}! Thank you${brief}.`;
}
export function ensureAllPullRequestsLinked(markdown, pullRequests) {
const missing = pullRequests.filter((pr) => {
const byNumber = new RegExp(`\\[#${pr.number}\\]\\(`).test(markdown);
- const byUrl = new RegExp(`${escapeRegExp(pr.url)}(?:\\)|\\s|$)`).test(markdown);
+ const byUrl = new RegExp(`${escapeRegExp(pr.url)}(?:\\)|\\s|$)`).test(
+ markdown,
+ );
return !byNumber && !byUrl;
});
if (missing.length === 0) {
return markdown;
}
- const links = missing.map((pr) => `[#${pr.number}](${pr.url})`).join(', ');
+ const links = missing.map((pr) => `[#${pr.number}](${pr.url})`).join(", ");
const authors = [...new Set(missing.map((pr) => pr.author).filter(Boolean))];
- const thanks = authors.length ? `Thank you ${formatHandleList(authors)}!` : 'Thank you to everyone who contributed!';
+ const thanks = authors.length
+ ? `Thank you ${formatHandleList(authors)}!`
+ : "Thank you to everyone who contributed!";
const insertion = `\n### Additional highlights πŸ”—\n\nA few more focused contributions round out this release with targeted fixes and improvements that are worth calling out. (${links}) β€” ${thanks}\n`;
- const sectionMatch = markdown.match(/\n## (New Contributors|Contributor Credits|Full Compare)\b/);
- if (!sectionMatch || typeof sectionMatch.index !== 'number') {
+ const sectionMatch = markdown.match(
+ /\n## (New Contributors|Contributor Credits|Full Compare)\b/,
+ );
+ if (!sectionMatch || typeof sectionMatch.index !== "number") {
return `${markdown.trim()}${insertion}`;
}
@@ -733,7 +871,7 @@ export function ensureAllPullRequestsLinked(markdown, pullRequests) {
}
function escapeRegExp(value) {
- return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
async function main() {
@@ -755,10 +893,12 @@ async function main() {
const from = resolveStartRef(repo, options.from);
const resolvedTo = resolveEndRef(options.to);
- assertRefExists(from, 'Start');
- assertRefExists(resolvedTo, 'End');
+ assertRefExists(from, "Start");
+ assertRefExists(resolvedTo, "End");
- console.error(`[release-notes] Collecting ${repo} changes from ${from} to ${resolvedTo}`);
+ console.error(
+ `[release-notes] Collecting ${repo} changes from ${from} to ${resolvedTo}`,
+ );
const commits = await collectCommits(from, resolvedTo);
const pullRequests = collectPullRequests(repo, commits);
const contributors = collectContributorStats(pullRequests);
@@ -775,25 +915,36 @@ async function main() {
let markdown;
if (options.dryRun) {
- const request = buildOpenAiRequest({ model: options.model, title, payload });
+ const request = buildOpenAiRequest({
+ model: options.model,
+ title,
+ payload,
+ });
markdown = JSON.stringify(request, null, 2);
} else if (options.noAi) {
markdown = renderDeterministicNotes({ title, payload });
} else {
- const request = buildOpenAiRequest({ model: options.model, title, payload });
+ const request = buildOpenAiRequest({
+ model: options.model,
+ title,
+ payload,
+ });
markdown = await summarizeWithOpenAi(request);
markdown = ensureAllPullRequestsLinked(markdown, payload.pullRequests);
}
if (options.output) {
const outputPath = resolve(options.output);
- if (existsSync(outputPath) && basename(outputPath).startsWith('.')) {
+ if (existsSync(outputPath) && basename(outputPath).startsWith(".")) {
throw new Error(`Refusing to overwrite hidden file: ${outputPath}`);
}
- writeFileSync(outputPath, markdown.endsWith('\n') ? markdown : `${markdown}\n`);
+ writeFileSync(
+ outputPath,
+ markdown.endsWith("\n") ? markdown : `${markdown}\n`,
+ );
console.error(`[release-notes] Wrote ${outputPath}`);
} else {
- process.stdout.write(markdown.endsWith('\n') ? markdown : `${markdown}\n`);
+ process.stdout.write(markdown.endsWith("\n") ? markdown : `${markdown}\n`);
}
}