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.
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 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.
Go layout heuristics (when applicable)
Section titled “Go layout heuristics (when applicable)”| 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.
Generated Config
Section titled “Generated Config”After running init, you’ll have a .coverctl.yaml file. Example for a
TypeScript / Python-style tree (Go uses ./internal/... instead):
version: 1policy: default: min: 75 domains: - name: core match: ["src/core/**"] min: 85 - name: api match: ["src/api/**"] min: 80exclude: - "**/generated/**" - "**/mocks/**"More language examples: Quick start.
Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
0 |
Config written (or validated) successfully |
1 |
Detection / write failure |
2 |
Usage / flag error (e.g. config exists without --force) |