fix: use process.cwd() instead of ctx.directory for glob/grep tools
ToolContext type from @opencode-ai/plugin/tool does not include a 'directory' property, causing typecheck failure after rebase from dev. Changed to use process.cwd() which is the same pattern used in session-manager/tools.ts.
This commit is contained in:
@@ -20,11 +20,11 @@ export const glob: ToolDefinition = tool({
|
||||
"simply omit it for the default behavior. Must be a valid directory path if provided."
|
||||
),
|
||||
},
|
||||
execute: async (args, ctx) => {
|
||||
execute: async (args) => {
|
||||
try {
|
||||
const cli = await resolveGrepCliWithAutoInstall()
|
||||
// Use ctx.directory as the default search path when no path is provided
|
||||
const searchPath = args.path ?? ctx.directory
|
||||
// Use process.cwd() as the default search path when no path is provided
|
||||
const searchPath = args.path ?? process.cwd()
|
||||
const paths = [searchPath]
|
||||
|
||||
const result = await runRgFiles(
|
||||
|
||||
@@ -20,11 +20,11 @@ export const grep: ToolDefinition = tool({
|
||||
.optional()
|
||||
.describe("The directory to search in. Defaults to the current working directory."),
|
||||
},
|
||||
execute: async (args, ctx) => {
|
||||
execute: async (args) => {
|
||||
try {
|
||||
const globs = args.include ? [args.include] : undefined
|
||||
// Use ctx.directory as the default search path when no path is provided
|
||||
const searchPath = args.path ?? ctx.directory
|
||||
// Use process.cwd() as the default search path when no path is provided
|
||||
const searchPath = args.path ?? process.cwd()
|
||||
const paths = [searchPath]
|
||||
|
||||
const result = await runRg({
|
||||
|
||||
Reference in New Issue
Block a user