Merge pull request #1393 from ualtinok/dev

fix: grep and glob tools usage without path param under Opencode Desktop
This commit is contained in:
YeonGyu-Kim 2026-02-04 13:34:52 +09:00 committed by GitHub
commit 5dabb8a198
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -20,10 +20,12 @@ export const glob: ToolDefinition = tool({
"simply omit it for the default behavior. Must be a valid directory path if provided." "simply omit it for the default behavior. Must be a valid directory path if provided."
), ),
}, },
execute: async (args) => { execute: async (args, ctx) => {
try { try {
const cli = await resolveGrepCliWithAutoInstall() const cli = await resolveGrepCliWithAutoInstall()
const paths = args.path ? [args.path] : undefined // Use ctx.directory as the default search path when no path is provided
const searchPath = args.path ?? ctx.directory
const paths = [searchPath]
const result = await runRgFiles( const result = await runRgFiles(
{ {

View File

@ -20,10 +20,12 @@ export const grep: ToolDefinition = tool({
.optional() .optional()
.describe("The directory to search in. Defaults to the current working directory."), .describe("The directory to search in. Defaults to the current working directory."),
}, },
execute: async (args) => { execute: async (args, ctx) => {
try { try {
const globs = args.include ? [args.include] : undefined const globs = args.include ? [args.include] : undefined
const paths = args.path ? [args.path] : undefined // Use ctx.directory as the default search path when no path is provided
const searchPath = args.path ?? ctx.directory
const paths = [searchPath]
const result = await runRg({ const result = await runRg({
pattern: args.pattern, pattern: args.pattern,