From 906b9419ced340e6f383058a681b7884cc26b409 Mon Sep 17 00:00:00 2001 From: Z User Date: Tue, 16 Jun 2026 00:22:34 +0000 Subject: [PATCH] fix: expand shell variables in bash argPath for external directory permission check (#740), allow leader keybinds when prompt is focused (#674) - Bash tool: argPath() now calls expand() for all shells (not just PowerShell), so paths like $HOME/dir are resolved before the external-directory permission check. Previously on bash, $HOME was left unexpanded, causing dynamic() to return true and skip the safety check entirely. - Command palette: leader-prefixed keybinds (e.g. down) are no longer blocked when the text input is focused. The text-editing key guard now exempts bindings so multi-key chords work while typing in the prompt. --- packages/opencode/src/cli/cmd/tui/component/dialog-command.tsx | 2 +- packages/opencode/src/tool/bash.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/component/dialog-command.tsx b/packages/opencode/src/cli/cmd/tui/component/dialog-command.tsx index 36ef66d5..7d0366aa 100644 --- a/packages/opencode/src/cli/cmd/tui/component/dialog-command.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/dialog-command.tsx @@ -96,7 +96,7 @@ function init() { const textEditingKey = textInputFocused && isTextEditingKey(evt) for (const option of entries()) { if (!isEnabled(option)) continue - if (textEditingKey && !option.keybind?.startsWith("input_")) continue + if (textEditingKey && !option.keybind?.startsWith("input_") && !option.keybind?.startsWith("")) continue if (option.keybind && keybind.match(option.keybind, evt)) { evt.preventDefault() option.onSelect?.(dialog) diff --git a/packages/opencode/src/tool/bash.ts b/packages/opencode/src/tool/bash.ts index 71acf5e6..6f79374d 100644 --- a/packages/opencode/src/tool/bash.ts +++ b/packages/opencode/src/tool/bash.ts @@ -382,7 +382,7 @@ export const BashTool = Tool.define( }) const argPath = Effect.fn("BashTool.argPath")(function* (arg: string, cwd: string, ps: boolean, shell: string) { - const text = ps ? expand(arg, cwd, shell) : home(unquote(arg)) + const text = expand(home(unquote(arg)), cwd, shell) const file = text && prefix(text) if (!file || dynamic(file, ps)) return const next = ps ? provider(file) : file