Skip to content

Commit 9f612d5

Browse files
committed
code review
1 parent 5c48253 commit 9f612d5

File tree

20 files changed

+58
-22
lines changed

20 files changed

+58
-22
lines changed

src/core/tools/contextValidator.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { promises as fs } from "fs"
21
import { Task } from "../task/Task"
32
import { readLines } from "../../integrations/misc/read-lines"
43
import { getModelMaxOutputTokens } from "../../shared/api"

src/core/tools/readFileTool.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ export async function readFileTool(
488488
try {
489489
const defResult = await parseSourceCodeDefinitionsForFile(fullPath, cline.rooIgnoreController)
490490
if (defResult) {
491-
let xmlInfo = `<notice>Showing only ${effectiveMaxReadFileLine} of ${totalLines} total lines. Use line_range if you need to read more lines</notice>\n`
491+
let xmlInfo = `<notice>${t("tools.readFile.showingOnlyLines", { shown: effectiveMaxReadFileLine, total: totalLines })}</notice>\n`
492492
updateFileResult(relPath, {
493493
xmlContent: `<file><path>${relPath}</path>\n<list_code_definition_names>${defResult}</list_code_definition_names>\n${xmlInfo}</file>`,
494494
})
@@ -520,9 +520,10 @@ export async function readFileTool(
520520
// Add appropriate notice based on whether this was a preemptive limit or user setting
521521
if (validationNotice) {
522522
// When shouldLimit is true, always provide inline instructions
523-
xmlInfo += `<notice>${validationNotice}\n\nTo read specific sections of this file, use the following format:\n<read_file>\n<args>\n <file>\n <path>${relPath}</path>\n <line_range>start-end</line_range>\n </file>\n</args>\n</read_file>\n\nFor example, to read lines 2001-3000:\n<read_file>\n<args>\n <file>\n <path>${relPath}</path>\n <line_range>2001-3000</line_range>\n </file>\n</args>\n</read_file></notice>\n`
523+
const instructions = t("tools.readFile.contextLimitInstructions", { path: relPath })
524+
xmlInfo += `<notice>${validationNotice}\n\n${instructions}</notice>\n`
524525
} else {
525-
xmlInfo += `<notice>Showing only ${effectiveMaxReadFileLine} of ${totalLines} total lines. Use line_range if you need to read more lines</notice>\n`
526+
xmlInfo += `<notice>${t("tools.readFile.showingOnlyLines", { shown: effectiveMaxReadFileLine, total: totalLines })}</notice>\n`
526527
}
527528

528529
updateFileResult(relPath, {

src/i18n/locales/ca/tools.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/de/tools.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/en/tools.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
"readFile": {
33
"linesRange": " (lines {{start}}-{{end}})",
44
"definitionsOnly": " (definitions only)",
5-
"maxLines": " (max {{max}} lines)"
5+
"maxLines": " (max {{max}} lines)",
6+
"showingOnlyLines": "Showing only {{shown}} of {{total}} total lines. Use line_range if you need to read more lines",
7+
"contextLimitInstructions": "To read specific sections of this file, use the following format:\n<read_file>\n<args>\n <file>\n <path>{{path}}</path>\n <line_range>start-end</line_range>\n </file>\n</args>\n</read_file>\n\nFor example, to read lines 2001-3000:\n<read_file>\n<args>\n <file>\n <path>{{path}}</path>\n <line_range>2001-3000</line_range>\n </file>\n</args>\n</read_file>"
68
},
79
"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.",
810
"codebaseSearch": {

src/i18n/locales/es/tools.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/fr/tools.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/hi/tools.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/id/tools.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/it/tools.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)