feat(plugin): add shell.env hook for manipulating environment in tools and shell (#12012)
This commit is contained in:
parent
25bdd77b1d
commit
a30696f9bf
5 changed files with 32 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ import type { WSContext } from "hono/ws"
|
|||
import { Instance } from "../project/instance"
|
||||
import { lazy } from "@opencode-ai/util/lazy"
|
||||
import { Shell } from "@/shell/shell"
|
||||
import { Plugin } from "@/plugin"
|
||||
|
||||
export namespace Pty {
|
||||
const log = Log.create({ service: "pty" })
|
||||
|
|
@ -102,9 +103,11 @@ export namespace Pty {
|
|||
}
|
||||
|
||||
const cwd = input.cwd || Instance.directory
|
||||
const shellEnv = await Plugin.trigger("shell.env", { cwd }, { env: {} })
|
||||
const env = {
|
||||
...process.env,
|
||||
...input.env,
|
||||
...shellEnv.env,
|
||||
TERM: "xterm-256color",
|
||||
OPENCODE_TERMINAL: "1",
|
||||
} as Record<string, string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue