diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d1bacee5..485cc6c91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -321,6 +321,11 @@ jobs: contents: write steps: - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + with: + bun-version: "1.3" + - name: Generate release notes from CHANGELOGs + run: bun scripts/ci-release-notes.ts - name: Download release binaries uses: actions/download-artifact@v4 with: @@ -332,6 +337,7 @@ jobs: with: files: | packages/coding-agent/binaries/omp-* + body_path: release-notes.md generate_release_notes: true diff --git a/crates/pi-natives/src/keys.rs b/crates/pi-natives/src/keys.rs index 6cb8747d1..74cd4c036 100644 --- a/crates/pi-natives/src/keys.rs +++ b/crates/pi-natives/src/keys.rs @@ -1063,9 +1063,10 @@ fn parse_key_inner(bytes: &[u8], kitty_protocol_active: bool) -> Option { + try { + const pkg = (await Bun.file(`${pkgDir}/package.json`).json()) as { name?: unknown }; + return typeof pkg.name === "string" ? pkg.name : pkgDir; + } catch { + return pkgDir; + } +} + +const tagInput = process.argv[2] ?? process.env.GITHUB_REF_NAME ?? ""; +if (!tagInput) { + console.error( + "Error: version not provided. Pass as argv (e.g. `v15.4.3`) or set GITHUB_REF_NAME.", + ); + process.exit(1); +} +const version = stripVPrefix(tagInput); +const outputPath = process.argv[3] ?? "release-notes.md"; + +const sections: string[] = []; +const changelogPaths = await Array.fromAsync(changelogGlob.scan(".")); +changelogPaths.sort(); + +for (const changelogPath of changelogPaths) { + const content = await Bun.file(changelogPath).text(); + const section = extractVersionSection(content, version); + if (!section) continue; + const pkgDir = changelogPath.replace(/\/CHANGELOG\.md$/, ""); + const name = await loadPackageName(pkgDir); + sections.push(`## ${name}\n\n${section}`); +} + +if (sections.length === 0) { + console.warn( + `No CHANGELOG entries found for version ${version}; writing empty release notes to ${outputPath}.`, + ); + await Bun.write(outputPath, ""); + process.exit(0); +} + +const body = `${sections.join("\n\n")}\n`; +await Bun.write(outputPath, body); +console.log(`Wrote ${sections.length} package section(s) to ${outputPath} (version ${version}).`);