Merge pull request #1393 from ualtinok/dev
fix: grep and glob tools usage without path param under Opencode Desktop
This commit is contained in:
commit
5dabb8a198
@ -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(
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user