summaryrefslogtreecommitdiffhomepage
path: root/packages
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-10-31 00:52:46 -0500
committerAiden Cline <[email protected]>2025-10-31 00:52:46 -0500
commitdfdd009750173eeaa78bb20376400c0074c971a2 (patch)
tree729c3ae956f108555c7e724e15f0617414e240fc /packages
parentc1ada302f983f150ec42c473d316b3488318163b (diff)
downloadopencode-dfdd009750173eeaa78bb20376400c0074c971a2.tar.gz
opencode-dfdd009750173eeaa78bb20376400c0074c971a2.zip
fix: bash permission case
Diffstat (limited to 'packages')
-rw-r--r--packages/opencode/src/tool/bash.ts20
1 files changed, 4 insertions, 16 deletions
diff --git a/packages/opencode/src/tool/bash.ts b/packages/opencode/src/tool/bash.ts
index 2c377ee14..e77bbf8ff 100644
--- a/packages/opencode/src/tool/bash.ts
+++ b/packages/opencode/src/tool/bash.ts
@@ -115,22 +115,10 @@ export const BashTool = Tool.define("bash", {
}
if (action === "ask") {
const pattern = (() => {
- let head = ""
- let sub: string | undefined
- for (let i = 0; i < node.childCount; i++) {
- const child = node.child(i)
- if (!child) continue
- if (child.type === "command_name") {
- if (!head) {
- head = child.text
- }
- continue
- }
- if (!sub && child.type === "word") {
- if (!child.text.startsWith("-")) sub = child.text
- }
- }
- if (!head) return
+ if (command.length === 0) return
+ const head = command[0]
+ // Find first non-flag argument as subcommand
+ const sub = command.slice(1).find((arg) => !arg.startsWith("-"))
return sub ? `${head} ${sub} *` : `${head} *`
})()
if (pattern) {