Require populated frontmatter coverage

AI assistance: Codex validated and addressed the Greptile review finding with focused regression coverage.
This commit is contained in:
Paul Bakaus
2026-07-30 09:23:37 -07:00
parent a209eeb0bd
commit 7a0489bd91
2 changed files with 32 additions and 1 deletions
+10 -1
View File
@@ -117,6 +117,15 @@ export function checkDesignDrift({ designPath, projectRoot, threshold = 25 }) {
* a section can be absent because it never applied, so this is reported as a
* documentation gap for a human to judge, never as an error.
*/
function hasCoverageValue(value) {
if (Array.isArray(value)) return value.some(hasCoverageValue);
if (value && typeof value === 'object') {
return Object.values(value).some(hasCoverageValue);
}
if (typeof value === 'string') return value.trim().length > 0;
return value !== null && value !== undefined;
}
export function checkDesignCoverage({ design, designPath, parseDesignMd }) {
if (!design || typeof parseDesignMd !== 'function') return [];
let model;
@@ -126,7 +135,7 @@ export function checkDesignCoverage({ design, designPath, parseDesignMd }) {
return [];
}
const missing = ['colors', 'typography', 'components']
.filter((section) => !model[section] && !model.frontmatter?.[section]);
.filter((section) => !model[section] && !hasCoverageValue(model.frontmatter?.[section]));
if (!missing.length) return [];
return [finding({
id: 'design-md-coverage',