@hupan56/wlkj 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/bin/cli.js +261 -11
  2. package/package.json +1 -1
  3. package/templates/qoder/agents/insight-planning.md +67 -0
  4. package/templates/qoder/agents/insight-research.md +61 -0
  5. package/templates/qoder/agents/prd-reference.md +8 -2
  6. package/templates/qoder/commands/optional/wl-insight.md +275 -0
  7. package/templates/qoder/commands/{wl-report.md → optional/wl-report.md} +13 -5
  8. package/templates/qoder/commands/{wl-spec.md → optional/wl-spec.md} +1 -1
  9. package/templates/qoder/commands/{wl-status.md → optional/wl-status.md} +28 -2
  10. package/templates/qoder/commands/wl-code.md +10 -2
  11. package/templates/qoder/commands/wl-commit.md +1 -1
  12. package/templates/qoder/commands/wl-design-draw.md +78 -0
  13. package/templates/qoder/commands/wl-design-scan.md +108 -0
  14. package/templates/qoder/commands/wl-design-spec.md +154 -0
  15. package/templates/qoder/commands/wl-design.md +32 -0
  16. package/templates/qoder/commands/wl-init.md +24 -3
  17. package/templates/qoder/commands/wl-prd-full.md +226 -0
  18. package/templates/qoder/commands/wl-prd-quick.md +134 -0
  19. package/templates/qoder/commands/wl-prd-review.md +104 -0
  20. package/templates/qoder/commands/wl-prd.md +17 -311
  21. package/templates/qoder/commands/wl-search.md +66 -30
  22. package/templates/qoder/commands/wl-task.md +290 -59
  23. package/templates/qoder/commands/wl-test.md +92 -24
  24. package/templates/qoder/config.yaml +51 -15
  25. package/templates/qoder/hooks/inject-workflow-state.py +2 -2
  26. package/templates/qoder/hooks/session-start.py +82 -51
  27. package/templates/qoder/rules/wl-pipeline.md +216 -105
  28. package/templates/qoder/scripts/__pycache__/search_index.cpython-39.pyc +0 -0
  29. package/templates/qoder/scripts/archive_prd.py +377 -0
  30. package/templates/qoder/scripts/autotest.py +1715 -0
  31. package/templates/qoder/scripts/autotest_batch.py +224 -0
  32. package/templates/qoder/scripts/autotest_run.py +297 -0
  33. package/templates/qoder/scripts/benchmark.py +210 -209
  34. package/templates/qoder/scripts/build_style_index.py +444 -4
  35. package/templates/qoder/scripts/check_carriers.py +238 -0
  36. package/templates/qoder/scripts/check_mcp.py +298 -0
  37. package/templates/qoder/scripts/check_qoderwork_consistency.py +166 -0
  38. package/templates/qoder/scripts/common/events.py +46 -0
  39. package/templates/qoder/scripts/common/extract.py +419 -0
  40. package/templates/qoder/scripts/common/graph_traverse.py +533 -0
  41. package/templates/qoder/scripts/common/paths.py +89 -0
  42. package/templates/qoder/scripts/common/pip_install.py +144 -0
  43. package/templates/qoder/scripts/common/platform_guard.py +61 -0
  44. package/templates/qoder/scripts/common/search_engine.py +205 -205
  45. package/templates/qoder/scripts/common/terms.py +57 -0
  46. package/templates/qoder/scripts/common/ts_extract.py +536 -0
  47. package/templates/qoder/scripts/context_pack.py +73 -13
  48. package/templates/qoder/scripts/enrich_prompt.py +226 -0
  49. package/templates/qoder/scripts/eval_prd.py +318 -231
  50. package/templates/qoder/scripts/export.py +487 -487
  51. package/templates/qoder/scripts/extract_api_params.py +246 -0
  52. package/templates/qoder/scripts/extract_routes.py +54 -0
  53. package/templates/qoder/scripts/extract_routes_tree.py +78 -0
  54. package/templates/qoder/scripts/fill_prototype.py +707 -0
  55. package/templates/qoder/scripts/gen_design_doc.py +394 -0
  56. package/templates/qoder/scripts/git_sync.py +27 -15
  57. package/templates/qoder/scripts/init_doctor.py +292 -40
  58. package/templates/qoder/scripts/install_qoderwork.py +366 -9
  59. package/templates/qoder/scripts/kg.py +708 -0
  60. package/templates/qoder/scripts/kg_auto_login.py +196 -0
  61. package/templates/qoder/scripts/kg_build.py +612 -0
  62. package/templates/qoder/scripts/kg_build_db.py +327 -0
  63. package/templates/qoder/scripts/kg_duckdb.py +549 -0
  64. package/templates/qoder/scripts/kg_incremental.py +393 -0
  65. package/templates/qoder/scripts/kg_link_db.py +224 -0
  66. package/templates/qoder/scripts/kg_mcp_server.py +801 -0
  67. package/templates/qoder/scripts/kg_semantic.py +150 -0
  68. package/templates/qoder/scripts/kg_test_runner.py +241 -0
  69. package/templates/qoder/scripts/lanhu_stdio_wrapper.py +119 -0
  70. package/templates/qoder/scripts/learn.py +118 -39
  71. package/templates/qoder/scripts/learn_aggregate.py +201 -0
  72. package/templates/qoder/scripts/mcp_launcher.py +359 -0
  73. package/templates/qoder/scripts/mysql_mcp_server.py +396 -0
  74. package/templates/qoder/scripts/repo_root.py +106 -0
  75. package/templates/qoder/scripts/role.py +12 -0
  76. package/templates/qoder/scripts/run_weekly_update.bat +5 -0
  77. package/templates/qoder/scripts/run_weekly_update.sh +5 -0
  78. package/templates/qoder/scripts/search_index.py +307 -60
  79. package/templates/qoder/scripts/secure-ls.js +5640 -0
  80. package/templates/qoder/scripts/setup.py +706 -641
  81. package/templates/qoder/scripts/setup_lanhu.py +963 -0
  82. package/templates/qoder/scripts/status.py +250 -11
  83. package/templates/qoder/scripts/sync_carriers.py +259 -0
  84. package/templates/qoder/scripts/syncgate.py +2 -2
  85. package/templates/qoder/scripts/task.py +75 -0
  86. package/templates/qoder/scripts/team_sync.py +60 -4
  87. package/templates/qoder/scripts/workspace_init.py +1 -1
  88. package/templates/qoder/skills/design-import/SKILL.md +226 -0
  89. package/templates/qoder/skills/design-import/figma-workflow.md +81 -0
  90. package/templates/qoder/skills/design-review/SKILL.md +82 -25
  91. package/templates/qoder/skills/prd-generator/SKILL.md +184 -60
  92. package/templates/qoder/skills/prd-review/SKILL.md +18 -1
  93. package/templates/qoder/skills/prompt-enrich/SKILL.md +90 -0
  94. package/templates/qoder/skills/prototype-generator/SKILL.md +256 -141
  95. package/templates/qoder/skills/prototype-generator/SKILL.md.zcode-79180-2af4721f-f9a6-412c-88db-c0af680d211b.tmp +0 -0
  96. package/templates/qoder/skills/spec-coder/SKILL.md +18 -1
  97. package/templates/qoder/skills/spec-generator/SKILL.md +18 -1
  98. package/templates/qoder/skills/test-generator/SKILL.md +15 -2
  99. package/templates/qoder/skills/wl-code/SKILL.md +55 -36
  100. package/templates/qoder/skills/wl-commit/SKILL.md +89 -76
  101. package/templates/qoder/skills/wl-design/SKILL.md +55 -0
  102. package/templates/qoder/skills/wl-init/SKILL.md +76 -67
  103. package/templates/qoder/skills/wl-insight/SKILL.md +201 -81
  104. package/templates/qoder/skills/wl-prd-full/SKILL.md +69 -0
  105. package/templates/qoder/skills/wl-prd-quick/SKILL.md +49 -0
  106. package/templates/qoder/skills/wl-prd-review/SKILL.md +34 -0
  107. package/templates/qoder/skills/wl-report/SKILL.md +131 -107
  108. package/templates/qoder/skills/wl-search/SKILL.md +141 -75
  109. package/templates/qoder/skills/wl-spec/SKILL.md +49 -39
  110. package/templates/qoder/skills/wl-status/SKILL.md +83 -61
  111. package/templates/qoder/skills/wl-task/SKILL.md +132 -58
  112. package/templates/qoder/skills/wl-test/SKILL.md +406 -40
  113. package/templates/qoder/templates/prototype-app.html +13 -8
  114. package/templates/qoder/templates/prototype-web.html +376 -93
  115. package/templates/root/AGENTS.md +89 -34
  116. package/templates/root/requirements.txt +21 -0
  117. package/templates/root//344/275/277/347/224/250/350/257/264/346/230/216.md +259 -259
  118. package/templates/root//346/226/260/346/211/213/346/214/207/345/215/227.md +186 -186
  119. package/templates/qoder/agents/prd-planning.md +0 -57
  120. package/templates/qoder/agents/prd-research.md +0 -34
  121. package/templates/qoder/commands/wl-insight.md +0 -51
  122. package/templates/qoder/scripts/__pycache__/init_doctor.cpython-39.pyc +0 -0
  123. package/templates/qoder/scripts/__pycache__/setup.cpython-39.pyc +0 -0
  124. package/templates/qoder/scripts/common/__pycache__/developer.cpython-39.pyc +0 -0
  125. package/templates/qoder/skills/wl-prd/SKILL.md +0 -92
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: wl-prd-review
3
+ description: "评审 PRD 完整性与质量(7 项 checklist + EVA 评分)。"
4
+ argument-hint: "[可选: PRD文件路径] 不给则列出最近 PRD 让用户选"
5
+ auto-approve: true
6
+ allowed-tools: [Read, Bash]
7
+ ---
8
+
9
+ # /wl-prd-review - 评审 PRD 完整性与质量
10
+
11
+ User input: $ARGUMENTS
12
+
13
+ > **定位:评审已有 PRD,不产出新 PRD。** 拿到一份 PRD,检查它够不够格发布/交付下游。
14
+ > 产出的 PRD 要评审,跑这个;要从头写 PRD,走 `/wl-prd-full` 或 `/wl-prd-quick`。
15
+
16
+ ---
17
+
18
+ ## 🔧 环境自检(QoderWork 桌面端 vs Qoder IDE/CLI)
19
+
20
+ **QoderWork 桌面端的工作目录是临时会话目录,不是仓库根!** 相对路径会失效。
21
+ ```bash
22
+ # 确定仓库根 R:
23
+ R=$(python ~/.qoderwork/repo_root.py) # QoderWork 桌面端
24
+ R=. # IDE/CLI(工作目录就是仓库)
25
+ ```
26
+
27
+ ---
28
+
29
+ ## STEP 0: 定位要评审的 PRD
30
+
31
+ **若 $ARGUMENTS 给了文件路径** → 直接 Read 该 PRD。
32
+
33
+ **若没给路径** → 扫仓库的这两个目录,列出最近的 PRD 让用户选:
34
+ ```bash
35
+ # 已归档的可发布 PRD
36
+ dir /b "$R\data\docs\prd\REQ-*.md"
37
+ # 还在草稿区的
38
+ dir /b "$R\workspace\members\*\drafts\REQ-*.md"
39
+ ```
40
+ 列出最近 5-10 份(带 REQ-ID 和标题),让用户选要评审哪份。
41
+
42
+ ---
43
+
44
+ ## STEP 1: 7 项人工评审 Checklist
45
+
46
+ 读完 PRD 后,逐项检查:
47
+
48
+ - [ ] **用户故事清晰**:每类用户要做什么,说清楚了
49
+ - [ ] **验收标准可测**:每个功能点有 Given-When-Then,能照着测
50
+ - [ ] **优先级已标**:功能点标了 P0/P1/P2/P3
51
+ - [ ] **模块/领域已识别**:属于哪个业务模块明确
52
+ - [ ] **非功能性需求已列**:性能/兼容/安全等(适用的话)
53
+ - [ ] **边界情况已考虑**:每个功能 ≥2 个异常场景(空数据/超长/并发/权限等)
54
+ - [ ] **依赖已识别**:依赖的其他模块/API/上下游说清了
55
+
56
+ ---
57
+
58
+ ## STEP 2: 跑 EVA 客观评分
59
+
60
+ 给 PRD 打客观分数(这是评审的硬依据,在仓库根下执行):
61
+ ```bash
62
+ cd "$R" && python .qoder/scripts/eval_prd.py <PRD路径> [原型HTML路径]
63
+ ```
64
+
65
+ | 维度 | 权重 | 检查内容 |
66
+ |------|------|----------|
67
+ | A1 现实锚定 | 40 分 | 字段/API 在索引命中比例(有没有发明字段) |
68
+ | A2 风格保真 | 30 分 | 原型颜色来自真源(无原型则跳过) |
69
+ | A3 模板完整 | 30 分 | 章节齐全比例 |
70
+
71
+ **≥ 80% 才 PASS**。低于 80% 把 EVA 报告的问题合并进 STEP 3 的修复清单。
72
+
73
+ > 注意 mode 标记:quick PRD(`<!-- mode: quick -->`)会跳过 EVA 完整检查;reference/full PRD 跑全套。评审时尊重 mode 差异——quick PRD 不该用 13 章标准苛求。
74
+
75
+ ---
76
+
77
+ ## STEP 3: 合并报告
78
+
79
+ 把 STEP 1 的 checklist 结果 + STEP 2 的 EVA 分数合并成评审报告:
80
+
81
+ **若 PASS**(checklist 全过 + EVA ≥80%):
82
+ ```
83
+ ✅ PRD 评审通过
84
+ - EVA 分数: XX/100
85
+ - 7 项检查: 全部通过
86
+ 建议:可发布(跑 /wl-prd-full 或 /wl-prd-quick 的发布流程),或直接建任务。
87
+ ```
88
+
89
+ **若不 PASS**:
90
+ ```
91
+ ❌ PRD 需修复,问题清单:
92
+ 1. [必须] 验收标准缺 Given-When-Then(功能 X)
93
+ 2. [必须] A1 命中率仅 45%,疑似发明字段:abcField, xyzStatus
94
+ 3. [建议] 边界情况只考虑了空数据,缺超长/并发场景
95
+ ...
96
+ 修复后重新评审:/wl-prd-review <PRD路径>
97
+ ```
98
+
99
+ ---
100
+
101
+ ## ⚙️ 自取上下文(Quest / QoderWork 无 hook 注入,必须自读)
102
+
103
+ - `.qoder/.developer` — 当前评审人
104
+ - `data/index/.index-meta.json` — 图谱新鲜度(影响 A1 现实锚定能否校验;过期则 A1 可能漏报)
@@ -1,321 +1,27 @@
1
1
  ---
2
2
  name: wl-prd
3
- description: "Generate PRD with prototype matching project style"
4
- argument-hint: "[mode] [description] modes: reference/brainstorm/plan/quick"
3
+ description: "[已废弃] 旧的单命令已拆分。请用 /wl-prd-full /wl-prd-quick /wl-prd-review"
5
4
  auto-approve: true
6
- allowed-tools: [Read, Glob, Grep, Bash, Write, Edit, Agent]
7
5
  ---
8
6
 
9
- # /wl-prd - Generate PRD + Prototype
7
+ # /wl-prd - 已废弃(拆分为 3 个独立命令)
10
8
 
11
- User input: $ARGUMENTS
9
+ > ⚠️ **本命令已废弃。** `/wl-prd` 的单命令 + 参数路由(`快速`/`深度`/`探讨`)已拆成 3 个独立命令,
10
+ > **只准 `/wl-prd-xx` 形式触发**。请改用:
12
11
 
13
- ## ⚠️ STEP 0: MANDATORY PLATFORM SELECTION (MUST DO FIRST!)
12
+ | 你要做什么 | 用哪个命令 |
13
+ |-----------|-----------|
14
+ | 写正经需求(新模块/新业务/新流程),完整 13 章 PRD + 原型 | **`/wl-prd-full`** |
15
+ | 小改动(加字段/加按钮/改文案),极速 Mini-PRD | **`/wl-prd-quick`** |
16
+ | 评审已有 PRD 的质量 | **`/wl-prd-review`** |
14
17
 
15
- **Before ANY search, ANY file read, ANY analysis — ask this question.**
16
- **NEVER auto-detect. NEVER assume. NEVER skip. ALWAYS ASK.**
18
+ ## 旧用法对照
17
19
 
18
- ```
19
- 这个需求是针对哪个平台?
20
+ | 旧用法(已废弃) | 新用法 |
21
+ |----------------|--------|
22
+ | `/wl-prd 快速:<需求>` | `/wl-prd-quick <需求>` |
23
+ | `/wl-prd <需求>`(默认) | `/wl-prd-full <需求>` |
24
+ | `/wl-prd 参考:<报告>`(衔接 insight) | `/wl-prd-full 参考:<报告>` |
25
+ | `/wl-prd 深度` / `/wl-prd 探讨` | `/wl-prd-full`(探索类已归 `/wl-insight`) |
20
26
 
21
- 1. **Web 管理端** (fywl-ui) - Ant Design Vue + VxeGrid 风格
22
- 2. **APP 移动端** (Carmg-H5) - Vant 风格
23
- 3. **两端都要**
24
-
25
- 请选择 (1/2/3):
26
- ```
27
-
28
- WAIT for the answer. Platform determines everything downstream:
29
-
30
- | Answer | Platform | Project | Search Flag | Prototype Template |
31
- |--------|----------|---------|-------------|--------------------|
32
- | 1 / Web / PC / 管理端 | Web | fywl-ui | `--platform web` | .qoder/templates/prototype-web.html |
33
- | 2 / APP / H5 / 移动端 | APP | Carmg-H5 | `--platform app` | .qoder/templates/prototype-app.html |
34
- | 3 / 都要 / 两端 | Both | Both | run both | both templates, 2 prototypes |
35
-
36
- ## Mode Detection
37
-
38
- | 怎么说 | 做什么 | 出 PRD? |
39
- |--------|--------|---------|
40
- | `/wl-prd 写个XX需求` | **直接生成** PRD + 原型 | ✅ |
41
- | `/wl-prd 深度 XX需求` 或 "深入分析""全面调研""规划" | **先分析后生成**:现状+Gap+多角度(SCAMPER)→PRD+原型 | ✅ |
42
- | `/wl-prd 快速 加个字段` 或 "快速""小改动" | **Mini-PRD**:精简格式,跳过 EVA | ✅ |
43
- | `/wl-prd 探讨 XX怎么做` 或 "聊聊""分析一下" | **纯讨论**:理需求、给方向,不出文件 | ❌ |
44
-
45
- ### 命令很简单
46
-
47
- ```
48
- /wl-prd <你的需求> ← 默认,直接出 PRD
49
- /wl-prd 深度 <你的需求> ← 先分析(现状/Gap/创新角度)再出 PRD
50
- /wl-prd 快速 <你的需求> ← 小改动,Mini-PRD
51
- /wl-prd 探讨 <你的需求> ← 纯聊天,不出文件
52
- ```
53
-
54
- > **"深度"模式** = 原 Brainstorm + Planning 合并:
55
- > - 先跑现状分析 + Gap 分析 + SCAMPER 多角度
56
- > - 再生成 PRD + 原型
57
- > - 适合:大需求/新领域/想创新/季度规划
58
-
59
- ### 模式路由规则
60
-
61
- 1. **显式参数优先**:`/wl-prd 深度 XX` `/wl-prd 快速 XX` `/wl-prd 探讨 XX`
62
- 2. **关键词推断**:
63
- - "深入""全面""规划""调研""创新""头脑风暴" → 深度
64
- - "快速""加个""小改动" → 快速
65
- - "探讨""聊聊""分析一下" → 探讨
66
- 3. **默认**:不带关键词 → 直接生成
67
-
68
- ### 什么时候用哪个模式?
69
-
70
- - **不知道怎么做** → 探讨(先聊清楚再决定要不要出PRD)
71
- - **照着已有的做类似的** → 参考(默认)
72
- - **想创新/没思路** → 头脑风暴
73
- - **大方向/季度规划** → 规划
74
- - **小功能/Bug fix** → 快速
75
-
76
- ### Discuss 转 Reference 的标记(审计用)
77
-
78
- Discuss 结束、用户说"出PRD"时,AI 必须输出:
79
- ```
80
- [MODE-SWITCH: discuss→reference]
81
- ```
82
- 然后按 Reference 模式流程生成。
83
-
84
- ### 全模式标记规则(生成 PRD 时必须遵守)
85
-
86
- **每种模式生成的 PRD,第一行必须是 `<!-- mode: <模式名> -->` 标记**:
87
- ```markdown
88
- <!-- mode: reference --> (或 brainstorm / planning / quick)
89
- # 标题...
90
- ```
91
-
92
- 各模式标记值与 EVA 门禁行为:
93
-
94
- | 模式 | mode 标记 | EVA 处理 | 说明 |
95
- |------|----------|---------|------|
96
- | Reference | `<!-- mode: reference -->` | 全跑 (A1+A3) | 默认完整 PRD |
97
- | Brainstorm | `<!-- mode: brainstorm -->` | 全跑 | 创新方案 PRD |
98
- | Planning | `<!-- mode: planning -->` | 全跑 | 规划路线图 PRD |
99
- | Quick | `<!-- mode: quick -->` | **跳过 EVA** | Mini-PRD 精简, A3 字段检查不适用 |
100
- | Discuss | (不出文件, 无标记) | — | 纯讨论 |
101
-
102
- > 标记从模板继承(模板已有正确默认值)。生成时**只改 mode 值,别删标记**。
103
- > syncgate 和 eval_prd 都靠这个标记识别模式;缺失标记会按 full 模板检查(对 Quick 会误杀)。
104
- > 向后兼容:旧 PRD 无标记时,eval_prd 回退到内容识别(看 Mini-PRD/零星需求字样)。
105
-
106
- ### Brainstorm 中间文件清理
107
-
108
- Brainstorm 模式可能生成 `brainstorm-agent-*.md` 中间调研文件。
109
- 生成最终 PRD 后**必须删除这些中间文件**:
110
- ```bash
111
- rm -f workspace/members/*/drafts/brainstorm-agent-*.md
112
- ```
113
- team_sync 的 staging allowlist 也会拒绝 `brainstorm-agent-*` 文件名。
114
-
115
- The agent files define the detailed workflow for each mode. When
116
- dispatching a sub-agent, ALWAYS include in the dispatch prompt:
117
- the chosen platform, the user requirement, and the current developer name.
118
- For simple requirements you may run the mode workflow inline instead of
119
- dispatching — the steps are the same.
120
-
121
- ### 模式不确定时的兜底(必须遵守)
122
-
123
- **推断流程(每次必走)**:
124
- 1. AI 根据用户关键词推断出一个候选模式
125
- 2. **置信度自检**:问自己"这个需求是否可能属于另一个模式?"
126
- - 若可能(≥2 模式沾边,如既像"分析"又像"规划")→ **必须问用户**
127
- - 若无明显歧义 → 直接用候选模式
128
- 3. 默认走 Reference 仅当用户明确给出需求描述且无探讨/创新/规划信号时
129
-
130
- **歧义确认话术(统一问法,降低不一致)**:
131
- ```
132
- 这个需求我理解为 [X 模式](会:[X 的产出])。
133
- 也可以走 [Y 模式](会:[Y 的产出])。
134
- 你要哪种?
135
- ```
136
-
137
- **铁律**:宁可多问一句,不要错模式。错模式的 PRD 是废纸——EVA 门禁只管格式不管方向,格式过了的废 PRD 照样能发布。
138
-
139
- ## Storage
140
-
141
- Draft -> workspace/members/{developer}/drafts/REQ-{ID}-{desc}.md
142
- Confirmed -> workspace/specs/prd/REQ-{ID}-{desc}.md
143
- Prototype (single platform) -> workspace/members/{developer}/drafts/prototype-{feature}.html
144
- Prototype (Both) -> prototype-{feature}-web.html AND prototype-{feature}-app.html
145
-
146
- REQ-ID rule: **必须**调用原子分配器获取新 ID, 禁止手动扫描最大值 (多人并发会撞号):
147
- ```bash
148
- python -c "import sys; sys.path.insert(0,'.qoder/scripts'); from common.reqid import allocate_req_id; n=allocate_req_id(); print('REQ-%d-%03d' % (__import__('datetime').date.today().year, n))"
149
- ```
150
- 分配器在文件锁内读 data/index/req-counter.json + 递增 + 写回, 保证并发安全。
151
- 首次使用若计数器不存在, 会自动 migrate_from_existing() 扫现有 PRD 初始化。
152
- Never reuse an existing number. push 时 team_sync 会校验 REQ-ID 唯一性。
153
-
154
- ---
155
-
156
- ## Discuss Mode (探讨模式 — 纯讨论,不出 PRD/原型)
157
-
158
- > 触发:用户说"探讨""聊聊""分析一下""我想做个XX但不知道怎么做"
159
- > 或需求很模糊,需要先理清思路时。
160
-
161
- ### 做什么
162
- 1. **听需求**:让用户把想法说完,不要急着出方案
163
- 2. **问关键问题**(一次问完,不要一条一条问):
164
- - 要解决什么问题?(业务痛点)
165
- - 谁用?(角色/场景)
166
- - 现在怎么做的?(现状)
167
- - 期望怎样?(目标)
168
- 3. **给方向建议**:基于现有代码(跑 context_pack 了解现状)给出 2-3 个可行方向
169
- 4. **不生成 PRD、不生成原型、不分配 REQ-ID**
170
- 5. 讨论结束后问:"要按这个方向出 PRD 吗?" → 用户说是 → 转 Reference 模式
171
-
172
- ### 不做什么
173
- - ❌ 不写 PRD 文件
174
- - ❌ 不画原型
175
- - ❌ 不分配 REQ-ID
176
- - ❌ 不跑 EVA 评估
177
- - ❌ 不 push
178
-
179
- ---
180
-
181
- ## Reference Mode (DEFAULT)
182
-
183
- ### Step 1: Get ALL Context in ONE Call (fast path)
184
- ```bash
185
- python .qoder/scripts/context_pack.py <业务关键词> --platform <web|app> [--type table|form|dashboard]
186
- ```
187
- One command returns: related code files + same-type page examples +
188
- real field specs + related PRDs + APIs + style/icon/template pointers.
189
- Then read the top 2-3 most similar Vue files it lists.
190
- (Fallback: individual search_index.py calls if you need to drill deeper.)
191
-
192
- ### Step 2: Read History PRD
193
- Read related PRDs found by `--prd` from data/docs/prd/.
194
-
195
- ### Step 3: Read Business Drafts
196
- Read data/docs/drafts/ for business context.
197
-
198
- ### Step 4: Style Tokens
199
- - Web: read data/index/vben-style-reference.json (pre-distilled design tokens)
200
- - APP: Vant variables (see Prototype Rules below)
201
- - Only open data/style/ PDFs if a needed token is missing from the JSON.
202
- - If PDF conflicts with real code, CODE WINS.
203
-
204
- ### Step 5: Confirm Findings (BATCHED)
205
- Present ALL findings in ONE numbered list (existing behavior, related pages,
206
- fields, business rules, assumptions). Ask the user to confirm or correct
207
- in a single round. Only ask follow-up questions for genuinely ambiguous points.
208
- Do NOT ask one question per finding.
209
-
210
- ### Step 6: Generate PRD + Prototype
211
-
212
- **PRD**: Auto-detect product type, use template, run 10-point quality check
213
- (see prd-generator skill).
214
-
215
- **Prototype** (KEY FEATURE):
216
- 1. Determine prototype type (table/form/detail/modal)
217
- 2. Start from the platform template (.qoder/templates/prototype-web.html or prototype-app.html)
218
- 3. Fill placeholders with real fields/columns extracted from existing code
219
- 4. Changed/new points highlighted (highlight-new class)
220
- 5. Clickable, fillable, hover effects; single self-contained file
221
- 6. Save per Storage rules above (Both -> 2 files with -web/-app suffix)
222
-
223
- ### Step 7: EVA Gate + Confirm Publish + Auto Sync
224
- Before asking to publish, run the quality gate:
225
- ```bash
226
- python .qoder/scripts/eval_prd.py <draft-prd.md> <prototype.html>
227
- ```
228
- If it FAILs (<80%), fix the reported issues (missing sections / invented
229
- fields / non-canonical colors) and re-run until PASS. Then ask user to
230
- confirm publishing to workspace/specs/prd/.
231
- After publishing (and also after saving drafts/prototypes), run:
232
- ```bash
233
- # 1. 归档到 data/docs/prd/ (立刻可搜, 不用等周五 cron)
234
- python .qoder/scripts/collect_prds.py
235
- # 2. 推送到团队
236
- python .qoder/scripts/team_sync.py push
237
- ```
238
- This silently commits & pushes the PM's outputs to the team repo.
239
- The user NEVER needs to know git. If the script prints SYNC_CONFLICT,
240
- YOU (the AI) resolve the git conflict following its instructions —
241
- do not ask the user to run git commands.
242
-
243
- ---
244
-
245
- ## Brainstorm Mode
246
-
247
- 1. SCAMPER 7 dimensions + 5-Why root cause analysis (inline)
248
- 2. Dispatch N sub-agents (default 2-4, scale with topic size) using
249
- .qoder/agents/prd-research.md — each gets a distinct perspective
250
- (competitor / user / tech / risk), web research only
251
- 3. Each agent writes workspace/members/{developer}/drafts/brainstorm-agent{N}-{perspective}.md
252
- 4. MERGE all agent reports into one summary, present to user,
253
- then DELETE the per-agent brainstorm-agent*.md files
254
- 5. Generate PRD + prototype matching target platform style (Step 6 above)
255
-
256
- ---
257
-
258
- ## Planning Mode
259
-
260
- Follow .qoder/agents/prd-planning.md:
261
- 1. Current state analysis (read code, platform-aware search)
262
- 2. Ideal state research (web search)
263
- 3. Gap analysis table
264
- 4. Current plan (MVP) + Future plan
265
- 5. ONE confirmation round on the full report (adjust at most twice, don't loop forever)
266
- 6. Output plan-{topic}.md AND (if user wants to proceed) PRD + prototype via Step 6
267
-
268
- ---
269
-
270
- ## Quick Mode (极速 — 3 步完成)
271
-
272
- > 触发:"快速""quick""加个字段""小改动""加个按钮"
273
- > 小功能专用。砍掉所有非必要步骤。
274
-
275
- Follow .qoder/agents/prd-quick.md:
276
- 1. **一次取全**:`context_pack.py`(1 次调用,不要再单独 search)
277
- 2. **一次生成**:Mini-PRD + 微型原型(直接 Write,不分步)
278
- 3. **一次确认**:问用户"可以吗"→ 确认后 push
279
-
280
- > Quick 模式**跳过**:EVA 评估、历史 PRD、网络搜索、style JSON 查颜色。
281
- > 原型直接从模板改 diff,模板已含正确颜色。
282
-
283
- ---
284
-
285
- ## Data Reading Matrix
286
-
287
- | Mode | Read Code | Read PRD | Web Search | Read Style | Generate Prototype |
288
- |------|-----------|----------|------------|------------|-------------------|
289
- | Reference | YES | YES | YES | YES | YES match |
290
- | Brainstorm | STYLE ONLY* | NO | YES | YES | YES new |
291
- | Planning | YES | YES | YES | YES | YES diff |
292
- | Quick | YES | NO | NO | YES | YES micro |
293
-
294
- *Brainstorm: business research happens on the web, but the prototype style
295
- MUST come from real code. Before generating any new-feature prototype:
296
- run `--style <type> --platform <p>`, read 1-2 closest real pages, and for
297
- dashboard/看板/大屏 requirements read data/index/chart-style-reference.json
298
- (two in-system idioms: 大屏深蓝风 = dashboard/monitor, 浅色卡片风 =
299
- dashboard/workbench). Never invent a generic admin look.
300
-
301
- ---
302
-
303
- ## Prototype Rules
304
-
305
- 1. Style priority: real .vue code > vben-style-reference.json / Vant tokens > PDF spec
306
- 2. Only change the diff, everything else identical to existing page
307
- 3. Interactive: buttons, forms, tables must work
308
- 4. Single file: one HTML with all CSS and JS
309
- 5. Templates already contain the correct design tokens — do not invent colors
310
-
311
- ### Web (fywl-ui) tokens — from data/index/vben-style-reference.json
312
- - Primary: `hsl(212 100% 45%)` via `--primary` CSS variable
313
- - Destructive: `hsl(359.33 100% 65.1%)`, Success: `hsl(144 57% 58%)`
314
- - Background: `hsl(216 20.11% 95.47%)` deep / #ffffff card
315
- - Font: PingFang SC / Microsoft YaHei, 14px
316
- - Table: VxeGrid style, fixed header, stripe
317
- - Form: labelWidth 80-120px, grid 2-4 columns
318
-
319
- ### APP (Carmg-H5) tokens — Vant 3
320
- - `--van-primary-color: #1989fa`, success #07c160, warning #ff976a, danger #ee0a24
321
- - max-width: 375px, bottom tab bar, mobile layout
27
+ > 旧参数路由模式不再支持。输入 `/wl-prd-` 可看到 3 个新命令。
@@ -1,52 +1,88 @@
1
1
  ---
2
2
  name: wl-search
3
- description: "Search code index by keyword or API. Auto-approve. Returns compact results."
4
- argument-hint: "[keyword] or --api [path] or --list or --modules"
3
+ description: "查代码/业务/API/字段/PRD + 知识图谱(影响分析/覆盖矩阵/功能画像/业务流程/多跳遍历)的唯一入口。"
4
+ argument-hint: "[keyword] or --api [path] or subcommand. 全系13个能力见下表"
5
5
  auto-approve: true
6
- allowed-tools: [Read, Bash]
6
+ allowed-tools: [Read, Bash, mcp__qoder-knowledge-graph]
7
7
  ---
8
8
 
9
- # /wl-search - Search Code Index
9
+ # /wl-search - 搜索代码 & 知识图谱
10
10
 
11
11
  User input: $ARGUMENTS
12
12
 
13
- ## THIS IS THE ONLY WAY TO SEARCH CODE
13
+ ## 🔧 环境自检(QoderWork 桌面端 vs Qoder IDE/CLI)
14
14
 
15
- When user asks about ANY code/business/API, use this command.
16
- It calls search_index.py which returns compact results (~200 bytes).
17
- DO NOT grep the entire codebase.
15
+ **先确定仓库根 R**(QoderWork 桌面端工作目录不是仓库根,相对路径会失效):
16
+ ```bash
17
+ R=$(python ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
18
+ ```
19
+ > 后续脚本统一用 `python "$R/.qoder/scripts/xxx.py"`。
18
20
 
19
- ## Execution
21
+ ## 双轨:MCP 优先(仅 QoderWork)/ kg.py 兜底(全系列通用)
20
22
 
21
- Run exactly this command:
22
- ```
23
- python .qoder/scripts/search_index.py $ARGUMENTS
24
- ```
23
+ **QoderWork 环境**(有 `mcp__qoder-knowledge-graph`):直接调 MCP 工具,更快。
24
+ **其他 Qoder 载体**(IDE/Quest/CLI):跑 `python "$R/.qoder/scripts/kg.py"`,功能等价。
25
+
26
+ 不确定在哪个环境?先试 MCP;MCP 工具不存在就用 kg.py。
27
+
28
+ ## 13 个能力对照表
29
+
30
+ | 用户要查什么 | MCP 工具(QoderWork) | kg.py 命令(全系列) |
31
+ |-------------|---------------------|---------------------|
32
+ | 代码在哪 / 搜关键词 | `search_code(keyword='考勤', platform='web')` | `kg.py search 考勤 --platform web` |
33
+ | API 端点 | `search_api(keyword='salary')` | `kg.py api salary` |
34
+ | 已有 PRD(防重复造轮子) | `search_prd(keyword='保险')` | `kg.py prd 保险` |
35
+ | 改某接口影响哪些页面 | `get_impact(endpoint='/asset')` | `kg.py impact /asset` |
36
+ | 某函数/端点的完整关联 | `context_360(symbol='handleExport')` | `kg.py context360 handleExport` |
37
+ | 一次取全(代码+页面+字段+API) | `context_pack(keyword='车辆', role='pm')` | `kg.py context 车辆 --role pm` |
38
+ | 哪些功能有/没测试 | `coverage_matrix()` | `kg.py coverage` |
39
+ | 功能完整画像 | `feature_overview(feature='资产管理')` | `kg.py feature 资产管理` |
40
+ | 业务流程链(几步) | `get_workflow(module='assets')` | `kg.py workflow assets` |
41
+ | 多跳遍历(关联实体) | `multi_hop(symbol='资产管理', max_depth=3)` | `kg.py hop 资产管理 --depth 3` |
42
+ | Repo Wiki 模块文档 | `search_wiki(keyword='考勤')` | `kg.py wiki 考勤` |
43
+ | 原型预填(真实数据) | `fill_prototype(keyword='车辆', platform='web')` | `kg.py fill-prototype 车辆 --platform web` |
44
+ | 设计系统规范 | `get_design_system(platform='web')` | `kg.py design-system --platform web` |
45
+
46
+ ## 快速判断该用哪个
47
+
48
+ - **"这个功能已经有了吗"** → `prd` 查需求 + `feature` 看画像
49
+ - **"改这个会影响谁"** → `impact`
50
+ - **"哪些功能缺测试"** → `coverage`
51
+ - **"盘点流程有几步"** → `workflow`
52
+ - **"XX 谁调用了/调用链"** → `context360` 或 `hop`
53
+ - **写 PRD 前一次取全** → `context --role pm`
54
+ - **出原型前** → `design-system` + `fill-prototype`
55
+
56
+ ## 字段/页面风格/组件(仍用 search_index.py)
57
+
58
+ 这些 kg.py 未单独封装,直接跑:
25
59
 
26
- If no arguments provided, run:
27
60
  ```
28
- python .qoder/scripts/search_index.py --list
61
+ python "$R/.qoder/scripts/search_index.py" --field <字段名>
62
+ python "$R/.qoder/scripts/search_index.py" --style <table|form|detail|modal|dashboard> [--platform web|app]
63
+ python "$R/.qoder/scripts/search_index.py" --list # Top50 关键词
64
+ python "$R/.qoder/scripts/search_index.py" --modules # 项目模块概览
65
+ python "$R/.qoder/scripts/search_index.py" --components # 组件使用统计
29
66
  ```
30
67
 
31
- ## How to Use Results
68
+ ## 没给参数时
32
69
 
33
- The script returns:
34
- - Matched files grouped by project
35
- - Shortened paths (project/module/.../file.java)
36
- - Max 5 files per keyword
70
+ 如果用户没给关键词/子命令,先问意图,或跑 `python "$R/.qoder/scripts/search_index.py" --list` 列出热门关键词让用户选。
71
+
72
+ ## DO NOT grep the entire codebase
73
+
74
+ ## How to Use Results
37
75
 
38
- After getting results:
39
76
  1. Pick the most relevant files (2-3 max)
40
77
  2. Read ONLY those files directly
41
- 3. Answer the user's question
78
+ 3. Answer the user's question — 提炼后回答,别贴原始输出
42
79
 
43
80
  ## Examples
44
81
 
45
- - `/wl-search 考勤` -> searches attendance related files
46
- - `/wl-search insurance --platform web` -> insurance files in fywl-ui only
47
- - `/wl-search --prd 保险` -> searches collected PRDs
48
- - `/wl-search --style table --platform web` -> table-page examples in fywl-ui
49
- - `/wl-search --field nickName` -> where a field is used (label + files)
50
- - `/wl-search --api salary` -> searches salary API endpoints
51
- - `/wl-search --modules` -> shows project overview
52
- - `/wl-search --list` -> shows top 50 keywords
82
+ - `/wl-search 考勤` -> `kg.py search 考勤`
83
+ - `/wl-search --api salary` -> `kg.py api salary`
84
+ - `/wl-search /asset 影响谁` -> `kg.py impact /asset`
85
+ - `/wl-search 哪些功能没测试` -> `kg.py coverage`
86
+ - `/wl-search 资产管理功能画像` -> `kg.py feature 资产管理`
87
+ - `/wl-search 资产盘点流程` -> `kg.py workflow assets`
88
+ - `/wl-search --modules` -> `search_index.py --modules`