fix grep exact file path searches (#22356)

This commit is contained in:
Kit Langton
2026-04-13 19:26:50 -04:00
committed by GitHub
parent 035954b2bf
commit 2c57db7f0e
6 changed files with 139 additions and 4 deletions
+4
View File
@@ -40,6 +40,10 @@ export const GlobTool = Tool.define(
let search = params.path ?? Instance.directory
search = path.isAbsolute(search) ? search : path.resolve(Instance.directory, search)
const info = yield* fs.stat(search).pipe(Effect.catch(() => Effect.succeed(undefined)))
if (info?.type === "File") {
throw new Error(`glob path must be a directory: ${search}`)
}
yield* assertExternalDirectoryEffect(ctx, search, { kind: "directory" })
const limit = 100