Skip to content
Back to archipelago.banuacoder.com

DevTools

coverage_manager Pro ​

Tier
Proversion 1.0.7
Command
archipelago generate coverage_manager
Generates
  • devtools/scripts/coverage_manager
Depends on
monorepo_toolkitgenerate these first

Test coverage pipeline with configurable thresholds and exclusions. Adds the coverage command (init/run/combine/check/full) to the base monorepo_toolkit.

What it is / when to use it ​

A devtools CLI script (no DI, no app UI) — it registers a CoverageCommand with 5 subcommands in monorepo_toolkit's command_runner.dart, backed by a CoverageService that runs flutter test --coverage per package, merges the resulting lcov.info reports, and fails CI when combined coverage drops below a configured threshold. Requires the base monorepo_toolkit brick first.

Variables ​

VariableTypeDefaultDescription
appNamestringMyAppThe name of your application
isForMonorepobooleantrueWhether this is being generated as part of a monorepo

Usage ​

Interactive ​

bash
archipelago generate coverage_manager

Non-interactive (CI) ​

bash
archipelago generate coverage_manager --config my_config.json

Config Template ​

json
{
  "@appName": "The name of your application",
  "appName": "MyApp",
  "@isForMonorepo": "Whether this is being generated as part of a monorepo",
  "isForMonorepo": true
}

Generated Structure ​

text
devtools/
└── scripts/
    └── coverage_manager/
        ├── lib/
        │   ├── coverage_manager.dart
        │   └── src/
        │       ├── commands/
        │       │   ├── check_command.dart       # coverage check — verify thresholds
        │       │   ├── combine_command.dart     # coverage combine — merge lcov reports
        │       │   ├── coverage_command.dart    # Parent `coverage` command, registers subcommands
        │       │   ├── full_command.dart        # coverage full — run + combine + check
        │       │   ├── init_command.dart        # coverage init — write coverage.yaml template
        │       │   └── run_command.dart         # coverage run — run tests with coverage
        │       ├── models/
        │       │   └── coverage_config.dart
        │       └── services/
        │           └── coverage_service.dart
        └── pubspec.yaml

CLI Usage ​

bash
# Create a coverage.yaml config template at the workspace root
dart run monorepo_toolkit coverage init

# Run tests with coverage, optionally scoped to one package
dart run monorepo_toolkit coverage run --concurrency 4 --package features/auth/auth_impl

# Merge per-package lcov reports into one file
dart run monorepo_toolkit coverage combine --output coverage/lcov.info

# Verify combined coverage against coverage.yaml thresholds
dart run monorepo_toolkit coverage check

# Run + combine + check in one step (what CI typically calls)
dart run monorepo_toolkit coverage full --concurrency 4 --fail-fast

run and full both default --fail-fast to true and accept --concurrency/-j (default 1) for parallel per-package test execution.

How It Works ​

The post-generation hook:

  1. Adds the coverage_manager package to the workspace pubspec.yaml
  2. Adds the dependency to monorepo_toolkit's pubspec.yaml
  3. Injects CoverageCommand into command_runner.dart at the // --- Pro Commands --- marker

Dependencies ​

  • monorepo_toolkit — must be generated first.
  • shared_scripts — provides MonorepoFinder, CliLogger.

Changelog ​

Run archipelago brick info coverage_manager to see the latest published version. Enterprise customers can read the full CHANGELOG.md in the brick source repository.