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:
YeonGyu-Kim
2026-02-05 02:23:48 +09:00
parent 8886879bd0
commit 71ac09bb63
2 changed files with 6 additions and 6 deletions

View File

@@ -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(

View File

@@ -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({