From 5761bea7c430ed9e2008633a0713f41a5f27def7 Mon Sep 17 00:00:00 2001 From: Sam Holmes Date: Sun, 3 Aug 2025 10:31:39 -0700 Subject: [PATCH 1/6] feat: add interactive environment selection to publish script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Install prompts package and @types/prompts - Replace hardcoded snapshot detection with interactive prompt - Remove unused pkgjsons variable 🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode --- bun.lock | 24 ++++++++++++++++-------- package.json | 2 ++ script/publish.ts | 19 ++++++++++++------- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/bun.lock b/bun.lock index 9d4e486a02..a98641dd73 100644 --- a/bun.lock +++ b/bun.lock @@ -4,13 +4,15 @@ "": { "name": "opencode", "devDependencies": { + "@types/prompts": "2.4.9", "prettier": "3.5.3", + "prompts": "2.4.2", "sst": "3.17.8", }, }, "packages/function": { "name": "@opencode/function", - "version": "0.0.1", + "version": "0.3.113", "dependencies": { "@octokit/auth-app": "8.0.1", "@octokit/rest": "22.0.0", @@ -25,7 +27,7 @@ }, "packages/opencode": { "name": "opencode", - "version": "0.0.0", + "version": "0.3.113", "bin": { "opencode": "./bin/opencode", }, @@ -77,7 +79,7 @@ }, "packages/plugin": { "name": "@opencode-ai/plugin", - "version": "0.0.0", + "version": "0.3.113", "devDependencies": { "@hey-api/openapi-ts": "0.80.1", "@opencode-ai/sdk": "workspace:*", @@ -87,7 +89,7 @@ }, "packages/sdk/js": { "name": "@opencode-ai/sdk", - "version": "0.0.0", + "version": "0.3.113", "devDependencies": { "@hey-api/openapi-ts": "0.80.1", "@tsconfig/node22": "catalog:", @@ -96,7 +98,7 @@ }, "packages/web": { "name": "@opencode/web", - "version": "0.0.1", + "version": "0.3.113", "dependencies": { "@astrojs/cloudflare": "^12.5.4", "@astrojs/markdown-remark": "6.3.1", @@ -583,6 +585,8 @@ "@types/node": ["@types/node@22.13.9", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw=="], + "@types/prompts": ["@types/prompts@2.4.9", "", { "dependencies": { "@types/node": "*", "kleur": "^3.0.3" } }, "sha512-qTxFi6Buiu8+50/+3DGIWLHM6QuWsEKugJnnP6iv2Mc4ncxE4A/OJkjuVOA+5X0X1S/nq5VJRa8Lu+nwcvbrKA=="], + "@types/react": ["@types/react@19.1.9", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-WmdoynAX8Stew/36uTSVMcLJJ1KRh6L3IZRx1PZ7qJtBqT3dYTgyDTx8H1qoRghErydW7xw9mSJ3wS//tCRpFA=="], "@types/sax": ["@types/sax@1.2.7", "", { "dependencies": { "@types/node": "*" } }, "sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A=="], @@ -1133,7 +1137,7 @@ "kind-of": ["kind-of@6.0.3", "", {}, "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw=="], - "kleur": ["kleur@4.1.5", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="], + "kleur": ["kleur@3.0.3", "", {}, "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w=="], "klona": ["klona@2.0.6", "", {}, "sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA=="], @@ -1845,6 +1849,8 @@ "@astrojs/mdx/@astrojs/markdown-remark": ["@astrojs/markdown-remark@6.3.3", "", { "dependencies": { "@astrojs/internal-helpers": "0.6.1", "@astrojs/prism": "3.3.0", "github-slugger": "^2.0.0", "hast-util-from-html": "^2.0.3", "hast-util-to-text": "^4.0.2", "import-meta-resolve": "^4.1.0", "js-yaml": "^4.1.0", "mdast-util-definitions": "^6.0.0", "rehype-raw": "^7.0.0", "rehype-stringify": "^10.0.1", "remark-gfm": "^4.0.1", "remark-parse": "^11.0.0", "remark-rehype": "^11.1.2", "remark-smartypants": "^3.0.2", "shiki": "^3.2.1", "smol-toml": "^1.3.4", "unified": "^11.0.5", "unist-util-remove-position": "^5.0.0", "unist-util-visit": "^5.0.0", "unist-util-visit-parents": "^6.0.1", "vfile": "^6.0.3" } }, "sha512-DDRtD1sPvAuA7ms2btc9A7/7DApKqgLMNrE6kh5tmkfy8utD0Z738gqd3p5aViYYdUtHIyEJ1X4mCMxfCfu15w=="], + "@astrojs/mdx/kleur": ["kleur@4.1.5", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="], + "@astrojs/mdx/source-map": ["source-map@0.7.6", "", {}, "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ=="], "@aws-crypto/util/@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="], @@ -1869,6 +1875,8 @@ "@oslojs/jwt/@oslojs/encoding": ["@oslojs/encoding@0.4.1", "", {}, "sha512-hkjo6MuIK/kQR5CrGNdAPZhS01ZCXuWDRJ187zh6qqF2+yMHZpD9fAYpX8q2bOO6Ryhl3XpCT6kUX76N8hhm4Q=="], + "@poppinss/colors/kleur": ["kleur@4.1.5", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="], + "@rollup/pluginutils/estree-walker": ["estree-walker@2.0.2", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="], "ansi-align/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], @@ -1877,6 +1885,8 @@ "astro/diff": ["diff@5.2.0", "", {}, "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A=="], + "astro/kleur": ["kleur@4.1.5", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="], + "astro/sharp": ["sharp@0.33.5", "", { "dependencies": { "color": "^4.2.3", "detect-libc": "^2.0.3", "semver": "^7.6.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.33.5", "@img/sharp-darwin-x64": "0.33.5", "@img/sharp-libvips-darwin-arm64": "1.0.4", "@img/sharp-libvips-darwin-x64": "1.0.4", "@img/sharp-libvips-linux-arm": "1.0.5", "@img/sharp-libvips-linux-arm64": "1.0.4", "@img/sharp-libvips-linux-s390x": "1.0.4", "@img/sharp-libvips-linux-x64": "1.0.4", "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", "@img/sharp-libvips-linuxmusl-x64": "1.0.4", "@img/sharp-linux-arm": "0.33.5", "@img/sharp-linux-arm64": "0.33.5", "@img/sharp-linux-s390x": "0.33.5", "@img/sharp-linux-x64": "0.33.5", "@img/sharp-linuxmusl-arm64": "0.33.5", "@img/sharp-linuxmusl-x64": "0.33.5", "@img/sharp-wasm32": "0.33.5", "@img/sharp-win32-ia32": "0.33.5", "@img/sharp-win32-x64": "0.33.5" } }, "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw=="], "babel-plugin-jsx-dom-expressions/@babel/helper-module-imports": ["@babel/helper-module-imports@7.18.6", "", { "dependencies": { "@babel/types": "^7.18.6" } }, "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA=="], @@ -1927,8 +1937,6 @@ "prebuild-install/tar-fs": ["tar-fs@2.1.3", "", { "dependencies": { "chownr": "^1.1.1", "mkdirp-classic": "^0.5.2", "pump": "^3.0.0", "tar-stream": "^2.1.4" } }, "sha512-090nwYJDmlhwFwEW3QQl+vaNnxsO2yVsd45eTKRBzSzu+hlb1w2K9inVq5b0ngXuLVqQ4ApvsUHHnu/zQNkWAg=="], - "prompts/kleur": ["kleur@3.0.3", "", {}, "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w=="], - "router/path-to-regexp": ["path-to-regexp@8.2.0", "", {}, "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ=="], "sitemap/@types/node": ["@types/node@17.0.45", "", {}, "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw=="], diff --git a/package.json b/package.json index 0c89b4f1f4..40a6002a63 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,9 @@ } }, "devDependencies": { + "@types/prompts": "2.4.9", "prettier": "3.5.3", + "prompts": "2.4.2", "sst": "3.17.8" }, "repository": { diff --git a/script/publish.ts b/script/publish.ts index 33813a984f..41118fa1f4 100755 --- a/script/publish.ts +++ b/script/publish.ts @@ -1,8 +1,19 @@ #!/usr/bin/env bun import { $ } from "bun" +import prompts from "prompts" -const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true" +const env = await prompts({ + type: "select", + name: "value", + message: "Select environment:", + choices: [ + { title: "Production", value: "production" }, + { title: "Snapshot", value: "snapshot" }, + ], +}) + +const snapshot = env.value === "snapshot" const version = snapshot ? `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}` : process.env["OPENCODE_VERSION"] @@ -11,12 +22,6 @@ if (!version) { } process.env["OPENCODE_VERSION"] = version -const pkgjsons = await Array.fromAsync( - new Bun.Glob("**/package.json").scan({ - absolute: true, - }), -) - const tree = await $`git add . && git write-tree`.text().then((x) => x.trim()) for await (const file of new Bun.Glob("**/package.json").scan({ absolute: true, From f017ac998ffd65333ade25c7dee1004d86a74365 Mon Sep 17 00:00:00 2001 From: Sam Holmes Date: Sun, 3 Aug 2025 10:54:40 -0700 Subject: [PATCH 2/6] feat: add interactive version selection for releases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Read current package version from packages/opencode/package.json - Provide patch, minor, major version bump choices for production releases - Calculate new version based on user selection - Include current version in snapshot versioning instead of 0.0.0 - Skip version prompting for snapshot releases 🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode --- script/publish.ts | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/script/publish.ts b/script/publish.ts index 41118fa1f4..49142a48f2 100755 --- a/script/publish.ts +++ b/script/publish.ts @@ -14,12 +14,43 @@ const env = await prompts({ }) const snapshot = env.value === "snapshot" -const version = snapshot - ? `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}` - : process.env["OPENCODE_VERSION"] -if (!version) { - throw new Error("OPENCODE_VERSION is required") + +let version: string +if (snapshot) { + const packageJson = await Bun.file("./packages/opencode/package.json").json() + const currentVersion = packageJson.version + version = `${currentVersion}-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}` +} else { + const packageJson = await Bun.file("./packages/opencode/package.json").json() + const currentVersion = packageJson.version + const [major, minor, patch] = currentVersion.split(".").map(Number) + + const versionChoice = await prompts({ + type: "select", + name: "value", + message: `Current version: ${currentVersion}. Select version bump:`, + choices: [ + { title: `Patch (${major}.${minor}.${patch + 1})`, value: "patch" }, + { title: `Minor (${major}.${minor + 1}.0)`, value: "minor" }, + { title: `Major (${major + 1}.0.0)`, value: "major" }, + ], + }) + + switch (versionChoice.value) { + case "patch": + version = `${major}.${minor}.${patch + 1}` + break + case "minor": + version = `${major}.${minor + 1}.0` + break + case "major": + version = `${major + 1}.0.0` + break + default: + throw new Error("Invalid version choice") + } } + process.env["OPENCODE_VERSION"] = version const tree = await $`git add . && git write-tree`.text().then((x) => x.trim()) From 68ad4447c62fb550495a7f36c8380dbf102c102e Mon Sep 17 00:00:00 2001 From: Sam Holmes Date: Sun, 3 Aug 2025 10:54:58 -0700 Subject: [PATCH 3/6] feat: add publish script to package.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add 'publish' script that runs bun run script/publish.ts - Enables running publish via npm/bun run publish 🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 40a6002a63..5f9fb726d4 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "dev": "bun run packages/opencode/src/index.ts", "typecheck": "bun run --filter='*' typecheck", "stainless": "./scripts/stainless", - "postinstall": "./script/hooks" + "postinstall": "./script/hooks", + "publish": "bun run script/publish.ts" }, "workspaces": { "packages": [ From 752edab7780e33d45119d7404574407b37f03c20 Mon Sep 17 00:00:00 2001 From: Sam Holmes Date: Sun, 3 Aug 2025 10:55:56 -0700 Subject: [PATCH 4/6] feat: add --local flag to publish script for local builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add --local argument parsing to skip interactive prompts - Set OPENCODE_DRY, OPENCODE_SNAPSHOT, and OPENCODE_LOCAL for local builds - Skip git operations and external publishing for local builds - Skip SDK and plugin publishing for local builds - Store and restore original package.json contents for local builds - Skip GitHub releases, AUR, and Homebrew operations for local builds 🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode --- packages/opencode/script/publish.ts | 3 +- script/publish.ts | 61 ++++++++++++++++++++++------- 2 files changed, 48 insertions(+), 16 deletions(-) diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts index c38148b4b2..cc4e33d8d9 100755 --- a/packages/opencode/script/publish.ts +++ b/packages/opencode/script/publish.ts @@ -8,6 +8,7 @@ import pkg from "../package.json" const dry = process.env["OPENCODE_DRY"] === "true" const version = process.env["OPENCODE_VERSION"]! const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true" +const local = process.env["OPENCODE_LOCAL"] === "true" console.log(`publishing ${version}`) @@ -78,7 +79,7 @@ await Bun.file(`./dist/${pkg.name}/package.json`).write( ) if (!dry) await $`cd ./dist/${pkg.name} && bun publish --access public --tag ${npmTag}` -if (!snapshot) { +if (!snapshot && !local) { // Github Release for (const key of Object.keys(optionalDependencies)) { await $`cd dist/${key}/bin && zip -r ../../${key}.zip *` diff --git a/script/publish.ts b/script/publish.ts index 49142a48f2..2a81968367 100755 --- a/script/publish.ts +++ b/script/publish.ts @@ -3,17 +3,21 @@ import { $ } from "bun" import prompts from "prompts" -const env = await prompts({ - type: "select", - name: "value", - message: "Select environment:", - choices: [ - { title: "Production", value: "production" }, - { title: "Snapshot", value: "snapshot" }, - ], -}) +const isLocal = process.argv.includes("--local") -const snapshot = env.value === "snapshot" +const env = isLocal + ? { value: "local" } + : await prompts({ + type: "select", + name: "value", + message: "Select environment:", + choices: [ + { title: "Production", value: "production" }, + { title: "Snapshot", value: "snapshot" }, + ], + }) + +const snapshot = env.value === "snapshot" || env.value === "local" let version: string if (snapshot) { @@ -53,7 +57,24 @@ if (snapshot) { process.env["OPENCODE_VERSION"] = version -const tree = await $`git add . && git write-tree`.text().then((x) => x.trim()) +if (isLocal) { + process.env["OPENCODE_DRY"] = "true" + process.env["OPENCODE_SNAPSHOT"] = "true" + process.env["OPENCODE_LOCAL"] = "true" +} + +// Store original package.json contents for local builds +const originalPackageContents = new Map() +if (isLocal) { + for await (const file of new Bun.Glob("**/package.json").scan({ + absolute: true, + })) { + const content = await Bun.file(file).text() + originalPackageContents.set(file, content) + } +} + +const tree = isLocal ? "" : await $`git add . && git write-tree`.text().then((x) => x.trim()) for await (const file of new Bun.Glob("**/package.json").scan({ absolute: true, })) { @@ -63,16 +84,18 @@ for await (const file of new Bun.Glob("**/package.json").scan({ } await import(`../packages/opencode/script/publish.ts`) -await import(`../packages/sdk/js/script/publish.ts`) -await import(`../packages/plugin/script/publish.ts`) -// await import(`../packages/sdk/stainless/generate.ts`) +if (!isLocal) { + await import(`../packages/sdk/js/script/publish.ts`) + await import(`../packages/plugin/script/publish.ts`) + // await import(`../packages/sdk/stainless/generate.ts`) +} if (!snapshot) { await $`git commit -am "release: v${version}"` await $`git tag v${version}` await $`git push origin HEAD --tags --no-verify` } -if (snapshot) { +if (snapshot && !isLocal) { await $`git checkout -b snapshot-${version}` await $`git commit --allow-empty -m "Snapshot release v${version}"` await $`git tag v${version}` @@ -85,3 +108,11 @@ if (snapshot) { $`await git checkout ${tree} ${file}` } } +if (isLocal) { + console.log(`Local build completed for version ${version}`) + console.log("Binaries available in ./packages/opencode/dist/") + // Restore original package.json contents for local builds + for (const [file, content] of originalPackageContents) { + await Bun.file(file).write(content) + } +} From bc7505470ae77f41a95b92c5b21cbf3a32fb6406 Mon Sep 17 00:00:00 2001 From: Sam Holmes Date: Sun, 3 Aug 2025 10:56:32 -0700 Subject: [PATCH 5/6] feat: add local binary support to install script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add VERSION=local support to use local binaries from dist directory - Check for local binary existence before installation - Use ditto instead of cp to preserve macOS binary attributes - Remove .zip extension from filename for correct local path resolution - Provide helpful error message if local binary not found 🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode --- install | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/install b/install index 46de9e3510..75ef10df53 100755 --- a/install +++ b/install @@ -44,7 +44,18 @@ esac INSTALL_DIR=$HOME/.opencode/bin mkdir -p "$INSTALL_DIR" -if [ -z "$requested_version" ]; then +if [[ "$requested_version" == "local" ]]; then + # Use local binary from dist directory + # Remove .zip extension from filename for local path + local_dirname="${filename%.zip}" + local_binary_path="./packages/opencode/dist/$local_dirname/bin/opencode" + if [[ ! -f "$local_binary_path" ]]; then + echo "${RED}Local binary not found at $local_binary_path${NC}" + echo "${YELLOW}Run 'bun run build:install' to build local binaries first${NC}" + exit 1 + fi + specific_version="local" +elif [ -z "$requested_version" ]; then url="https://github.com/sst/opencode/releases/latest/download/$filename" specific_version=$(curl -s https://api.github.com/repos/sst/opencode/releases/latest | awk -F'"' '/"tag_name": "/ {gsub(/^v/, "", $4); print $4}') @@ -91,12 +102,21 @@ check_version() { } download_and_install() { - print_message info "Downloading ${ORANGE}opencode ${GREEN}version: ${YELLOW}$specific_version ${GREEN}..." - mkdir -p opencodetmp && cd opencodetmp - curl -# -L -o "$filename" "$url" - unzip -q "$filename" - mv opencode "$INSTALL_DIR" - cd .. && rm -rf opencodetmp + if [[ "$specific_version" == "local" ]]; then + print_message info "Installing local ${ORANGE}opencode ${GREEN}binary..." + local_dirname="${filename%.zip}" + local_binary_path="./packages/opencode/dist/$local_dirname/bin/opencode" + # Use ditto to preserve all macOS binary attributes + ditto "$local_binary_path" "$INSTALL_DIR/opencode" + chmod +x "$INSTALL_DIR/opencode" + else + print_message info "Downloading ${ORANGE}opencode ${GREEN}version: ${YELLOW}$specific_version ${GREEN}..." + mkdir -p opencodetmp && cd opencodetmp + curl -# -L -o "$filename" "$url" + unzip -q "$filename" + mv opencode "$INSTALL_DIR" + cd .. && rm -rf opencodetmp + fi } check_version From 9860c2657d8bfc52a46f8b45d05eb8625f4cdcf0 Mon Sep 17 00:00:00 2001 From: Sam Holmes Date: Sun, 3 Aug 2025 10:56:42 -0700 Subject: [PATCH 6/6] feat: add build:install script for local development MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add build:install script that builds local binaries and installs them - Combines publish --local and install with VERSION=local - Enables quick local development workflow 🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 5f9fb726d4..5934d2de77 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "typecheck": "bun run --filter='*' typecheck", "stainless": "./scripts/stainless", "postinstall": "./script/hooks", - "publish": "bun run script/publish.ts" + "publish": "bun run script/publish.ts", + "build:install": "bun run script/publish.ts --local && VERSION=local ./install" }, "workspaces": { "packages": [