/** * Project-Root Resolution Module * * Resolves a project root from a starting directory by walking the ancestor * chain and applying four heuristics: * (0) own .planning/ guard (#1362) * (1) parent .planning/config.json sub_repos * (2) legacy multiRepo: true + ancestor .git * (3) .git heuristic with parent .planning/ * Bounded by FIND_PROJECT_ROOT_MAX_DEPTH ancestors. Sync I/O. * * Source of truth for `findProjectRoot` — the CJS artifact at * get-shit-done/bin/lib/project-root.generated.cjs is generated from this file. */ /** * Maximum number of parent directories to walk when searching for a * multi-repo `.planning/` root. Bounded to avoid scanning to the filesystem * root in pathological cases. */ export declare const FIND_PROJECT_ROOT_MAX_DEPTH = 10; /** * Walk up from `startDir` to find the project root that owns `.planning/`. * * Ported from `get-shit-done/bin/lib/core.cjs:findProjectRoot` so that * `gsd-sdk query` resolves the same parent `.planning/` root as the legacy * `gsd-tools.cjs` CLI when invoked inside a `sub_repos`-listed child repo. * * Detection strategy (checked in order for each ancestor, up to * `FIND_PROJECT_ROOT_MAX_DEPTH` levels): * 1. `startDir` itself has `.planning/` — return it unchanged (#1362). * 2. Parent has `.planning/config.json` with `sub_repos` listing the * immediate child segment of the starting directory. * 3. Parent has `.planning/config.json` with `multiRepo: true` (legacy). * 4. Parent has `.planning/` AND an ancestor of `startDir` (up to the * candidate parent) contains `.git` — heuristic fallback. * * Returns `startDir` unchanged when no ancestor `.planning/` is found * (first-run or single-repo projects). Never walks above the user's home * directory. * * All filesystem errors are swallowed — a missing or unparseable * `config.json` falls back to the `.git` heuristic, and unreadable * directories terminate the walk at that level. */ export declare function findProjectRoot(startDir: string): string; //# sourceMappingURL=index.d.ts.map