MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / findGitRepos

Function findGitRepos

packages/setupWizard/src/localRepos.ts:33–66  ·  view source on GitHub ↗
(root: string, maxDepth: number)

Source from the content-addressed store, hash-verified

31}
32
33async function findGitRepos(root: string, maxDepth: number): Promise<string[]> {
34 const repos: string[] = [];
35
36 async function walk(dir: string, depth: number): Promise<void> {
37 if (existsSync(join(dir, '.git'))) {
38 repos.push(dir);
39 return;
40 }
41 if (depth >= maxDepth) {
42 return;
43 }
44 let entries;
45 try {
46 entries = await readdir(dir, { withFileTypes: true });
47 } catch {
48 return;
49 }
50 for (const entry of entries) {
51 if (!entry.isDirectory()) {
52 continue;
53 }
54 if (entry.name.startsWith('.')) {
55 continue;
56 }
57 if (SKIP_DIRS.has(entry.name)) {
58 continue;
59 }
60 await walk(join(dir, entry.name), depth + 1);
61 }
62 }
63
64 await walk(root, 0);
65 return repos.sort();
66}
67
68export async function collectLocalReposConfig(
69 localRepoIndex: Map<string, number>,

Callers 1

collectLocalReposConfigFunction · 0.85

Calls 1

walkFunction · 0.85

Tested by

no test coverage detected