fix: grep omitting text after a colon (#1053)

This commit is contained in:
Jeremy Mack
2025-07-16 09:09:05 -05:00
committed by GitHub
parent 57d1a60efc
commit 5d67e13df5

View File

@@ -55,12 +55,11 @@ export const GrepTool = Tool.define({
for (const line of lines) { for (const line of lines) {
if (!line) continue if (!line) continue
const parts = line.split(":", 3) const [filePath, lineNumStr, ...lineTextParts] = line.split(":")
if (parts.length < 3) continue if (!filePath || !lineNumStr || lineTextParts.length === 0) continue
const filePath = parts[0] const lineNum = parseInt(lineNumStr, 10)
const lineNum = parseInt(parts[1], 10) const lineText = lineTextParts.join(":")
const lineText = parts[2]
const file = Bun.file(filePath) const file = Bun.file(filePath)
const stats = await file.stat().catch(() => null) const stats = await file.stat().catch(() => null)