@hupan56/wlkj 3.1.2 → 3.1.4

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 (25) hide show
  1. package/package.json +1 -1
  2. package/templates/qoder/commands/optional/wl-insight.md +1 -1
  3. package/templates/qoder/commands/optional/wl-report.md +2 -2
  4. package/templates/qoder/commands/optional/wl-status.md +1 -1
  5. package/templates/qoder/commands/wl-code.md +1 -1
  6. package/templates/qoder/commands/wl-design.md +2 -0
  7. package/templates/qoder/commands/wl-init.md +1 -1
  8. package/templates/qoder/commands/wl-prd.md +4 -0
  9. package/templates/qoder/commands/wl-req.md +3 -0
  10. package/templates/qoder/commands/wl-search.md +2 -0
  11. package/templates/qoder/commands/wl-task.md +1 -1
  12. package/templates/qoder/commands/wl-test.md +1 -1
  13. package/templates/qoder/scripts/deployment/setup/init_doctor.py +15 -7
  14. package/templates/qoder/scripts/deployment/setup/repo_root.py +17 -4
  15. package/templates/qoder/scripts/deployment/setup/setup.py +4 -1
  16. package/templates/qoder/scripts/domain/task/__pycache__/syncgate.cpython-39.pyc +0 -0
  17. package/templates/qoder/scripts/foundation/__pycache__/__init__.cpython-39.pyc +0 -0
  18. package/templates/qoder/scripts/foundation/__pycache__/bootstrap.cpython-39.pyc +0 -0
  19. package/templates/qoder/scripts/foundation/core/__pycache__/__init__.cpython-39.pyc +0 -0
  20. package/templates/qoder/scripts/foundation/core/__pycache__/paths.cpython-39.pyc +0 -0
  21. package/templates/qoder/scripts/foundation/identity/__pycache__/__init__.cpython-39.pyc +0 -0
  22. package/templates/qoder/scripts/foundation/identity/__pycache__/identity.cpython-39.pyc +0 -0
  23. package/templates/qoder/scripts/foundation/io/__pycache__/__init__.cpython-39.pyc +0 -0
  24. package/templates/qoder/scripts/foundation/io/__pycache__/atomicio.cpython-39.pyc +0 -0
  25. package/templates/qoder/scripts/foundation/io/__pycache__/filelock.cpython-39.pyc +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hupan56/wlkj",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
4
4
  "description": "AI Product R&D Workflow - PRD/Prototype/Search/Task/Report",
5
5
  "bin": {
6
6
  "wlkj": "bin/cli.js"
@@ -23,7 +23,7 @@ User input: $ARGUMENTS
23
23
 
24
24
  **先确定仓库根 R**(QoderWork 桌面端工作目录不是仓库根,相对路径会失效):
25
25
  ```bash
26
- R=$(python ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
26
+ R=$(python ~/.qoderwork/repo_root.py 2>/dev/null || python3 ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
27
27
  ```
28
28
  > 后续脚本统一用 `python "$R/.qoder/scripts/orchestration/wlkj.py" <命令>`。
29
29
 
@@ -14,7 +14,7 @@ User input: $ARGUMENTS
14
14
 
15
15
  **先确定仓库根 R**(QoderWork 桌面端工作目录不是仓库根,相对路径会失效):
16
16
  ```bash
17
- R=$(python ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
17
+ R=$(python ~/.qoderwork/repo_root.py 2>/dev/null || python3 ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
18
18
  ```
19
19
  > 后续脚本统一用 `python "$R/.qoder/scripts/orchestration/wlkj.py" <命令>`;所有仓库内相对路径(workspace/、data/code/)都前置 `"$R/"`。
20
20
 
@@ -38,7 +38,7 @@ If no developer is set, refuse and say "Run /wl-init first".
38
38
  ### ⚡ Fast Path:一次拿全(必须先跑,禁止逐个 cat/ls/git log)
39
39
 
40
40
  ```bash
41
- R=$(python ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
41
+ R=$(python ~/.qoderwork/repo_root.py 2>/dev/null || python3 ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
42
42
  python "$R/.qoder/scripts/orchestration/wlkj.py" report-snapshot "$R" # 日报(今天)
43
43
  python "$R/.qoder/scripts/orchestration/wlkj.py" report-snapshot "$R" --days 7 # 周报(近7天)
44
44
  ```
@@ -14,7 +14,7 @@ User input: $ARGUMENTS (default: show current status)
14
14
 
15
15
  **先确定仓库根 R**(QoderWork 桌面端工作目录不是仓库根,相对路径会失效):
16
16
  ```bash
17
- R=$(python ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
17
+ R=$(python ~/.qoderwork/repo_root.py 2>/dev/null || python3 ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
18
18
  ```
19
19
  > 后续脚本统一用 `python "$R/.qoder/scripts/orchestration/wlkj.py" <命令>`;仓库内相对路径都前置 `"$R/"`。
20
20
 
@@ -14,7 +14,7 @@ User input: $ARGUMENTS
14
14
 
15
15
  **先确定仓库根 R**(QoderWork 桌面端工作目录不是仓库根,相对路径会失效):
16
16
  ```bash
17
- R=$(python ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
17
+ R=$(python ~/.qoderwork/repo_root.py 2>/dev/null || python3 ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
18
18
  ```
19
19
  > 后续脚本统一用 `python "$R/.qoder/scripts/orchestration/wlkj.py" <命令>`。
20
20
 
@@ -120,6 +120,8 @@ cap.mcp.call("context_pack", {"keyword": "<功能名>", "platform": "web"})
120
120
  ## 埋点(评审完成后)
121
121
 
122
122
  评审输出后,记录到 learning:
123
+ > 先定位仓库根 `R`(Mac 只有 python3, 两个都试):
124
+ > `R=$(python ~/.qoderwork/repo_root.py 2>/dev/null || python3 ~/.qoderwork/repo_root.py 2>/dev/null) || R=.`
123
125
  ```bash
124
126
  python "$R/.qoder/scripts/orchestration/wlkj.py" learn record review_done "{\"target\":\"$feature\",\"result\":\"$pass_or_issues\"}"
125
127
  ```
@@ -17,7 +17,7 @@ Usage:
17
17
 
18
18
  **先确定仓库根 R**(QoderWork 桌面端工作目录不是仓库根,相对路径会失效):
19
19
  ```bash
20
- R=$(python ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
20
+ R=$(python ~/.qoderwork/repo_root.py 2>/dev/null || python3 ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
21
21
  ```
22
22
  > `repo_root.py` 从 `~/.qoderwork/mcp.json` 反推仓库根;失败回退 `.`(IDE/CLI 工作目录即仓库根)。后续脚本统一用 `python "$R/.qoder/scripts/orchestration/wlkj.py" <命令>`。
23
23
 
@@ -43,6 +43,10 @@ User input: $ARGUMENTS
43
43
  ``
44
44
 
45
45
  ### 取上下文(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
+ ``
46
50
  ``bash
47
51
  python "$R/.qoder/scripts/orchestration/wlkj.py" context <业务词> --platform <web|app>
48
52
  ``
@@ -17,6 +17,9 @@ argument-hint: "[REQ-ID] [发布]"
17
17
 
18
18
  ## 实现层
19
19
 
20
+ > 先定位仓库根 `R`(Mac 只有 python3, 两个都试; 失败回退 `.` 即当前工作目录):
21
+ > `R=$(python ~/.qoderwork/repo_root.py 2>/dev/null || python3 ~/.qoderwork/repo_root.py 2>/dev/null) || R=.`
22
+
20
23
  ```bash
21
24
  # 列需求
22
25
  python "$R/.qoder/scripts/orchestration/wlkj.py" req
@@ -97,6 +97,8 @@ cap.mcp.call("search_code", {"keyword": "--components"}) # 组件使用
97
97
  🚫 **绝对禁止**用 `findstr /s`、`grep -r`、`os.walk`、`subprocess` 全盘递归扫 data/code。
98
98
 
99
99
  **中文文案/报错溯源**(用户查的是中文短语),**唯一合法方式**:
100
+ > 先定位仓库根 `R`(Mac 只有 python3, 两个都试):
101
+ > `R=$(python ~/.qoderwork/repo_root.py 2>/dev/null || python3 ~/.qoderwork/repo_root.py 2>/dev/null) || R=.`
100
102
  ```bash
101
103
  # grep-text 走 CLI 降级(不是 MCP 工具)
102
104
  python "$R/.qoder/scripts/orchestration/wlkj.py" kg grep-text 车辆不存在 --ext java --limit 20
@@ -19,7 +19,7 @@ User input: $ARGUMENTS
19
19
 
20
20
  **先确定仓库根 R**(QoderWork 桌面端工作目录不是仓库根,相对路径会失效):
21
21
  ```bash
22
- R=$(python ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
22
+ R=$(python ~/.qoderwork/repo_root.py 2>/dev/null || python3 ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
23
23
  ```
24
24
  > 后续脚本统一用 `python "$R/.qoder/scripts/orchestration/wlkj.py" <命令>`。
25
25
 
@@ -16,7 +16,7 @@ User input: $ARGUMENTS
16
16
 
17
17
  **先确定仓库根 R**(QoderWork 桌面端工作目录不是仓库根,相对路径会失效):
18
18
  ```bash
19
- R=$(python ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
19
+ R=$(python ~/.qoderwork/repo_root.py 2>/dev/null || python3 ~/.qoderwork/repo_root.py 2>/dev/null) || R=.
20
20
  ```
21
21
  > 后续脚本统一用 `python "$R/.qoder/scripts/orchestration/wlkj.py" <命令>`。
22
22
 
@@ -88,16 +88,24 @@ def problem(msg, hint=None):
88
88
 
89
89
  def run_script(script, *args, timeout=1800):
90
90
  """跑另一个脚本, 实时透传输出。
91
- v3.0: 支持子目录化 — 先在 scripts/根找, 找不到扫各子包。"""
91
+
92
+ v3.x: 脚本已分子目录 (domain/task/, domain/kg/build/, ...), 不再固定在少数子包。
93
+ 用递归 glob 在 scripts/ 下找, 找不到才报错 —— 根治"目录一重组 run_script 就断链"
94
+ (旧版硬扫 io/setup/kg/build/test 这几个子目录, v3.0 重组后全找不到)。
95
+ """
96
+ import glob
97
+ if not script.endswith('.py'):
98
+ script = script + '.py'
92
99
  # 先试 scripts/根
93
100
  cand = os.path.join(SCRIPTS_DIR, script)
94
101
  if not os.path.isfile(cand):
95
- # 扫各子包
96
- for sub in ('io', 'setup', 'kg', 'build', 'test'):
97
- c2 = os.path.join(SCRIPTS_DIR, sub, script)
98
- if os.path.isfile(c2):
99
- cand = c2
100
- break
102
+ # 递归找 scripts/**/<script>
103
+ hits = glob.glob(os.path.join(SCRIPTS_DIR, '**', script), recursive=True)
104
+ if hits:
105
+ cand = hits[0]
106
+ else:
107
+ print('[run_script] 找不到脚本: %s (在 scripts/ 下递归也没找到)' % script)
108
+ return False
101
109
  cmd = [sys.executable, cand] + list(args)
102
110
  r = subprocess.run(cmd, cwd=BASE, timeout=timeout)
103
111
  return r.returncode == 0
@@ -64,11 +64,17 @@ def find_repo_root():
64
64
  here = parent
65
65
 
66
66
  # 方法4: 本脚本所在位置(若它被放到仓库 .qoder/scripts/ 下)
67
+ # ⚠ 仅当脚本真在 <repo>/.qoder/scripts/ 结构内才成立。
68
+ # 安装到 ~/.qoderwork/repo_root.py 的副本不能走这步 ——
69
+ # s 上三级会解析到用户主目录的父目录(非仓库)。用目录名校验避免误判。
67
70
  try:
68
71
  s = os.path.abspath(__file__)
69
- root = os.path.dirname(os.path.dirname(os.path.dirname(s)))
70
- if os.path.isdir(os.path.join(root, '.qoder', 'scripts')):
71
- return root
72
+ s_dir = os.path.dirname(s)
73
+ # 校验: 本脚本是否真在 .../<repo>/.qoder/scripts/
74
+ if os.path.basename(s_dir) == 'scripts' and os.path.basename(os.path.dirname(s_dir)) == '.qoder':
75
+ root = os.path.dirname(os.path.dirname(s_dir))
76
+ if os.path.isdir(os.path.join(root, '.qoder', 'scripts')):
77
+ return root
72
78
  except Exception:
73
79
  pass
74
80
 
@@ -78,7 +84,14 @@ def find_repo_root():
78
84
  def main():
79
85
  root = find_repo_root()
80
86
  if not root:
81
- print('ERROR: 无法定位 QODER 仓库根。请确认 ~/.qoderwork/mcp.json 存在且指向有效的 kg_mcp_server.py', file=sys.stderr)
87
+ # 清晰诊断, 不静默 (命令里 R= 回退 '.' 但那常是会话临时目录, 后续脚本全失败)
88
+ import sys as _sys
89
+ anchor = os.path.join(os.path.expanduser('~'), '.qoderwork', '.repo-root')
90
+ _sys.stderr.write('ERROR: repo_root.py 无法定位 QODER 仓库根。\n')
91
+ _sys.stderr.write(' cwd: %s\n' % os.getcwd())
92
+ _sys.stderr.write(' 锚点 %s 存在? %s\n' % (anchor, os.path.isfile(anchor)))
93
+ _sys.stderr.write(' 修复: 在项目根跑 "npx @hupan56/wlkj init" (写 .repo-root 锚点),\n')
94
+ _sys.stderr.write(' 或设环境变量 QODER_REPO=<项目根>。\n')
82
95
  return 1
83
96
 
84
97
  # 子路径模式: --script / --template
@@ -658,7 +658,10 @@ def offer_cron(skip=False):
658
658
  else:
659
659
  warn(f'cron 注册失败: {(r.stderr or "").strip()[:100]}')
660
660
  else:
661
- print(' 跳过。以后可手动跑: python .qoder/scripts/setup_weekly_cron.bat')
661
+ if sys.platform == 'win32':
662
+ print(' 跳过。以后可手动跑 (双击或命令行): .qoder\\scripts\\setup_weekly_cron.bat')
663
+ else:
664
+ print(' 跳过。以后可手动跑: bash .qoder/scripts/setup_weekly_cron.sh')
662
665
 
663
666
 
664
667
  # ============================================================