From 71ac09bb637e90d9b5496ad300af0b37c111fd2f Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Thu, 5 Feb 2026 02:23:48 +0900 Subject: [PATCH] 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. --- src/tools/glob/tools.ts | 6 +++--- src/tools/grep/tools.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tools/glob/tools.ts b/src/tools/glob/tools.ts index 763a3fd4b..2d8b491ed 100644 --- a/src/tools/glob/tools.ts +++ b/src/tools/glob/tools.ts @@ -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( diff --git a/src/tools/grep/tools.ts b/src/tools/grep/tools.ts index 7e8f5faa8..901764ce7 100644 --- a/src/tools/grep/tools.ts +++ b/src/tools/grep/tools.ts @@ -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({