Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit b275e18

Browse files
stevolandrekram1-node
authored andcommitted
fix: Provide OPENCODE & AGENT env vars (anomalyco#3843)
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
1 parent af9a179 commit b275e18

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

packages/opencode/src/cli/cmd/tui/thread.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,13 @@ export const TuiThreadCommand = cmd({
8282
return undefined
8383
})()
8484

85-
const worker = new Worker("./src/cli/cmd/tui/worker.ts")
85+
const worker = new Worker("./src/cli/cmd/tui/worker.ts", {
86+
env: Object.fromEntries(
87+
Object.entries(process.env).filter(
88+
(entry): entry is [string, string] => entry[1] !== undefined,
89+
),
90+
),
91+
})
8692
worker.onerror = console.error
8793
const client = Rpc.client<typeof rpc>(worker)
8894
process.on("uncaughtException", (e) => {

packages/opencode/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ const cli = yargs(hideBin(process.argv))
6262
})(),
6363
})
6464

65-
process.env["OPENCODE"] = "1"
65+
process.env.AGENT = "1"
66+
process.env.OPENCODE = "1"
6667

6768
Log.Default.info("opencode", {
6869
version: Installation.VERSION,

packages/opencode/src/tool/bash.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ export const BashTool = Tool.define("bash", {
144144
const proc = spawn(params.command, {
145145
shell: true,
146146
cwd: Instance.directory,
147+
env: {
148+
...process.env,
149+
},
147150
stdio: ["ignore", "pipe", "pipe"],
148151
detached: process.platform !== "win32",
149152
})

0 commit comments

Comments
 (0)