The open source coding agent.
TypeScript
upgrade to latest bun
Dax Raada6265ea3d2c1
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.ymlindex ebbd3030b48..90d440641ff 100644--- a/.github/workflows/deploy.yml+++ b/.github/workflows/deploy.yml@@ -17,7 +17,7 @@ jobs:- uses: oven-sh/setup-bun@v1with:- bun-version: 1.2.19+ bun-version: 1.2.21- run: bun installdiff --git a/.github/workflows/format.yml b/.github/workflows/format.ymlindex f7f12c36f3a..e787023013f 100644--- a/.github/workflows/format.yml+++ b/.github/workflows/format.yml@@ -18,7 +18,7 @@ jobs:- name: Setup Bunuses: oven-sh/setup-bun@v1with:- bun-version: 1.2.19+ bun-version: 1.2.21- name: Install dependenciesrun: bun installdiff --git a/.github/workflows/publish-vscode.yml b/.github/workflows/publish-vscode.ymlindex 5cb406f68c0..f40c937983f 100644--- a/.github/workflows/publish-vscode.yml+++ b/.github/workflows/publish-vscode.yml@@ -21,7 +21,7 @@ jobs:- uses: oven-sh/setup-bun@v2with:- bun-version: 1.2.19+ bun-version: 1.2.21- run: git fetch --force --tags- run: bun install -g @vscode/vscediff --git a/.github/workflows/publish.yml b/.github/workflows/publish.ymlindex cf9c547df89..645a7b504f1 100644--- a/.github/workflows/publish.yml+++ b/.github/workflows/publish.yml@@ -37,7 +37,7 @@ jobs:- uses: oven-sh/setup-bun@v2with:- bun-version: 1.2.19+ bun-version: 1.2.21- name: Cache ~/.bunid: cache-bundiff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.ymlindex 01aa398b55d..2d24d45e92f 100644--- a/.github/workflows/typecheck.yml+++ b/.github/workflows/typecheck.yml@@ -15,7 +15,7 @@ jobs:- name: Setup Bunuses: oven-sh/setup-bun@v1with:- bun-version: 1.2.19+ bun-version: 1.2.21- name: Install dependenciesrun: bun installdiff --git a/bun.lock b/bun.lockindex 8381e898ee8..3846f2dbd7c 100644--- a/bun.lock+++ b/bun.lock@@ -26,7 +26,7 @@},"cloud/core": {"name": "@opencode/cloud-core",- "version": "0.6.4",+ "version": "0.6.10","dependencies": {"@aws-sdk/client-sts": "3.782.0","@opencode/cloud-resource": "workspace:*",@@ -43,7 +43,7 @@},"cloud/function": {"name": "@opencode/cloud-function",- "version": "0.6.4",+ "version": "0.6.10","dependencies": {"@ai-sdk/anthropic": "2.0.0","@ai-sdk/openai": "2.0.2",@@ -69,7 +69,7 @@},"cloud/scripts": {"name": "@opencode/cloud-scripts",- "version": "0.6.4",+ "version": "0.6.10","dependencies": {"@opencode/cloud-core": "workspace:*","tsx": "4.20.5",@@ -81,7 +81,7 @@},"packages/function": {"name": "@opencode/function",- "version": "0.6.4",+ "version": "0.6.10","dependencies": {"@octokit/auth-app": "8.0.1","@octokit/rest": "22.0.0",@@ -96,7 +96,7 @@},"packages/opencode": {"name": "opencode",- "version": "0.6.4",+ "version": "0.6.10","bin": {"opencode": "./bin/opencode",},@@ -136,7 +136,7 @@"@octokit/webhooks-types": "7.6.1","@standard-schema/spec": "1.0.0","@tsconfig/bun": "1.0.7",- "@types/bun": "latest",+ "@types/bun": "catalog:","@types/turndown": "5.0.5","@types/yargs": "17.0.33","typescript": "catalog:",@@ -146,7 +146,7 @@},"packages/plugin": {"name": "@opencode-ai/plugin",- "version": "0.6.4",+ "version": "0.6.10","dependencies": {"@opencode-ai/sdk": "workspace:*",},@@ -157,7 +157,7 @@},"packages/sdk/js": {"name": "@opencode-ai/sdk",- "version": "0.6.4",+ "version": "0.6.10","dependencies": {"@hey-api/openapi-ts": "0.81.0",},@@ -169,7 +169,7 @@},"packages/web": {"name": "@opencode/web",- "version": "0.6.4",+ "version": "0.6.10","dependencies": {"@astrojs/cloudflare": "12.6.3","@astrojs/markdown-remark": "6.3.1",@@ -217,6 +217,7 @@"catalog": {"@hono/zod-validator": "0.4.2","@tsconfig/node22": "22.0.2",+ "@types/bun": "1.2.21","@types/node": "22.13.9","ai": "5.0.8","hono": "4.7.10",@@ -492,7 +493,7 @@"@hey-api/json-schema-ref-parser": ["@hey-api/[email protected]", "", { "dependencies": { "@jsdevtools/ono": "^7.1.3", "@types/json-schema": "^7.0.15", "js-yaml": "^4.1.0", "lodash": "^4.17.21" } }, "sha512-yktiFZoWPtEW8QKS65eqKwA5MTKp88CyiL8q72WynrBs/73SAaxlSWlA2zW/DZlywZ5hX1OYzrCC0wFdvO9c2w=="],- "@hey-api/openapi-ts": ["@hey-api/[email protected]", "", { "dependencies": { "@hey-api/json-schema-ref-parser": "1.0.6", "ansi-colors": "4.1.3", "c12": "2.0.1", "color-support": "1.1.3", "commander": "13.0.0", "handlebars": "4.7.8", "js-yaml": "4.1.0", "open": "10.1.2", "semver": "7.7.2" }, "peerDependencies": { "typescript": "^5.5.3" }, "bin": { "openapi-ts": "bin/index.cjs" } }, "sha512-PoJukNBkUfHOoMDpN33bBETX49TUhy7Hu8Sa0jslOvFndvZ5VjQr4Nl/Dzjb9LG1Lp5HjybyTJMA6a1zYk/q6A=="],+ "@hey-api/openapi-ts": ["@hey-api/[email protected]", "", { "dependencies": { "@hey-api/json-schema-ref-parser": "1.0.6", "ansi-colors": "4.1.3", "c12": "2.0.1", "color-support": "1.1.3", "commander": "13.0.0", "handlebars": "4.7.8", "open": "10.1.2", "semver": "7.7.2" }, "peerDependencies": { "typescript": "^5.5.3" }, "bin": { "openapi-ts": "bin/index.cjs" } }, "sha512-AC478kg36vmmrseLZNFonZ/cmXXmDzW5yWz4PVg1S8ebJsRtVRJ/QU+mtnXfzf9avN2P0pz/AO4WAe4jyFY2gA=="],"@hono/zod-validator": ["@hono/[email protected]", "", { "peerDependencies": { "hono": ">=3.9.0", "zod": "^3.19.1" } }, "sha512-1rrlBg+EpDPhzOV4hT9pxr5+xDVmKuz6YJl+la7VCwK6ass5ldyKm5fD+umJdV2zhHD6jROoCCv8NbTwyfhT0g=="],@@ -3082,6 +3083,8 @@"@openauthjs/openauth/jose": ["[email protected]", "", {}, "sha512-AMlnetc9+CV9asI19zHmrgS/WYsWUwCn2R7RzlbJWD7F9eWYUTGyBmU9o6PxngtLGOiDGPRu+Uc4fhKzbpteZQ=="],+ "@opencode-ai/sdk/@hey-api/openapi-ts": ["@hey-api/[email protected]", "", { "dependencies": { "@hey-api/json-schema-ref-parser": "1.0.6", "ansi-colors": "4.1.3", "c12": "2.0.1", "color-support": "1.1.3", "commander": "13.0.0", "handlebars": "4.7.8", "js-yaml": "4.1.0", "open": "10.1.2", "semver": "7.7.2" }, "peerDependencies": { "typescript": "^5.5.3" }, "bin": { "openapi-ts": "bin/index.cjs" } }, "sha512-PoJukNBkUfHOoMDpN33bBETX49TUhy7Hu8Sa0jslOvFndvZ5VjQr4Nl/Dzjb9LG1Lp5HjybyTJMA6a1zYk/q6A=="],+"@opencode/cloud-resource/@cloudflare/workers-types": ["@cloudflare/[email protected]", "", {}, "sha512-uAGZFqEBFnCiwIokxMnrrtjIkT8qyGT1LACSScEUyW7nKmtD0Viykp9QZWrIlssyEp/MDB6XsdALF8y6upxpcg=="],"@opentelemetry/instrumentation-grpc/@opentelemetry/semantic-conventions": ["@opentelemetry/[email protected]", "", {}, "sha512-sAay1RrB+ONOem0OZanAR1ZI/k7yDpnOQSQmTMuGImUQb2y8EbSaCJ94FQluM74xoU03vlb2d2U90hZluL6nQg=="],diff --git a/github/package.json b/github/package.jsonindex 3be63d33176..06db814ae4c 100644--- a/github/package.json+++ b/github/package.json@@ -4,7 +4,7 @@"type": "module","private": true,"devDependencies": {- "@types/bun": "latest"+ "@types/bun": "catalog:"},"peerDependencies": {"typescript": "^5"diff --git a/package.json b/package.jsonindex 78a0e543dac..68ca4f4148a 100644--- a/package.json+++ b/package.json@@ -3,7 +3,7 @@"name": "opencode","private": true,"type": "module",- "packageManager": "[email protected]",+ "packageManager": "[email protected]","scripts": {"dev": "bun run --conditions=development packages/opencode/src/index.ts","typecheck": "bun run --filter='*' typecheck",@@ -17,6 +17,7 @@"packages/sdk/js"],"catalog": {+ "@types/bun": "1.2.21","@hono/zod-validator": "0.4.2","@types/node": "22.13.9","@tsconfig/node22": "22.0.2",diff --git a/packages/opencode/package.json b/packages/opencode/package.jsonindex 4d86c23bf1e..93045cda108 100644--- a/packages/opencode/package.json+++ b/packages/opencode/package.json@@ -19,7 +19,7 @@"@octokit/webhooks-types": "7.6.1","@standard-schema/spec": "1.0.0","@tsconfig/bun": "1.0.7",- "@types/bun": "latest",+ "@types/bun": "catalog:","@types/turndown": "5.0.5","@types/yargs": "17.0.33","typescript": "catalog:",diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.tsindex 0de48fe6739..44af7ad9f8f 100755--- a/packages/opencode/script/publish.ts+++ b/packages/opencode/script/publish.ts@@ -38,7 +38,20 @@ for (const [os, arch] of targets) {await $`CGO_ENABLED=0 GOOS=${os} GOARCH=${GOARCH[arch]} go build -ldflags="-s -w -X main.Version=${version}" -o ../opencode/dist/${name}/bin/tui ../tui/cmd/opencode/main.go`.cwd("../tui",)- await $`bun build --define OPENCODE_TUI_PATH="'../../../dist/${name}/bin/tui'" --define OPENCODE_VERSION="'${version}'" --compile --target=bun-${os}-${arch} --outfile=dist/${name}/bin/opencode ./src/index.ts`+ await Bun.build({+ compile: {+ target: `bun-${os}-${arch}` as any,+ outfile: `dist/${name}/bin/opencode`,+ execArgv: [`--user-agent=opencode/${version}`],+ windows: {},+ },+ entrypoints: ["./src/index.ts"],+ define: {+ OPENCODE_VERSION: `'${version}'`,+ OPENCODE_TUI_PATH: `'../../../dist/${name}/bin/tui'`,+ },+ })+ // await $`bun build --define OPENCODE_TUI_PATH="'../../../dist/${name}/bin/tui'" --define OPENCODE_VERSION="'${version}'" --compile --target=bun-${os}-${arch} --outfile=dist/${name}/bin/opencode ./src/index.ts`// Run the binary only if it matches current OS/archif (process.platform === (os === "windows" ? "win32" : os) &&diff --git a/script/publish.ts b/script/publish.tsindex c0f79bb9c4b..9b3ea450ea2 100755--- a/script/publish.ts+++ b/script/publish.ts@@ -2,6 +2,10 @@import { $ } from "bun"+if (process.versions.bun !== "1.2.21") {+ throw new Error("This script requires [email protected]")+}+console.log("=== publishing ===\n")const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true"