From 88ff70be493a8e859deb44d3a5363c27d1085b06 Mon Sep 17 00:00:00 2001 From: RinCodeForge927 Date: Mon, 12 Jan 2026 15:23:38 +0700 Subject: [PATCH] feat: update BashTool command parsing logic --- packages/opencode/src/tool/bash.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/opencode/src/tool/bash.ts b/packages/opencode/src/tool/bash.ts index 5d073fd6815b..7c971658a45f 100644 --- a/packages/opencode/src/tool/bash.ts +++ b/packages/opencode/src/tool/bash.ts @@ -99,6 +99,7 @@ export const BashTool = Tool.define("bash", async () => { for (let i = 0; i < node.childCount; i++) { const child = node.child(i) if (!child) continue + if ( child.type !== "command_name" && child.type !== "word" && @@ -111,6 +112,8 @@ export const BashTool = Tool.define("bash", async () => { command.push(child.text) } + if (command.length === 0) continue + // not an exhaustive list, but covers most common cases if (["cd", "rm", "cp", "mv", "mkdir", "touch", "chmod", "chown", "cat"].includes(command[0])) { for (const arg of command.slice(1)) {