import { WithAsync } from "../util/type-utils.mjs"; import { CommandTypesBase } from "../types/command.mjs"; import { StandardSchemaV1 } from "@standard-schema/spec"; //#region src/extension/config.d.ts type PadroneConfigOptions = { /** Config file names to auto-detect (e.g. `['config.json', '.myapprc']`). First found is used. */files?: string | string[]; /** Schema to validate and transform config file data into the args shape. */ schema?: StandardSchemaV1; /** Disable this extension. */ disabled?: boolean; /** Whether to add `--config` / `-c` flag support. Defaults to `true`. */ flag?: boolean; /** Whether subcommands inherit this interceptor. Defaults to `true`. */ inherit?: boolean; /** * Search for config files in the user's platform-specific config directory. * - `true` — use the program name as the subdirectory (e.g. program `'myapp'` → `~/.config/myapp/`). * - `string` — use a custom app name as the subdirectory. * - `false` — disable (default). * * Directories searched (after cwd): * - **Linux**: `$XDG_CONFIG_HOME/` or `~/.config/` * - **macOS**: `~/Library/Application Support/` (or `$XDG_CONFIG_HOME/` when set) * - **Windows**: `%APPDATA%\` * * Config files found in cwd always take precedence over XDG paths. */ xdg?: string | boolean; /** * Custom config loader. When provided, replaces the built-in file system loader. * Useful for testing or non-CLI environments. */ loadConfig?: (files: string | string[], xdgAppName?: string) => Record | undefined | Promise | undefined>; }; /** * Extension that handles config file loading, validation, and merging into command arguments. * * Features: * - `--config` / `-c` flag for explicit config file path (can be disabled via `flag: false`) * - Auto-detection of config files from a list of candidate names * - Optional schema validation and transformation of config data * - Directly accesses the file system (gracefully no-ops in non-CLI environments) * * Config values have the lowest precedence (CLI > stdin > env > config). * * Not included in the default built-in extensions — must be explicitly added: * ```ts * createPadrone('my-cli') * .extend(padroneConfig({ * files: ['config.json', '.myapprc'], * schema: z.object({ port: z.number(), host: z.string() }), * })) * ``` */ declare function padroneConfig(options?: PadroneConfigOptions): (builder: T) => WithAsync; //#endregion export { PadroneConfigOptions, padroneConfig }; //# sourceMappingURL=config.d.mts.map