Concepts
Configuration layers
Understand where clily reads values from and which layer wins.
clily resolves command input by merging four layers:
- CLI arguments
- Environment variables
- Config files
- Schema defaults
That precedence is encoded directly in the framework.
defu(cliArgs, envVars, fileConfig, schemaDefaults)Why this matters
Your handler should not need to care whether a value came from --profile=prod, an environment variable, or a local config file.
By the time the handler runs, clily has already:
- loaded matching config through
c12 - resolved environment variables
- applied schema defaults
- validated the merged result
Config loading
clily searches for config based on the command name, including local and global rc files plus dotenv and package.json support through c12.
For a command named release, clily looks for sources such as:
release.config.tsrelease.config.js.releaserc- global rc variants
Design consequence
Model defaults in your schema when they are part of the command contract.
Use config files and environment variables when the values are deployment- or machine-specific.