Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
300 changes: 0 additions & 300 deletions src/core/tools/__tests__/searchFilesTool.spec.ts

This file was deleted.

18 changes: 4 additions & 14 deletions src/core/tools/searchFilesTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { ClineSayTool } from "../../shared/ExtensionMessage"
import { getReadablePath } from "../../utils/path"
import { isPathOutsideWorkspace } from "../../utils/pathUtils"
import { regexSearchFiles } from "../../services/ripgrep"
import { t } from "../../i18n"

export async function searchFilesTool(
cline: Task,
Expand All @@ -20,11 +19,15 @@ export async function searchFilesTool(
const regex: string | undefined = block.params.regex
const filePattern: string | undefined = block.params.file_pattern

const absolutePath = relDirPath ? path.resolve(cline.cwd, relDirPath) : cline.cwd
const isOutsideWorkspace = isPathOutsideWorkspace(absolutePath)

const sharedMessageProps: ClineSayTool = {
tool: "searchFiles",
path: getReadablePath(cline.cwd, removeClosingTag("path", relDirPath)),
regex: removeClosingTag("regex", regex),
filePattern: removeClosingTag("file_pattern", filePattern),
isOutsideWorkspace,
}

try {
Expand All @@ -49,19 +52,6 @@ export async function searchFilesTool(

cline.consecutiveMistakeCount = 0

const absolutePath = path.resolve(cline.cwd, relDirPath)

// Check if path is outside workspace
if (isPathOutsideWorkspace(absolutePath)) {
const userErrorMessage = t("tools:searchFiles.workspaceBoundaryError", { path: relDirPath })
const llmErrorMessage = `Cannot search outside workspace. Path '${relDirPath}' is outside the current workspace.`
cline.consecutiveMistakeCount++
cline.recordToolError("search_files")
await cline.say("error", userErrorMessage)
pushToolResult(llmErrorMessage)
return
}

const results = await regexSearchFiles(
cline.cwd,
absolutePath,
Expand Down
3 changes: 0 additions & 3 deletions src/i18n/locales/ca/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@
"toolRepetitionLimitReached": "Roo sembla estar atrapat en un bucle, intentant la mateixa acció ({{toolName}}) repetidament. Això podria indicar un problema amb la seva estratègia actual. Considera reformular la tasca, proporcionar instruccions més específiques o guiar-lo cap a un enfocament diferent.",
"codebaseSearch": {
"approval": "Cercant '{{query}}' a la base de codi..."
},
"searchFiles": {
"workspaceBoundaryError": "No es pot cercar fora de l'espai de treball. El camí '{{path}}' està fora de l'espai de treball actual."
}
}
3 changes: 0 additions & 3 deletions src/i18n/locales/de/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@
"toolRepetitionLimitReached": "Roo scheint in einer Schleife festzustecken und versucht wiederholt dieselbe Aktion ({{toolName}}). Dies könnte auf ein Problem mit der aktuellen Strategie hindeuten. Überlege dir, die Aufgabe umzuformulieren, genauere Anweisungen zu geben oder Roo zu einem anderen Ansatz zu führen.",
"codebaseSearch": {
"approval": "Suche nach '{{query}}' im Codebase..."
},
"searchFiles": {
"workspaceBoundaryError": "Kann nicht außerhalb des Arbeitsbereichs suchen. Pfad '{{path}}' liegt außerhalb des aktuellen Arbeitsbereichs."
}
}
3 changes: 0 additions & 3 deletions src/i18n/locales/en/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@
"toolRepetitionLimitReached": "Roo appears to be stuck in a loop, attempting the same action ({{toolName}}) repeatedly. This might indicate a problem with its current strategy. Consider rephrasing the task, providing more specific instructions, or guiding it towards a different approach.",
"codebaseSearch": {
"approval": "Searching for '{{query}}' in codebase..."
},
"searchFiles": {
"workspaceBoundaryError": "Cannot search outside workspace. Path '{{path}}' is outside the current workspace."
}
}
3 changes: 0 additions & 3 deletions src/i18n/locales/es/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@
"toolRepetitionLimitReached": "Roo parece estar atrapado en un bucle, intentando la misma acción ({{toolName}}) repetidamente. Esto podría indicar un problema con su estrategia actual. Considera reformular la tarea, proporcionar instrucciones más específicas o guiarlo hacia un enfoque diferente.",
"codebaseSearch": {
"approval": "Buscando '{{query}}' en la base de código..."
},
"searchFiles": {
"workspaceBoundaryError": "No se puede buscar fuera del espacio de trabajo. La ruta '{{path}}' está fuera del espacio de trabajo actual."
}
}
3 changes: 0 additions & 3 deletions src/i18n/locales/fr/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@
"toolRepetitionLimitReached": "Roo semble être bloqué dans une boucle, tentant la même action ({{toolName}}) de façon répétée. Cela pourrait indiquer un problème avec sa stratégie actuelle. Envisage de reformuler la tâche, de fournir des instructions plus spécifiques ou de le guider vers une approche différente.",
"codebaseSearch": {
"approval": "Recherche de '{{query}}' dans la base de code..."
},
"searchFiles": {
"workspaceBoundaryError": "Impossible de rechercher en dehors de l'espace de travail. Le chemin '{{path}}' est en dehors de l'espace de travail actuel."
}
}
3 changes: 0 additions & 3 deletions src/i18n/locales/hi/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@
"toolRepetitionLimitReached": "Roo एक लूप में फंसा हुआ लगता है, बार-बार एक ही क्रिया ({{toolName}}) को दोहरा रहा है। यह उसकी वर्तमान रणनीति में किसी समस्या का संकेत हो सकता है। कार्य को पुनः परिभाषित करने, अधिक विशिष्ट निर्देश देने, या उसे एक अलग दृष्टिकोण की ओर मार्गदर्शित करने पर विचार करें।",
"codebaseSearch": {
"approval": "कोडबेस में '{{query}}' खोज रहा है..."
},
"searchFiles": {
"workspaceBoundaryError": "वर्कस्पेस के बाहर खोज नहीं की जा सकती। पथ '{{path}}' वर्तमान वर्कस्पेस के बाहर है।"
}
}
Loading
Loading