Skip to content

The design language that makes your AI harness better at design.

JavaScript

Fix seed design coverage

Paul Bakausc91047d66ab1
diff --git a/skill/scripts/lib/staleness-deep.mjs b/skill/scripts/lib/staleness-deep.mjs
index 8981b654a..53beb1b4b 100644
--- a/skill/scripts/lib/staleness-deep.mjs
+++ b/skill/scripts/lib/staleness-deep.mjs
@@ -129,6 +129,9 @@ function hasCoverageValue(value) {
return false;
}
+const SEED_DESIGN_MARKER = '<!-- SEED: established with the user before implementation; '
+ + "re-run /impeccable document once there's code to capture the actual tokens and components. -->";
+
export function checkDesignCoverage({ design, designPath, parseDesignMd }) {
if (!design || typeof parseDesignMd !== 'function') return [];
let model;
@@ -137,7 +140,10 @@ export function checkDesignCoverage({ design, designPath, parseDesignMd }) {
} catch {
return [];
}
- const missing = ['colors', 'typography', 'components']
+ const requiredSections = design.includes(SEED_DESIGN_MARKER)
+ ? ['colors', 'typography']
+ : ['colors', 'typography', 'components'];
+ const missing = requiredSections
.filter((section) => !model[section] && !hasCoverageValue(model.frontmatter?.[section]));
if (!missing.length) return [];
return [finding({
diff --git a/tests/doctor.test.mjs b/tests/doctor.test.mjs
index fbd9db19d..2063da2c3 100644
--- a/tests/doctor.test.mjs
+++ b/tests/doctor.test.mjs
@@ -172,6 +172,34 @@ describe('checkDesignCoverage', () => {
assert.deepEqual(checkDesignCoverage({ design, designPath: 'DESIGN.md', parseDesignMd }), []);
});
+ it('allows Components to be absent from a marked seed document', () => {
+ const design = [
+ '<!-- SEED: established with the user before implementation; re-run /impeccable document once there\'s code to capture the actual tokens and components. -->',
+ '',
+ '# Design System: X',
+ '',
+ '## Colors', '', '### Primary', '- **Ink** (#111): Text.', '',
+ '## Typography', '', '**Body Font:** Inter', '',
+ '### Hierarchy', '- **Body** (400, 16px, 1.5): Paragraphs.', '',
+ ].join('\n');
+ assert.deepEqual(checkDesignCoverage({ design, designPath: 'DESIGN.md', parseDesignMd }), []);
+ });
+
+ it('still requires seed documents to cover Colors and Typography', () => {
+ const design = [
+ '<!-- SEED: established with the user before implementation; re-run /impeccable document once there\'s code to capture the actual tokens and components. -->',
+ '',
+ '# Design System: X',
+ '',
+ '## Typography', '', '**Body Font:** Inter', '',
+ '### Hierarchy', '- **Body** (400, 16px, 1.5): Paragraphs.', '',
+ ].join('\n');
+ const findings = checkDesignCoverage({ design, designPath: 'DESIGN.md', parseDesignMd });
+ assert.deepEqual(ids(findings), ['design-md-coverage']);
+ assert.match(findings[0].summary, /no colors section/);
+ assert.doesNotMatch(findings[0].summary, /components/);
+ });
+
it('counts machine-readable frontmatter as section coverage', () => {
const design = [
'---',