summaryrefslogtreecommitdiffhomepage
path: root/script
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-10-02 01:08:29 -0400
committerDax Raad <[email protected]>2025-10-02 01:08:29 -0400
commiteac11c0753dd4792891a8a3bdb3563fd09c006c5 (patch)
treeb7b239df09c493f76f272c8df7eb9bfad06de186 /script
parent0e804c302cf2ce5b0c1ff50b872f4361991e168a (diff)
downloadopencode-eac11c0753dd4792891a8a3bdb3563fd09c006c5.tar.gz
opencode-eac11c0753dd4792891a8a3bdb3563fd09c006c5.zip
ci: stuff
Diffstat (limited to 'script')
-rwxr-xr-xscript/publish.ts68
1 files changed, 43 insertions, 25 deletions
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 [email protected]")
}
@@ -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..."
+
+ <example>
+ - Added ability to @ mention agents
+ - Fixed a bug where the TUI would render improperly on some terminals
+ </example>
+ `,
+ },
+ ],
+ },
+ })
+ .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) {