Lands L2 of the agent-first coverage architecture (ADR-020) — the
aggregated trend store.
Script: scripts/coverage/aggregate.mjs (zero-dep Node ESM)
- discoverLcovs: walks packages/* and apps/* for coverage/lcov.info
- normalizeLcov: rewrites SF entries from package-relative (vitest's
output) to repo-relative, so the merged file matches git diff paths
- summarizeLcov: computes statement/branch/function/line percentages
from LF/LH/BRF/BRH/FNF/FNH summary records
- aggregate: merges all lcovs and returns mergedLcov + summary
- Writes coverage/lcov.info (gitignored — large) and
coverage/summary.json (committed — trend via git log -- ...) with
timestamp, short commit SHA, repo + per-package percentages
Test surface: scripts/coverage/aggregate.test.mjs (10 tests, all green)
- Fixtures at __fixtures__/aggregate-pkg-a.lcov +
aggregate-pkg-b.lcov (synthetic, structured to make percentages
deterministic)
- Covers: path normalization (prefix, absolute, double-prefix
avoidance), summary computation (percentages, zero-division,
rounding), discovery (packages + apps, missing dirs), full
aggregation in a tmp repo
Wired:
- root package.json adds "coverage:aggregate" script
- .gitignore restructured: per-package coverage/ stays ignored,
aggregated /coverage/ ignored EXCEPT summary.json (committed for
trend) and .gitkeep markers
L1 allowlist fix folded in (scripts/coverage/diff.mjs):
- The previous (^|/)coverage/ regex accidentally caught
scripts/coverage/* — replaced with anchored patterns
(^coverage/, ^packages/*/coverage/, ^apps/*/coverage/)
- Allowlist scripts/ and turbo/generators/ since they're dev tooling
tested via node --test, outside vitest's v8 lcov pipeline
Smoke-tested end-to-end:
- pnpm coverage:aggregate merged 3 lcovs (auth + media + navigation
from this session's earlier runs), repo coverage 95.22% statements
- pnpm coverage:diff against HEAD~1 with the new merged lcov reports
PASS — all 6 diff files correctly allowlisted
First committed snapshot of coverage/summary.json lands with this
commit, anchoring the trend history at this state.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
48 lines
1.6 KiB
JSON
48 lines
1.6 KiB
JSON
{
|
|
"name": "template",
|
|
"private": true,
|
|
"packageManager": "pnpm@9.15.4",
|
|
"engines": {
|
|
"node": ">=20"
|
|
},
|
|
"scripts": {
|
|
"build": "turbo run build",
|
|
"dev": "turbo run dev",
|
|
"lint": "turbo run lint",
|
|
"test": "turbo run test",
|
|
"test:e2e": "turbo run test:e2e",
|
|
"test:stories": "turbo run test:stories",
|
|
"test:visual": "pnpm --filter @repo/storybook exec concurrently -k -s first -n 'SB,VRT' -c 'magenta,blue' 'pnpm --filter @repo/storybook exec http-server storybook-static --port 6006 --silent' 'pnpm --filter @repo/storybook exec wait-on tcp:6006 && pnpm exec playwright test'",
|
|
"typecheck": "turbo run typecheck",
|
|
"conformance": "node scripts/conformance.mjs",
|
|
"coverage:diff": "node scripts/coverage/diff.mjs",
|
|
"coverage:aggregate": "node scripts/coverage/aggregate.mjs",
|
|
"fallow": "fallow",
|
|
"fallow:audit": "fallow audit --base main",
|
|
"work": "node scripts/work/cli.mjs",
|
|
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
|
|
"format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,json,md}\"",
|
|
"prepare": "husky"
|
|
},
|
|
"devDependencies": {
|
|
"@ai-hero/sandcastle": "*",
|
|
"@playwright/test": "^1.49.0",
|
|
"@turbo/gen": "^2.4.0",
|
|
"@types/node": "^22.0.0",
|
|
"fallow": "^2.73.0",
|
|
"husky": "^9.0.0",
|
|
"lint-staged": "^16.0.0",
|
|
"prettier": "^3.5.0",
|
|
"turbo": "^2.4.0",
|
|
"typescript": "^5.8.0"
|
|
},
|
|
"lint-staged": {
|
|
"*.{ts,tsx,js,mjs,jsx}": [
|
|
"eslint --fix --max-warnings=0 --no-warn-ignored"
|
|
],
|
|
"*.{ts,tsx,js,mjs,jsx,json,md,yml,yaml}": [
|
|
"prettier --write"
|
|
]
|
|
}
|
|
}
|