init
The init command launches an interactive wizard to configure coverctl for your project. It auto-detects domains and lets you customize coverage thresholds.
coverctl init [flags]Alias: coverctl i
| Flag | Description | Default |
|---|---|---|
-c, --config | Config file path | .coverctl.yaml |
-f, --force | Overwrite existing config file | false |
--no-interactive | Skip wizard, write auto-detected config | false |
Interactive Wizard
Section titled “Interactive Wizard”The wizard provides a terminal UI built with Bubble Tea:
- Domain Detection: Automatically discovers domains from project structure
- Threshold Adjustment: Use arrow keys or +/- to adjust coverage minimums
- Confirmation: Review and confirm before writing config
Navigation
Section titled “Navigation”| Key | Action |
|---|---|
↑/↓ | Move between domains |
←/→ | Decrease/increase threshold |
+/- | Adjust threshold by 5% |
Enter | Confirm and write config |
Esc/q | Cancel |
Examples
Section titled “Examples”Interactive Setup
Section titled “Interactive Setup”# Launch the wizardcoverctl initCI/Script Mode
Section titled “CI/Script Mode”# Skip wizard, use auto-detected valuescoverctl init --no-interactive
# Overwrite existing configcoverctl init --no-interactive --forceCustom Config Path
Section titled “Custom Config Path”# Write to custom locationcoverctl init -c custom-config.yamlDomain Detection
Section titled “Domain Detection”The wizard automatically detects domains based on your project structure:
| Directory | Detected Domain |
|---|---|
cmd/ | Command-line entry points |
internal/core/ | Core business logic |
internal/api/ | API layer |
internal/infrastructure/ | Infrastructure adapters |
pkg/ | Public packages |
Directories named generated, mocks, or testdata are automatically excluded.
Generated Config
Section titled “Generated Config”After running init, you’ll have a .coverctl.yaml file:
version: 1policy: default: min: 75 domains: - name: core match: ["./internal/core/..."] min: 85 - name: api match: ["./internal/api/..."] min: 80 - name: cli match: ["./cmd/..."] min: 75exclude: - "**/generated/**" - "**/mocks/**"Related Commands
Section titled “Related Commands”detect
Section titled “detect”For non-interactive domain detection:
# Preview detected domainscoverctl detect --dry-run
# Write config directlycoverctl detectSee Also
Section titled “See Also”- Configuration - Configuration reference
- Domains - Domain configuration