feat: improve lightweight AI generation guard

This commit is contained in:
shkim4 committed 2026-10-08 20:32:15 +09:00
1 parent c86d12bebc
commit 4daca6d357
7 files changed
+327 -162

No files matched your search

+18 -3
View File
@@ -6,6 +6,8 @@ const root = process.cwd();
const out = path.join(root, 'HMDesignSystem-AI-Reference-Test');
const zip = path.join(root, 'HMDesignSystem-AI-Reference-Test.zip');
// Recursive cleanup is restricted to this script's fixed output directory.
if (path.dirname(path.resolve(out)) !== root || path.basename(out) !== 'HMDesignSystem-AI-Reference-Test') throw new Error('Unsafe package output path');
fs.rmSync(out, { recursive: true, force: true });
fs.rmSync(zip, { force: true });
fs.mkdirSync(out, { recursive: true });
@@ -50,6 +52,17 @@ copy('README.md', 'docs/README.md');
copy('package.json', 'docs/root-package.json');
copy('package-lock.json', 'docs/package-lock.json');
// Executable Guard and its contract sources share the original workspace paths.
// Keep legacy docs locations for existing reference consumers.
copy('AGENTS.md', 'source/AGENTS.md');
copy('docs', 'source/docs');
copy('package.json', 'source/package.json');
copy('package-lock.json', 'source/package-lock.json');
copy('scripts/ai-generation-guard.mjs', 'source/scripts/ai-generation-guard.mjs');
copy('scripts/ai-generation-guard.test.mjs', 'source/scripts/ai-generation-guard.test.mjs');
copy('src', 'source/src');
copy('themes', 'source/themes');
copy('src/exports', 'examples/react-and-html/src/exports');
copy('src/exports/dashboard', 'examples/react-and-html/src/exports/dashboard');
copy('index.html', 'examples/react-and-html/index.html');
@@ -75,13 +88,15 @@ const startHere = `# HM Design System AI Reference
## AI 참조 순서
1. \`docs/AGENTS.md\`와 \`docs/README.md\`를 읽습니다.
2. \`docs/source/components\`, \`docs/source/patterns\`, \`docs/source/guidelines\`에서 사용 규칙을 확인합니다.
3. \`source/packages/ui/src\`와 \`source/packages/center-graphic/src\`의 실제 TSX 구현을 재사용합니다.
1. \`source/AGENTS.md\`의 짧은 필수 규칙부터 읽습니다.
2. \`source/docs/guidelines/component-pattern-reference.md\`에서 필요한 항목만 찾습니다.
3. 선택한 Component/Pattern 문서·공개 API와 대표 Story만 확인합니다. HTML/CSS 모방이나 import만으로 재사용을 주장하지 않습니다.
4. \`storybook/source\`의 Story에서 상태·조합·레이아웃을 확인합니다.
5. \`theme/source\` 및 \`theme/generated\`의 Token/CSS Custom Properties를 사용합니다.
6. \`packages/ui-dist\`와 declarations는 소비자 Export 형태를 확인할 때 사용합니다.
Guard는 \`source/\`에서 \`node scripts/ai-generation-guard.mjs --target <앱> --scope FULL_SCREEN|PARTIAL\`을 1회 실행합니다. PARTIAL은 \`--files\`, 최종 React artifact는 \`--result\`를 전달합니다. parser 의존성이 없으면 NOT VERIFIED로 보고합니다. 개발자가 실행할 때만 기존 lockfile로 의존성을 복원하며, 포터블 Storybook 테스트 사용자에게 npm 설치를 요구하지 않습니다. PASS는 정적 계약만 의미하며 실제 React 브라우저 결과를 별도로 최소 1회 확인합니다.
임의의 색상·spacing·radius·Typography 값을 추가하거나 디자인을 재해석하지 않습니다. 신규 화면은 기존 공개 Component/Pattern과 Theme 계약을 우선 재사용합니다.
## 구조