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
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."
),
},
execute: async (args) => {
execute: async (args, ctx) => {
try {
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(
{

View File

@@ -20,10 +20,12 @@ export const grep: ToolDefinition = tool({
.optional()
.describe("The directory to search in. Defaults to the current working directory."),
},
execute: async (args) => {
execute: async (args, ctx) => {
try {
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({
pattern: args.pattern,