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 间距绑定校验拒绝数组与空映射
Kirozeng52cee87640c1
diff --git a/scripts/__tests__/hardcoded-color-audit.test.mjs b/scripts/__tests__/hardcoded-color-audit.test.mjsindex 7a628d2a61..f6c97aae2f 100644--- a/scripts/__tests__/hardcoded-color-audit.test.mjs+++ b/scripts/__tests__/hardcoded-color-audit.test.mjs@@ -233,6 +233,12 @@ test('worktree includes staged, unstaged and untracked source; commit mode exclu// candidates, so the audit itself has to validate the contract it hashes.fs.writeFileSync(path.join(temp,bindings),'{bad json');assert.equal(cli('--base-ref',commit,'--worktree','--report').status,2);+ // Arrays pass typeof checks yet carry no entries, and a mapping without+ // space-* foundations silently degrades every spacing report to unknown.+ fs.writeFileSync(path.join(temp,bindings),'{"foundations":{"css":[]}}');+ assert.equal(cli('--base-ref',commit,'--worktree','--report').status,2);+ fs.writeFileSync(path.join(temp,bindings),'{"foundations":{"css":{"text":"semantic.foundations.text-14"}}}');+ assert.equal(cli('--base-ref',commit,'--worktree','--report').status,2);fs.copyFileSync(path.join(root, bindings), path.join(temp, bindings));fs.appendFileSync(path.join(temp,file), '\nconst spacing = "gap-x-[var(--space-4)]";\n');const reported = cli('--base-ref',commit,'--worktree','--report','--json');diff --git a/scripts/shared/design-layer-report.mjs b/scripts/shared/design-layer-report.mjsindex 27feb67ef9..ff773390c6 100644--- a/scripts/shared/design-layer-report.mjs+++ b/scripts/shared/design-layer-report.mjs@@ -7,13 +7,16 @@ let spacingVariables;export function getSpacingVariables() {if (!spacingVariables) {const { foundations } = JSON.parse(readFileSync(new URL('../../packages/design-tokens/src/desktop-bindings.json', import.meta.url), 'utf8'));- if (!foundations?.css || typeof foundations.css !== 'object') {- throw new Error('Invalid desktop-bindings.json; expected foundations.css spacing bindings');+ if (!foundations?.css || typeof foundations.css !== 'object' || Array.isArray(foundations.css)) {+ throw new Error('Invalid desktop-bindings.json; expected foundations.css as a non-array mapping');}spacingVariables = new Set(Object.entries(foundations.css)// Includes component spacing (space-input-lg), not only Tailwind's scale..filter(([, id]) => id.startsWith('semantic.foundations.space-')).map(([name]) => `--${name}`));+ if (!spacingVariables.size) {+ throw new Error('Invalid desktop-bindings.json; foundations.css has no semantic.foundations.space-* entries');+ }}return spacingVariables;}