io.github.felixgeelhaar/coverctl

编码与调试

by felixgeelhaar

面向 Go 代码覆盖率分析的工具,结合 MCP server 支持 AI-powered coverage workflows。

什么是 io.github.felixgeelhaar/coverctl

面向 Go 代码覆盖率分析的工具,结合 MCP server 支持 AI-powered coverage workflows。

README

coverctl

Declarative, domain-aware coverage enforcement for any language Supports 15 languages including Go, Python, TypeScript/JavaScript, Java, Rust, C#, C/C++, PHP, Ruby, Swift, Dart, Scala, Elixir, and Shell. Built with strict Domain-Driven Design layers, TDD-first validation, and automated releases powered by Relicta v2.6.1.

Multi-Language coverage releases

Overview

coverctl enforces domain-aware coverage policies across multiple languages. It auto-detects your project's language and parses coverage profiles from various formats (Go cover profiles, LCOV, Cobertura, JaCoCo), so coverage policy failures surface at the domain level, not just the module level. It autodetects domains, emits human-readable and JSON reports, surfaces warnings when files overlap multiple domains, and keeps builds consistently above target coverage.

Supported Languages

LanguageCoverage FormatAuto-Detection
GoNative go test -covergo.mod, go.sum
PythonCobertura, LCOVpyproject.toml, setup.py, requirements.txt
TypeScript/JavaScriptLCOVtsconfig.json, package.json
JavaJaCoCo, Coberturapom.xml, build.gradle
RustLCOV (cargo-llvm-cov)Cargo.toml
C#/.NETCobertura (coverlet)*.csproj, *.sln, Directory.Build.props
C/C++LCOV (gcov/lcov)CMakeLists.txt, meson.build
PHPCobertura (PHPUnit)composer.json, phpunit.xml
RubyLCOV (SimpleCov)Gemfile, Rakefile
SwiftLCOV (llvm-cov)Package.swift
DartLCOV (dart test)pubspec.yaml
ScalaCobertura (scoverage)build.sbt
ElixirLCOV (mix test)mix.exs
ShellCobertura (kcov).bats files

Getting started

bash
# Install
go install github.com/felixgeelhaar/coverctl@latest

# Initialize in any project (Go, Python, TypeScript, Java, or Rust)
cd your-project
coverctl init                               # runs an interactive wizard, auto-detects language
coverctl detect --dry-run                   # preview detected domains without writing config
coverctl check                              # enforce policy, add -o json for automation
coverctl watch                              # continuous coverage feedback during development

CLI reference

CommandWhat it doesNotes
coverctl initAutodetect domains and launch the Bubble Tea wizard before writing .coverctl.yamlNavigate with ↑/↓, adjust thresholds with ←/→ or +/-, and confirm to persist. Pass --no-interactive to skip the UI in scripts.
coverctl detectAutodetect domains and write configWrites config by default; use --dry-run to preview without writing. Pass --force to overwrite existing config.
coverctl checkRun coverage, aggregate domains, enforce policy-o json emits machine-readable results; exit code 1 signals policy violations. Use --show-delta to display coverage changes. Supports --fail-under N, --ratchet, and --from-profile.
coverctl runProduce coverage artifacts without evaluating policyUse --profile to customize output path.
coverctl watchWatch for file changes and re-run coverageContinuous coverage feedback during development.
coverctl reportEvaluate an already generated profileConsumes the same config + domains; ideal for CI artifacts or debugging. Supports -o html, --uncovered, --diff <ref>, and --merge <profile>.
coverctl ignoreShow configured exclude patterns and the tracked domainsUse this to document generated folders (e.g., internal/generated/proto/...) that you wish to skip.
coverctl badgeGenerate an SVG coverage badgeUse --style flat-square for a different style. Output to coverage.svg by default.
coverctl trendShow coverage trends over timeRequires history data recorded via coverctl record.
coverctl recordRecord current coverage to historyUse with --commit and --branch for CI integration. Use --run or profiles from coverctl run/coverctl check so history matches instrumentation.
coverctl suggestSuggest optimal coverage thresholdsStrategies: current, aggressive, conservative. Use --write-config to apply.
coverctl debtShow coverage debt reportIdentifies domains/files below target and estimates remediation effort.
coverctl mcp serveStart MCP server for AI agentsEnables Claude and other AI agents to interact with coverage tools programmatically via STDIO.

Text output (the default) shows domain coverage, required thresholds, and statuses. JSON adds warnings for overlap detection and is suitable for dashboards when you pass -o json. HTML output (-o html) generates a visual report with coverage percentages and status indicators. Use coverctl ignore to review the exclude list, which is how generated folders such as proto artifacts can be omitted before running coverctl check.

Note: coverctl check --from-profile skips running tests but still runs policy evaluation on every configured domain, so reused profiles that already fall below a domain's min will continue to fail until you regenerate them, relax thresholds, scope domains, or adjust domain matches.

Init wizard

coverctl init now launches a short Bubble Tea wizard that reviews the detected domains, lets you adjust coverage minima with arrow keys or +/- shortcuts, and confirms the policy before persisting .coverctl.yaml. Use --no-interactive when you need to run the command in CI or scripted workflows and you just want to write the autodetected configuration.

Build/test flags

The check, run, and watch commands support common test flags for customizing test execution. For Go projects:

FlagDescriptionExample
--tagsBuild tags--tags integration,e2e
--raceEnable race detector--race
--shortSkip long-running tests--short
-vVerbose test output-v
--runRun only tests matching pattern--run TestFoo
--timeoutTest timeout--timeout 30m
--test-argAdditional go test argument (repeatable)--test-arg=-count=1

Examples:

bash
# Run integration tests with build tag
coverctl check --tags integration

# Run with race detector and extended timeout
coverctl check --race --timeout 30m

# Run specific tests with verbose output
coverctl run --run TestMyFunction -v

# Pass multiple extra arguments to go test
coverctl check --test-arg=-count=1 --test-arg=-parallel=4

Coverage policy

coverctl check parses coverage profiles (Go, LCOV, Cobertura, JaCoCo) and assigns statements to the domains defined in .coverctl.yaml. Because raw coverage output often aggregates everything—including helpers, generated files, and adapters you may already exclude—the percentage it reports is not used directly. The policy enforces coverage thresholds only within the scoped domains, so staying focused there while keeping generated folders listed in exclude prevents quality from falling through the cracks.

Configuration

The schema lives in schemas/coverctl.schema.json. Configs are versioned; set version: 1 today and keep it in place so future schema upgrades can be detected safely. A policy looks like:

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

The autodetect command covers cmd/, pkg/, and directories inside internal/, skipping generated/mocks.

Advanced options you can enable as needed:

yaml
version: 1
files:
  - match: ["internal/core/*.go"]
    min: 90
diff:
  enabled: true
  base: origin/main
integration:
  enabled: true
  packages: ["./internal/integration/..."]
  run_args: ["-test.run", "TestIntegration"]
  cover_dir: ".cover/integration"
  profile: ".cover/integration.out"
merge:
  profiles: [".cover/unit.out", ".cover/integration.out"]
annotations:
  enabled: true
  • files enforces per-file minima for any matching paths.
  • diff enforces coverage only on files changed since the base ref.
  • integration builds go test -c binaries and runs them with GOCOVERDIR (Go 1.20+).
  • merge combines multiple coverprofiles into a single policy evaluation.
  • annotations enables // coverctl:ignore and // coverctl:domain=NAME pragmas.

Need a starting point? Copy templates/coverctl.yaml and adjust domains and thresholds to fit your repo.

MCP Server (AI Agent Integration)

coverctl includes a Model Context Protocol (MCP) server that enables AI agents like Claude to interact with coverage tools programmatically. Start it with:

bash
coverctl mcp serve

Available Tools

ToolDescription
checkRun coverage tests and enforce policy thresholds
reportAnalyze an existing coverage profile
recordRecord current coverage to history

Available Resources

URIDescription
coverctl://debtCoverage debt metrics
coverctl://trendCoverage trends over time
coverctl://suggestThreshold recommendations
coverctl://configCurrent configuration

Claude Desktop Configuration

Add to ~/.config/claude/claude_desktop_config.json (macOS/Linux) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

json
{
  "mcpServers": {
    "coverctl": {
      "command": "coverctl",
      "args": ["mcp", "serve"],
      "cwd": "/path/to/your/go/project"
    }
  }
}

Once configured, Claude can run coverage checks, analyze reports, and provide recommendations based on your project's coverage data.

Architecture

  • internal/domain: coverage stats, policy evaluation, warning aggregation.
  • internal/application: services (check, run, report, detect) orchestrate config loading, domain resolution, coverage runs, and reporting.
  • internal/infrastructure: adapters for config files, Go tooling (go test), profile parsing, reporters, and autodetection.
  • internal/cli: CLI parsing, output, and wiring for the root command entrypoint.
  • main.go: root entrypoint so go install github.com/felixgeelhaar/coverctl@latest works. (The cmd/coverctl wrapper remains for compatibility.)

Testing & contribution guidelines

  • Practice TDD: add or update tests before implementing behavior changes.
  • Keep test coverage ≥80% using go test ./... -cover.
  • Follow Conventional Commits (feat:, fix:, etc.) for Relicta’s version bump logic.
  • main is protected: merge via PRs after CI passes (see .github/workflows/go.yml). This keeps the release workflow deterministic and reviewable.
  • Pull requests that touch reporting should document CLI output or sample JSON to keep churn visible.

Releases

  • Relicta v2.6.1 (relicta.config.yaml) drives releases: it creates semver tags, updates CHANGELOG.md, and publishes GitHub releases.
  • .github/workflows/release.yml triggers relicta release --yes on protected main (after each merge). The Relicta pre_release_hook runs scripts/build-artifacts.sh to compile Linux/macOS/Windows CLI tarballs/zips that the GitHub plugin attaches as release assets.
  • Configure a secret named RELICTA_TOKEN (or rely on ${{ secrets.GITHUB_TOKEN }}) with contents/workflows/packages permissions so Relicta can push tags, update the changelog, and attach artifacts.
  • Do not manually push v* tags; let Relicta own the tag lifecycle to avoid conflicts.

GitHub Action

Use the built-in composite action to run coverctl in CI:

yaml
jobs:
  coverage:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-go@v6
        with:
          go-version: "1.25"
      - uses: ./.github/actions/coverctl
        with:
          command: check
          config: .coverctl.yaml
          output: text

Security Scan (SARIF)

Run nox in GitHub Actions and upload SARIF results:

yaml
jobs:
  security:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      security-events: write
    steps:
      - uses: actions/checkout@v6
      - name: Install nox
        run: |
          curl -sL https://github.com/nox-hq/nox/releases/download/v0.7.0/nox_0.7.0_linux_amd64.tar.gz | tar xz -C /usr/local/bin nox
      - name: Run nox (SARIF)
        run: nox -format sarif -output . scan . || true
      - name: Upload SARIF
        uses: github/codeql-action/upload-sarif@v4
        with:
          sarif_file: results.sarif

Multi-Language Support

coverctl is a universal coverage enforcement platform supporting multiple languages out of the box. For design details, see:

Language Support Status

LanguageFormatStatus
GoNative coverage profile✅ Supported
PythonLCOV, Cobertura✅ Supported
TypeScript/JavaScriptLCOV✅ Supported
JavaCobertura, JaCoCo✅ Supported
RustLCOV (cargo-llvm-cov)✅ Supported
C#/.NETCobertura (coverlet)✅ Supported
C/C++LCOV (gcov/lcov)✅ Supported
PHPCobertura (PHPUnit)✅ Supported
RubyLCOV (SimpleCov)✅ Supported
SwiftLCOV (llvm-cov)✅ Supported
DartLCOV (dart test)✅ Supported
ScalaCobertura (scoverage)✅ Supported
ElixirLCOV (mix test)✅ Supported
ShellCobertura (kcov)✅ Supported

Usage with Different Languages

coverctl auto-detects your project language, or you can specify it explicitly:

bash
# Auto-detect (recommended)
coverctl check

# Explicit language
coverctl check --language python --profile coverage.xml

# Explicit format
coverctl report --format lcov --profile coverage/lcov.info

Claude Code Plugin

coverctl is available as a Claude Code plugin for AI-assisted coverage enforcement:

bash
/plugin install coverctl
/coverctl:check
/coverctl:suggest

Docs & governance

  • Product/architecture docs live under docs/design/ (TDD/PRD). AGENTS.md covers contributor expectations.
  • The scripts/build-artifacts.sh helper compiles cross-platform binaries for release artifacts.
  • Keep CHANGELOG.md tracked so Relicta can automatically append release notes during relicta release.

常见问题

io.github.felixgeelhaar/coverctl 是什么?

面向 Go 代码覆盖率分析的工具,结合 MCP server 支持 AI-powered coverage workflows。

相关 Skills

网页构建器

by anthropics

Universal
热门

面向复杂 claude.ai HTML artifact 开发,快速初始化 React + Tailwind CSS + shadcn/ui 项目并打包为单文件 HTML,适合需要状态管理、路由或多组件交互的页面。

在 claude.ai 里做复杂网页 Artifact 很省心,多组件、状态和路由都能顺手搭起来,React、Tailwind 与 shadcn/ui 组合效率高、成品也更精致。

编码与调试
未扫描123.0k

前端设计

by anthropics

Universal
热门

面向组件、页面、海报和 Web 应用开发,按鲜明视觉方向生成可直接落地的前端代码与高质感 UI,适合做 landing page、Dashboard 或美化现有界面,避开千篇一律的 AI 审美。

想把页面做得既能上线又有设计感,就用前端设计:组件到整站都能产出,难得的是能避开千篇一律的 AI 味。

编码与调试
未扫描123.0k

网页应用测试

by anthropics

Universal
热门

用 Playwright 为本地 Web 应用编写自动化测试,支持启动开发服务器、校验前端交互、排查 UI 异常、抓取截图与浏览器日志,适合调试动态页面和回归验证。

借助 Playwright 一站式验证本地 Web 应用前端功能,调 UI 时还能同步查看日志和截图,定位问题更快。

编码与调试
未扫描123.0k

相关 MCP Server

GitHub

编辑精选

by GitHub

热门

GitHub 是 MCP 官方参考服务器,让 Claude 直接读写你的代码仓库和 Issues。

这个参考服务器解决了开发者想让 AI 安全访问 GitHub 数据的问题,适合需要自动化代码审查或 Issue 管理的团队。但注意它只是参考实现,生产环境得自己加固安全。

编码与调试
84.2k

by Context7

热门

Context7 是实时拉取最新文档和代码示例的智能助手,让你告别过时资料。

它能解决开发者查找文档时信息滞后的问题,特别适合快速上手新库或跟进更新。不过,依赖外部源可能导致偶尔的数据延迟,建议结合官方文档使用。

编码与调试
53.3k

by tldraw

热门

tldraw 是让 AI 助手直接在无限画布上绘图和协作的 MCP 服务器。

这解决了 AI 只能输出文本、无法视觉化协作的痛点——想象让 Claude 帮你画流程图或白板讨论。最适合需要快速原型设计或头脑风暴的开发者。不过,目前它只是个基础连接器,你得自己搭建画布应用才能发挥全部潜力。

编码与调试
46.4k

评论