diff --git a/packages/opencode/src/bun/index.ts b/packages/opencode/src/bun/index.ts index edf74c310..584683dd3 100644 --- a/packages/opencode/src/bun/index.ts +++ b/packages/opencode/src/bun/index.ts @@ -4,6 +4,7 @@ import { Log } from "../util/log" import path from "path" import { NamedError } from "@opencode-ai/util/error" import { readableStreamToText } from "bun" +import { Config } from "../config/config" import { createRequire } from "module" import { Lock } from "../util/lock" @@ -76,6 +77,12 @@ export namespace BunProc { // Build command arguments const args = ["add", "--force", "--exact", "--cwd", Global.Path.cache, pkg + "@" + version] + // Add --no-cache flag if configured + const config = await Config.get() + if (config.bun_no_cache) { + args.push("--no-cache") + } + // Let Bun handle registry resolution: // - If .npmrc files exist, Bun will use them automatically // - If no .npmrc files exist, Bun will default to https://registry.npmjs.org diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index 267278b74..98d3b783a 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -671,6 +671,10 @@ export namespace Config { url: z.string().optional().describe("Enterprise URL"), }) .optional(), + bun_no_cache: z + .boolean() + .optional() + .describe("Disable Bun cache when installing packages (adds --no-cache flag)"), experimental: z .object({ hook: z