@hupan56/wlkj 2.4.6 → 2.4.8
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/commands/wl-prd.md +46 -10
- package/templates/qoder/hooks/inject-workflow-state.py +14 -0
- package/templates/qoder/hooks/session-start.py +17 -0
- package/templates/qoder/scripts/syncgate.py +9 -0
- package/templates/qoder/scripts/team_sync.py +5 -1
- package/templates/qoder/skills/wl-prd/SKILL.md +5 -6
package/package.json
CHANGED
|
@@ -37,21 +37,57 @@ WAIT for the answer. Platform determines everything downstream:
|
|
|
37
37
|
|
|
38
38
|
| 用户怎么说 | 模式 | 做什么 | 出 PRD? | 出原型? |
|
|
39
39
|
|-----------|------|--------|---------|---------|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
| "
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
| `/wl-prd discuss <需求>` 或 "探讨""聊聊""分析一下" | **Discuss** 探讨模式 | 纯讨论:理需求、拆问题、给方案建议,不出文件 | ❌ | ❌ |
|
|
41
|
+
| `/wl-prd <需求>`(默认) | **Reference** 参考模式 | 参考现有代码+历史PRD,出标准PRD+原型 | ✅ | ✅ |
|
|
42
|
+
| `/wl-prd quick <需求>` 或 "快速""加个字段""小改动" | **Quick** 快速模式 | 快速定位+Mini-PRD+微型原型(只改diff),跳过EVA | ✅ | ✅ |
|
|
43
|
+
|
|
44
|
+
> **精简为 3 个模式**(原 Brainstorm/Planning 已合并进 Reference):
|
|
45
|
+
> - 需要**创新/头脑风暴**?Reference 模式里先说"帮我从不同角度分析",AI 会做 SCAMPER
|
|
46
|
+
> - 需要**规划/Gap 分析**?Reference 模式里先说"先分析现状和差距",AI 会做 Gap 分析
|
|
47
|
+
> - 这两种场景都是"先分析再生成 PRD",不需要单独模式
|
|
48
|
+
|
|
49
|
+
### 模式路由规则
|
|
50
|
+
|
|
51
|
+
1. **显式参数优先**:`/wl-prd quick XX` 或 `/wl-prd discuss XX`
|
|
52
|
+
2. **关键词推断**:自然语言带"探讨/快速" → 匹配
|
|
53
|
+
3. **默认**:不带关键词 → Reference
|
|
54
|
+
4. **兜底**:不确定 → 先问用户
|
|
45
55
|
|
|
46
56
|
### 什么时候用哪个模式?
|
|
47
57
|
|
|
48
|
-
- **不知道怎么做** →
|
|
49
|
-
- **照着已有的做类似的** →
|
|
58
|
+
- **不知道怎么做** → 探讨(先聊清楚再决定要不要出PRD)
|
|
59
|
+
- **照着已有的做类似的** → 参考(默认)
|
|
50
60
|
- **想创新/没思路** → 头脑风暴
|
|
51
|
-
- **大方向/季度规划** →
|
|
52
|
-
- **小功能/Bug fix** →
|
|
61
|
+
- **大方向/季度规划** → 规划
|
|
62
|
+
- **小功能/Bug fix** → 快速
|
|
63
|
+
|
|
64
|
+
### Discuss 转 Reference 的标记(审计用)
|
|
65
|
+
|
|
66
|
+
Discuss 结束、用户说"出PRD"时,AI 必须输出:
|
|
67
|
+
```
|
|
68
|
+
[MODE-SWITCH: discuss→reference]
|
|
69
|
+
```
|
|
70
|
+
然后按 Reference 模式流程生成。
|
|
53
71
|
|
|
54
|
-
|
|
72
|
+
### Quick 模式的特殊处理
|
|
73
|
+
|
|
74
|
+
Quick 模式生成的 PRD **头部必须标注 `mode: quick`**:
|
|
75
|
+
```markdown
|
|
76
|
+
<!-- mode: quick -->
|
|
77
|
+
# Mini-PRD: {标题}
|
|
78
|
+
```
|
|
79
|
+
syncgate 的 EVA 门禁检查到 `mode: quick` 时**跳过 A3(字段引用检查)**,
|
|
80
|
+
因为 Mini-PRD 格式精简,A3 的表格字段检查不适用。
|
|
81
|
+
其他检查(平台/REQ-ID/秘密)仍然生效。
|
|
82
|
+
|
|
83
|
+
### Brainstorm 中间文件清理
|
|
84
|
+
|
|
85
|
+
Brainstorm 模式可能生成 `brainstorm-agent-*.md` 中间调研文件。
|
|
86
|
+
生成最终 PRD 后**必须删除这些中间文件**:
|
|
87
|
+
```bash
|
|
88
|
+
rm -f workspace/members/*/drafts/brainstorm-agent-*.md
|
|
89
|
+
```
|
|
90
|
+
team_sync 的 staging allowlist 也会拒绝 `brainstorm-agent-*` 文件名。
|
|
55
91
|
|
|
56
92
|
The agent files define the detailed workflow for each mode. When
|
|
57
93
|
dispatching a sub-agent, ALWAYS include in the dispatch prompt:
|
|
@@ -97,6 +97,20 @@ GUIDE = {
|
|
|
97
97
|
|
|
98
98
|
def main():
|
|
99
99
|
tp, st = get_status()
|
|
100
|
+
# Hook-2: 如果任务/状态没变, 输出空 (减少 token 消耗)
|
|
101
|
+
# 用 .runtime/.last-workflow-state 存上次输出, mtime 变了才重新注入
|
|
102
|
+
state_file = os.path.join(BASE, '.qoder', '.runtime', '.last-wf-state.txt')
|
|
103
|
+
current_sig = '{}|{}'.format(tp or '', st or '')
|
|
104
|
+
try:
|
|
105
|
+
os.makedirs(os.path.dirname(state_file), exist_ok=True)
|
|
106
|
+
if os.path.isfile(state_file):
|
|
107
|
+
last_sig = open(state_file, 'r', encoding='utf-8').read().strip()
|
|
108
|
+
if last_sig == current_sig:
|
|
109
|
+
return # 状态没变, 不重复注入 (省 token)
|
|
110
|
+
open(state_file, 'w', encoding='utf-8').write(current_sig)
|
|
111
|
+
except OSError:
|
|
112
|
+
pass
|
|
113
|
+
|
|
100
114
|
g = GUIDE.get(st, 'Status "{}" - check task.json, expected planning/in_progress/completed.'.format(st))
|
|
101
115
|
parts = []
|
|
102
116
|
parts.append('<qoder-workflow>')
|
|
@@ -76,6 +76,20 @@ def get_team_size():
|
|
|
76
76
|
|
|
77
77
|
def get_index_info():
|
|
78
78
|
lines = []
|
|
79
|
+
# Hook-3: 检查 hook 错误日志, 超过 3 条新错误时告警
|
|
80
|
+
try:
|
|
81
|
+
log_path = os.path.join(BASE, '.qoder', '.runtime', 'hook-errors.log')
|
|
82
|
+
if os.path.isfile(log_path):
|
|
83
|
+
with open(log_path, 'r', encoding='utf-8', errors='replace') as f:
|
|
84
|
+
errors = [l for l in f.readlines() if l.strip()]
|
|
85
|
+
# 只看最近 24h 的错误
|
|
86
|
+
recent = errors[-10:] # 取最后 10 行检查
|
|
87
|
+
if len(recent) >= 3:
|
|
88
|
+
lines.append('[WARN] hook 最近频繁失败 (%d 条错误), 详情见 .qoder/.runtime/hook-errors.log' % len(recent))
|
|
89
|
+
lines.append(' 跑 python .qoder/scripts/init_doctor.py --fix 排查')
|
|
90
|
+
except OSError:
|
|
91
|
+
pass
|
|
92
|
+
|
|
79
93
|
lines.append('## Knowledge Index')
|
|
80
94
|
lines.append('Use search script (DO NOT read large JSON files directly):')
|
|
81
95
|
lines.append(' python .qoder/scripts/search_index.py <keyword> [--platform web|app]')
|
|
@@ -191,6 +205,9 @@ def main():
|
|
|
191
205
|
parts.append(style_info)
|
|
192
206
|
|
|
193
207
|
parts.append('</qoder-context>')
|
|
208
|
+
# Hook-1: 健康标记 — AI 能感知 hook 是否真的跑了
|
|
209
|
+
# QoderWork/Quest 里看不到 [hook-ok] 就知道 hook 没生效, 要自取上下文
|
|
210
|
+
parts.append('<!-- [hook-ok] session-start hook ran successfully -->')
|
|
194
211
|
print(NL.join(parts))
|
|
195
212
|
|
|
196
213
|
|
|
@@ -275,6 +275,15 @@ def check_eval_gate(
|
|
|
275
275
|
full = os.path.join(repo_root, prd) if not os.path.isabs(prd) else prd
|
|
276
276
|
if not os.path.isfile(full):
|
|
277
277
|
continue
|
|
278
|
+
# PRD-3: Quick 模式 PRD 跳过 A3 (字段引用检查)
|
|
279
|
+
# Mini-PRD 格式精简, A3 的表格字段检查不适用
|
|
280
|
+
try:
|
|
281
|
+
with open(full, 'r', encoding='utf-8', errors='replace') as f:
|
|
282
|
+
head = f.read(2048)
|
|
283
|
+
if 'mode: quick' in head.lower():
|
|
284
|
+
continue # Quick 模式, 跳过 EVA
|
|
285
|
+
except OSError:
|
|
286
|
+
pass
|
|
278
287
|
# 找同名原型 (可选)
|
|
279
288
|
dirname = os.path.dirname(full)
|
|
280
289
|
base = os.path.splitext(os.path.basename(full))[0]
|
|
@@ -270,7 +270,11 @@ def _stage_scopes_safely(skip_secret=False):
|
|
|
270
270
|
fpath = line[3:]
|
|
271
271
|
if status[0] == '?' or status[1] == '?': # 未跟踪
|
|
272
272
|
ext = os.path.splitext(fpath)[1].lower()
|
|
273
|
-
|
|
273
|
+
# PRD-4: 拒绝 brainstorm 中间文件
|
|
274
|
+
basename = os.path.basename(fpath)
|
|
275
|
+
if 'brainstorm-agent' in basename:
|
|
276
|
+
skipped.append(fpath + ' (brainstorm 中间文件, 不提交)')
|
|
277
|
+
elif ext in SAFE_EXTENSIONS:
|
|
274
278
|
git('add', '--', fpath)
|
|
275
279
|
staged += 1
|
|
276
280
|
else:
|
|
@@ -38,18 +38,17 @@ trigger: "用户描述需求、要 PRD、要原型、要 mockup,或直接 /wl-
|
|
|
38
38
|
- `.qoder/.current-task` — 当前活动任务
|
|
39
39
|
- `data/index/.index-meta.json` — 知识图谱新鲜度(过期提示先 `/wl-init`,不阻塞)
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## 三种模式(精简版)
|
|
42
42
|
|
|
43
43
|
| 用户怎么说 | 模式 | 出PRD? | 出原型? |
|
|
44
44
|
|-----------|------|---------|---------|
|
|
45
45
|
| 直接说需求(默认) | Reference 参考 | ✅ | ✅ |
|
|
46
46
|
| "探讨""聊聊""分析一下""不知道怎么做" | **Discuss 探讨** | ❌ | ❌ |
|
|
47
|
-
| "
|
|
48
|
-
| "规划""plan" | Planning 规划 | ✅ | ✅ |
|
|
49
|
-
| "快速""quick""加个字段" | Quick 快速 | ✅ | ✅ |
|
|
47
|
+
| "快速""quick""加个字段""小改动" | Quick 快速 | ✅ | ✅ |
|
|
50
48
|
|
|
51
|
-
>
|
|
52
|
-
>
|
|
49
|
+
> **只有 3 个模式**。需要头脑风暴?Reference 里说"从不同角度分析"。
|
|
50
|
+
> 需要规划?Reference 里说"先分析现状和差距"。都是"先分析再生成",不需要单独模式。
|
|
51
|
+
> **探讨模式**:纯讨论,不出文件。聊完用户说"出PRD"→ 自动转参考模式。
|
|
53
52
|
|
|
54
53
|
## 完整流程(Reference/Brainstorm/Planning/Quick 模式)
|
|
55
54
|
|