From 7f6b4dd72bb4c4cc1c7ba7547caf0533ef8cf5a3 Mon Sep 17 00:00:00 2001 From: David Birks Date: Wed, 6 Aug 2025 10:33:39 -0400 Subject: [PATCH 01/20] feat: implement include_co_authored_by configuration option Adds a new config option to control whether co-authored-by text appears in git commit messages and PR descriptions. When set to false, removes opencode attribution from generated commit templates. Defaults to true to maintain existing behavior. --- packages/opencode/src/config/config.ts | 1 + packages/opencode/src/tool/bash.ts | 45 ++++++++++++++++++-------- packages/opencode/src/tool/bash.txt | 15 ++------- 3 files changed, 36 insertions(+), 25 deletions(-) diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index 88fff6bf121..ef4c85f5d70 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -244,6 +244,7 @@ export namespace Config { .optional() .describe("@deprecated Use 'share' field instead. Share newly created sessions automatically"), autoupdate: z.boolean().optional().describe("Automatically update to the latest version"), + include_co_authored_by: z.boolean().optional().describe("Include co-authored-by text in commit messages"), disabled_providers: z.array(z.string()).optional().describe("Disable providers that are loaded automatically"), model: z.string().describe("Model to use in the format of provider/model, eg anthropic/claude-2").optional(), small_model: z diff --git a/packages/opencode/src/tool/bash.ts b/packages/opencode/src/tool/bash.ts index de1eedaa840..dd9068d8095 100644 --- a/packages/opencode/src/tool/bash.ts +++ b/packages/opencode/src/tool/bash.ts @@ -18,6 +18,22 @@ const MAX_TIMEOUT = 10 * 60 * 1000 const log = Log.create({ service: "bash-tool" }) +function replaceCoAuthoredMessage(description: string, includeCoAuthoredBy?: boolean) { + if (includeCoAuthoredBy === false) { + return description.replace("${commitCoAuthored1}", ".") + .replace("${commitCoAuthored2}", "") + .replace("${prCoAuthored}", "") + } + + const generatedWith = "🤖 Generated with [opencode](https://opencode.ai)" + const coAuthoredBy = `${generatedWith}\nCo-Authored-By: opencode ` + + // Add co-authoring text when option is true + return description.replace("${commitCoAuthored1}", ` ending with:\n ${coAuthoredBy}`) + .replace("${commitCoAuthored2}", `\n\n ${coAuthoredBy}`) + .replace("${prCoAuthored}", `\n\n${generatedWith}`) +} + const parser = lazy(async () => { const { default: Parser } = await import("tree-sitter") const Bash = await import("tree-sitter-bash") @@ -26,18 +42,20 @@ const parser = lazy(async () => { return p }) -export const BashTool = Tool.define("bash", { - description: DESCRIPTION, - parameters: z.object({ - command: z.string().describe("The command to execute"), - timeout: z.number().describe("Optional timeout in milliseconds").optional(), - description: z - .string() - .describe( - "Clear, concise description of what this command does in 5-10 words. Examples:\nInput: ls\nOutput: Lists files in current directory\n\nInput: git status\nOutput: Shows working tree status\n\nInput: npm install\nOutput: Installs package dependencies\n\nInput: mkdir foo\nOutput: Creates directory 'foo'", - ), - }), - async execute(params, ctx) { +export const BashTool = Tool.define("bash", async () => { + const cfg = await Config.get() + return { + description: replaceCoAuthoredMessage(DESCRIPTION, cfg.include_co_authored_by), + parameters: z.object({ + command: z.string().describe("The command to execute"), + timeout: z.number().describe("Optional timeout in milliseconds").optional(), + description: z + .string() + .describe( + "Clear, concise description of what this command does in 5-10 words. Examples:\nInput: ls\nOutput: Lists files in current directory\n\nInput: git status\nOutput: Shows working tree status\n\nInput: npm install\nOutput: Installs package dependencies\n\nInput: mkdir foo\nOutput: Creates directory 'foo'", + ), + }), + async execute(params, ctx) { const timeout = Math.min(params.timeout ?? DEFAULT_TIMEOUT, MAX_TIMEOUT) const app = App.info() const cfg = await Config.get() @@ -152,5 +170,6 @@ export const BashTool = Tool.define("bash", { }, output: [``, stdout ?? "", ``, ``, stderr ?? "", ``].join("\n"), } - }, + }, + } }) diff --git a/packages/opencode/src/tool/bash.txt b/packages/opencode/src/tool/bash.txt index caf2515edc2..3cb674a79f4 100644 --- a/packages/opencode/src/tool/bash.txt +++ b/packages/opencode/src/tool/bash.txt @@ -59,10 +59,7 @@ When the user asks you to create a new git commit, follow these steps carefully: 3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel: - Add relevant untracked files to the staging area. - - Create the commit with a message ending with: - 🤖 Generated with [opencode](https://opencode.ai) - - Co-Authored-By: opencode + - Create the commit with a message${commitCoAuthored1} - Run git status to make sure the commit succeeded. 4. If the commit fails due to pre-commit hook changes, retry the commit ONCE to include these automated changes. If it fails again, it usually means a pre-commit hook is preventing the commit. If the commit succeeds but you notice that files were modified by the pre-commit hook, you MUST amend your commit to include them. @@ -79,11 +76,7 @@ Important notes: - In order to ensure good formatting, ALWAYS pass the commit message via a HEREDOC, a la this example: git commit -m "$(cat <<'EOF' - Commit message here. - - 🤖 Generated with [opencode](https://opencode.ai) - - Co-Authored-By: opencode + Commit message here.${commitCoAuthored2} EOF )" @@ -126,9 +119,7 @@ gh pr create --title "the pr title" --body "$(cat <<'EOF' <1-3 bullet points> ## Test plan -[Checklist of TODOs for testing the pull request...] - -🤖 Generated with [opencode](https://opencode.ai) +[Checklist of TODOs for testing the pull request...]${prCoAuthored} EOF )" From 607f2b3faae46539d9a17babb420370c8f7bbaf7 Mon Sep 17 00:00:00 2001 From: David Birks Date: Wed, 6 Aug 2025 10:46:39 -0400 Subject: [PATCH 02/20] ci: disable deploy workflow for fork The deploy workflow requires CLOUDFLARE_API_TOKEN secret which is not available in forks. Disabled automatic deployment on push to avoid failed runs. --- .github/workflows/deploy.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 99d96eeb803..5460e5cd230 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,10 +1,11 @@ name: deploy on: - push: - branches: - - dev - - production + # Disabled for forks - requires CLOUDFLARE_API_TOKEN secret + # push: + # branches: + # - dev + # - production workflow_dispatch: concurrency: ${{ github.workflow }}-${{ github.ref }} From 4456714594ca82ec77adbcd4a02412f02095fa33 Mon Sep 17 00:00:00 2001 From: David Birks Date: Wed, 6 Aug 2025 10:53:14 -0400 Subject: [PATCH 03/20] ci: disable external publishing for fork Comment out npm, AUR, and homebrew publishing steps that require external credentials. Keep only GitHub releases functionality for testing the include_co_authored_by feature. --- packages/opencode/script/publish.ts | 12 ++++++++++-- packages/plugin/script/publish.ts | 3 +++ packages/sdk/js/script/publish.ts | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts index c38148b4b2a..a587bba4bbb 100755 --- a/packages/opencode/script/publish.ts +++ b/packages/opencode/script/publish.ts @@ -52,7 +52,8 @@ for (const [os, arch] of targets) { 2, ), ) - if (!dry) await $`cd dist/${name} && chmod 777 -R . && bun publish --access public --tag ${npmTag}` + // Skip npm publishing for fork - requires NPM_CONFIG_TOKEN + // if (!dry) await $`cd dist/${name} && chmod 777 -R . && bun publish --access public --tag ${npmTag}` optionalDependencies[name] = version } @@ -76,7 +77,8 @@ await Bun.file(`./dist/${pkg.name}/package.json`).write( 2, ), ) -if (!dry) await $`cd ./dist/${pkg.name} && bun publish --access public --tag ${npmTag}` +// Skip npm publishing for fork - requires NPM_CONFIG_TOKEN +// if (!dry) await $`cd ./dist/${pkg.name} && bun publish --access public --tag ${npmTag}` if (!snapshot) { // Github Release @@ -123,6 +125,8 @@ if (!snapshot) { const macX64Sha = await $`sha256sum ./dist/opencode-darwin-x64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) const macArm64Sha = await $`sha256sum ./dist/opencode-darwin-arm64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) + // Skip AUR publishing for fork - requires SSH keys + /* // AUR package const pkgbuild = [ "# Maintainer: dax", @@ -162,7 +166,10 @@ if (!snapshot) { await $`cd ./dist/aur-${pkg} && git commit -m "Update to v${version}"` if (!dry) await $`cd ./dist/aur-${pkg} && git push` } + */ + // Skip Homebrew publishing for fork - requires push access to sst/homebrew-tap + /* // Homebrew formula const homebrewFormula = [ "# typed: false", @@ -220,4 +227,5 @@ if (!snapshot) { await $`cd ./dist/homebrew-tap && git add opencode.rb` await $`cd ./dist/homebrew-tap && git commit -m "Update to v${version}"` if (!dry) await $`cd ./dist/homebrew-tap && git push` + */ } diff --git a/packages/plugin/script/publish.ts b/packages/plugin/script/publish.ts index b984fd4f404..29ae50ffe48 100644 --- a/packages/plugin/script/publish.ts +++ b/packages/plugin/script/publish.ts @@ -9,6 +9,8 @@ const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true" await $`bun tsc` +// Skip npm publishing for fork - requires NPM_CONFIG_TOKEN +/* if (snapshot) { await $`bun publish --tag snapshot --access public` await $`git checkout package.json` @@ -16,3 +18,4 @@ if (snapshot) { if (!snapshot) { await $`bun publish --access public` } +*/ diff --git a/packages/sdk/js/script/publish.ts b/packages/sdk/js/script/publish.ts index 389a9376c66..10f1ab7f8b0 100644 --- a/packages/sdk/js/script/publish.ts +++ b/packages/sdk/js/script/publish.ts @@ -11,9 +11,12 @@ await $`bun tsc` const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true" +// Skip npm publishing for fork - requires NPM_CONFIG_TOKEN +/* if (snapshot) { await $`bun publish --tag snapshot` } if (!snapshot) { await $`bun publish` } +*/ From eeba5c4e8fb55120f463d0d3697299c66ec8d328 Mon Sep 17 00:00:00 2001 From: David Birks Date: Wed, 6 Aug 2025 10:53:39 -0400 Subject: [PATCH 04/20] fix: remove unused variables from publish script Comment out npmTag and SHA calculations that are no longer used after disabling external publishing. --- packages/opencode/script/publish.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts index a587bba4bbb..7159a58a37f 100755 --- a/packages/opencode/script/publish.ts +++ b/packages/opencode/script/publish.ts @@ -30,7 +30,7 @@ const targets = [ await $`rm -rf dist` const optionalDependencies: Record = {} -const npmTag = snapshot ? "snapshot" : "latest" +// const npmTag = snapshot ? "snapshot" : "latest" // Commented out for fork for (const [os, arch] of targets) { console.log(`building ${os}-${arch}`) const name = `${pkg.name}-${os}-${arch}` @@ -119,11 +119,14 @@ if (!snapshot) { if (!dry) await $`gh release create v${version} --title "v${version}" --notes ${notes} ./dist/*.zip` + // Skip SHA calculation for fork - only needed for AUR/Homebrew + /* // Calculate SHA values const arm64Sha = await $`sha256sum ./dist/opencode-linux-arm64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) const x64Sha = await $`sha256sum ./dist/opencode-linux-x64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) const macX64Sha = await $`sha256sum ./dist/opencode-darwin-x64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) const macArm64Sha = await $`sha256sum ./dist/opencode-darwin-arm64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) + */ // Skip AUR publishing for fork - requires SSH keys /* From 92e842a814d393ce088a5b7aac3d65465ac5859b Mon Sep 17 00:00:00 2001 From: David Birks Date: Wed, 6 Aug 2025 11:02:48 -0400 Subject: [PATCH 05/20] fix: restore chmod permissions for binary files The chmod command was accidentally commented out with npm publishing, causing zip permission failures. Restore chmod 777 for binary files to fix GitHub release creation. --- packages/opencode/script/publish.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts index 7159a58a37f..94e69a30862 100755 --- a/packages/opencode/script/publish.ts +++ b/packages/opencode/script/publish.ts @@ -52,6 +52,8 @@ for (const [os, arch] of targets) { 2, ), ) + // Set permissions for binary files + await $`cd dist/${name} && chmod 777 -R .` // Skip npm publishing for fork - requires NPM_CONFIG_TOKEN // if (!dry) await $`cd dist/${name} && chmod 777 -R . && bun publish --access public --tag ${npmTag}` optionalDependencies[name] = version From 663ed74ac1aed46edc400c8d32565b64421c30d9 Mon Sep 17 00:00:00 2001 From: David Birks Date: Wed, 6 Aug 2025 11:03:16 -0400 Subject: [PATCH 06/20] docs: add fork notice with include_co_authored_by feature documentation Add prominent notice explaining the new configurable co-authored text feature with usage examples and configuration instructions. --- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/README.md b/README.md index c35d5d8901d..2de0661096b 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,58 @@ --- +## 🚨 Fork Notice + +This is a fork of [sst/opencode](https://github.com/sst/opencode) with the following enhancement: + +### **✨ New Feature: Configurable Co-Authored Text** + +**Feature:** Add `include_co_authored_by` configuration option to control whether opencode adds co-authored text to git commit messages and PR descriptions. + +**Implementation:** +- **Files Modified:** `packages/opencode/src/config/config.ts`, `packages/opencode/src/tool/bash.ts`, `packages/opencode/src/tool/bash.txt` +- **Status:** Ready for upstream contribution + +### **How to Enable/Disable Co-Authored Text** + +#### **Disable Co-Authored Text (New Option)** +```bash +# Global configuration +mkdir -p ~/.config/opencode +cat > ~/.config/opencode/opencode.json << 'EOF' +{ + "$schema": "https://opencode.ai/config.json", + "include_co_authored_by": false +} +EOF + +# OR Project-level configuration +cat > opencode.json << 'EOF' +{ + "$schema": "https://opencode.ai/config.json", + "include_co_authored_by": false +} +EOF +``` + +#### **Behavior Changes** + +**With `include_co_authored_by: true` (default):** +```bash +git commit -m "Your commit message + +🤖 Generated with [opencode](https://opencode.ai) + +Co-Authored-By: opencode " +``` + +**With `include_co_authored_by: false`:** +```bash +git commit -m "Your commit message." +``` + +--- + ### Installation ```bash From 78d70341357b3e62d07fe7bdd261b693b9e90c10 Mon Sep 17 00:00:00 2001 From: David Birks Date: Wed, 6 Aug 2025 11:10:58 -0400 Subject: [PATCH 07/20] fix: use correct GitHub token for gh CLI Change from GITHUB_TOKEN to GH_TOKEN (required by gh CLI) and use standard github.token instead of secrets.SST_GITHUB_TOKEN which doesn't exist in forks. --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 97b943c9534..2afe21c89df 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -69,6 +69,6 @@ jobs: run: | OPENCODE_VERSION=${{ inputs.version }} ./script/publish.ts env: - GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }} + GH_TOKEN: ${{ github.token }} AUR_KEY: ${{ secrets.AUR_KEY }} NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} From a0271391645e0f495459529b97d58ee4ae71fd5e Mon Sep 17 00:00:00 2001 From: opencode Date: Wed, 6 Aug 2025 15:16:27 +0000 Subject: [PATCH 08/20] release: v0.4.0 --- bun.lock | 10 +++++----- packages/function/package.json | 2 +- packages/opencode/package.json | 2 +- packages/plugin/package.json | 2 +- packages/sdk/js/package.json | 2 +- packages/sdk/js/src/gen/types.gen.ts | 4 ++++ packages/web/package.json | 2 +- sdks/vscode/package.json | 2 +- 8 files changed, 15 insertions(+), 11 deletions(-) diff --git a/bun.lock b/bun.lock index 39c91701928..803d2ea8cdc 100644 --- a/bun.lock +++ b/bun.lock @@ -10,7 +10,7 @@ }, "packages/function": { "name": "@opencode/function", - "version": "0.3.130", + "version": "0.4.0", "dependencies": { "@ai-sdk/anthropic": "2.0.0", "@ai-sdk/openai": "2.0.2", @@ -30,7 +30,7 @@ }, "packages/opencode": { "name": "opencode", - "version": "0.3.130", + "version": "0.4.0", "bin": { "opencode": "./bin/opencode", }, @@ -83,7 +83,7 @@ }, "packages/plugin": { "name": "@opencode-ai/plugin", - "version": "0.3.130", + "version": "0.4.0", "dependencies": { "@opencode-ai/sdk": "workspace:*", }, @@ -95,7 +95,7 @@ }, "packages/sdk/js": { "name": "@opencode-ai/sdk", - "version": "0.3.130", + "version": "0.4.0", "devDependencies": { "@hey-api/openapi-ts": "0.80.1", "@tsconfig/node22": "catalog:", @@ -104,7 +104,7 @@ }, "packages/web": { "name": "@opencode/web", - "version": "0.3.130", + "version": "0.4.0", "dependencies": { "@astrojs/cloudflare": "^12.5.4", "@astrojs/markdown-remark": "6.3.1", diff --git a/packages/function/package.json b/packages/function/package.json index 52d621eb13b..5ba7f10a6b0 100644 --- a/packages/function/package.json +++ b/packages/function/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/function", - "version": "0.3.130", + "version": "0.4.0", "$schema": "https://json.schemastore.org/package.json", "private": true, "type": "module", diff --git a/packages/opencode/package.json b/packages/opencode/package.json index 0c95da93df9..17a1ac4f974 100644 --- a/packages/opencode/package.json +++ b/packages/opencode/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "0.3.130", + "version": "0.4.0", "name": "opencode", "type": "module", "private": true, diff --git a/packages/plugin/package.json b/packages/plugin/package.json index e469a266154..0fc2bf2f902 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode-ai/plugin", - "version": "0.3.130", + "version": "0.4.0", "type": "module", "scripts": { "typecheck": "tsc --noEmit" diff --git a/packages/sdk/js/package.json b/packages/sdk/js/package.json index 24a01c1ef67..c08d1897acc 100644 --- a/packages/sdk/js/package.json +++ b/packages/sdk/js/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode-ai/sdk", - "version": "0.3.130", + "version": "0.4.0", "type": "module", "scripts": { "typecheck": "tsc --noEmit" diff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.ts index 74fa1a4fb3d..fe0d6f3500b 100644 --- a/packages/sdk/js/src/gen/types.gen.ts +++ b/packages/sdk/js/src/gen/types.gen.ts @@ -549,6 +549,10 @@ export type Config = { * Automatically update to the latest version */ autoupdate?: boolean + /** + * Include co-authored-by text in commit messages + */ + include_co_authored_by?: boolean /** * Disable providers that are loaded automatically */ diff --git a/packages/web/package.json b/packages/web/package.json index 433c0290847..72ed9559f66 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,7 +1,7 @@ { "name": "@opencode/web", "type": "module", - "version": "0.3.130", + "version": "0.4.0", "scripts": { "dev": "astro dev", "dev:remote": "sst shell --stage=dev --target=Web astro dev", diff --git a/sdks/vscode/package.json b/sdks/vscode/package.json index dda6ed81411..e991ae19ea5 100644 --- a/sdks/vscode/package.json +++ b/sdks/vscode/package.json @@ -2,7 +2,7 @@ "name": "opencode", "displayName": "opencode", "description": "opencode for VS Code", - "version": "0.3.130", + "version": "0.4.0", "publisher": "sst-dev", "repository": { "type": "git", From d4ce9023fa8ecf6d29ad8d6f402546dfbf119f99 Mon Sep 17 00:00:00 2001 From: David Birks Date: Wed, 6 Aug 2025 11:26:10 -0400 Subject: [PATCH 09/20] docs: add upstream PR reference for include_co_authored_by feature Reference the original PR #1369 from sst/opencode that this implementation is based on, and remove internal implementation details from user-facing documentation. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2de0661096b..c440596c7aa 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,9 @@ This is a fork of [sst/opencode](https://github.com/sst/opencode) with the follo **Feature:** Add `include_co_authored_by` configuration option to control whether opencode adds co-authored text to git commit messages and PR descriptions. -**Implementation:** -- **Files Modified:** `packages/opencode/src/config/config.ts`, `packages/opencode/src/tool/bash.ts`, `packages/opencode/src/tool/bash.txt` -- **Status:** Ready for upstream contribution +**Based on:** [sst/opencode PR #1369](https://github.com/sst/opencode/pull/1369) - "implement the includeCoAuthoredBy option" + +**Status:** Ready for upstream contribution ### **How to Enable/Disable Co-Authored Text** From 935a5ac2074d0394d19534f854a3d0a1921eb61e Mon Sep 17 00:00:00 2001 From: David Birks Date: Mon, 11 Aug 2025 11:30:46 -0400 Subject: [PATCH 10/20] fix: remove dangling comment in publish script --- packages/opencode/script/publish.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts index 73970149492..7888a62a4ac 100755 --- a/packages/opencode/script/publish.ts +++ b/packages/opencode/script/publish.ts @@ -127,12 +127,12 @@ if (!snapshot) { .join("\n") || "No notable changes" if (!dry) await $`gh release create v${version} --title "v${version}" --notes ${notes} ./dist/*.zip` + // Calculate SHA values const arm64Sha = await $`sha256sum ./dist/opencode-linux-arm64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) const x64Sha = await $`sha256sum ./dist/opencode-linux-x64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) const macX64Sha = await $`sha256sum ./dist/opencode-darwin-x64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) const macArm64Sha = await $`sha256sum ./dist/opencode-darwin-arm64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) - */ // Skip AUR publishing for fork - requires SSH keys /* From d633a8eec7178ba5bdb78b2f5a369989fdfcd199 Mon Sep 17 00:00:00 2001 From: David Birks Date: Mon, 11 Aug 2025 11:31:08 -0400 Subject: [PATCH 11/20] fix: comment out unused SHA variables --- packages/opencode/script/publish.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts index 7888a62a4ac..33b3217ce46 100755 --- a/packages/opencode/script/publish.ts +++ b/packages/opencode/script/publish.ts @@ -128,11 +128,13 @@ if (!snapshot) { if (!dry) await $`gh release create v${version} --title "v${version}" --notes ${notes} ./dist/*.zip` - // Calculate SHA values + // Calculate SHA values - needed for AUR/Homebrew + /* const arm64Sha = await $`sha256sum ./dist/opencode-linux-arm64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) const x64Sha = await $`sha256sum ./dist/opencode-linux-x64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) const macX64Sha = await $`sha256sum ./dist/opencode-darwin-x64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) const macArm64Sha = await $`sha256sum ./dist/opencode-darwin-arm64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) + */ // Skip AUR publishing for fork - requires SSH keys /* From 2160001100b28c4449c9da4e55a7c296c6dd5381 Mon Sep 17 00:00:00 2001 From: David Birks Date: Mon, 11 Aug 2025 11:37:57 -0400 Subject: [PATCH 12/20] release: v0.5.0 Bump version to 0.5.0 across all packages --- packages/function/package.json | 2 +- packages/opencode/package.json | 2 +- packages/plugin/package.json | 2 +- packages/web/package.json | 2 +- sdks/vscode/package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/function/package.json b/packages/function/package.json index e692b5b643e..8f0342881db 100644 --- a/packages/function/package.json +++ b/packages/function/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/function", - "version": "0.4.17", + "version": "0.5.0", "$schema": "https://json.schemastore.org/package.json", "private": true, "type": "module", diff --git a/packages/opencode/package.json b/packages/opencode/package.json index ffa0adff5b1..69656c19277 100644 --- a/packages/opencode/package.json +++ b/packages/opencode/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "0.4.17", + "version": "0.5.0", "name": "opencode", "type": "module", "private": true, diff --git a/packages/plugin/package.json b/packages/plugin/package.json index f6bb4e20e58..f846df94ada 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode-ai/plugin", - "version": "0.4.17", + "version": "0.5.0", "type": "module", "scripts": { "typecheck": "tsc --noEmit" diff --git a/packages/web/package.json b/packages/web/package.json index cc49971fa60..0aa79558d62 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,7 +1,7 @@ { "name": "@opencode/web", "type": "module", - "version": "0.4.17", + "version": "0.5.0", "scripts": { "dev": "astro dev", "dev:remote": "sst shell --stage=dev --target=Web astro dev", diff --git a/sdks/vscode/package.json b/sdks/vscode/package.json index 74efa7f26dd..2a0c4e7aab8 100644 --- a/sdks/vscode/package.json +++ b/sdks/vscode/package.json @@ -2,7 +2,7 @@ "name": "opencode", "displayName": "opencode", "description": "opencode for VS Code", - "version": "0.4.17", + "version": "0.5.0", "publisher": "sst-dev", "repository": { "type": "git", From e67d101be551642dde4f5615dc60574eb8b197f2 Mon Sep 17 00:00:00 2001 From: David Birks Date: Mon, 18 Aug 2025 09:56:44 -0400 Subject: [PATCH 13/20] fix: add missing Config import in bash.ts --- packages/opencode/src/tool/bash.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/opencode/src/tool/bash.ts b/packages/opencode/src/tool/bash.ts index 6532232083a..f0217f3e1cc 100644 --- a/packages/opencode/src/tool/bash.ts +++ b/packages/opencode/src/tool/bash.ts @@ -11,6 +11,7 @@ import { Log } from "../util/log" import { Wildcard } from "../util/wildcard" import { $ } from "bun" import { Agent } from "../agent/agent" +import { Config } from "../config/config" const MAX_OUTPUT_LENGTH = 30_000 const DEFAULT_TIMEOUT = 1 * 60 * 1000 From 0396f1ac11bd4111811144e6c97e8bef3f5295b3 Mon Sep 17 00:00:00 2001 From: David Birks Date: Mon, 18 Aug 2025 10:01:34 -0400 Subject: [PATCH 14/20] fix: disable npm publishing for fork --- packages/opencode/script/publish.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts index 74cd3dfa6b0..08e554112e6 100755 --- a/packages/opencode/script/publish.ts +++ b/packages/opencode/script/publish.ts @@ -60,7 +60,8 @@ for (const [os, arch] of targets) { 2, ), ) - if (!dry) await $`cd dist/${name} && chmod 777 -R . && bun publish --access public --tag ${npmTag}` + // Skip npm publishing for fork - requires NPM_CONFIG_TOKEN + // if (!dry) await $`cd dist/${name} && chmod 777 -R . && bun publish --access public --tag ${npmTag}` optionalDependencies[name] = version } @@ -84,7 +85,8 @@ await Bun.file(`./dist/${pkg.name}/package.json`).write( 2, ), ) -if (!dry) await $`cd ./dist/${pkg.name} && bun publish --access public --tag ${npmTag}` +// Skip npm publishing for fork - requires NPM_CONFIG_TOKEN +// if (!dry) await $`cd ./dist/${pkg.name} && bun publish --access public --tag ${npmTag}` if (!snapshot) { for (const key of Object.keys(optionalDependencies)) { From fbf0c90bd868c3309fdefbca5cd9f3b284793385 Mon Sep 17 00:00:00 2001 From: David Birks Date: Mon, 18 Aug 2025 10:01:53 -0400 Subject: [PATCH 15/20] fix: comment out unused npmTag variable --- packages/opencode/script/publish.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts index 08e554112e6..0a9f61cc4fe 100755 --- a/packages/opencode/script/publish.ts +++ b/packages/opencode/script/publish.ts @@ -30,7 +30,7 @@ const targets = [ await $`rm -rf dist` const optionalDependencies: Record = {} -const npmTag = snapshot ? "snapshot" : "latest" +// const npmTag = snapshot ? "snapshot" : "latest" // Commented out for fork for (const [os, arch] of targets) { console.log(`building ${os}-${arch}`) const name = `${pkg.name}-${os}-${arch}` From 9a435b8e93f48e140f77fc3af42f4acc8d4e2763 Mon Sep 17 00:00:00 2001 From: David Birks Date: Mon, 18 Aug 2025 11:37:34 -0400 Subject: [PATCH 16/20] fix: restore chmod permissions for binary files --- packages/opencode/script/publish.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts index 0a9f61cc4fe..8056443db08 100755 --- a/packages/opencode/script/publish.ts +++ b/packages/opencode/script/publish.ts @@ -60,6 +60,8 @@ for (const [os, arch] of targets) { 2, ), ) + // Set permissions for binary files + await $`cd dist/${name} && chmod 777 -R .` // Skip npm publishing for fork - requires NPM_CONFIG_TOKEN // if (!dry) await $`cd dist/${name} && chmod 777 -R . && bun publish --access public --tag ${npmTag}` optionalDependencies[name] = version From d2b29fd13dbfbd777aa4d368737446e2c1f91230 Mon Sep 17 00:00:00 2001 From: David Birks Date: Mon, 18 Aug 2025 11:41:37 -0400 Subject: [PATCH 17/20] feat: add automated fork update script This script automates: - Fetching upstream changes - Merging upstream/dev - Triggering GitHub Actions release with -fork version - Preserving fork-specific features --- script/update-fork.sh | 99 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100755 script/update-fork.sh diff --git a/script/update-fork.sh b/script/update-fork.sh new file mode 100755 index 00000000000..22085f4b0c3 --- /dev/null +++ b/script/update-fork.sh @@ -0,0 +1,99 @@ +#!/bin/bash + +# OpenCode Fork Update Script +# Automates the process of updating the fork from upstream and creating a new -fork release + +set -e # Exit on any error + +echo "🔄 OpenCode Fork Update Script" +echo "==============================" + +# Check if we're in the right directory +if [ ! -f "packages/opencode/package.json" ]; then + echo "❌ Error: Please run this script from the root of the opencode repository" + exit 1 +fi + +# Check if upstream remote exists +if ! git remote | grep -q "upstream"; then + echo "❌ Error: No 'upstream' remote found. Please add it first:" + echo " git remote add upstream https://github.com/sst/opencode.git" + exit 1 +fi + +# Check if we're on dev branch +current_branch=$(git branch --show-current) +if [ "$current_branch" != "dev" ]; then + echo "❌ Error: Please switch to the 'dev' branch first" + echo " git checkout dev" + exit 1 +fi + +# Check for uncommitted changes +if ! git diff --quiet || ! git diff --cached --quiet; then + echo "❌ Error: You have uncommitted changes. Please commit or stash them first." + exit 1 +fi + +echo "✅ Pre-flight checks passed" +echo + +# Step 1: Fetch upstream changes +echo "📡 Step 1: Fetching upstream changes..." +git fetch upstream +echo "✅ Upstream fetched" + +# Step 2: Get the latest upstream version +echo "🔍 Step 2: Checking latest upstream version..." +latest_upstream_tag=$(git tag --list --sort=-version:refname | grep -E "^v[0-9]" | head -1) +latest_upstream_version=${latest_upstream_tag#v} # Remove 'v' prefix +echo "📍 Latest upstream version: $latest_upstream_version" + +# Step 3: Merge upstream changes +echo "🔀 Step 3: Merging upstream/dev..." +if ! git merge upstream/dev; then + echo "❌ Merge conflicts detected! Please resolve them manually and run:" + echo " git add ." + echo " git commit -m 'Merge upstream/dev'" + echo " Then re-run this script" + exit 1 +fi +echo "✅ Merged upstream changes" + +# Step 4: Create fork version +fork_version="$latest_upstream_version-fork" +echo "🏷️ Step 4: Creating fork version: $fork_version" + +# Step 5: Push changes +echo "📤 Step 5: Pushing changes to origin..." +git push origin dev +echo "✅ Changes pushed" + +# Step 6: Trigger GitHub Actions release +echo "🚀 Step 6: Triggering GitHub Actions release for v$fork_version..." +gh workflow run publish.yml --repo dbirks/opencode --field version="$fork_version" +echo "✅ Release workflow triggered" + +# Step 7: Monitor workflow (optional) +echo "👁️ Step 7: Monitoring workflow..." +echo " You can monitor the release at:" +echo " https://github.com/dbirks/opencode/actions" +echo +echo " Or run this command to watch progress:" +echo " gh run list --repo dbirks/opencode --limit 1" + +echo +echo "🎉 Fork update process completed!" +echo " Fork version: $fork_version" +echo " The GitHub Actions workflow is now building your release." +echo +echo "📝 What was done:" +echo " ✅ Fetched latest upstream changes" +echo " ✅ Merged upstream/dev into your fork" +echo " ✅ Pushed changes to your fork" +echo " ✅ Triggered release workflow for v$fork_version" +echo +echo "🔮 Next steps:" +echo " • Wait for the GitHub Actions workflow to complete" +echo " • Your fork-specific features are preserved" +echo " • New release will be available with latest upstream features" \ No newline at end of file From e5d765b8d4b921117e6a8f32c618d8a2d7eb3430 Mon Sep 17 00:00:00 2001 From: David Birks Date: Mon, 18 Aug 2025 11:43:29 -0400 Subject: [PATCH 18/20] fix: disable Homebrew publishing for fork --- packages/opencode/script/publish.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts index 8056443db08..c6b10fb3514 100755 --- a/packages/opencode/script/publish.ts +++ b/packages/opencode/script/publish.ts @@ -142,6 +142,8 @@ if (!snapshot) { } */ + // Skip Homebrew publishing for fork - requires push access to sst/homebrew-tap + /* // Homebrew formula const homebrewFormula = [ "# typed: false", @@ -199,4 +201,5 @@ if (!snapshot) { await $`cd ./dist/homebrew-tap && git add opencode.rb` await $`cd ./dist/homebrew-tap && git commit -m "Update to v${version}"` if (!dry) await $`cd ./dist/homebrew-tap && git push` + */ } From a90fb5a0e3b69dd361a570dfc536e8e1c43f5186 Mon Sep 17 00:00:00 2001 From: David Birks Date: Mon, 18 Aug 2025 11:44:02 -0400 Subject: [PATCH 19/20] fix: comment out unused variables for fork --- packages/opencode/script/publish.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts index c6b10fb3514..2e97701d0e5 100755 --- a/packages/opencode/script/publish.ts +++ b/packages/opencode/script/publish.ts @@ -5,7 +5,7 @@ import { $ } from "bun" import pkg from "../package.json" -const dry = process.env["OPENCODE_DRY"] === "true" +// const dry = process.env["OPENCODE_DRY"] === "true" // Commented out for fork const version = process.env["OPENCODE_VERSION"]! const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true" @@ -95,11 +95,13 @@ if (!snapshot) { await $`cd dist/${key}/bin && zip -r ../../${key}.zip *` } - // Calculate SHA values + // Calculate SHA values - needed for AUR/Homebrew publishing (disabled for fork) + /* const arm64Sha = await $`sha256sum ./dist/opencode-linux-arm64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) const x64Sha = await $`sha256sum ./dist/opencode-linux-x64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) const macX64Sha = await $`sha256sum ./dist/opencode-darwin-x64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) const macArm64Sha = await $`sha256sum ./dist/opencode-darwin-arm64.zip | cut -d' ' -f1`.text().then((x) => x.trim()) + */ /* AUR package - commented out as AUR is down const pkgbuild = [ From 9d5e818b5a679c406d9c7ad8bdce6a42c597623d Mon Sep 17 00:00:00 2001 From: opencode Date: Mon, 18 Aug 2025 15:47:37 +0000 Subject: [PATCH 20/20] release: v0.5.5-fork --- cloud/app/package.json | 2 +- cloud/core/package.json | 2 +- cloud/function/package.json | 2 +- cloud/web/package.json | 2 +- packages/function/package.json | 2 +- packages/opencode/package.json | 2 +- packages/plugin/package.json | 2 +- packages/sdk/js/package.json | 2 +- packages/sdk/js/src/gen/types.gen.ts | 7 +++++++ packages/web/package.json | 2 +- sdks/vscode/package.json | 2 +- 11 files changed, 17 insertions(+), 10 deletions(-) diff --git a/cloud/app/package.json b/cloud/app/package.json index 72163d18aa1..e75d3800fe0 100644 --- a/cloud/app/package.json +++ b/cloud/app/package.json @@ -5,7 +5,7 @@ "dev": "vinxi dev --host 0.0.0.0", "build": "vinxi build", "start": "vinxi start", - "version": "0.5.5" + "version": "0.5.5-fork" }, "dependencies": { "@ibm/plex": "6.4.1", diff --git a/cloud/core/package.json b/cloud/core/package.json index 1da17a1754e..e410002af57 100644 --- a/cloud/core/package.json +++ b/cloud/core/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/cloud-core", - "version": "0.5.5", + "version": "0.5.5-fork", "private": true, "type": "module", "dependencies": { diff --git a/cloud/function/package.json b/cloud/function/package.json index d2aa13ed0db..40c2bdb7df5 100644 --- a/cloud/function/package.json +++ b/cloud/function/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/cloud-function", - "version": "0.5.5", + "version": "0.5.5-fork", "$schema": "https://json.schemastore.org/package.json", "private": true, "type": "module", diff --git a/cloud/web/package.json b/cloud/web/package.json index 8246cefe0b6..30017405b16 100644 --- a/cloud/web/package.json +++ b/cloud/web/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/cloud-web", - "version": "0.5.5", + "version": "0.5.5-fork", "private": true, "description": "", "type": "module", diff --git a/packages/function/package.json b/packages/function/package.json index 211ebb5c9c8..60c71e70a21 100644 --- a/packages/function/package.json +++ b/packages/function/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/function", - "version": "0.5.5", + "version": "0.5.5-fork", "$schema": "https://json.schemastore.org/package.json", "private": true, "type": "module", diff --git a/packages/opencode/package.json b/packages/opencode/package.json index 9b288567ec9..4a7506ebe0c 100644 --- a/packages/opencode/package.json +++ b/packages/opencode/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "0.5.5", + "version": "0.5.5-fork", "name": "opencode", "type": "module", "private": true, diff --git a/packages/plugin/package.json b/packages/plugin/package.json index f0dba802f94..c8c7dde6d95 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode-ai/plugin", - "version": "0.5.5", + "version": "0.5.5-fork", "type": "module", "scripts": { "typecheck": "tsc --noEmit" diff --git a/packages/sdk/js/package.json b/packages/sdk/js/package.json index 02a486f28fe..02c76ecb39d 100644 --- a/packages/sdk/js/package.json +++ b/packages/sdk/js/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode-ai/sdk", - "version": "0.5.5", + "version": "0.5.5-fork", "type": "module", "scripts": { "typecheck": "tsc --noEmit" diff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.ts index f275ba12189..ab21762be40 100644 --- a/packages/sdk/js/src/gen/types.gen.ts +++ b/packages/sdk/js/src/gen/types.gen.ts @@ -733,6 +733,9 @@ export type Config = { } webfetch?: "ask" | "allow" | "deny" } + tools?: { + [key: string]: boolean + } experimental?: { hook?: { file_edited?: { @@ -798,6 +801,10 @@ export type KeybindsConfig = { * List all sessions */ session_list: string + /** + * Show session timeline + */ + session_timeline: string /** * Share current session */ diff --git a/packages/web/package.json b/packages/web/package.json index 04d968995c3..c03efd473e0 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,7 +1,7 @@ { "name": "@opencode/web", "type": "module", - "version": "0.5.5", + "version": "0.5.5-fork", "scripts": { "dev": "astro dev", "dev:remote": "sst shell --stage=dev --target=Web astro dev", diff --git a/sdks/vscode/package.json b/sdks/vscode/package.json index c2af58a0e81..92308065bf4 100644 --- a/sdks/vscode/package.json +++ b/sdks/vscode/package.json @@ -2,7 +2,7 @@ "name": "opencode", "displayName": "opencode", "description": "opencode for VS Code", - "version": "0.5.5", + "version": "0.5.5-fork", "publisher": "sst-dev", "repository": { "type": "git",