Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(design-system): DS-10 间距报告纳入任意 margin 与多值裸值
Kirozeng12987f2c9205
diff --git a/scripts/__tests__/hardcoded-color-audit.test.mjs b/scripts/__tests__/hardcoded-color-audit.test.mjsindex c08625a891..f67d51c627 100644--- a/scripts/__tests__/hardcoded-color-audit.test.mjs+++ b/scripts/__tests__/hardcoded-color-audit.test.mjs@@ -152,6 +152,15 @@ test('spacing reports distinguish real generated references, unknown variables a['gap-[calc(var(--space-4)-var(--space-2))]', 'spacing-expression'],['p-[var(--space-4,var(--missing))]', 'unknown-spacing-reference'],['p-[env(safe-area-inset-top)]', 'unclassified-spacing'],+ ['p-[calc(100%-4px)]', 'unclassified-spacing'],+ ['mt-[var(--space-4)]', 'spacing-source-reference'],+ ['ms-[var(--space-4,initial)]', 'mixed-spacing-expression'],+ ['mt-[3px]', 'literal-spacing'],+ ['mx-[7px]', 'literal-spacing'],+ ['me-[13px]', 'literal-spacing'],+ ['p-[14px_16px]', 'literal-spacing'],+ ['px-[8px_12px]', 'literal-spacing'],+ ['p-[-14px_-16px]', 'literal-spacing'],]) {const source = `<div className="${value}" />`;const [hit] = inspect(file, source);@@ -163,7 +172,7 @@ test('spacing reports distinguish real generated references, unknown variables aassert.match(hit.suggestion, /foundations.spacing/);assert.doesNotMatch(hit.suggestion, /radius overrides/);}- for (const value of ['p-4', 'gap-x-2', 'gap-y-2', 'gapx-[13px]', 'gapy-[13px]']) {+ for (const value of ['p-4', 'm-4', 'mt-2', 'gap-x-2', 'gap-y-2', 'gapx-[13px]', 'gapy-[13px]']) {assert.deepEqual(inspect(file, `<div className="${value}" />`), [], value);}const source = '// gap-x-[13px]\n<div className="gap-x-[13px]" />\n<div className="p-[var(--space-4)]" />';diff --git a/scripts/shared/design-layer-report.mjs b/scripts/shared/design-layer-report.mjsindex 3680071159..7306d6991c 100644--- a/scripts/shared/design-layer-report.mjs+++ b/scripts/shared/design-layer-report.mjs@@ -63,7 +63,10 @@ function classifySpacing(value, spacingVariables = getSpacingVariables()) {reason: mixed ? 'Combines spacing references with literal values (including fallbacks); review each literal and the component role.': 'Derived spacing expression; verify the calculation and component role. References do not approve the whole expression.' };}- return { classification: /^-?(?:\d*\.)?\d+(?:px|rem|em|%|vh|vw)?$/.test(expression) ? 'literal-spacing' : 'unclassified-spacing',+ // Tailwind writes spaces in arbitrary values as underscores: a bare value+ // may be a list (p-[14px_16px]). Every item must be a literal on its own.+ const literal = /^-?(?:\d*\.)?\d+(?:px|rem|em|%|vh|vw)?$/;+ return { classification: expression.split('_').every(part => literal.test(part)) ? 'literal-spacing' : 'unclassified-spacing',reason: 'No verified spacing source reference; use the matching standard spacing class or document the component-specific geometry.' };}@@ -86,7 +89,7 @@ export function classifyDesignLayer({ member, layer, radius, evidence = false })export function reportDesignLayers(file, source, changed, locate, spacingVariables) {const findings = [];- const patterns = /\brounded(?:-(?:\[[^\]\n]+\]|[\w-]+))?|\bborder(?:-radius|Radius)\s*:\s*[^;,}\n]+|\b(?:p[xytrblse]?|gap(?:-[xy])?)-\[[^\]\n]+\]/g;+ const patterns = /\brounded(?:-(?:\[[^\]\n]+\]|[\w-]+))?|\bborder(?:-radius|Radius)\s*:\s*[^;,}\n]+|\b(?:[pm][xytrblse]?|gap(?:-[xy])?)-\[[^\]\n]+\]/g;for (const match of source.matchAll(patterns)) {const pos = locate(match.index);if (!changed.has(pos.line)) continue;@@ -110,7 +113,7 @@ export function reportDesignLayers(file, source, changed, locate, spacingVariablvalue: match[0], disposition: 'report', ...judgement,suggestion: isRadius? 'Review the visible frame, contained mark and hit/indicator layers separately against DESIGN §5 and governance §13; register missing evidence/decisions. Do not change user radius overrides.'- : 'Use the existing p/px/py/gap/gap-x/gap-y scale from desktop-bindings.json foundations.spacing and the component treatment in DESIGN §4/5. Verify unknown variables, calculations and fallbacks; do not infer button padding from a DOM tag.' });+ : 'Use the existing p/px/py, m/mx/my and gap/gap-x/gap-y scales from desktop-bindings.json foundations.spacing and the component treatment in DESIGN §4/5. Verify unknown variables, calculations and fallbacks; do not infer button spacing from a DOM tag.' });}if (/components\/settings\/.*(?:Dialog|Wizard)\.tsx$/.test(file) && changed.size) {findings.push({ file, line: Math.min(...changed), column: 1, rule: 'form-adoption', disposition: 'report',