@hupan56/wlkj 3.1.31 → 3.2.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 (70) hide show
  1. package/package.json +1 -1
  2. package/templates/qoder/agents/insight-planning.md +67 -67
  3. package/templates/qoder/agents/prd-reference.md +47 -47
  4. package/templates/qoder/commands/optional/wl-insight.md +276 -276
  5. package/templates/qoder/commands/optional/wl-spec.md +10 -2
  6. package/templates/qoder/commands/wl-code.md +63 -4
  7. package/templates/qoder/commands/wl-design.md +1 -1
  8. package/templates/qoder/commands/wl-prd.md +87 -13
  9. package/templates/qoder/commands/wl-req.md +10 -3
  10. package/templates/qoder/commands/wl-task.md +613 -613
  11. package/templates/qoder/commands/wl-test.md +2 -2
  12. package/templates/qoder/contracts/CHANGELOG.md +418 -0
  13. package/templates/qoder/contracts/README.md +180 -0
  14. package/templates/qoder/contracts/code.md +82 -0
  15. package/templates/qoder/contracts/commit.md +86 -0
  16. package/templates/qoder/contracts/contract-header.md +76 -0
  17. package/templates/qoder/contracts/design.md +106 -0
  18. package/templates/qoder/contracts/fallback.md +126 -0
  19. package/templates/qoder/contracts/isolation.md +119 -0
  20. package/templates/qoder/contracts/prd.md +118 -0
  21. package/templates/qoder/contracts/schemas/design-spec.schema.json +46 -0
  22. package/templates/qoder/contracts/schemas/prd.schema.json +36 -0
  23. package/templates/qoder/contracts/schemas/test-cases.schema.json +40 -0
  24. package/templates/qoder/contracts/spec.md +112 -0
  25. package/templates/qoder/contracts/task.md +125 -0
  26. package/templates/qoder/contracts/test.md +112 -0
  27. package/templates/qoder/hooks/post-tool-use.py +20 -0
  28. package/templates/qoder/hooks/stop-eval.py +47 -0
  29. package/templates/qoder/rules/wl-pipeline.md +37 -0
  30. package/templates/qoder/scripts/deployment/setup/install_qoderwork.py +11 -0
  31. package/templates/qoder/scripts/deployment/setup/setup.py +70 -0
  32. package/templates/qoder/scripts/deployment/setup/wlkj_shim.py +104 -0
  33. package/templates/qoder/scripts/domain/deployment/deploy_to_test.py +298 -0
  34. package/templates/qoder/scripts/domain/kg/build/kg_build.py +241 -22
  35. package/templates/qoder/scripts/domain/kg/build/kg_incremental.py +108 -3
  36. package/templates/qoder/scripts/domain/kg/build/kg_signatures.py +169 -0
  37. package/templates/qoder/scripts/domain/kg/extract/ts_extract.py +111 -0
  38. package/templates/qoder/scripts/domain/kg/storage/kg_duckdb.py +43 -0
  39. package/templates/qoder/scripts/domain/requirement/req.py +134 -28
  40. package/templates/qoder/scripts/domain/task/zentao_panel.py +688 -53
  41. package/templates/qoder/scripts/foundation/core/paths.py +102 -0
  42. package/templates/qoder/scripts/protocol/mcp/zentao_mcp_server.py +23 -10
  43. package/templates/qoder/scripts/validation/eval/qwork_harness.py +1 -1
  44. package/templates/qoder/scripts/validation/eval/report-commands.md +2 -2
  45. package/templates/qoder/settings.json +27 -9
  46. package/templates/qoder/skills/design-import/SKILL.md +3 -3
  47. package/templates/qoder/skills/design-review/SKILL.md +1 -1
  48. package/templates/qoder/skills/prd-generator/SKILL.md +4 -4
  49. package/templates/qoder/skills/prd-review/SKILL.md +1 -1
  50. package/templates/qoder/skills/prototype-generator/SKILL.md +3 -3
  51. package/templates/qoder/skills/spec-coder/SKILL.md +1 -1
  52. package/templates/qoder/skills/spec-generator/SKILL.md +80 -23
  53. package/templates/qoder/skills/test-generator/SKILL.md +1 -1
  54. package/templates/qoder/skills/wl-code/SKILL.md +13 -1
  55. package/templates/qoder/skills/wl-commit/SKILL.md +1 -1
  56. package/templates/qoder/skills/wl-design/SKILL.md +6 -6
  57. package/templates/qoder/skills/wl-init/SKILL.md +2 -2
  58. package/templates/qoder/skills/wl-insight/SKILL.md +5 -5
  59. package/templates/qoder/skills/wl-prd/SKILL.md +60 -0
  60. package/templates/qoder/skills/wl-report/SKILL.md +2 -2
  61. package/templates/qoder/skills/wl-search/SKILL.md +1 -1
  62. package/templates/qoder/skills/wl-spec/SKILL.md +2 -2
  63. package/templates/qoder/skills/wl-status/SKILL.md +2 -2
  64. package/templates/qoder/skills/wl-task/SKILL.md +3 -3
  65. package/templates/qoder/skills/wl-test/SKILL.md +2 -2
  66. package/templates/qoder/templates/spec-template.md +124 -0
  67. package/templates/root/AGENTS.md +32 -4
  68. package/templates/qoder/skills/wl-prd-full/SKILL.md +0 -121
  69. package/templates/qoder/skills/wl-prd-quick/SKILL.md +0 -50
  70. package/templates/qoder/skills/wl-prd-review/SKILL.md +0 -47
@@ -15,6 +15,13 @@ User input: $ARGUMENTS
15
15
 
16
16
  ## 🚦 路由(看第一个词或描述特征)
17
17
 
18
+ ### 🔴 命令优先铁律(最重要,先读)
19
+ **只要用户打了 `/wl-prd`,就必须产出 PRD,绝不跨命令跑去别处。**
20
+ 哪怕描述含"报错/无法提交/bug/异常"这类词(如"养护计划无法提交,时间报错"——这是要为修复写需求),也走本命令出 PRD,**不准**跑去 `/wl-test`(测试)/ `/wl-code`(直接改码)/ 排查。
21
+ - 用户要写需求 → 本命令(不管描述像 bug 还是新功能)
22
+ - 用户要直接改代码 → 那是 `/wl-code`,但前提是用户打的是 `/wl-code`
23
+ - 判断不准 → 问一句,不要擅自换命令
24
+
18
25
  | 用户说 | 模式 | 走哪个 |
19
26
  |--------|------|--------|
20
27
  | "完整""深度""正经需求" 或 描述含"新模块/新业务/新流程" | **完整** | prd-full-template(13 章)|
@@ -29,28 +36,37 @@ User input: $ARGUMENTS
29
36
 
30
37
  ---
31
38
 
39
+ ## 🔧 仓库根定位(完整档/快速档共用,进任何模式前先跑这一条)
40
+
41
+ > QoderWork 桌面端 cwd 不在仓库根(在 `.qoderwork/workspace/xxx`),相对路径
42
+ > `.qoder/scripts/...` **必然失败**(真实踩坑:连续 2 条命令报错浪费一轮)。
43
+ > 进模式前**必须先定位仓库根**。Mac 只有 python3,两个都试:
44
+
45
+ ```bash
46
+ R=$(python ~/.qoderwork/repo_root.py 2>/dev/null || python3 ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
47
+ PY=$(python --version >/dev/null 2>&1 && echo python || echo python3)
48
+ ```
49
+ > 后续所有 `$PY "$R/.qoder/scripts/..."` 都用这两个变量。**不准自己编 `cd /d` / 裸相对路径**。
50
+
51
+ ---
52
+
32
53
  ## 完整模式(13 章 PRD)
33
54
 
34
55
  **新模块/新业务/新流程用这个。** 支持衔接 insight:`参考:<报告路径>`
35
56
 
36
57
  **铁律:平台必问。** 先问:
37
- ``
58
+ ```
38
59
  这个需求是针对哪个平台?
39
60
  1. Web 管理端 (fywl-ui)
40
61
  2. APP 移动端 (Carmg-H5)
41
62
  3. 两端都要
42
63
  请选择 (1/2/3):
43
- ``
64
+ ```
44
65
 
45
66
  ### 取上下文(1 次调用取全 8 段)
46
- 先定位仓库根(Mac 只有 python3, 两个都试):
47
- ``bash
48
- R=$(python ~/.qoderwork/repo_root.py 2>/dev/null || python3 ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
49
- PY=$(python --version >/dev/null 2>&1 && echo python || echo python3)
50
- ``
51
- ``bash
67
+ ```bash
52
68
  $PY "$R/.qoder/scripts/orchestration/wlkj.py" context <业务词> --platform <web|app>
53
- ``
69
+ ```
54
70
  - 第 4 段 = 历史 PRD(防重复)
55
71
  - 第 5 段 = 相关 API
56
72
  - 第 8 段 = 数据库表结构+真实字段
@@ -63,7 +79,7 @@ $PY "$R/.qoder/scripts/orchestration/wlkj.py" context <业务词> --platform <we
63
79
 
64
80
  ### 原型要不要画?(融入批量确认)
65
81
 
66
- **默认建议**(用户可一键改,详见 `.qoder/skills/wl-prd-full/SKILL.md` STEP 0.5):
82
+ **默认建议**(用户可一键改):
67
83
  - 纯规则/接口/定时/参数/计算类 → **不画**(如"出交车点检固定为总部全局规则")
68
84
  - 含页面/菜单/表单/弹窗/详情/向导/看板/大屏 → **画**
69
85
  - 加字段/按钮/文案/导出 → **不画**
@@ -75,9 +91,9 @@ $PY "$R/.qoder/scripts/orchestration/wlkj.py" context <业务词> --platform <we
75
91
  eval 自动跳过 A2(满分从 100 降到 70,照样 PASS);`/wl-design` `/wl-code` 据此跳过原型环节。
76
92
 
77
93
  ### 质量门禁
78
- ``bash
94
+ ```bash
79
95
  $PY "$R/.qoder/scripts/orchestration/wlkj.py" eval <prd.md> [原型.html]
80
- ``
96
+ ```
81
97
  ≥ 80% 才 PASS。完整模板见 `.qoder/templates/prd-full-template.md`。
82
98
 
83
99
  ---
@@ -88,9 +104,18 @@ $PY "$R/.qoder/scripts/orchestration/wlkj.py" eval <prd.md> [原型.html]
88
104
 
89
105
  **平台必问**(同上)。
90
106
 
107
+ ### 取上下文(1 次 prefetch,禁止串行 search)
108
+ ```bash
109
+ $PY "$R/.qoder/scripts/orchestration/wlkj.py" prefetch "<需求描述>" --platform <p>
110
+ ```
111
+ prefetch 一次返回代码/字段/API/Wiki/历史 PRD。**之后不要逐个 search/find/grep 查词**(会变 6+ 次串行往返,轮次爆炸根因)。不够才补调一次。
112
+
91
113
  ### 产出
92
114
  - Mini-PRD: `workspace/members/{dev}/drafts/REQ-{YYYY}-{NNN}-{标题}.md`(6 章)
93
- - 6 章:功能入口 / 需求背景 / 需求说明 / 影响范围 / 验收标准 / 不在本次范围
115
+ - **6 章缺一不可(铁律)**:功能入口 / 需求背景 / 需求说明 / 影响范围 / 验收标准 / 不在本次范围
116
+ > 🚫 **禁止只写 1-2 章就交差**(真实反面教材:海外考勤 PRD 只写了"功能入口"一段就停,6 章缺 5 章 → 残废品)。
117
+ > 即使是 bug 修复,也要写全 6 章(需求背景=bug 现象、需求说明=修复方案、验收标准=修复后行为)。
118
+ > 不涉及的章节写"不涉及"或一句话说明,**标题必须保留,不许整章省略**。Stop hook 会检测缺章并阻断。
94
119
  - 模板见 `.qoder/templates/prd-quick-template.md`
95
120
 
96
121
  ---
@@ -115,3 +140,52 @@ $PY "$R/.qoder/scripts/orchestration/wlkj.py" eval <prd.md> [原型.html]
115
140
  ## 埋点
116
141
 
117
142
  PRD 生成/评审后自动记录到 learning(eval_prd.py 已内置)。
143
+
144
+ **评审模式额外**:给出 PASS/FAIL 结论后立即记一条 `review_done`(可用性指标 F2 评审级数据唯一来源,不埋则该级永远为 0):
145
+ ```bash
146
+ $PY "$R/.qoder/scripts/orchestration/wlkj.py" learn record review_done "{\"prd\": \"<被评审PRD名>\", \"verdict\": \"PASS|FAIL\"}"
147
+ ```
148
+ 埋点失败不阻塞,但能埋一定要埋。
149
+
150
+ ---
151
+
152
+ ## 📤 发禅道(PRD 写完后的衔接,完整/快速档都问)
153
+
154
+ PRD 产出后,**主动问一句**(不要默默结束):
155
+ ```
156
+ PRD 已写好: <路径>
157
+ 要发到禅道吗?(发禅道 = 建禅道需求 + 可选关联计划/版本)
158
+ ```
159
+
160
+ ### 用户说"发" → 交互式逐项确认(不要一次性全问,按需)
161
+
162
+ 用禅道 MCP 现查现选(QoderWork: `qw_mcp_call`):
163
+
164
+ **① 选产品(必选)**
165
+ - `list_products()` → 列出现有产品 → 让用户选 product_id
166
+ - 禅道需求必须挂产品,没产品发不了
167
+
168
+ **② 关联计划?(可选,问一句)**
169
+ ```
170
+ 要关联到计划(迭代)吗?(可跳过)
171
+ ```
172
+ - 用户要 → `list_plans(product_id=<上一步选的>)` → 选 plan_id
173
+ - 跳过 → 不传 plan
174
+
175
+ **③ 挂版本?(可选,问一句)**
176
+ ```
177
+ 要纳入某个版本(build)吗?(可跳过)
178
+ ```
179
+ - 用户要 → `list_builds(project_id=N)` → 选 build_id(⚠️ builds 按项目维度查最常见,禅道无"全量版本"端点)
180
+ - 跳过 → 不传 build
181
+
182
+ **④ 执行发布**
183
+ ```bash
184
+ $PY "$R/.qoder/scripts/orchestration/wlkj.py" req <REQ-ID> 发布 \
185
+ --product=<①> [--plan=<②>] [--build=<③>] --confirm
186
+ ```
187
+ - 默认先 dry-run 预览,用户确认后再 `--confirm` 真发
188
+ - 真发后禅道建好需求,PRD 末尾自动回写 `<!-- zentao: story=ID -->` 留痕
189
+
190
+ > 用户说"不发" → 不勉强,PRD 留本地,后续可随时 `/wl-req <REQ-ID> 发布`。
191
+ > 直连禅道 HTTP(脚本内部),AI 只触发一次,几乎不耗 token。
@@ -14,7 +14,7 @@ argument-hint: "[REQ-ID] [发布]"
14
14
  |------|--------|
15
15
  | `/wl-req` | 列出所有需求 (跨草稿/产出/历史桶) |
16
16
  | `/wl-req REQ-2026-001` | 显示该需求的全部产出 |
17
- | `/wl-req REQ-2026-001 发布` | 草稿→产出→发禅道 (一步到位) |
17
+ | `/wl-req REQ-2026-001 发布` | 草稿→产出→**真发禅道**(建需求+关联计划+纳入版本) |
18
18
 
19
19
  ## 实现层
20
20
 
@@ -29,10 +29,17 @@ $PY "$R/.qoder/scripts/orchestration/wlkj.py" req
29
29
  # 看某需求全貌
30
30
  $PY "$R/.qoder/scripts/orchestration/wlkj.py" req REQ-2026-001
31
31
 
32
- # 发布 (promote + publish)
33
- $PY "$R/.qoder/scripts/orchestration/wlkj.py" req REQ-2026-001 发布
32
+ # 发布 (promote + publish)。默认 dry-run 只预览, --confirm 才真写禅道
33
+ $PY "$R/.qoder/scripts/orchestration/wlkj.py" req REQ-2026-001 发布 --product=1
34
+ # 真发(建需求→关联计划→纳入版本, 一步到位)
35
+ $PY "$R/.qoder/scripts/orchestration/wlkj.py" req REQ-2026-001 发布 --product=1 --plan=12 --build=8 --confirm
34
36
  ```
35
37
 
38
+ > **产品/计划/版本从哪来**: 命令行 `--product/--plan/--build` 优先; 或在 PRD 顶部标
39
+ > `<!-- zentao: product=1 plan=12 build=8 -->` 自动读取。缺产品ID会停(禅道需求必须挂产品)。
40
+ > 发布后 PRD 末尾自动回写 `<!-- zentao: story=762 -->` 留痕, 防重复建。
41
+ > 直连禅道 HTTP(不走MCP), AI 只触发一次 → 几乎不耗 token。
42
+
36
43
  ## 结构
37
44
 
38
45
  ```