Function signature
packages/core/src/cli.ts
bunli.config.ts, applies defaults, and initializes the plugin system.
Parameters
Optional configuration to override or merge with loaded config. If no config file exists,
name and version are required.Internal runtime dependencies for testing and customization.
Return value
A CLI instance with methods to register commands and execute the CLI.
Configuration loading
The function automatically searches for configuration files in this order:bunli.config.tsbunli.config.jsbunli.config.mjs
configOverride. If no config file exists and configOverride doesn’t provide name and version, an error is thrown.
Generated types
The function attempts to load generated types from./.bunli/commands.gen.ts. This enables type-safe command execution via the execute() method.
Error handling
Thrown when configuration validation fails
Examples
Basic usage with config file
Usage without config file
With plugins
Programmatic execution
Related
- defineCommand - Define commands to register with the CLI
- defineConfig - Define configuration with type safety
- loadConfig - Load configuration from files