Skip to content

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

FlagDescriptionDefault
-c, --configConfig file path.coverctl.yaml
-f, --forceOverwrite existing config filefalse
--no-interactiveSkip wizard, write auto-detected configfalse

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
KeyAction
↑/↓Move between domains
←/→Decrease/increase threshold
+/-Adjust threshold by 5%
EnterConfirm and write config
Esc/qCancel
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:

DirectoryDetected 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