Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions .github/actions/setup-bun/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,29 @@ runs:
bun-version-file: ${{ !steps.bun-url.outputs.url && 'package.json' || '' }}
bun-download-url: ${{ steps.bun-url.outputs.url }}

# Use the fixed Windows patch installer without changing the compiled runtime:
# Bun 1.4.2 regresses our Effect graph at packaged CLI startup.
- name: Setup Windows dependency installer
if: runner.os == 'Windows'
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: "1.4.2"

- name: Get cache directory
id: cache
shell: bash
run: echo "dir=$(bun pm cache)" >> "$GITHUB_OUTPUT"
run: |
echo "dir=$(bun pm cache)" >> "$GITHUB_OUTPUT"
echo "version=$(bun --version)" >> "$GITHUB_OUTPUT"

- name: Restore Bun dependencies
id: bun-cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ steps.cache.outputs.dir }}
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
key: ${{ runner.os }}-${{ runner.arch }}-bun-${{ steps.cache.outputs.version }}-${{ hashFiles('**/bun.lock', 'patches/**') }}
restore-keys: |
${{ runner.os }}-bun-
${{ runner.os }}-${{ runner.arch }}-bun-${{ steps.cache.outputs.version }}-

- name: Install setuptools for distutils compatibility
run: python3 -m pip install setuptools || pip install setuptools || true
Expand All @@ -70,4 +80,15 @@ runs:
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ steps.cache.outputs.dir }}
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
key: ${{ runner.os }}-${{ runner.arch }}-bun-${{ steps.cache.outputs.version }}-${{ hashFiles('**/bun.lock', 'patches/**') }}

- name: Restore pinned Bun runtime after Windows install
if: runner.os == 'Windows'
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version-file: ${{ !steps.bun-url.outputs.url && 'package.json' || '' }}
bun-download-url: ${{ steps.bun-url.outputs.url }}

- name: Verify pinned Bun runtime
shell: bash
run: test "$(bun --version)" = "$(node -p "require('./package.json').packageManager.split('@')[1]")"
5 changes: 4 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ jobs:
{ target: "linux-x64", runner: "ubuntu-24.04", arch: "x64" },
]
const target = process.env.CANDIDATE_TARGET || "all"
if (!["all", "windows-x64"].includes(target)) throw Error("Invalid candidate target")
if (!["all", "windows-x64"].includes(target)) {
console.error("Invalid candidate target")
process.exit(1)
}
const include = target === "all" ? targets : targets.filter((item) => item.target === target)
require("node:fs").appendFileSync(process.env.GITHUB_OUTPUT, `matrix=${JSON.stringify({ include })}\n`)
'
Expand Down
36 changes: 13 additions & 23 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"pacote@21.5.0": "patches/pacote@21.5.0.patch",
"@ai-sdk/google@3.0.73": "patches/@ai-sdk%2Fgoogle@3.0.73.patch",
"@pierre/trees@1.0.0-beta.4": "patches/@pierre%2Ftrees@1.0.0-beta.4.patch",
"@modelcontextprotocol/sdk@1.29.0": "patches/@modelcontextprotocol%2Fsdk@1.29.0.patch",
"@modelcontextprotocol/sdk@1.32.0": "patches/@modelcontextprotocol%2Fsdk@1.32.0.patch",
"effect@4.0.0-beta.83": "patches/effect@4.0.0-beta.83.patch",
"@tanstack/virtual-core@3.17.3": "patches/@tanstack%2Fvirtual-core@3.17.3.patch",
"@ai-sdk/openai-compatible@2.0.41": "patches/@ai-sdk%2Fopenai-compatible@2.0.41.patch",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/app",
"version": "1.15.46",
"version": "1.15.47",
"description": "",
"type": "module",
"exports": {
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@opencode-ai/desktop",
"private": true,
"version": "1.15.46",
"version": "1.15.47",
"type": "module",
"license": "MIT",
"homepage": "https://bharatcode.ai",
Expand Down Expand Up @@ -50,7 +50,7 @@
"@types/node": "catalog:",
"@typescript/native-preview": "catalog:",
"@valibot/to-json-schema": "1.6.0",
"electron": "42.3.3",
"electron": "42.11.16",
"electron-builder": "26.16.1",
"electron-vite": "^5",
"solid-js": "catalog:",
Expand Down
20 changes: 20 additions & 0 deletions packages/desktop/scripts/packaging.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@ import { expect, test } from "bun:test"
import config, { assertPackagingPolicy } from "../electron-builder.config"
import { bundledCliFilename } from "./utils"

test("Windows installer cannot silently replace the pinned build runtime", async () => {
const action = Bun.YAML.parse(
await Bun.file(new URL("../../../.github/actions/setup-bun/action.yml", import.meta.url)).text(),
) as {
runs: { steps: { name: string; if?: string; run?: string; with?: Record<string, string> }[] }
}
const steps = action.runs.steps
const installer = steps.findIndex((step) => step.name === "Setup Windows dependency installer")
const install = steps.findIndex((step) => step.name === "Install dependencies")
const restore = steps.findIndex((step) => step.name === "Restore pinned Bun runtime after Windows install")
expect(installer).toBeGreaterThan(-1)
expect(install).toBeGreaterThan(installer)
expect(restore).toBeGreaterThan(install)
expect(steps[installer].if).toBe("runner.os == 'Windows'")
expect(steps[installer].with?.["bun-version"]).toBe("1.4.2")
expect(steps[restore].with?.["bun-download-url"]).toBe("${{ steps.bun-url.outputs.url }}")
expect(steps.at(-1)?.run).toContain("packageManager.split")
expect(steps.at(-1)?.run).toContain("bun --version")
})

test("packaging cannot substitute an upstream product, protocol, CLI or update destination", () => {
expect(config.appId).toStartWith("ai.bharatcode.desktop")
expect(config.productName).toStartWith("BharatCode")
Expand Down
Loading
Loading