Coverage Baseline
Role: worker. Captures the true baseline coverage of the repo after cannot-fail tests have been disabled so the floor isn't inflated by tautologies.
You have been invoked with the /coverage-baseline command.
Parse Arguments
Arguments: $ARGUMENTS
- Positional:
<repo-path>. --parent <issue-url>— parent issue URL on the resolved tracker (or empty for local-files mode).--repo-slug <slug>— namespace under.claude/memory/<workflow>/.--workflow <name>— the workflow namespace under.claude/memory/. Defaults totest-improve. Orchestrators pass their own namespace (e.g./test-improvepassestest-improvefor its Phase-2 baseline).
If <repo-path> is absent, ask the operator.
Steps
1. Detect the coverage tool
Read the build manifest at the repo root and pick the appropriate command:
| Manifest | Default coverage command |
|---|---|
| package.json (JS/TS) | npm test -- --coverage (or pnpm test --coverage, yarn test --coverage) — or, when a workspace signal is present (a root workspaces field, pnpm-workspace.yaml, or lerna.json), multi-project discovery (see Step 1a) |
| pyproject.toml / setup.py | pytest --cov=. --cov-report=json |
| pom.xml | mvn test jacoco:report — or, when the root pom.xml declares <modules>, multi-project discovery (see Step 1a) |
| build.gradle* | ./gradlew test jacocoTestReport — or, when settings.gradle/settings.gradle.kts declares include(...), multi-project discovery (see Step 1a) |
| *.csproj | dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=json — or, when a .sln is present at the repo root, multi-project discovery (see Step 1a) |
| Cargo.toml | cargo llvm-cov --json |
| go.mod | go test -coverprofile=coverage.out ./... + go tool cover -func=coverage.out |
If the repo has its own coverage script (e.g. npm run coverage, make coverage), prefer that — detect via package.json#scripts.coverage, the Makefile, or a documented run target in README.md. If detection is ambiguous, ask the operator for the exact command. This override does not apply to the .sln/.csproj, pom.xml, or build.gradle* rows above — each of those rows' discovery scripts always re-derives the project/module list itself, per-run, regardless of any repo-level coverage script.
1a. Multi-project discovery (.NET solutions, JS/TS workspaces & Java multi-module builds)
Replaces the single frozen coverage command above for a multi-project .NET
solution, JS/TS workspace, or Java multi-module build — closing the gap where
a hand-picked,
never-revisited inclusion list caused a real coverage delta to be
underreported (issue #1759). Implementation detail — the discovery,
bootstrap/drift-check, weighted-merge, and persist mechanics below: