The open source coding agent.
TypeScript
ci: stuff
Dax Raadeac11c0753dd
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.ymlindex e5678ec3e86..a34405e9e5a 100644--- a/.github/workflows/publish.yml+++ b/.github/workflows/publish.yml@@ -71,3 +71,4 @@ jobs:GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}AUR_KEY: ${{ secrets.AUR_KEY }}NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}+ OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}diff --git a/script/publish.ts b/script/publish.tsindex 359fa72a488..f1268c00ba0 100755--- a/script/publish.ts+++ b/script/publish.ts@@ -1,7 +1,7 @@#!/usr/bin/env bunimport { $ } 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) {