buildConfigSearchPaths
Generated reference page for the buildConfigSearchPaths function export.
- Import:
@kjanat/dreamcli - Export kind: function
- Declared in:
src/core/config/index.ts - Source link:
packages/dreamcli/src/core/config/index.ts:170
Signatures
ts
function buildConfigSearchPaths(appName: string, cwd: string, configDir: string, loaders?: readonly FormatLoader[]): readonly string[];| Parameter | Type | Description |
|---|---|---|
appName | string | CLI application name used to derive config filenames. |
cwd | string | Current working directory (project-root search location). |
configDir | string | Platform config directory (XDG / AppData). |
loaders | readonly FormatLoader[] | undefined | Optional custom FormatLoaders whose extensions expand the search set. |
Members
Members
buildConfigSearchPaths
Build the default config search paths for an app.
Advanced helper used by DreamCLI's config discovery. Most apps should call .config() or discoverConfig instead of constructing search paths manually. Exported for debugging, custom discovery flows, and help text.
Search order (first match wins):
$CWD/.{appName}.json— dotfile in project root$CWD/{appName}.config.json— explicit config in project root$CONFIG_DIR/{appName}/config.json— XDG / AppData standard ($XDG_CONFIG_HOME/~/.configon Unix,%APPDATA%/%USERPROFILE%\\AppData\\Roamingon Windows)
When custom loaders are registered, each path pattern is repeated per supported extension (JSON always first).
ts
(appName: string, cwd: string, configDir: string, loaders?: readonly FormatLoader[]): readonly string[];Examples
ts
const paths = buildConfigSearchPaths('mycli', '/repo', '/home/me/.config');