Check rooignore for insert_content and search_and_replace (#4094)

This commit is contained in:
Matt Rubens 2025-05-28 22:36:19 -04:00 committed by GitHub
parent aa6265462e
commit 4cf240f3db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 0 deletions

View file

@ -58,6 +58,14 @@ export async function insertContentTool(
return
}
const accessAllowed = cline.rooIgnoreController?.validateAccess(relPath)
if (!accessAllowed) {
await cline.say("rooignore_error", relPath)
pushToolResult(formatResponse.toolError(formatResponse.rooIgnoreError(relPath)))
return
}
const absolutePath = path.resolve(cline.cwd, relPath)
const fileExists = await fileExistsAtPath(absolutePath)

View file

@ -115,6 +115,14 @@ export async function searchAndReplaceTool(
endLine: endLine,
}
const accessAllowed = cline.rooIgnoreController?.validateAccess(validRelPath)
if (!accessAllowed) {
await cline.say("rooignore_error", validRelPath)
pushToolResult(formatResponse.toolError(formatResponse.rooIgnoreError(validRelPath)))
return
}
const absolutePath = path.resolve(cline.cwd, validRelPath)
const fileExists = await fileExistsAtPath(absolutePath)