MCPcopy Index your code
hub / github.com/dmno-dev/bumpy / findRoot

Function findRoot

packages/bumpy/src/core/config.ts:9–28  ·  view source on GitHub ↗
(startDir: string = process.cwd())

Source from the content-addressed store, hash-verified

7
8/** Find the monorepo root by walking up from cwd looking for .bumpy/ */
9export async function findRoot(startDir: string = process.cwd()): Promise<string> {
10 let dir = resolve(startDir);
11 while (true) {
12 if (await exists(resolve(dir, BUMPY_DIR))) return dir;
13 // Also check for package.json with workspaces as a fallback
14 if (await exists(resolve(dir, 'package.json'))) {
15 try {
16 const pkg = await readJson<Record<string, unknown>>(resolve(dir, 'package.json'));
17 if (pkg.workspaces) return dir;
18 } catch {
19 // ignore
20 }
21 }
22 const parent = resolve(dir, '..');
23 if (parent === dir) break; // reached filesystem root
24 dir = parent;
25 }
26 // Default to cwd if nothing found
27 return resolve(startDir);
28}
29
30/** Load the root bumpy config, merging with defaults */
31export async function loadConfig(rootDir: string): Promise<BumpyConfig> {

Callers 1

mainFunction · 0.90

Calls 1

existsFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…