@hupan56/wlkj 2.7.12 → 3.1.2

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 (253) hide show
  1. package/bin/cli.js +1435 -1107
  2. package/package.json +29 -29
  3. package/templates/qoder/agents/insight-planning.md +1 -1
  4. package/templates/qoder/agents/insight-research.md +28 -15
  5. package/templates/qoder/commands/optional/wl-insight.md +161 -161
  6. package/templates/qoder/commands/optional/wl-report.md +20 -39
  7. package/templates/qoder/commands/optional/wl-status.md +4 -4
  8. package/templates/qoder/commands/wl-code.md +2 -2
  9. package/templates/qoder/commands/wl-design.md +6 -6
  10. package/templates/qoder/commands/wl-init.md +3 -3
  11. package/templates/qoder/commands/wl-prd.md +26 -13
  12. package/templates/qoder/commands/wl-req.md +43 -0
  13. package/templates/qoder/commands/wl-search.md +78 -47
  14. package/templates/qoder/commands/wl-task.md +343 -40
  15. package/templates/qoder/commands/wl-test.md +43 -17
  16. package/templates/qoder/config.yaml +52 -14
  17. package/templates/qoder/hooks/post-tool-use.py +181 -0
  18. package/templates/qoder/hooks/session-start.py +94 -23
  19. package/templates/qoder/hooks/stop-eval.py +207 -0
  20. package/templates/qoder/hooks/user-prompt-submit.py +139 -0
  21. package/templates/qoder/rules/wl-pipeline.md +85 -49
  22. package/templates/qoder/scripts/README.md +102 -0
  23. package/templates/qoder/scripts/capability/__init__.py +26 -0
  24. package/templates/qoder/scripts/capability/__main__.py +72 -0
  25. package/templates/qoder/scripts/capability/adapters/__init__.py +29 -0
  26. package/templates/qoder/scripts/capability/adapters/cli.py +316 -0
  27. package/templates/qoder/scripts/capability/adapters/mcp.py +334 -0
  28. package/templates/qoder/scripts/capability/adapters/qw.py +271 -0
  29. package/templates/qoder/scripts/capability/caps/__init__.py +27 -0
  30. package/templates/qoder/scripts/capability/caps/context.py +36 -0
  31. package/templates/qoder/scripts/capability/caps/cron.py +50 -0
  32. package/templates/qoder/scripts/capability/caps/identity.py +43 -0
  33. package/templates/qoder/scripts/capability/caps/memory.py +71 -0
  34. package/templates/qoder/scripts/capability/caps/notify.py +41 -0
  35. package/templates/qoder/scripts/capability/caps/present.py +48 -0
  36. package/templates/qoder/scripts/capability/caps/repo.py +31 -0
  37. package/templates/qoder/scripts/capability/caps/sandbox.py +43 -0
  38. package/templates/qoder/scripts/capability/chain.py +92 -0
  39. package/templates/qoder/scripts/capability/memory_chain.py +41 -0
  40. package/templates/qoder/scripts/capability/registry.py +246 -0
  41. package/templates/qoder/scripts/capability/registry_mcp.py +250 -0
  42. package/templates/qoder/scripts/capability/smoke_test.py +211 -0
  43. package/templates/qoder/scripts/capability/smoke_test_report.json +94 -0
  44. package/templates/qoder/scripts/deployment/setup/__init__.py +11 -0
  45. package/templates/qoder/scripts/deployment/setup/carriers.py +669 -0
  46. package/templates/qoder/scripts/deployment/setup/carriers_verify.py +148 -0
  47. package/templates/qoder/scripts/{init_doctor.py → deployment/setup/init_doctor.py} +100 -39
  48. package/templates/qoder/scripts/{install_qoderwork.py → deployment/setup/install_qoderwork.py} +48 -30
  49. package/templates/qoder/scripts/{platform_doctor.py → deployment/setup/platform_doctor.py} +271 -259
  50. package/templates/qoder/scripts/{repo_root.py → deployment/setup/repo_root.py} +9 -2
  51. package/templates/qoder/scripts/{setup.py → deployment/setup/setup.py} +143 -14
  52. package/templates/qoder/scripts/{setup_lanhu.py → deployment/setup/setup_lanhu.py} +979 -963
  53. package/templates/qoder/scripts/domain/design/__init__.py +0 -0
  54. package/templates/qoder/scripts/{fill_prototype.py → domain/design/fill_prototype.py} +17 -5
  55. package/templates/qoder/scripts/{gen_design_doc.py → domain/design/gen_design_doc.py} +406 -394
  56. package/templates/qoder/scripts/domain/kg/__init__.py +11 -0
  57. package/templates/qoder/scripts/domain/kg/build/__init__.py +0 -0
  58. package/templates/qoder/scripts/domain/kg/build/build_entity_registry.py +201 -0
  59. package/templates/qoder/scripts/domain/kg/build/build_relations.py +132 -0
  60. package/templates/qoder/scripts/{build_style_index.py → domain/kg/build/build_style_index.py} +50 -15
  61. package/templates/qoder/scripts/domain/kg/build/build_workflows.py +149 -0
  62. package/templates/qoder/scripts/{kg_build.py → domain/kg/build/kg_build.py} +685 -612
  63. package/templates/qoder/scripts/{kg_build_db.py → domain/kg/build/kg_build_db.py} +338 -327
  64. package/templates/qoder/scripts/{kg_incremental.py → domain/kg/build/kg_incremental.py} +425 -393
  65. package/templates/qoder/scripts/{learn_aggregate.py → domain/kg/build/learn_aggregate.py} +212 -201
  66. package/templates/qoder/scripts/domain/kg/extract/__init__.py +0 -0
  67. package/templates/qoder/scripts/{common → domain/kg/extract}/extract.py +430 -419
  68. package/templates/qoder/scripts/domain/kg/extract/test_extract.py +115 -0
  69. package/templates/qoder/scripts/{common → domain/kg/extract}/ts_extract.py +614 -536
  70. package/templates/qoder/scripts/domain/kg/graph/__init__.py +0 -0
  71. package/templates/qoder/scripts/{kg_link_db.py → domain/kg/graph/kg_link_db.py} +235 -224
  72. package/templates/qoder/scripts/domain/kg/graph/kg_semantic.py +683 -0
  73. package/templates/qoder/scripts/{kg.py → domain/kg/kg.py} +871 -708
  74. package/templates/qoder/scripts/domain/kg/kg_capabilities.py +182 -0
  75. package/templates/qoder/scripts/domain/kg/search/__init__.py +0 -0
  76. package/templates/qoder/scripts/{context_pack.py → domain/kg/search/context_pack.py} +45 -17
  77. package/templates/qoder/scripts/{enrich_prompt.py → domain/kg/search/enrich_prompt.py} +238 -226
  78. package/templates/qoder/scripts/domain/kg/search/prefetch.py +384 -0
  79. package/templates/qoder/scripts/{common → domain/kg/search}/search_engine.py +207 -205
  80. package/templates/qoder/scripts/{search_index.py → domain/kg/search/search_index.py} +210 -88
  81. package/templates/qoder/scripts/domain/kg/server/__init__.py +0 -0
  82. package/templates/qoder/scripts/domain/kg/server/kgd.py +549 -0
  83. package/templates/qoder/scripts/domain/kg/server/perf_bench.py +197 -0
  84. package/templates/qoder/scripts/domain/kg/storage/__init__.py +0 -0
  85. package/templates/qoder/scripts/{kg_duckdb.py → domain/kg/storage/kg_duckdb.py} +70 -45
  86. package/templates/qoder/scripts/domain/learning/__init__.py +0 -0
  87. package/templates/qoder/scripts/{learn.py → domain/learning/learn.py} +157 -146
  88. package/templates/qoder/scripts/domain/report/__init__.py +11 -0
  89. package/templates/qoder/scripts/{add_session.py → domain/report/add_session.py} +256 -244
  90. package/templates/qoder/scripts/{export.py → domain/report/export.py} +72 -4
  91. package/templates/qoder/scripts/{report.py → domain/report/report.py} +292 -281
  92. package/templates/qoder/scripts/domain/report/report_snapshot.py +261 -0
  93. package/templates/qoder/scripts/domain/report/role.py +39 -0
  94. package/templates/qoder/scripts/{status.py → domain/report/status.py} +737 -628
  95. package/templates/qoder/scripts/domain/report/status_snapshot.py +191 -0
  96. package/templates/qoder/scripts/domain/requirement/__init__.py +0 -0
  97. package/templates/qoder/scripts/{archive_prd.py → domain/requirement/archive_prd.py} +389 -377
  98. package/templates/qoder/scripts/domain/requirement/req.py +228 -0
  99. package/templates/qoder/scripts/domain/task/__init__.py +11 -0
  100. package/templates/qoder/scripts/{git_sync.py → domain/task/git_sync.py} +90 -50
  101. package/templates/qoder/scripts/{syncgate.py → domain/task/syncgate.py} +18 -7
  102. package/templates/qoder/scripts/domain/task/task.py +229 -0
  103. package/templates/qoder/scripts/domain/task/task_lifecycle.py +606 -0
  104. package/templates/qoder/scripts/domain/task/task_query.py +162 -0
  105. package/templates/qoder/scripts/domain/task/task_relations.py +425 -0
  106. package/templates/qoder/scripts/{team_sync.py → domain/task/team_sync.py} +101 -23
  107. package/templates/qoder/scripts/domain/task/zentao_sync.py +370 -0
  108. package/templates/qoder/scripts/foundation/__init__.py +0 -0
  109. package/templates/qoder/scripts/foundation/bootstrap.py +145 -0
  110. package/templates/qoder/scripts/foundation/core/__init__.py +0 -0
  111. package/templates/qoder/scripts/foundation/core/cmd_registry.py +112 -0
  112. package/templates/qoder/scripts/foundation/core/config.py +187 -0
  113. package/templates/qoder/scripts/{common → foundation/core}/paths.py +706 -400
  114. package/templates/qoder/scripts/foundation/data/__init__.py +0 -0
  115. package/templates/qoder/scripts/foundation/data/contract.py +317 -0
  116. package/templates/qoder/scripts/{common → foundation/data}/events.py +2 -2
  117. package/templates/qoder/scripts/foundation/data/result.py +223 -0
  118. package/templates/qoder/scripts/{common → foundation/data}/task_utils.py +427 -392
  119. package/templates/qoder/scripts/foundation/identity/__init__.py +0 -0
  120. package/templates/qoder/scripts/foundation/identity/check_publish.py +103 -0
  121. package/templates/qoder/scripts/{common → foundation/identity}/developer.py +239 -238
  122. package/templates/qoder/scripts/foundation/identity/guard.py +159 -0
  123. package/templates/qoder/scripts/{common → foundation/identity}/identity.py +132 -9
  124. package/templates/qoder/scripts/foundation/identity/roles.py +60 -0
  125. package/templates/qoder/scripts/foundation/integrations/__init__.py +0 -0
  126. package/templates/qoder/scripts/{common → foundation/integrations}/active_task.py +30 -15
  127. package/templates/qoder/scripts/{common → foundation/integrations}/feishu.py +11 -10
  128. package/templates/qoder/scripts/{common → foundation/integrations}/terms.py +3 -3
  129. package/templates/qoder/scripts/foundation/integrations/zentao_client.py +220 -0
  130. package/templates/qoder/scripts/foundation/io/__init__.py +0 -0
  131. package/templates/qoder/scripts/{common → foundation/io}/filelock.py +1 -1
  132. package/templates/qoder/scripts/{common → foundation/io}/reqid.py +1 -1
  133. package/templates/qoder/scripts/foundation/protocol/__init__.py +0 -0
  134. package/templates/qoder/scripts/foundation/protocol/duckdb_conn.py +39 -0
  135. package/templates/qoder/scripts/foundation/protocol/mcp_base.py +268 -0
  136. package/templates/qoder/scripts/foundation/utils/__init__.py +0 -0
  137. package/templates/qoder/scripts/{common → foundation/utils}/eval_api.py +12 -1
  138. package/templates/qoder/scripts/{common → foundation/utils}/pip_install.py +23 -6
  139. package/templates/qoder/scripts/{common → foundation/utils}/platform_guard.py +1 -1
  140. package/templates/qoder/scripts/orchestration/__init__.py +0 -0
  141. package/templates/qoder/scripts/orchestration/wlkj.py +185 -0
  142. package/templates/qoder/scripts/protocol/__init__.py +0 -0
  143. package/templates/qoder/scripts/protocol/browser/README.md +207 -0
  144. package/templates/qoder/scripts/protocol/browser/SKILL.md +265 -0
  145. package/templates/qoder/scripts/protocol/browser/config.env +9 -0
  146. package/templates/qoder/scripts/protocol/browser/references/cdp-api.md +110 -0
  147. package/templates/qoder/scripts/protocol/browser/references/migration-2.5.3.md +72 -0
  148. package/templates/qoder/scripts/protocol/browser/references/site-patterns/.gitkeep +0 -0
  149. package/templates/qoder/scripts/protocol/browser/scripts/browser-discovery.mjs +138 -0
  150. package/templates/qoder/scripts/protocol/browser/scripts/cdp-proxy.mjs +672 -0
  151. package/templates/qoder/scripts/protocol/browser/scripts/check-deps.mjs +206 -0
  152. package/templates/qoder/scripts/protocol/browser/scripts/find-url.mjs +253 -0
  153. package/templates/qoder/scripts/protocol/browser/scripts/match-site.mjs +46 -0
  154. package/templates/qoder/scripts/protocol/browser/templates/config.env.template +9 -0
  155. package/templates/qoder/scripts/protocol/mcp/__init__.py +11 -0
  156. package/templates/qoder/scripts/protocol/mcp/kg_mcp_server.py +478 -0
  157. package/templates/qoder/scripts/{lanhu_stdio_wrapper.py → protocol/mcp/lanhu_stdio_wrapper.py} +131 -119
  158. package/templates/qoder/scripts/protocol/mcp/mcp_doctor.py +548 -0
  159. package/templates/qoder/scripts/protocol/mcp/mcp_launcher.py +600 -0
  160. package/templates/qoder/scripts/protocol/mcp/mysql_mcp_server.py +461 -0
  161. package/templates/qoder/scripts/protocol/mcp/zentao_mcp_server.py +1920 -0
  162. package/templates/qoder/scripts/protocol/transports/__init__.py +56 -0
  163. package/templates/qoder/scripts/protocol/transports/base.py +87 -0
  164. package/templates/qoder/scripts/protocol/transports/cli.py +132 -0
  165. package/templates/qoder/scripts/protocol/transports/http.py +141 -0
  166. package/templates/qoder/scripts/protocol/transports/stdio.py +293 -0
  167. package/templates/qoder/scripts/run_weekly_update.bat +27 -18
  168. package/templates/qoder/scripts/run_weekly_update.sh +22 -13
  169. package/templates/qoder/scripts/validation/__init__.py +0 -0
  170. package/templates/qoder/scripts/validation/eval/__init__.py +0 -0
  171. package/templates/qoder/scripts/validation/eval/perf-report-2026-06-24.md +139 -0
  172. package/templates/qoder/scripts/validation/eval/qwork_harness.py +617 -0
  173. package/templates/qoder/scripts/validation/eval/report-commands.md +220 -0
  174. package/templates/qoder/scripts/validation/eval/transcript_timing.py +386 -0
  175. package/templates/qoder/scripts/validation/metrics/__init__.py +0 -0
  176. package/templates/qoder/scripts/{eval_prd.py → validation/metrics/eval_prd.py} +84 -15
  177. package/templates/qoder/scripts/validation/metrics/usability_score.py +750 -0
  178. package/templates/qoder/scripts/validation/test/__init__.py +11 -0
  179. package/templates/qoder/scripts/validation/test/assertion_gen.py +551 -0
  180. package/templates/qoder/scripts/{autotest.py → validation/test/autotest.py} +1234 -1751
  181. package/templates/qoder/scripts/validation/test/autotest_auth.py +109 -0
  182. package/templates/qoder/scripts/{autotest_batch.py → validation/test/autotest_batch.py} +255 -224
  183. package/templates/qoder/scripts/validation/test/autotest_data.py +680 -0
  184. package/templates/qoder/scripts/validation/test/autotest_opencli.py +646 -0
  185. package/templates/qoder/scripts/{autotest_run.py → validation/test/autotest_run.py} +323 -297
  186. package/templates/qoder/scripts/validation/test/autotest_webaccess.py +571 -0
  187. package/templates/qoder/scripts/{benchmark.py → validation/test/benchmark.py} +17 -5
  188. package/templates/qoder/scripts/{kg_auto_login.py → validation/test/kg_auto_login.py} +208 -196
  189. package/templates/qoder/scripts/{kg_test_runner.py → validation/test/kg_test_runner.py} +13 -2
  190. package/templates/qoder/scripts/{page_probe.py → validation/test/page_probe.py} +470 -459
  191. package/templates/qoder/scripts/validation/test/smoke_all_commands.py +170 -0
  192. package/templates/qoder/settings.json +23 -2
  193. package/templates/qoder/skills/design-import/SKILL.md +235 -226
  194. package/templates/qoder/skills/design-review/SKILL.md +91 -82
  195. package/templates/qoder/skills/prd-generator/SKILL.md +38 -24
  196. package/templates/qoder/skills/prd-review/SKILL.md +8 -6
  197. package/templates/qoder/skills/prototype-generator/SKILL.md +296 -247
  198. package/templates/qoder/skills/spec-coder/SKILL.md +24 -15
  199. package/templates/qoder/skills/spec-generator/SKILL.md +24 -12
  200. package/templates/qoder/skills/test-generator/SKILL.md +9 -7
  201. package/templates/qoder/skills/wl-code/SKILL.md +25 -13
  202. package/templates/qoder/skills/wl-commit/SKILL.md +10 -9
  203. package/templates/qoder/skills/wl-design/SKILL.md +7 -5
  204. package/templates/qoder/skills/wl-init/SKILL.md +8 -8
  205. package/templates/qoder/skills/wl-insight/SKILL.md +25 -12
  206. package/templates/qoder/skills/wl-prd-full/SKILL.md +59 -8
  207. package/templates/qoder/skills/wl-prd-quick/SKILL.md +7 -7
  208. package/templates/qoder/skills/wl-prd-review/SKILL.md +18 -6
  209. package/templates/qoder/skills/wl-report/SKILL.md +27 -25
  210. package/templates/qoder/skills/wl-search/SKILL.md +151 -80
  211. package/templates/qoder/skills/wl-spec/SKILL.md +9 -7
  212. package/templates/qoder/skills/wl-status/SKILL.md +50 -18
  213. package/templates/qoder/skills/wl-task/SKILL.md +94 -12
  214. package/templates/qoder/skills/wl-test/SKILL.md +154 -45
  215. package/templates/qoder/templates/prd-full-template.md +7 -0
  216. package/templates/root/AGENTS.md +275 -237
  217. package/templates/root/requirements.txt +3 -0
  218. package/templates/root//344/275/277/347/224/250/350/257/264/346/230/216.md +3 -3
  219. package/templates/root//346/226/260/346/211/213/346/214/207/345/215/227.md +2 -2
  220. package/templates/qoder/hooks/inject-workflow-state.py +0 -169
  221. package/templates/qoder/scripts/__pycache__/check_mcp_launch.cpython-39.pyc +0 -0
  222. package/templates/qoder/scripts/__pycache__/install_qoderwork.cpython-39.pyc +0 -0
  223. package/templates/qoder/scripts/__pycache__/mcp_launcher.cpython-39.pyc +0 -0
  224. package/templates/qoder/scripts/__pycache__/platform_doctor.cpython-39.pyc +0 -0
  225. package/templates/qoder/scripts/check_carriers.py +0 -238
  226. package/templates/qoder/scripts/check_mcp.py +0 -298
  227. package/templates/qoder/scripts/check_mcp_launch.py +0 -183
  228. package/templates/qoder/scripts/check_qoderwork_consistency.py +0 -166
  229. package/templates/qoder/scripts/collect_prds.py +0 -31
  230. package/templates/qoder/scripts/common/mentions.py +0 -134
  231. package/templates/qoder/scripts/common/utf8.py +0 -38
  232. package/templates/qoder/scripts/extract_api_params.py +0 -246
  233. package/templates/qoder/scripts/extract_routes.py +0 -54
  234. package/templates/qoder/scripts/extract_routes_tree.py +0 -78
  235. package/templates/qoder/scripts/handoff.py +0 -22
  236. package/templates/qoder/scripts/init_developer.py +0 -76
  237. package/templates/qoder/scripts/kg_mcp_server.py +0 -801
  238. package/templates/qoder/scripts/kg_semantic.py +0 -150
  239. package/templates/qoder/scripts/mcp_launcher.py +0 -414
  240. package/templates/qoder/scripts/mysql_mcp_server.py +0 -396
  241. package/templates/qoder/scripts/parse_prds.py +0 -33
  242. package/templates/qoder/scripts/role.py +0 -51
  243. package/templates/qoder/scripts/sync_carriers.py +0 -259
  244. package/templates/qoder/scripts/task.py +0 -1261
  245. package/templates/qoder/scripts/workspace_init.py +0 -102
  246. package/templates/qoder/scripts/zentao_mcp_server.py +0 -424
  247. package/templates/qoder/skills/prompt-enrich/SKILL.md +0 -90
  248. /package/templates/qoder/scripts/{common → deployment}/__init__.py +0 -0
  249. /package/templates/qoder/{skills/prototype-generator/SKILL.md.zcode-79180-2af4721f-f9a6-412c-88db-c0af680d211b.tmp → scripts/domain/__init__.py} +0 -0
  250. /package/templates/qoder/scripts/{common → domain/kg/graph}/graph_traverse.py +0 -0
  251. /package/templates/qoder/scripts/{common → domain/kg/server}/repowiki.py +0 -0
  252. /package/templates/qoder/scripts/{common → foundation/io}/atomicio.py +0 -0
  253. /package/templates/qoder/scripts/{secure-ls.js → validation/test/secure-ls.js} +0 -0
@@ -1,256 +1,305 @@
1
- ---
2
- name: prototype-generator
3
- description: "生成匹配项目 UI 风格的交互式 HTML 原型(Web 端 fywl-ui 用 Vben Admin + Ant Design Vue;APP 端 Carmg-H5 用 Vant 3)。Generate interactive HTML prototypes matching project UI style. 用户说'做个原型''画个 mockup''看看效果''出个界面预览'时触发。"
4
- trigger: "user asks for prototype, mockup, UI preview, or when PRD needs visual illustration"
5
- ---
6
-
7
-
8
- ## 🔧 仓库根定位(QoderWork 桌面端 vs Qoder IDE/CLI)
9
-
10
- **后续脚本里的 `$R` 代表仓库根**,先确定它(QoderWork 桌面端工作目录不是仓库根,相对路径会失效):
11
- ```bash
12
- R=$(python ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
13
- ```
14
- > `repo_root.py` 从 `~/.qoderwork/mcp.json` 反推仓库根;失败回退 `.`(IDE/CLI 工作目录即仓库根)。找不到时先跑 `python .qoder/scripts/install_qoderwork.py`。
15
-
16
- # Prototype Generator
17
-
18
- Generate production-ready HTML prototypes that match the project's actual UI style.
19
-
20
- ## ⚙️ 自取上下文(Quest / QoderWork 无 hook 注入,必须自读)
21
-
22
- - `.qoder/.developer` 决定产出存到 `workspace/members/{dev}/drafts/`
23
- - 若 `.qoder/.current-task` 存在,原型命名带上任务关键词
24
- - 平台(Web/APP/Both)必须明确;如未指定,先问用户(见 prd-generator Step 0)
25
-
26
- ## Step 0: Know the Platform
27
-
28
- The platform MUST already be decided (asked by /wl-prd-full Step 0).
29
- If you don't know it, STOP and ask the user (Web 管理端 / APP 移动端 / 两端都要).
30
-
31
- | Platform | Project | Template | Design Tokens |
32
- |----------|---------|----------|---------------|
33
- | Web | fywl-ui | .qoder/templates/prototype-web.html | data/index/vben-style-reference.json (HSL) |
34
- | APP | Carmg-H5 | .qoder/templates/prototype-app.html | Vant 3 variables (in template) |
35
- | Both | both | both templates | generate 2 files: -web.html and -app.html |
36
-
37
- ## Style Sources (Priority Order)
38
-
39
- 1. **data/code/** - Existing Vue code from the TARGET project (HIGHEST priority)
40
- 2. **data/index/vben-style-reference.json** - Vben design tokens (Web)
41
- / Vant variables baked into prototype-app.html (APP)
42
- 3. **data/index/chart-style-reference.json** - Dashboard/big-screen/chart
43
- idioms (REQUIRED for dashboard/看板/大屏/统计类原型)
44
- 4. **data/style/** - PDF design specs (only if a token is missing above)
45
-
46
- If code conflicts with PDF, CODE WINS. The templates already contain the
47
- correct tokens — do NOT invent colors or copy Ant Design defaults
48
- (#1890ff is NOT this project's primary).
49
-
50
- ## ⚠️ NEW-FEATURE prototypes MUST also anchor to real pages
1
+ ---
2
+ name: prototype-generator
3
+ description: "生成匹配项目 UI 风格的交互式 HTML 原型(Web 端 fywl-ui 用 Vben Admin + Ant Design Vue;APP 端 Carmg-H5 用 Vant 3)。Generate interactive HTML prototypes matching project UI style. "
4
+ trigger: "user invokes /wl-* command explicitly"
5
+ ---
6
+
7
+
8
+ ## 🔧 仓库根定位(QoderWork 桌面端 vs Qoder IDE/CLI)
9
+
10
+ **后续脚本里的 `$R` 代表仓库根**,先确定它(QoderWork 桌面端工作目录不是仓库根,相对路径会失效):
11
+ ```bash
12
+ R=$(python ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
13
+ ```
14
+ > `repo_root.py` 从 `~/.qoderwork/mcp.json` 反推仓库根;失败回退 `.`(IDE/CLI 工作目录即仓库根)。找不到时先跑 `python "$R/.qoder/scripts/orchestration/wlkj.py" install-qw`。
15
+
16
+ # Prototype Generator
17
+
18
+ Generate production-ready HTML prototypes that match the project's actual UI style.
19
+
20
+ ## 🔌 MCP 工具可用性(双轨)
21
+
22
+ skill 用到的知识图谱 MCP 工具(`MCP 工具 (` / `MCP 工具 (`)**自动路由(有 MCP 走 MCP,无 MCP 走 CLI)**。
23
+
24
+ - **QoderWork**:直接调 MCP 工具(更快更准)。
25
+ - **Qoder IDE/Quest/CLI(无 MCP)**:用 `python "$R/.qoder/scripts/orchestration/wlkj.py" search` 降级(`--style` / `--field <名>` / `--vben` / `--components`);仅 MCP 有的能力(如 fill_prototype/context_pack)跳过或人工补。
26
+
27
+ ## ⚙️ 自取上下文(Quest / QoderWork 无 hook 注入,必须自读)
28
+
29
+ - **当前身份**:决定产出存到 `workspace/members/{dev}/drafts/`。读法:先 `R=$(python ~/.qoderwork/repo_root.py 2>/dev/null) || R=.` 定位仓库根,
30
+ 再 `python "$R/.qoder/scripts/foundation/core/paths.py" whoami`(输出开发者名;空=未初始化)。
31
+ ⚠️ 勿用裸相对路径 `.qoder/.developer`(QoderWork 桌面端 cwd 不在仓库根,会读不到而误报未初始化)。
32
+ - 若 `.qoder/.current-task` 存在,原型命名带上任务关键词
33
+ - 平台(Web/APP/Both)必须明确;如未指定,先问用户(见 prd-generator Step 0)
34
+
35
+ ## ⚠️ 前置门: 用户是否选了"画原型"?(v3.1 新增)
36
+
37
+ skill **只在用户明确选择"画原型"后才进入**。
38
+
39
+ - 如果上游 `/wl-prd-full` `/wl-prd` 在「批量确认」环节已决定**不画**(PRD 1
40
+ `@contract` 头标记 `prototype: none`),**立即退出本 skill**,不生成任何 HTML。
41
+ - 如果上游没有 contract 头(独立调用本 skill),**先问用户**:
42
+ `这个需求要画原型吗?(画 / 不画)`
43
+ 用户答"不画"→ 退出;用户答"画"→ 继续。
44
+ - **绝不擅自决定画/不画**。决策权在用户,本 skill 只执行。
45
+
46
+ > 这条门治"AI 默默画了个塑料骨架"的反模式——比如"出交车点检固定为总部全局规则"
47
+ > 这种纯规则下发型需求,AI 不该自己往里塞一个配置页原型。
51
48
 
52
- For a feature with NO existing page (e.g. brainstorm/new dashboard), the
53
- style must STILL come from the system, never from generic admin templates:
54
-
55
- 1. Find the closest in-system page family:
56
- `search_index.py --style <type> --platform <p>` + read 1-2 real pages
57
- 2. Dashboard/看板/大屏类: read data/index/chart-style-reference.json and
58
- choose the idiom 大屏深蓝风 (dashboard/monitor 先例: 全国地图/驾驶舱)
59
- or 浅色卡片风 (dashboard/workbench 先例: 工作台统计卡)
60
- 3. Use REAL business vocabulary from the index (e.g. 异常三分类
61
- 人员作业异常/车辆异常/费用异常 comes from workbench/components/abnormal.vue)
62
- 4. In the prototype header comment, cite which real files the style came from
63
- — if you cannot name a source file, you have NOT done step 1.
64
-
65
- ## Step 0.5: Get Design System (MUST DO FIRST)
66
-
67
- **PREFERRED: Call MCP tool (faster, auto-generates if missing):**
68
- ```
69
- mcp__qoder-knowledge-graph__get_design_system(platform='web')
70
- ```
71
-
72
- **FALLBACK: Read file directly:**
73
- Read `data/design/DESIGN.md`. If missing, run `python "$R/.qoder/scripts/gen_design_doc.py"`.
74
-
75
- Returns: layout fingerprint (sidebar 160px, mixed-nav), token set (primary HSL),
76
- page type patterns, form behavior modes, icon rules, component stats.
77
-
78
- > This is the v0.dev Registry equivalent — one call teaches AI the entire design system.
79
-
80
- ## Step 1: Determine Prototype Type
81
-
82
- Read the requirement to decide:
83
- - **Table page**: List with search form + data grid + actions
84
- - **Form page**: Create/edit form with validation
85
- - **Detail page**: Read-only data display
86
- - **Modal/Drawer**: Popup form
87
- - **Dashboard**: Charts + summary cards
88
-
89
- ## Step 1.5: Prefill Draft (MUST DO - 80% auto, 20% you adjust)
90
-
91
- **PREFERRED: Call MCP tool:**
92
- ```
93
- mcp__qoder-knowledge-graph__fill_prototype(keyword='营业外合同', platform='web')
94
- ```
95
-
96
- **FALLBACK: Run script:**
97
- ```bash
98
- python "$R/.qoder/scripts/fill_prototype.py" <关键词> --platform <web|app>
99
- ```
100
-
101
- Returns: 80% complete HTML draft (real columns/fields/layout injected) + data manifest.
102
- Your job: 20% adjustment only (interaction details, layout tweaks).
103
- **DO NOT change tokens/colors/layout params they come from real code.**
104
- 需要用户提供参考页/设计稿,而不是默默画个默认骨架
105
-
106
- 脚本/MCP 输出的数据清单包含:
107
- 1. **真实表格列/表单字段**(来自 page_examples,非编造)
108
- 2. **layout_fingerprint**(侧边栏宽度 160px、布局模式 mixed-nav,已注入 CSS)
109
- 3. **behaviors**(表单模式 single/wizard/tabs、表格分页方式、弹窗类型)
110
- 4. **🆕 真实按钮文案**(来自 entity-registry,如"添加反馈资产""导出 Excel"——别编"新增/编辑")
111
- 5. **🆕 功能模块**(需求属于哪个模块、该模块有多少现有页面、标杆页面路径)
112
- 6. **预填 HTML 草稿**(80% 完成)
113
-
114
- 你的工作只剩 **20% 微调**:
115
- - 用数据清单里的**真实按钮文案**替换通用文案(详情/编辑 → 系统真实按钮名)
116
- - 补充交互细节(侧边栏折叠、弹窗、Tab 切换)
117
- - 参考功能模块的标杆页面,确保布局跟同模块页面一致
118
-
119
- **⚠️ 铁律**:
120
- - 草稿里的 token(颜色/间距/侧边栏宽度)是**正确的**,**不要改成 #1890ff 或你编的值**
121
- - 数据清单里的字段/按钮来自真实代码,**不要替换成你编的**
122
- - 按钮文案优先用 entity-registry 里的真实文案,没有才用通用文案
123
- - 你只做"调整",不做"重写"——如果草稿已满足需求,甚至可以零修改直接用
124
-
125
- > **为什么这一步必要**:旧流程 AI 从零手写 HTML+CSS,12 个原型里 2 个硬编码了
126
- > 禁止的 #1890ff(Ant Design 默认色,非 Vben),模板形同虚设。
127
- > fill_prototype 从源头消灭这个问题——token 继承模板,字段来自索引。
128
-
129
- ## Step 2: Load Style Context(仅当 Step 1.5 草稿不够时补充)
130
-
131
- **PREFERRED: MCP tools (designer-focused, no code noise):**
132
- ```
133
- mcp__qoder-knowledge-graph__context_pack(keyword='异常资产申请', platform='web', role='design')
134
- ```
135
- `role='design'` 只返回页面示例+布局指纹+风格速查+字段,过滤掉代码/API噪音。
136
- 比无 role 更干净,原型生成专用。
137
-
138
- **理解业务交互流程(原型要有状态,不只是静态截图):**
139
- ```
140
- mcp__qoder-knowledge-graph__get_workflow(module='资产')
141
- ```
142
- 返回操作链(如:查询→新增→提交→审批→归档→导出)。
143
- AI 据此设计原型的交互状态和页面跳转。
144
-
145
- **查语义级模块文档(比读代码更省 token):**
146
- ```
147
- mcp__search_wiki(keyword='资产')
148
- ```
149
-
150
- **FALLBACK: Python scripts:**
151
- ```bash
152
- python "$R/.qoder/scripts/search_index.py" --style <table|form|detail|modal|dashboard> --platform <web|app>
153
- python "$R/.qoder/scripts/search_index.py" <keyword> --platform <web|app>
154
- python "$R/.qoder/scripts/search_index.py" --field <field_name>
155
- ```
156
-
157
- Then read the TOP 2-3 most similar existing Vue files to extract:
158
- - Table column titles/fields and widths
159
- - Form field layouts and component types
160
- - Button styles and positions
161
-
162
- ## Step 3: Fill the Template
163
-
164
- Read the platform template and replace its placeholders.
165
-
166
- **prototype-web.html** (Web, Vben Admin mixed-nav shell, VxeGrid table):
167
-
168
- 布局外壳 = mixed-nav 三段式(顶部一级菜单 + 左侧二级菜单[可折叠三级] + 主区标签页)。
169
- fill_prototype 会按目标项目的 `layout_fingerprint` 自动填示例菜单骨架,
170
- 你只需按 PRD/需求替换成真实菜单层级。
171
-
172
- 占位符:
173
- - `{{TITLE}}` - browser tab title
174
- - `{{LOGO_TEXT}}` - 顶部 logo 文字(如 "ICS智云")
175
- - `{{MODULE_NAME}}` - 当前模块名(breadcrumb/菜单高亮用)
176
- - `{{TOP_MENU}}` - 顶部一级菜单项(`<div class="top-menu-item">`),当前模块加 `active`
177
- - `{{SIDEBAR_MENU}}` - 左侧二级菜单;三级用 `<details class="sidebar-group">` 折叠(见下),当前页加 `sidebar-item active`
178
- - `{{TABS}}` - 主区标签页(承载三四级页面),当前页加 `tab-item active`
179
- - `{{PAGE_NAME}}` - page name in breadcrumb
180
- - `{{SEARCH_FORM_FIELDS}}` - search form items (label + input/select)
181
- - `{{TABLE_HEADERS}}` - `<th>` cells using REAL column titles from code
182
- - `{{TABLE_ROWS}}` - `<tr>` rows with realistic sample data
49
+ ---
50
+ ## Step 0: Know the Platform
51
+
52
+ The platform MUST already be decided (asked by /wl-prd-full Step 0).
53
+ If you don't know it, STOP and ask the user (Web 管理端 / APP 移动端 / 两端都要).
54
+
55
+ | Platform | Project | Template | Design Tokens |
56
+ |----------|---------|----------|---------------|
57
+ | Web | fywl-ui | .qoder/templates/prototype-web.html | data/index/vben-style-reference.json (HSL) |
58
+ | APP | Carmg-H5 | .qoder/templates/prototype-app.html | Vant 3 variables (in template) |
59
+ | Both | both | both templates | generate 2 files: -web.html and -app.html |
60
+
61
+ ## Style Sources (Priority Order)
62
+
63
+ 1. **data/code/** - Existing Vue code from the TARGET project (HIGHEST priority)
64
+ 2. **data/index/vben-style-reference.json** - Vben design tokens (Web)
65
+ / Vant variables baked into prototype-app.html (APP)
66
+ 3. **data/index/chart-style-reference.json** - Dashboard/big-screen/chart
67
+ idioms (REQUIRED for dashboard/看板/大屏/统计类原型)
68
+ 4. **data/style/** - PDF design specs (only if a token is missing above)
69
+
70
+ If code conflicts with PDF, CODE WINS. The templates already contain the
71
+ correct tokens — do NOT invent colors or copy Ant Design defaults
72
+ (#1890ff is NOT this project's primary).
73
+
74
+ ## ⚠️ NEW-FEATURE prototypes MUST also anchor to real pages
75
+
76
+ For a feature with NO existing page (e.g. brainstorm/new dashboard), the
77
+ style must STILL come from the system, never from generic admin templates:
78
+
79
+ 1. Find the closest in-system page family:
80
+ `search_index.py --style <type> --platform <p>` + read 1-2 real pages
81
+ 2. Dashboard/看板/大屏类: read data/index/chart-style-reference.json and
82
+ choose the idiom 大屏深蓝风 (dashboard/monitor 先例: 全国地图/驾驶舱)
83
+ or 浅色卡片风 (dashboard/workbench 先例: 工作台统计卡)
84
+ 3. Use REAL business vocabulary from the index (e.g. 异常三分类
85
+ 人员作业异常/车辆异常/费用异常 comes from workbench/components/abnormal.vue)
86
+ 4. In the prototype header comment, cite which real files the style came from
87
+ — if you cannot name a source file, you have NOT done step 1.
88
+
89
+ ## 🔒 Step 0.5: Get Design System(硬门 #1,跳过则 A2 必扣分)
90
+
91
+ **PREFERRED: Call MCP tool (faster, auto-generates if missing):**
92
+ ```
93
+ cap.mcp.call("get_design_system", {"platform": "web"})
94
+ ```
95
+
96
+ **FALLBACK: Read file directly:**
97
+ Read `data/design/DESIGN.md`. If missing, run `python "$R/.qoder/scripts/orchestration/wlkj.py" design-doc`.
98
+
99
+ Returns: layout fingerprint (sidebar 160px, mixed-nav), token set (primary HSL),
100
+ page type patterns, form behavior modes, icon rules, component stats.
101
+
102
+ > This is the v0.dev Registry equivalent — one call teaches AI the entire design system.
103
+
104
+ ## Step 1: Determine Prototype Type
105
+
106
+ Read the requirement to decide:
107
+ - **Table page**: List with search form + data grid + actions
108
+ - **Form page**: Create/edit form with validation
109
+ - **Detail page**: Read-only data display
110
+ - **Modal/Drawer**: Popup form
111
+ - **Dashboard**: Charts + summary cards
112
+
113
+ ## 🔒 Step 1.5: Prefill Draft(硬门 #2,跳过等于从零手抄 → 必出模板感)
114
+
115
+ **PREFERRED: Call MCP tool:**
116
+ ```
117
+ cap.mcp.call("fill_prototype", {"keyword": "营业外合同", "platform": "web"})
118
+ ```
119
+
120
+ **FALLBACK: Run script:**
121
+ ```bash
122
+ python "$R/.qoder/scripts/orchestration/wlkj.py" fill-prototype <关键词> --platform <web|app>
123
+ ```
124
+
125
+ Returns: 80% complete HTML draft (real columns/fields/layout injected) + data manifest.
126
+ Your job: 20% adjustment only (interaction details, layout tweaks).
127
+ **DO NOT change tokens/colors/layout params — they come from real code.**
128
+ 需要用户提供参考页/设计稿,而不是默默画个默认骨架
129
+
130
+ 脚本/MCP 输出的数据清单包含:
131
+ 1. **真实表格列/表单字段**(来自 page_examples,非编造)
132
+ 2. **layout_fingerprint**(侧边栏宽度 160px、布局模式 mixed-nav,已注入 CSS)
133
+ 3. **behaviors**(表单模式 single/wizard/tabs、表格分页方式、弹窗类型)
134
+ 4. **🆕 真实按钮文案**(来自 entity-registry,如"添加反馈资产""导出 Excel"——别编"新增/编辑")
135
+ 5. **🆕 功能模块**(需求属于哪个模块、该模块有多少现有页面、标杆页面路径)
136
+ 6. **预填 HTML 草稿**(80% 完成)
137
+
138
+ 你的工作只剩 **20% 微调**:
139
+ - 用数据清单里的**真实按钮文案**替换通用文案(详情/编辑 → 系统真实按钮名)
140
+ - 补充交互细节(侧边栏折叠、弹窗、Tab 切换)
141
+ - 参考功能模块的标杆页面,确保布局跟同模块页面一致
142
+
143
+ **⚠️ 铁律**:
144
+ - 草稿里的 token(颜色/间距/侧边栏宽度)是**正确的**,**不要改成 #1890ff 或你编的值**
145
+ - 数据清单里的字段/按钮来自真实代码,**不要替换成你编的**
146
+ - 按钮文案优先用 entity-registry 里的真实文案,没有才用通用文案
147
+ - 你只做"调整",不做"重写"——如果草稿已满足需求,甚至可以零修改直接用
148
+
149
+ > **为什么这一步必要**:旧流程 AI 从零手写 HTML+CSS,12 个原型里 2 个硬编码了
150
+ > 禁止的 #1890ff(Ant Design 默认色,非 Vben),模板形同虚设。
151
+ > fill_prototype 从源头消灭这个问题——token 继承模板,字段来自索引。
152
+
153
+ ## Step 2: Load Style Context(仅当 Step 1.5 草稿不够时补充)
154
+
155
+ **PREFERRED: MCP tools (designer-focused, no code noise):**
156
+ ```
157
+ cap.mcp.call("context_pack", {"keyword": "异常资产申请", "platform": "web", "role": "design"})
158
+ ```
159
+ `role='design'` 只返回页面示例+布局指纹+风格速查+字段,过滤掉代码/API噪音。
160
+ 比无 role 更干净,原型生成专用。
161
+
162
+ **理解业务交互流程(原型要有状态,不只是静态截图):**
163
+ ```
164
+ cap.mcp.call("get_workflow", {"module": "资产"})
165
+ ```
166
+ 返回操作链(如:查询→新增→提交→审批→归档→导出)。
167
+ AI 据此设计原型的交互状态和页面跳转。
168
+
169
+ **查语义级模块文档(比读代码更省 token):**
170
+ ```
171
+ cap.mcp.call("search_wiki", {"keyword": "资产"})
172
+ ```
173
+
174
+ **FALLBACK: Python scripts:**
175
+ ```bash
176
+ python "$R/.qoder/scripts/orchestration/wlkj.py" search --style <table|form|detail|modal|dashboard> --platform <web|app>
177
+ python "$R/.qoder/scripts/orchestration/wlkj.py" search <keyword> --platform <web|app>
178
+ python "$R/.qoder/scripts/orchestration/wlkj.py" search --field <field_name>
179
+ ```
180
+
181
+ Then read the TOP 2-3 most similar existing Vue files to extract:
182
+ - Table column titles/fields and widths
183
+ - Form field layouts and component types
184
+ - Button styles and positions
185
+
186
+ ## Step 3: Fill the Template
187
+
188
+ Read the platform template and replace its placeholders.
189
+
190
+ **prototype-web.html** (Web, Vben Admin mixed-nav shell, VxeGrid table):
191
+
192
+ 布局外壳 = mixed-nav 三段式(顶部一级菜单 + 左侧二级菜单[可折叠三级] + 主区标签页)。
193
+ fill_prototype 会按目标项目的 `layout_fingerprint` 自动填示例菜单骨架,
194
+ 你只需按 PRD/需求替换成真实菜单层级。
195
+
196
+ 占位符:
197
+ - `{{TITLE}}` - browser tab title
198
+ - `{{LOGO_TEXT}}` - 顶部 logo 文字(如 "ICS智云")
199
+ - `{{MODULE_NAME}}` - 当前模块名(breadcrumb/菜单高亮用)
200
+ - `{{TOP_MENU}}` - 顶部一级菜单项(`<div class="top-menu-item">`),当前模块加 `active`
201
+ - `{{SIDEBAR_MENU}}` - 左侧二级菜单;三级用 `<details class="sidebar-group">` 折叠(见下),当前页加 `sidebar-item active`
202
+ - `{{TABS}}` - 主区标签页(承载三四级页面),当前页加 `tab-item active`
203
+ - `{{PAGE_NAME}}` - page name in breadcrumb
204
+ - `{{SEARCH_FORM_FIELDS}}` - search form items (label + input/select)
205
+ - `{{TABLE_HEADERS}}` - `<th>` cells using REAL column titles from code
206
+ - `{{TABLE_ROWS}}` - `<tr>` rows with realistic sample data
207
+
208
+ 三级折叠菜单写法(原生 `<details>`,零 JS):
209
+ ```html
210
+ <details class="sidebar-group">
211
+ <summary>二级菜单A</summary>
212
+ <div class="sidebar-sub">
213
+ <div class="sidebar-item">三级菜单A-1</div>
214
+ <div class="sidebar-item">三级菜单A-2</div>
215
+ </div>
216
+ </details>
217
+ ```
218
+
219
+ **prototype-app.html** (APP, Vant 3 variables, 375px, NavBar + TabBar):
220
+ - `{{TITLE}}` - browser tab title
221
+ - `{{PAGE_TITLE}}` - NavBar title
222
+ - `{{LIST_ITEMS}}` - list cells (van-cell style)
223
+ - `{{ITEM_TITLE}}` / `{{ITEM_DESC}}` - cell content
224
+
225
+ Key design tokens already in the templates (do not override):
226
+ - Web primary: 来自 `style-index.json` 的 `layout_fingerprint.color_primary`
227
+ (ICS = `hsl(214.58, 86.34%, 59.8%)`,已写入模板 `:root --primary`)
228
+ - APP primary: `--van-primary-color: #1989fa`
229
+
230
+ ## ⚠️ Icons: NEVER emoji, ALWAYS the project's real icon system
231
+
232
+ Source of truth: **data/index/icon-reference.json** (real usage counts +
233
+ ready-to-paste SVGs extracted from the actual projects).
234
+
235
+ - **Web (fywl-ui)**: Ant Design icons. Inline the SVG from icon-reference.json:
236
+ ```html
237
+ <span class="anticon">{svg from icon-reference.json web.svg.outlined[...]}</span>
238
+ <style>.anticon svg{width:1em;height:1em;fill:currentColor}</style>
239
+ ```
240
+ Most-used in the real app: Download(303x), Plus(171x), Delete, Search, Edit...
241
+ - **APP (Carmg-H5)**: Vant font icons:
242
+ ```html
243
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@4/lib/index.css">
244
+ <i class="van-icon van-icon-search"></i>
245
+ ```
246
+ Most-used: arrow-down, arrow, plus, cross, search...
247
+ - An emoji (👤🚛💰⚠️...) anywhere in a prototype = automatic style FAIL.
248
+
249
+ ## ⚠️ 菜单/侧边栏层级: 必须按需求填, 不准退化成扁平框
250
+
251
+ 这是最常翻车的点。模板已是 **mixed-nav 多级骨架**(一级顶栏 + 二级侧栏 +
252
+ 三级折叠 + 标签页),不要退化成旧的"扁平单级 sidebar"。
253
+
254
+ 铁律:
255
+ 1. 如果 PRD/需求**描述了侧边栏或菜单结构**(如"左边点一级显示二级,右边显示
256
+ 三四级"),**严格按它填** `{{TOP_MENU}}`/`{{SIDEBAR_MENU}}`/`{{TABS}}`。
257
+ 例如"一级→二级,右侧三四级"翻译成:顶部一级 tab + 左侧二级列表 + 标签页放三四级。
258
+ 2. 如果需求没提菜单,保留 fill_prototype 填的**示例多级结构**(不要删成单级)。
259
+ 3. 永远不要把 `{{SIDEBAR_MENU}}` 填成只有一个 `sidebar-item` —— 那是 bug。
260
+ 4. ICS 的菜单来自后端接口(`access_mode: backend`),静态代码里抓不到完整菜单树,
261
+ 所以菜单层级**必须由需求/PRD 提供**,不要去代码里找。
262
+
263
+ ## 🔒 Step 3.5: 来源锚定 + UTF-8(硬门 #3,eval A2 检查)
264
+
265
+ ### 来源锚定(必做)
266
+
267
+ 生成的 HTML 必须在 `<head>` 里写一行注释,标注样式来源的真实文件:
183
268
 
184
- 三级折叠菜单写法(原生 `<details>`,零 JS):
185
269
  ```html
186
- <details class="sidebar-group">
187
- <summary>二级菜单A</summary>
188
- <div class="sidebar-sub">
189
- <div class="sidebar-item">三级菜单A-1</div>
190
- <div class="sidebar-item">三级菜单A-2</div>
191
- </div>
192
- </details>
270
+ <!-- @prototype-source: fywl-ui/apps/ics/src/views/xxx/index.vue, fywl-ui/apps/ics/src/api/xxx.ts -->
271
+ <meta name="x-source-pages" content="fywl-ui/.../index.vue">
193
272
  ```
194
273
 
195
- **prototype-app.html** (APP, Vant 3 variables, 375px, NavBar + TabBar):
196
- - `{{TITLE}}` - browser tab title
197
- - `{{PAGE_TITLE}}` - NavBar title
198
- - `{{LIST_ITEMS}}` - list cells (van-cell style)
199
- - `{{ITEM_TITLE}}` / `{{ITEM_DESC}}` - cell content
274
+ - 来源文件**必须来自 Step 2 读过的真实 Vue/TS 文件**(prefetch 返回的 page_examples)
275
+ - 写不出具体文件名 = 你没做 Step 2 = 违规
276
+ - eval A2 会检查:HTML 含 `@prototype-source:` 或 `x-source-pages` 通过;否则 A2 扣 5 分
200
277
 
201
- Key design tokens already in the templates (do not override):
202
- - Web primary: 来自 `style-index.json` 的 `layout_fingerprint.color_primary`
203
- (ICS = `hsl(214.58, 86.34%, 59.8%)`,已写入模板 `:root --primary`)
204
- - APP primary: `--van-primary-color: #1989fa`
278
+ ### UTF-8 强制(治编码乱码)
205
279
 
206
- ## ⚠️ Icons: NEVER emoji, ALWAYS the project's real icon system
280
+ 生成的 HTML **必须用 UTF-8 写入**,否则中文 `<title>`/注释会变成 `鍑轰氦杞?` 乱码。
207
281
 
208
- Source of truth: **data/index/icon-reference.json** (real usage counts +
209
- ready-to-paste SVGs extracted from the actual projects).
282
+ - Write 工具调用时,内容里的中文必须是原始 UTF-8(不要从 GBK 源复制)
283
+ - 如果用 Python 写文件:`open(path, 'w', encoding='utf-8')`
284
+ - **绝不要从 bash 输出里复制中文再粘贴**(bash 在 Windows 上可能转 GBK)→ 优先让
285
+ `fill_prototype` 脚本直接出文件,AI 只 Edit 占位符
210
286
 
211
- - **Web (fywl-ui)**: Ant Design icons. Inline the SVG from icon-reference.json:
212
- ```html
213
- <span class="anticon">{svg from icon-reference.json web.svg.outlined[...]}</span>
214
- <style>.anticon svg{width:1em;height:1em;fill:currentColor}</style>
215
- ```
216
- Most-used in the real app: Download(303x), Plus(171x), Delete, Search, Edit...
217
- - **APP (Carmg-H5)**: Vant font icons:
218
- ```html
219
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@4/lib/index.css">
220
- <i class="van-icon van-icon-search"></i>
221
- ```
222
- Most-used: arrow-down, arrow, plus, cross, search...
223
- - An emoji (👤🚛💰⚠️...) anywhere in a prototype = automatic style FAIL.
224
-
225
- ## ⚠️ 菜单/侧边栏层级: 必须按需求填, 不准退化成扁平框
226
-
227
- 这是最常翻车的点。模板已是 **mixed-nav 多级骨架**(一级顶栏 + 二级侧栏 +
228
- 三级折叠 + 标签页),不要退化成旧的"扁平单级 sidebar"。
229
-
230
- 铁律:
231
- 1. 如果 PRD/需求**描述了侧边栏或菜单结构**(如"左边点一级显示二级,右边显示
232
- 三四级"),**严格按它填** `{{TOP_MENU}}`/`{{SIDEBAR_MENU}}`/`{{TABS}}`。
233
- 例如"一级→二级,右侧三四级"翻译成:顶部一级 tab + 左侧二级列表 + 标签页放三四级。
234
- 2. 如果需求没提菜单,保留 fill_prototype 填的**示例多级结构**(不要删成单级)。
235
- 3. 永远不要把 `{{SIDEBAR_MENU}}` 填成只有一个 `sidebar-item` —— 那是 bug。
236
- 4. ICS 的菜单来自后端接口(`access_mode: backend`),静态代码里抓不到完整菜单树,
237
- 所以菜单层级**必须由需求/PRD 提供**,不要去代码里找。
238
-
239
- ## Step 4: Highlight Changes + Interactivity
240
-
241
- - Mark NEW/CHANGED elements with the template's `highlight-new` class
242
- (subtle border + legend), so reviewers see the diff at a glance
243
- - Minimal JavaScript: row click highlight, form expand/collapse,
244
- tab switching, modal open/close, validation hints
245
- - Single self-contained HTML file, no external dependencies
246
-
247
- ## Rules
248
-
249
- 1. **ALWAYS match the TARGET platform style** - colors, spacing, fonts come
250
- from the template + real code, never from memory
251
- 2. **NEVER invent new patterns** - if the project uses VxeGrid, mimic VxeGrid
252
- 3. **Use REAL fields** - column titles and field names must come from the
253
- actual code found in Step 2, not made up
254
- 4. **Prototype must be interactive** - clickable buttons, fillable forms, hover states
255
- 5. **Save to** `workspace/members/{developer}/drafts/prototype-{feature}.html`
256
- (Both platforms -> `prototype-{feature}-web.html` + `prototype-{feature}-app.html`)
287
+ ---
288
+ ## Step 4: Highlight Changes + Interactivity
289
+
290
+ - Mark NEW/CHANGED elements with the template's `highlight-new` class
291
+ (subtle border + legend), so reviewers see the diff at a glance
292
+ - Minimal JavaScript: row click highlight, form expand/collapse,
293
+ tab switching, modal open/close, validation hints
294
+ - Single self-contained HTML file, no external dependencies
295
+
296
+ ## Rules
297
+
298
+ 1. **ALWAYS match the TARGET platform style** - colors, spacing, fonts come
299
+ from the template + real code, never from memory
300
+ 2. **NEVER invent new patterns** - if the project uses VxeGrid, mimic VxeGrid
301
+ 3. **Use REAL fields** - column titles and field names must come from the
302
+ actual code found in Step 2, not made up
303
+ 4. **Prototype must be interactive** - clickable buttons, fillable forms, hover states
304
+ 5. **Save to** `workspace/members/{developer}/drafts/prototype-{feature}.html`
305
+ (Both platforms -> `prototype-{feature}-web.html` + `prototype-{feature}-app.html`)
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: spec-coder
3
- description: "严格按开发 Spec 实现代码。Implement code strictly following development Spec. 用户说'开始写代码''按规格实现''实现这个接口''把这个需求做出来'时触发。需用户确认(DANGEROUS)。"
4
- trigger: "Spec 已确认待实现时;用户说'开始写代码''按spec实现''/wl-code'"
3
+ description: "严格按开发 Spec 实现代码。Implement code strictly following development Spec. 需用户确认(DANGEROUS)。"
4
+ trigger: "user invokes /wl-* command explicitly"
5
5
  ---
6
6
 
7
7
 
@@ -11,7 +11,7 @@ trigger: "Spec 已确认待实现时;用户说'开始写代码''按spec实现'
11
11
  ```bash
12
12
  R=$(python ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
13
13
  ```
14
- > `repo_root.py` 从 `~/.qoderwork/mcp.json` 反推仓库根;失败回退 `.`(IDE/CLI 工作目录即仓库根)。找不到时先跑 `python .qoder/scripts/install_qoderwork.py`。
14
+ > `repo_root.py` 从 `~/.qoderwork/mcp.json` 反推仓库根;失败回退 `.`(IDE/CLI 工作目录即仓库根)。找不到时先跑 `python "$R/.qoder/scripts/orchestration/wlkj.py" install-qw`。
15
15
 
16
16
  # Spec Coder
17
17
 
@@ -25,8 +25,10 @@ R=$(python ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
25
25
 
26
26
  ## ⚙️ 自取上下文(Quest / QoderWork 无 hook 注入,必须自读)
27
27
 
28
- - `.qoder/.developer` 当前开发者
29
- - `.qoder/.current-task` 当前任务(含任务相关的 Spec 路径)
28
+ - **当前身份**:当前开发者。读法:先 `R=$(python ~/.qoderwork/repo_root.py 2>/dev/null) || R=.` 定位仓库根,
29
+ `python "$R/.qoder/scripts/foundation/core/paths.py" whoami`(输出开发者名;空=未初始化)。
30
+ ⚠️ 勿用裸相对路径 `.qoder/.developer`(QoderWork 桌面端 cwd 不在仓库根,会读不到而误报未初始化)。
31
+ - **活动任务**:当前任务(含任务相关的 Spec 路径)。读法 `python "$R/.qoder/scripts/foundation/core/paths.py" current-task`(输出任务路径;空=无活动任务)。
30
32
  - Spec 文件位置:`workspace/specs/REQ-{ID}-*.spec.md` 或 `workspace/tasks/{task-id}/spec.md`
31
33
  - 目标代码库:`data/code/`(fywl-ics 后端 / fywl-ui 前端 / Carmg-H5 移动端)
32
34
 
@@ -41,19 +43,26 @@ ls workspace/tasks/ # 任务内的 specs
41
43
 
42
44
  ## Step 2: 读取上下文
43
45
 
46
+ ### ⚡ 取全一次到位(先跑,省掉后续多次 search/Read)
47
+
48
+ ```bash
49
+ cap.mcp.call("context_pack", {"keyword": "..."}) <spec里的模块关键词> --platform <web|app> --role dev
50
+ ```
51
+
52
+ **一次拿到**:相关代码文件(第1段) + 真实字段名(第3段) + 相关 API(第5段) + Repo Wiki(第7段)。
53
+ 拿到后 Read top 2-3 个命中的相似文件,照着它们的命名/结构/异常处理写。**不要再 search_index 单词搜**。
54
+
55
+ ### 同时并发补这两项(与上面 context_pack 无依赖,同回合并发)
56
+
44
57
  1. **Spec 文件**(必需):开发规格
45
58
  2. **PRD 文件**(推荐):原始需求,理解业务背景
46
- 3. **现有代码风格**(必需):用 search_index.py 找相关模块真实代码作参考
47
- ```bash
48
- python "$R/.qoder/scripts/search_index.py" <模块关键词>
49
- ```
50
- 读 top 2-3 个相似文件,照着它们的命名/结构/异常处理写
51
- 4. **架构/数据字典**(如存在):`.qoder/context/architecture.md`、`data-dictionary.md`
52
- 不存在就跳过,从现有代码推断
53
- 5. **真实表结构(推荐)**:写 Entity/SQL 前调 MySQL MCP 核对数据库真实列定义。
54
- - `mcp__qoder-mysql__query_schema(table='表名', db='库名')`
59
+ 3. **真实表结构**(写 Entity/SQL 前必查):context_pack 不含 DB schema,单独调
60
+ - `cap.mcp.call("query_schema", {"table": "表名", "db": "库名"})`(先 list_envs 问环境)
55
61
  - 拿真实列名/类型/可空/注释(含枚举定义),避免 Entity 字段和数据库对不上
56
- - 注意:[QAS 测试环境] 结构与生产一致;数据行仅参考格式
62
+ - [QAS 测试环境] 结构与生产一致;数据行仅参考格式
63
+
64
+ > 架构/数据字典 `.qoder/context/architecture.md`、`data-dictionary.md` 如存在顺手读,不存在跳过。
65
+ > 以上 Spec/PRD/query_schema 三项相互独立 → **同一条消息并发发**,不要逐个等。
57
66
 
58
67
  ## Step 3: 按 Spec 实现
59
68