fix: handle Windows CRLF line endings in grep tool (#5948)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
lif
2025-12-22 22:26:15 -06:00
committed by GitHub
co-authored by Claude
parent eab177f5e7
commit 5af35117db
3 changed files with 114 additions and 3 deletions
+2 -1
View File
@@ -49,7 +49,8 @@ export const GrepTool = Tool.define("grep", {
throw new Error(`ripgrep failed: ${errorOutput}`)
}
const lines = output.trim().split("\n")
// Handle both Unix (\n) and Windows (\r\n) line endings
const lines = output.trim().split(/\r?\n/)
const matches = []
for (const line of lines) {