Skip to content

findProjectConfigPath

findProjectConfigPath(commandLineConfigOverrides): { dir: string; path: string; } | undefined

Defined in: core/dist/config/loader.d.ts:24

Find THE project config by walking up from cwd toward a stop boundary, returning the FIRST match (first-match-win: nearest dir, then format precedence within that dir — NOT a merged stack). Detection (hasProjectConfig/hasAnyConfig) and loading (initConfig) both go through this, so they can never disagree.

Stop boundary — the dir is SEARCHED, then ascent stops at: a dir containing .git (the git root), the user’s home dir, or the filesystem root — whichever comes first. So a config IN the git root (or home) is found; a config ABOVE it is not.

A customConfigPath override wins outright (no walking).

NOTE (identity profile): with an identityProfile set, each dir’s per-format resolver (resolveConfigPath) tries the profile path .gsloth/.gsloth-settings/<profile>/<file> but FALLS BACK to the plain <dir>/<file> when the profile file is absent. So a match here does NOT prove the named profile itself has a config — it may be a plain (non-profile) config. Use resolveIdentityProfileConfigPath when you need to know a profile specifically resolved.

CommandLineConfigOverrides

{ dir: string; path: string; } | undefined

the matched { dir, path }, or undefined when no project config exists within the boundary.