@hupan56/wlkj 3.1.32 → 3.3.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 (178) hide show
  1. package/bin/cli.js +117 -0
  2. package/package.json +1 -1
  3. package/templates/qoder/agents/insight-planning.md +67 -67
  4. package/templates/qoder/agents/prd-reference.md +47 -47
  5. package/templates/qoder/commands/optional/wl-insight.md +4 -4
  6. package/templates/qoder/commands/optional/wl-report.md +1 -1
  7. package/templates/qoder/commands/optional/wl-spec.md +23 -3
  8. package/templates/qoder/commands/optional/wl-status.md +12 -1
  9. package/templates/qoder/commands/wl-code.md +138 -7
  10. package/templates/qoder/commands/wl-commit.md +12 -1
  11. package/templates/qoder/commands/wl-design.md +70 -6
  12. package/templates/qoder/commands/wl-init.md +27 -0
  13. package/templates/qoder/commands/wl-prd.md +230 -15
  14. package/templates/qoder/commands/wl-req.md +10 -3
  15. package/templates/qoder/commands/wl-search.md +74 -20
  16. package/templates/qoder/commands/wl-task.md +3 -3
  17. package/templates/qoder/commands/wl-test.md +17 -2
  18. package/templates/qoder/contracts/CHANGELOG.md +418 -0
  19. package/templates/qoder/contracts/README.md +180 -0
  20. package/templates/qoder/contracts/code.md +82 -0
  21. package/templates/qoder/contracts/commit.md +86 -0
  22. package/templates/qoder/contracts/contract-header.md +76 -0
  23. package/templates/qoder/contracts/design.md +106 -0
  24. package/templates/qoder/contracts/fallback.md +126 -0
  25. package/templates/qoder/contracts/isolation.md +119 -0
  26. package/templates/qoder/contracts/prd.md +118 -0
  27. package/templates/qoder/contracts/schemas/design-spec.schema.json +46 -0
  28. package/templates/qoder/contracts/schemas/prd.schema.json +36 -0
  29. package/templates/qoder/contracts/schemas/test-cases.schema.json +40 -0
  30. package/templates/qoder/contracts/spec.md +116 -0
  31. package/templates/qoder/contracts/task.md +125 -0
  32. package/templates/qoder/contracts/test.md +112 -0
  33. package/templates/qoder/hooks/post-tool-use.py +61 -0
  34. package/templates/qoder/hooks/session-start.py +34 -66
  35. package/templates/qoder/hooks/stop-eval.py +47 -0
  36. package/templates/qoder/rules/wl-pipeline.md +37 -0
  37. package/templates/qoder/scripts/capability/__pycache__/__init__.cpython-39.pyc +0 -0
  38. package/templates/qoder/scripts/capability/__pycache__/registry.cpython-39.pyc +0 -0
  39. package/templates/qoder/scripts/capability/__pycache__/registry_mcp.cpython-39.pyc +0 -0
  40. package/templates/qoder/scripts/capability/adapters/__init__.py +1 -1
  41. package/templates/qoder/scripts/capability/adapters/__pycache__/__init__.cpython-39.pyc +0 -0
  42. package/templates/qoder/scripts/capability/adapters/__pycache__/cli.cpython-39.pyc +0 -0
  43. package/templates/qoder/scripts/capability/adapters/__pycache__/mcp.cpython-39.pyc +0 -0
  44. package/templates/qoder/scripts/capability/adapters/__pycache__/qw.cpython-39.pyc +0 -0
  45. package/templates/qoder/scripts/capability/adapters/mcp.py +76 -100
  46. package/templates/qoder/scripts/capability/adapters/qw.py +295 -295
  47. package/templates/qoder/scripts/capability/caps/__init__.py +1 -1
  48. package/templates/qoder/scripts/capability/caps/__pycache__/__init__.cpython-39.pyc +0 -0
  49. package/templates/qoder/scripts/capability/caps/__pycache__/context.cpython-39.pyc +0 -0
  50. package/templates/qoder/scripts/capability/caps/__pycache__/cron.cpython-39.pyc +0 -0
  51. package/templates/qoder/scripts/capability/caps/__pycache__/identity.cpython-39.pyc +0 -0
  52. package/templates/qoder/scripts/capability/caps/__pycache__/memory.cpython-39.pyc +0 -0
  53. package/templates/qoder/scripts/capability/caps/__pycache__/notify.cpython-39.pyc +0 -0
  54. package/templates/qoder/scripts/capability/caps/__pycache__/present.cpython-39.pyc +0 -0
  55. package/templates/qoder/scripts/capability/caps/__pycache__/repo.cpython-39.pyc +0 -0
  56. package/templates/qoder/scripts/capability/caps/__pycache__/sandbox.cpython-39.pyc +0 -0
  57. package/templates/qoder/scripts/capability/caps/memory.py +1 -1
  58. package/templates/qoder/scripts/capability/registry.py +21 -23
  59. package/templates/qoder/scripts/capability/registry_mcp.py +69 -5
  60. package/templates/qoder/scripts/capability/smoke_test_report.json +34 -20
  61. package/templates/qoder/scripts/deployment/setup/carriers.py +3 -1
  62. package/templates/qoder/scripts/deployment/setup/init_doctor.py +10 -3
  63. package/templates/qoder/scripts/deployment/setup/install_qoderwork.py +11 -0
  64. package/templates/qoder/scripts/deployment/setup/wlkj_shim.py +104 -0
  65. package/templates/qoder/scripts/domain/__pycache__/__init__.cpython-39.pyc +0 -0
  66. package/templates/qoder/scripts/domain/deployment/deploy_to_test.py +298 -0
  67. package/templates/qoder/scripts/domain/integration/__init__.py +0 -0
  68. package/templates/qoder/scripts/domain/integration/__pycache__/__init__.cpython-39.pyc +0 -0
  69. package/templates/qoder/scripts/domain/integration/__pycache__/return_to_platform.cpython-39.pyc +0 -0
  70. package/templates/qoder/scripts/domain/integration/return_to_platform.py +392 -0
  71. package/templates/qoder/scripts/domain/integration/spec_upload.py +209 -0
  72. package/templates/qoder/scripts/domain/kg/build/kg_build.py +268 -25
  73. package/templates/qoder/scripts/domain/kg/build/kg_incremental.py +108 -3
  74. package/templates/qoder/scripts/domain/kg/build/kg_signatures.py +169 -0
  75. package/templates/qoder/scripts/domain/kg/extract/asset/__init__.py +10 -0
  76. package/templates/qoder/scripts/domain/kg/extract/asset/asset_tree.py +57 -0
  77. package/templates/qoder/scripts/domain/kg/extract/asset/discussion_importer.py +62 -0
  78. package/templates/qoder/scripts/domain/kg/extract/asset/prd_importer.py +146 -0
  79. package/templates/qoder/scripts/domain/kg/extract/asset/prototype_importer.py +64 -0
  80. package/templates/qoder/scripts/domain/kg/extract/asset/returns_importer.py +52 -0
  81. package/templates/qoder/scripts/domain/kg/extract/build_goal3.py +104 -0
  82. package/templates/qoder/scripts/domain/kg/extract/build_goal4.py +55 -0
  83. package/templates/qoder/scripts/domain/kg/extract/build_goal5.py +95 -0
  84. package/templates/qoder/scripts/domain/kg/extract/db/__init__.py +8 -0
  85. package/templates/qoder/scripts/domain/kg/extract/db/data_profile.py +22 -0
  86. package/templates/qoder/scripts/domain/kg/extract/db/fk_extractor.py +55 -0
  87. package/templates/qoder/scripts/domain/kg/extract/db/schema_extractor.py +90 -0
  88. package/templates/qoder/scripts/domain/kg/extract/extract.py +84 -0
  89. package/templates/qoder/scripts/domain/kg/extract/extract.py.bak +430 -0
  90. package/templates/qoder/scripts/domain/kg/extract/inference/__init__.py +9 -0
  91. package/templates/qoder/scripts/domain/kg/extract/inference/community_summarizer.py +206 -0
  92. package/templates/qoder/scripts/domain/kg/extract/inference/embed_builder.py +132 -0
  93. package/templates/qoder/scripts/domain/kg/extract/inference/naming_matcher.py +80 -0
  94. package/templates/qoder/scripts/domain/kg/extract/inference/promote.py +59 -0
  95. package/templates/qoder/scripts/domain/kg/extract/inference/recompute.py +93 -0
  96. package/templates/qoder/scripts/domain/kg/extract/inference/weak_link.py +421 -0
  97. package/templates/qoder/scripts/domain/kg/extract/java/__init__.py +15 -0
  98. package/templates/qoder/scripts/domain/kg/extract/java/_parser.py +271 -0
  99. package/templates/qoder/scripts/domain/kg/extract/java/all.py +145 -0
  100. package/templates/qoder/scripts/domain/kg/extract/java/build_java_to_pg.py +102 -0
  101. package/templates/qoder/scripts/domain/kg/extract/java/call_chain.py +49 -0
  102. package/templates/qoder/scripts/domain/kg/extract/java/class_extractor.py +141 -0
  103. package/templates/qoder/scripts/domain/kg/extract/java/domain_extractor.py +148 -0
  104. package/templates/qoder/scripts/domain/kg/extract/java/dubbo_extractor.py +33 -0
  105. package/templates/qoder/scripts/domain/kg/extract/java/endpoint_extractor.py +36 -0
  106. package/templates/qoder/scripts/domain/kg/extract/java/javadoc_extractor.py +110 -0
  107. package/templates/qoder/scripts/domain/kg/extract/java/llm_cn_filler.py +150 -0
  108. package/templates/qoder/scripts/domain/kg/extract/java/member_extractor.py +157 -0
  109. package/templates/qoder/scripts/domain/kg/extract/java/mybatisplus_extractor.py +34 -0
  110. package/templates/qoder/scripts/domain/kg/extract/java/pg_upsert.py +165 -0
  111. package/templates/qoder/scripts/domain/kg/extract/java/satoken_extractor.py +30 -0
  112. package/templates/qoder/scripts/domain/kg/extract/java/spring_extractor.py +39 -0
  113. package/templates/qoder/scripts/domain/kg/extract/java/validation_extractor.py +33 -0
  114. package/templates/qoder/scripts/domain/kg/extract/mybatis/__init__.py +9 -0
  115. package/templates/qoder/scripts/domain/kg/extract/mybatis/all.py +79 -0
  116. package/templates/qoder/scripts/domain/kg/extract/mybatis/mapper_parser.py +99 -0
  117. package/templates/qoder/scripts/domain/kg/extract/mybatis/relation_builder.py +69 -0
  118. package/templates/qoder/scripts/domain/kg/extract/mybatis/sql_extractor.py +78 -0
  119. package/templates/qoder/scripts/domain/kg/extract/prd/__init__.py +8 -0
  120. package/templates/qoder/scripts/domain/kg/extract/prd/prd_chunk_embed.py +105 -0
  121. package/templates/qoder/scripts/domain/kg/extract/prd/prd_llm_extract.py +153 -0
  122. package/templates/qoder/scripts/domain/kg/extract/prd/req_anchor.py +120 -0
  123. package/templates/qoder/scripts/domain/kg/extract/ts_extract.py +111 -0
  124. package/templates/qoder/scripts/domain/kg/graph/kg_semantic.py +4 -2
  125. package/templates/qoder/scripts/domain/kg/kg.py +42 -5
  126. package/templates/qoder/scripts/domain/kg/search/_remote.py +187 -0
  127. package/templates/qoder/scripts/domain/kg/search/context_pack.py +32 -2
  128. package/templates/qoder/scripts/domain/kg/search/search_index.py +74 -20
  129. package/templates/qoder/scripts/domain/kg/storage/kg_duckdb.py +43 -0
  130. package/templates/qoder/scripts/domain/kg/switch_project.py +159 -0
  131. package/templates/qoder/scripts/domain/kg/sync_repowiki.py +109 -0
  132. package/templates/qoder/scripts/domain/requirement/req.py +134 -28
  133. package/templates/qoder/scripts/domain/task/__pycache__/wlkj_panel.cpython-39.pyc +0 -0
  134. package/templates/qoder/scripts/domain/task/wlkj_panel.py +1348 -0
  135. package/templates/qoder/scripts/engine/poller.py +219 -0
  136. package/templates/qoder/scripts/foundation/__pycache__/__init__.cpython-39.pyc +0 -0
  137. package/templates/qoder/scripts/foundation/core/__pycache__/__init__.cpython-39.pyc +0 -0
  138. package/templates/qoder/scripts/foundation/core/__pycache__/paths.cpython-39.pyc +0 -0
  139. package/templates/qoder/scripts/foundation/core/paths.py +102 -0
  140. package/templates/qoder/scripts/foundation/integrations/active_task.py +2 -1
  141. package/templates/qoder/scripts/orchestration/wlkj.py +4 -0
  142. package/templates/qoder/scripts/protocol/__pycache__/__init__.cpython-39.pyc +0 -0
  143. package/templates/qoder/scripts/protocol/mcp/zentao_mcp_server.py +24 -11
  144. package/templates/qoder/scripts/protocol/transports/__pycache__/__init__.cpython-39.pyc +0 -0
  145. package/templates/qoder/scripts/protocol/transports/__pycache__/base.cpython-39.pyc +0 -0
  146. package/templates/qoder/scripts/protocol/transports/__pycache__/cli.cpython-39.pyc +0 -0
  147. package/templates/qoder/scripts/protocol/transports/__pycache__/http.cpython-39.pyc +0 -0
  148. package/templates/qoder/scripts/protocol/transports/__pycache__/stdio.cpython-39.pyc +0 -0
  149. package/templates/qoder/scripts/protocol/transports/http.py +7 -1
  150. package/templates/qoder/scripts/validation/eval/qwork_harness.py +1 -1
  151. package/templates/qoder/scripts/validation/eval/report-commands.md +2 -2
  152. package/templates/qoder/settings.json +27 -9
  153. package/templates/qoder/skills/design-import/SKILL.md +3 -3
  154. package/templates/qoder/skills/design-review/SKILL.md +1 -1
  155. package/templates/qoder/skills/prd-generator/SKILL.md +4 -4
  156. package/templates/qoder/skills/prd-review/SKILL.md +1 -1
  157. package/templates/qoder/skills/prototype-generator/SKILL.md +3 -3
  158. package/templates/qoder/skills/spec-coder/SKILL.md +1 -1
  159. package/templates/qoder/skills/spec-generator/SKILL.md +80 -23
  160. package/templates/qoder/skills/test-generator/SKILL.md +1 -1
  161. package/templates/qoder/skills/wl-code/SKILL.md +13 -1
  162. package/templates/qoder/skills/wl-commit/SKILL.md +1 -1
  163. package/templates/qoder/skills/wl-design/SKILL.md +6 -6
  164. package/templates/qoder/skills/wl-init/SKILL.md +2 -2
  165. package/templates/qoder/skills/wl-insight/SKILL.md +5 -5
  166. package/templates/qoder/skills/wl-prd/SKILL.md +60 -0
  167. package/templates/qoder/skills/wl-report/SKILL.md +2 -2
  168. package/templates/qoder/skills/wl-search/SKILL.md +1 -1
  169. package/templates/qoder/skills/wl-spec/SKILL.md +2 -2
  170. package/templates/qoder/skills/wl-status/SKILL.md +2 -2
  171. package/templates/qoder/skills/wl-task/SKILL.md +3 -3
  172. package/templates/qoder/skills/wl-test/SKILL.md +2 -2
  173. package/templates/qoder/templates/spec-template.md +124 -0
  174. package/templates/root/AGENTS.md +41 -14
  175. package/templates/qoder/scripts/domain/task/zentao_panel.py +0 -451
  176. package/templates/qoder/skills/wl-prd-full/SKILL.md +0 -121
  177. package/templates/qoder/skills/wl-prd-quick/SKILL.md +0 -50
  178. package/templates/qoder/skills/wl-prd-review/SKILL.md +0 -47
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: spec-generator
3
3
  description: "从已确认的 PRD 自动生成开发 Spec 文档(技术规格说明)。Auto-generate development Spec documents from confirmed PRDs. "
4
- trigger: "user invokes /wl-* command explicitly"
4
+ trigger: " /wl-spec 内部调用(实现层)"
5
5
  ---
6
6
 
7
7
 
@@ -28,21 +28,46 @@ PY=$(python --version >/dev/null 2>&1 && echo python || echo python3)
28
28
  再 `$PY "$R/.qoder/scripts/foundation/core/paths.py" whoami`(输出开发者名;空=未初始化)。
29
29
  ⚠️ 勿用裸相对路径 `.qoder/.developer`(QoderWork 桌面端 cwd 不在仓库根,会读不到而误报未初始化)。
30
30
  - **活动任务**:当前任务(决定 spec 存到哪个 task 目录)。读法 `$PY "$R/.qoder/scripts/foundation/core/paths.py" current-task`(输出任务路径;空=无活动任务)。
31
- - 扫描 PRD 来源目录:`data/docs/prd/`(已发布)+ `workspace/members/{dev}/drafts/REQ-*.md`(草稿)
31
+ - 扫描 PRD 来源目录:`data/docs/prd/`(已发布)+ PRD 所在的 REQ-ID 容器
32
+ (`workspace/members/{dev}/{drafts|outputs}/{YYYY}/{MM}/{Ww}/{REQ-ID}/`,用 `find_req_dirs` 跨桶查找)
32
33
  找出还没有对应 Spec 的 PRD
33
34
  - 风格/字段参考:`$PY "$R/.qoder/scripts/orchestration/wlkj.py" search --field <字段名>` 查现有字段命名约定
34
35
  - 团队 Java 约定(MyBatis Plus + RESTful + BigDecimal 金额)写在本 skill 的 Step 3
35
36
 
36
- ## Step 1: 定位 PRD
37
+ ## Step 1: 定位 PRD(优先禅道 task,本地兜底)
38
+
39
+ **核心:1 禅道 task ↔ 1 spec。PRD 真源是 task 关联的 story**(本地找不到别人提的 PRD 时,从禅道 story 读)。
40
+
41
+ ### 优先级 1:从禅道 task 读(解决"别人提的 PRD 本地没有")
37
42
 
38
43
  ```bash
39
- # 列出已发布的 PRD
40
- ls data/docs/prd/REQ-*.md
41
- # 列出当前开发者的草稿 PRD
42
- ls workspace/members/{developer}/drafts/REQ-*.md
44
+ # 当前活动任务(panel / /wl-task 指向的禅道 task)
45
+ TASK=$($PY "$R/.qoder/scripts/foundation/core/paths.py" current-task) # 或直接给 task_id
46
+ ```
47
+
48
+ 走 MCP 读 task → story:
49
+ ```python
50
+ cap.mcp.call("get_task", {"task_id": 1453}) # 拿 task 详情,取 story 字段
51
+ cap.mcp.call("get_story_detail", {"story_id": 761}) # 读 story.spec 字段 = PRD 数据源
43
52
  ```
53
+ story.spec 即 PRD 正文(验收标准/字段/操作)。**本地无该 PRD 文件也能生成 spec。**
44
54
 
45
- 找出"有 PRD 但无 Spec"的需求。如果有多份,问用户先做哪个。
55
+ ### 优先级 2:本地 PRD 兜底
56
+
57
+ ```bash
58
+ # task 无 story 关联,或禅道不可达 → 扫本地
59
+ ls data/docs/prd/REQ-*.md # 已发布
60
+ $PY "$R/.qoder/scripts/foundation/core/paths.py" whoami # 取开发者
61
+ # 草稿在 REQ-ID 容器: workspace/members/{DEV}/{drafts|outputs}/{桶}/{REQ-ID}/
62
+ ```
63
+ 跨桶找某 REQ:复用 `paths.find_req_dirs(req_id, DEV)`。
64
+
65
+ ### 决定
66
+
67
+ 找出"要生成 spec 的目标"后:
68
+ - **禅道 task 来的**:spec 主标识用 `task_id`,契约头写 `zentao: task=X story=Y`,第 0 章"禅道关联"填实。
69
+ - **本地 PRD 来的**:用 REQ-ID,`zentao:` 留空(后续 panel 回填 task 时补)。
70
+ - 多份候选时问用户先做哪个。
46
71
 
47
72
  ## Step 2: 读取上下文
48
73
 
@@ -57,41 +82,73 @@ cap.mcp.call("context_pack", {"keyword": "..."}) <PRD里的模块关键词> --pl
57
82
 
58
83
  ### 同时并发补这几项(与 context_pack 无依赖,同回合并发)
59
84
 
60
- 1. **PRD 文件**(必需):需求源
61
- 2. **历史 Spec**(推荐):扫 `workspace/specs/` 看同类需求的写法,照着写
62
- 3. **真实表结构**(强烈推荐):context_pack 不含 DB schema,写 API 字段前单独查
85
+ 1. **PRD 数据源**(必需):禅道 task 来的 = Step 1 读到的 story.spec;本地来的 = PRD 文件
86
+ 2. **spec 模板**(必需):`$R/.qoder/templates/spec-template.md` —— **必须读它,照它的 6 章骨架逐节填,不自由发挥结构**
87
+ 3. **历史 Spec**(推荐):扫 PRD 同容器或历史 REQ-ID 容器看同类需求的写法,照着写
88
+ 4. **真实表结构**(强烈推荐):context_pack 不含 DB schema,写 API 字段前单独查
63
89
  - 先 `cap.mcp.call("list_envs", {})` 问环境,再 `query_schema(table='quality_case', db='fywl_ics_quality')`
64
90
  - 拿到真实列名/类型/注释(注释里常含枚举定义,如"0=小时,1=工作日")
65
91
 
66
92
  > 数据字典 `data/docs/constitution/` 如存在顺手读,不存在跳过。
67
- > 以上 PRD/历史Spec/query_schema 三项相互独立 → **同一条消息并发发**,不要逐个等。
93
+ > 以上 PRD源/模板/历史Spec/query_schema 四项相互独立 → **同一条消息并发发**,不要逐个等。
94
+
95
+ ## Step 3: 照模板分析(不自由发挥结构)
68
96
 
69
- ## Step 3: 分析并生成
97
+ **核心:读 `templates/spec-template.md` 6 章骨架,逐章节填空。** 不是从零生成结构。
70
98
 
71
- 从 PRD 提取:
72
- - 每个用户故事 → 一个或多个 API 接口
73
- - 验收标准 → 接口入参/出参/错误场景
74
- - 数据需求 → 数据库表设计
75
- - 非功能性需求 约束章节
99
+ 从 PRD 提取并填入对应章节:
100
+ - 每个用户故事 → 1 章一个或多个 API 接口
101
+ - 验收标准 → 第 1 章入参/出参 + 第 3 章异常场景 + 第 5 章测试用例
102
+ - 数据需求 → 第 2 章表设计(表名 `t_{module}_{entity}`,金额 BigDecimal)
103
+ - **第 3 章异常矩阵 ★强制**:每个操作**系统性枚举所有失败场景**(参数/业务/权限/并发/外部依赖/数据不存在/边界值),这是写代码前必须想清楚的,不可遗漏
104
+ - **第 4 章 AI 边界 ★强制**:明确划分 ✅可自动 / ⚠️必须人工确认 / 🚫禁止AI做
105
+ - **第 5 章测试用例 ★强制**:每条 PRD 验收标准 ≥1 个用例,输入/预期/断言齐全
106
+ - 第 6 章映射表:每条 PRD acceptance → 对应接口/数据/异常/用例,保证可追溯不漏
107
+
108
+ ★强制章节不适用时写"无"并附原因(例:纯查询页异常章写"无(仅查询,校验由前端处理)")。
76
109
 
77
110
  ## Step 4: 输出
78
111
 
79
- 写到 `workspace/specs/REQ-{ID}-{module}.spec.md`(或 task 目录 `workspace/tasks/{task-id}/spec.md`)
112
+ **存储位置(按来源二选一)**:
113
+
114
+ - **禅道 task 来的**(1 task ↔ 1 spec):`workspace/tasks/{task_id}/spec.md`(复用现有 task 目录,task_id 即禅道 task id)
115
+ - **本地 PRD 来的**:跟着 PRD 同容器,`workspace/members/{dev}/{drafts|outputs}/{YYYY}/{MM}/{Ww}/{REQ-ID}/REQ-{ID}-{module}.spec.md`
116
+ (复用 `paths.get_req_dir` / `find_req_dirs`,跨时间桶可查)
117
+
118
+ **契约头**(status 初始为 draft;禅道来的带 zentao 字段):
119
+ ```markdown
120
+ <!-- @contract spec v1
121
+ source-req: REQ-2025-0042
122
+ platform: web
123
+ module: policy
124
+ endpoints: [POST /api/policy/amend, GET /api/policy/amend/{id}]
125
+ status: draft
126
+ zentao: task=1453 story=761
127
+ -->
128
+ ```
129
+ > `zentao:` 字段:禅道 task 来的必须填(task+story);本地来的留空,待 panel 回填 task 时补。
130
+
131
+ > 兜底:若本地 PRD 不在时间桶容器(老 PRD 在 `data/docs/prd/`),spec 写到 `workspace/specs/REQ-{ID}-{module}.spec.md`(向后兼容)。
80
132
 
81
- 规则:
82
- - 每条 PRD 验收标准都映射到一个 Spec 测试用例
133
+ 规则(模板已固化,这里只强调重点):
134
+ - 每条 PRD 验收标准都映射到一个 Spec 测试用例(第 6 章)
83
135
  - API 路径遵循 RESTful 约定
84
136
  - 表名遵循 `t_{module}_{entity}`
85
137
  - 金额字段必须用 `BigDecimal`
86
138
  - 不写 PRD 未定义的功能
87
139
  - Entity → Mapper → Service → Controller 全栈结构
88
140
 
89
- ## Step 5: 通知
141
+ ## Step 5: 通知并提交确认
90
142
 
91
- 报告给被分配的开发者评审。
143
+ 生成后 `status: draft`。报告给被分配的开发者评审:
144
+ 1. 展示 spec 全文 + 列出关键决策点(接口设计 / 表结构 / 异常枚举 / AI 边界)
145
+ 2. 提示:可直接修改 spec 文件(路径见输出),改完告知
146
+ 3. **⚠️ status 保持 draft,不要自动改 confirmed** —— 用户在 `/wl-code` 的 spec gate 确认后才升级
147
+ 4. **不在此回填禅道** —— spec 回填禅道 task 的 `desc` 由 `/wl-code` 在用户确认后做(见 wl-code Step 1),本 skill 只负责生成
92
148
 
93
149
  ## 触发条件
94
150
 
95
151
  - 手动:用户说"生成 Spec"、"写技术规格"、"/wl-spec"
96
152
  - 任务驱动:PRD 评审通过后,下一步通常就是生成 Spec
153
+ - `/wl-code` gate:无 spec 或 status≠confirmed 时,`/wl-code` 自动调本 skill 生成 draft
97
154
  - 子 agent:可被 prd-generator 在 PRD 确认后调度
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: test-generator
3
3
  description: "从已实现代码和 Spec 自动生成单元测试。Auto-generate unit tests from implemented code and Spec. 需用户确认(DANGEROUS)。"
4
- trigger: "user invokes /wl-* command explicitly"
4
+ trigger: " /wl-test quick模式内部调用(实现层)"
5
5
  ---
6
6
 
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: wl-code
3
3
  description: "按开发 Spec 严格实现代码(/wl-code 命令入口)。Implement code following a Spec strictly. 需用户确认(DANGEROUS)。"
4
- trigger: "user invokes /wl-* command explicitly"
4
+ trigger: "用户显式打 /wl-code; 或自然语言"写代码""实现这个功能""按spec开发"。需确认"
5
5
  ---
6
6
 
7
7
 
@@ -53,6 +53,18 @@ cap.mcp.call("context_pack", {"keyword": "..."}) <模块关键词> --platform <w
53
53
  - 拿真实列名/类型/注释(含枚举定义),别靠推断。
54
54
  - [QAS环境] 表结构与生产一致可放心用。
55
55
 
56
+ ### 排查/修 bug 类先对齐链路(kg 取证,1-2 步定位,禁止空转假设)
57
+
58
+ > 遵守 wl-pipeline 规则 2.6:取证优先用 kg(`cap.mcp.call`),**不许"假设A→假设B→假设C"连环空转**。
59
+
60
+ | 场景 | 对齐链路 | kg 先取证 | 最常见根因 |
61
+ |------|---------|----------|-----------|
62
+ | 后端报错/类型异常 | 前端格式→BO→Entity→DB列 | `query_schema`(DB列类型) + `context_pack`(BO/Entity文件) | String/Date/Long 不一致 |
63
+ | 接口不通/400 | 路由→Controller→Service→Mapper→SQL | `code-api`(路由/参数) + `table_impact`(影响面) | 参数名不匹配/缺@RequestBody |
64
+ | 前端白屏/NaN | 组件→API→响应→字段映射 | `context_pack`(组件/API) + `field_map`(字段映射) | null未处理/字段名拼错 |
65
+
66
+ kg 取证后 Read 命中文件找**不一致点**,定位即动手,**别发散推理**。
67
+
56
68
  ## 执行
57
69
 
58
70
  1. **加载 Spec**:按 REQ-ID 找 spec;没参数就读 `.qoder/.current-task`
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: wl-commit
3
3
  description: "代码提交 + push + 同步,带质量门禁。Git commit + push + sync with pre-commit quality gate. 需用户确认(DANGEROUS)。"
4
- trigger: "user invokes /wl-* command explicitly"
4
+ trigger: "用户显式打 /wl-commit; 或自然语言"提交代码""commit"。需确认"
5
5
  ---
6
6
 
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: wl-design
3
- description: "设计工序入口: import 录入设计稿→spec.json(默认) / generate 按设计spec出原型 / review 评审原型。"
4
- trigger: "user invokes /wl-* command explicitly"
3
+ description: "设计工序站: 预览(蓝湖稿→HTML预览,默认) / 扫描(看现有系统页面组件风格) / 评审(检查原型是否用系统真源)。"
4
+ trigger: "用户显式打 /wl-design; 或自然语言"出原型""设计稿""预览设计""扫描页面风格""
5
5
  ---
6
6
 
7
7
 
@@ -28,12 +28,12 @@ PY=$(python --version >/dev/null 2>&1 && echo python || echo python3)
28
28
 
29
29
  | 用户说 | 模式 | 走哪个 skill |
30
30
  |--------|------|-------------|
31
- | "录入设计稿""Figma稿录入""把这个设计录入" | **import**(默认) | design-import |
32
- | "按设计出原型""按设计师规范出原型" | **generate** | prototype-generator |
33
- | "评审原型""设计稿看一下""检查交互稿" | **review** | design-review |
31
+ | "预览""出预览""蓝湖链接""看看设计稿" 或 含 lanhuapp.com | **预览**(默认) | design-import |
32
+ | "扫描""看系统""有哪些页面""什么风格" | **扫描** | 看现有系统页面/组件/风格 |
33
+ | "评审""检查""合规""颜色对不对" | **评审** | design-review |
34
34
  | 模糊 | 先问意图 | — |
35
35
 
36
- 默认 import(最常见入口)。
36
+ 默认 预览(最常见入口)。
37
37
 
38
38
  ## ⚙️ 自取上下文(Quest / QoderWork 无 hook 注入,必须自读)
39
39
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: wl-init
3
3
  description: "初始化/切换开发者身份 + 环境体检。Initialize/switch developer identity + environment health check. "
4
- trigger: "user invokes /wl-* command explicitly"
4
+ trigger: "用户显式打 /wl-init; 身份初始化"
5
5
  ---
6
6
 
7
7
 
@@ -63,7 +63,7 @@ $PY "$R/.qoder/scripts/orchestration/wlkj.py" doctor --fix
63
63
 
64
64
  ## 输出规则
65
65
 
66
- - 体检完打印一句总结:「环境健康,可以开始工作:/wl-prd-full <需求>」或「N 个问题待修,加 --fix 自愈」
66
+ - 体检完打印一句总结:「环境健康,可以开始工作:/wl-prd <需求>」或「N 个问题待修,加 --fix 自愈」
67
67
  - 如果用户没给名字但 `.developer` 不存在:先问"你叫什么名字?角色是 pm/dev/design?"
68
68
  - 如果 git user.name 与开发者名不一致:在体检里 `[WARN]` 提示,`--fix` 会自动改
69
69
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: wl-insight
3
- description: "需求探索 + 外部调研 + 未来规划。流水线的'上游探索站',负责发现需求、对标竞品、做 Gap 分析和 roadmap。把'该做什么、为什么做'想清楚,结论交给 /wl-prd-full 落地。"
4
- trigger: "user invokes /wl-* command explicitly"
3
+ description: "需求上游探索站。默认澄清(产品听不懂时对焦,必要时出原型帮理解); discover(发现机会) / research(调研竞品) / plan(规划roadmap)。说'转PRD'落地。"
4
+ trigger: "用户显式打 /wl-insight; 或自然语言需求澄清(产品听不懂时)"
5
5
  ---
6
6
 
7
7
 
@@ -38,7 +38,7 @@ insight(探索/调研/规划)→ [用户确认转PRD] → prd(落地)→
38
38
  ```
39
39
 
40
40
  **insight 不产 PRD,不画原型,不分配 REQ-ID。** insight 的产出是**洞察报告**(.md)。
41
- 报告写完,提示用户"要把某个机会转成 PRD 吗?" → 是 → 自动进 `/wl-prd-full` 参考模式(mode: reference)。
41
+ 报告写完,提示用户"要把某个机会转成 PRD 吗?" → 是 → 自动进 `/wl-prd` 参考模式(mode: reference)。
42
42
 
43
43
  ---
44
44
 
@@ -154,12 +154,12 @@ OST ├─ Opportunity(用户机会/痛点)─ discover ──┤ → i
154
154
  insight 报告末尾**永远**给一句:
155
155
 
156
156
  ```
157
- 要把握住哪个机会?说"转 PRD"我把它作为现状输入,进 /wl-prd-full 参考模式落地成可执行 PRD。
157
+ 要把握住哪个机会?说"转 PRD"我把它作为现状输入,进 /wl-prd 参考模式落地成可执行 PRD。
158
158
  ```
159
159
 
160
160
  用户说"转 PRD"或指定某个机会 → 触发:
161
161
  ```
162
- /wl-prd-full 参考:{报告路径}#{机会编号}
162
+ /wl-prd 参考:{报告路径}#{机会编号}
163
163
  ```
164
164
  prd 以 reference 模式(mode: reference)承接,读取 insight 报告作为现状背景,走"轻反思+批量确认"流程落地。
165
165
 
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: wl-prd
3
+ description: "需求: 完整(13章,新功能) / 快速(6章,小改动) / 评审(检查质量)。默认根据描述自动判断。先问平台!"
4
+ trigger: "用户显式打 /wl-prd; 或自然语言'写需求''写PRD''这个需求怎么做'。⚠️铁律: 只要用户打了/wl-prd,不管描述含'报错/无法/bug'(如'养护计划无法提交,时间报错'这种修复型小需求),都必须走本skill产出PRD,绝不跨命令跑去/wl-test"
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 || python3 ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
13
+ PY=$(python --version >/dev/null 2>&1 && echo python || echo python3)
14
+ ```
15
+ > `repo_root.py` 从 `~/.qoderwork/mcp.json` 反推仓库根;失败回退 `.`(IDE/CLI 工作目录即仓库根)。找不到时先跑 `$PY "$R/.qoder/scripts/orchestration/wlkj.py" install-qw`。
16
+
17
+ # wl-prd — 需求工序站(/wl-prd 命令入口)
18
+
19
+ > 这是 `/wl-prd` 命令的 skill 入口(桥接 QoderWork 的 `/` 列表)。
20
+ > 完整工作流见同名 command 文件 `.qoder/commands/wl-prd.md`,
21
+ > 完整/快速模式实现见 `.qoder/skills/prd-generator/SKILL.md`,
22
+ > 评审模式实现见 `.qoder/skills/prd-review/SKILL.md`。
23
+ > **第一性原理:又快又准。**(快=并行+砍模式,准=语义归档+质量锁)
24
+ > **定位:专注"已确定需求"的落地。** 探索/调研/规划/对标已移交 `/wl-insight`。
25
+
26
+ ## ⚠️ STEP 0: 必须先问平台(任何分析前,绝不自动判断)
27
+
28
+ ```
29
+ 这个需求是针对哪个平台?
30
+ 1. Web 管理端 (fywl-ui) - Ant Design Vue + VxeGrid 风格
31
+ 2. APP 移动端 (Carmg-H5) - Vant 风格
32
+ 3. 两端都要
33
+ 请选择 (1/2/3):
34
+ ```
35
+ 问完就停。平台未定时任何分析都是违规。
36
+
37
+ ## 🚦 三模式路由(看第一个词或描述特征)
38
+
39
+ | 用户说 | 模式 | 走哪个 |
40
+ |--------|------|--------|
41
+ | "完整""深度""正经需求" 或 含"新模块/新业务/新流程" | **完整** | prd-full-template(13 章)+ EVA |
42
+ | "快速""小改动""加个""改下" 或 加字段/按钮/文案/导出 | **快速** | prd-quick-template(6 章),不走 EVA |
43
+ | "评审""检查""质量""合格吗" 或 给了 PRD 路径 | **评审** | 7 项 checklist + EVA 评分 |
44
+ | 判断不了 | **问一句**:完整需求(新功能)还是小改动(加字段/按钮)? |
45
+
46
+ > 默认:没说模式 + 像新功能 → 完整;像小改动 → 快速;给了文件 → 评审。
47
+
48
+ ---
49
+
50
+ ## 详细流程
51
+
52
+ 完整的三模式流程(取上下文 / 产出路径 / 原型要不要画 / 质量门禁 / 埋点)
53
+ **全部在 command 文件** `.qoder/commands/wl-prd.md`,本桥接不重复(避免臃肿/双源不同步)。
54
+
55
+ 调用时直接读 command 文件按所选模式执行即可。
56
+
57
+ ## 🔗 上游衔接
58
+
59
+ - 来自 `/wl-insight` 的调研结论:`/wl-prd 参考:<报告路径>`
60
+ - 衔接 `/wl-task`:PRD 发布后由 `/wl-task create` 落成任务
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: wl-report
3
- description: "生成日报/周报,严格按当前开发者隔离。Generate daily/weekly work report, isolated by current developer. "
4
- trigger: "user invokes /wl-* command explicitly"
3
+ description: "日报/周报,按当前开发者隔离。默认日报(今天); 说'周报'出本周。数据源: 任务+禅道工时+提交+PRD+日历(可选增强)。"
4
+ trigger: "用户显式打 /wl-report; 或自然语言"写日报""周报""
5
5
  ---
6
6
 
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: wl-search
3
3
  description: "查代码/业务/API/字段/PRD + 知识图谱(影响分析/覆盖矩阵/功能画像/业务流程/多跳遍历)的唯一入口。"
4
- trigger: "user invokes /wl-* command explicitly"
4
+ trigger: "用户显式打 /wl-search; 代码/业务/API搜索专用"
5
5
  ---
6
6
 
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: wl-spec
3
- description: "从已确认 PRD 生成开发 Spec 文档(/wl-spec 命令入口)。Generate or review technical Spec from PRD + Design. "
4
- trigger: "user invokes /wl-* command explicitly"
3
+ description: "从已确认 PRD 生成开发 Spec(技术规格)。默认生成; review 评审现有 spec。/wl-code 按此 spec 实现。"
4
+ trigger: "用户显式打 /wl-spec; PRD→技术规格"
5
5
  ---
6
6
 
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: wl-status
3
- description: "项目状态/路线图/健康度。Project status: current sprint / roadmap / health score. "
4
- trigger: "user invokes /wl-* command explicitly"
3
+ description: "项目状态看板。current(当前迭代进度,默认) / roadmap(路线图) / health(健康度,含工作流采纳分)。说哪个看哪个。"
4
+ trigger: "用户显式打 /wl-status; 或自然语言"项目状态""健康度""路线图""
5
5
  ---
6
6
 
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: wl-task
3
- description: "任务管理 + RICE 优先级 + 依赖排期。7 站流水线的'任务'站,产品在这里把 PRD 落成任务。Task management with RICE prioritization. "
4
- trigger: "user invokes /wl-* command explicitly"
3
+ description: "任务管理 + 禅道同步。把 PRD 落成任务、看我的活、改状态、记工时(本地+禅道双写)。动作词: 建任务/我的任务/开始/完成/归档。自然语言问'我的Bug''看#301'直连禅道回答。"
4
+ trigger: "用户显式打 /wl-task; 或自然语言"建任务""我的任务""开始任务""完成任务"。注意:"我的Bug/看需求#301"等禅道查询直接答不走本skill"
5
5
  ---
6
6
 
7
7
 
@@ -222,7 +222,7 @@ cap.mcp.call("sync", {"direction": "push"})
222
222
  ## 输出规则
223
223
 
224
224
  - `list` 结果用表格呈现(优先级 | 状态 | 任务 | 负责人 | 标题 | 备注),当前任务标 `*`
225
- - `create` 后告诉用户任务目录路径 + 下一步建议("接 /wl-prd-full 写需求" 或 "/wl-code 写代码")
225
+ - `create` 后告诉用户任务目录路径 + 下一步建议("接 /wl-prd 写需求" 或 "/wl-code 写代码")
226
226
  - `finish` 后提示是否归档 + 看下个 `--ready` 的任务
227
227
  - 任何脚本非 0 退出 → 原样转述错误,不吞
228
228
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: wl-test
3
- description: "测试工作流: 意图式用例 + Playwright MCP 执行 + 锚点缓存。触发: /wl-test 命令; 或自然语言里带'功能验证点'(如'测一下XX支不支持YY''验一下XX能不能ZZ''XX对不对')。纯随手看('打开XX页''看看登录')→不走本工作流。需确认(DANGEROUS)。"
4
- trigger: "user invokes /wl-* command explicitly"
3
+ description: "测试: quick(意图式用例,默认) / browser(Playwright浏览器) / unit(单元) / coverage(测试覆盖矩阵)。触发: /wl-test 命令; 或自然语言带'功能验证点'(如'测一下XX支不支持YY')。需确认(DANGEROUS)。"
4
+ trigger: "用户显式打 /wl-test; 或自然语言带功能验证点('测一下XX支不支持YY''验一下XX能不能ZZ')。⚠️边界: '写需求/写PRD'→/wl-prd; '报错/bug/无法提交'若是写需求场景→/wl-prd不归本skill; 纯排查bug不走任何wl工作流"
5
5
  ---
6
6
 
7
7
  # wl-test — 测试工作流(/wl-test 命令 或 带功能验证点的自然语言触发)
@@ -0,0 +1,124 @@
1
+ # REQ-{YYYY}-{NNN} {需求标题} - 开发规格
2
+
3
+ <!-- @contract spec v1
4
+ source-req: REQ-2025-0042
5
+ platform: web
6
+ module: policy
7
+ endpoints: [POST /api/policy/amend, GET /api/policy/amend/{id}]
8
+ status: draft
9
+ zentao: task=1453 story=761
10
+ -->
11
+
12
+ > ⚙️ **如何用本模板**:spec-generator 读本文件**逐章节填空**,不自由发挥结构。
13
+ > - 所有 **★强制** 章节必须填;不适用写"无"并附原因。
14
+ > - 生成时 `status: draft`;经 `/wl-code` 的 spec gate **用户确认**后改为 `status: confirmed` 才可写码。
15
+ > - **禅道对接**:`zentao:` 字段标识本 spec 对应的禅道 task(1 task ↔ 1 spec)。
16
+ > PRD 数据源 = task 关联的 story(经 `get_task → get_story_detail` 读,本地无 PRD 也能生成);
17
+ > 确认后 spec 摘要回填该 task 的 `desc`。
18
+ > - 模块契约(输入/输出/校验):`.qoder/contracts/spec.md`
19
+ > - 团队技术约定:Java MyBatis Plus + RESTful + `BigDecimal` 金额 + JSR-303 + `Result<T>`;
20
+ > 表名 `t_{module}_{entity}`;全栈 Entity→Mapper→Service→Controller;不写 PRD 未定义的功能。
21
+
22
+ ---
23
+
24
+ ## 0. 概述
25
+
26
+ - **禅道关联**:task #{task_id} ← story #{story_id}(PRD 真源 = 该 story 的 spec 字段)
27
+ - **需求来源**:REQ-{ID}(本地有 PRD 则链回;禅道 task 来的若无本地 PRD,标注"源=禅道 story #{story_id}")
28
+ - **本次改动一句话**:{用一句话说清本次交付什么——读 spec 的人 5 秒内能懂}
29
+ - **涉及端**:{web / app / both}
30
+ - **PRD 验收标准条数**:{N 条}(映射见第 6 章,必须逐条覆盖,不可漏)
31
+ - **改动范围**:{新增 / 修改 / 删除了哪些模块文件,一句话}
32
+
33
+ ---
34
+
35
+ ## 1. 接口定义
36
+
37
+ > 每个接口一行。RESTful + JSR-303 校验 + `Result<T>` 包装返回。
38
+ > 无后端接口(纯前端/纯数据)写:"无(本次纯 {前端组件/数据脚本})"。
39
+
40
+ | 方法 | 路径 | 说明 | 入参(关键字段) | 出参 | 错误码 |
41
+ |------|------|------|----------------|------|--------|
42
+ | POST | /api/{module}/{action} | {用途} | {field: Type} | Result<{DTO}> | 见第3章 |
43
+ | GET | /api/{module}/{id} | {用途} | {id: Long} | Result<{DTO}> | 见第3章 |
44
+
45
+ **入参校验(JSR-303)**:逐接口列出必填/格式约束。
46
+ - `POST /api/{module}/{action}`:`{name @NotBlank(max=64), amount @NotNull @DecimalMin("0.01")}`
47
+
48
+ ---
49
+
50
+ ## 2. 数据结构
51
+
52
+ > 表名 `t_{module}_{entity}`;金额字段**一律 BigDecimal**,禁用 double/float。
53
+ > 无 DB 改动写:"无(复用现有表,无 DDL)"。
54
+
55
+ ### t_{module}_{entity} {— 用途说明}
56
+
57
+ | 字段 | 类型 | 约束 | 说明 |
58
+ |------|------|------|------|
59
+ | id | BIGINT | PK, AUTO | 主键 |
60
+ | {field} | VARCHAR(64) | NOT NULL | {含义} |
61
+ | amount | DECIMAL(18,2) | NOT NULL | 金额,BigDecimal 映射 |
62
+
63
+ **全栈结构**:`Entity(t_xxx) → Mapper(XxxMapper) → Service(XxxService) → Controller(XxxController)`
64
+
65
+ ---
66
+
67
+ ## 3. 异常处理矩阵 ★强制
68
+
69
+ > **每个操作**枚举**所有**失败场景,不遗漏。这是写代码前必须想清楚的,不是写完补的。
70
+ > 必须覆盖这些维度:参数校验失败 / 业务规则违反 / 权限 / 并发重复 / 外部依赖失败 / 数据不存在 / 边界值(0/空/超长/超大)。
71
+ > 不适用写"无"并说明原因(例如纯展示页可写"无(仅查询,校验由前端处理)")。
72
+
73
+ | 操作 | 失败场景 | 错误码 | HTTP | 处理策略 |
74
+ |------|----------|--------|------|----------|
75
+ | {POST /api/x} | 参数缺失/格式错 | 40001 | 400 | JSR-303 拦截 → Result.fail(字段提示) |
76
+ | {POST /api/x} | 业务规则违反 | 40901 | 409 | Service 校验 → Result.fail(原因) |
77
+ | {POST /api/x} | 数据不存在 | 40404 | 404 | Result.fail("记录不存在") |
78
+ | {POST /api/x} | 权限不足 | 40301 | 403 | Result.fail("无权限") |
79
+ | {POST /api/x} | 重复提交/并发 | 40902 | 409 | 唯一索引拦截 → 提示已存在 |
80
+ | {POST /api/x} | 边界: amount=0/超大 | 42201 | 422 | 前置校验拦截 |
81
+ | {POST /api/x} | 外部依赖失败 | 50001 | 500 | 捕获 → 降级/重试 + 日志 |
82
+
83
+ ---
84
+
85
+ ## 4. AI 能力边界 ★强制
86
+
87
+ > 明确划分三类,防止 AI 越界或该确认的不确认。**禁止 AI 做的**绝不能放进 `/wl-code` 执行清单。
88
+
89
+ | 类别 | 范围 | 本次涉及项 |
90
+ |------|------|-----------|
91
+ | ✅ AI 可自动完成 | 标准 CRUD、模板代码、照 spec 填实现 | {例:Entity/Mapper/Service/Controller 全栈、Vue 表单页} |
92
+ | ⚠️ 必须人工确认 | 有业务风险或不可逆的决策 | {例:DDL 建表/改表、删除类操作、金额计算逻辑、对接第三方} |
93
+ | 🚫 禁止 AI 做 | 无授权或不该自动化的 | {例:直连生产库改数据、删生产数据、绕过权限校验、臆造 PRD 没有的字段/接口} |
94
+
95
+ ---
96
+
97
+ ## 5. 测试用例 ★强制
98
+
99
+ > **每条 PRD 验收标准** → 至少一个用例。必须详细可复现(输入/预期/断言齐全),验收标准不漏一条。
100
+
101
+ | 用例ID | 对应验收(见第6章) | 输入 | 预期 | 断言 |
102
+ |--------|-------------------|------|------|------|
103
+ | TC-001 | AC-1 | {合法完整入参} | 200 + Result.success | 状态码=200 且 data.id 非空 |
104
+ | TC-002 | AC-1 | {非法: 缺必填字段} | 400 + 40001 | 状态码=400 |
105
+ | TC-003 | AC-1 | {边界: amount=0} | 422 + 42201 | 状态码=422 |
106
+ | TC-004 | AC-2 | {...} | {...} | {...} |
107
+
108
+ ---
109
+
110
+ ## 6. PRD 验收标准映射表
111
+
112
+ > 每条 PRD acceptance 映射到本 spec 的接口/数据/异常/用例,**保证可追溯、不漏**。
113
+ > 这是 /wl-code 完工自检的依据:每条 AC 都有实现着落。
114
+
115
+ | PRD 验收标准 | 对应接口(§1) | 数据(§2) | 异常(§3) | 测试用例(§5) |
116
+ |--------------|--------------|----------|----------|--------------|
117
+ | AC-1 {验收点原文} | POST /api/x | t_xxx | 场景行 | TC-001~003 |
118
+ | AC-2 {验收点原文} | ... | ... | ... | ... |
119
+
120
+ ---
121
+
122
+ > 生成者:spec-generator(基于 `templates/spec-template.md`)
123
+ > 状态流转:`status: draft` → 用户确认 → `status: confirmed` → `/wl-code` 放行写码
124
+ > 禅道回填:confirmed 后,spec 摘要(接口清单/关键表/异常/AC 映射)+ 本地路径 → 回填禅道 task `desc`
@@ -15,6 +15,18 @@
15
15
 
16
16
  ---
17
17
 
18
+ ## ⚠️ CRITICAL RULE #0: COMMAND ROUTE IS FINAL (highest priority, overrides memory/preferences)
19
+
20
+ **When user explicitly types `/wl-X`, you MUST route to X. NEVER reroute.** This overrides any "user preference", "memory", "context hint", or your own assumption. The command name IS the final route; description content (even bug-sounding) does not change it.
21
+
22
+ - User types `/wl-prd` (even if the description sounds like a bug: "无法提交,时间报错") → **MUST run PRD** (this is writing a requirement for the fix). **NEVER** reroute to `/wl-test`, `/wl-code`, or debugging.
23
+ - User types `/wl-code` → run code. `/wl-test` → run tests. `/wl-task` → run task. (same for every command)
24
+ - If routing is genuinely unclear → **ask the user one question**, do NOT guess from "preferences" or "memory".
25
+
26
+ > 🚫 Failure case (forbidden, real): user typed `/wl-prd 快速,园林绿化养护计划无法提交,时间有问题报错`, AI rerouted to `/wl-test quick` based on a hallucinated "memory that user prefers wl-test for bugs". → VIOLATION. The command was `/wl-prd`; a bug-sounding description still goes to PRD. `wl-prd.md` lists this exact example as forbidden.
27
+
28
+ ---
29
+
18
30
  ## ⚠️ CRITICAL RULE #1: ALWAYS ASK PLATFORM FIRST
19
31
 
20
32
  **When user asks for PRD or prototype, you MUST ask this question FIRST:**
@@ -108,11 +120,11 @@ app/mobile/h5/移动端 -> Carmg-H5
108
120
  | Command | 工序站 | 模式参数(第一个词路由) | Auto | 背后 skill |
109
121
  |---------|--------|------------------------|------|-----------|
110
122
  | `/wl-init` | 身份 | (无) | YES | wl-init |
111
- | `/wl-prd` | 需求 | 语义路由: 完整档/小改动/评审 (原 wl-prd-full/quick/review 合并) | YES | prd-generator/prd-review |
112
- | `/wl-design` | 设计 | `import`/`generate`/`review` 或默认(import) | YES | design-import/prototype-generator/design-review |
113
- | `/wl-task` | 任务 | `create`/`list`/`start`/`finish` | YES | wl-task |
123
+ | `/wl-prd` | 需求 | 语义路由: 完整/快速/评审 (原 wl-prd-full/quick/review 已合并) | YES | prd-generator/prd-review |
124
+ | `/wl-design` | 设计 | `预览`/`扫描`/`评审` 或默认(预览) | YES | design-import/prototype-generator/design-review |
125
+ | `/wl-task` | 任务 | `create`/`list`/`show`/`start`/`finish`/`archive`/`rank`/`plan` | YES | wl-task |
114
126
  | `/wl-code` | 编码 | (无,按 spec 实现) | NO | spec-coder |
115
- | `/wl-test` | 测试 | `quick`/`browser`/`unit` 或默认(quick) | NO | wl-test / test-generator |
127
+ | `/wl-test` | 测试 | `quick`/`browser`/`unit`/`coverage` 或默认(quick) | NO | wl-test / test-generator |
116
128
  | `/wl-commit` | 提交 | (无) | NO | wl-commit |
117
129
 
118
130
  ### Optional Commands(长大了再开,非执行链路必经)
@@ -178,21 +190,20 @@ Style priority: Code > PDF > Default
178
190
  **独立性**:每个模块认文件不认流程。缺上游 → 手动喂个契约文件,或用自然语言 +
179
191
  `context_pack.py` 让 AI 自检索补全(见 `.qoder/contracts/fallback.md`)。
180
192
 
181
- ## Qoder 全系列兼容(IDE / Quest / CLI / QoderWork)
193
+ ## Qoder 系列兼容(Desktop / QoderWork)
182
194
 
183
195
  This pipeline works on Windows + macOS, across the **whole Qoder family**.
184
196
  Each product loads rules from a different carrier — keep them in sync:
185
197
 
186
- | 产品/模式 | 规则载体 | 命令载体 |
187
- |-----------|---------|---------|
188
- | Qoder IDE 默认编辑器 | .qoder/rules/wl-pipeline.md (always_on) | .qoder/commands/wl-*.md |
189
- | Qoder Quest 模式 | .qoder/rules/ + .qoder/skills/ + .qoder/agents/ | 自然语言 -> skills |
190
- | Qoder CLI (qodercli) | 本文件 AGENTS.md | 自然语言 -> scripts |
191
- | QoderWork 桌面 Agent | 安装 .qoder/skills/ 下的技能 | 自然语言 -> skills |
198
+ | 产品 | 定位 | 规则载体 | 命令载体 |
199
+ |-----------|------|---------|---------|
200
+ | Qoder Desktop/IDE 1.0(含 Quest 模式)| 主开发宿主 | .qoder/rules/wl-pipeline.md + .qoder/skills/ + .qoder/agents/ | .qoder/commands/wl-*.md;Quest 走自然语言→skills |
201
+ | QoderWork 桌面 Agent | 办公(非开发者)| 安装 .qoder/skills/ 下的技能 | 自然语言→skills;~/.qoderwork/ 投影 |
192
202
 
193
- > 本流水线聚焦 Qoder 全系列,4 种载体功能等价。知识图谱 17 个能力(影响分析/
194
- > 覆盖矩阵/功能画像/业务流程/多跳遍历…)通过统一 CLI `python .qoder/scripts/domain/kg/kg.py`
195
- > 全系列触达;QoderWork 环境也可直接调 MCP 工具。
203
+ > 本流水线聚焦 Qoder 系列(主开发 Desktop + 办公 QoderWork),载体功能等价。知识图谱 17 个能力
204
+ > (影响分析/覆盖矩阵/功能画像/业务流程/多跳遍历…)通过统一 CLI
205
+ > `python .qoder/scripts/domain/kg/kg.py` 全系列触达;Desktop/QoderWork 环境也可直接调 MCP 工具。
206
+ > (Qoder CLI / Cloud Agents 后续按需对接。)
196
207
 
197
208
  ## QoderWork Integration: Optional Enhancement Only (Progressive Enhancement)
198
209
 
@@ -230,6 +241,22 @@ Each product loads rules from a different carrier — keep them in sync:
230
241
  code files + page examples + field specs + PRDs + APIs + style/icon pointers
231
242
  in ONE call. Use it FIRST; fall back to search_index.py for drill-down.
232
243
 
244
+ ## Thinking Discipline (思考链收敛 — 治"超长思考链")
245
+
246
+ **痛点:AI 取证了(读了代码)却没抓住矛盾,在假设上连续空转,15+ 步才定位 3 步能找到的根因。**
247
+ 本段**只约束排查/修码/取证类**推理;探索/规划/写 PRD 类(feature/workflow/coverage/context 撒网理解业务)不受约束,反而要多用 kg。
248
+
249
+ 1. **先取证再推理(铁律)**:每个推断立刻验证,**不许"假设A→假设B→假设C"连环空转**;一轮工具调用 = 一轮推理,不许"无工具调用的纯思考"超 1 轮。
250
+ 2. **取证优先用知识层**(比 grep 快 10 倍,与 Fast Path 一脉相承):
251
+ - 代码文件 → `context_pack`(**别** grep 全库)/ 字段类型 → `query_schema`·`field_map`(**别** Read 整个 Entity)/ 波及面 → `table_impact`(**别** 手动追踪)/ API → `code-api`(**别** grep Controller)
252
+ - kg 给了文件才 Read 那几个;kg 给了类型就不读全文。**kg 用得更准,不是闲置。**
253
+ 3. **排查/修码先对齐链路**(1-2 步对齐再动手;kg 一次对齐多环):
254
+ - 后端类型异常:`query_schema`(DB列) + `context_pack`(BO/Entity) → 找类型不一致点(String vs Date 最常见根因)
255
+ - 接口不通/400:`code-api`(路由/参数) + `table_impact`(影响面)
256
+ - 前端白屏/NaN:`context_pack`(组件/API) + `field_map`(字段映射)
257
+
258
+ > 正例:`query_schema`=Date + `context_pack` BO=String → 改BO(2步) | 反例:假设null→Invalid Date→时区→disabledDate→…(15步空转,养护计划实录)
259
+
233
260
  ## Icons: NEVER emoji
234
261
 
235
262
  Prototypes use the projects' real icon systems (data/index/icon-reference.json):