@hupan56/wlkj 3.1.8 → 3.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/qoder/scripts/capability/adapters/mcp.py +6 -2
- package/templates/qoder/scripts/capability/memory_chain.py +3 -1
- package/templates/qoder/scripts/domain/kg/kg_capabilities.py +3 -1
- package/templates/qoder/scripts/domain/kg/search/context_pack.py +3 -3
- package/templates/qoder/scripts/domain/kg/search/prefetch.py +1 -1
- package/templates/qoder/scripts/domain/kg/search/search_index.py +1 -1
- package/templates/qoder/scripts/protocol/mcp/kg_mcp_server.py +31 -0
- package/templates/root/AGENTS.md +275 -275
package/package.json
CHANGED
|
@@ -270,9 +270,13 @@ class McpMemoryProvider:
|
|
|
270
270
|
import hashlib
|
|
271
271
|
import json
|
|
272
272
|
import time as _time
|
|
273
|
-
|
|
273
|
+
# ⚠ 不能 import init_schema! duckdb_conn 故意不导出它 (领域 DDL 留在各域)。
|
|
274
|
+
# 旧版 from ...duckdb_conn import init_schema → ImportError → 被下面 except 吞掉
|
|
275
|
+
# → INSERT 永不执行 → remember() 静默丢全部写入。
|
|
276
|
+
# learning_events 表已由 self.available 的 CREATE TABLE IF NOT EXISTS 保证存在,
|
|
277
|
+
# 这里直接 INSERT 即可。
|
|
278
|
+
from foundation.protocol.duckdb_conn import get_db
|
|
274
279
|
con = get_db()
|
|
275
|
-
init_schema(con)
|
|
276
280
|
eid = hashlib.md5(("%s:%s:%s" % (key, content, _time.time())).encode()).hexdigest()[:16]
|
|
277
281
|
ts = _time.strftime("%Y-%m-%dT%H:%M:%S")
|
|
278
282
|
data = json.dumps({"content": content}, ensure_ascii=False)
|
|
@@ -33,7 +33,9 @@ def build_memory_chain(host: str) -> ProviderChain:
|
|
|
33
33
|
from .adapters.cli import FileMemoryCap
|
|
34
34
|
|
|
35
35
|
providers: list = [McpMemoryProvider()]
|
|
36
|
-
|
|
36
|
+
# ⚠ host 名是 "qoder-work" (带连字符, 见 registry.py:40 detect_host 返回值)。
|
|
37
|
+
# 旧版写成 "qoderwork" (无连字符) → 永不匹配 → QwMemoryCap 在所有 QoderWork 机器上都不激活。
|
|
38
|
+
if host == "qoder-work":
|
|
37
39
|
from .adapters.qw import QwMemoryCap
|
|
38
40
|
providers.append(QwMemoryCap())
|
|
39
41
|
providers.append(FileMemoryCap())
|
|
@@ -158,7 +158,9 @@ def wiki_query(kw):
|
|
|
158
158
|
return ("wiki-index.json 不存在。请手动构建(一次性):\n"
|
|
159
159
|
" python .qoder/scripts/domain/kg/search/search_index.py wiki")
|
|
160
160
|
try:
|
|
161
|
-
from repowiki import
|
|
161
|
+
# v3.x: repowiki 在 domain/kg/server/ 子包下, 不能裸 from repowiki import
|
|
162
|
+
# (sys.path 没含 server/, 永远 ModuleNotFoundError → search_wiki 永远报"模块缺失")
|
|
163
|
+
from domain.kg.server.repowiki import search_wiki
|
|
162
164
|
from foundation.integrations.terms import get_cn_map_with_auto
|
|
163
165
|
except ImportError as e:
|
|
164
166
|
return "Wiki 搜索模块缺失: %s" % str(e)
|
|
@@ -10,7 +10,7 @@ for _ in range(10):
|
|
|
10
10
|
break
|
|
11
11
|
if _cp not in _s.path: _s.path.insert(0, _cp)
|
|
12
12
|
from bootstrap import setup; setup()
|
|
13
|
-
from foundation.core.paths import get_repo_root
|
|
13
|
+
from foundation.core.paths import get_repo_root
|
|
14
14
|
|
|
15
15
|
"""
|
|
16
16
|
QODER Context Pack - 一次调用返回写 PRD/原型所需的全部上下文
|
|
@@ -48,7 +48,7 @@ except (AttributeError, TypeError, OSError, IOError):
|
|
|
48
48
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
49
49
|
from foundation.integrations.terms import CN_MAP, BUSINESS_PATH_MAP, CN_TO_EN, get_platform_map, expand_chinese_query
|
|
50
50
|
|
|
51
|
-
BASE = get_repo_root()
|
|
51
|
+
BASE = get_repo_root()
|
|
52
52
|
INDEX_DIR = os.path.join(BASE, 'data', 'index')
|
|
53
53
|
PLATFORM_MAP = get_platform_map()
|
|
54
54
|
MIN_FUZZY_LEN = 4
|
|
@@ -309,7 +309,7 @@ def _compute_and_print(query, platform, page_type):
|
|
|
309
309
|
code_dir = os.path.join(BASE, 'data', 'code')
|
|
310
310
|
wiki_results = []
|
|
311
311
|
try:
|
|
312
|
-
from repowiki import search_wiki, build_wiki_index
|
|
312
|
+
from domain.kg.server.repowiki import search_wiki, build_wiki_index
|
|
313
313
|
from foundation.integrations.terms import get_cn_map_with_auto
|
|
314
314
|
wiki_idx_path = os.path.join(BUILD_CACHE_DIR, 'wiki-index.json')
|
|
315
315
|
if not os.path.isfile(wiki_idx_path):
|
|
@@ -296,7 +296,7 @@ def _print_merged(query, platform, primary_cn, en_words, collected):
|
|
|
296
296
|
code_dir = os.path.join(BASE, 'data', 'code')
|
|
297
297
|
wiki_results = []
|
|
298
298
|
try:
|
|
299
|
-
from repowiki import search_wiki, build_wiki_index
|
|
299
|
+
from domain.kg.server.repowiki import search_wiki, build_wiki_index
|
|
300
300
|
wiki_idx_path = os.path.join(BUILD_CACHE_DIR, 'wiki-index.json')
|
|
301
301
|
if not os.path.isfile(wiki_idx_path):
|
|
302
302
|
build_wiki_index(code_dir, wiki_idx_path)
|
|
@@ -768,7 +768,7 @@ def show_vben():
|
|
|
768
768
|
def search_wiki_cli(query):
|
|
769
769
|
"""搜 Repo Wiki (Qoder IDE 生成的语义级模块文档)。"""
|
|
770
770
|
try:
|
|
771
|
-
from repowiki import search_wiki, build_wiki_index
|
|
771
|
+
from domain.kg.server.repowiki import search_wiki, build_wiki_index
|
|
772
772
|
from foundation.integrations.terms import get_cn_map_with_auto
|
|
773
773
|
except ImportError:
|
|
774
774
|
print('Wiki 搜索不可用 (common.repowiki 模块缺失)')
|
|
@@ -86,6 +86,23 @@ def _ensure_imports():
|
|
|
86
86
|
from foundation.protocol.mcp_base import BaseMCPServer, tool
|
|
87
87
|
|
|
88
88
|
|
|
89
|
+
def _require_kgdb():
|
|
90
|
+
"""检查 kg.duckdb 是否存在。存在返回 None; 不存在返回友好提示字符串。
|
|
91
|
+
|
|
92
|
+
防止 get_db() 创建空库后查询报 CatalogException (49 台没预建图谱的机器)。
|
|
93
|
+
"""
|
|
94
|
+
try:
|
|
95
|
+
from foundation.core.paths import DATA_INDEX_DIR
|
|
96
|
+
db_path = DATA_INDEX_DIR / 'kg.duckdb'
|
|
97
|
+
if not db_path.is_file():
|
|
98
|
+
return ("知识图谱未构建 (kg.duckdb 不存在)。请管理员跑:\n"
|
|
99
|
+
" python .qoder/scripts/orchestration/wlkj.py kg-build\n"
|
|
100
|
+
"或非管理员: npx @hupan56/wlkj update (会 git pull 拉团队已构建的 kg.duckdb)")
|
|
101
|
+
except Exception:
|
|
102
|
+
pass
|
|
103
|
+
return None
|
|
104
|
+
|
|
105
|
+
|
|
89
106
|
class KnowledgeGraphMCPServer(BaseMCPServer):
|
|
90
107
|
"""知识图谱 MCP Server。
|
|
91
108
|
|
|
@@ -185,6 +202,11 @@ class KnowledgeGraphMCPServer(BaseMCPServer):
|
|
|
185
202
|
q = (args.get("module") or '').strip()
|
|
186
203
|
if not q:
|
|
187
204
|
return "请提供模块名。可选: assets/cost/hr/maintenance/operation/qualityAndSafety/veh/settings/dashboard/flow/systems/monitor/quasafe"
|
|
205
|
+
# ⚠ 先检查 kg.duckdb 存在! get_db() 会创建空库 → 查询报 CatalogException
|
|
206
|
+
# (49 台没预建图谱的机器会看到原始异常, 而非友好提示)。
|
|
207
|
+
_hint = _require_kgdb()
|
|
208
|
+
if _hint:
|
|
209
|
+
return _hint
|
|
188
210
|
con = get_db()
|
|
189
211
|
try:
|
|
190
212
|
return workflow_query(con, q)
|
|
@@ -209,6 +231,9 @@ class KnowledgeGraphMCPServer(BaseMCPServer):
|
|
|
209
231
|
except (TypeError, ValueError):
|
|
210
232
|
depth = 3
|
|
211
233
|
depth = max(1, min(5, depth))
|
|
234
|
+
_hint = _require_kgdb()
|
|
235
|
+
if _hint:
|
|
236
|
+
return _hint
|
|
212
237
|
con = get_db()
|
|
213
238
|
try:
|
|
214
239
|
return hop_query(con, sym, depth, multi_hop_fn=multi_hop)
|
|
@@ -236,6 +261,9 @@ class KnowledgeGraphMCPServer(BaseMCPServer):
|
|
|
236
261
|
def _t_search_field(self, args):
|
|
237
262
|
from domain.kg.storage.kg_duckdb import get_db
|
|
238
263
|
field = (args.get("field") or '').strip()
|
|
264
|
+
_hint = _require_kgdb()
|
|
265
|
+
if _hint:
|
|
266
|
+
return _hint
|
|
239
267
|
con = get_db()
|
|
240
268
|
try:
|
|
241
269
|
rows = con.execute(
|
|
@@ -260,6 +288,9 @@ class KnowledgeGraphMCPServer(BaseMCPServer):
|
|
|
260
288
|
def _t_list_modules(self, args):
|
|
261
289
|
from domain.kg.storage.kg_duckdb import get_db
|
|
262
290
|
platform = args.get("platform", "")
|
|
291
|
+
_hint = _require_kgdb()
|
|
292
|
+
if _hint:
|
|
293
|
+
return _hint
|
|
263
294
|
con = get_db()
|
|
264
295
|
try:
|
|
265
296
|
if platform == 'web':
|
package/templates/root/AGENTS.md
CHANGED
|
@@ -1,275 +1,275 @@
|
|
|
1
|
-
# QODER Pipeline
|
|
2
|
-
|
|
3
|
-
## 🏗️ 架构: 引擎与数据分离 (Trellis 化)
|
|
4
|
-
|
|
5
|
-
`.qoder/` 一分为二 (v2.8.0+):
|
|
6
|
-
|
|
7
|
-
| 类别 | 内容 | 来源 | 进团队 git? |
|
|
8
|
-
|------|------|------|------------|
|
|
9
|
-
| **引擎代码** | `.qoder/scripts/` `skills/` `commands/` `agents/` `contracts/` `hooks/` `templates/` `rules/` | `npx @hupan56/wlkj init/update` 生成 | ❌ gitignore |
|
|
10
|
-
| **团队数据** | `.qoder/config.yaml` `config.toml` `settings.json` `learning/` + `data/` (kg.duckdb/索引) + `workspace/` (PRD/任务) | git 跟踪, 团队共享 | ✅ |
|
|
11
|
-
|
|
12
|
-
- 引擎代码**只由 npm 包生成**, 不再进团队 git → 彻底消除"引擎更新污染团队 git"和"新机 init 产生 unrelated histories"。
|
|
13
|
-
- Qoder 全系列仍读 `.qoder/` (路径不变), 只是引擎来源从 git 变成 npm 生成。
|
|
14
|
-
- 老团队升级 (管理员跑一次): `npx @hupan56/wlkj migrate`, 然后团队成员各自 `npx @hupan56/wlkj update`。
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## ⚠️ CRITICAL RULE #1: ALWAYS ASK PLATFORM FIRST
|
|
19
|
-
|
|
20
|
-
**When user asks for PRD or prototype, you MUST ask this question FIRST:**
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
这个需求是针对哪个平台?
|
|
24
|
-
|
|
25
|
-
1. **Web 管理端** (fywl-ui) - Ant Design Vue + VxeGrid 风格
|
|
26
|
-
2. **APP 移动端** (Carmg-H5) - Vant 风格
|
|
27
|
-
3. **两端都要**
|
|
28
|
-
|
|
29
|
-
请选择 (1/2/3):
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
**DO NOT skip this question. DO NOT auto-detect. ALWAYS ASK.**
|
|
33
|
-
**Wait for user answer before doing ANYTHING else.**
|
|
34
|
-
**DO NOT search/read/analyze in the same turn as asking — the reply MUST end after the question.**
|
|
35
|
-
Asking platform + simultaneously searching code in the same response is a VIOLATION.
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## CRITICAL RULE #2: Use /wl-search to find code
|
|
40
|
-
|
|
41
|
-
When user asks about code, business, API, feature:
|
|
42
|
-
1. **ALWAYS** use `/wl-search <keyword>` command first
|
|
43
|
-
2. Then read only the specific files returned
|
|
44
|
-
3. **NEVER** grep the entire codebase directly
|
|
45
|
-
|
|
46
|
-
Examples:
|
|
47
|
-
- "考勤代码在哪" -> /wl-search attendance
|
|
48
|
-
- "保险定时任务" -> /wl-search insurance
|
|
49
|
-
- "薪资API" -> /wl-search --api salary
|
|
50
|
-
|
|
51
|
-
## CRITICAL RULE #2.5: 触发方式(非侵入式 — v3.0)
|
|
52
|
-
|
|
53
|
-
工作流**只在显式调用时启动**,不主动干预普通对话。
|
|
54
|
-
|
|
55
|
-
**两种触发方式(且仅此两种):**
|
|
56
|
-
1. **斜杠命令**:`/wl-prd` `/wl-search` `/wl-req` 等 → 启动工作流
|
|
57
|
-
2. **npx**:`npx @hupan56/wlkj init/update` → 安装/同步
|
|
58
|
-
|
|
59
|
-
**自然语言不触发工作流。** 用户说"写个需求""查下代码"等,AI 正常回答,不自动拉入工作流。
|
|
60
|
-
(工作流启动后的过程内交互 — 如选平台、确认需求 — 仍可用自然语言。)
|
|
61
|
-
|
|
62
|
-
### 禅道自然查询(非命令,直接回答)
|
|
63
|
-
|
|
64
|
-
用户随口问禅道("我的任务""看下#301""Bug 状态""我的需求")—— **直接用禅道 MCP 工具自然回答**,
|
|
65
|
-
不拉入 `/wl-task` 工作流:
|
|
66
|
-
- QoderWork: `qw_mcp_call("my_workbench", {})` 一行看全(任务+需求+Bug)
|
|
67
|
-
- CLI/其他: `cap.mcp.call("my_workbench")`
|
|
68
|
-
|
|
69
|
-
只有**显式工序**(`/wl-task` 建需求/记工时/改状态)才走工作流。
|
|
70
|
-
> 工具用真实工具名,别拿需求冒充任务回答(问任务查 task 域,查不到如实说"没有")。
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
注意区分:"同步/保存产出" = team_sync(push);"提交/commit 代码" = wl-commit。
|
|
74
|
-
|
|
75
|
-
## CRITICAL RULE #3: User NEVER touches git
|
|
76
|
-
|
|
77
|
-
PMs on this team do not know git. ALL git operations are invisible:
|
|
78
|
-
- After any publish/save action (/wl-prd publish, /wl-task create/finish,
|
|
79
|
-
/wl-report save), run: `python .qoder/scripts/task/team_sync.py push`
|
|
80
|
-
- To get teammates' latest work: `python .qoder/scripts/task/team_sync.py pull`
|
|
81
|
-
- If team_sync prints SYNC_CONFLICT, YOU (the AI) resolve the conflict
|
|
82
|
-
yourself (it tells you the commands). NEVER ask the user to run git.
|
|
83
|
-
- When the user says 同步/保存/提交 in natural language -> team_sync, not raw git.
|
|
84
|
-
|
|
85
|
-
## Platform Filtering
|
|
86
|
-
|
|
87
|
-
After user selects platform, use it for search:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
# Search by platform
|
|
91
|
-
/wl-search 保险 --platform web # Only fywl-ui (PC)
|
|
92
|
-
/wl-search 保险 --platform app # Only Carmg-H5 (Mobile)
|
|
93
|
-
/wl-search 保险 # Both platforms
|
|
94
|
-
|
|
95
|
-
# Platform shortcuts
|
|
96
|
-
web/pc/管理端 -> fywl-ui
|
|
97
|
-
app/mobile/h5/移动端 -> Carmg-H5
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Commands: 7 Core (小而美) + Optional
|
|
101
|
-
|
|
102
|
-
> 认知面只暴露 7 个核心命令,每个是一道工序站,每个带模式参数。
|
|
103
|
-
> **一个命令当多个用**——记不住参数也没关系,自然语言一样路由。
|
|
104
|
-
> 模块契约(输入/输出/校验)见 `.qoder/contracts/`。
|
|
105
|
-
|
|
106
|
-
### 7 Core Commands(记住这 7 个就够)
|
|
107
|
-
|
|
108
|
-
| Command | 工序站 | 模式参数(第一个词路由) | Auto | 背后 skill |
|
|
109
|
-
|---------|--------|------------------------|------|-----------|
|
|
110
|
-
| `/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 |
|
|
114
|
-
| `/wl-code` | 编码 | (无,按 spec 实现) | NO | spec-coder |
|
|
115
|
-
| `/wl-test` | 测试 | `quick`/`browser`/`unit` 或默认(quick) | NO | wl-test / test-generator |
|
|
116
|
-
| `/wl-commit` | 提交 | (无) | NO | wl-commit |
|
|
117
|
-
|
|
118
|
-
### Optional Commands(长大了再开,非执行链路必经)
|
|
119
|
-
|
|
120
|
-
> 物理上归在 `.qoder/commands/optional/` 子目录(Qoder IDE 会按子目录归类显示),
|
|
121
|
-
> QoderWork 安装脚本已支持递归扫描,4 个照样能装到用户级。
|
|
122
|
-
|
|
123
|
-
| Command | 用途 | 何时用 |
|
|
124
|
-
|---------|------|--------|
|
|
125
|
-
| `/wl-search` | 代码索引搜索 | 全员工具,按需,非工序站(物理在 `commands/` 顶层) |
|
|
126
|
-
| `/wl-req` | 需求 CRUD + 发布 | 需求生命周期管理(创建/编辑/发布/归档) |
|
|
127
|
-
| `/wl-spec` | PRD→技术规格 | 需求复杂时(小团队可直接 `/wl-code`) |
|
|
128
|
-
| `/wl-status` | 项目健康度/路线图 | 需要 PMO/汇报时 |
|
|
129
|
-
| `/wl-report` | 日报周报 | 需要向上汇报时 |
|
|
130
|
-
| `/wl-insight` | 需求澄清对焦(默认)/调研/规划 | 需求模糊听不懂、要做调研或规划时(位于 /wl-prd 之前)。最高频:产品听不懂用户时快速对焦(必要时出原型图帮助理解),对齐后再问要不要调研 |
|
|
131
|
-
|
|
132
|
-
> **新人只需记 7 个核心命令**,能把活从需求干到提交。可选 6 个按场景启用。
|
|
133
|
-
|
|
134
|
-
## Knowledge Index
|
|
135
|
-
|
|
136
|
-
3 projects: Carmg-H5(1378 files), fywl-ics(8973 files, 3903 APIs), fywl-ui(3270 files)
|
|
137
|
-
Search: /wl-search <keyword> returns compact results (~200 bytes)
|
|
138
|
-
Weekly sync: python .qoder/scripts/task/git_sync.py
|
|
139
|
-
|
|
140
|
-
### MCP Servers (QoderWork / Qoder IDE)
|
|
141
|
-
注册在 `~/.qoderwork/mcp.json`,setup.py 一键配齐:
|
|
142
|
-
- `qoder-knowledge-graph` (stdio) — 本仓库知识图谱,
|
|
143
|
-
- `playwright` (stdio) — 浏览器自动化,快且稳。自动拉起。
|
|
144
|
-
- `qoder-mysql` (stdio) — 只读查真实数据库结构/数据。自动拉起。
|
|
145
|
-
- `lanhu` (STDIO) — 蓝湖设计稿直读,设计师发链接 AI 提取颜色/尺寸/字体/切图。
|
|
146
|
-
**STDIO 模式:开 QoderWork 自动起、关自动停**(QoderWork 原生进程管理,无需手动 start)。
|
|
147
|
-
cookie 按角色隔离(UI 能改稿/PM 只读):wrapper 读当前 `.developer` → 该角色的 `workspace/members/{dev}/.secrets/lanhu.env`(gitignored)。换角色改 `.developer` + 配该角色 cookie → 重启 QoderWork。首次配置跑 `python .qoder/scripts/setup/setup_lanhu.py`。
|
|
148
|
-
|
|
149
|
-
### Style Index (Prototype Reference)
|
|
150
|
-
UI patterns from Vue files: Tables(718), Forms(301), Detail(129), Dashboard(90)
|
|
151
|
-
Top components: Space(583), Modal(270), Select(172), Input(134)
|
|
152
|
-
Form components: Input(2262), Select(1049), ApiSelect(725), DatePicker(265)
|
|
153
|
-
Field map: 2383 entries
|
|
154
|
-
|
|
155
|
-
Style search:
|
|
156
|
-
python .qoder/scripts/kg/search_index.py --style table/form/modal/dashboard
|
|
157
|
-
python .qoder/scripts/kg/search_index.py --field <field_name>
|
|
158
|
-
python .qoder/scripts/kg/search_index.py --components
|
|
159
|
-
python .qoder/scripts/kg/search_index.py --vben # Vben Admin CSS variables
|
|
160
|
-
|
|
161
|
-
Prototype templates:
|
|
162
|
-
.qoder/templates/prototype-web.html # Web管理端 (Vben Admin + Ant Design)
|
|
163
|
-
.qoder/templates/prototype-app.html # APP移动端 (Vant)
|
|
164
|
-
|
|
165
|
-
Prototype output: workspace/members/{dev}/drafts/prototype-{feature}.html
|
|
166
|
-
Style priority: Code > PDF > Default
|
|
167
|
-
|
|
168
|
-
## Workflow: 契约网(非强制流水线)
|
|
169
|
-
|
|
170
|
-
模块间**不强制顺序**,靠标准契约文件对接(详见 `.qoder/contracts/`)。
|
|
171
|
-
完整链路**可以**这么走,但任何模块都能独立开机:
|
|
172
|
-
|
|
173
|
-
```
|
|
174
|
-
/wl-init → /wl-prd (ASK PLATFORM!) → /wl-design → /wl-task → /wl-code → /wl-test → /wl-commit
|
|
175
|
-
身份 需求 设计 任务 编码 测试 提交
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
**独立性**:每个模块认文件不认流程。缺上游 → 手动喂个契约文件,或用自然语言 +
|
|
179
|
-
`context_pack.py` 让 AI 自检索补全(见 `.qoder/contracts/fallback.md`)。
|
|
180
|
-
|
|
181
|
-
## Qoder 全系列兼容(IDE / Quest / CLI / QoderWork)
|
|
182
|
-
|
|
183
|
-
This pipeline works on Windows + macOS, across the **whole Qoder family**.
|
|
184
|
-
Each product loads rules from a different carrier — keep them in sync:
|
|
185
|
-
|
|
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 |
|
|
192
|
-
|
|
193
|
-
> 本流水线聚焦 Qoder 全系列,4 种载体功能等价。知识图谱
|
|
194
|
-
> 覆盖矩阵/功能画像/业务流程/多跳遍历…)通过统一 CLI `python .qoder/scripts/kg/kg.py`
|
|
195
|
-
> 全系列触达;QoderWork 环境也可直接调 MCP 工具。
|
|
196
|
-
|
|
197
|
-
## QoderWork Integration: Optional Enhancement Only (Progressive Enhancement)
|
|
198
|
-
|
|
199
|
-
> 🔒 **核心原则:本流水线绝不强依赖 QoderWork。**
|
|
200
|
-
> 团队里有人用 Qoder IDE、有人用 Qoder CLI、有人用 QoderWork —— 必须保证前两者开箱即用、功能完整。
|
|
201
|
-
> QoderWork 的「连接器 / 专家套件 / 定时任务」只能是**可选增强**:有就锦上添花,没有就静默回退,绝不报错、绝不阻塞。
|
|
202
|
-
|
|
203
|
-
具体落实:
|
|
204
|
-
- **本地数据是唯一事实源**:task.json / git log / drafts / index 永远是真相,连接器只是它的"投影/补充"
|
|
205
|
-
- **增强段统一标记 `🧩 QoderWork 增强(可选)`**:出现在 wl-report / wl-task / wl-status 三个 skill 里,每段都明确写"无连接器则自动回退 + 不影响纯 Qoder 使用"
|
|
206
|
-
- **探测而非假设**:只在运行环境真正提供了「日历/待办/邮件」工具可读时才启用增强;看不到就跳过,补一句 `[xx 未启用:非 QoderWork 或未授权连接器]`
|
|
207
|
-
- 已接入的增强点:
|
|
208
|
-
- `/wl-report` 读日历补"会议/评审"到日报(补 PM/设计岗无提交的空窗)
|
|
209
|
-
- `/wl-task` 把任务同步为待办 + finish 后标记完成(本地仍为准)
|
|
210
|
-
- `/wl-status` 用真实日历节点校准"按时交付""团队同步"两维健康度
|
|
211
|
-
- 未来加任何 QoderWork 增强都必须遵循同样原则:**先保证纯 Qoder 可跑,再叠加可选层。**
|
|
212
|
-
|
|
213
|
-
- THE rule file: `.qoder/rules/wl-pipeline.md` — 修改流程规则时同步更新它和本文件
|
|
214
|
-
- Quest 修改 agents/skills 后需重启 Quest 窗口/新建对话才能生效(Qoder 已知限制)
|
|
215
|
-
- **Repo Wiki** (`.qoder/repowiki/`, Qoder IDE 生成): 存在则作为模块级知识源,
|
|
216
|
-
写 PRD 前优先查相关模块页。索引管"定位", Wiki 管"理解"。
|
|
217
|
-
⚠️ Wiki 由宿主从代码自动生成、会被重生成覆盖, **且 .gitignore 已排除** → 不可手写、不进团队 git
|
|
218
|
-
(团队共享知识走 `data/learning/patterns/` 和 `data/docs/`, 那里可写且进 git)。
|
|
219
|
-
- All scripts are pure Python 3 + git, path-autodetecting (no hardcoded
|
|
220
|
-
drive letters). Invoke as `python` (Windows) or `python3` (macOS).
|
|
221
|
-
- Weekly update: Windows -> scripts/setup_weekly_cron.bat,
|
|
222
|
-
macOS/Linux -> scripts/setup_weekly_cron.sh. Only ONE machine per team
|
|
223
|
-
needs this; everyone else gets the graph via /wl-init's auto pull.
|
|
224
|
-
- Environment problems of any kind -> run:
|
|
225
|
-
`python .qoder/scripts/setup/init_doctor.py` (add --fix to auto-repair).
|
|
226
|
-
|
|
227
|
-
## Fast Path: one call to get all context
|
|
228
|
-
|
|
229
|
-
`python .qoder/scripts/kg/context_pack.py <业务词> --platform <web|app>` returns
|
|
230
|
-
code files + page examples + field specs + PRDs + APIs + style/icon pointers
|
|
231
|
-
in ONE call. Use it FIRST; fall back to search_index.py for drill-down.
|
|
232
|
-
|
|
233
|
-
## Icons: NEVER emoji
|
|
234
|
-
|
|
235
|
-
Prototypes use the projects' real icon systems (data/index/icon-reference.json):
|
|
236
|
-
Web = Ant Design inline SVG, APP = Vant font icons. Emoji in a prototype = FAIL.
|
|
237
|
-
|
|
238
|
-
## Quality Gate (EVA)
|
|
239
|
-
|
|
240
|
-
Before publishing any PRD: `python .qoder/scripts/report/eval_prd.py <prd> [prototype]`
|
|
241
|
-
must PASS (>=80%). Metrics definition: data/docs/constitution/eva-metrics.md
|
|
242
|
-
|
|
243
|
-
## Workflow Usability (可用性)
|
|
244
|
-
|
|
245
|
-
回答"这套工作流对真实团队用不用得起来"——EVA 管 PRD 写得好不好, 本指标管工作流有没有人用。
|
|
246
|
-
```bash
|
|
247
|
-
python .qoder/scripts/orchestration/wlkj.py usability [--days N] # 或 --json
|
|
248
|
-
```
|
|
249
|
-
- 采纳(主): U1流程采纳率/U2一次过审率/U3返工轮数/U4规则违反率/U5绕过率/U6活跃度
|
|
250
|
-
- 流程(辅): F1端到端闭环率/F2转化漏斗/F3单命令效率/F4流程断点
|
|
251
|
-
- 每条指标标【自动/半自动/待埋点】, 算不了的明说不编造
|
|
252
|
-
- `/wl-status health` 的健康分含「工作流采纳」维度(权重10%)
|
|
253
|
-
- 指标定义 + 公式 + 阈值: `data/docs/constitution/workflow-usability-metrics.md`
|
|
254
|
-
- **交互看板**: `wlkj.py usability --html` → QoderWork 嵌入对话流 / CLI 落盘 dashboard.html
|
|
255
|
-
- **红灯自动沉淀**: 评测红/黄项自动 append 到 `data/learning/patterns/usability-patterns.md`(进 git 团队共享)
|
|
256
|
-
|
|
257
|
-
## Deterministic Hooks (确定性钩子 · 吸收宿主能力)
|
|
258
|
-
|
|
259
|
-
把"靠 AI 自觉"的规则升级为"宿主确定性执行"(不漂移、不依赖 LLM 服从性)。配置在 `.qoder/settings.json`:
|
|
260
|
-
|
|
261
|
-
| Hook | 时机 | 作用 | 阻断? |
|
|
262
|
-
|------|------|------|-------|
|
|
263
|
-
| `SessionStart` | 开会话 | 注入项目上下文 + 可用性红灯到 `<qoder-context>` | 否 |
|
|
264
|
-
| `UserPromptSubmit` | 用户提交 | `/wl-prd-*` 未带平台 → **exit 2 阻断**, 强制先问平台(治违规率) | 是 |
|
|
265
|
-
| `PostToolUse` | 工具执行后 | 写完 PRD/建完任务 → **自动埋点**(治漏斗断链) | 否 |
|
|
266
|
-
| `Stop` | Agent 说完成 | 产出 PRD 未跑 eval → **exit 2 阻断**, 强制 eval≥80%(带防递归) | 是 |
|
|
267
|
-
|
|
268
|
-
> 钩子契约: `exit 0` 放行 / `exit 2` 阻断(原因写 stderr) / 失败绝不崩会话。脚本草稿在 `.qoder/hooks/`。
|
|
269
|
-
|
|
270
|
-
## Permission Model
|
|
271
|
-
|
|
272
|
-
| Level | Commands | Auto |
|
|
273
|
-
|-------|---------|------|
|
|
274
|
-
| SAFE | /wl-init, /wl-prd, /wl-design, /wl-task, /wl-search, /wl-req, /wl-spec, /wl-status, /wl-insight, /wl-report | YES |
|
|
275
|
-
| DANGEROUS | /wl-code, /wl-test, /wl-commit | NO |
|
|
1
|
+
# QODER Pipeline
|
|
2
|
+
|
|
3
|
+
## 🏗️ 架构: 引擎与数据分离 (Trellis 化)
|
|
4
|
+
|
|
5
|
+
`.qoder/` 一分为二 (v2.8.0+):
|
|
6
|
+
|
|
7
|
+
| 类别 | 内容 | 来源 | 进团队 git? |
|
|
8
|
+
|------|------|------|------------|
|
|
9
|
+
| **引擎代码** | `.qoder/scripts/` `skills/` `commands/` `agents/` `contracts/` `hooks/` `templates/` `rules/` | `npx @hupan56/wlkj init/update` 生成 | ❌ gitignore |
|
|
10
|
+
| **团队数据** | `.qoder/config.yaml` `config.toml` `settings.json` `learning/` + `data/` (kg.duckdb/索引) + `workspace/` (PRD/任务) | git 跟踪, 团队共享 | ✅ |
|
|
11
|
+
|
|
12
|
+
- 引擎代码**只由 npm 包生成**, 不再进团队 git → 彻底消除"引擎更新污染团队 git"和"新机 init 产生 unrelated histories"。
|
|
13
|
+
- Qoder 全系列仍读 `.qoder/` (路径不变), 只是引擎来源从 git 变成 npm 生成。
|
|
14
|
+
- 老团队升级 (管理员跑一次): `npx @hupan56/wlkj migrate`, 然后团队成员各自 `npx @hupan56/wlkj update`。
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## ⚠️ CRITICAL RULE #1: ALWAYS ASK PLATFORM FIRST
|
|
19
|
+
|
|
20
|
+
**When user asks for PRD or prototype, you MUST ask this question FIRST:**
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
这个需求是针对哪个平台?
|
|
24
|
+
|
|
25
|
+
1. **Web 管理端** (fywl-ui) - Ant Design Vue + VxeGrid 风格
|
|
26
|
+
2. **APP 移动端** (Carmg-H5) - Vant 风格
|
|
27
|
+
3. **两端都要**
|
|
28
|
+
|
|
29
|
+
请选择 (1/2/3):
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**DO NOT skip this question. DO NOT auto-detect. ALWAYS ASK.**
|
|
33
|
+
**Wait for user answer before doing ANYTHING else.**
|
|
34
|
+
**DO NOT search/read/analyze in the same turn as asking — the reply MUST end after the question.**
|
|
35
|
+
Asking platform + simultaneously searching code in the same response is a VIOLATION.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## CRITICAL RULE #2: Use /wl-search to find code
|
|
40
|
+
|
|
41
|
+
When user asks about code, business, API, feature:
|
|
42
|
+
1. **ALWAYS** use `/wl-search <keyword>` command first
|
|
43
|
+
2. Then read only the specific files returned
|
|
44
|
+
3. **NEVER** grep the entire codebase directly
|
|
45
|
+
|
|
46
|
+
Examples:
|
|
47
|
+
- "考勤代码在哪" -> /wl-search attendance
|
|
48
|
+
- "保险定时任务" -> /wl-search insurance
|
|
49
|
+
- "薪资API" -> /wl-search --api salary
|
|
50
|
+
|
|
51
|
+
## CRITICAL RULE #2.5: 触发方式(非侵入式 — v3.0)
|
|
52
|
+
|
|
53
|
+
工作流**只在显式调用时启动**,不主动干预普通对话。
|
|
54
|
+
|
|
55
|
+
**两种触发方式(且仅此两种):**
|
|
56
|
+
1. **斜杠命令**:`/wl-prd` `/wl-search` `/wl-req` 等 → 启动工作流
|
|
57
|
+
2. **npx**:`npx @hupan56/wlkj init/update` → 安装/同步
|
|
58
|
+
|
|
59
|
+
**自然语言不触发工作流。** 用户说"写个需求""查下代码"等,AI 正常回答,不自动拉入工作流。
|
|
60
|
+
(工作流启动后的过程内交互 — 如选平台、确认需求 — 仍可用自然语言。)
|
|
61
|
+
|
|
62
|
+
### 禅道自然查询(非命令,直接回答)
|
|
63
|
+
|
|
64
|
+
用户随口问禅道("我的任务""看下#301""Bug 状态""我的需求")—— **直接用禅道 MCP 工具自然回答**,
|
|
65
|
+
不拉入 `/wl-task` 工作流:
|
|
66
|
+
- QoderWork: `qw_mcp_call("my_workbench", {})` 一行看全(任务+需求+Bug)
|
|
67
|
+
- CLI/其他: `cap.mcp.call("my_workbench")`
|
|
68
|
+
|
|
69
|
+
只有**显式工序**(`/wl-task` 建需求/记工时/改状态)才走工作流。
|
|
70
|
+
> 工具用真实工具名,别拿需求冒充任务回答(问任务查 task 域,查不到如实说"没有")。
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
注意区分:"同步/保存产出" = team_sync(push);"提交/commit 代码" = wl-commit。
|
|
74
|
+
|
|
75
|
+
## CRITICAL RULE #3: User NEVER touches git
|
|
76
|
+
|
|
77
|
+
PMs on this team do not know git. ALL git operations are invisible:
|
|
78
|
+
- After any publish/save action (/wl-prd publish, /wl-task create/finish,
|
|
79
|
+
/wl-report save), run: `python .qoder/scripts/task/team_sync.py push`
|
|
80
|
+
- To get teammates' latest work: `python .qoder/scripts/task/team_sync.py pull`
|
|
81
|
+
- If team_sync prints SYNC_CONFLICT, YOU (the AI) resolve the conflict
|
|
82
|
+
yourself (it tells you the commands). NEVER ask the user to run git.
|
|
83
|
+
- When the user says 同步/保存/提交 in natural language -> team_sync, not raw git.
|
|
84
|
+
|
|
85
|
+
## Platform Filtering
|
|
86
|
+
|
|
87
|
+
After user selects platform, use it for search:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Search by platform
|
|
91
|
+
/wl-search 保险 --platform web # Only fywl-ui (PC)
|
|
92
|
+
/wl-search 保险 --platform app # Only Carmg-H5 (Mobile)
|
|
93
|
+
/wl-search 保险 # Both platforms
|
|
94
|
+
|
|
95
|
+
# Platform shortcuts
|
|
96
|
+
web/pc/管理端 -> fywl-ui
|
|
97
|
+
app/mobile/h5/移动端 -> Carmg-H5
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Commands: 7 Core (小而美) + Optional
|
|
101
|
+
|
|
102
|
+
> 认知面只暴露 7 个核心命令,每个是一道工序站,每个带模式参数。
|
|
103
|
+
> **一个命令当多个用**——记不住参数也没关系,自然语言一样路由。
|
|
104
|
+
> 模块契约(输入/输出/校验)见 `.qoder/contracts/`。
|
|
105
|
+
|
|
106
|
+
### 7 Core Commands(记住这 7 个就够)
|
|
107
|
+
|
|
108
|
+
| Command | 工序站 | 模式参数(第一个词路由) | Auto | 背后 skill |
|
|
109
|
+
|---------|--------|------------------------|------|-----------|
|
|
110
|
+
| `/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 |
|
|
114
|
+
| `/wl-code` | 编码 | (无,按 spec 实现) | NO | spec-coder |
|
|
115
|
+
| `/wl-test` | 测试 | `quick`/`browser`/`unit` 或默认(quick) | NO | wl-test / test-generator |
|
|
116
|
+
| `/wl-commit` | 提交 | (无) | NO | wl-commit |
|
|
117
|
+
|
|
118
|
+
### Optional Commands(长大了再开,非执行链路必经)
|
|
119
|
+
|
|
120
|
+
> 物理上归在 `.qoder/commands/optional/` 子目录(Qoder IDE 会按子目录归类显示),
|
|
121
|
+
> QoderWork 安装脚本已支持递归扫描,4 个照样能装到用户级。
|
|
122
|
+
|
|
123
|
+
| Command | 用途 | 何时用 |
|
|
124
|
+
|---------|------|--------|
|
|
125
|
+
| `/wl-search` | 代码索引搜索 | 全员工具,按需,非工序站(物理在 `commands/` 顶层) |
|
|
126
|
+
| `/wl-req` | 需求 CRUD + 发布 | 需求生命周期管理(创建/编辑/发布/归档) |
|
|
127
|
+
| `/wl-spec` | PRD→技术规格 | 需求复杂时(小团队可直接 `/wl-code`) |
|
|
128
|
+
| `/wl-status` | 项目健康度/路线图 | 需要 PMO/汇报时 |
|
|
129
|
+
| `/wl-report` | 日报周报 | 需要向上汇报时 |
|
|
130
|
+
| `/wl-insight` | 需求澄清对焦(默认)/调研/规划 | 需求模糊听不懂、要做调研或规划时(位于 /wl-prd 之前)。最高频:产品听不懂用户时快速对焦(必要时出原型图帮助理解),对齐后再问要不要调研 |
|
|
131
|
+
|
|
132
|
+
> **新人只需记 7 个核心命令**,能把活从需求干到提交。可选 6 个按场景启用。
|
|
133
|
+
|
|
134
|
+
## Knowledge Index
|
|
135
|
+
|
|
136
|
+
3 projects: Carmg-H5(1378 files), fywl-ics(8973 files, 3903 APIs), fywl-ui(3270 files)
|
|
137
|
+
Search: /wl-search <keyword> returns compact results (~200 bytes)
|
|
138
|
+
Weekly sync: python .qoder/scripts/task/git_sync.py
|
|
139
|
+
|
|
140
|
+
### MCP Servers (QoderWork / Qoder IDE)
|
|
141
|
+
注册在 `~/.qoderwork/mcp.json`,setup.py 一键配齐:
|
|
142
|
+
- `qoder-knowledge-graph` (stdio) — 本仓库知识图谱,17 个工具 (search_code/api, get_impact, context_360, fill_prototype, get_design_system...)。自动拉起。
|
|
143
|
+
- `playwright` (stdio) — 浏览器自动化,快且稳。自动拉起。
|
|
144
|
+
- `qoder-mysql` (stdio) — 只读查真实数据库结构/数据。自动拉起。
|
|
145
|
+
- `lanhu` (STDIO) — 蓝湖设计稿直读,设计师发链接 AI 提取颜色/尺寸/字体/切图。
|
|
146
|
+
**STDIO 模式:开 QoderWork 自动起、关自动停**(QoderWork 原生进程管理,无需手动 start)。
|
|
147
|
+
cookie 按角色隔离(UI 能改稿/PM 只读):wrapper 读当前 `.developer` → 该角色的 `workspace/members/{dev}/.secrets/lanhu.env`(gitignored)。换角色改 `.developer` + 配该角色 cookie → 重启 QoderWork。首次配置跑 `python .qoder/scripts/setup/setup_lanhu.py`。
|
|
148
|
+
|
|
149
|
+
### Style Index (Prototype Reference)
|
|
150
|
+
UI patterns from Vue files: Tables(718), Forms(301), Detail(129), Dashboard(90)
|
|
151
|
+
Top components: Space(583), Modal(270), Select(172), Input(134)
|
|
152
|
+
Form components: Input(2262), Select(1049), ApiSelect(725), DatePicker(265)
|
|
153
|
+
Field map: 2383 entries
|
|
154
|
+
|
|
155
|
+
Style search:
|
|
156
|
+
python .qoder/scripts/kg/search_index.py --style table/form/modal/dashboard
|
|
157
|
+
python .qoder/scripts/kg/search_index.py --field <field_name>
|
|
158
|
+
python .qoder/scripts/kg/search_index.py --components
|
|
159
|
+
python .qoder/scripts/kg/search_index.py --vben # Vben Admin CSS variables
|
|
160
|
+
|
|
161
|
+
Prototype templates:
|
|
162
|
+
.qoder/templates/prototype-web.html # Web管理端 (Vben Admin + Ant Design)
|
|
163
|
+
.qoder/templates/prototype-app.html # APP移动端 (Vant)
|
|
164
|
+
|
|
165
|
+
Prototype output: workspace/members/{dev}/drafts/prototype-{feature}.html
|
|
166
|
+
Style priority: Code > PDF > Default
|
|
167
|
+
|
|
168
|
+
## Workflow: 契约网(非强制流水线)
|
|
169
|
+
|
|
170
|
+
模块间**不强制顺序**,靠标准契约文件对接(详见 `.qoder/contracts/`)。
|
|
171
|
+
完整链路**可以**这么走,但任何模块都能独立开机:
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
/wl-init → /wl-prd (ASK PLATFORM!) → /wl-design → /wl-task → /wl-code → /wl-test → /wl-commit
|
|
175
|
+
身份 需求 设计 任务 编码 测试 提交
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**独立性**:每个模块认文件不认流程。缺上游 → 手动喂个契约文件,或用自然语言 +
|
|
179
|
+
`context_pack.py` 让 AI 自检索补全(见 `.qoder/contracts/fallback.md`)。
|
|
180
|
+
|
|
181
|
+
## Qoder 全系列兼容(IDE / Quest / CLI / QoderWork)
|
|
182
|
+
|
|
183
|
+
This pipeline works on Windows + macOS, across the **whole Qoder family**.
|
|
184
|
+
Each product loads rules from a different carrier — keep them in sync:
|
|
185
|
+
|
|
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 |
|
|
192
|
+
|
|
193
|
+
> 本流水线聚焦 Qoder 全系列,4 种载体功能等价。知识图谱 17 个能力(影响分析/
|
|
194
|
+
> 覆盖矩阵/功能画像/业务流程/多跳遍历…)通过统一 CLI `python .qoder/scripts/kg/kg.py`
|
|
195
|
+
> 全系列触达;QoderWork 环境也可直接调 MCP 工具。
|
|
196
|
+
|
|
197
|
+
## QoderWork Integration: Optional Enhancement Only (Progressive Enhancement)
|
|
198
|
+
|
|
199
|
+
> 🔒 **核心原则:本流水线绝不强依赖 QoderWork。**
|
|
200
|
+
> 团队里有人用 Qoder IDE、有人用 Qoder CLI、有人用 QoderWork —— 必须保证前两者开箱即用、功能完整。
|
|
201
|
+
> QoderWork 的「连接器 / 专家套件 / 定时任务」只能是**可选增强**:有就锦上添花,没有就静默回退,绝不报错、绝不阻塞。
|
|
202
|
+
|
|
203
|
+
具体落实:
|
|
204
|
+
- **本地数据是唯一事实源**:task.json / git log / drafts / index 永远是真相,连接器只是它的"投影/补充"
|
|
205
|
+
- **增强段统一标记 `🧩 QoderWork 增强(可选)`**:出现在 wl-report / wl-task / wl-status 三个 skill 里,每段都明确写"无连接器则自动回退 + 不影响纯 Qoder 使用"
|
|
206
|
+
- **探测而非假设**:只在运行环境真正提供了「日历/待办/邮件」工具可读时才启用增强;看不到就跳过,补一句 `[xx 未启用:非 QoderWork 或未授权连接器]`
|
|
207
|
+
- 已接入的增强点:
|
|
208
|
+
- `/wl-report` 读日历补"会议/评审"到日报(补 PM/设计岗无提交的空窗)
|
|
209
|
+
- `/wl-task` 把任务同步为待办 + finish 后标记完成(本地仍为准)
|
|
210
|
+
- `/wl-status` 用真实日历节点校准"按时交付""团队同步"两维健康度
|
|
211
|
+
- 未来加任何 QoderWork 增强都必须遵循同样原则:**先保证纯 Qoder 可跑,再叠加可选层。**
|
|
212
|
+
|
|
213
|
+
- THE rule file: `.qoder/rules/wl-pipeline.md` — 修改流程规则时同步更新它和本文件
|
|
214
|
+
- Quest 修改 agents/skills 后需重启 Quest 窗口/新建对话才能生效(Qoder 已知限制)
|
|
215
|
+
- **Repo Wiki** (`.qoder/repowiki/`, Qoder IDE 生成): 存在则作为模块级知识源,
|
|
216
|
+
写 PRD 前优先查相关模块页。索引管"定位", Wiki 管"理解"。
|
|
217
|
+
⚠️ Wiki 由宿主从代码自动生成、会被重生成覆盖, **且 .gitignore 已排除** → 不可手写、不进团队 git
|
|
218
|
+
(团队共享知识走 `data/learning/patterns/` 和 `data/docs/`, 那里可写且进 git)。
|
|
219
|
+
- All scripts are pure Python 3 + git, path-autodetecting (no hardcoded
|
|
220
|
+
drive letters). Invoke as `python` (Windows) or `python3` (macOS).
|
|
221
|
+
- Weekly update: Windows -> scripts/setup_weekly_cron.bat,
|
|
222
|
+
macOS/Linux -> scripts/setup_weekly_cron.sh. Only ONE machine per team
|
|
223
|
+
needs this; everyone else gets the graph via /wl-init's auto pull.
|
|
224
|
+
- Environment problems of any kind -> run:
|
|
225
|
+
`python .qoder/scripts/setup/init_doctor.py` (add --fix to auto-repair).
|
|
226
|
+
|
|
227
|
+
## Fast Path: one call to get all context
|
|
228
|
+
|
|
229
|
+
`python .qoder/scripts/kg/context_pack.py <业务词> --platform <web|app>` returns
|
|
230
|
+
code files + page examples + field specs + PRDs + APIs + style/icon pointers
|
|
231
|
+
in ONE call. Use it FIRST; fall back to search_index.py for drill-down.
|
|
232
|
+
|
|
233
|
+
## Icons: NEVER emoji
|
|
234
|
+
|
|
235
|
+
Prototypes use the projects' real icon systems (data/index/icon-reference.json):
|
|
236
|
+
Web = Ant Design inline SVG, APP = Vant font icons. Emoji in a prototype = FAIL.
|
|
237
|
+
|
|
238
|
+
## Quality Gate (EVA)
|
|
239
|
+
|
|
240
|
+
Before publishing any PRD: `python .qoder/scripts/report/eval_prd.py <prd> [prototype]`
|
|
241
|
+
must PASS (>=80%). Metrics definition: data/docs/constitution/eva-metrics.md
|
|
242
|
+
|
|
243
|
+
## Workflow Usability (可用性)
|
|
244
|
+
|
|
245
|
+
回答"这套工作流对真实团队用不用得起来"——EVA 管 PRD 写得好不好, 本指标管工作流有没有人用。
|
|
246
|
+
```bash
|
|
247
|
+
python .qoder/scripts/orchestration/wlkj.py usability [--days N] # 或 --json
|
|
248
|
+
```
|
|
249
|
+
- 采纳(主): U1流程采纳率/U2一次过审率/U3返工轮数/U4规则违反率/U5绕过率/U6活跃度
|
|
250
|
+
- 流程(辅): F1端到端闭环率/F2转化漏斗/F3单命令效率/F4流程断点
|
|
251
|
+
- 每条指标标【自动/半自动/待埋点】, 算不了的明说不编造
|
|
252
|
+
- `/wl-status health` 的健康分含「工作流采纳」维度(权重10%)
|
|
253
|
+
- 指标定义 + 公式 + 阈值: `data/docs/constitution/workflow-usability-metrics.md`
|
|
254
|
+
- **交互看板**: `wlkj.py usability --html` → QoderWork 嵌入对话流 / CLI 落盘 dashboard.html
|
|
255
|
+
- **红灯自动沉淀**: 评测红/黄项自动 append 到 `data/learning/patterns/usability-patterns.md`(进 git 团队共享)
|
|
256
|
+
|
|
257
|
+
## Deterministic Hooks (确定性钩子 · 吸收宿主能力)
|
|
258
|
+
|
|
259
|
+
把"靠 AI 自觉"的规则升级为"宿主确定性执行"(不漂移、不依赖 LLM 服从性)。配置在 `.qoder/settings.json`:
|
|
260
|
+
|
|
261
|
+
| Hook | 时机 | 作用 | 阻断? |
|
|
262
|
+
|------|------|------|-------|
|
|
263
|
+
| `SessionStart` | 开会话 | 注入项目上下文 + 可用性红灯到 `<qoder-context>` | 否 |
|
|
264
|
+
| `UserPromptSubmit` | 用户提交 | `/wl-prd-*` 未带平台 → **exit 2 阻断**, 强制先问平台(治违规率) | 是 |
|
|
265
|
+
| `PostToolUse` | 工具执行后 | 写完 PRD/建完任务 → **自动埋点**(治漏斗断链) | 否 |
|
|
266
|
+
| `Stop` | Agent 说完成 | 产出 PRD 未跑 eval → **exit 2 阻断**, 强制 eval≥80%(带防递归) | 是 |
|
|
267
|
+
|
|
268
|
+
> 钩子契约: `exit 0` 放行 / `exit 2` 阻断(原因写 stderr) / 失败绝不崩会话。脚本草稿在 `.qoder/hooks/`。
|
|
269
|
+
|
|
270
|
+
## Permission Model
|
|
271
|
+
|
|
272
|
+
| Level | Commands | Auto |
|
|
273
|
+
|-------|---------|------|
|
|
274
|
+
| SAFE | /wl-init, /wl-prd, /wl-design, /wl-task, /wl-search, /wl-req, /wl-spec, /wl-status, /wl-insight, /wl-report | YES |
|
|
275
|
+
| DANGEROUS | /wl-code, /wl-test, /wl-commit | NO |
|