@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.
- package/.claude-plugin/marketplace.json +7 -3
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +77 -1
- package/CHANGELOG.zh-CN.md +77 -1
- package/CONTRIBUTING.md +15 -10
- package/CONTRIBUTING.zh-CN.md +15 -10
- package/README.md +69 -43
- package/README.openclaw.md +11 -9
- package/README.openclaw.zh-CN.md +11 -9
- package/README.zh-CN.md +69 -43
- package/agents/fec-typescript-reviewer.md +1 -1
- package/commands/fec-doc-sync.md +7 -6
- package/dist/bin/frontend-craft.js +30 -27
- package/docs/example-prompts.md +82 -69
- package/docs/ja-JP/README.md +110 -84
- package/docs/ko-KR/README.md +100 -74
- package/docs/project-structure.md +8 -4
- package/docs/runtimes/antigravity.md +1 -1
- package/docs/runtimes/augment.md +1 -1
- package/docs/runtimes/claude.md +16 -10
- package/docs/runtimes/claude.zh-CN.md +16 -10
- package/docs/runtimes/cline.md +1 -1
- package/docs/runtimes/codebuddy.md +1 -1
- package/docs/runtimes/codex.md +1 -1
- package/docs/runtimes/copilot.md +1 -1
- package/docs/runtimes/cursor.md +1 -1
- package/docs/runtimes/gemini.md +1 -1
- package/docs/runtimes/kilo.md +1 -1
- package/docs/runtimes/openclaw.md +1 -1
- package/docs/runtimes/opencode.md +1 -1
- package/docs/runtimes/qoder.md +1 -1
- package/docs/runtimes/trae.md +1 -1
- package/docs/runtimes/windsurf.md +1 -1
- package/docs/zh-CN/example-prompts.md +82 -69
- package/docs/zh-CN/project-structure.md +8 -4
- package/docs/zh-TW/README.md +88 -62
- package/openclaw.plugin.json +1 -1
- package/package.json +3 -3
- package/skills/eval_queries.json +179 -56
- package/skills/fec-accessibility-check/SKILL.md +1 -1
- package/skills/fec-alchemy/SKILL.md +74 -0
- package/skills/fec-alchemy/assets/absorption-plan-template.md +47 -0
- package/skills/fec-alchemy/assets/intake-template.md +55 -0
- package/skills/fec-alchemy/assets/review-checklist.md +31 -0
- package/skills/fec-alchemy/references/methodology.md +94 -0
- package/skills/fec-alchemy/references/originality-and-licensing.md +57 -0
- package/skills/fec-backend-requirements-handoff/SKILL.md +45 -0
- package/skills/fec-browser-storage/SKILL.md +1 -1
- package/skills/fec-canvas-threejs/SKILL.md +1 -1
- package/skills/fec-code-review/SKILL.md +11 -3
- package/skills/fec-data-fetching/SKILL.md +15 -15
- package/skills/fec-data-fetching/references/query-patterns.md +27 -1
- package/skills/fec-debug-framework/SKILL.md +14 -19
- package/skills/fec-debug-framework/references/report-template.md +58 -0
- package/skills/fec-doc-sync/SKILL.md +19 -17
- package/skills/fec-drawio-studio/SKILL.md +69 -0
- package/skills/fec-drawio-studio/data/THIRD_PARTY_NOTICES.md +10 -0
- package/skills/fec-drawio-studio/data/brand-icons.json +878 -0
- package/skills/fec-drawio-studio/data/shape-index.json.gz +0 -0
- package/skills/fec-drawio-studio/references/data-residency.md +27 -0
- package/skills/fec-drawio-studio/references/diagram-patterns.md +41 -0
- package/skills/fec-drawio-studio/references/layout-and-export.md +57 -0
- package/skills/fec-drawio-studio/references/troubleshooting.md +29 -0
- package/skills/fec-drawio-studio/references/xml-and-mermaid.md +54 -0
- package/skills/fec-drawio-studio/scripts/brand-symbols.mjs +99 -0
- package/skills/fec-drawio-studio/scripts/diagram-lint.mjs +143 -0
- package/skills/fec-drawio-studio/scripts/diagram-url.mjs +102 -0
- package/skills/fec-drawio-studio/scripts/layout-graph.mjs +107 -0
- package/skills/fec-drawio-studio/scripts/png-embed-fix.mjs +26 -0
- package/skills/fec-drawio-studio/scripts/scan-go-packages.mjs +36 -0
- package/skills/fec-drawio-studio/scripts/scan-js-modules.mjs +52 -0
- package/skills/fec-drawio-studio/scripts/scan-python-classes.mjs +30 -0
- package/skills/fec-drawio-studio/scripts/scan-python-modules.mjs +55 -0
- package/skills/fec-drawio-studio/scripts/scan-rust-modules.mjs +35 -0
- package/skills/fec-drawio-studio/scripts/scan-ts-modules.mjs +7 -0
- package/skills/fec-drawio-studio/scripts/shape-query.mjs +81 -0
- package/skills/fec-drawio-studio/scripts/studio-core.mjs +139 -0
- package/skills/fec-drawio-studio/styles/built-in/corporate.json +49 -0
- package/skills/fec-drawio-studio/styles/built-in/default.json +49 -0
- package/skills/fec-drawio-studio/styles/built-in/handdrawn.json +49 -0
- package/skills/fec-drawio-studio/styles/schema.json +112 -0
- package/skills/fec-e2e-testing/SKILL.md +5 -3
- package/skills/fec-e2e-testing/references/e2e-ci-reporting.md +62 -0
- package/skills/fec-e2e-testing/references/e2e-special-scenarios.md +52 -0
- package/skills/fec-e2e-testing/references/e2e-visual-regression.md +60 -0
- package/skills/fec-form-handling/SKILL.md +11 -11
- package/skills/fec-form-handling/references/advanced-form-patterns.md +34 -5
- package/skills/fec-image-generation/SKILL.md +56 -0
- package/skills/fec-image-generation/references/artifact-routing.md +80 -0
- package/skills/fec-image-generation/references/diagram-workflows.md +43 -0
- package/skills/fec-image-generation/references/png-qa-autofix.md +30 -0
- package/skills/fec-image-generation/scripts/png-qa.mjs +431 -0
- package/skills/fec-implement-from-design/SKILL.md +9 -2
- package/skills/fec-legacy-to-modern-migration/SKILL.md +29 -163
- package/skills/fec-legacy-to-modern-migration/references/migration-execution-checklist.md +110 -0
- package/skills/fec-legacy-to-modern-migration/references/migration-strategy-and-mapping.md +48 -0
- package/skills/fec-legacy-web-standard/SKILL.md +1 -1
- package/skills/fec-list-virtualization/SKILL.md +3 -3
- package/skills/fec-list-virtualization/references/virtualization-patterns.md +32 -4
- package/skills/fec-motion-interaction/SKILL.md +7 -0
- package/skills/fec-nextjs-project-standard/SKILL.md +7 -1
- package/skills/fec-performance-optimization/SKILL.md +9 -1
- package/skills/fec-performance-optimization/references/framework-performance-patterns.md +38 -0
- package/skills/fec-performance-optimization/references/report-template.md +59 -0
- package/skills/fec-pwa-implementation/SKILL.md +3 -4
- package/skills/fec-react-project-standard/SKILL.md +12 -4
- package/skills/fec-react-project-standard/references/react-performance-patterns.md +35 -0
- package/skills/fec-react-project-standard/references/react-project-structure.md +197 -0
- package/skills/fec-react-project-standard/references/react-quality-patterns.md +131 -0
- package/skills/fec-react-project-standard/references/react-runtime-patterns.md +293 -0
- package/skills/fec-refactor-clean/SKILL.md +4 -1
- package/skills/fec-refactor-clean/references/report-template.md +42 -0
- package/skills/fec-responsive-layout/references/responsive-layout-patterns.md +11 -0
- package/skills/fec-security-review/SKILL.md +3 -3
- package/skills/fec-source-driven-development/SKILL.md +26 -0
- package/skills/fec-state-management/SKILL.md +1 -1
- package/skills/fec-storybook-component-doc/SKILL.md +2 -2
- package/skills/fec-tailwind-design-system/references/tailwind-system-patterns.md +5 -1
- package/skills/fec-typescript-project-standard/SKILL.md +54 -0
- package/skills/{fec-typescript-type-safety → fec-typescript-project-standard}/references/type-safety-patterns.md +1 -1
- package/skills/{fec-typescript-type-safety/SKILL.md → fec-typescript-project-standard/references/type-safety.md} +1 -10
- package/skills/fec-ui-design/SKILL.md +26 -8
- package/skills/fec-ui-design/data/style-archetypes.json +40 -0
- package/skills/fec-ui-design/data/ux-quality-rules.json +35 -0
- package/skills/fec-ui-design/references/design-intelligence.md +66 -6
- package/skills/fec-ui-design/references/pre-delivery-checklist.md +6 -0
- package/skills/fec-ui-design/scripts/design-system.mjs +119 -1
- package/skills/fec-validation-fix/SKILL.md +5 -2
- package/skills/fec-validation-fix/references/report-template.md +43 -0
- package/skills/fec-vue3-project-standard/SKILL.md +12 -3
- package/skills/fec-vue3-project-standard/references/vue3-composables-routing.md +163 -0
- package/skills/fec-vue3-project-standard/references/vue3-performance-patterns.md +13 -0
- package/skills/fec-vue3-project-standard/references/vue3-project-structure.md +177 -0
- package/skills/fec-vue3-project-standard/references/vue3-state-api-quality.md +216 -0
- package/skills/fec-web-video-presentation/SKILL.md +61 -0
- package/skills/fec-web-video-presentation/data/starter-themes.json +59 -0
- package/skills/fec-web-video-presentation/references/chapter-craft.md +37 -0
- package/skills/fec-web-video-presentation/references/content-plan.md +38 -0
- package/skills/fec-web-video-presentation/references/recording-and-audio.md +33 -0
- package/skills/fec-web-video-presentation/references/theme-system.md +36 -0
- package/skills/fec-web-video-presentation/scripts/create-video-presentation.mjs +430 -0
- package/skills/fec-web-workers/SKILL.md +3 -4
- package/skills/metadata.json +381 -168
- package/skills/relations.json +136 -25
- package/templates/shared/rules/fec-ci-cd.md +20 -108
- package/templates/shared/rules/fec-design-system.md +47 -223
- package/templates/shared/rules/fec-error-handling.md +35 -179
- package/templates/shared/rules/fec-i18n.md +43 -91
- package/templates/shared/rules/fec-refactoring.md +4 -0
- package/templates/shared/rules/fec-rendering-patterns.md +28 -171
- package/templates/shared/rules/fec-responsive-design.md +34 -211
- package/templates/shared/rules/fec-state-management.md +41 -144
- package/templates/shared/rules/fec-typescript.md +47 -290
- package/skills/fec-e2e-testing/references/e2e-advanced.md +0 -176
- package/skills/fec-react-project-standard/references/react-project-details.md +0 -642
- package/skills/fec-vue3-project-standard/references/vue3-project-details.md +0 -547
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://github.com/Agents365-ai/drawio-skill/styles/schema.json",
|
|
4
|
+
"title": "drawio-skill preset",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["name", "version", "palette", "roles", "shapes", "font", "edges"],
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": { "type": "string" },
|
|
10
|
+
"name": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]*$" },
|
|
11
|
+
"version": { "type": "integer", "const": 1 },
|
|
12
|
+
"default": { "type": "boolean" },
|
|
13
|
+
"confidence": { "type": "string", "enum": ["low", "medium", "high"] },
|
|
14
|
+
"source": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"additionalProperties": false,
|
|
17
|
+
"properties": {
|
|
18
|
+
"type": { "type": "string", "enum": ["xml", "image", "built-in", "hand-authored"] },
|
|
19
|
+
"path": { "type": "string" },
|
|
20
|
+
"extracted_at": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"palette": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"additionalProperties": false,
|
|
26
|
+
"required": ["primary", "success", "warning", "accent", "danger", "neutral", "secondary"],
|
|
27
|
+
"properties": {
|
|
28
|
+
"primary": { "$ref": "#/$defs/colorPair" },
|
|
29
|
+
"success": { "$ref": "#/$defs/colorPair" },
|
|
30
|
+
"warning": { "$ref": "#/$defs/colorPair" },
|
|
31
|
+
"accent": { "$ref": "#/$defs/colorPair" },
|
|
32
|
+
"danger": { "$ref": "#/$defs/colorPair" },
|
|
33
|
+
"neutral": { "$ref": "#/$defs/colorPair" },
|
|
34
|
+
"secondary": { "$ref": "#/$defs/colorPair" }
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"roles": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"additionalProperties": false,
|
|
40
|
+
"properties": {
|
|
41
|
+
"service": { "$ref": "#/$defs/slotName" },
|
|
42
|
+
"database": { "$ref": "#/$defs/slotName" },
|
|
43
|
+
"queue": { "$ref": "#/$defs/slotName" },
|
|
44
|
+
"gateway": { "$ref": "#/$defs/slotName" },
|
|
45
|
+
"error": { "$ref": "#/$defs/slotName" },
|
|
46
|
+
"external": { "$ref": "#/$defs/slotName" },
|
|
47
|
+
"security": { "$ref": "#/$defs/slotName" }
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"shapes": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"additionalProperties": { "type": "string" },
|
|
53
|
+
"properties": {
|
|
54
|
+
"service": { "type": "string" },
|
|
55
|
+
"database": { "type": "string" },
|
|
56
|
+
"queue": { "type": "string" },
|
|
57
|
+
"decision": { "type": "string" },
|
|
58
|
+
"external": { "type": "string" },
|
|
59
|
+
"container": { "type": "string" }
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"font": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"additionalProperties": false,
|
|
65
|
+
"required": ["fontFamily", "fontSize"],
|
|
66
|
+
"properties": {
|
|
67
|
+
"fontFamily": { "type": "string" },
|
|
68
|
+
"fontSize": { "type": "integer", "minimum": 8, "maximum": 36 },
|
|
69
|
+
"titleFontSize": { "type": "integer", "minimum": 8, "maximum": 48 },
|
|
70
|
+
"titleBold": { "type": "boolean" }
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"edges": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"additionalProperties": false,
|
|
76
|
+
"required": ["style", "arrow"],
|
|
77
|
+
"properties": {
|
|
78
|
+
"style": { "type": "string" },
|
|
79
|
+
"arrow": { "type": "string" },
|
|
80
|
+
"dashedFor": { "type": "array", "items": { "type": "string" } }
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"extras": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"additionalProperties": false,
|
|
86
|
+
"properties": {
|
|
87
|
+
"sketch": { "type": "boolean" },
|
|
88
|
+
"globalStrokeWidth": { "type": "number", "minimum": 0.5, "maximum": 6 }
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"$defs": {
|
|
93
|
+
"colorPair": {
|
|
94
|
+
"oneOf": [
|
|
95
|
+
{ "type": "null" },
|
|
96
|
+
{
|
|
97
|
+
"type": "object",
|
|
98
|
+
"additionalProperties": false,
|
|
99
|
+
"required": ["fillColor", "strokeColor"],
|
|
100
|
+
"properties": {
|
|
101
|
+
"fillColor": { "type": "string", "pattern": "^#[0-9A-Fa-f]{6}$" },
|
|
102
|
+
"strokeColor": { "type": "string", "pattern": "^#[0-9A-Fa-f]{6}$" }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"slotName": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"enum": ["primary", "success", "warning", "accent", "danger", "neutral", "secondary"]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -20,10 +20,12 @@ description: Use when creating, maintaining, debugging, or reviewing real-browse
|
|
|
20
20
|
7. 对关键浏览器能力、支付、权限、上传和实时通信流程,记录测试环境、种子数据和清理策略。
|
|
21
21
|
8. 测试数据必须可重复:优先使用 API seed、数据库 fixture、测试账号或 mock 服务;随机数据需带唯一前缀并在 teardown 清理。
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## 详细参考
|
|
24
24
|
|
|
25
|
-
-
|
|
26
|
-
-
|
|
25
|
+
- 需要目录结构、Page Object、spec 组织、配置、flaky 调试和产物示例时,加载 [references/playwright-patterns.md](references/playwright-patterns.md)。
|
|
26
|
+
- 需要 CI 示例和 Markdown 报告模板时,加载 [references/e2e-ci-reporting.md](references/e2e-ci-reporting.md)。
|
|
27
|
+
- 需要 Web3/钱包流程或高风险金融流程时,加载 [references/e2e-special-scenarios.md](references/e2e-special-scenarios.md)。
|
|
28
|
+
- 需要跨页面截图或视觉回归配置时,加载 [references/e2e-visual-regression.md](references/e2e-visual-regression.md)。
|
|
27
29
|
|
|
28
30
|
## Constraints
|
|
29
31
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# E2E CI 与报告
|
|
2
|
+
|
|
3
|
+
## CI 集成(示例)
|
|
4
|
+
|
|
5
|
+
```yaml
|
|
6
|
+
# .github/workflows/e2e.yml
|
|
7
|
+
name: E2E Tests
|
|
8
|
+
on: [push, pull_request]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: 20
|
|
18
|
+
- run: npm ci
|
|
19
|
+
- run: npx playwright install --with-deps
|
|
20
|
+
- run: npx playwright test
|
|
21
|
+
env:
|
|
22
|
+
CI: true
|
|
23
|
+
BASE_URL: ${{ vars.STAGING_URL }}
|
|
24
|
+
- uses: actions/upload-artifact@v4
|
|
25
|
+
if: always()
|
|
26
|
+
with:
|
|
27
|
+
name: playwright-report
|
|
28
|
+
path: playwright-report/
|
|
29
|
+
retention-days: 30
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Cypress:固定 `CYPRESS_baseUrl` 或配置文件中的 `baseUrl`,失败截图/视频同样建议上传 artifact。
|
|
33
|
+
|
|
34
|
+
## E2E 报告模板(Markdown)
|
|
35
|
+
|
|
36
|
+
输出或归档测试报告时可采用下列结构,便于复盘:
|
|
37
|
+
|
|
38
|
+
```markdown
|
|
39
|
+
# E2E 测试报告
|
|
40
|
+
|
|
41
|
+
**日期:** YYYY-MM-DD HH:mm
|
|
42
|
+
**耗时:** X 分 Y 秒
|
|
43
|
+
**结果:** 通过 / 失败
|
|
44
|
+
|
|
45
|
+
## 摘要
|
|
46
|
+
|
|
47
|
+
- 总计 X | 通过 Y | 失败 Z | 不稳定/跳过 说明
|
|
48
|
+
|
|
49
|
+
## 失败用例
|
|
50
|
+
|
|
51
|
+
### 用例名
|
|
52
|
+
|
|
53
|
+
- **文件:** `tests/e2e/xxx.spec.ts:行号`
|
|
54
|
+
- **错误:** 简述断言或超时信息
|
|
55
|
+
- **截图/Trace:** 路径或 artifact 名称
|
|
56
|
+
- **建议修复:** 可执行结论
|
|
57
|
+
|
|
58
|
+
## 产物
|
|
59
|
+
|
|
60
|
+
- HTML 报告:`playwright-report/index.html`
|
|
61
|
+
- Trace / 视频 / 截图:CI artifact 或本地 `test-results/`
|
|
62
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# E2E 特殊场景
|
|
2
|
+
|
|
3
|
+
## Web3 / 钱包注入(Playwright)
|
|
4
|
+
|
|
5
|
+
在 **`page.goto` 之前**通过 `context.addInitScript` 注入 mock,避免依赖真实插件:
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
test("连接钱包", async ({ page, context }) => {
|
|
9
|
+
await context.addInitScript(() => {
|
|
10
|
+
(window as unknown as { ethereum?: unknown }).ethereum = {
|
|
11
|
+
isMetaMask: true,
|
|
12
|
+
request: async ({ method }: { method: string }) => {
|
|
13
|
+
if (method === "eth_requestAccounts")
|
|
14
|
+
return ["0x1234567890123456789012345678901234567890"];
|
|
15
|
+
if (method === "eth_chainId") return "0x1";
|
|
16
|
+
return null;
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
await page.goto("/");
|
|
22
|
+
await page.getByTestId("connect-wallet").click();
|
|
23
|
+
await expect(page.getByTestId("wallet-address")).toContainText("0x1234");
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
链 ID、账户列表与业务契约保持一致即可。
|
|
28
|
+
|
|
29
|
+
## 金融或高风险操作
|
|
30
|
+
|
|
31
|
+
- **禁止**在真实生产环境执行真实资金操作;使用 **staging、mock 或 `test.skip`**。
|
|
32
|
+
- 断言**预览金额、成功态**与**关键接口 200** 后再结束用例,超时给足(如链上确认场景)。
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
test("下单预览与成功态", async ({ page }) => {
|
|
36
|
+
test.skip(process.env.NODE_ENV === "production", "生产环境跳过真实交易");
|
|
37
|
+
|
|
38
|
+
await page.goto("/markets/demo");
|
|
39
|
+
await page.getByTestId("position-yes").click();
|
|
40
|
+
await page.getByTestId("trade-amount").fill("1.0");
|
|
41
|
+
|
|
42
|
+
const preview = page.getByTestId("trade-preview");
|
|
43
|
+
await expect(preview).toContainText("1.0");
|
|
44
|
+
|
|
45
|
+
await page.getByTestId("confirm-trade").click();
|
|
46
|
+
await page.waitForResponse(
|
|
47
|
+
(resp) => resp.url().includes("/api/trade") && resp.status() === 200,
|
|
48
|
+
{ timeout: 30_000 },
|
|
49
|
+
);
|
|
50
|
+
await expect(page.getByTestId("trade-success")).toBeVisible();
|
|
51
|
+
});
|
|
52
|
+
```
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# E2E 视觉回归测试
|
|
2
|
+
|
|
3
|
+
通过截图快照对比检测非预期的 UI 变化。适用于 CSS 重构、设计 Token 更新、组件改版等场景。
|
|
4
|
+
|
|
5
|
+
## 基础用法
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { test, expect } from "@playwright/test";
|
|
9
|
+
|
|
10
|
+
test("首页布局与基线一致", async ({ page }) => {
|
|
11
|
+
await page.goto("/");
|
|
12
|
+
await page.waitForLoadState("networkidle");
|
|
13
|
+
|
|
14
|
+
// 全页截图对比 - 首次运行自动生成基线
|
|
15
|
+
await expect(page).toHaveScreenshot("homepage-full.png", {
|
|
16
|
+
fullPage: true,
|
|
17
|
+
maxDiffPixels: 100, // 允许的轻微像素差异(抗锯齿等)
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test("按钮组件视觉一致", async ({ page }) => {
|
|
22
|
+
await page.goto("/components/buttons");
|
|
23
|
+
const submitButton = page.getByTestId("submit-button");
|
|
24
|
+
await expect(submitButton).toHaveScreenshot("submit-button.png");
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 屏蔽动态内容
|
|
29
|
+
|
|
30
|
+
时间、随机 ID、第三方广告等动态元素会导致误报,使用 `mask` 屏蔽:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
await expect(page).toHaveScreenshot("dashboard.png", {
|
|
34
|
+
mask: [
|
|
35
|
+
page.locator(".live-clock"),
|
|
36
|
+
page.locator(".random-id"),
|
|
37
|
+
page.locator(".ad-banner"),
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 禁用动画
|
|
43
|
+
|
|
44
|
+
CSS 动画会导致截图不一致,注入样式禁用动画后再截图:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
await page.addStyleTag({
|
|
48
|
+
content:
|
|
49
|
+
"*, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; }",
|
|
50
|
+
});
|
|
51
|
+
await expect(page).toHaveScreenshot("animated-page.png");
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 基线管理
|
|
55
|
+
|
|
56
|
+
- **首次运行**: `npx playwright test` 失败但自动生成基线到 `tests/` 目录
|
|
57
|
+
- **更新基线**: UI 有意变更时 `npx playwright test --update-snapshots`
|
|
58
|
+
- **CI 一致性**: 基线必须在与 CI 相同的 OS(Linux/Ubuntu)上生成,字体渲染在 macOS 与 Linux 间存在差异
|
|
59
|
+
- **多浏览器**: 每个 project 独立生成基线(Chromium/Firefox/WebKit 渲染结果不同)
|
|
60
|
+
- **基线文件**: 纳入 `.gitignore` 或 Git LFS 管理,避免仓库膨胀
|
|
@@ -11,13 +11,13 @@ description: Use when building or reviewing substantial forms with React Hook Fo
|
|
|
11
11
|
|
|
12
12
|
## Procedure
|
|
13
13
|
|
|
14
|
-
1.
|
|
15
|
-
2.
|
|
16
|
-
3.
|
|
17
|
-
4.
|
|
14
|
+
1. 先识别框架、项目既有表单库、schema 校验库、组件库和复杂度;10+ 字段、动态字段、联动校验、文件上传、多步流程或输入卡顿时再引入专门表单方案。
|
|
15
|
+
2. 按项目栈选型:React 可考虑 React Hook Form + Zod;Vue 可考虑 vee-validate / FormKit + Zod、Yup 或 Valibot;简单表单可用框架原生状态和基础校验。
|
|
16
|
+
3. 用运行时 schema 或明确校验函数守住外部输入边界;TypeScript 类型可从 schema 推导,但不要只写 TS 类型。
|
|
17
|
+
4. 明确默认值、字段注册、受控/非受控边界和组件库适配;错误提示用 `aria-invalid`、`aria-describedby` 和 `role="alert"`。
|
|
18
18
|
5. 提交时处理 loading、服务端错误、重复提交和 reset;大型表单用局部订阅和子组件隔离控制重渲染。
|
|
19
19
|
|
|
20
|
-
## Quick Start
|
|
20
|
+
## React Quick Start
|
|
21
21
|
|
|
22
22
|
```tsx
|
|
23
23
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
@@ -59,17 +59,17 @@ export function LoginFormView() {
|
|
|
59
59
|
}
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
##
|
|
62
|
+
## 详细参考
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
涉及是否需要表单库、框架选型、`Controller`、`useFieldArray`、联动校验、文件上传、多步表单、异步校验和性能模式时,加载 [references/advanced-form-patterns.md](references/advanced-form-patterns.md)。
|
|
65
65
|
|
|
66
66
|
## Constraints
|
|
67
67
|
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
68
|
+
- 沿用仓库既有表单库、schema 库和组件库适配方式,不为单个表单引入第二套体系。
|
|
69
|
+
- 默认值必须完整,避免 undefined 触发受控/非受控警告或初始化抖动。
|
|
70
|
+
- reset 应传服务器返回或明确的完整默认对象。
|
|
71
71
|
- 异步校验必须 debounce 或放到提交边界,避免每次键入请求。
|
|
72
|
-
-
|
|
72
|
+
- schema 级联动校验的错误 path 必须指向实际字段。
|
|
73
73
|
|
|
74
74
|
## Expected Output
|
|
75
75
|
|
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
# 高级表单模式
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 先判断是否需要表单库
|
|
4
|
+
|
|
5
|
+
- 1-3 个字段、无复杂校验、无动态字段、无组件库适配压力的表单,可用框架原生状态、浏览器约束校验和轻量提交状态。
|
|
6
|
+
- 需要动态字段、跨字段校验、多步流程、文件上传、异步校验、服务端错误回填或明显输入卡顿时,再引入专门表单方案。
|
|
7
|
+
- 表单库只管理字段状态和校验流程,不替代 API 错误映射、权限判断、可访问性标注或服务端最终校验。
|
|
8
|
+
|
|
9
|
+
## 选型参考
|
|
10
|
+
|
|
11
|
+
先沿用项目已有表单库、schema 库和组件库适配方式;新增依赖时再按场景选择。
|
|
12
|
+
|
|
13
|
+
| 场景 | 候选方案 | 注意点 |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| React 复杂表单 | React Hook Form + Zod | 非受控优先,第三方受控组件用 `Controller`。 |
|
|
16
|
+
| Vue 复杂表单 | vee-validate / FormKit + Zod、Yup 或 Valibot | 不要为 Vue 项目引入 React-only 表单 API;优先沿用项目既有 Vue 表单库。 |
|
|
17
|
+
| 简单表单 | 框架原生状态 + 基础校验 | 避免为了 1-3 个字段引入重型表单体系。 |
|
|
18
|
+
| 多步表单 | 分步 schema + 最终提交 schema | 明确跨步数据保存、返回上一步和最终校验策略。 |
|
|
19
|
+
| 文件上传 | 表单库字段状态 + `FormData` | 校验文件数量、大小、类型;不要把 `File` JSON 序列化。 |
|
|
20
|
+
| 异步校验 | 提交边界校验或 debounce 字段校验 | 避免每次键入请求;处理竞态和旧响应覆盖。 |
|
|
21
|
+
|
|
22
|
+
## 通用实现原则
|
|
23
|
+
|
|
24
|
+
- 运行时 schema 或校验函数负责外部输入边界;TypeScript 类型不能替代运行时校验。
|
|
25
|
+
- 默认值、reset 数据和服务端回填数据要形状一致,避免字段在受控/非受控之间切换。
|
|
26
|
+
- 字段错误要能映射到具体字段;全局错误用于提交失败、权限或服务不可用等非字段问题。
|
|
27
|
+
- 组件库适配层要透传 value、onChange、onBlur、name/ref 或等价字段注册能力。
|
|
28
|
+
- 提交时保护 loading、重复提交、取消/过期请求、服务端错误回填和成功后 reset。
|
|
29
|
+
- 文件上传使用 `FormData` 或直传流程,前端校验只做体验保护,服务端仍需最终校验。
|
|
30
|
+
- 性能优化优先使用字段级订阅、局部组件拆分和延迟校验,不要全表单 watch 后驱动整页重渲染。
|
|
31
|
+
|
|
32
|
+
## React Hook Form Controller
|
|
4
33
|
|
|
5
34
|
```tsx
|
|
6
35
|
<Controller
|
|
@@ -18,7 +47,7 @@
|
|
|
18
47
|
|
|
19
48
|
用于不暴露原生 `ref` 的 Select、DatePicker、RichEditor 等组件。
|
|
20
49
|
|
|
21
|
-
## 动态字段
|
|
50
|
+
## React Hook Form 动态字段
|
|
22
51
|
|
|
23
52
|
```tsx
|
|
24
53
|
const { fields, append, remove } = useFieldArray({
|
|
@@ -36,7 +65,7 @@ const { fields, append, remove } = useFieldArray({
|
|
|
36
65
|
|
|
37
66
|
`key` 必须使用 `field.id`,不要使用数组 index。
|
|
38
67
|
|
|
39
|
-
## 联动校验
|
|
68
|
+
## Zod 联动校验
|
|
40
69
|
|
|
41
70
|
```ts
|
|
42
71
|
const schema = z
|
|
@@ -50,7 +79,7 @@ const schema = z
|
|
|
50
79
|
});
|
|
51
80
|
```
|
|
52
81
|
|
|
53
|
-
##
|
|
82
|
+
## Zod 文件上传校验
|
|
54
83
|
|
|
55
84
|
```ts
|
|
56
85
|
const schema = z.object({
|
|
@@ -67,6 +96,6 @@ const schema = z.object({
|
|
|
67
96
|
## 性能
|
|
68
97
|
|
|
69
98
|
- 用 `useWatch` 或字段级订阅替代全表单 watch。
|
|
70
|
-
- 大表单拆成 memoized
|
|
99
|
+
- 大表单拆成 memoized 子组件或框架等价的局部更新单元。
|
|
71
100
|
- 高频输入不要每次键入触发网络校验。
|
|
72
101
|
- 多步表单要明确每步 schema 和跨步最终 schema。
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fec-image-generation
|
|
3
|
+
description: Use when generating or editing diagrams, charts, visual assets, posters, UI mockups, product images, infographics, academic figures, comics, avatars, storyboards, brand boards, or image-edit workflows, especially when exported PNGs need visual QA and bounded self-repair. Prefer deterministic Mermaid/SVG/HTML/canvas sources for text-heavy diagrams; do not use for ordinary UI polish without generated imagery. Chinese triggers include 图片生成, 图像编辑, 图表生成, 架构图, ER 图, UML, 序列图, 海报, UI 样机, 产品图, 信息图, 学术图, 漫画, 头像, 分镜, 品牌板, PNG 自检, 自动修复.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 图片生成与图表工作流
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
生成或编辑图表、视觉资产和图片工作流,并对导出的 PNG 做可复查的自检与修复迭代。
|
|
11
|
+
|
|
12
|
+
## Procedure
|
|
13
|
+
|
|
14
|
+
1. 判断产物类型
|
|
15
|
+
- 文本、结构和连线准确性优先时,用 Mermaid、SVG、HTML/CSS、canvas 或图表库生成可编辑源,再导出 PNG。
|
|
16
|
+
- 审美、质感、照片、插画、漫画、产品图或品牌氛围优先时,用图片生成或编辑工具,再把最终资产保存到项目或报告目录。
|
|
17
|
+
|
|
18
|
+
2. 明确输入与约束
|
|
19
|
+
- 收集受众、用途、尺寸、语言、必须出现的文本、品牌限制、可编辑源格式、导出格式和禁用元素。
|
|
20
|
+
- 对海报、UI 样机、品牌板和产品图,先写出一行视觉读取:目标用户、场景、可信感来源、主视觉锚点。
|
|
21
|
+
|
|
22
|
+
3. 选择生成路线
|
|
23
|
+
- ER 图、UML 类图、序列图、技术架构图、ML/深度学习、流程图等,优先按 [diagram-workflows.md](references/diagram-workflows.md) 建立结构化源。
|
|
24
|
+
- 海报、UI 样机、产品图、信息图、学术图、漫画、头像、分镜、品牌板和图像编辑,按 [artifact-routing.md](references/artifact-routing.md) 选择生成、编辑或混合路线。
|
|
25
|
+
|
|
26
|
+
4. 导出并自检 PNG
|
|
27
|
+
- 每次交付前都读取导出的 PNG,检查主体是否真实渲染、文字是否截断、连线是否堆叠、节点是否重叠。
|
|
28
|
+
- 有布局 manifest 时运行:
|
|
29
|
+
```bash
|
|
30
|
+
node skills/fec-image-generation/scripts/png-qa.mjs --png output.png --manifest layout.json --format markdown
|
|
31
|
+
```
|
|
32
|
+
- 没有 manifest 时仍运行 PNG 基础检查:
|
|
33
|
+
```bash
|
|
34
|
+
node skills/fec-image-generation/scripts/png-qa.mjs --png output.png --format json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
5. 自动修复循环
|
|
38
|
+
- 默认最多 2 轮;用户明确要求时可提高到 5 轮软上限。
|
|
39
|
+
- 修复对象是源文件、prompt、布局参数或导出尺寸,不直接破坏性修改 PNG 像素。
|
|
40
|
+
- 按 [png-qa-autofix.md](references/png-qa-autofix.md) 把问题转成具体修复:增大画布、换行、移动节点、分层连线、调整 padding 或重导出。
|
|
41
|
+
|
|
42
|
+
6. 交付记录
|
|
43
|
+
- 说明最终源文件、PNG 路径、生成路线、QA 轮次、发现并修复的问题、仍需人工确认的文字或品牌风险。
|
|
44
|
+
|
|
45
|
+
## Constraints
|
|
46
|
+
|
|
47
|
+
- 文本密集图不要只靠位图模型生成;必须保留可编辑结构化源。
|
|
48
|
+
- 不把截图、假数据或占位图当成最终产品图,除非用户明确要求概念稿。
|
|
49
|
+
- 不直接覆盖原图;编辑工作流默认输出新文件。
|
|
50
|
+
- 不为追求美观牺牲可读标签、连线归属、图例、坐标轴和可访问替代说明。
|
|
51
|
+
- PNG helper 只做检测和建议;修复必须回到源、prompt 或布局参数。
|
|
52
|
+
- 自检结果不能替代人工确认专有名词、公式、论文图注、品牌规范和合规信息。
|
|
53
|
+
|
|
54
|
+
## Expected Output
|
|
55
|
+
|
|
56
|
+
产出可编辑源、最终 PNG 或编辑后图片,并附带生成路线与 QA 结果。图表应结构清晰、标签不截断、连线不混乱;视觉资产应匹配用途、尺寸、品牌语气和交付路径。
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Artifact Routing
|
|
2
|
+
|
|
3
|
+
## Mode selection
|
|
4
|
+
|
|
5
|
+
Choose the execution mode before writing a prompt:
|
|
6
|
+
|
|
7
|
+
| Mode | Use when | Behavior |
|
|
8
|
+
| ---- | -------- | -------- |
|
|
9
|
+
| Deterministic source | Text, labels, charts, connectors, or exact geometry must be correct | Build Mermaid, SVG, HTML/CSS, canvas, plotting, or design-tool source first, then export PNG. |
|
|
10
|
+
| Host-native image tool | The task needs raster aesthetics, illustration, product mood, photo-like output, or image editing and the current environment has an image tool | Write a structured prompt and call the host image tool. Save or report the prompt when future edits are likely. |
|
|
11
|
+
| Prompt-only advisor | No image tool is available or the user only wants a prompt | Produce the final prompt, usage notes, and verification checklist. Do not imply an image was generated. |
|
|
12
|
+
| Hybrid | Exact text or UI structure plus generated imagery are both needed | Generate supporting imagery, then compose final text/layout in SVG, HTML, canvas, or a design tool. |
|
|
13
|
+
|
|
14
|
+
Do not introduce local image API scripts, provider-specific environment variables, or OpenAI-compatible gateway assumptions as part of this workflow. If a project already owns such a pipeline, treat it as a host tool and keep prompts provider-neutral.
|
|
15
|
+
|
|
16
|
+
## Route by output
|
|
17
|
+
|
|
18
|
+
| Output | Preferred route | Notes |
|
|
19
|
+
| ------ | --------------- | ----- |
|
|
20
|
+
| Poster / ad creative | Image generation, then optional layout polish in HTML/SVG or design tool | Lock exact copy before generation; recompose text outside the bitmap when accuracy matters. |
|
|
21
|
+
| UI mockup | HTML/CSS or design-tool mockup first; raster generation only for mood or hero references | Keep controls readable and avoid fake product states in final handoff. |
|
|
22
|
+
| Product image | Image generation or edit with reference constraints | Preserve brand, perspective, material, and lighting; do not overwrite original assets. |
|
|
23
|
+
| Infographic | Structured SVG/HTML/canvas for text and charts; generated illustrations only as supporting media | Export PNG after layout QA. |
|
|
24
|
+
| Academic figure | Deterministic plotting, SVG, Mermaid, LaTeX, or canvas | Accuracy beats style; keep source reproducible. |
|
|
25
|
+
| Comic / storyboard | Image generation with panel manifest | Track panel count, exact captions, characters, scene continuity, and reading order. |
|
|
26
|
+
| Avatar | Image generation or edit | Ask only when identity, style, or usage rights are ambiguous. |
|
|
27
|
+
| Brand board | Mixed route: generated imagery, palette/type/layout board in HTML/SVG | Record palette roles, typography mood, imagery rules, and avoid-list. |
|
|
28
|
+
| Image edit | Edit target plus explicit invariants | Preserve requested identity, composition, text, object, lighting, or background constraints. |
|
|
29
|
+
|
|
30
|
+
## Visual asset categories
|
|
31
|
+
|
|
32
|
+
Use these categories to pick prompt detail and verification focus:
|
|
33
|
+
|
|
34
|
+
- Product and commerce: product image, packaging, lifestyle scene, marketplace board.
|
|
35
|
+
- UI and interface: app mockup, chat scene, dashboard view, landing hero, social post.
|
|
36
|
+
- Technical and academic: architecture, sequence, state, ER, method figure, graphical abstract.
|
|
37
|
+
- Narrative and brand: poster, campaign key visual, storyboard, comic, avatar, mascot, brand board.
|
|
38
|
+
- Information design: infographic, map, comparison, step-by-step guide, KPI board.
|
|
39
|
+
- Editing: background replacement, object removal, local replacement, retouching, portrait edit.
|
|
40
|
+
|
|
41
|
+
If the category is text-heavy or diagram-heavy, prefer a deterministic source or hybrid route.
|
|
42
|
+
|
|
43
|
+
## Prompt contract
|
|
44
|
+
|
|
45
|
+
Use this compact structure when calling an image tool:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
Asset type:
|
|
49
|
+
Use:
|
|
50
|
+
Canvas / aspect ratio:
|
|
51
|
+
Audience:
|
|
52
|
+
Required text:
|
|
53
|
+
Subject:
|
|
54
|
+
Composition:
|
|
55
|
+
Style / brand tone:
|
|
56
|
+
Reference assets:
|
|
57
|
+
Must preserve:
|
|
58
|
+
Avoid:
|
|
59
|
+
Output:
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
For exact text, prefer adding text in SVG/HTML/design source after image generation. If text must be inside generated imagery, keep it short and verify manually.
|
|
63
|
+
|
|
64
|
+
For image edits, add:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
Source image:
|
|
68
|
+
Edit region:
|
|
69
|
+
Invariants:
|
|
70
|
+
Replacement:
|
|
71
|
+
Lighting / perspective:
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Handoff checklist
|
|
75
|
+
|
|
76
|
+
- Final image path is inside the workspace when the asset is project-bound.
|
|
77
|
+
- Source or prompt is saved when future edits are likely.
|
|
78
|
+
- Exact text, diagram labels, chart values, citations, and brand marks are manually checked.
|
|
79
|
+
- Generated variants that were rejected are not referenced by code or docs.
|
|
80
|
+
- If no image was generated, the final answer clearly states prompt-only mode.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Diagram Workflows
|
|
2
|
+
|
|
3
|
+
## Source selection
|
|
4
|
+
|
|
5
|
+
| Diagram type | Preferred source | QA focus |
|
|
6
|
+
| ------------ | ---------------- | -------- |
|
|
7
|
+
| ER diagram | Mermaid ER, DBML, Graphviz, SVG | Cardinality labels, table names, key fields, crossing relations. |
|
|
8
|
+
| UML class | Mermaid class, PlantUML, Graphviz | Inheritance direction, method/property wrapping, package grouping. |
|
|
9
|
+
| Sequence | Mermaid sequence, PlantUML | Lifeline order, activation spans, async/return arrows, message text. |
|
|
10
|
+
| Technical architecture | Mermaid flowchart, C4/Structurizr, SVG/HTML | Layer grouping, trust boundaries, data flow direction, legends. |
|
|
11
|
+
| ML / deep learning | SVG/HTML/canvas | Tensor shapes, layer order, branch joins, repeated blocks, annotations. |
|
|
12
|
+
| Flowchart | Mermaid flowchart, SVG | Decision labels, terminal states, loop-back readability, connector spacing. |
|
|
13
|
+
|
|
14
|
+
## Minimum source manifest
|
|
15
|
+
|
|
16
|
+
When the rendering path allows it, save a layout manifest next to the PNG:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"canvas": { "width": 1280, "height": 720 },
|
|
21
|
+
"boxes": [
|
|
22
|
+
{ "id": "api", "x": 80, "y": 120, "width": 220, "height": 96, "label": "API Gateway" }
|
|
23
|
+
],
|
|
24
|
+
"connectors": [
|
|
25
|
+
{ "id": "api-db", "from": "api", "to": "db", "points": [[300, 168], [560, 168]] }
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Coordinates are PNG pixel coordinates after export. Boxes should cover visible label/node bounds, not just the center point.
|
|
31
|
+
|
|
32
|
+
## Diagram repair playbook
|
|
33
|
+
|
|
34
|
+
- **Overlapping nodes:** increase rank/column spacing, split clusters, or move low-priority annotations into a legend.
|
|
35
|
+
- **Truncated labels:** widen the node, add manual line breaks, reduce label length, or increase export scale.
|
|
36
|
+
- **Connector through labels:** add waypoints, route orthogonally around boxes, or move labels above the segment.
|
|
37
|
+
- **Connector stacking:** separate parallel edges with different waypoints or bundle them with a shared labeled bus.
|
|
38
|
+
- **Edge clipping:** increase outer padding or export viewBox/canvas size.
|
|
39
|
+
- **Unreadable dense graph:** split into overview plus detail diagrams instead of shrinking everything.
|
|
40
|
+
|
|
41
|
+
## Export guidance
|
|
42
|
+
|
|
43
|
+
Prefer exporting at 2x scale for raster PNGs, then downsample only if text remains crisp. Keep the editable source committed or attached wherever future diagram changes are expected.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# PNG QA And Autofix
|
|
2
|
+
|
|
3
|
+
## Loop
|
|
4
|
+
|
|
5
|
+
1. Export PNG from the editable source or image workflow.
|
|
6
|
+
2. Inspect the PNG visually.
|
|
7
|
+
3. Run `png-qa.mjs` with a manifest when available.
|
|
8
|
+
4. Convert each issue into source, prompt, or layout changes.
|
|
9
|
+
5. Repeat for 2 rounds by default, up to 5 when the user asks for more repair attempts.
|
|
10
|
+
|
|
11
|
+
## Issue mapping
|
|
12
|
+
|
|
13
|
+
| Issue | Repair |
|
|
14
|
+
| ----- | ------ |
|
|
15
|
+
| `blank-image` | Check export target, renderer errors, hidden layers, transparent fill, or failed image generation. |
|
|
16
|
+
| `edge-clipping` | Add canvas padding, expand SVG viewBox, reduce subject scale, or export a larger frame. |
|
|
17
|
+
| `box-overlap` | Increase spacing, reflow to grid/layers, split clusters, or shorten labels. |
|
|
18
|
+
| `box-out-of-bounds` | Move the node inside canvas or increase canvas dimensions. |
|
|
19
|
+
| `label-overflow` | Wrap text, widen the box, reduce copy, or increase font/container size together. |
|
|
20
|
+
| `connector-through-label` | Add waypoints around boxes, move labels, or use orthogonal routing. |
|
|
21
|
+
| `connector-stacking` | Offset parallel connectors or replace repeated lines with a labeled grouped path. |
|
|
22
|
+
| `manifest-canvas-mismatch` | Regenerate the manifest from final export dimensions. |
|
|
23
|
+
|
|
24
|
+
## Manifest quality
|
|
25
|
+
|
|
26
|
+
The helper can only reason about overlaps and connectors when the manifest coordinates match the exported PNG. If the manifest is stale, repair the manifest first, then rerun QA.
|
|
27
|
+
|
|
28
|
+
## Reporting
|
|
29
|
+
|
|
30
|
+
Report the number of QA rounds and the final issue list. If issues remain because the source renderer cannot expose layout coordinates, say which checks were image-only and which require manual visual review.
|