The open source coding agent.
TypeScript
limit grep line length to 2000
Dax Raad95c3a8b80505
diff --git a/packages/opencode/src/tool/grep.ts b/packages/opencode/src/tool/grep.tsindex 5390be21ac1..99af448ba68 100644--- a/packages/opencode/src/tool/grep.ts+++ b/packages/opencode/src/tool/grep.ts@@ -5,6 +5,8 @@ import { Ripgrep } from "../file/ripgrep"import DESCRIPTION from "./grep.txt"import { Instance } from "../project/instance"+const MAX_LINE_LENGTH = 2000+export const GrepTool = Tool.define("grep", {description: DESCRIPTION,parameters: z.object({@@ -96,7 +98,9 @@ export const GrepTool = Tool.define("grep", {currentFile = match.pathoutputLines.push(`${match.path}:`)}- outputLines.push(` Line ${match.lineNum}: ${match.lineText}`)+ const truncatedLineText =+ match.lineText.length > MAX_LINE_LENGTH ? match.lineText.substring(0, MAX_LINE_LENGTH) + "..." : match.lineText+ outputLines.push(` Line ${match.lineNum}: ${truncatedLineText}`)}if (truncated) {