@devries-cameron20 / t3code Mirror · read-only / commits / 460b88bc42
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 08:15 UTC

feat(release): update notes lead with up to 7 highlights (#28593)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Nov 1, 2026 at 02:11 UTC 460b88bc425f41ed5e7b5208a64b448f34098b9b
8 files changed +221 -118
apps/desktop/src/updates/releaseNotes.test.ts
+20
@@ -92,6 +92,26 @@ describe("normalizeDesktopUpdateReleaseNotes", () => {
92 ]);
93 });
94
95 + it.each([
96 + "**v1.2.4** · 3 changes from 2 contributors\n- **One-time tasks.** Pick a date.\n\n### Plus 2 more bug fixes and performance improvements.",
97 + "<p><strong>v1.2.4</strong> · 3 changes from 2 contributors</p><ul><li><strong>One-time tasks.</strong> Pick a date.</li></ul><h3>Plus 2 more bug fixes and performance improvements.</h3>",
98 + ])("keeps highlight labels and the remaining change count from the feed", (summary) => {
99 + const { releaseNotes } = normalizeDesktopUpdateReleaseNotes(
100 + summary + "\n<details><summary>Full changelog</summary>raw list</details>",
101 + "1.2.4",
102 + "latest",
103 + );
104 + expect(releaseNotes).toEqual([
105 + {
106 + version: "1.2.4",
107 + stats: "3 changes from 2 contributors",
108 + items: ["**One-time tasks.** Pick a date."],
109 + totalItems: 1,
110 + footer: "Plus 2 more bug fixes and performance improvements.",
111 + },
112 + ]);
113 + });
114 +
115 it("does not count Markdown or HTML section headings as changes", () => {
116 const changes = Array.from({ length: 8 }, (_, index) => `Change ${index + 1}`);
117 const result = normalizeDesktopUpdateReleaseNotes(
apps/desktop/src/updates/releaseNotes.ts
+31 -31
@@ -54,17 +54,18 @@ function decodeHtmlEntities(input: string): string {
54 );
55 }
56
57 -function stripMarkup(input: string): string {
58 - return decodeHtmlEntities(
57 +function stripMarkup(input: string, keepBold = false): string {
58 + const markdown = decodeHtmlEntities(
59 input
60 .replace(/<br\s*\/?>/gi, "\n")
61 .replace(/<li\b[^>]*>/gi, "\n- ")
62 .replace(/<h([1-6])\b[^>]*>/gi, (_, level: string) => `\n${"#".repeat(Number(level))} `)
63 .replace(/<\/(?:p|div|li|h[1-6]|ul|ol|blockquote)>/gi, "\n")
64 + .replace(/<\/?(?:strong|b)\b[^>]*>/gi, "**")
65 .replace(/<[^>]*>/g, "")
65 - .replace(/\[([^\]]+)\]\([^)]+\)/g, "$1")
66 - .replace(/\*\*([^*]+)\*\*/g, "$1"),
66 + .replace(/\[([^\]]+)\]\([^)]+\)/g, "$1"),
67 );
68 + return keepBold ? markdown : markdown.replace(/\*\*([^*]+)\*\*/g, "$1");
69 }
70
71 function truncateReleaseNoteItem(item: string): string {
@@ -92,40 +93,42 @@ function isIgnoredReleaseNoteLine(line: string): boolean {
93 );
94 }
95
95 -interface ExtractedReleaseNoteItems {
96 - readonly items: ReadonlyArray<string>;
97 - readonly totalItems: number;
98 - readonly intro?: string;
99 - readonly stats?: string;
100 -}
96 +type ExtractedReleaseNoteItems = Omit<DesktopUpdateReleaseNote, "version" | "releasedAt">;
97
102 -/**
103 - * Reads a generated summary (`scripts/generate-release-notes.ts`): a `v1.2.3 · N changes…`
104 - * header, a highlights paragraph, and fix bullets. PR numbers are left to the GitHub page.
105 - */
98 +/** Older generated notes have a highlights paragraph followed by a separate list of fixes. */
99 function extractReleaseNoteSummary(summary: string): ExtractedReleaseNoteItems {
100 let stats: string | undefined;
101 + let footer: string | undefined;
102 const intro: string[] = [];
103 const items: string[] = [];
110 - for (const rawLine of stripMarkup(summary).split("\n")) {
111 - const line = rawLine.trim().replace(/\s+/g, " ");
112 - if (line === "" || /^#{1,6}\s+/.test(line)) continue;
113 - if (stats === undefined && /^v\S+ · /.test(line)) {
114 - stats = line.slice(line.indexOf(" · ") + 3);
115 - continue;
116 - }
117 - const text = line
118 - .replace(/^[-*]\s+/, "")
104 + for (const rawLine of stripMarkup(summary, true).split("\n")) {
105 + const line = rawLine
106 + .trim()
107 + .replace(/\s+/g, " ")
108 .replace(/\s*\((?:#\d+(?:,\s*)?)+\)\.?$/, "")
109 .trim();
121 - if (/^[-*]\s+/.test(line)) items.push(text);
122 - else intro.push(text);
110 + const plain = line.replace(/\*\*([^*]+)\*\*/g, "$1");
111 + if (/^### Plus \d+ more /.test(plain)) {
112 + footer = plain.slice(4);
113 + continue;
114 + }
115 + if (plain === "" || /^#{1,6}\s+/.test(plain)) continue;
116 + if (stats === undefined && /^v\S+ · /.test(plain)) {
117 + stats = plain.slice(plain.indexOf(" · ") + 3);
118 + continue;
119 + }
120 + if (/^[-*]\s+/.test(line)) {
121 + items.push(line.replace(/^[-*]\s+/, ""));
122 + } else {
123 + intro.push(plain);
124 + }
125 }
126 return {
127 items,
128 totalItems: items.length + intro.length,
129 ...(intro.length > 0 ? { intro: intro.join(" ") } : {}),
130 ...(stats ? { stats } : {}),
131 + ...(footer ? { footer } : {}),
132 };
133 }
134
@@ -184,16 +187,13 @@ export function normalizeDesktopUpdateReleaseNotes(
187 ).filter((entry) => desktopUpdateChannelOf(entry.version) === channel);
188
189 const normalizedNotes = rawNotes.flatMap((entry) => {
187 - const { items, totalItems, intro, stats } = extractReleaseNoteItems(entry.note);
188 - if (totalItems === 0) return [];
190 + const note = extractReleaseNoteItems(entry.note);
191 + if (note.totalItems === 0 && !note.stats) return [];
192 const releasedAt = resolveReleasedAt(entry.version, fallbackVersion, releaseDate);
193 return [
194 {
195 version: entry.version,
193 - items,
194 - totalItems,
195 - ...(intro ? { intro } : {}),
196 - ...(stats ? { stats } : {}),
196 + ...note,
197 ...(releasedAt ? { releasedAt } : {}),
198 },
199 ];
apps/web/src/components/sidebar/SidebarUpdatePill.browser.test.tsx
+13 -2
@@ -100,8 +100,19 @@ describe("SidebarUpdatePill release notes", () => {
100 await userEvent.tab();
101 expect(releaseNotes()).toBeNull();
102
103 - await publish(nightlyUpdate(RELEASE_NOTES));
104 - await vi.waitFor(() => expect(releaseNotes()).not.toBeNull());
103 + await publish(
104 + nightlyUpdate([
105 + {
106 + version: "0.0.50-nightly.2",
107 + items: ["**One-time tasks.** Pick a date."],
108 + totalItems: 1,
109 + stats: "3 changes from 2 contributors",
110 + footer: "Plus 2 more bug fixes.",
111 + },
112 + ]),
113 + );
114 + await expect.element(page.getByText("One-time tasks.", { exact: true })).toBeVisible();
115 + await expect.element(page.getByText("Plus 2 more bug fixes.")).toBeVisible();
116 });
117 });
118
apps/web/src/components/sidebar/SidebarUpdateReleaseNotes.tsx
+38 -33
@@ -101,48 +101,53 @@ export function SidebarUpdateReleaseNotes({
101 ? "View release on GitHub"
102 : `${omittedItemCount} more ${omittedItemCount === 1 ? "change" : "changes"} on GitHub`);
103
104 - if (releaseNote.intro !== undefined) {
105 - return (
106 - <section className={index > 0 ? "mt-4" : undefined} key={releaseNote.version}>
107 - {releaseNote.version !== state.availableVersion ? (
104 + const generated = releaseNote.stats !== undefined || releaseNote.intro !== undefined;
105 + return (
106 + <section className={index > 0 ? "mt-4" : undefined} key={releaseNote.version}>
107 + {generated ? (
108 + releaseNote.version !== state.availableVersion && (
109 <h3 className="mb-1 text-xs leading-4 font-medium text-muted-foreground">
110 {releaseNote.releasedAt
111 ? `${releaseNote.version} · ${formatReleaseAge(releaseNote.releasedAt)}`
112 : releaseNote.version}
113 </h3>
113 - ) : null}
114 + )
115 + ) : (
116 + <h3 className="mb-2 text-foreground text-xs leading-4 font-semibold">
117 + {index === 0 ? "What's changed" : `Changes in ${releaseNote.version}`}
118 + </h3>
119 + )}
120 + {releaseNote.intro ? (
121 <p className="break-words text-xs leading-5 text-popover-foreground">
122 {releaseNote.intro}
123 </p>
117 - {releaseUrl ? (
118 - <ReleaseLink releaseUrl={releaseUrl} shell={shell}>
119 - {releaseNote.stats ?? "View release on GitHub"}
120 - </ReleaseLink>
121 - ) : null}
122 - </section>
123 - );
124 - }
125 -
126 - return (
127 - <div className={index > 0 ? "mt-4" : undefined} key={releaseNote.version}>
128 - <section>
129 - <h3 className="text-foreground text-xs leading-4 font-semibold">
130 - {index === 0 ? "What's changed" : `Changes in ${releaseNote.version}`}
131 - </h3>
132 - <ul className="mt-2 space-y-1.5 pl-4 text-xs leading-5 text-popover-foreground/90">
133 - {keyReleaseNoteItems(releaseNote.items).map(({ item, key }) => (
134 - <li className="list-disc break-words" key={key}>
135 - {item}
136 - </li>
137 - ))}
124 + ) : releaseNote.items.length > 0 ? (
125 + <ul className="space-y-1.5 pl-4 text-xs leading-5 text-popover-foreground/90">
126 + {keyReleaseNoteItems(releaseNote.items).map(({ item, key }) => {
127 + const highlight = /^\*\*([^*]+)\*\* (.+)$/.exec(item);
128 + return (
129 + <li className="list-disc break-words" key={key}>
130 + {highlight ? (
131 + <>
132 + <strong>{highlight[1]}</strong> {highlight[2]}
133 + </>
134 + ) : (
135 + item
136 + )}
137 + </li>
138 + );
139 + })}
140 </ul>
139 - {releaseUrl ? (
140 - <ReleaseLink releaseUrl={releaseUrl} shell={shell}>
141 - {linkLabel}
142 - </ReleaseLink>
143 - ) : null}
144 - </section>
145 - </div>
141 + ) : null}
142 + {releaseNote.footer && (
143 + <p className="mt-2 text-xs leading-5 font-semibold">{releaseNote.footer}</p>
144 + )}
145 + {releaseUrl && (
146 + <ReleaseLink releaseUrl={releaseUrl} shell={shell}>
147 + {linkLabel}
148 + </ReleaseLink>
149 + )}
150 + </section>
151 );
152 })}
153 {state.omittedReleaseCount > 0 ? (
docs/operations/release.md
+1 -1
@@ -42,7 +42,7 @@ the version.
42 - Only plain stable `X.Y.Z` releases are marked as the repository's latest release.
43 - Nightly runs are always GitHub prereleases and never marked latest.
44 - Automatically generated release notes are pinned to the previous tag in the same channel, so stable compares to the previous stable tag and nightly compares to the previous nightly tag.
45 - - The release job's **Write release notes** step (`scripts/generate-release-notes.ts`) builds the body: a computed header line, a short summary from `gpt-6.1-terra`, and GitHub's generated list folded under `<details>`. It needs the `OPENAI_API_KEY` secret. The summary leaves out commits whose scopes are all mobile; the header counts every commit. The desktop update popover, on every channel, shows the highlights paragraph and the header counts as a short note per release, with the offered release's age from the update feed's `releaseDate`. The nightly Discord post shows the part above `<details>`. If the step fails or there is nothing to summarize, it writes no file and the release uses GitHub's generated notes as before.
45 + - The release job's **Write release notes** step (`scripts/generate-release-notes.ts`) builds the body: a computed header line, a short summary from `gpt-6.1-terra`, and GitHub's generated list folded under `<details>`. It needs the `OPENAI_API_KEY` secret. The desktop update popover shows up to seven highlights and the number of other fixes and performance improvements. Mobile-only commits count toward release totals but cannot be highlights. The offered release's age comes from the update feed's `releaseDate`. The nightly Discord post shows the part above `<details>`. If summary generation fails, the release uses GitHub's generated notes.
46 - Includes Electron auto-update metadata (for example `latest*.yml`, `nightly*.yml`, and `*.blockmap`) in release assets.
47 - Builds a self-contained CLI archive per platform (`t3-<version>-<platform>-<arch>.tar.gz`, `.zip` on Windows) in the same job as that target's desktop artifact and attaches them to the GitHub Release with a `SHA256SUMS` file, on every channel, for five targets: macOS arm64, Linux x64 and arm64, Windows x64 and arm64. Every archive is smoke-tested on hardware of its own architecture, and every one but the Windows archives is also built and signed there. There is no macOS x64 archive: Node single-executables are unsupported on x64 macOS (the SEA docs list macOS as arm64 only) and the binary segfaults on start; the x64 desktop app is Electron and unaffected.
48 - The archive holds the server as a Node single-executable (`scripts/build-cli-archive.ts`), so unpacking it needs neither Node, npm, nor a compiler. It is the only form in which T3 Code manages a runtime: the desktop's SSH environments, the boot service, `t3 update`, and the install scripts all download and verify this archive against `SHA256SUMS`. The `t3` npm package exists for people who run `npx t3` or `npm install -g t3` themselves, and it downloads this same archive too; nothing in the product installs from npm. The `curl | sh` installers are `scripts/install.sh` and `scripts/install.ps1`; the marketing site copies them into its `public/` at build time (`apps/marketing/scripts/stage-install-scripts.mjs`) and serves them at `t3.codes/install.sh` and `/install.ps1`.
packages/contracts/src/ipc.ts
+3 -1
@@ -290,10 +290,11 @@ export interface DesktopUpdateReleaseNote {
290 totalItems: number;
291 /** ISO time from the update feed for the offered version, else `YYYY-MM-DD` from a prerelease version. */
292 releasedAt?: string;
293 - /** Generated summaries only: the highlights paragraph. `items` then holds the fixes. */
293 + /** Paragraph-style summaries from older releases keep their fixes in `items`. */
294 intro?: string;
295 /** Generated summaries only, for example "275 changes from 22 contributors". */
296 stats?: string;
297 + footer?: string;
298 }
299
300 export const DesktopUpdateReleaseNoteSchema = Schema.Struct({
@@ -303,6 +304,7 @@ export const DesktopUpdateReleaseNoteSchema = Schema.Struct({
304 releasedAt: Schema.optionalKey(Schema.String),
305 intro: Schema.optionalKey(Schema.String),
306 stats: Schema.optionalKey(Schema.String),
307 + footer: Schema.optionalKey(Schema.String),
308 });
309
310 export const DesktopUpdateStateSchema = Schema.Struct({
scripts/generate-release-notes.test.ts
+48 -6
@@ -4,8 +4,9 @@ import * as Option from "effect/Option";
4
5 import {
6 countContributors,
7 + formatReleaseSummary,
8 isReleaseNoteCommit,
8 - summaryText,
9 + readReleaseHighlights,
10 type PullRequest,
11 } from "./generate-release-notes.ts";
12
@@ -53,13 +54,54 @@ it("leaves mobile-only scopes out and keeps shared ones", () => {
54 }
55 });
56
56 -it("uses model text only from a completed response", () => {
57 +it("reads highlights only from a completed JSON response", () => {
58 const output = [
58 - { type: "message", content: [{ type: "output_text", text: " ## Highlights\nX " }] },
59 + { type: "message", content: [{ type: "output_text", text: ' {"highlights":[]} ' }] },
60 ];
61 + assert.deepStrictEqual(readReleaseHighlights({ status: "completed", output }), Option.some([]));
62 + assert.deepStrictEqual(readReleaseHighlights({ status: "incomplete", output }), Option.none());
63 +});
64 +
65 +it("counts fixes and performance changes once, outside the selected highlights", () => {
66 + const commits = [
67 + "feat: schedule a task once",
68 + "fix: use the selected time",
69 + "perf(server): read less history",
70 + "fix(mobile): restore the chat position",
71 + "docs: update instructions",
72 + ].map((subject) => ({ subject, authorName: "" }));
73 + const selected = [
74 + { label: "One-time tasks", detail: "Schedule a task for a specific time.", commits: [1, 2] },
75 + ] as const;
76 + assert.deepStrictEqual(
77 + formatReleaseSummary(commits, selected),
78 + Option.some(
79 + "- **One-time tasks.** Schedule a task for a specific time.\n\n### Plus 2 more bug fixes and performance improvements.",
80 + ),
81 + );
82 assert.deepStrictEqual(
61 - summaryText({ status: "completed", output }),
62 - Option.some("## Highlights\nX"),
83 + formatReleaseSummary(commits.slice(0, 2), selected),
84 + Option.some("- **One-time tasks.** Schedule a task for a specific time."),
85 );
64 - assert.deepStrictEqual(summaryText({ status: "incomplete", output }), Option.none());
86 + assert.deepStrictEqual(formatReleaseSummary(commits.slice(2), selected), Option.none());
87 + assert.deepStrictEqual(
88 + formatReleaseSummary(commits, []),
89 + Option.some("**3 bug fixes and performance improvements.**"),
90 + );
91 + assert.deepStrictEqual(formatReleaseSummary(commits.slice(-1), []), Option.some(""));
92 +});
93 +
94 +it("counts fixes beyond the seven displayed highlights in the footer", () => {
95 + const commits = Array.from({ length: 8 }, (_, i) => ({
96 + subject: `fix: change ${i + 1}`,
97 + authorName: "",
98 + }));
99 + const highlights = commits.map((_, i) => ({
100 + label: `Fix ${i + 1}`,
101 + detail: "A fix.",
102 + commits: [i + 1] as const,
103 + }));
104 + const summary = Option.getOrThrow(formatReleaseSummary(commits, highlights));
105 + assert.lengthOf(summary.match(/^- /gm) ?? [], 7);
106 + assert.include(summary, "Plus 1 more bug fix.");
107 });
scripts/generate-release-notes.ts
+67 -44
@@ -20,38 +20,15 @@ const PULL_REQUEST_NUMBER = /\(#(\d+)\)$/;
20 const PULL_REQUEST_BODY_LIMIT = 300;
21 const SUMMARY_MODEL = "gpt-6.1-terra";
22
23 -const SUMMARY_INSTRUCTIONS = `You write release notes for T3 Code, a GUI for coding agents (web and desktop apps backed by a server; providers like Codex, Claude, Cursor, OpenCode).
23 +const SUMMARY_INSTRUCTIONS = `Write up to 7 bullet points for the T3 Code update popover. Cover web, desktop, and server. Mobile has its own release notes.
24
25 -These notes cover the web app, desktop app, and server only. The mobile app has its own release notes, so leave out anything only about mobile, iOS, or Android.
25 +Give a feature a bullet only when it lets users do something they could not do before, removes a real limitation they hit in normal use, or cuts meaningful steps or wait time from a common task. Judge the outcome, regardless of the commit prefix. A new setting, a large diff, or support for one more edge case is not enough.
26
27 -You get the commit subjects merged since the last release, oldest first. Most end with a PR number like (#1234). Each commit shows lines added and removed and files changed, then a trimmed PR description on the next line starting with ">". Use the descriptions to understand what changed for users and why it matters. Line counts hint at size, but a small change can still matter most.
27 +Lead with new capabilities. Give a bug fix its own bullet only when the source shows lost work or a core workflow that users could not complete in normal use. Leave isolated failures, cosmetic polish, and routine fixes in the count. Skip internal work, docs, tests, and dependency bumps. Group commits only when they deliver the same user outcome. Seven is a ceiling. Stop when the qualifying changes run out, even if that leaves zero bullets.
28
29 -Output Markdown in exactly this shape and nothing else:
29 +Each bullet has a short feature name and one sentence of at most 20 words. Say what the user can do or what now works. Use product names people see in the app and leave out protocol or implementation details. Describe the shipped behavior at the end of the range. Mark user-accessible Labs or beta features "(beta)". Skip dev-only features. No title, headings, introduction, example prompts, hype, PR numbers, or em dashes.
30
31 -## Highlights
32 -Up to 4 short sentences. Name only the new features a user would care about most. If no new feature matters to users, write one sentence about the most important fix. Each feature gets a few words that make the benefit clear, not a description of how it works or where the button is.
33 -
34 -## Fixes
35 -- Up to 10 bullets, one fix each, under 10 words, ending with the PR number like (#123). Fewer is fine. Never pad.
36 -- Each bullet names what was broken and says it works now. A user who hit the bug should recognize it.
37 -- Only list fixes from fix commits. New abilities go in Highlights or nowhere. Say "again" only if the commit says it.
38 -
39 -How to write:
40 -- Pick only significant, user-facing changes. Leave out visual polish (focus rings, spacing, colors), layout tweaks, refactors, tests, CI, build, docs, deps, internal tooling, and performance or efficiency work a user would not feel.
41 -- Include Labs and beta features, with "(beta)" after the feature. Leave out work marked internal testing or dev-only.
42 -- Describe each feature as it is at the end of the range. If a beta feature became standard later in the range, it is not beta.
43 -- Say what the user gets, as short as possible. Cut details, conditions, and mechanics.
44 -- No defaults or rollout state ("on by default", "now available", "behind a flag").
45 -- For lists of file types or formats, use common extensions: "previews for .docx, .ttf, .sqlite, .zip and more".
46 -- No internal names, env vars, file paths, or code terms.
47 -- No em dashes. No hype words. Do not invent anything that is not in the input.
48 -
49 -Examples of the tone:
50 -- Bad: "Cmd+K now finds the right thread first, and it searches message text too." Good: "Much better Cmd+K search."
51 -- Bad: "You can share a thread with a guest who watches it live and sends messages that you approve." Good: "Share threads with guests, safely."
52 -- Bad: "Triage issues from the command palette." Good: "Fix and debug T3 Code itself with a new 'triage' command."
53 -- Bad: "Settings and Usage open as large modals over your thread." Good: leave it out.
54 -- Bad: "Cmd/Ctrl+W closes tabs safely (#25860)" Good: "Cmd/Ctrl+W no longer closes the whole window (#25860)"`;
31 +Return JSON with a "highlights" array. For each highlight, give "label" (plain text, no final period), "detail" (one sentence), and "commits" (the bracketed input numbers of all commits it covers). Use the subjects and PR descriptions as source material. The release script adds the formatting, count of remaining fixes and performance improvements, and contributor credit.`;
32
33 class EmptyReleaseRangeError extends Schema.TaggedError<EmptyReleaseRangeError>()(
34 "EmptyReleaseRangeError",
@@ -101,6 +78,49 @@ const SummaryResponse = Schema.Struct({
78 ),
79 });
80
81 +const ReleaseHighlights = Schema.Struct({
82 + highlights: Schema.Array(
83 + Schema.Struct({
84 + label: Schema.NonEmptyString,
85 + detail: Schema.NonEmptyString,
86 + commits: Schema.NonEmptyArray(Schema.Int),
87 + }),
88 + ),
89 +});
90 +const decodeHighlights = Schema.decodeUnknownOption(Schema.fromJsonString(ReleaseHighlights));
91 +
92 +export function formatReleaseSummary(
93 + commits: ReadonlyArray<ReleaseCommit>,
94 + selected: (typeof ReleaseHighlights.Type)["highlights"],
95 +): Option.Option<string> {
96 + const highlights = selected.slice(0, 7);
97 + const covered = new Set(highlights.flatMap((highlight) => highlight.commits));
98 + for (const id of covered) {
99 + const commit = commits[id - 1];
100 + if (!commit || !isReleaseNoteCommit(commit)) return Option.none();
101 + }
102 + const bullets = highlights.map(
103 + ({ label, detail }) => `- **${label.replace(/\.$/, "")}.** ${detail}`,
104 + );
105 + const remaining = commits.flatMap(({ subject }, index) => {
106 + if (covered.has(index + 1)) return [];
107 + return /^(fix|perf)(?:\([^)]*\))?!?:/i.exec(subject)?.[1]?.toLowerCase() ?? [];
108 + });
109 + if (remaining.length === 0) return Option.some(bullets.join("\n"));
110 +
111 + const count = remaining.length;
112 + let kind = "bug fixes and performance improvements";
113 + if (!remaining.includes("perf")) kind = count === 1 ? "bug fix" : "bug fixes";
114 + if (!remaining.includes("fix"))
115 + kind = count === 1 ? "performance improvement" : "performance improvements";
116 + // Older popovers skip headings. A footer paragraph would hide the bullets on those clients.
117 + return Option.some(
118 + bullets.length
119 + ? `${bullets.join("\n")}\n\n### Plus ${count} more ${kind}.`
120 + : `**${count} ${kind}.**`,
121 + );
122 +}
123 +
124 const pullRequestNumber = (subject: string) => {
125 const match = PULL_REQUEST_NUMBER.exec(subject);
126 return match ? Number(match[1]) : undefined;
@@ -129,11 +149,14 @@ function buildSummaryInput(
149 pullRequests: ReadonlyMap<number, PullRequest>,
150 ): string {
151 return commits
132 - .flatMap(({ subject }) => {
152 + .flatMap((commit, index) => {
153 + if (!isReleaseNoteCommit(commit)) return [];
154 + const { subject } = commit;
155 + const source = `[${index + 1}] ${subject}`;
156 const number = pullRequestNumber(subject);
157 const pullRequest = number === undefined ? undefined : pullRequests.get(number);
135 - if (!pullRequest) return [subject];
136 - const line = `${subject} [+${pullRequest.additions} -${pullRequest.deletions}, ${pullRequest.changedFiles} files]`;
158 + if (!pullRequest) return [source];
159 + const line = `${source} [+${pullRequest.additions} -${pullRequest.deletions}, ${pullRequest.changedFiles} files]`;
160 const body = trimPullRequestBody(pullRequest.body);
161 return body ? [line, ` > ${body}`] : [line];
162 })
@@ -175,7 +198,8 @@ function buildReleaseHeader(version: string, changes: number, contributors: numb
198
199 /** The summary leads; GitHub's full list folds under it. Clients cut the body at `<details>`. */
200 function assembleReleaseNotes(header: string, summary: string, fullChangelog: string): string {
178 - return `${header}\n\n${summary.trim()}\n\n<details>\n<summary>Full changelog</summary>\n\n${fullChangelog.trim()}\n\n</details>\n`;
201 + const folded = `<details>\n<summary>Full changelog</summary>\n\n${fullChangelog.trim()}\n\n</details>\n`;
202 + return [header, summary, folded].filter(Boolean).join("\n\n");
203 }
204
205 const run = Effect.fn("generateReleaseNotes.run")(function* (
@@ -261,7 +285,7 @@ const readFullChangelog = Effect.fn("generateReleaseNotes.readFullChangelog")(fu
285 return (yield* decodeJson(GeneratedNotes)(response)).body;
286 });
287
264 -export function summaryText(response: typeof SummaryResponse.Type): Option.Option<string> {
288 +export function readReleaseHighlights(response: typeof SummaryResponse.Type) {
289 // An incomplete response can carry partial text; publishing it would cut the notes short.
290 if (response.status !== "completed") return Option.none();
291 const text = response.output
@@ -269,7 +293,7 @@ export function summaryText(response: typeof SummaryResponse.Type): Option.Optio
293 .flatMap((part) => (part.type === "output_text" && part.text ? [part.text] : []))
294 .join("")
295 .trim();
272 - return text === "" ? Option.none() : Option.some(text);
296 + return Option.map(decodeHighlights(text), ({ highlights }) => highlights);
297 }
298
299 const summarize = Effect.fn("generateReleaseNotes.summarize")(function* (input: string) {
@@ -281,7 +305,8 @@ const summarize = Effect.fn("generateReleaseNotes.summarize")(function* (input:
305 model: SUMMARY_MODEL,
306 reasoning: { effort: "low" },
307 instructions: SUMMARY_INSTRUCTIONS,
284 - input: `Commits:\n${input}`,
308 + text: { format: { type: "json_object" } },
309 + input: `Choose highlights as JSON from these commits:\n${input}`,
310 }),
311 Effect.flatMap(httpClient.execute),
312 Effect.flatMap(HttpClientResponse.filterStatusOk),
@@ -296,7 +321,7 @@ const summarize = Effect.fn("generateReleaseNotes.summarize")(function* (input:
321 outputTokens: response.usage?.output_tokens,
322 }),
323 );
299 - return summaryText(response);
324 + return readReleaseHighlights(response);
325 });
326
327 const command = Command.make(
@@ -311,13 +336,11 @@ const command = Command.make(
336 },
337 ({ repository, tag, ref, previousTag, version, output }) =>
338 Effect.gen(function* () {
314 - // The header counts every commit in the range; the summary skips mobile-only work.
339 const allCommits = yield* readCommits(previousTag, ref);
340 // The spawner ignores exit codes, so a failed git log shows up as an empty range.
341 if (allCommits.length === 0) {
342 return yield* new EmptyReleaseRangeError({ range: `${previousTag}..${ref}` });
343 }
320 - const commits = allCommits.filter(isReleaseNoteCommit);
344 const numbers = [
345 ...new Set(allCommits.flatMap(({ subject }) => pullRequestNumber(subject) ?? [])),
346 ];
@@ -333,11 +356,11 @@ const command = Command.make(
356 allCommits.length,
357 countContributors(allCommits, pullRequests),
358 );
336 - // With no summary, write nothing: the release falls back to GitHub's generated notes.
337 - const summary =
338 - commits.length === 0
339 - ? Option.none<string>()
340 - : yield* summarize(buildSummaryInput(commits, pullRequests));
359 + const input = buildSummaryInput(allCommits, pullRequests);
360 + const selected = input === "" ? Option.some([]) : yield* summarize(input);
361 + const summary = Option.flatMap(selected, (highlights) =>
362 + formatReleaseSummary(allCommits, highlights),
363 + );
364 if (Option.isNone(summary)) {
365 return yield* Effect.logWarning("no release summary, leaving GitHub's notes in place");
366 }
@@ -349,7 +372,7 @@ const command = Command.make(
372 );
373 yield* fs.rename(`${output}.tmp`, output);
374 yield* Effect.logInfo("release notes written").pipe(
352 - Effect.annotateLogs({ output, commits: commits.length }),
375 + Effect.annotateLogs({ output, commits: allCommits.length }),
376 );
377 }),
378 ).pipe(