Would it be a good idea to add a feature for handling configuration files to Optique? 🤔

optique.dev
Optique
Type-safe combinatorial CLI parser for TypeScript
Would it be a good idea to add a feature for handling configuration files to Optique? 🤔

optique.dev
Type-safe combinatorial CLI parser for TypeScript
After deep thinking, I've designed a satisfying solution and broke it down into 4 issues:
Annotations system (#83): Low-level primitive that allows passing runtime context to parsers via parse() options
SourceContext interface (#85): High-level system for composing multiple data sources (env, config, etc.) with clear priority ordering via runWith()
@optique/config (#84): Configuration file support with Standard Schema validation (Zod, Valibot, etc.)
@optique/env (#86): Environment variables support with automatic type conversion
The key insight: use a two-pass parsing approach where the first pass extracts the config file path, then the second pass runs with config data injected as annotations. All sources can be composed together with runWith([envContext, configContext]) for automatic priority handling: CLI > environment variables > configuration file > default values.
github.com
Motivation CLI applications often need to support configuration via environment variables, following the common pattern where environment variables provide defaults between CLI arguments and config...