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 from your project layout. Match patterns follow the detected language: path globs (src/api/**) for most stacks, Go package paths (./internal/api/...) when go.mod is present.

Directory Detected Domain
cmd/ Command-line entry points
internal/core/ Core business logic
internal/api/ API layer
internal/infrastructure/ Infrastructure adapters
pkg/ Public packages

For Python, TypeScript, Rust, and others, detection proposes src/**-style globs. Preview with coverctl detect --dry-run. Directories named generated, mocks, or testdata are automatically excluded.

After running init, you’ll have a .coverctl.yaml file. Example for a TypeScript / Python-style tree (Go uses ./internal/... instead):

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

More language examples: Quick start.

Code Meaning
0 Config written (or validated) successfully
1 Detection / write failure
2 Usage / flag error (e.g. config exists without --force)

Related