The open source coding agent.
TypeScript
fix: grep failing when pattern started with a dash
Haris Gušićaf5059652903
diff --git a/packages/opencode/src/file/ripgrep.ts b/packages/opencode/src/file/ripgrep.tsindex 6e7f549a7a5..29014d199e7 100644--- a/packages/opencode/src/file/ripgrep.ts+++ b/packages/opencode/src/file/ripgrep.ts@@ -367,6 +367,7 @@ export namespace Ripgrep {args.push(`--max-count=${input.limit}`)}+ args.push("--")args.push(input.pattern)const command = args.join(" ")diff --git a/packages/opencode/src/tool/grep.ts b/packages/opencode/src/tool/grep.tsindex a4d57b3d6df..5390be21ac1 100644--- a/packages/opencode/src/tool/grep.ts+++ b/packages/opencode/src/tool/grep.ts@@ -20,7 +20,7 @@ export const GrepTool = Tool.define("grep", {const searchPath = params.path || Instance.directoryconst rgPath = await Ripgrep.filepath()- const args = ["-nH", "--field-match-separator=|", params.pattern]+ const args = ["-nH", "--field-match-separator=|", "--regexp", params.pattern]if (params.include) {args.push("--glob", params.include)}