Kaynağa Gözat

Check rooignore for insert_content and search_and_replace (#4094)

Matt Rubens 8 ay önce
ebeveyn
işleme
4cf240f3db

+ 8 - 0
src/core/tools/insertContentTool.ts

@@ -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)
 

+ 8 - 0
src/core/tools/searchAndReplaceTool.ts

@@ -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)