fix: handle redirected_statement treesitter node in bash permissions (#6737)

This commit is contained in:
Patrick Schiel
2026-01-30 23:11:45 +01:00
committed by GitHub
parent 2c36cbb87c
commit e7ff7143b6
2 changed files with 49 additions and 2 deletions

View File

@@ -91,6 +91,10 @@ export const BashTool = Tool.define("bash", async () => {
for (const node of tree.rootNode.descendantsOfType("command")) {
if (!node) continue
// Get full command text including redirects if present
let commandText = node.parent?.type === "redirected_statement" ? node.parent.text : node.text
const command = []
for (let i = 0; i < node.childCount; i++) {
const child = node.child(i)
@@ -131,8 +135,8 @@ export const BashTool = Tool.define("bash", async () => {
// cd covered by above check
if (command.length && command[0] !== "cd") {
patterns.add(command.join(" "))
always.add(BashArity.prefix(command).join(" ") + "*")
patterns.add(commandText)
always.add(BashArity.prefix(command).join(" ") + " *")
}
}