buildConfigSearchPaths
Generated reference page for the buildConfigSearchPaths function export.
- Import:
@kjanat/dreamcli - Export kind: function
- Declared in:
src/core/config/index.ts - Source link:
src/core/config/index.ts:231
Signatures
ts
function buildConfigSearchPaths(appName: string, options: ConfigSearchPathOptions): readonly string[];| Parameter | Type | Description |
|---|---|---|
appName | string | CLI application name used to derive config filenames. |
options | ConfigSearchPathOptions | Directory scopes and loaders (see ConfigSearchPathOptions). |
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):
- Project scope — for
baseDirand each ancestor directory up to the filesystem root, nearest first:{dir}/.{appName}.json— dotfile{dir}/{appName}.config.json— explicit config{dir}/.config/{appName}.json— project.config/convention
- User scope —
{userConfigDir}/{appName}/config.jsonfor each entry ofuserConfigDirs, in order. - System scope —
{systemConfigDir}/{appName}/config.jsonfor each entry ofsystemConfigDirs, in order.
When custom loaders are registered, each path pattern is repeated per supported extension (JSON always first).
ts
(appName: string, options: ConfigSearchPathOptions): readonly string[];Examples
ts
const paths = buildConfigSearchPaths('mycli', {
baseDir: '/repo/packages/app',
userConfigDirs: ['/home/me/.config'],
systemConfigDirs: ['/etc'],
});