summaryrefslogtreecommitdiff
path: root/packages/core/src/utils/filesearch/fileSearch.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/core/src/utils/filesearch/fileSearch.ts')
-rw-r--r--packages/core/src/utils/filesearch/fileSearch.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/core/src/utils/filesearch/fileSearch.ts b/packages/core/src/utils/filesearch/fileSearch.ts
index 5915821a..db14bc65 100644
--- a/packages/core/src/utils/filesearch/fileSearch.ts
+++ b/packages/core/src/utils/filesearch/fileSearch.ts
@@ -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();
}