overhaul file search and support @ mentioning directories

This commit is contained in:
Dax Raad
2025-10-01 03:37:01 -04:00
parent fe45a76c55
commit 6e19200fca
10 changed files with 132 additions and 27 deletions

View File

@@ -23,7 +23,7 @@ export const GlobTool = Tool.define("glob", {
const limit = 100
const files = []
let truncated = false
for (const file of await Ripgrep.files({
for await (const file of Ripgrep.files({
cwd: search,
glob: [params.pattern],
})) {

View File

@@ -44,7 +44,11 @@ export const ListTool = Tool.define("list", {
const searchPath = path.resolve(Instance.directory, params.path || ".")
const ignoreGlobs = IGNORE_PATTERNS.map((p) => `!${p}*`).concat(params.ignore?.map((p) => `!${p}`) || [])
const files = await Ripgrep.files({ cwd: searchPath, glob: ignoreGlobs, limit: LIMIT })
const files = []
for await (const file of Ripgrep.files({ cwd: searchPath, glob: ignoreGlobs })) {
files.push(file)
if (files.length >= LIMIT) break
}
// Build directory structure
const dirs = new Set<string>()