Files
msd-core/scripts/check-coverage-gate.cjs
Jakub Zych a9a7a328e6 refactor: hard-fork GSD -> MSD (Make Software Done)
Mechanical rename produced by scripts/msd-rename.cjs: gsd/Gsd/GSD -> msd/Msd/MSD
across contents and paths, upstream package/repo coordinates -> @golem15/msd-core
and golem15com/msd-core. Deep links into upstream history, sibling upstream
packages, the GSD-2 import feature, CHANGELOG.md and .changeset/ are kept as-is.

Hand edits on top: MSD block-letter banner and logos, LICENSE copyright line,
package/plugin identity, regenerated lockfile, install-tree fixtures, derived
registries and benchmark baseline; migration checksum baseline re-locked
(MSD keeps its own install state, so no install had applied the old sums);
sort-order and regex-escaped expectations in tests adjusted.
2026-10-06 01:47:40 +02:00

52 lines
1.4 KiB
JavaScript

#!/usr/bin/env node
'use strict';
const fs = require('fs');
const path = require('path');
const summaryPath = path.join(process.cwd(), 'coverage', 'coverage-summary.json');
if (!fs.existsSync(summaryPath)) {
console.error('check-coverage-gate: coverage/coverage-summary.json not found.');
console.error('Ensure c8 runs with --reporter json-summary before this script.');
process.exitCode = 1;
return;
}
const summary = JSON.parse(fs.readFileSync(summaryPath, 'utf8'));
const errors = [];
const OVERALL_LINES = 70;
const OVERALL_BRANCHES = 60;
const PER_FILE_BRANCHES = 70;
const PER_FILE_FILES = [
'msd-core/bin/lib/state.cjs',
'msd-core/bin/lib/phase.cjs',
'msd-core/bin/lib/verify.cjs',
'msd-core/bin/lib/init.cjs',
];
const overall = summary.total;
if (overall.lines.pct < OVERALL_LINES) {
errors.push(`Overall lines ${overall.lines.pct}% < ${OVERALL_LINES}%`);
}
if (overall.branches.pct < OVERALL_BRANCHES) {
errors.push(`Overall branches ${overall.branches.pct}% < ${OVERALL_BRANCHES}%`);
}
for (const file of PER_FILE_FILES) {
const key = Object.keys(summary).find((k) => k.endsWith(file));
if (!key) {
errors.push(`${file}: not found in coverage summary`);
continue;
}
const pct = summary[key].branches.pct;
if (pct < PER_FILE_BRANCHES) {
errors.push(`${file}: branches ${pct}% < ${PER_FILE_BRANCHES}%`);
}
}
if (errors.length > 0) {
for (const e of errors) console.error(`ERROR: ${e}`);
process.exitCode = 1;
}