mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-02 15:13:46 +00:00
fix: handle redirected_statement treesitter node in bash permissions (#6737)
This commit is contained in:
@@ -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(" ") + " *")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user