agent-skill-kit 3.9.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/global.d.ts +80 -0
- package/.agent/rules/GEMINI.md +210 -0
- package/.agent/rules/autopilot.md +287 -0
- package/.agent/rules/code-rules.md +227 -0
- package/.agent/scripts/audit_workflows.ts +23 -0
- package/.agent/scripts/auto_preview.ts +170 -0
- package/.agent/scripts/checklist.ts +180 -0
- package/.agent/scripts/compile-agents.ts +237 -0
- package/.agent/scripts/fix_skills.ts +49 -0
- package/.agent/scripts/session_manager.ts +222 -0
- package/.agent/scripts/skill-audit.ts +255 -0
- package/.agent/scripts/sync_workflows.ts +54 -0
- package/.agent/scripts/utils/colors.ts +58 -0
- package/.agent/scripts/utils/process-manager.ts +131 -0
- package/.agent/scripts/utils/reporter.ts +192 -0
- package/.agent/scripts/utils/runner.ts +128 -0
- package/.agent/scripts/verify_all.ts +243 -0
- package/.agent/scripts/version-sync.ts +256 -0
- package/.agent/skills/SKILL_INDEX.md +129 -0
- package/.agent/skills/agent-browser/AGENTS.md +728 -0
- package/.agent/skills/agent-browser/SKILL.md +193 -0
- package/.agent/skills/agent-browser/rules/_sections.md +15 -0
- package/.agent/skills/agent-browser/rules/_template.md +32 -0
- package/.agent/skills/agent-browser/rules/engineering-spec.md +528 -0
- package/.agent/skills/agent-browser/scripts/browser_cli.ts +52 -0
- package/.agent/skills/agent-browser/scripts/session_manager.ts +166 -0
- package/.agent/skills/ai-artist/AGENTS.md +1082 -0
- package/.agent/skills/ai-artist/SKILL.md +186 -0
- package/.agent/skills/ai-artist/rules/_sections.md +30 -0
- package/.agent/skills/ai-artist/rules/_template.md +32 -0
- package/.agent/skills/ai-artist/rules/domain-code.md +118 -0
- package/.agent/skills/ai-artist/rules/domain-marketing.md +105 -0
- package/.agent/skills/ai-artist/rules/engineering-spec.md +519 -0
- package/.agent/skills/ai-artist/rules/image-prompts.md +195 -0
- package/.agent/skills/ai-artist/rules/model-syntax.md +115 -0
- package/.agent/skills/ai-artist/scripts/prompt_compiler.ts +72 -0
- package/.agent/skills/ai-artist/templates/image-core.txt +1 -0
- package/.agent/skills/ai-artist/templates/llm-core.txt +6 -0
- package/.agent/skills/api-architect/AGENTS.md +1896 -0
- package/.agent/skills/api-architect/SKILL.md +173 -0
- package/.agent/skills/api-architect/rules/_sections.md +35 -0
- package/.agent/skills/api-architect/rules/_template.md +32 -0
- package/.agent/skills/api-architect/rules/api-style.md +115 -0
- package/.agent/skills/api-architect/rules/auth.md +134 -0
- package/.agent/skills/api-architect/rules/documentation.md +131 -0
- package/.agent/skills/api-architect/rules/engineering-spec.md +505 -0
- package/.agent/skills/api-architect/rules/graphql.md +154 -0
- package/.agent/skills/api-architect/rules/rate-limiting.md +76 -0
- package/.agent/skills/api-architect/rules/response.md +138 -0
- package/.agent/skills/api-architect/rules/rest.md +113 -0
- package/.agent/skills/api-architect/rules/security-testing.md +146 -0
- package/.agent/skills/api-architect/rules/trpc.md +129 -0
- package/.agent/skills/api-architect/rules/versioning.md +100 -0
- package/.agent/skills/api-architect/scripts/api_validator.ts +413 -0
- package/.agent/skills/auth-patterns/AGENTS.md +1830 -0
- package/.agent/skills/auth-patterns/SKILL.md +163 -0
- package/.agent/skills/auth-patterns/rules/_sections.md +30 -0
- package/.agent/skills/auth-patterns/rules/_template.md +32 -0
- package/.agent/skills/auth-patterns/rules/engineering-spec.md +515 -0
- package/.agent/skills/auth-patterns/rules/jwt-deep.md +196 -0
- package/.agent/skills/auth-patterns/rules/mfa.md +174 -0
- package/.agent/skills/auth-patterns/rules/oauth2.md +134 -0
- package/.agent/skills/auth-patterns/rules/passkey.md +243 -0
- package/.agent/skills/auth-patterns/rules/rbac-abac.md +206 -0
- package/.agent/skills/auth-patterns/rules/session.md +183 -0
- package/.agent/skills/auth-patterns/scripts/auth_validator.ts +121 -0
- package/.agent/skills/chrome-devtools/AGENTS.md +952 -0
- package/.agent/skills/chrome-devtools/SKILL.md +160 -0
- package/.agent/skills/chrome-devtools/rules/_sections.md +25 -0
- package/.agent/skills/chrome-devtools/rules/_template.md +32 -0
- package/.agent/skills/chrome-devtools/rules/aria-snapshot.md +95 -0
- package/.agent/skills/chrome-devtools/rules/engineering-spec.md +510 -0
- package/.agent/skills/chrome-devtools/rules/scripts-guide.md +174 -0
- package/.agent/skills/chrome-devtools/scripts/aria-snapshot.ts +3 -0
- package/.agent/skills/chrome-devtools/scripts/click.ts +3 -0
- package/.agent/skills/chrome-devtools/scripts/console.ts +3 -0
- package/.agent/skills/chrome-devtools/scripts/core_cli.ts +79 -0
- package/.agent/skills/chrome-devtools/scripts/evaluate.ts +3 -0
- package/.agent/skills/chrome-devtools/scripts/fill.ts +3 -0
- package/.agent/skills/chrome-devtools/scripts/navigate.ts +3 -0
- package/.agent/skills/chrome-devtools/scripts/network.ts +3 -0
- package/.agent/skills/chrome-devtools/scripts/performance.ts +3 -0
- package/.agent/skills/chrome-devtools/scripts/screenshot.ts +3 -0
- package/.agent/skills/chrome-devtools/scripts/select-ref.ts +3 -0
- package/.agent/skills/cicd-pipeline/AGENTS.md +809 -0
- package/.agent/skills/cicd-pipeline/SKILL.md +164 -0
- package/.agent/skills/cicd-pipeline/rules/_sections.md +15 -0
- package/.agent/skills/cicd-pipeline/rules/_template.md +32 -0
- package/.agent/skills/cicd-pipeline/rules/engineering-spec.md +477 -0
- package/.agent/skills/cicd-pipeline/scripts/flag-manager.ts +253 -0
- package/.agent/skills/cicd-pipeline/scripts/pipeline_validator.ts +133 -0
- package/.agent/skills/code-constitution/AGENTS.md +597 -0
- package/.agent/skills/code-constitution/CHANGELOG.md +216 -0
- package/.agent/skills/code-constitution/SKILL.md +191 -0
- package/.agent/skills/code-constitution/VERSION +3 -0
- package/.agent/skills/code-constitution/examples/violation-backend-mutation/after.tsx +59 -0
- package/.agent/skills/code-constitution/examples/violation-backend-mutation/before.tsx +42 -0
- package/.agent/skills/code-constitution/examples/violation-backend-mutation/explanation.md +91 -0
- package/.agent/skills/code-constitution/examples/violation-chart-injection/after.tsx +99 -0
- package/.agent/skills/code-constitution/examples/violation-chart-injection/before.tsx +57 -0
- package/.agent/skills/code-constitution/examples/violation-chart-injection/explanation.md +120 -0
- package/.agent/skills/code-constitution/knowledge/lessons-learned.yaml +3 -0
- package/.agent/skills/code-constitution/metadata/precedence.yaml +117 -0
- package/.agent/skills/code-constitution/metadata/scope-map.yaml +156 -0
- package/.agent/skills/code-constitution/proposals/v1.1-change-proposal-template.md +201 -0
- package/.agent/skills/code-constitution/resources/AUTHORITY_MODEL.md +115 -0
- package/.agent/skills/code-constitution/resources/ENFORCEMENT_GUIDE.md +246 -0
- package/.agent/skills/code-constitution/resources/LOAD_ORDER.md +86 -0
- package/.agent/skills/code-constitution/rules/_sections.md +15 -0
- package/.agent/skills/code-constitution/rules/_template.md +32 -0
- package/.agent/skills/code-constitution/rules/constitution/master-constitution.md +210 -0
- package/.agent/skills/code-constitution/rules/doctrines/architecture/architecture-doctrine.md +188 -0
- package/.agent/skills/code-constitution/rules/doctrines/backend/backend-data-engine-doctrine.md +218 -0
- package/.agent/skills/code-constitution/rules/doctrines/commercial/commercial-guardrails-doctrine.md +196 -0
- package/.agent/skills/code-constitution/rules/doctrines/data/data-integrity-doctrine.md +202 -0
- package/.agent/skills/code-constitution/rules/doctrines/frontend/frontend-mobile-doctrine.md +169 -0
- package/.agent/skills/code-constitution/rules/doctrines/frontend/interaction-patterns-doctrine.md +176 -0
- package/.agent/skills/code-constitution/rules/doctrines/learning/learning-engine-doctrine.md +192 -0
- package/.agent/skills/code-constitution/rules/doctrines/performance/performance-doctrine.md +180 -0
- package/.agent/skills/code-constitution/rules/doctrines/review/code-review-doctrine.md +174 -0
- package/.agent/skills/code-constitution/rules/enforcement/agents/agent-enforcement-protocol.md +218 -0
- package/.agent/skills/code-constitution/rules/enforcement/agents/agent-system-prompt.md +196 -0
- package/.agent/skills/code-constitution/rules/enforcement/checklists/backend-api-review-checklist.md +131 -0
- package/.agent/skills/code-constitution/rules/enforcement/checklists/chart-component-review-checklist.md +147 -0
- package/.agent/skills/code-constitution/rules/enforcement/checklists/frontend-review-checklist.md +194 -0
- package/.agent/skills/code-constitution/rules/enforcement/playbooks/doctrine-violation-playbook.md +236 -0
- package/.agent/skills/code-constitution/rules/engineering-spec.md +561 -0
- package/.agent/skills/code-constitution/scripts/audit_pr.ts +219 -0
- package/.agent/skills/code-constitution/scripts/check_boundaries.ts +134 -0
- package/.agent/skills/code-constitution/scripts/learn.ts +202 -0
- package/.agent/skills/code-constitution/scripts/validate_doctrine.ts +287 -0
- package/.agent/skills/code-craft/AGENTS.md +803 -0
- package/.agent/skills/code-craft/SKILL.md +170 -0
- package/.agent/skills/code-craft/rules/_sections.md +20 -0
- package/.agent/skills/code-craft/rules/_template.md +32 -0
- package/.agent/skills/code-craft/rules/engineering-spec.md +447 -0
- package/.agent/skills/code-craft/rules/verification-scripts.md +83 -0
- package/.agent/skills/code-craft/scripts/code_quality_checker.ts +193 -0
- package/.agent/skills/code-review/AGENTS.md +1664 -0
- package/.agent/skills/code-review/SKILL.md +152 -0
- package/.agent/skills/code-review/rules/_sections.md +15 -0
- package/.agent/skills/code-review/rules/_template.md +32 -0
- package/.agent/skills/code-review/rules/engineering-spec.md +466 -0
- package/.agent/skills/code-review/scripts/lint_runner.ts +213 -0
- package/.agent/skills/code-review/scripts/type_coverage.ts +118 -0
- package/.agent/skills/context-engineering/AGENTS.md +499 -0
- package/.agent/skills/context-engineering/SKILL.md +147 -0
- package/.agent/skills/context-engineering/rules/_sections.md +15 -0
- package/.agent/skills/context-engineering/rules/_template.md +32 -0
- package/.agent/skills/context-engineering/rules/engineering-spec.md +463 -0
- package/.agent/skills/context-engineering/scripts/context_analyzer.ts +127 -0
- package/.agent/skills/copywriting/AGENTS.md +501 -0
- package/.agent/skills/copywriting/SKILL.md +188 -0
- package/.agent/skills/copywriting/rules/_sections.md +15 -0
- package/.agent/skills/copywriting/rules/_template.md +32 -0
- package/.agent/skills/copywriting/rules/engineering-spec.md +465 -0
- package/.agent/skills/copywriting/scripts/copy_validator.ts +185 -0
- package/.agent/skills/data-modeler/AGENTS.md +814 -0
- package/.agent/skills/data-modeler/SKILL.md +195 -0
- package/.agent/skills/data-modeler/rules/_sections.md +15 -0
- package/.agent/skills/data-modeler/rules/_template.md +32 -0
- package/.agent/skills/data-modeler/rules/database-selection.md +124 -0
- package/.agent/skills/data-modeler/rules/engineering-spec.md +479 -0
- package/.agent/skills/data-modeler/rules/indexing.md +166 -0
- package/.agent/skills/data-modeler/rules/migrations.md +176 -0
- package/.agent/skills/data-modeler/rules/optimization.md +161 -0
- package/.agent/skills/data-modeler/rules/orm-selection.md +155 -0
- package/.agent/skills/data-modeler/rules/schema-design.md +162 -0
- package/.agent/skills/data-modeler/scripts/schema_validator.ts +357 -0
- package/.agent/skills/debug-pro/AGENTS.md +798 -0
- package/.agent/skills/debug-pro/SKILL.md +193 -0
- package/.agent/skills/debug-pro/defense-in-depth/SKILL.md +148 -0
- package/.agent/skills/debug-pro/root-cause-tracing/SKILL.md +196 -0
- package/.agent/skills/debug-pro/root-cause-tracing/find-polluter.sh +63 -0
- package/.agent/skills/debug-pro/rules/_sections.md +15 -0
- package/.agent/skills/debug-pro/rules/_template.md +32 -0
- package/.agent/skills/debug-pro/rules/engineering-spec.md +491 -0
- package/.agent/skills/debug-pro/scripts/debug_verifier.ts +148 -0
- package/.agent/skills/debug-pro/verification-before-completion/SKILL.md +160 -0
- package/.agent/skills/design-system/AGENTS.md +4216 -0
- package/.agent/skills/design-system/SKILL.md +186 -0
- package/.agent/skills/design-system/rules/_sections.md +65 -0
- package/.agent/skills/design-system/rules/_template.md +32 -0
- package/.agent/skills/design-system/rules/animation-guide.md +355 -0
- package/.agent/skills/design-system/rules/color-system.md +335 -0
- package/.agent/skills/design-system/rules/color-systems.md +133 -0
- package/.agent/skills/design-system/rules/decision-trees.md +442 -0
- package/.agent/skills/design-system/rules/design-extraction.md +152 -0
- package/.agent/skills/design-system/rules/engineering-spec.md +484 -0
- package/.agent/skills/design-system/rules/motion-design.md +161 -0
- package/.agent/skills/design-system/rules/motion-graphics.md +330 -0
- package/.agent/skills/design-system/rules/spatial-composition.md +184 -0
- package/.agent/skills/design-system/rules/typography-system.md +369 -0
- package/.agent/skills/design-system/rules/typography.md +124 -0
- package/.agent/skills/design-system/rules/ux-psychology.md +565 -0
- package/.agent/skills/design-system/rules/visual-effects.md +407 -0
- package/.agent/skills/design-system/scripts/accessibility_checker.ts +292 -0
- package/.agent/skills/design-system/scripts/ux_audit.ts +356 -0
- package/.agent/skills/doc-templates/AGENTS.md +820 -0
- package/.agent/skills/doc-templates/SKILL.md +260 -0
- package/.agent/skills/doc-templates/rules/_sections.md +20 -0
- package/.agent/skills/doc-templates/rules/_template.md +32 -0
- package/.agent/skills/doc-templates/rules/doc.md +355 -0
- package/.agent/skills/doc-templates/rules/engineering-spec.md +422 -0
- package/.agent/skills/doc-templates/scripts/editor-server.ts +162 -0
- package/.agent/skills/doc-templates/scripts/inject_otel.ts +22 -0
- package/.agent/skills/doc-templates/scripts/kanban-server.ts +171 -0
- package/.agent/skills/doc-templates/scripts/markdown-server.ts +185 -0
- package/.agent/skills/e2e-automation/AGENTS.md +882 -0
- package/.agent/skills/e2e-automation/SKILL.md +175 -0
- package/.agent/skills/e2e-automation/rules/_sections.md +20 -0
- package/.agent/skills/e2e-automation/rules/_template.md +32 -0
- package/.agent/skills/e2e-automation/rules/aria-snapshot.md +185 -0
- package/.agent/skills/e2e-automation/rules/engineering-spec.md +501 -0
- package/.agent/skills/e2e-automation/scripts/playwright_runner.ts +208 -0
- package/.agent/skills/execution-reporter/AGENTS.md +419 -0
- package/.agent/skills/execution-reporter/SKILL.md +152 -0
- package/.agent/skills/execution-reporter/rules/_sections.md +15 -0
- package/.agent/skills/execution-reporter/rules/_template.md +32 -0
- package/.agent/skills/execution-reporter/rules/engineering-spec.md +389 -0
- package/.agent/skills/game-development/2d-games/SKILL.md +140 -0
- package/.agent/skills/game-development/3d-games/SKILL.md +156 -0
- package/.agent/skills/game-development/AGENTS.md +783 -0
- package/.agent/skills/game-development/SKILL.md +178 -0
- package/.agent/skills/game-development/game-art/SKILL.md +207 -0
- package/.agent/skills/game-development/game-audio/SKILL.md +211 -0
- package/.agent/skills/game-development/game-design/SKILL.md +151 -0
- package/.agent/skills/game-development/mobile-games/SKILL.md +130 -0
- package/.agent/skills/game-development/multiplayer/SKILL.md +154 -0
- package/.agent/skills/game-development/pc-games/SKILL.md +167 -0
- package/.agent/skills/game-development/rules/_sections.md +15 -0
- package/.agent/skills/game-development/rules/_template.md +32 -0
- package/.agent/skills/game-development/rules/engineering-spec.md +480 -0
- package/.agent/skills/game-development/vr-ar/SKILL.md +144 -0
- package/.agent/skills/game-development/web-games/SKILL.md +173 -0
- package/.agent/skills/git-workflow/AGENTS.md +554 -0
- package/.agent/skills/git-workflow/SKILL.md +181 -0
- package/.agent/skills/git-workflow/rules/_sections.md +15 -0
- package/.agent/skills/git-workflow/rules/_template.md +32 -0
- package/.agent/skills/git-workflow/rules/engineering-spec.md +518 -0
- package/.agent/skills/gitops/AGENTS.md +921 -0
- package/.agent/skills/gitops/SKILL.md +163 -0
- package/.agent/skills/gitops/rules/_sections.md +25 -0
- package/.agent/skills/gitops/rules/_template.md +32 -0
- package/.agent/skills/gitops/rules/argocd-setup.md +148 -0
- package/.agent/skills/gitops/rules/engineering-spec.md +450 -0
- package/.agent/skills/gitops/rules/sync-policies.md +145 -0
- package/.agent/skills/google-adk-python/AGENTS.md +1054 -0
- package/.agent/skills/google-adk-python/SKILL.md +168 -0
- package/.agent/skills/google-adk-python/rules/_sections.md +25 -0
- package/.agent/skills/google-adk-python/rules/_template.md +32 -0
- package/.agent/skills/google-adk-python/rules/deployment.md +138 -0
- package/.agent/skills/google-adk-python/rules/engineering-spec.md +451 -0
- package/.agent/skills/google-adk-python/rules/multi-agent.md +146 -0
- package/.agent/skills/google-adk-python/rules/tools.md +131 -0
- package/.agent/skills/idea-storm/AGENTS.md +995 -0
- package/.agent/skills/idea-storm/SKILL.md +160 -0
- package/.agent/skills/idea-storm/rules/_sections.md +25 -0
- package/.agent/skills/idea-storm/rules/_template.md +32 -0
- package/.agent/skills/idea-storm/rules/architecture-debate.md +122 -0
- package/.agent/skills/idea-storm/rules/dynamic-questioning.md +374 -0
- package/.agent/skills/idea-storm/rules/engineering-spec.md +466 -0
- package/.agent/skills/knowledge-compiler/SKILL.md +320 -0
- package/.agent/skills/knowledge-graph/AGENTS.md +762 -0
- package/.agent/skills/knowledge-graph/SKILL.md +157 -0
- package/.agent/skills/knowledge-graph/rules/_sections.md +15 -0
- package/.agent/skills/knowledge-graph/rules/_template.md +32 -0
- package/.agent/skills/knowledge-graph/rules/engineering-spec.md +439 -0
- package/.agent/skills/knowledge-linter/SKILL.md +217 -0
- package/.agent/skills/lifecycle-orchestrator/AGENTS.md +989 -0
- package/.agent/skills/lifecycle-orchestrator/SKILL.md +169 -0
- package/.agent/skills/lifecycle-orchestrator/rules/_sections.md +15 -0
- package/.agent/skills/lifecycle-orchestrator/rules/_template.md +32 -0
- package/.agent/skills/lifecycle-orchestrator/rules/engineering-spec.md +525 -0
- package/.agent/skills/lifecycle-orchestrator/scripts/state_manager.ts +189 -0
- package/.agent/skills/mcp-builder/AGENTS.md +1653 -0
- package/.agent/skills/mcp-builder/SKILL.md +166 -0
- package/.agent/skills/mcp-builder/rules/_sections.md +40 -0
- package/.agent/skills/mcp-builder/rules/_template.md +32 -0
- package/.agent/skills/mcp-builder/rules/best-practices.md +157 -0
- package/.agent/skills/mcp-builder/rules/design-principles.md +105 -0
- package/.agent/skills/mcp-builder/rules/engineering-spec.md +473 -0
- package/.agent/skills/mcp-builder/rules/evaluation.md +103 -0
- package/.agent/skills/mcp-builder/rules/python-implementation.md +249 -0
- package/.agent/skills/mcp-builder/rules/quickstart.md +111 -0
- package/.agent/skills/mcp-builder/rules/typescript-implementation.md +280 -0
- package/.agent/skills/mcp-management/AGENTS.md +837 -0
- package/.agent/skills/mcp-management/SKILL.md +164 -0
- package/.agent/skills/mcp-management/rules/_sections.md +25 -0
- package/.agent/skills/mcp-management/rules/_template.md +32 -0
- package/.agent/skills/mcp-management/rules/cli-usage.md +146 -0
- package/.agent/skills/mcp-management/rules/engineering-spec.md +501 -0
- package/.agent/skills/mcp-management/rules/protocol.md +159 -0
- package/.agent/skills/media-processing/AGENTS.md +479 -0
- package/.agent/skills/media-processing/SKILL.md +176 -0
- package/.agent/skills/media-processing/rules/_sections.md +15 -0
- package/.agent/skills/media-processing/rules/_template.md +32 -0
- package/.agent/skills/media-processing/rules/engineering-spec.md +452 -0
- package/.agent/skills/media-processing/scripts/convert-video.ts +155 -0
- package/.agent/skills/media-processing/scripts/optimize-image.ts +127 -0
- package/.agent/skills/mobile-design/AGENTS.md +6531 -0
- package/.agent/skills/mobile-design/SKILL.md +165 -0
- package/.agent/skills/mobile-design/rules/_sections.md +45 -0
- package/.agent/skills/mobile-design/rules/_template.md +32 -0
- package/.agent/skills/mobile-design/rules/decision-trees.md +540 -0
- package/.agent/skills/mobile-design/rules/engineering-spec.md +467 -0
- package/.agent/skills/mobile-design/rules/mobile-backend.md +516 -0
- package/.agent/skills/mobile-design/rules/mobile-color-system.md +436 -0
- package/.agent/skills/mobile-design/rules/mobile-debugging.md +146 -0
- package/.agent/skills/mobile-design/rules/mobile-design-thinking.md +381 -0
- package/.agent/skills/mobile-design/rules/mobile-navigation.md +474 -0
- package/.agent/skills/mobile-design/rules/mobile-performance.md +783 -0
- package/.agent/skills/mobile-design/rules/mobile-testing.md +380 -0
- package/.agent/skills/mobile-design/rules/mobile-typography.md +449 -0
- package/.agent/skills/mobile-design/rules/platform-android.md +682 -0
- package/.agent/skills/mobile-design/rules/platform-ios.md +577 -0
- package/.agent/skills/mobile-design/rules/touch-psychology.md +553 -0
- package/.agent/skills/mobile-design/scripts/mobile_audit.ts +309 -0
- package/.agent/skills/mobile-developer/AGENTS.md +904 -0
- package/.agent/skills/mobile-developer/SKILL.md +194 -0
- package/.agent/skills/mobile-developer/rules/_sections.md +75 -0
- package/.agent/skills/mobile-developer/rules/_template.md +32 -0
- package/.agent/skills/mobile-developer/rules/anti-patterns.md +70 -0
- package/.agent/skills/mobile-developer/rules/app-store-optimization.md +319 -0
- package/.agent/skills/mobile-developer/rules/decision-trees.md +545 -0
- package/.agent/skills/mobile-developer/rules/deep-linking.md +441 -0
- package/.agent/skills/mobile-developer/rules/engineering-spec.md +477 -0
- package/.agent/skills/mobile-developer/rules/flutter.md +475 -0
- package/.agent/skills/mobile-developer/rules/mobile-backend.md +516 -0
- package/.agent/skills/mobile-developer/rules/mobile-color-system.md +444 -0
- package/.agent/skills/mobile-developer/rules/mobile-debugging.md +428 -0
- package/.agent/skills/mobile-developer/rules/mobile-design-thinking.md +367 -0
- package/.agent/skills/mobile-developer/rules/mobile-navigation.md +483 -0
- package/.agent/skills/mobile-developer/rules/mobile-performance.md +778 -0
- package/.agent/skills/mobile-developer/rules/mobile-testing.md +382 -0
- package/.agent/skills/mobile-developer/rules/mobile-typography.md +457 -0
- package/.agent/skills/mobile-developer/rules/native.md +572 -0
- package/.agent/skills/mobile-developer/rules/platform-android.md +676 -0
- package/.agent/skills/mobile-developer/rules/platform-ios.md +571 -0
- package/.agent/skills/mobile-developer/rules/push-notifications.md +599 -0
- package/.agent/skills/mobile-developer/rules/react-native.md +422 -0
- package/.agent/skills/mobile-developer/rules/touch-psychology.md +547 -0
- package/.agent/skills/mobile-developer/scripts/mobile_audit.ts +701 -0
- package/.agent/skills/nextjs-pro/AGENTS.md +3932 -0
- package/.agent/skills/nextjs-pro/SKILL.md +171 -0
- package/.agent/skills/nextjs-pro/rules/_sections.md +50 -0
- package/.agent/skills/nextjs-pro/rules/_template.md +32 -0
- package/.agent/skills/nextjs-pro/rules/advanced-event-handler-refs.md +59 -0
- package/.agent/skills/nextjs-pro/rules/advanced-init-once.md +46 -0
- package/.agent/skills/nextjs-pro/rules/advanced-use-latest.md +43 -0
- package/.agent/skills/nextjs-pro/rules/async-api-routes.md +42 -0
- package/.agent/skills/nextjs-pro/rules/async-defer-await.md +84 -0
- package/.agent/skills/nextjs-pro/rules/async-dependencies.md +55 -0
- package/.agent/skills/nextjs-pro/rules/async-parallel.md +32 -0
- package/.agent/skills/nextjs-pro/rules/async-suspense-boundaries.md +103 -0
- package/.agent/skills/nextjs-pro/rules/bundle-barrel-imports.md +63 -0
- package/.agent/skills/nextjs-pro/rules/bundle-conditional.md +35 -0
- package/.agent/skills/nextjs-pro/rules/bundle-defer-third-party.md +53 -0
- package/.agent/skills/nextjs-pro/rules/bundle-dynamic-imports.md +39 -0
- package/.agent/skills/nextjs-pro/rules/bundle-preload.md +54 -0
- package/.agent/skills/nextjs-pro/rules/client-event-listeners.md +78 -0
- package/.agent/skills/nextjs-pro/rules/client-localstorage-schema.md +75 -0
- package/.agent/skills/nextjs-pro/rules/client-passive-event-listeners.md +52 -0
- package/.agent/skills/nextjs-pro/rules/client-swr-dedup.md +60 -0
- package/.agent/skills/nextjs-pro/rules/engineering-spec.md +440 -0
- package/.agent/skills/nextjs-pro/rules/js-batch-dom-css.md +111 -0
- package/.agent/skills/nextjs-pro/rules/js-cache-function-results.md +84 -0
- package/.agent/skills/nextjs-pro/rules/js-cache-property-access.md +32 -0
- package/.agent/skills/nextjs-pro/rules/js-cache-storage.md +74 -0
- package/.agent/skills/nextjs-pro/rules/js-combine-iterations.md +36 -0
- package/.agent/skills/nextjs-pro/rules/js-early-exit.md +54 -0
- package/.agent/skills/nextjs-pro/rules/js-hoist-regexp.md +49 -0
- package/.agent/skills/nextjs-pro/rules/js-index-maps.md +41 -0
- package/.agent/skills/nextjs-pro/rules/js-length-check-first.md +53 -0
- package/.agent/skills/nextjs-pro/rules/js-min-max-loop.md +86 -0
- package/.agent/skills/nextjs-pro/rules/js-set-map-lookups.md +28 -0
- package/.agent/skills/nextjs-pro/rules/js-tosorted-immutable.md +61 -0
- package/.agent/skills/nextjs-pro/rules/rendering-activity.md +30 -0
- package/.agent/skills/nextjs-pro/rules/rendering-animate-svg-wrapper.md +51 -0
- package/.agent/skills/nextjs-pro/rules/rendering-conditional-render.md +44 -0
- package/.agent/skills/nextjs-pro/rules/rendering-content-visibility.md +42 -0
- package/.agent/skills/nextjs-pro/rules/rendering-hoist-jsx.md +50 -0
- package/.agent/skills/nextjs-pro/rules/rendering-hydration-no-flicker.md +86 -0
- package/.agent/skills/nextjs-pro/rules/rendering-hydration-suppress-warning.md +34 -0
- package/.agent/skills/nextjs-pro/rules/rendering-svg-precision.md +32 -0
- package/.agent/skills/nextjs-pro/rules/rendering-usetransition-loading.md +79 -0
- package/.agent/skills/nextjs-pro/rules/rerender-defer-reads.md +43 -0
- package/.agent/skills/nextjs-pro/rules/rerender-dependencies.md +49 -0
- package/.agent/skills/nextjs-pro/rules/rerender-derived-state-no-effect.md +44 -0
- package/.agent/skills/nextjs-pro/rules/rerender-derived-state.md +33 -0
- package/.agent/skills/nextjs-pro/rules/rerender-functional-setstate.md +78 -0
- package/.agent/skills/nextjs-pro/rules/rerender-lazy-state-init.md +62 -0
- package/.agent/skills/nextjs-pro/rules/rerender-memo-with-default-value.md +42 -0
- package/.agent/skills/nextjs-pro/rules/rerender-memo.md +48 -0
- package/.agent/skills/nextjs-pro/rules/rerender-move-effect-to-event.md +49 -0
- package/.agent/skills/nextjs-pro/rules/rerender-simple-expression-in-memo.md +39 -0
- package/.agent/skills/nextjs-pro/rules/rerender-transitions.md +44 -0
- package/.agent/skills/nextjs-pro/rules/rerender-use-ref-transient-values.md +77 -0
- package/.agent/skills/nextjs-pro/rules/schema.json +34 -0
- package/.agent/skills/nextjs-pro/rules/server-after-nonblocking.md +77 -0
- package/.agent/skills/nextjs-pro/rules/server-auth-actions.md +100 -0
- package/.agent/skills/nextjs-pro/rules/server-cache-lru.md +45 -0
- package/.agent/skills/nextjs-pro/rules/server-cache-react.md +80 -0
- package/.agent/skills/nextjs-pro/rules/server-dedup-props.md +69 -0
- package/.agent/skills/nextjs-pro/rules/server-parallel-fetching.md +87 -0
- package/.agent/skills/nextjs-pro/rules/server-serialization.md +42 -0
- package/.agent/skills/nodejs-pro/AGENTS.md +866 -0
- package/.agent/skills/nodejs-pro/SKILL.md +172 -0
- package/.agent/skills/nodejs-pro/rules/_sections.md +50 -0
- package/.agent/skills/nodejs-pro/rules/_template.md +32 -0
- package/.agent/skills/nodejs-pro/rules/architecture-patterns.md +229 -0
- package/.agent/skills/nodejs-pro/rules/async-patterns.md +246 -0
- package/.agent/skills/nodejs-pro/rules/engineering-spec.md +438 -0
- package/.agent/skills/nodejs-pro/rules/error-handling.md +257 -0
- package/.agent/skills/nodejs-pro/rules/framework-selection.md +220 -0
- package/.agent/skills/nodejs-pro/rules/runtime-modules.md +176 -0
- package/.agent/skills/nodejs-pro/rules/testing-strategy.md +266 -0
- package/.agent/skills/nodejs-pro/rules/validation-security.md +205 -0
- package/.agent/skills/observability/AGENTS.md +607 -0
- package/.agent/skills/observability/SKILL.md +178 -0
- package/.agent/skills/observability/rules/_sections.md +15 -0
- package/.agent/skills/observability/rules/_template.md +32 -0
- package/.agent/skills/observability/rules/engineering-spec.md +440 -0
- package/.agent/skills/offensive-sec/AGENTS.md +849 -0
- package/.agent/skills/offensive-sec/SKILL.md +191 -0
- package/.agent/skills/offensive-sec/rules/_sections.md +15 -0
- package/.agent/skills/offensive-sec/rules/_template.md +32 -0
- package/.agent/skills/offensive-sec/rules/engineering-spec.md +470 -0
- package/.agent/skills/perf-optimizer/AGENTS.md +870 -0
- package/.agent/skills/perf-optimizer/SKILL.md +189 -0
- package/.agent/skills/perf-optimizer/rules/_sections.md +15 -0
- package/.agent/skills/perf-optimizer/rules/_template.md +32 -0
- package/.agent/skills/perf-optimizer/rules/backend-patterns.md +312 -0
- package/.agent/skills/perf-optimizer/rules/engineering-spec.md +428 -0
- package/.agent/skills/perf-optimizer/scripts/lighthouse_audit.ts +201 -0
- package/.agent/skills/problem-checker/AGENTS.md +519 -0
- package/.agent/skills/problem-checker/SKILL.md +189 -0
- package/.agent/skills/problem-checker/rules/_sections.md +15 -0
- package/.agent/skills/problem-checker/rules/_template.md +32 -0
- package/.agent/skills/problem-checker/rules/engineering-spec.md +483 -0
- package/.agent/skills/problem-checker/scripts/check_problems.ts +396 -0
- package/.agent/skills/project-planner/AGENTS.md +2698 -0
- package/.agent/skills/project-planner/SKILL.md +166 -0
- package/.agent/skills/project-planner/rules/_sections.md +15 -0
- package/.agent/skills/project-planner/rules/_template.md +32 -0
- package/.agent/skills/project-planner/rules/engineering-spec.md +420 -0
- package/.agent/skills/python-pro/AGENTS.md +1871 -0
- package/.agent/skills/python-pro/SKILL.md +182 -0
- package/.agent/skills/python-pro/rules/_sections.md +50 -0
- package/.agent/skills/python-pro/rules/_template.md +32 -0
- package/.agent/skills/python-pro/rules/async-patterns.md +168 -0
- package/.agent/skills/python-pro/rules/django-patterns.md +194 -0
- package/.agent/skills/python-pro/rules/engineering-spec.md +442 -0
- package/.agent/skills/python-pro/rules/fastapi-patterns.md +179 -0
- package/.agent/skills/python-pro/rules/framework-selection.md +167 -0
- package/.agent/skills/python-pro/rules/project-structure.md +181 -0
- package/.agent/skills/python-pro/rules/testing-patterns.md +212 -0
- package/.agent/skills/python-pro/rules/type-hints.md +159 -0
- package/.agent/skills/react-pro/AGENTS.md +963 -0
- package/.agent/skills/react-pro/SKILL.md +232 -0
- package/.agent/skills/react-pro/rules/_sections.md +40 -0
- package/.agent/skills/react-pro/rules/_template.md +32 -0
- package/.agent/skills/react-pro/rules/component-patterns.md +145 -0
- package/.agent/skills/react-pro/rules/composition-compound.md +82 -0
- package/.agent/skills/react-pro/rules/data-fetching.md +133 -0
- package/.agent/skills/react-pro/rules/engineering-spec.md +453 -0
- package/.agent/skills/react-pro/rules/error-boundary.md +61 -0
- package/.agent/skills/react-pro/rules/file-organization.md +158 -0
- package/.agent/skills/react-pro/rules/hooks-custom.md +61 -0
- package/.agent/skills/react-pro/rules/mui-styling.md +138 -0
- package/.agent/skills/react-pro/rules/patterns.md +24 -0
- package/.agent/skills/react-pro/rules/performance-optimization.md +65 -0
- package/.agent/skills/react-pro/rules/performance.md +137 -0
- package/.agent/skills/react-pro/rules/react19-hooks.md +85 -0
- package/.agent/skills/react-pro/rules/state-management.md +90 -0
- package/.agent/skills/react-pro/rules/testing-patterns.md +52 -0
- package/.agent/skills/registry.json +1251 -0
- package/.agent/skills/security-scanner/AGENTS.md +851 -0
- package/.agent/skills/security-scanner/SKILL.md +182 -0
- package/.agent/skills/security-scanner/rules/_sections.md +15 -0
- package/.agent/skills/security-scanner/rules/_template.md +32 -0
- package/.agent/skills/security-scanner/rules/auth-patterns.md +281 -0
- package/.agent/skills/security-scanner/rules/checklists.md +186 -0
- package/.agent/skills/security-scanner/rules/engineering-spec.md +440 -0
- package/.agent/skills/security-scanner/scripts/security_scan.ts +513 -0
- package/.agent/skills/seo-optimizer/AGENTS.md +839 -0
- package/.agent/skills/seo-optimizer/SKILL.md +180 -0
- package/.agent/skills/seo-optimizer/rules/_sections.md +15 -0
- package/.agent/skills/seo-optimizer/rules/_template.md +32 -0
- package/.agent/skills/seo-optimizer/rules/engineering-spec.md +433 -0
- package/.agent/skills/seo-optimizer/scripts/geo_checker.ts +109 -0
- package/.agent/skills/seo-optimizer/scripts/seo_checker.ts +308 -0
- package/.agent/skills/server-ops/AGENTS.md +643 -0
- package/.agent/skills/server-ops/SKILL.md +194 -0
- package/.agent/skills/server-ops/rules/_sections.md +15 -0
- package/.agent/skills/server-ops/rules/_template.md +32 -0
- package/.agent/skills/server-ops/rules/engineering-spec.md +450 -0
- package/.agent/skills/shell-script/AGENTS.md +499 -0
- package/.agent/skills/shell-script/SKILL.md +205 -0
- package/.agent/skills/shell-script/rules/_sections.md +15 -0
- package/.agent/skills/shell-script/rules/_template.md +32 -0
- package/.agent/skills/shell-script/rules/engineering-spec.md +463 -0
- package/.agent/skills/skill-generator/SKILL.md +147 -0
- package/.agent/skills/smart-router/SKILL.md +95 -0
- package/.agent/skills/studio/AGENTS.md +636 -0
- package/.agent/skills/studio/SKILL.md +178 -0
- package/.agent/skills/studio/data/charts.csv +26 -0
- package/.agent/skills/studio/data/colors.csv +97 -0
- package/.agent/skills/studio/data/icons.csv +101 -0
- package/.agent/skills/studio/data/landing.csv +31 -0
- package/.agent/skills/studio/data/products.csv +97 -0
- package/.agent/skills/studio/data/prompts.csv +24 -0
- package/.agent/skills/studio/data/react-performance.csv +45 -0
- package/.agent/skills/studio/data/stacks/flutter.csv +52 -0
- package/.agent/skills/studio/data/stacks/html-tailwind.csv +56 -0
- package/.agent/skills/studio/data/stacks/jetpack-compose.csv +53 -0
- package/.agent/skills/studio/data/stacks/nextjs.csv +53 -0
- package/.agent/skills/studio/data/stacks/nuxt-ui.csv +51 -0
- package/.agent/skills/studio/data/stacks/nuxtjs.csv +59 -0
- package/.agent/skills/studio/data/stacks/react-native.csv +52 -0
- package/.agent/skills/studio/data/stacks/react.csv +54 -0
- package/.agent/skills/studio/data/stacks/shadcn.csv +61 -0
- package/.agent/skills/studio/data/stacks/svelte.csv +54 -0
- package/.agent/skills/studio/data/stacks/swiftui.csv +51 -0
- package/.agent/skills/studio/data/stacks/vue.csv +50 -0
- package/.agent/skills/studio/data/styles.csv +59 -0
- package/.agent/skills/studio/data/typography.csv +58 -0
- package/.agent/skills/studio/data/ui-reasoning.csv +101 -0
- package/.agent/skills/studio/data/ux-guidelines.csv +100 -0
- package/.agent/skills/studio/data/web-interface.csv +31 -0
- package/.agent/skills/studio/rules/_sections.md +15 -0
- package/.agent/skills/studio/rules/_template.md +32 -0
- package/.agent/skills/studio/rules/engineering-spec.md +455 -0
- package/.agent/skills/studio/scripts/core.ts +345 -0
- package/.agent/skills/studio/scripts/design_system.ts +953 -0
- package/.agent/skills/studio/scripts/search.ts +197 -0
- package/.agent/skills/studio/scripts/types.ts +147 -0
- package/.agent/skills/studio/scripts/utils/component-specs.ts +154 -0
- package/.agent/skills/studio/scripts/utils/config-loader.ts +165 -0
- package/.agent/skills/studio/scripts/utils/css-templates.ts +169 -0
- package/.agent/skills/studio/scripts/utils/css-validator.ts +95 -0
- package/.agent/skills/studio/scripts/utils/csv-loader.ts +52 -0
- package/.agent/skills/studio/scripts/utils/intelligent-overrides.ts +129 -0
- package/.agent/skills/studio/scripts/utils/page-override-formatter.ts +143 -0
- package/.agent/skills/studio/scripts/utils/page-type-detector.ts +124 -0
- package/.agent/skills/studio/scripts/utils/search-cache.ts +165 -0
- package/.agent/skills/studio/scripts/utils/text-utils.ts +44 -0
- package/.agent/skills/system-design/AGENTS.md +597 -0
- package/.agent/skills/system-design/SKILL.md +153 -0
- package/.agent/skills/system-design/rules/_sections.md +15 -0
- package/.agent/skills/system-design/rules/_template.md +32 -0
- package/.agent/skills/system-design/rules/context-discovery.md +117 -0
- package/.agent/skills/system-design/rules/engineering-spec.md +437 -0
- package/.agent/skills/system-design/rules/examples.md +180 -0
- package/.agent/skills/system-design/rules/pattern-selection.md +130 -0
- package/.agent/skills/system-design/rules/patterns-reference.md +110 -0
- package/.agent/skills/system-design/rules/trade-off-analysis.md +169 -0
- package/.agent/skills/tailwind-kit/AGENTS.md +1135 -0
- package/.agent/skills/tailwind-kit/SKILL.md +171 -0
- package/.agent/skills/tailwind-kit/rules/_sections.md +20 -0
- package/.agent/skills/tailwind-kit/rules/_template.md +32 -0
- package/.agent/skills/tailwind-kit/rules/components.md +232 -0
- package/.agent/skills/tailwind-kit/rules/engineering-spec.md +435 -0
- package/.agent/skills/tailwind-kit/rules/responsive.md +221 -0
- package/.agent/skills/tailwind-kit/rules/v4-config.md +72 -0
- package/.agent/skills/test-architect/AGENTS.md +851 -0
- package/.agent/skills/test-architect/SKILL.md +176 -0
- package/.agent/skills/test-architect/rules/_sections.md +15 -0
- package/.agent/skills/test-architect/rules/_template.md +32 -0
- package/.agent/skills/test-architect/rules/engineering-spec.md +434 -0
- package/.agent/skills/test-architect/scripts/test_runner.ts +265 -0
- package/.agent/skills/typescript-expert/AGENTS.md +1045 -0
- package/.agent/skills/typescript-expert/SKILL.md +200 -0
- package/.agent/skills/typescript-expert/rules/_sections.md +20 -0
- package/.agent/skills/typescript-expert/rules/_template.md +32 -0
- package/.agent/skills/typescript-expert/rules/engineering-spec.md +433 -0
- package/.agent/skills/typescript-expert/rules/tsconfig-strict.json +92 -0
- package/.agent/skills/typescript-expert/rules/typescript-cheatsheet.md +407 -0
- package/.agent/skills/typescript-expert/rules/utility-types.ts +264 -0
- package/.agent/skills/typescript-expert/scripts/ts_diagnostic.ts +321 -0
- package/.agent/skills/vercel-deploy/AGENTS.md +490 -0
- package/.agent/skills/vercel-deploy/SKILL.md +175 -0
- package/.agent/skills/vercel-deploy/rules/_sections.md +15 -0
- package/.agent/skills/vercel-deploy/rules/_template.md +32 -0
- package/.agent/skills/vercel-deploy/rules/engineering-spec.md +463 -0
- package/.agent/skills/vercel-deploy/scripts/deploy.sh +310 -0
- package/.agent/workflows/api.md +377 -0
- package/.agent/workflows/autopilot.md +344 -0
- package/.agent/workflows/build.md +338 -0
- package/.agent/workflows/chronicle.md +279 -0
- package/.agent/workflows/cook.md +217 -0
- package/.agent/workflows/diagnose.md +302 -0
- package/.agent/workflows/fix.md +253 -0
- package/.agent/workflows/game.md +329 -0
- package/.agent/workflows/inspect.md +276 -0
- package/.agent/workflows/knowledge.md +212 -0
- package/.agent/workflows/launch.md +345 -0
- package/.agent/workflows/mobile.md +354 -0
- package/.agent/workflows/monitor.md +239 -0
- package/.agent/workflows/optimize.md +269 -0
- package/.agent/workflows/plan.md +278 -0
- package/.agent/workflows/stage.md +286 -0
- package/.agent/workflows/studio.md +276 -0
- package/.agent/workflows/think.md +262 -0
- package/.agent/workflows/validate.md +289 -0
- package/.agentignore +161 -0
- package/.gitattributes +16 -0
- package/CHANGELOG.md +198 -0
- package/LICENSE +40 -0
- package/README.md +173 -0
- package/docs/SKILL_DESIGN_GUIDE.md +561 -0
- package/docs/The-Complete-Guide-to-Building-Skills-for-Claude.md +1207 -0
- package/docs/WORKFLOW_DESIGN_GUIDE.md +325 -0
- package/package.json +33 -0
- package/tsconfig.json +28 -0
|
@@ -0,0 +1,953 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Design System Generator - Studio Scripts
|
|
4
|
+
* ==========================================
|
|
5
|
+
* JavaScript port of design_system.py
|
|
6
|
+
* Aggregates search results and applies reasoning to generate design systems
|
|
7
|
+
*
|
|
8
|
+
* Due to file size (~1300 LOC), this file is organized into clear sections:
|
|
9
|
+
* 1. Configuration & Setup
|
|
10
|
+
* 2. DesignSystemGenerator Class
|
|
11
|
+
* 3. Output Formatters (ASCII & Markdown)
|
|
12
|
+
* 4. Main Entry Point
|
|
13
|
+
* 5. Persistence Functions
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { readFile, writeFile, mkdir } from 'fs/promises';
|
|
17
|
+
import { existsSync } from 'fs';
|
|
18
|
+
import { fileURLToPath } from 'url';
|
|
19
|
+
import { dirname, join } from 'path';
|
|
20
|
+
import { search, DATA_DIR } from './core.ts';
|
|
21
|
+
|
|
22
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
23
|
+
const __dirname = dirname(__filename);
|
|
24
|
+
|
|
25
|
+
// ============ CONFIGURATION ============
|
|
26
|
+
const REASONING_FILE = 'ui-reasoning.csv';
|
|
27
|
+
|
|
28
|
+
const SEARCH_CONFIG = {
|
|
29
|
+
product: { max_results: 1 },
|
|
30
|
+
style: { max_results: 3 },
|
|
31
|
+
color: { max_results: 2 },
|
|
32
|
+
landing: { max_results: 2 },
|
|
33
|
+
typography: { max_results: 2 }
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// ============ DESIGN SYSTEM GENERATOR ============
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Generates design system recommendations from aggregated searches
|
|
40
|
+
*/
|
|
41
|
+
export class DesignSystemGenerator {
|
|
42
|
+
constructor() {
|
|
43
|
+
this.reasoningData = null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Load reasoning rules from CSV
|
|
48
|
+
*/
|
|
49
|
+
async _loadReasoning() {
|
|
50
|
+
if (this.reasoningData) return this.reasoningData;
|
|
51
|
+
|
|
52
|
+
const filepath = join(DATA_DIR, REASONING_FILE);
|
|
53
|
+
if (!existsSync(filepath)) {
|
|
54
|
+
this.reasoningData = [];
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
const content = await readFile(filepath, 'utf-8');
|
|
60
|
+
const lines = content.split('\n');
|
|
61
|
+
const headers = lines[0].split(',').map(h => h.trim());
|
|
62
|
+
|
|
63
|
+
this.reasoningData = lines.slice(1)
|
|
64
|
+
.filter(line => line.trim())
|
|
65
|
+
.map(line => {
|
|
66
|
+
const values = line.split(',');
|
|
67
|
+
const row = {};
|
|
68
|
+
headers.forEach((header, i) => {
|
|
69
|
+
row[header] = values[i] || '';
|
|
70
|
+
});
|
|
71
|
+
return row;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return this.reasoningData;
|
|
75
|
+
} catch (error) {
|
|
76
|
+
console.error('Error loading reasoning data:', error.message);
|
|
77
|
+
this.reasoningData = [];
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Execute searches across multiple domains
|
|
84
|
+
*/
|
|
85
|
+
async _multiDomainSearch(query, stylePriority = null) {
|
|
86
|
+
const results = {};
|
|
87
|
+
|
|
88
|
+
for (const [domain, config] of Object.entries(SEARCH_CONFIG)) {
|
|
89
|
+
if (domain === 'style' && stylePriority && stylePriority.length > 0) {
|
|
90
|
+
// For style, also search with priority keywords
|
|
91
|
+
const priorityQuery = stylePriority.slice(0, 2).join(' ');
|
|
92
|
+
const combinedQuery = `${query} ${priorityQuery}`;
|
|
93
|
+
results[domain] = await search(combinedQuery, domain, config.max_results);
|
|
94
|
+
} else {
|
|
95
|
+
results[domain] = await search(query, domain, config.max_results);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return results;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Find matching reasoning rule for a category
|
|
104
|
+
*/
|
|
105
|
+
async _findReasoningRule(category) {
|
|
106
|
+
const reasoningData = await this._loadReasoning();
|
|
107
|
+
const categoryLower = category.toLowerCase();
|
|
108
|
+
|
|
109
|
+
// Try exact match first
|
|
110
|
+
for (const rule of reasoningData) {
|
|
111
|
+
if (rule['UI_Category']?.toLowerCase() === categoryLower) {
|
|
112
|
+
return rule;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Try partial match
|
|
117
|
+
for (const rule of reasoningData) {
|
|
118
|
+
const uiCat = rule['UI_Category']?.toLowerCase() || '';
|
|
119
|
+
if (uiCat.includes(categoryLower) || categoryLower.includes(uiCat)) {
|
|
120
|
+
return rule;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Try keyword match
|
|
125
|
+
for (const rule of reasoningData) {
|
|
126
|
+
const uiCat = rule['UI_Category']?.toLowerCase() || '';
|
|
127
|
+
const keywords = uiCat.replace(/\//g, ' ').replace(/-/g, ' ').split(/\s+/);
|
|
128
|
+
if (keywords.some(kw => categoryLower.includes(kw))) {
|
|
129
|
+
return rule;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return {};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Apply reasoning rules to search results
|
|
138
|
+
*/
|
|
139
|
+
async _applyReasoning(category, searchResults) {
|
|
140
|
+
const rule = await this._findReasoningRule(category);
|
|
141
|
+
|
|
142
|
+
if (!rule || Object.keys(rule).length === 0) {
|
|
143
|
+
return {
|
|
144
|
+
pattern: 'Hero + Features + CTA',
|
|
145
|
+
style_priority: ['Minimalism', 'Flat Design'],
|
|
146
|
+
color_mood: 'Professional',
|
|
147
|
+
typography_mood: 'Clean',
|
|
148
|
+
key_effects: 'Subtle hover transitions',
|
|
149
|
+
anti_patterns: '',
|
|
150
|
+
decision_rules: {},
|
|
151
|
+
severity: 'MEDIUM'
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Parse decision rules JSON
|
|
156
|
+
let decisionRules = {};
|
|
157
|
+
try {
|
|
158
|
+
const rulesStr = rule['Decision_Rules'] || '{}';
|
|
159
|
+
decisionRules = JSON.parse(rulesStr);
|
|
160
|
+
} catch (error) {
|
|
161
|
+
// Keep empty object if parsing fails
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const stylePriority = (rule['Style_Priority'] || '')
|
|
165
|
+
.split('+')
|
|
166
|
+
.map(s => s.trim())
|
|
167
|
+
.filter(s => s);
|
|
168
|
+
|
|
169
|
+
return {
|
|
170
|
+
pattern: rule['Recommended_Pattern'] || '',
|
|
171
|
+
style_priority: stylePriority,
|
|
172
|
+
color_mood: rule['Color_Mood'] || '',
|
|
173
|
+
typography_mood: rule['Typography_Mood'] || '',
|
|
174
|
+
key_effects: rule['Key_Effects'] || '',
|
|
175
|
+
anti_patterns: rule['Anti_Patterns'] || '',
|
|
176
|
+
decision_rules: decisionRules,
|
|
177
|
+
severity: rule['Severity'] || 'MEDIUM'
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Select best matching result based on priority keywords
|
|
183
|
+
*/
|
|
184
|
+
_selectBestMatch(results, priorityKeywords) {
|
|
185
|
+
if (!results || results.length === 0) {
|
|
186
|
+
return {};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (!priorityKeywords || priorityKeywords.length === 0) {
|
|
190
|
+
return results[0];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// First: try exact style name match
|
|
194
|
+
for (const priority of priorityKeywords) {
|
|
195
|
+
const priorityLower = priority.toLowerCase().trim();
|
|
196
|
+
for (const result of results) {
|
|
197
|
+
const styleName = (result['Style Category'] || '').toLowerCase();
|
|
198
|
+
if (priorityLower.includes(styleName) || styleName.includes(priorityLower)) {
|
|
199
|
+
return result;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Second: score by keyword match in all fields
|
|
205
|
+
const scored = [];
|
|
206
|
+
for (const result of results) {
|
|
207
|
+
const resultStr = JSON.stringify(result).toLowerCase();
|
|
208
|
+
let score = 0;
|
|
209
|
+
|
|
210
|
+
for (const kw of priorityKeywords) {
|
|
211
|
+
const kwLower = kw.toLowerCase().trim();
|
|
212
|
+
// Higher score for style name match
|
|
213
|
+
if ((result['Style Category'] || '').toLowerCase().includes(kwLower)) {
|
|
214
|
+
score += 10;
|
|
215
|
+
}
|
|
216
|
+
// Lower score for keyword field match
|
|
217
|
+
else if ((result['Keywords'] || '').toLowerCase().includes(kwLower)) {
|
|
218
|
+
score += 3;
|
|
219
|
+
}
|
|
220
|
+
// Even lower for other field matches
|
|
221
|
+
else if (resultStr.includes(kwLower)) {
|
|
222
|
+
score += 1;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
scored.push([score, result]);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
scored.sort((a, b) => b[0] - a[0]);
|
|
230
|
+
return scored.length > 0 && scored[0][0] > 0 ? scored[0][1] : results[0];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Extract results list from search result dict
|
|
235
|
+
*/
|
|
236
|
+
_extractResults(searchResult) {
|
|
237
|
+
return searchResult?.results || [];
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Generate complete design system recommendation
|
|
242
|
+
*/
|
|
243
|
+
async generate(query, projectName = null) {
|
|
244
|
+
// Step 1: First search product to get category
|
|
245
|
+
const productResult = await search(query, 'product', 1);
|
|
246
|
+
const productResults = productResult.results || [];
|
|
247
|
+
let category = 'General';
|
|
248
|
+
if (productResults.length > 0) {
|
|
249
|
+
category = productResults[0]['Product Type'] || 'General';
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Step 2: Get reasoning rules for this category
|
|
253
|
+
const reasoning = await this._applyReasoning(category, {});
|
|
254
|
+
const stylePriority = reasoning.style_priority || [];
|
|
255
|
+
|
|
256
|
+
// Step 3: Multi-domain search with style priority hints
|
|
257
|
+
const searchResults = await this._multiDomainSearch(query, stylePriority);
|
|
258
|
+
searchResults.product = productResult; // Reuse product search
|
|
259
|
+
|
|
260
|
+
// Step 4: Select best matches from each domain using priority
|
|
261
|
+
const styleResults = this._extractResults(searchResults.style || {});
|
|
262
|
+
const colorResults = this._extractResults(searchResults.color || {});
|
|
263
|
+
const typographyResults = this._extractResults(searchResults.typography || {});
|
|
264
|
+
const landingResults = this._extractResults(searchResults.landing || {});
|
|
265
|
+
|
|
266
|
+
const bestStyle = this._selectBestMatch(styleResults, reasoning.style_priority || []);
|
|
267
|
+
const bestColor = colorResults[0] || {};
|
|
268
|
+
const bestTypography = typographyResults[0] || {};
|
|
269
|
+
const bestLanding = landingResults[0] || {};
|
|
270
|
+
|
|
271
|
+
// Step 5: Build final recommendation
|
|
272
|
+
const styleEffects = bestStyle['Effects & Animation'] || '';
|
|
273
|
+
const reasoningEffects = reasoning.key_effects || '';
|
|
274
|
+
const combinedEffects = styleEffects || reasoningEffects;
|
|
275
|
+
|
|
276
|
+
return {
|
|
277
|
+
project_name: projectName || query.toUpperCase(),
|
|
278
|
+
category,
|
|
279
|
+
pattern: {
|
|
280
|
+
name: bestLanding['Pattern Name'] || reasoning.pattern || 'Hero + Features + CTA',
|
|
281
|
+
sections: bestLanding['Section Order'] || 'Hero > Features > CTA',
|
|
282
|
+
cta_placement: bestLanding['Primary CTA Placement'] || 'Above fold',
|
|
283
|
+
color_strategy: bestLanding['Color Strategy'] || '',
|
|
284
|
+
conversion: bestLanding['Conversion Optimization'] || ''
|
|
285
|
+
},
|
|
286
|
+
style: {
|
|
287
|
+
name: bestStyle['Style Category'] || 'Minimalism',
|
|
288
|
+
type: bestStyle['Type'] || 'General',
|
|
289
|
+
effects: styleEffects,
|
|
290
|
+
keywords: bestStyle['Keywords'] || '',
|
|
291
|
+
best_for: bestStyle['Best For'] || '',
|
|
292
|
+
performance: bestStyle['Performance'] || '',
|
|
293
|
+
accessibility: bestStyle['Accessibility'] || ''
|
|
294
|
+
},
|
|
295
|
+
colors: {
|
|
296
|
+
primary: bestColor['Primary (Hex)'] || '#2563EB',
|
|
297
|
+
secondary: bestColor['Secondary (Hex)'] || '#3B82F6',
|
|
298
|
+
cta: bestColor['CTA (Hex)'] || '#F97316',
|
|
299
|
+
background: bestColor['Background (Hex)'] || '#F8FAFC',
|
|
300
|
+
text: bestColor['Text (Hex)'] || '#1E293B',
|
|
301
|
+
notes: bestColor['Notes'] || ''
|
|
302
|
+
},
|
|
303
|
+
typography: {
|
|
304
|
+
heading: bestTypography['Heading Font'] || 'Inter',
|
|
305
|
+
body: bestTypography['Body Font'] || 'Inter',
|
|
306
|
+
mood: bestTypography['Mood/Style Keywords'] || reasoning.typography_mood || '',
|
|
307
|
+
best_for: bestTypography['Best For'] || '',
|
|
308
|
+
google_fonts_url: bestTypography['Google Fonts URL'] || '',
|
|
309
|
+
css_import: bestTypography['CSS Import'] || ''
|
|
310
|
+
},
|
|
311
|
+
key_effects: combinedEffects,
|
|
312
|
+
anti_patterns: reasoning.anti_patterns || '',
|
|
313
|
+
decision_rules: reasoning.decision_rules || {},
|
|
314
|
+
severity: reasoning.severity || 'MEDIUM'
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// ============ OUTPUT FORMATTERS ============
|
|
320
|
+
const BOX_WIDTH = 90;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Wrap long text into multiple lines
|
|
324
|
+
*/
|
|
325
|
+
function wrapText(text, prefix, width) {
|
|
326
|
+
if (!text) return [];
|
|
327
|
+
|
|
328
|
+
const words = text.split(/\s+/);
|
|
329
|
+
const lines = [];
|
|
330
|
+
let currentLine = prefix;
|
|
331
|
+
|
|
332
|
+
for (const word of words) {
|
|
333
|
+
if (currentLine.length + word.length + 1 <= width - 2) {
|
|
334
|
+
currentLine += (currentLine !== prefix ? ' ' : '') + word;
|
|
335
|
+
} else {
|
|
336
|
+
if (currentLine !== prefix) {
|
|
337
|
+
lines.push(currentLine);
|
|
338
|
+
}
|
|
339
|
+
currentLine = prefix + word;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (currentLine !== prefix) {
|
|
344
|
+
lines.push(currentLine);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return lines;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Format design system as ASCII box with emojis (MCP-style)
|
|
352
|
+
*/
|
|
353
|
+
export function formatAsciiBox(designSystem) {
|
|
354
|
+
const project = designSystem.project_name || 'PROJECT';
|
|
355
|
+
const pattern = designSystem.pattern || {};
|
|
356
|
+
const style = designSystem.style || {};
|
|
357
|
+
const colors = designSystem.colors || {};
|
|
358
|
+
const typography = designSystem.typography || {};
|
|
359
|
+
const effects = designSystem.key_effects || '';
|
|
360
|
+
const antiPatterns = designSystem.anti_patterns || '';
|
|
361
|
+
|
|
362
|
+
// Build sections from pattern
|
|
363
|
+
const sections = (pattern.sections || '')
|
|
364
|
+
.split('>')
|
|
365
|
+
.map(s => s.trim())
|
|
366
|
+
.filter(s => s);
|
|
367
|
+
|
|
368
|
+
// Build output lines
|
|
369
|
+
const lines = [];
|
|
370
|
+
const w = BOX_WIDTH - 1;
|
|
371
|
+
|
|
372
|
+
lines.push('+' + '-'.repeat(w) + '+');
|
|
373
|
+
lines.push(`| 🎯 TARGET: ${project} - RECOMMENDED DESIGN SYSTEM`.padEnd(BOX_WIDTH) + '|');
|
|
374
|
+
lines.push('+' + '-'.repeat(w) + '+');
|
|
375
|
+
lines.push('|' + ' '.repeat(BOX_WIDTH) + '|');
|
|
376
|
+
|
|
377
|
+
// Pattern section
|
|
378
|
+
lines.push(`| 📐 PATTERN: ${pattern.name || ''}`.padEnd(BOX_WIDTH) + '|');
|
|
379
|
+
if (pattern.conversion) {
|
|
380
|
+
lines.push(`| 🎯 Conversion: ${pattern.conversion}`.padEnd(BOX_WIDTH) + '|');
|
|
381
|
+
}
|
|
382
|
+
if (pattern.cta_placement) {
|
|
383
|
+
lines.push(`| 📍 CTA: ${pattern.cta_placement}`.padEnd(BOX_WIDTH) + '|');
|
|
384
|
+
}
|
|
385
|
+
lines.push('| 📋 Sections:'.padEnd(BOX_WIDTH) + '|');
|
|
386
|
+
sections.forEach((section, i) => {
|
|
387
|
+
lines.push(`| ${i + 1}. ${section}`.padEnd(BOX_WIDTH) + '|');
|
|
388
|
+
});
|
|
389
|
+
lines.push('|' + ' '.repeat(BOX_WIDTH) + '|');
|
|
390
|
+
|
|
391
|
+
// Style section
|
|
392
|
+
lines.push(`| 🎨 STYLE: ${style.name || ''}`.padEnd(BOX_WIDTH) + '|');
|
|
393
|
+
if (style.keywords) {
|
|
394
|
+
wrapText(`🏷️ Keywords: ${style.keywords}`, '| ', BOX_WIDTH).forEach(line => {
|
|
395
|
+
lines.push(line.padEnd(BOX_WIDTH) + '|');
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
if (style.best_for) {
|
|
399
|
+
wrapText(`✨ Best For: ${style.best_for}`, '| ', BOX_WIDTH).forEach(line => {
|
|
400
|
+
lines.push(line.padEnd(BOX_WIDTH) + '|');
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
if (style.performance || style.accessibility) {
|
|
404
|
+
const perfA11y = `⚡ Performance: ${style.performance} | ♿ Accessibility: ${style.accessibility}`;
|
|
405
|
+
lines.push(`| ${perfA11y}`.padEnd(BOX_WIDTH) + '|');
|
|
406
|
+
}
|
|
407
|
+
lines.push('|' + ' '.repeat(BOX_WIDTH) + '|');
|
|
408
|
+
|
|
409
|
+
// Colors section
|
|
410
|
+
lines.push('| 🎨 COLORS:'.padEnd(BOX_WIDTH) + '|');
|
|
411
|
+
lines.push(`| Primary: ${colors.primary || ''}`.padEnd(BOX_WIDTH) + '|');
|
|
412
|
+
lines.push(`| Secondary: ${colors.secondary || ''}`.padEnd(BOX_WIDTH) + '|');
|
|
413
|
+
lines.push(`| CTA: ${colors.cta || ''}`.padEnd(BOX_WIDTH) + '|');
|
|
414
|
+
lines.push(`| Background: ${colors.background || ''}`.padEnd(BOX_WIDTH) + '|');
|
|
415
|
+
lines.push(`| Text: ${colors.text || ''}`.padEnd(BOX_WIDTH) + '|');
|
|
416
|
+
if (colors.notes) {
|
|
417
|
+
wrapText(`📝 Notes: ${colors.notes}`, '| ', BOX_WIDTH).forEach(line => {
|
|
418
|
+
lines.push(line.padEnd(BOX_WIDTH) + '|');
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
lines.push('|' + ' '.repeat(BOX_WIDTH) + '|');
|
|
422
|
+
|
|
423
|
+
// Typography section
|
|
424
|
+
lines.push(`| 🔤 TYPOGRAPHY: ${typography.heading || ''} / ${typography.body || ''}`.padEnd(BOX_WIDTH) + '|');
|
|
425
|
+
if (typography.mood) {
|
|
426
|
+
wrapText(`💭 Mood: ${typography.mood}`, '| ', BOX_WIDTH).forEach(line => {
|
|
427
|
+
lines.push(line.padEnd(BOX_WIDTH) + '|');
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
if (typography.best_for) {
|
|
431
|
+
wrapText(`✨ Best For: ${typography.best_for}`, '| ', BOX_WIDTH).forEach(line => {
|
|
432
|
+
lines.push(line.padEnd(BOX_WIDTH) + '|');
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
if (typography.google_fonts_url) {
|
|
436
|
+
lines.push(`| 🔗 Google Fonts: ${typography.google_fonts_url}`.padEnd(BOX_WIDTH) + '|');
|
|
437
|
+
}
|
|
438
|
+
if (typography.css_import) {
|
|
439
|
+
const cssImport = typography.css_import.slice(0, 70) + (typography.css_import.length > 70 ? '...' : '');
|
|
440
|
+
lines.push(`| 📎 CSS Import: ${cssImport}`.padEnd(BOX_WIDTH) + '|');
|
|
441
|
+
}
|
|
442
|
+
lines.push('|' + ' '.repeat(BOX_WIDTH) + '|');
|
|
443
|
+
|
|
444
|
+
// Key Effects section
|
|
445
|
+
if (effects) {
|
|
446
|
+
lines.push('| ✨ KEY EFFECTS:'.padEnd(BOX_WIDTH) + '|');
|
|
447
|
+
wrapText(effects, '| ', BOX_WIDTH).forEach(line => {
|
|
448
|
+
lines.push(line.padEnd(BOX_WIDTH) + '|');
|
|
449
|
+
});
|
|
450
|
+
lines.push('|' + ' '.repeat(BOX_WIDTH) + '|');
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// Anti-patterns section
|
|
454
|
+
if (antiPatterns) {
|
|
455
|
+
lines.push('| ⛔ AVOID (Anti-patterns):'.padEnd(BOX_WIDTH) + '|');
|
|
456
|
+
wrapText(antiPatterns, '| ', BOX_WIDTH).forEach(line => {
|
|
457
|
+
lines.push(line.padEnd(BOX_WIDTH) + '|');
|
|
458
|
+
});
|
|
459
|
+
lines.push('|' + ' '.repeat(BOX_WIDTH) + '|');
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// Pre-Delivery Checklist section
|
|
463
|
+
lines.push('| ✅ PRE-DELIVERY CHECKLIST:'.padEnd(BOX_WIDTH) + '|');
|
|
464
|
+
const checklistItems = [
|
|
465
|
+
'[ ] No emojis as icons (use SVG: Heroicons/Lucide)',
|
|
466
|
+
'[ ] cursor-pointer on all clickable elements',
|
|
467
|
+
'[ ] Hover states with smooth transitions (150-300ms)',
|
|
468
|
+
'[ ] Light mode: text contrast 4.5:1 minimum',
|
|
469
|
+
'[ ] Focus states visible for keyboard nav',
|
|
470
|
+
'[ ] prefers-reduced-motion respected',
|
|
471
|
+
'[ ] Responsive: 375px, 768px, 1024px, 1440px'
|
|
472
|
+
];
|
|
473
|
+
checklistItems.forEach(item => {
|
|
474
|
+
lines.push(`| ${item}`.padEnd(BOX_WIDTH) + '|');
|
|
475
|
+
});
|
|
476
|
+
lines.push('|' + ' '.repeat(BOX_WIDTH) + '|');
|
|
477
|
+
|
|
478
|
+
lines.push('+' + '-'.repeat(w) + '+');
|
|
479
|
+
|
|
480
|
+
return lines.join('\n');
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Format design system as markdown
|
|
485
|
+
*/
|
|
486
|
+
export function formatMarkdown(designSystem) {
|
|
487
|
+
const project = designSystem.project_name || 'PROJECT';
|
|
488
|
+
const pattern = designSystem.pattern || {};
|
|
489
|
+
const style = designSystem.style || {};
|
|
490
|
+
const colors = designSystem.colors || {};
|
|
491
|
+
const typography = designSystem.typography || {};
|
|
492
|
+
const effects = designSystem.key_effects || '';
|
|
493
|
+
const antiPatterns = designSystem.anti_patterns || '';
|
|
494
|
+
|
|
495
|
+
const lines = [];
|
|
496
|
+
lines.push(`## Design System: ${project}`);
|
|
497
|
+
lines.push('');
|
|
498
|
+
|
|
499
|
+
// Pattern section
|
|
500
|
+
lines.push('### Pattern');
|
|
501
|
+
lines.push(`- **Name:** ${pattern.name || ''}`);
|
|
502
|
+
if (pattern.conversion) {
|
|
503
|
+
lines.push(`- **Conversion Focus:** ${pattern.conversion}`);
|
|
504
|
+
}
|
|
505
|
+
if (pattern.cta_placement) {
|
|
506
|
+
lines.push(`- **CTA Placement:** ${pattern.cta_placement}`);
|
|
507
|
+
}
|
|
508
|
+
if (pattern.color_strategy) {
|
|
509
|
+
lines.push(`- **Color Strategy:** ${pattern.color_strategy}`);
|
|
510
|
+
}
|
|
511
|
+
lines.push(`- **Sections:** ${pattern.sections || ''}`);
|
|
512
|
+
lines.push('');
|
|
513
|
+
|
|
514
|
+
// Style section
|
|
515
|
+
lines.push('### Style');
|
|
516
|
+
lines.push(`- **Name:** ${style.name || ''}`);
|
|
517
|
+
if (style.keywords) {
|
|
518
|
+
lines.push(`- **Keywords:** ${style.keywords}`);
|
|
519
|
+
}
|
|
520
|
+
if (style.best_for) {
|
|
521
|
+
lines.push(`- **Best For:** ${style.best_for}`);
|
|
522
|
+
}
|
|
523
|
+
if (style.performance || style.accessibility) {
|
|
524
|
+
lines.push(`- **Performance:** ${style.performance} | **Accessibility:** ${style.accessibility}`);
|
|
525
|
+
}
|
|
526
|
+
lines.push('');
|
|
527
|
+
|
|
528
|
+
// Colors section
|
|
529
|
+
lines.push('### Colors');
|
|
530
|
+
lines.push('| Role | Hex |');
|
|
531
|
+
lines.push('|------|-----|');
|
|
532
|
+
lines.push(`| Primary | ${colors.primary || ''} |`);
|
|
533
|
+
lines.push(`| Secondary | ${colors.secondary || ''} |`);
|
|
534
|
+
lines.push(`| CTA | ${colors.cta || ''} |`);
|
|
535
|
+
lines.push(`| Background | ${colors.background || ''} |`);
|
|
536
|
+
lines.push(`| Text | ${colors.text || ''} |`);
|
|
537
|
+
if (colors.notes) {
|
|
538
|
+
lines.push('');
|
|
539
|
+
lines.push(`*Notes: ${colors.notes}*`);
|
|
540
|
+
}
|
|
541
|
+
lines.push('');
|
|
542
|
+
|
|
543
|
+
// Typography section
|
|
544
|
+
lines.push('### Typography');
|
|
545
|
+
lines.push(`- **Heading:** ${typography.heading || ''}`);
|
|
546
|
+
lines.push(`- **Body:** ${typography.body || ''}`);
|
|
547
|
+
if (typography.mood) {
|
|
548
|
+
lines.push(`- **Mood:** ${typography.mood}`);
|
|
549
|
+
}
|
|
550
|
+
if (typography.best_for) {
|
|
551
|
+
lines.push(`- **Best For:** ${typography.best_for}`);
|
|
552
|
+
}
|
|
553
|
+
if (typography.google_fonts_url) {
|
|
554
|
+
lines.push(`- **Google Fonts:** ${typography.google_fonts_url}`);
|
|
555
|
+
}
|
|
556
|
+
if (typography.css_import) {
|
|
557
|
+
lines.push('- **CSS Import:**');
|
|
558
|
+
lines.push('```css');
|
|
559
|
+
lines.push(typography.css_import);
|
|
560
|
+
lines.push('```');
|
|
561
|
+
}
|
|
562
|
+
lines.push('');
|
|
563
|
+
|
|
564
|
+
// Key Effects section
|
|
565
|
+
if (effects) {
|
|
566
|
+
lines.push('### Key Effects');
|
|
567
|
+
lines.push(effects);
|
|
568
|
+
lines.push('');
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// Anti-patterns section
|
|
572
|
+
if (antiPatterns) {
|
|
573
|
+
lines.push('### Avoid (Anti-patterns)');
|
|
574
|
+
const antiList = antiPatterns.split('+').map(a => a.trim()).filter(a => a);
|
|
575
|
+
antiList.forEach(anti => {
|
|
576
|
+
lines.push(`- ${anti}`);
|
|
577
|
+
});
|
|
578
|
+
lines.push('');
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// Pre-Delivery Checklist section
|
|
582
|
+
lines.push('### Pre-Delivery Checklist');
|
|
583
|
+
lines.push('- [ ] No emojis as icons (use SVG: Heroicons/Lucide)');
|
|
584
|
+
lines.push('- [ ] cursor-pointer on all clickable elements');
|
|
585
|
+
lines.push('- [ ] Hover states with smooth transitions (150-300ms)');
|
|
586
|
+
lines.push('- [ ] Light mode: text contrast 4.5:1 minimum');
|
|
587
|
+
lines.push('- [ ] Focus states visible for keyboard nav');
|
|
588
|
+
lines.push('- [ ] prefers-reduced-motion respected');
|
|
589
|
+
lines.push('- [ ] Responsive: 375px, 768px, 1024px, 1440px');
|
|
590
|
+
lines.push('');
|
|
591
|
+
|
|
592
|
+
return lines.join('\n');
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// ============ MAIN ENTRY POINT ============
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Main entry point for design system generation
|
|
599
|
+
*/
|
|
600
|
+
export async function generateDesignSystem(
|
|
601
|
+
query,
|
|
602
|
+
projectName = null,
|
|
603
|
+
outputFormat = 'ascii',
|
|
604
|
+
persist = false,
|
|
605
|
+
page = null,
|
|
606
|
+
outputDir = null
|
|
607
|
+
) {
|
|
608
|
+
const generator = new DesignSystemGenerator();
|
|
609
|
+
const designSystem = await generator.generate(query, projectName);
|
|
610
|
+
|
|
611
|
+
// Persist to files if requested
|
|
612
|
+
if (persist) {
|
|
613
|
+
await persistDesignSystem(designSystem, page, outputDir, query);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
if (outputFormat === 'markdown') {
|
|
617
|
+
return formatMarkdown(designSystem);
|
|
618
|
+
}
|
|
619
|
+
return formatAsciiBox(designSystem);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// ============ ADVANCED PERSISTENCE FUNCTIONS ============
|
|
623
|
+
// Full implementation matching Python version (format_master_md + intelligent overrides)
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
import { generateTokenSystem } from './utils/css-templates.ts';
|
|
627
|
+
import { generateComponentSpecs } from './utils/component-specs.ts';
|
|
628
|
+
import { formatPageOverrideMd } from './utils/page-override-formatter.ts';
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Format design system as complete MASTER.md file with hierarchical override logic
|
|
632
|
+
* This is the full Python-equivalent implementation (260 LOC in Python)
|
|
633
|
+
* @param {Object} designSystem - Complete design system object
|
|
634
|
+
* @returns {string} Formatted MASTER.md content
|
|
635
|
+
*/
|
|
636
|
+
export function formatMasterMd(designSystem) {
|
|
637
|
+
const project = designSystem.project_name || 'PROJECT';
|
|
638
|
+
const pattern = designSystem.pattern || {};
|
|
639
|
+
const style = designSystem.style || {};
|
|
640
|
+
const colors = designSystem.colors || {};
|
|
641
|
+
const typography = designSystem.typography || {};
|
|
642
|
+
const effects = designSystem.key_effects || '';
|
|
643
|
+
const antiPatterns = designSystem.anti_patterns || '';
|
|
644
|
+
|
|
645
|
+
const timestamp = new Date().toISOString(); // Full ISO 8601 UTC format
|
|
646
|
+
|
|
647
|
+
const lines = [];
|
|
648
|
+
|
|
649
|
+
// Logic header - explains Master + Override pattern
|
|
650
|
+
lines.push('# Design System Master File');
|
|
651
|
+
lines.push('');
|
|
652
|
+
lines.push('> **LOGIC:** When building a specific page, first check `design-system/pages/[page-name].md`.');
|
|
653
|
+
lines.push('> If that file exists, its rules **override** this Master file.');
|
|
654
|
+
lines.push('> If not, strictly follow the rules below.');
|
|
655
|
+
lines.push('');
|
|
656
|
+
lines.push('---');
|
|
657
|
+
lines.push('');
|
|
658
|
+
lines.push(`**Project:** ${project}`);
|
|
659
|
+
lines.push(`**Generated:** ${timestamp}`);
|
|
660
|
+
lines.push(`**Category:** ${designSystem.category || 'General'}`);
|
|
661
|
+
lines.push('');
|
|
662
|
+
lines.push('---');
|
|
663
|
+
lines.push('');
|
|
664
|
+
|
|
665
|
+
// Global Rules section
|
|
666
|
+
lines.push('## Global Rules');
|
|
667
|
+
lines.push('');
|
|
668
|
+
|
|
669
|
+
// Color Palette with CSS variables
|
|
670
|
+
lines.push('### Color Palette');
|
|
671
|
+
lines.push('');
|
|
672
|
+
lines.push('| Role | Hex | CSS Variable |');
|
|
673
|
+
lines.push('|------|-----|--------------|');
|
|
674
|
+
lines.push(`| Primary | \`${colors.primary || '#2563EB'}\` | \`--color-primary\` |`);
|
|
675
|
+
lines.push(`| Secondary | \`${colors.secondary || '#3B82F6'}\` | \`--color-secondary\` |`);
|
|
676
|
+
lines.push(`| CTA/Accent | \`${colors.cta || '#F97316'}\` | \`--color-cta\` |`);
|
|
677
|
+
lines.push(`| Background | \`${colors.background || '#F8FAFC'}\` | \`--color-background\` |`);
|
|
678
|
+
lines.push(`| Text | \`${colors.text || '#1E293B'}\` | \`--color-text\` |`);
|
|
679
|
+
lines.push('');
|
|
680
|
+
if (colors.notes) {
|
|
681
|
+
lines.push(`**Color Notes:** ${colors.notes}`);
|
|
682
|
+
lines.push('');
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
// Typography
|
|
686
|
+
lines.push('### Typography');
|
|
687
|
+
lines.push('');
|
|
688
|
+
lines.push(`- **Heading Font:** ${typography.heading || 'Inter'}`);
|
|
689
|
+
lines.push(`- **Body Font:** ${typography.body || 'Inter'}`);
|
|
690
|
+
if (typography.mood) {
|
|
691
|
+
lines.push(`- **Mood:** ${typography.mood}`);
|
|
692
|
+
}
|
|
693
|
+
if (typography.google_fonts_url) {
|
|
694
|
+
lines.push(`- **Google Fonts:** [${typography.heading} + ${typography.body}](${typography.google_fonts_url})`);
|
|
695
|
+
}
|
|
696
|
+
lines.push('');
|
|
697
|
+
if (typography.css_import) {
|
|
698
|
+
lines.push('**CSS Import:**');
|
|
699
|
+
lines.push('```css');
|
|
700
|
+
lines.push(typography.css_import);
|
|
701
|
+
lines.push('```');
|
|
702
|
+
lines.push('');
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
// Spacing Variables
|
|
706
|
+
lines.push('### Spacing Variables');
|
|
707
|
+
lines.push('');
|
|
708
|
+
lines.push('| Token | Value | Usage |');
|
|
709
|
+
lines.push('|-------|-------|-------|');
|
|
710
|
+
lines.push('| `--space-xs` | `4px` / `0.25rem` | Tight gaps |');
|
|
711
|
+
lines.push('| `--space-sm` | `8px` / `0.5rem` | Icon gaps, inline spacing |');
|
|
712
|
+
lines.push('| `--space-md` | `16px` / `1rem` | Standard padding |');
|
|
713
|
+
lines.push('| `--space-lg` | `24px` / `1.5rem` | Section padding |');
|
|
714
|
+
lines.push('| `--space-xl` | `32px` / `2rem` | Large gaps |');
|
|
715
|
+
lines.push('| `--space-2xl` | `48px` / `3rem` | Section margins |');
|
|
716
|
+
lines.push('| `--space-3xl` | `64px` / `4rem` | Hero padding |');
|
|
717
|
+
lines.push('');
|
|
718
|
+
|
|
719
|
+
// Shadow Depths
|
|
720
|
+
lines.push('### Shadow Depths');
|
|
721
|
+
lines.push('');
|
|
722
|
+
lines.push('| Level | Value | Usage |');
|
|
723
|
+
lines.push('|-------|-------|-------|');
|
|
724
|
+
lines.push('| `--shadow-sm` | `0 1px 2px rgba(0,0,0,0.05)` | Subtle lift |');
|
|
725
|
+
lines.push('| `--shadow-md` | `0 4px 6px rgba(0,0,0,0.1)` | Cards, buttons |');
|
|
726
|
+
lines.push('| `--shadow-lg` | `0 10px 15px rgba(0,0,0,0.1)` | Modals, dropdowns |');
|
|
727
|
+
lines.push('| `--shadow-xl` | `0 20px 25px rgba(0,0,0,0.15)` | Hero images, featured cards |');
|
|
728
|
+
lines.push('');
|
|
729
|
+
|
|
730
|
+
// Component Specs section (using Phase 2 generators)
|
|
731
|
+
lines.push('---');
|
|
732
|
+
lines.push('');
|
|
733
|
+
lines.push('## Component Specs');
|
|
734
|
+
lines.push('');
|
|
735
|
+
|
|
736
|
+
// Buttons
|
|
737
|
+
lines.push('### Buttons');
|
|
738
|
+
lines.push('');
|
|
739
|
+
lines.push('```css');
|
|
740
|
+
lines.push('/* Primary Button */');
|
|
741
|
+
lines.push('.btn-primary {');
|
|
742
|
+
lines.push(` background: ${colors.cta || '#F97316'};`);
|
|
743
|
+
lines.push(' color: white;');
|
|
744
|
+
lines.push(' padding: 12px 24px;');
|
|
745
|
+
lines.push(' border-radius: 8px;');
|
|
746
|
+
lines.push(' font-weight: 600;');
|
|
747
|
+
lines.push(' transition: all 200ms ease;');
|
|
748
|
+
lines.push(' cursor: pointer;');
|
|
749
|
+
lines.push('}');
|
|
750
|
+
lines.push('');
|
|
751
|
+
lines.push('.btn-primary:hover {');
|
|
752
|
+
lines.push(' opacity: 0.9;');
|
|
753
|
+
lines.push(' transform: translateY(-1px);');
|
|
754
|
+
lines.push('}');
|
|
755
|
+
lines.push('');
|
|
756
|
+
lines.push('/* Secondary Button */');
|
|
757
|
+
lines.push('.btn-secondary {');
|
|
758
|
+
lines.push(' background: transparent;');
|
|
759
|
+
lines.push(` color: ${colors.primary || '#2563EB'};`);
|
|
760
|
+
lines.push(` border: 2px solid ${colors.primary || '#2563EB'};`);
|
|
761
|
+
lines.push(' padding: 12px 24px;');
|
|
762
|
+
lines.push(' border-radius: 8px;');
|
|
763
|
+
lines.push(' font-weight: 600;');
|
|
764
|
+
lines.push(' transition: all 200ms ease;');
|
|
765
|
+
lines.push(' cursor: pointer;');
|
|
766
|
+
lines.push('}');
|
|
767
|
+
lines.push('```');
|
|
768
|
+
lines.push('');
|
|
769
|
+
|
|
770
|
+
// Cards
|
|
771
|
+
lines.push('### Cards');
|
|
772
|
+
lines.push('');
|
|
773
|
+
lines.push('```css');
|
|
774
|
+
lines.push('.card {');
|
|
775
|
+
lines.push(` background: ${colors.background || '#FFFFFF'};`);
|
|
776
|
+
lines.push(' border-radius: 12px;');
|
|
777
|
+
lines.push(' padding: 24px;');
|
|
778
|
+
lines.push(' box-shadow: var(--shadow-md);');
|
|
779
|
+
lines.push(' transition: all 200ms ease;');
|
|
780
|
+
lines.push(' cursor: pointer;');
|
|
781
|
+
lines.push('}');
|
|
782
|
+
lines.push('');
|
|
783
|
+
lines.push('.card:hover {');
|
|
784
|
+
lines.push(' box-shadow: var(--shadow-lg);');
|
|
785
|
+
lines.push(' transform: translateY(-2px);');
|
|
786
|
+
lines.push('}');
|
|
787
|
+
lines.push('```');
|
|
788
|
+
lines.push('');
|
|
789
|
+
|
|
790
|
+
// Inputs
|
|
791
|
+
lines.push('### Inputs');
|
|
792
|
+
lines.push('');
|
|
793
|
+
lines.push('```css');
|
|
794
|
+
lines.push('.input {');
|
|
795
|
+
lines.push(' padding: 12px 16px;');
|
|
796
|
+
lines.push(' border: 1px solid #E2E8F0;');
|
|
797
|
+
lines.push(' border-radius: 8px;');
|
|
798
|
+
lines.push(' font-size: 16px;');
|
|
799
|
+
lines.push(' transition: border-color 200ms ease;');
|
|
800
|
+
lines.push('}');
|
|
801
|
+
lines.push('');
|
|
802
|
+
lines.push('.input:focus {');
|
|
803
|
+
lines.push(` border-color: ${colors.primary || '#2563EB'};`);
|
|
804
|
+
lines.push(' outline: none;');
|
|
805
|
+
lines.push(` box-shadow: 0 0 0 3px ${colors.primary || '#2563EB'}20;`);
|
|
806
|
+
lines.push('}');
|
|
807
|
+
lines.push('```');
|
|
808
|
+
lines.push('');
|
|
809
|
+
|
|
810
|
+
// Modals
|
|
811
|
+
lines.push('### Modals');
|
|
812
|
+
lines.push('');
|
|
813
|
+
lines.push('```css');
|
|
814
|
+
lines.push('.modal-overlay {');
|
|
815
|
+
lines.push(' background: rgba(0, 0, 0, 0.5);');
|
|
816
|
+
lines.push(' backdrop-filter: blur(4px);');
|
|
817
|
+
lines.push('}');
|
|
818
|
+
lines.push('');
|
|
819
|
+
lines.push('.modal {');
|
|
820
|
+
lines.push(' background: white;');
|
|
821
|
+
lines.push(' border-radius: 16px;');
|
|
822
|
+
lines.push(' padding: 32px;');
|
|
823
|
+
lines.push(' box-shadow: var(--shadow-xl);');
|
|
824
|
+
lines.push(' max-width: 500px;');
|
|
825
|
+
lines.push(' width: 90%;');
|
|
826
|
+
lines.push('}');
|
|
827
|
+
lines.push('```');
|
|
828
|
+
lines.push('');
|
|
829
|
+
|
|
830
|
+
// Style section
|
|
831
|
+
lines.push('---');
|
|
832
|
+
lines.push('');
|
|
833
|
+
lines.push('## Style Guidelines');
|
|
834
|
+
lines.push('');
|
|
835
|
+
lines.push(`**Style:** ${style.name || 'Minimalism'}`);
|
|
836
|
+
lines.push('');
|
|
837
|
+
if (style.keywords) {
|
|
838
|
+
lines.push(`**Keywords:** ${style.keywords}`);
|
|
839
|
+
lines.push('');
|
|
840
|
+
}
|
|
841
|
+
if (style.best_for) {
|
|
842
|
+
lines.push(`**Best For:** ${style.best_for}`);
|
|
843
|
+
lines.push('');
|
|
844
|
+
}
|
|
845
|
+
if (effects) {
|
|
846
|
+
lines.push(`**Key Effects:** ${effects}`);
|
|
847
|
+
lines.push('');
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
// Layout Pattern
|
|
851
|
+
lines.push('### Page Pattern');
|
|
852
|
+
lines.push('');
|
|
853
|
+
lines.push(`**Pattern Name:** ${pattern.name || ''}`);
|
|
854
|
+
lines.push('');
|
|
855
|
+
if (pattern.conversion) {
|
|
856
|
+
lines.push(`- **Conversion Strategy:** ${pattern.conversion}`);
|
|
857
|
+
}
|
|
858
|
+
if (pattern.cta_placement) {
|
|
859
|
+
lines.push(`- **CTA Placement:** ${pattern.cta_placement}`);
|
|
860
|
+
}
|
|
861
|
+
lines.push(`- **Section Order:** ${pattern.sections || ''}`);
|
|
862
|
+
lines.push('');
|
|
863
|
+
|
|
864
|
+
// Anti-Patterns section
|
|
865
|
+
lines.push('---');
|
|
866
|
+
lines.push('');
|
|
867
|
+
lines.push('## Anti-Patterns (Do NOT Use)');
|
|
868
|
+
lines.push('');
|
|
869
|
+
if (antiPatterns) {
|
|
870
|
+
const antiList = antiPatterns.split('+').map(a => a.trim()).filter(a => a);
|
|
871
|
+
antiList.forEach(anti => {
|
|
872
|
+
lines.push(`- ❌ ${anti}`);
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
lines.push('');
|
|
876
|
+
lines.push('### Additional Forbidden Patterns');
|
|
877
|
+
lines.push('');
|
|
878
|
+
lines.push('- ❌ **Emojis as icons** — Use SVG icons (Heroicons, Lucide, Simple Icons)');
|
|
879
|
+
lines.push('- ❌ **Missing cursor:pointer** — All clickable elements must have cursor:pointer');
|
|
880
|
+
lines.push('- ❌ **Layout-shifting hovers** — Avoid scale transforms that shift layout');
|
|
881
|
+
lines.push('- ❌ **Low contrast text** — Maintain 4.5:1 minimum contrast ratio');
|
|
882
|
+
lines.push('- ❌ **Instant state changes** — Always use transitions (150-300ms)');
|
|
883
|
+
lines.push('- ❌ **Invisible focus states** — Focus states must be visible for a11y');
|
|
884
|
+
lines.push('');
|
|
885
|
+
|
|
886
|
+
// Pre-Delivery Checklist
|
|
887
|
+
lines.push('---');
|
|
888
|
+
lines.push('');
|
|
889
|
+
lines.push('## Pre-Delivery Checklist');
|
|
890
|
+
lines.push('');
|
|
891
|
+
lines.push('Before delivering any UI code, verify:');
|
|
892
|
+
lines.push('');
|
|
893
|
+
lines.push('- [ ] No emojis used as icons (use SVG instead)');
|
|
894
|
+
lines.push('- [ ] All icons from consistent icon set (Heroicons/Lucide)');
|
|
895
|
+
lines.push('- [ ] `cursor-pointer` on all clickable elements');
|
|
896
|
+
lines.push('- [ ] Hover states with smooth transitions (150-300ms)');
|
|
897
|
+
lines.push('- [ ] Light mode: text contrast 4.5:1 minimum');
|
|
898
|
+
lines.push('- [ ] Focus states visible for keyboard navigation');
|
|
899
|
+
lines.push('- [ ] `prefers-reduced-motion` respected');
|
|
900
|
+
lines.push('- [ ] Responsive: 375px, 768px, 1024px, 1440px');
|
|
901
|
+
lines.push('- [ ] No content hidden behind fixed navbars');
|
|
902
|
+
lines.push('- [ ] No horizontal scroll on mobile');
|
|
903
|
+
lines.push('');
|
|
904
|
+
|
|
905
|
+
return lines.join('\n');
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* Persist design system to design-system/<project>/ folder
|
|
910
|
+
* Updated to use full formatMasterMd() instead of simplified version
|
|
911
|
+
*/
|
|
912
|
+
export async function persistDesignSystem(
|
|
913
|
+
designSystem,
|
|
914
|
+
page = null,
|
|
915
|
+
outputDir = null,
|
|
916
|
+
pageQuery = null
|
|
917
|
+
) {
|
|
918
|
+
const baseDir = outputDir || process.cwd();
|
|
919
|
+
|
|
920
|
+
// Use project name for project-specific folder
|
|
921
|
+
const projectName = designSystem.project_name || 'default';
|
|
922
|
+
const projectSlug = projectName.toLowerCase().replace(/\s+/g, '-');
|
|
923
|
+
|
|
924
|
+
const designSystemDir = join(baseDir, 'design-system', projectSlug);
|
|
925
|
+
const pagesDir = join(designSystemDir, 'pages');
|
|
926
|
+
|
|
927
|
+
const createdFiles = [];
|
|
928
|
+
|
|
929
|
+
// Create directories
|
|
930
|
+
await mkdir(designSystemDir, { recursive: true });
|
|
931
|
+
await mkdir(pagesDir, { recursive: true });
|
|
932
|
+
|
|
933
|
+
const masterFile = join(designSystemDir, 'MASTER.md');
|
|
934
|
+
|
|
935
|
+
// Generate and write MASTER.md (now using full formatter)
|
|
936
|
+
const masterContent = formatMasterMd(designSystem);
|
|
937
|
+
await writeFile(masterFile, masterContent, 'utf-8');
|
|
938
|
+
createdFiles.push(masterFile);
|
|
939
|
+
|
|
940
|
+
// If page is specified, create intelligent page override file
|
|
941
|
+
if (page) {
|
|
942
|
+
const pageFile = join(pagesDir, `${page.toLowerCase().replace(/\s+/g, '-')}.md`);
|
|
943
|
+
const pageContent = await formatPageOverrideMd(designSystem, page, pageQuery);
|
|
944
|
+
await writeFile(pageFile, pageContent, 'utf-8');
|
|
945
|
+
createdFiles.push(pageFile);
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
return {
|
|
949
|
+
status: 'success',
|
|
950
|
+
design_system_dir: designSystemDir,
|
|
951
|
+
created_files: createdFiles
|
|
952
|
+
};
|
|
953
|
+
}
|