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:
parent
8886879bd0
commit
71ac09bb63
@ -20,11 +20,11 @@ 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, ctx) => {
|
execute: async (args) => {
|
||||||
try {
|
try {
|
||||||
const cli = await resolveGrepCliWithAutoInstall()
|
const cli = await resolveGrepCliWithAutoInstall()
|
||||||
// Use ctx.directory as the default search path when no path is provided
|
// Use process.cwd() as the default search path when no path is provided
|
||||||
const searchPath = args.path ?? ctx.directory
|
const searchPath = args.path ?? process.cwd()
|
||||||
const paths = [searchPath]
|
const paths = [searchPath]
|
||||||
|
|
||||||
const result = await runRgFiles(
|
const result = await runRgFiles(
|
||||||
|
|||||||
@ -20,11 +20,11 @@ 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, ctx) => {
|
execute: async (args) => {
|
||||||
try {
|
try {
|
||||||
const globs = args.include ? [args.include] : undefined
|
const globs = args.include ? [args.include] : undefined
|
||||||
// Use ctx.directory as the default search path when no path is provided
|
// Use process.cwd() as the default search path when no path is provided
|
||||||
const searchPath = args.path ?? ctx.directory
|
const searchPath = args.path ?? process.cwd()
|
||||||
const paths = [searchPath]
|
const paths = [searchPath]
|
||||||
|
|
||||||
const result = await runRg({
|
const result = await runRg({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user