@hupan56/wlkj 3.1.13 → 3.1.15

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/bin/cli.js CHANGED
@@ -951,8 +951,26 @@ function doUpdate() {
951
951
  }
952
952
  }
953
953
  } catch { /* */ }
954
- if (cleaned > 0 || cacheCleaned > 0) {
955
- console.log(` [清理] 废弃文件 ${cleaned} + 过期缓存 ${cacheCleaned} 个`);
954
+ // 清理引擎 __pycache__ (v3.x 加): 脚本重组后, .pyc 可能指向已删/已移的 .py
955
+ // 某些机器 Python 加载死字节码 行为漂移 (机器特定, 难排查)。全删, 自动重建。
956
+ let pycCleaned = 0;
957
+ function _purgePycache(dir) {
958
+ try {
959
+ for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
960
+ const p = path.join(dir, e.name);
961
+ if (e.isDirectory()) {
962
+ if (e.name === "__pycache__") {
963
+ try { fs.rmSync(p, { recursive: true, force: true }); pycCleaned++; } catch { /* 占用 */ }
964
+ } else {
965
+ _purgePycache(p);
966
+ }
967
+ }
968
+ }
969
+ } catch { /* */ }
970
+ }
971
+ _purgePycache(path.join(cwd, ".qoder", "scripts"));
972
+ if (cleaned > 0 || cacheCleaned > 0 || pycCleaned > 0) {
973
+ console.log(` [清理] 废弃文件 ${cleaned} 个 + 过期缓存 ${cacheCleaned} 个 + __pycache__ ${pycCleaned} 个`);
956
974
  }
957
975
 
958
976
  // === 5c. 清理 .qoder 嵌套残留 (致命 bug 源) ===
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hupan56/wlkj",
3
- "version": "3.1.13",
3
+ "version": "3.1.15",
4
4
  "description": "AI Product R&D Workflow - PRD/Prototype/Search/Task/Report",
5
5
  "bin": {
6
6
  "wlkj": "bin/cli.js"
@@ -1,17 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  """build_workflows.py — 从 traces + endpoints 推导业务流程链, 生成 workflow-index.json。
3
3
 
4
- # v3.0 路径自举: 引导到 common/bootstrap, 统一 sys.path 逻辑
5
- import os as _o, sys as _s
6
- _f = _o.path.abspath(__file__)
7
- for _ in range(10):
8
- _f = _o.path.dirname(_f)
9
- _cp = _o.path.join(_f, 'foundation')
10
- if _o.path.isfile(_o.path.join(_cp, 'bootstrap.py')):
11
- break
12
- if _cp not in _s.path: _s.path.insert(0, _cp)
13
- from bootstrap import setup; setup()
14
-
15
4
  产出 data/index/_build_cache/workflow-index.json, 供 kg_duckdb 导入 workflows 表,
16
5
  让 kg.py workflow <模块> 能返回该模块的状态流转链 (query→create→audit→...)。
17
6
 
@@ -26,13 +15,24 @@ workflows 表结构: module, state, seq, button, endpoint
26
15
  数据源: trace-chain.json (vue_file→button→endpoint→verb) + entity-registry.json
27
16
  (module→endpoint 邻接, 用于把 endpoint 归到 module)。
28
17
  """
18
+ # v3.0 路径自举: 引导到 foundation/bootstrap, 统一 sys.path 逻辑
19
+ # ⚠ 必须在 module docstring 之外! 旧版把这块包进 docstring (闭引号在第28行) →
20
+ # bootstrap 永不执行 → from foundation ModuleNotFoundError → 脚本直接跑死。
21
+ import os as _o, sys as _s
22
+ _f = _o.path.abspath(__file__)
23
+ for _ in range(10):
24
+ _f = _o.path.dirname(_f)
25
+ _cp = _o.path.join(_f, 'foundation')
26
+ if _o.path.isfile(_o.path.join(_cp, 'bootstrap.py')):
27
+ break
28
+ if _cp not in _s.path: _s.path.insert(0, _cp)
29
+ from bootstrap import setup; setup()
30
+
29
31
  import json
30
32
  import os
31
33
  import sys
32
34
  from datetime import datetime
33
35
 
34
- THIS_DIR = os.path.dirname(os.path.abspath(__file__))
35
- sys.path.insert(0, os.path.join(THIS_DIR, '..'))
36
36
  from foundation.core.paths import DATA_INDEX_DIR, BUILD_CACHE_DIR
37
37
 
38
38