@bovinphang/frontend-craft 2.5.0 → 2.7.0

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.
Files changed (156) hide show
  1. package/.claude-plugin/marketplace.json +7 -3
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +77 -1
  4. package/CHANGELOG.zh-CN.md +77 -1
  5. package/CONTRIBUTING.md +15 -10
  6. package/CONTRIBUTING.zh-CN.md +15 -10
  7. package/README.md +69 -43
  8. package/README.openclaw.md +11 -9
  9. package/README.openclaw.zh-CN.md +11 -9
  10. package/README.zh-CN.md +69 -43
  11. package/agents/fec-typescript-reviewer.md +1 -1
  12. package/commands/fec-doc-sync.md +7 -6
  13. package/dist/bin/frontend-craft.js +30 -27
  14. package/docs/example-prompts.md +82 -69
  15. package/docs/ja-JP/README.md +110 -84
  16. package/docs/ko-KR/README.md +100 -74
  17. package/docs/project-structure.md +8 -4
  18. package/docs/runtimes/antigravity.md +1 -1
  19. package/docs/runtimes/augment.md +1 -1
  20. package/docs/runtimes/claude.md +16 -10
  21. package/docs/runtimes/claude.zh-CN.md +16 -10
  22. package/docs/runtimes/cline.md +1 -1
  23. package/docs/runtimes/codebuddy.md +1 -1
  24. package/docs/runtimes/codex.md +1 -1
  25. package/docs/runtimes/copilot.md +1 -1
  26. package/docs/runtimes/cursor.md +1 -1
  27. package/docs/runtimes/gemini.md +1 -1
  28. package/docs/runtimes/kilo.md +1 -1
  29. package/docs/runtimes/openclaw.md +1 -1
  30. package/docs/runtimes/opencode.md +1 -1
  31. package/docs/runtimes/qoder.md +1 -1
  32. package/docs/runtimes/trae.md +1 -1
  33. package/docs/runtimes/windsurf.md +1 -1
  34. package/docs/zh-CN/example-prompts.md +82 -69
  35. package/docs/zh-CN/project-structure.md +8 -4
  36. package/docs/zh-TW/README.md +88 -62
  37. package/openclaw.plugin.json +1 -1
  38. package/package.json +3 -3
  39. package/skills/eval_queries.json +179 -56
  40. package/skills/fec-accessibility-check/SKILL.md +1 -1
  41. package/skills/fec-alchemy/SKILL.md +74 -0
  42. package/skills/fec-alchemy/assets/absorption-plan-template.md +47 -0
  43. package/skills/fec-alchemy/assets/intake-template.md +55 -0
  44. package/skills/fec-alchemy/assets/review-checklist.md +31 -0
  45. package/skills/fec-alchemy/references/methodology.md +94 -0
  46. package/skills/fec-alchemy/references/originality-and-licensing.md +57 -0
  47. package/skills/fec-backend-requirements-handoff/SKILL.md +45 -0
  48. package/skills/fec-browser-storage/SKILL.md +1 -1
  49. package/skills/fec-canvas-threejs/SKILL.md +1 -1
  50. package/skills/fec-code-review/SKILL.md +11 -3
  51. package/skills/fec-data-fetching/SKILL.md +15 -15
  52. package/skills/fec-data-fetching/references/query-patterns.md +27 -1
  53. package/skills/fec-debug-framework/SKILL.md +14 -19
  54. package/skills/fec-debug-framework/references/report-template.md +58 -0
  55. package/skills/fec-doc-sync/SKILL.md +19 -17
  56. package/skills/fec-drawio-studio/SKILL.md +69 -0
  57. package/skills/fec-drawio-studio/data/THIRD_PARTY_NOTICES.md +10 -0
  58. package/skills/fec-drawio-studio/data/brand-icons.json +878 -0
  59. package/skills/fec-drawio-studio/data/shape-index.json.gz +0 -0
  60. package/skills/fec-drawio-studio/references/data-residency.md +27 -0
  61. package/skills/fec-drawio-studio/references/diagram-patterns.md +41 -0
  62. package/skills/fec-drawio-studio/references/layout-and-export.md +57 -0
  63. package/skills/fec-drawio-studio/references/troubleshooting.md +29 -0
  64. package/skills/fec-drawio-studio/references/xml-and-mermaid.md +54 -0
  65. package/skills/fec-drawio-studio/scripts/brand-symbols.mjs +99 -0
  66. package/skills/fec-drawio-studio/scripts/diagram-lint.mjs +143 -0
  67. package/skills/fec-drawio-studio/scripts/diagram-url.mjs +102 -0
  68. package/skills/fec-drawio-studio/scripts/layout-graph.mjs +107 -0
  69. package/skills/fec-drawio-studio/scripts/png-embed-fix.mjs +26 -0
  70. package/skills/fec-drawio-studio/scripts/scan-go-packages.mjs +36 -0
  71. package/skills/fec-drawio-studio/scripts/scan-js-modules.mjs +52 -0
  72. package/skills/fec-drawio-studio/scripts/scan-python-classes.mjs +30 -0
  73. package/skills/fec-drawio-studio/scripts/scan-python-modules.mjs +55 -0
  74. package/skills/fec-drawio-studio/scripts/scan-rust-modules.mjs +35 -0
  75. package/skills/fec-drawio-studio/scripts/scan-ts-modules.mjs +7 -0
  76. package/skills/fec-drawio-studio/scripts/shape-query.mjs +81 -0
  77. package/skills/fec-drawio-studio/scripts/studio-core.mjs +139 -0
  78. package/skills/fec-drawio-studio/styles/built-in/corporate.json +49 -0
  79. package/skills/fec-drawio-studio/styles/built-in/default.json +49 -0
  80. package/skills/fec-drawio-studio/styles/built-in/handdrawn.json +49 -0
  81. package/skills/fec-drawio-studio/styles/schema.json +112 -0
  82. package/skills/fec-e2e-testing/SKILL.md +5 -3
  83. package/skills/fec-e2e-testing/references/e2e-ci-reporting.md +62 -0
  84. package/skills/fec-e2e-testing/references/e2e-special-scenarios.md +52 -0
  85. package/skills/fec-e2e-testing/references/e2e-visual-regression.md +60 -0
  86. package/skills/fec-form-handling/SKILL.md +11 -11
  87. package/skills/fec-form-handling/references/advanced-form-patterns.md +34 -5
  88. package/skills/fec-image-generation/SKILL.md +56 -0
  89. package/skills/fec-image-generation/references/artifact-routing.md +80 -0
  90. package/skills/fec-image-generation/references/diagram-workflows.md +43 -0
  91. package/skills/fec-image-generation/references/png-qa-autofix.md +30 -0
  92. package/skills/fec-image-generation/scripts/png-qa.mjs +431 -0
  93. package/skills/fec-implement-from-design/SKILL.md +9 -2
  94. package/skills/fec-legacy-to-modern-migration/SKILL.md +29 -163
  95. package/skills/fec-legacy-to-modern-migration/references/migration-execution-checklist.md +110 -0
  96. package/skills/fec-legacy-to-modern-migration/references/migration-strategy-and-mapping.md +48 -0
  97. package/skills/fec-legacy-web-standard/SKILL.md +1 -1
  98. package/skills/fec-list-virtualization/SKILL.md +3 -3
  99. package/skills/fec-list-virtualization/references/virtualization-patterns.md +32 -4
  100. package/skills/fec-motion-interaction/SKILL.md +7 -0
  101. package/skills/fec-nextjs-project-standard/SKILL.md +7 -1
  102. package/skills/fec-performance-optimization/SKILL.md +9 -1
  103. package/skills/fec-performance-optimization/references/framework-performance-patterns.md +38 -0
  104. package/skills/fec-performance-optimization/references/report-template.md +59 -0
  105. package/skills/fec-pwa-implementation/SKILL.md +3 -4
  106. package/skills/fec-react-project-standard/SKILL.md +12 -4
  107. package/skills/fec-react-project-standard/references/react-performance-patterns.md +35 -0
  108. package/skills/fec-react-project-standard/references/react-project-structure.md +197 -0
  109. package/skills/fec-react-project-standard/references/react-quality-patterns.md +131 -0
  110. package/skills/fec-react-project-standard/references/react-runtime-patterns.md +293 -0
  111. package/skills/fec-refactor-clean/SKILL.md +4 -1
  112. package/skills/fec-refactor-clean/references/report-template.md +42 -0
  113. package/skills/fec-responsive-layout/references/responsive-layout-patterns.md +11 -0
  114. package/skills/fec-security-review/SKILL.md +3 -3
  115. package/skills/fec-source-driven-development/SKILL.md +26 -0
  116. package/skills/fec-state-management/SKILL.md +1 -1
  117. package/skills/fec-storybook-component-doc/SKILL.md +2 -2
  118. package/skills/fec-tailwind-design-system/references/tailwind-system-patterns.md +5 -1
  119. package/skills/fec-typescript-project-standard/SKILL.md +54 -0
  120. package/skills/{fec-typescript-type-safety → fec-typescript-project-standard}/references/type-safety-patterns.md +1 -1
  121. package/skills/{fec-typescript-type-safety/SKILL.md → fec-typescript-project-standard/references/type-safety.md} +1 -10
  122. package/skills/fec-ui-design/SKILL.md +26 -8
  123. package/skills/fec-ui-design/data/style-archetypes.json +40 -0
  124. package/skills/fec-ui-design/data/ux-quality-rules.json +35 -0
  125. package/skills/fec-ui-design/references/design-intelligence.md +66 -6
  126. package/skills/fec-ui-design/references/pre-delivery-checklist.md +6 -0
  127. package/skills/fec-ui-design/scripts/design-system.mjs +119 -1
  128. package/skills/fec-validation-fix/SKILL.md +5 -2
  129. package/skills/fec-validation-fix/references/report-template.md +43 -0
  130. package/skills/fec-vue3-project-standard/SKILL.md +12 -3
  131. package/skills/fec-vue3-project-standard/references/vue3-composables-routing.md +163 -0
  132. package/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md +13 -0
  133. package/skills/fec-vue3-project-standard/references/vue3-project-structure.md +177 -0
  134. package/skills/fec-vue3-project-standard/references/vue3-state-api-quality.md +216 -0
  135. package/skills/fec-web-video-presentation/SKILL.md +61 -0
  136. package/skills/fec-web-video-presentation/data/starter-themes.json +59 -0
  137. package/skills/fec-web-video-presentation/references/chapter-craft.md +37 -0
  138. package/skills/fec-web-video-presentation/references/content-plan.md +38 -0
  139. package/skills/fec-web-video-presentation/references/recording-and-audio.md +33 -0
  140. package/skills/fec-web-video-presentation/references/theme-system.md +36 -0
  141. package/skills/fec-web-video-presentation/scripts/create-video-presentation.mjs +430 -0
  142. package/skills/fec-web-workers/SKILL.md +3 -4
  143. package/skills/metadata.json +381 -168
  144. package/skills/relations.json +136 -25
  145. package/templates/shared/rules/fec-ci-cd.md +20 -108
  146. package/templates/shared/rules/fec-design-system.md +47 -223
  147. package/templates/shared/rules/fec-error-handling.md +35 -179
  148. package/templates/shared/rules/fec-i18n.md +43 -91
  149. package/templates/shared/rules/fec-refactoring.md +4 -0
  150. package/templates/shared/rules/fec-rendering-patterns.md +28 -171
  151. package/templates/shared/rules/fec-responsive-design.md +34 -211
  152. package/templates/shared/rules/fec-state-management.md +41 -144
  153. package/templates/shared/rules/fec-typescript.md +47 -290
  154. package/skills/fec-e2e-testing/references/e2e-advanced.md +0 -176
  155. package/skills/fec-react-project-standard/references/react-project-details.md +0 -642
  156. package/skills/fec-vue3-project-standard/references/vue3-project-details.md +0 -547
@@ -1,11 +1,31 @@
1
1
  {
2
+ "fec-alchemy": {
3
+ "relatedSkills": [
4
+ "fec-source-driven-development",
5
+ "fec-doc-sync",
6
+ "fec-refactor-clean",
7
+ "fec-code-review",
8
+ "fec-testing-strategy"
9
+ ],
10
+ "boundaryWorkflows": [
11
+ "Use source-driven development when reference behavior depends on official docs, version-sensitive APIs, or project facts.",
12
+ "Use documentation sync when absorbed capabilities change public docs, runtime docs, metadata, or published capability tables.",
13
+ "Use refactor clean when the absorption work first requires removing proven dead code, duplicate modules, or unused dependencies."
14
+ ],
15
+ "capabilityTags": [
16
+ "project-absorption",
17
+ "originality",
18
+ "reference-analysis",
19
+ "workflow"
20
+ ]
21
+ },
2
22
  "fec-api-integration": {
3
23
  "relatedSkills": [
4
24
  "fec-data-fetching",
5
25
  "fec-security-review",
6
26
  "fec-route-protection",
7
27
  "fec-form-handling",
8
- "fec-typescript-type-safety",
28
+ "fec-typescript-project-standard",
9
29
  "fec-source-driven-development"
10
30
  ],
11
31
  "boundaryWorkflows": [
@@ -21,6 +41,26 @@
21
41
  "realtime"
22
42
  ]
23
43
  },
44
+ "fec-backend-requirements-handoff": {
45
+ "relatedSkills": [
46
+ "fec-api-integration",
47
+ "fec-doc-sync",
48
+ "fec-source-driven-development",
49
+ "fec-testing-strategy",
50
+ "fec-route-protection"
51
+ ],
52
+ "boundaryWorkflows": [
53
+ "Use API integration when the contract shape, typed client, auth refresh, error mapping, upload, or realtime implementation is being designed.",
54
+ "Use documentation sync when backend decisions change public docs, API notes, route docs, or env/config documentation.",
55
+ "Use route protection when the handoff centers on auth redirects, RBAC, permission routes, or middleware behavior."
56
+ ],
57
+ "capabilityTags": [
58
+ "backend-requirements",
59
+ "handoff",
60
+ "api-collaboration",
61
+ "data-needs"
62
+ ]
63
+ },
24
64
  "fec-browser-storage": {
25
65
  "relatedSkills": [
26
66
  "fec-security-review",
@@ -65,7 +105,7 @@
65
105
  "fec-e2e-testing",
66
106
  "fec-validation-fix",
67
107
  "fec-performance-optimization",
68
- "fec-typescript-type-safety",
108
+ "fec-typescript-project-standard",
69
109
  "fec-state-management",
70
110
  "fec-source-driven-development",
71
111
  "fec-dependency-upgrade",
@@ -154,6 +194,27 @@
154
194
  "migration"
155
195
  ]
156
196
  },
197
+ "fec-drawio-studio": {
198
+ "relatedSkills": [
199
+ "fec-image-generation",
200
+ "fec-canvas-threejs",
201
+ "fec-svg-animation",
202
+ "fec-ui-design",
203
+ "fec-source-driven-development"
204
+ ],
205
+ "boundaryWorkflows": [
206
+ "Use image generation for raster-first posters, visual concepts, product images, and PNG QA beyond editable technical diagrams.",
207
+ "Use Canvas/Three.js when the diagram becomes an interactive runtime visualization, simulation, game scene, shader, or 3D renderer.",
208
+ "Use SVG animation for motion-specific vector micro-interactions; use drawio studio for static or editable technical SVG exports."
209
+ ],
210
+ "capabilityTags": [
211
+ "drawio",
212
+ "editable-diagram",
213
+ "autolayout",
214
+ "shape-search",
215
+ "code-structure-map"
216
+ ]
217
+ },
157
218
  "fec-e2e-testing": {
158
219
  "relatedSkills": [
159
220
  "fec-testing-strategy",
@@ -190,6 +251,30 @@
190
251
  "accessibility"
191
252
  ]
192
253
  },
254
+ "fec-image-generation": {
255
+ "relatedSkills": [
256
+ "fec-ui-design",
257
+ "fec-implement-from-design",
258
+ "fec-canvas-threejs",
259
+ "fec-svg-animation",
260
+ "fec-responsive-layout",
261
+ "fec-accessibility-check",
262
+ "fec-web-video-presentation"
263
+ ],
264
+ "boundaryWorkflows": [
265
+ "Use UI design for product-specific visual direction, brand tone, hierarchy, and visual QA of generated assets.",
266
+ "Use implementation-from-design when a Figma, Sketch, MasterGo, Pixso, screenshot, or other external design source is authoritative.",
267
+ "Use Canvas/Three.js or SVG animation workflows when the generated visual becomes an interactive renderer, shader, or motion asset rather than a static image."
268
+ ],
269
+ "capabilityTags": [
270
+ "image-generation",
271
+ "image-editing",
272
+ "diagram-generation",
273
+ "png-qa",
274
+ "visual-assets",
275
+ "autofix"
276
+ ]
277
+ },
193
278
  "fec-legacy-to-modern-migration": {
194
279
  "relatedSkills": [
195
280
  "fec-legacy-web-standard",
@@ -336,7 +421,7 @@
336
421
  },
337
422
  "fec-react-project-standard": {
338
423
  "relatedSkills": [
339
- "fec-typescript-type-safety",
424
+ "fec-typescript-project-standard",
340
425
  "fec-state-management",
341
426
  "fec-tailwind-design-system",
342
427
  "fec-responsive-layout",
@@ -510,26 +595,6 @@
510
595
  "workflow"
511
596
  ]
512
597
  },
513
- "fec-typescript-type-safety": {
514
- "relatedSkills": [
515
- "fec-code-review",
516
- "fec-api-integration",
517
- "fec-react-project-standard",
518
- "fec-vue3-project-standard",
519
- "fec-form-handling"
520
- ],
521
- "boundaryWorkflows": [
522
- "Use a general code review workflow when the task spans architecture, rendering, styles, tests, and maintainability beyond type contracts.",
523
- "Use an API integration workflow for runtime API client boundaries, auth refresh, uploads, realtime behavior, and error mapping.",
524
- "Use framework project workflows when type decisions are part of broader React, Vue, Next.js, or Nuxt module architecture."
525
- ],
526
- "capabilityTags": [
527
- "typescript",
528
- "type-safety",
529
- "type-modeling",
530
- "dto"
531
- ]
532
- },
533
598
  "fec-testing-strategy": {
534
599
  "relatedSkills": [
535
600
  "fec-component-testing",
@@ -550,14 +615,39 @@
550
615
  "quality-gate"
551
616
  ]
552
617
  },
618
+ "fec-typescript-project-standard": {
619
+ "relatedSkills": [
620
+ "fec-code-review",
621
+ "fec-api-integration",
622
+ "fec-react-project-standard",
623
+ "fec-vue3-project-standard",
624
+ "fec-vite-project-standard",
625
+ "fec-monorepo-project-standard",
626
+ "fec-validation-fix"
627
+ ],
628
+ "boundaryWorkflows": [
629
+ "Use framework project workflows for component architecture, routing, state ownership, and framework-specific module boundaries.",
630
+ "Use API integration when runtime API clients, auth refresh, uploads, realtime behavior, or error mapping go beyond TypeScript type contracts.",
631
+ "Use validation fix when the task is to repair concrete lint, typecheck, test, build, or CI failures after TypeScript changes."
632
+ ],
633
+ "capabilityTags": [
634
+ "typescript",
635
+ "project-standard",
636
+ "type-safety",
637
+ "tsconfig",
638
+ "declarations"
639
+ ]
640
+ },
553
641
  "fec-ui-design": {
554
642
  "relatedSkills": [
643
+ "fec-image-generation",
555
644
  "fec-implement-from-design",
556
645
  "fec-accessibility-check",
557
646
  "fec-code-review",
558
647
  "fec-tailwind-design-system",
559
648
  "fec-responsive-layout",
560
- "fec-storybook-component-doc"
649
+ "fec-storybook-component-doc",
650
+ "fec-web-video-presentation"
561
651
  ],
562
652
  "boundaryWorkflows": [
563
653
  "Use an implementation-from-design workflow when an external design file is the source of truth.",
@@ -600,7 +690,7 @@
600
690
  },
601
691
  "fec-vue3-project-standard": {
602
692
  "relatedSkills": [
603
- "fec-typescript-type-safety",
693
+ "fec-typescript-project-standard",
604
694
  "fec-state-management",
605
695
  "fec-tailwind-design-system",
606
696
  "fec-responsive-layout",
@@ -624,6 +714,27 @@
624
714
  "fec-architecture"
625
715
  ]
626
716
  },
717
+ "fec-web-video-presentation": {
718
+ "relatedSkills": [
719
+ "fec-ui-design",
720
+ "fec-image-generation",
721
+ "fec-motion-interaction",
722
+ "fec-responsive-layout",
723
+ "fec-accessibility-check"
724
+ ],
725
+ "boundaryWorkflows": [
726
+ "Use a UI design workflow for product-specific visual direction, asset strategy, anti-generic design, and visual QA of scenes.",
727
+ "Use image generation when the presentation needs custom raster assets, diagrams, storyboard frames, or generated visual references.",
728
+ "Use motion and responsive layout workflows when scene transitions, reduced-motion behavior, viewport scaling, or recording stability need deeper treatment."
729
+ ],
730
+ "capabilityTags": [
731
+ "web-video",
732
+ "presentation",
733
+ "recording",
734
+ "script-outline",
735
+ "step-driven-stage"
736
+ ]
737
+ },
627
738
  "fec-web-workers": {
628
739
  "relatedSkills": [
629
740
  "fec-canvas-threejs",
@@ -1,128 +1,40 @@
1
1
  # CI/CD 规则
2
2
 
3
- 本文件约定持续集成与部署流水线的结构与行为。
3
+ 本文件约定持续集成与部署流水线的常驻结构与门禁。具体 GitHub Actions、GitLab CI、云平台或 monorepo pipeline 写法,应按项目现有 CI 模板实现,不在本规则中复制长 YAML。
4
4
 
5
5
  ## 流水线阶段
6
6
 
7
7
  建议顺序:
8
8
 
9
- 1. **安装依赖** — `npm ci` 或 `pnpm install --frozen-lockfile`
10
- 2. **Lint** — ESLint、Stylelint
11
- 3. **类型检查** — `tsc --noEmit`
12
- 4. **单元测试** — Jest / Vitest
13
- 5. **构建** — `npm run build` 或 `pnpm build`
14
- 6. **包体/性能预算**(可选)— size-limit、Lighthouse CI、bundle analyzer
15
- 7. **依赖与供应链检查**(可选)— audit、license、lockfile diff、依赖升级验证
16
- 8. **E2E 测试**(可选)— Playwright / Cypress
17
- 9. **部署** — 构建产物上传或触发部署服务
9
+ 1. **安装依赖**:使用锁文件安装,例如 `npm ci` 或 `pnpm install --frozen-lockfile`。
10
+ 2. **Lint / Format 检查**:ESLint、Stylelint、Prettier check 或项目等价命令。
11
+ 3. **类型检查**:`tsc --noEmit` 或项目 typecheck 脚本。
12
+ 4. **单元 / 组件测试**:Jest、Vitest、Testing Library、Vue Test Utils 等。
13
+ 5. **构建**:项目生产构建命令。
14
+ 6. **专项质量门禁**:包体、Lighthouse、依赖安全、license、a11y、视觉回归、E2E,按风险启用。
15
+ 7. **部署**:仅在前序门禁通过后上传产物或触发部署。
18
16
 
19
- 任一阶段失败则中止后续步骤。
20
-
21
- ## GitHub Actions 示例
22
-
23
- ```yaml
24
- name: CI
25
-
26
- on:
27
- push:
28
- branches: [main, develop]
29
- pull_request:
30
- branches: [main, develop]
31
-
32
- jobs:
33
- ci:
34
- runs-on: ubuntu-latest
35
- steps:
36
- - uses: actions/checkout@v4
37
-
38
- - uses: pnpm/action-setup@v2
39
- with:
40
- version: 8
41
-
42
- - uses: actions/setup-node@v4
43
- with:
44
- node-version: '20'
45
- cache: 'pnpm'
46
-
47
- - run: pnpm install --frozen-lockfile
48
- - run: pnpm run lint
49
- - run: pnpm run typecheck
50
- - run: pnpm run test
51
- - run: pnpm run build
52
-
53
- - name: Upload build
54
- if: success() && github.ref == 'refs/heads/main'
55
- uses: actions/upload-artifact@v4
56
- with:
57
- name: dist
58
- path: dist/
59
- ```
60
-
61
- ## GitLab CI 示例
62
-
63
- ```yaml
64
- stages:
65
- - install
66
- - lint
67
- - test
68
- - build
69
- - deploy
70
-
71
- variables:
72
- PNPM_VERSION: "8"
73
-
74
- install:
75
- stage: install
76
- script:
77
- - corepack enable pnpm
78
- - pnpm install --frozen-lockfile
79
- cache:
80
- key: ${CI_COMMIT_REF_SLUG}
81
- paths:
82
- - node_modules/
83
- - .pnpm-store/
84
-
85
- lint:
86
- stage: lint
87
- script:
88
- - pnpm run lint
89
- - pnpm run typecheck
90
- needs: [install]
91
-
92
- test:
93
- stage: test
94
- script:
95
- - pnpm run test
96
- needs: [install]
97
-
98
- build:
99
- stage: build
100
- script:
101
- - pnpm run build
102
- artifacts:
103
- paths:
104
- - dist/
105
- needs: [lint, test]
106
- ```
17
+ 任一必需阶段失败都应中止后续步骤。
107
18
 
108
19
  ## 环境变量与密钥
109
20
 
110
- - 敏感信息使用 CI 平台的 Secrets,不写入仓库
111
- - 构建时注入 `VITE_*` / `NEXT_PUBLIC_*` 等前端环境变量
112
- - E2E 的 baseURL、测试账号等从 Secrets 读取
113
- - 只允许公开前缀的环境变量进入客户端 bundle;服务端密钥不得使用 `VITE_*` / `NEXT_PUBLIC_*`
21
+ - 敏感信息使用 CI 平台 Secrets,不写入仓库、日志或构建产物。
22
+ - 只允许公开前缀的环境变量进入客户端 bundle,例如 `VITE_*`、`NEXT_PUBLIC_*` 等;服务端密钥不得使用公开前缀。
23
+ - E2E 的 baseURL、测试账号、第三方 token 等从 Secrets 或受控测试环境读取。
24
+ - CI 日志要避免打印完整环境变量、请求 header、token 或私密配置。
114
25
 
115
26
  ## 产物与证据
116
27
 
117
- - 上传测试报告、覆盖率、E2E trace、截图、构建产物和性能预算结果。
28
+ - 上传或保留测试报告、覆盖率、E2E trace、截图、构建产物、包体报告和性能预算结果。
118
29
  - CI 失败时保留足够日志定位根因,不只返回“命令失败”。
119
- - 发布前确认版本、变更说明、迁移事项和回滚路径。
30
+ - 发布前确认版本、变更说明、迁移事项、回滚路径和影响范围。
120
31
  - 依赖升级 PR 保留 lockfile diff、关键包版本、release notes 摘要和验证矩阵。
121
32
  - Monorepo affected 快速验证可以用于 PR 反馈,但 release 或主干合并前应保留全量验证入口。
122
33
 
123
34
  ## 强约束
124
35
 
125
- - 使用锁文件(`package-lock.json`、`pnpm-lock.yaml`),禁止 `npm install` 无锁安装
126
- - 构建产物不提交到仓库,由 CI 生成并上传
127
- - 部署前必须通过 lint、typecheck、test、build
128
- - 不跳过失败门禁直接部署,除非有明确风险接受和回滚方案
36
+ - 使用并提交锁文件,禁止无锁安装。
37
+ - 构建产物不提交到源码仓库,由 CI 生成并上传。
38
+ - 部署前必须通过项目定义的 lint、typecheck、test、build。
39
+ - 不跳过失败门禁直接部署,除非有明确风险接受、审批记录和回滚方案。
40
+ - CI 配置应复用项目已有命令,不在流水线里发明与本地不同的替代命令。
@@ -1,248 +1,72 @@
1
1
  # 设计系统规则
2
2
 
3
- 凡是任务涉及 UI 实现、设计稿转代码、样式、设计 Token 或组件复用时,都应用本文件。
3
+ 凡是任务涉及 UI 实现、设计稿转代码、样式、设计 Token 或组件复用时,都应用本文件。本文只保留项目常驻设计约束;产品化设计方向、设计系统生成、页面级 override、UI QA 细节交给 `fec-ui-design`;Tailwind token、variant、dark mode 和 class 治理交给 `fec-tailwind-design-system`;响应式布局交给 `fec-responsive-layout`。
4
4
 
5
5
  ## 核心优先级
6
6
 
7
- 按以下顺序优先处理:
8
-
9
- 1. 复用已有组件
10
- 2. 在已有组件上扩展
11
- 3. 创建新的叶子组件
12
- 4. 只有在理由非常充分时,才创建新的共享基础组件
7
+ 1. 复用已有组件。
8
+ 2. 在已有组件上扩展。
9
+ 3. 创建新的叶子组件。
10
+ 4. 只有在理由充分、边界清晰且会被复用时,才创建新的共享基础组件。
13
11
 
14
12
  ## 产品化设计方向
15
13
 
16
- 开始 UI 实现前,先明确界面语气:
17
-
18
- - 工具型页面、SaaS 后台、CRM、运营台:优先安静、密集、可扫描,首屏直接呈现核心工作区
19
- - 品牌页、作品集、发布页:可以更有表现力,但 H1 应是品牌/产品/对象/品类,说明文案放在副标题
20
- - 可视化、游戏、创作工具:可以使用更强视觉资产和动效,但必须保持交互可控、状态清晰
21
- - 每个重要界面都应有一个贴合业务的视觉锚点:真实媒体、数据形态、行业材质、字体性格、空间组织或交互节奏
22
- - 大胆设计必须服务场景;高频工具重效率和稳定,展示型页面重主体识别和记忆点
14
+ - 工具型页面、SaaS 后台、CRM、运营台:优先安静、密集、可扫描,首屏直接呈现核心工作区。
15
+ - 品牌页、作品集、发布页:可以更有表现力,但 H1 应是品牌、产品、对象或品类,说明文案放在副标题。
16
+ - 可视化、游戏、创作工具:可以使用更强视觉资产和动效,但必须保持交互可控、状态清晰。
17
+ - 每个重要界面都应有贴合业务的视觉锚点,例如真实媒体、数据形态、行业材质、字体性格、空间组织或交互节奏。
18
+ - 大胆设计必须服务场景;高频工具重效率和稳定,展示型页面重主体识别和记忆点。
23
19
 
24
20
  避免:
25
21
 
26
- - 把日常高频工具做成营销落地页
27
- - 默认使用紫色渐变、装饰光斑、堆叠卡片或空泛 hero
28
- - 使用无语境默认字体、平均分布的弱对比配色、模板化双栏 hero 或重复圆角卡片作为通用答案
29
- - 页面区块大面积卡片化,尤其是卡片套卡片
30
- - 用可见说明文字解释常见控件本该表达的功能
31
- - 让整个界面只由一个色相的深浅变化组成
22
+ - 把日常高频工具做成营销落地页。
23
+ - 默认使用紫色渐变、装饰光斑、堆叠卡片、空泛 hero 或无语境默认字体。
24
+ - 页面区块大面积卡片化,尤其是卡片套卡片。
25
+ - 用可见说明文字解释常见控件本该表达的功能。
26
+ - 让整个界面只由一个色相的深浅变化组成。
32
27
 
33
- ### 视觉语言基线
28
+ ## 设计稿转代码规则
34
29
 
35
- - 字体:优先复用项目字体体系;新建方向时,标题和正文应形成性格与可读性的分工
36
- - 色彩:区分主色、强调色、状态色和中性色,关键动作与风险状态不能只靠透明度表达
37
- - 动效:只为入场、层级展开、状态确认、错误反馈和重点引导编排节奏,并尊重 `prefers-reduced-motion`
38
- - 空间:根据任务选择高密度、留白、非对称、分栏、画布式或编辑器式布局,不套用固定卡片模板
39
- - 质感:背景、纹理、阴影和透明度应解释层级或语境,不作为无内容装饰
30
+ - 有设计上下文时,先通过 MCP 或截图/标注读取事实来源,不靠猜测决定布局、间距、字体、颜色或状态。
31
+ - 设计稿中的颜色、间距、圆角、阴影和字体应映射到现有 token、CSS 变量、主题变量或组件 variant。
32
+ - 创建新组件前先检查现有组件库和业务组件,优先复用。
33
+ - 默认验证 mobile(375px)、tablet(768px)、desktop(1440px)。
34
+ - 像素还原要求以项目约定为准;没有约定时,核心结构、间距、字体、状态和交互优先于机械追求截图重合。
35
+ - 复杂设计任务实现前先给出简短实现计划,说明复用组件、新建组件、可能改动文件、响应式策略和 token 映射。
40
36
 
41
- ### 设计系统生成与覆盖
37
+ ## 设计 Token 与样式
42
38
 
43
- - 项目缺少设计方向时,可先生成轻量设计系统建议,再根据真实业务、组件库和数据校正
44
- - `design-system/<project>/MASTER.md` 记录跨页面共享的产品类型、视觉语言、token 方向、动效、图表和 QA 规则
45
- - `design-system/<project>/pages/<page>.md` 只记录页面差异:首屏结构、组件密度、图表选择、状态覆盖和局部 token 调整
46
- - 构建页面或检查 UI 时,先读取页面 override,再读取 Master;页面规则不能复制全量 Master
47
- - 产品类型推理要落到界面决策:行业风险、用户频率、数据密度、触摸/鼠标场景、图表任务和转化路径
48
- - 交付前 QA 至少覆盖可访问性、交互反馈、布局溢出、字体色彩、动效降级、表单、导航和图表可读性
39
+ - 优先使用已有 design token、CSS 变量或主题变量;不要硬编码颜色、圆角、间距、阴影和字体取值。
40
+ - 缺少所需 token 时要明确指出,并集中补齐或记录,不在多个组件里散落字面量。
41
+ - Tailwind 项目中,token 应通过语义化 `theme.extend`、CSS 变量或组件 variant 承接;不要把 `blue-600`、`rounded-xl` 等具体值复制成事实标准。
42
+ - 组件 variant 应区分语义 tone、尺寸 size、密度 density 和状态 state;不要让一个字符串参数同时承载多种业务含义。
43
+ - 动态 Tailwind class 必须可被构建扫描识别;复杂映射使用显式对象、variant 工具或 safelist。
44
+ - 优先使用局部、受控的样式,不做大范围全局覆盖;与项目现有 CSS Modules、Tailwind、组件库或样式体系保持一致。
49
45
 
50
- ## 设计稿转代码规则
46
+ ## 界面质感基线
51
47
 
52
- 当存在设计上下文时:
53
-
54
- - 先通过 MCP 读取设计上下文(Figma / MasterGo / Pixso / 墨刀 / Sketch,摹客则使用截图/标注)
55
- - 设计稿中的颜色/间距 token 必须从 design token 文件中引用
56
- - 如果已有设计上下文,不要靠猜测来决定布局、间距、字体、颜色或状态
57
- - 在创建新组件前,先检查现有组件,优先复用现有组件库中的组件
58
- - 响应式断点: mobile(375px) / tablet(768px) / desktop(1440px)
59
- - 像素还原精度要求: ≥ 95%
60
- - 在改文件前先给出简短实现计划
61
-
62
- 始终要考虑:
63
-
64
- - loading 状态
65
- - empty 状态
66
- - error 状态
67
- - disabled 状态
68
- - hover 状态
69
- - focus 状态
70
- - 在相关场景下的 selected 状态
71
- - 响应式行为
72
-
73
- ## 设计 Token 规则
74
-
75
- - 优先使用已有 design token、CSS 变量或主题变量
76
- - 当已有 Token 可用时,不要硬编码颜色、圆角、间距、阴影和字体取值
77
- - 如果缺少所需 Token,要明确指出,不要悄悄到处硬编码
78
- - Token 使用方式要与周边模块保持一致
79
- - Tailwind 项目中,token 应通过语义化 `theme.extend`、CSS 变量或组件 variant 承接;不要把 `blue-600`、`rounded-xl` 等具体值复制成事实标准
80
- - 组件 variant 应区分语义 tone、尺寸 size、密度 density 和状态 state;不要让一个字符串参数承载多种业务含义
81
- - 动态 Tailwind class 必须可被构建扫描识别;复杂映射使用显式对象、variant 工具或 safelist
82
-
83
- ## 样式规则
84
-
85
- - 优先使用局部、受控的样式,而不是大范围全局覆盖
86
- - 保持当前断点下的响应式行为
87
- - 与项目现有样式体系保持一致
88
- - 检查 hover、active、focus、disabled、selected 等状态
89
- - 除非没有合适 Token 或刻度值,否则不要使用 magic number
90
-
91
- ### 界面质感基线
92
-
93
- - 嵌套圆角保持光学关系:外层圆角约等于内层圆角 + 间距
94
- - 图标按钮、箭头、播放三角等非对称图形按视觉中心微调
95
- - 小控件命中区域至少 40x40px,空间允许时优先 44x44px
96
- - 标题和短文本可用 `text-wrap: balance`,短中正文可用 `text-wrap: pretty`
97
- - 计数器、价格、时间、表格数字使用 `font-variant-numeric: tabular-nums`
98
- - 图片在浅/深色背景上边缘不清时,使用中性 alpha 内描边,不使用品牌色描边
99
- - 动效只声明实际变化属性,禁止 `transition: all` 和 `will-change: all`
100
- - 进入/退出动效要克制,并尊重 `prefers-reduced-motion`
48
+ - 嵌套圆角保持光学关系:外层圆角约等于内层圆角 + 间距。
49
+ - 图标按钮、箭头、播放三角等非对称图形按视觉中心微调。
50
+ - 小控件命中区域至少 40x40px,空间允许时优先 44x44px。
51
+ - 标题和短文本可用 `text-wrap: balance`,短中正文可用 `text-wrap: pretty`。
52
+ - 计数器、价格、时间、表格数字使用 `font-variant-numeric: tabular-nums`。
53
+ - 动效只声明实际变化属性,禁止 `transition: all` 和 `will-change: all`,并尊重 `prefers-reduced-motion`。
101
54
 
102
55
  ## 暗色模式
103
56
 
104
- 提供与系统主题同步的手动切换能力,减少视觉疲劳并满足可访问性要求。
105
-
106
- ### CSS 变量方案
107
-
108
- ```css
109
- :root {
110
- --color-bg-primary: #ffffff;
111
- --color-bg-secondary: #f5f5f5;
112
- --color-text-primary: #1a1a1a;
113
- --color-text-secondary: #666666;
114
- --color-border: #e0e0e0;
115
- }
116
-
117
- [data-theme="dark"] {
118
- --color-bg-primary: #1a1a1a;
119
- --color-bg-secondary: #2a2a2a;
120
- --color-text-primary: #f0f0f0;
121
- --color-text-secondary: #a0a0a0;
122
- --color-border: #404040;
123
- }
124
-
125
- body {
126
- background-color: var(--color-bg-primary);
127
- color: var(--color-text-primary);
128
- }
129
- ```
130
-
131
- ### Tailwind 方案
132
-
133
- ```js
134
- // tailwind.config.js
135
- module.exports = {
136
- darkMode: "class", // 通过 .dark 类控制,而非 prefers-color-scheme
137
- };
138
- ```
139
-
140
- ```html
141
- <div class="bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100">
142
- <!-- 内容 -->
143
- </div>
144
- ```
145
-
146
- ### 主题切换 Hook
147
-
148
- ```tsx
149
- import { useState, useEffect } from "react";
150
-
151
- function useTheme() {
152
- const [theme, setTheme] = useState<"light" | "dark">("light");
153
-
154
- useEffect(() => {
155
- // 1. 优先读取用户保存的偏好
156
- const saved = localStorage.getItem("theme") as "light" | "dark" | null;
157
- if (saved) {
158
- setTheme(saved);
159
- return;
160
- }
161
- // 2. 回退到系统偏好
162
- const prefersDark = window.matchMedia(
163
- "(prefers-color-scheme: dark)",
164
- ).matches;
165
- setTheme(prefersDark ? "dark" : "light");
166
- }, []);
167
-
168
- useEffect(() => {
169
- const root = document.documentElement;
170
- if (theme === "dark") {
171
- root.classList.add("dark");
172
- root.setAttribute("data-theme", "dark");
173
- } else {
174
- root.classList.remove("dark");
175
- root.setAttribute("data-theme", "light");
176
- }
177
- localStorage.setItem("theme", theme);
178
- }, [theme]);
179
-
180
- const toggle = () => setTheme((t) => (t === "light" ? "dark" : "light"));
181
-
182
- return { theme, toggle };
183
- }
184
- ```
185
-
186
- ### FOUC 防护(主题闪烁)
187
-
188
- 在 `<head>` 中同步执行主题初始化脚本(阻塞渲染),避免首次加载时出现错误的主题色:
189
-
190
- ```html
191
- <head>
192
- <script>
193
- // 同步执行 — 在 body 渲染前确定主题
194
- (function () {
195
- const theme =
196
- localStorage.getItem("theme") ||
197
- (window.matchMedia("(prefers-color-scheme: dark)").matches
198
- ? "dark"
199
- : "light");
200
- if (theme === "dark") {
201
- document.documentElement.classList.add("dark");
202
- document.documentElement.setAttribute("data-theme", "dark");
203
- }
204
- })();
205
- </script>
206
- </head>
207
- ```
208
-
209
- ### 暗色模式注意事项
210
-
211
- - **图片**: 亮色图片在暗色模式下刺眼,使用 `filter: brightness(0.8)` 降低亮度
212
- - **阴影**: 暗色模式下阴影不明显,改用 `box-shadow: 0 0 15px rgba(255,255,255,0.05)` 或边框替代
213
- - **颜色对比度**: 确保暗色模式下文本与背景的对比度 ≥ 4.5:1(WCAG AA)
214
- - **表单控件**: 输入框、下拉框、开关等原生控件在暗色模式下需要自定义样式
215
- - **第三方组件**: 检查 UI 组件库是否支持暗色模式,必要时用 CSS 变量覆盖
216
- - **Tailwind 组件**: 暗色模式下需复核 focus、disabled、selected、invalid、skeleton、chart 和阴影层级,不只补 `dark:` 背景色
217
-
218
- ---
57
+ - 项目级暗色模式只选择一种主策略:CSS 变量、根节点 class、`data-theme` 或组件库主题。
58
+ - 支持手动切换主题时,要在首屏绘制前初始化用户偏好,避免主题闪烁;实现细节交给 Tailwind / design-system skill reference。
59
+ - 亮色与暗色都要复核 disabled、focus、selected、invalid、skeleton、chart、表单控件、第三方组件和阴影层级。
60
+ - 不只靠降低透明度表达 disabled,不只补背景色而忽略文本、边框、图表和焦点状态。
219
61
 
220
62
  ## 可访问性基线
221
63
 
222
- 优先使用语义化 HTML。
223
-
224
- 确保:
225
-
226
- - 表单控件具备标签
227
- - 纯图标按钮具有可访问名称
228
- - 菜单、标签页、对话框和自定义控件支持键盘操作
229
- - 焦点样式可见
230
- - 编辑页面时标题层级正确
231
- - 真实表格数据使用正确表格语义
232
-
233
- ## UI 任务的输出要求
234
-
235
- 对于较复杂的设计类任务,开始时先给出:
236
-
237
- - 复用的组件
238
- - 新建的组件
239
- - 可能改动的文件
240
- - 响应式策略
241
- - Token 映射或样式策略
64
+ - 优先使用语义化 HTML。
65
+ - 表单控件具备标签,纯图标按钮具备可访问名称。
66
+ - 菜单、标签页、对话框和自定义控件支持键盘操作。
67
+ - 焦点样式可见,标题层级正确,真实表格数据使用表格语义。
68
+ - 颜色对比度、触摸目标、reduced-motion 和错误提示不能被视觉 polish 破坏。
242
69
 
243
- 实现完成后,需要说明:
70
+ ## UI 任务输出
244
71
 
245
- - 复用了什么
246
- - 新建了什么
247
- - 与设计稿有哪些偏差
248
- - 缺少哪些 Token、资源或交互细节
72
+ 实现完成后说明复用了什么、新建了什么、与设计稿或项目 token 的偏差、缺少哪些资源或交互细节。复杂 UI 还应说明状态覆盖、响应式验证和剩余设计风险。