From eac11c0753dd4792891a8a3bdb3563fd09c006c5 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Thu, 2 Oct 2025 01:08:29 -0400 Subject: ci: stuff --- script/publish.ts | 68 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 25 deletions(-) (limited to 'script') diff --git a/script/publish.ts b/script/publish.ts index 359fa72a4..f1268c00b 100755 --- a/script/publish.ts +++ b/script/publish.ts @@ -1,7 +1,7 @@ #!/usr/bin/env bun import { $ } from "bun" - +import { createOpencodeClient, createOpencodeServer } from "@opencode-ai/sdk" if (process.versions.bun !== "1.2.21") { throw new Error("This script requires bun@1.2.21") } @@ -66,30 +66,48 @@ if (!snapshot) { }) .then((data) => data.tag_name) - console.log("finding commits between", previous, "and", "HEAD") - const commits = await fetch(`https://api.github.com/repos/sst/opencode/compare/${previous}...HEAD`) - .then((res) => res.json()) - .then((data) => data.commits || []) - - const raw = commits.map((commit: any) => `- ${commit.commit.message.split("\n").join(" ")}`) - console.log(raw) - - const notes = - raw - .filter((x: string) => { - const lower = x.toLowerCase() - return ( - !lower.includes("release:") && - !lower.includes("ignore:") && - !lower.includes("chore:") && - !lower.includes("ci:") && - !lower.includes("wip:") && - !lower.includes("docs:") && - !lower.includes("doc:") - ) - }) - .join("\n") || "No notable changes" - + const server = await createOpencodeServer() + const client = createOpencodeClient({ baseUrl: server.url }) + const session = await client.session.create() + console.log("generating changelog since " + previous) + const notes = await client.session + .prompt({ + path: { + id: session.data!.id, + }, + body: { + parts: [ + { + type: "text", + text: ` + Analyze the commits between ${previous} and HEAD. + + We care about changes to + - packages/opencode + - packages/sdk + - packages/plugin + + We do not care about anything else + + Return a changelog of all notable user facing changes. + + - Do NOT make general statements about "improvements", be very specific about what was changed. + - Do NOT include any information about code changes if they do not affect the user facing changes. + + IMPORTANT: ONLY return a bulleted list of changes, do not include any other information. Do not include a preamble like "Based on my analysis..." + + + - Added ability to @ mention agents + - Fixed a bug where the TUI would render improperly on some terminals + + `, + }, + ], + }, + }) + .then((x) => x.data?.parts?.find((y) => y.type === "text")?.text) + console.log(notes) + server.close() await $`gh release create v${version} --title "v${version}" --notes ${notes} ./packages/opencode/dist/*.zip` } if (snapshot) { -- cgit v1.2.3