Skip to content

Commit abd6619

Browse files
authored
Merge pull request #8112 from continuedev/tingwai/con-4174-cli-start-file-depth
fix: add max depth to file indexing
2 parents 2fb5a74 + 52f2058 commit abd6619

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

extensions/cli/src/services/FileIndexService.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { fdir } from "fdir";
22
import { AsyncFzf, FzfResultItem } from "fzf";
33

44
import { FILE_IGNORE_PATTERNS } from "../util/filePatterns.js";
5+
import { isGitRepo } from "../util/git.js";
56
import { logger } from "../util/logger.js";
67

78
import { BaseService } from "./BaseService.js";
@@ -131,10 +132,15 @@ export class FileIndexService extends BaseService<FileIndexServiceState> {
131132
const currentDir = process.cwd();
132133
logger.debug(`Starting file index in directory: ${currentDir}`);
133134

135+
// Determine max depth based on git repository status
136+
const inGitRepo = isGitRepo();
137+
const maxDepth = inGitRepo ? 10 : 3;
138+
134139
// Create file indexing promise
135140
const fileIndexPromise = new fdir()
136141
.withFullPaths()
137142
.withRelativePaths()
143+
.withMaxDepth(maxDepth)
138144
.filter((path) => {
139145
// Use the helper function that implements original FILE_PATTERNS logic
140146
return this.shouldIncludeFile(path);

0 commit comments

Comments
 (0)