Skip to content

An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.

build(release): generate release notes from the tag or the commit log

Shahriar84d474d20548
diff --git a/scripts/release-notes.mjs b/scripts/release-notes.mjs
new file mode 100644
index 0000000..81d0460
--- /dev/null
+++ b/scripts/release-notes.mjs
@@ -0,0 +1,128 @@
+#!/usr/bin/env node
+import { execFileSync } from 'node:child_process';
+import { writeFileSync } from 'node:fs';
+
+const REPO = 'imshaikot/browsentic';
+
+const SECTIONS = [
+ ['feat', 'Features'],
+ ['fix', 'Fixes'],
+ ['perf', 'Performance'],
+ ['refactor', 'Refactoring'],
+ ['docs', 'Documentation'],
+ ['test', 'Tests'],
+ ['build', 'Build'],
+ ['ci', 'CI'],
+ ['chore', 'Chores'],
+];
+
+const SECTION_CAP = 20;
+
+const git = (...args) => execFileSync('git', args, { encoding: 'utf8' }).trim();
+const gitTry = (...args) => {
+ try {
+ return git(...args);
+ } catch {
+ return '';
+ }
+};
+
+/**
+ * `prepare` writes the notes into the annotated tag object, so a tag cut that way already
+ * carries the text that should ship, hand-edits included. Only an annotated tag has its own
+ * message: on a lightweight one `%(contents)` returns the commit's message, which would
+ * publish a commit body as release notes.
+ */
+function annotatedBody(tag) {
+ if (gitTry('cat-file', '-t', tag) !== 'tag') return null;
+ const contents = gitTry('tag', '-l', '--format=%(contents)', tag);
+ const body = contents.startsWith(tag) ? contents.slice(tag.length) : contents;
+ return body.trim() || null;
+}
+
+function commitsSince(prevTag, tag) {
+ const raw = gitTry('log', '--no-merges', '--format=%H%x1f%s%x1f%b%x1e', prevTag ? `${prevTag}..${tag}` : tag);
+ if (!raw) return [];
+ return raw
+ .split('\x1e')
+ .map((chunk) => chunk.trim())
+ .filter(Boolean)
+ .filter((chunk) => !/\x1fchore\(release\):/.test(chunk))
+ .map((chunk) => {
+ const [hash, subject, body = ''] = chunk.split('\x1f');
+ const m = /^(\w+)(?:\(([^)]*)\))?(!)?:\s*(.+)$/.exec(subject);
+ return {
+ short: hash.slice(0, 7),
+ subject,
+ type: m ? m[1] : null,
+ scope: m ? m[2] || null : null,
+ breaking: !!(m && m[3]) || /^BREAKING[ -]CHANGE:/m.test(body),
+ text: m ? m[4] : subject,
+ };
+ });
+}
+
+function renderNotes(version, commits, prevTag) {
+ const lines = [];
+ const bullet = (c) => `- ${c.scope ? `**${c.scope}**: ` : ''}${c.text} (${c.short})`;
+ const section = (title, hits, render = bullet) => {
+ if (!hits.length) return;
+ lines.push(`### ${title}`, '');
+ for (const c of hits.slice(0, SECTION_CAP)) lines.push(render(c));
+ if (hits.length > SECTION_CAP) lines.push(`- _… and ${hits.length - SECTION_CAP} more_`);
+ lines.push('');
+ };
+
+ if (!prevTag) lines.push('First tagged release. Everything in the repo to date, summarized.', '');
+ section('Breaking changes', commits.filter((c) => c.breaking));
+ for (const [type, title] of SECTIONS) {
+ section(title, commits.filter((c) => c.type === type && !c.breaking));
+ }
+ section(
+ 'Other',
+ commits.filter((c) => !c.breaking && !SECTIONS.some(([t]) => t === c.type)),
+ (c) => `- ${c.subject} (${c.short})`,
+ );
+ if (!commits.length) lines.push('_No commits since the last release._', '');
+
+ lines.push(
+ '### Install',
+ '',
+ `Download \`browsentic-${version}-chrome.zip\`, unzip it, then load the folder at \`chrome://extensions\``,
+ 'with **Developer mode** on. Firefox users want the `-firefox.zip`.',
+ '',
+ 'The daemon runs from source:',
+ '',
+ '```sh',
+ `git clone --branch v${version} https://github.com/${REPO}.git`,
+ 'cd browsentic && yarn setup && yarn mcp:link',
+ 'browsentic-mcp pair',
+ '```',
+ '',
+ prevTag
+ ? `**Full changelog**: https://github.com/${REPO}/compare/${prevTag}...v${version}`
+ : `**Full changelog**: https://github.com/${REPO}/commits/v${version}`,
+ );
+ return lines.join('\n');
+}
+
+const args = process.argv.slice(2);
+const outAt = args.indexOf('--out');
+const out = outAt === -1 ? null : args[outAt + 1];
+const version = (outAt === 0 ? args[2] : args[0])?.replace(/^v/, '');
+
+if (!/^\d+\.\d+\.\d+$/.test(version ?? '')) {
+ console.error('usage: release-notes.mjs <version> [--out <file>]');
+ process.exit(1);
+}
+
+const tag = `v${version}`;
+const prevTag = gitTry('describe', '--tags', '--abbrev=0', `${tag}^`) || null;
+const notes = annotatedBody(tag) ?? renderNotes(version, commitsSince(prevTag, tag), prevTag);
+
+if (out) {
+ writeFileSync(out, `${notes}\n`);
+ console.error(`notes for ${tag} → ${out}`);
+} else {
+ process.stdout.write(`${notes}\n`);
+}