Skip to content

coverctl init

The init command launches an interactive wizard to configure coverctl for your project. It auto-detects domains and lets you customize coverage thresholds.

Terminal window
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

The wizard provides a terminal UI built with Bubble Tea:

  1. Domain Detection: Automatically discovers domains from project structure
  2. Threshold Adjustment: Use arrow keys or +/- to adjust coverage minimums
  3. Confirmation: Review and confirm before writing config
Key Action
↑/↓ Move between domains
←/→ Decrease/increase threshold
+/- Adjust threshold by 5%
Enter Confirm and write config
Esc/q Cancel
Terminal window
# Launch the wizard
coverctl init
Terminal window
# Skip wizard, use auto-detected values
coverctl init --no-interactive
# Overwrite existing config
coverctl init --no-interactive --force
Terminal window
# Write to custom location
coverctl init -c custom-config.yaml

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.

After running init, you’ll have a .coverctl.yaml file:

version: 1
policy:
default:
min: 75
domains:
- name: core
match: ["./internal/core/..."]
min: 85
- name: api
match: ["./internal/api/..."]
min: 80
- name: cli
match: ["./cmd/..."]
min: 75
exclude:
- "**/generated/**"
- "**/mocks/**"

For non-interactive domain detection:

Terminal window
# Preview detected domains
coverctl detect --dry-run
# Write config directly
coverctl detect