discoverConfig
Discover and load a config file.
Low-level discovery helper behind CLIBuilder.config(). Most apps should let the CLI runtime call this automatically; call it directly when testing config behavior or building custom bootstrapping around RuntimeAdapter.
Path loaders use the adapter's optional file-existence probe. Text loaders and adapters without that probe use readFile. Returns a discriminated union: { found: true, ... } when a config file was found and parsed, { found: false } when no file exists.
- Import:
@kjanat/dreamcli/config - Export kind: function
- Declared in:
src/core/config/index.ts - Source link:
src/core/config/index.ts:392
Signatures
function discoverConfig(appName: string, adapter: ConfigAdapter, options?: ConfigDiscoveryOptions): Promise<ConfigDiscoveryResult>;Members
Members
discoverConfig
Discover and load a config file.
Low-level discovery helper behind CLIBuilder.config(). Most apps should let the CLI runtime call this automatically; call it directly when testing config behavior or building custom bootstrapping around RuntimeAdapter.
Path loaders use the adapter's optional file-existence probe. Text loaders and adapters without that probe use readFile. Returns a discriminated union: { found: true, ... } when a config file was found and parsed, { found: false } when no file exists.
(appName: string, adapter: ConfigAdapter, options?: ConfigDiscoveryOptions): Promise<ConfigDiscoveryResult>;Examples
const result = await discoverConfig('mycli', adapter, {
loaders: [
configFormat(['yaml', 'yml'], Bun.YAML.parse),
configFormat(['toml'], Bun.TOML.parse),
],
});