We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f1bb587 commit 95c3a8bCopy full SHA for 95c3a8b
1 file changed
packages/opencode/src/tool/grep.ts
@@ -5,6 +5,8 @@ import { Ripgrep } from "../file/ripgrep"
5
import DESCRIPTION from "./grep.txt"
6
import { Instance } from "../project/instance"
7
8
+const MAX_LINE_LENGTH = 2000
9
+
10
export const GrepTool = Tool.define("grep", {
11
description: DESCRIPTION,
12
parameters: z.object({
@@ -96,7 +98,9 @@ export const GrepTool = Tool.define("grep", {
96
98
currentFile = match.path
97
99
outputLines.push(`${match.path}:`)
100
}
- outputLines.push(` Line ${match.lineNum}: ${match.lineText}`)
101
+ const truncatedLineText =
102
+ match.lineText.length > MAX_LINE_LENGTH ? match.lineText.substring(0, MAX_LINE_LENGTH) + "..." : match.lineText
103
+ outputLines.push(` Line ${match.lineNum}: ${truncatedLineText}`)
104
105
106
if (truncated) {
0 commit comments