mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
feat(file-search): Add support for non-recursive file search (#5648)
Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
@@ -19,6 +19,7 @@ export type FileSearchOptions = {
|
||||
useGeminiignore: boolean;
|
||||
cache: boolean;
|
||||
cacheTtl: number;
|
||||
maxDepth?: number;
|
||||
};
|
||||
|
||||
export class AbortError extends Error {
|
||||
@@ -215,6 +216,7 @@ export class FileSearch {
|
||||
const cacheKey = cache.getCacheKey(
|
||||
this.absoluteDir,
|
||||
this.ignore.getFingerprint(),
|
||||
this.options.maxDepth,
|
||||
);
|
||||
const cachedResults = cache.read(cacheKey);
|
||||
|
||||
@@ -230,6 +232,7 @@ export class FileSearch {
|
||||
const cacheKey = cache.getCacheKey(
|
||||
this.absoluteDir,
|
||||
this.ignore.getFingerprint(),
|
||||
this.options.maxDepth,
|
||||
);
|
||||
cache.write(cacheKey, this.allFiles, this.options.cacheTtl * 1000);
|
||||
}
|
||||
@@ -257,6 +260,10 @@ export class FileSearch {
|
||||
return dirFilter(`${relativePath}/`);
|
||||
});
|
||||
|
||||
if (this.options.maxDepth !== undefined) {
|
||||
api.withMaxDepth(this.options.maxDepth);
|
||||
}
|
||||
|
||||
return api.crawl(this.absoluteDir).withPromise();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user