@hupan56/wlkj 3.1.26 → 3.1.28

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hupan56/wlkj",
3
- "version": "3.1.26",
3
+ "version": "3.1.28",
4
4
  "description": "AI Product R&D Workflow - PRD/Prototype/Search/Task/Report",
5
5
  "bin": {
6
6
  "wlkj": "bin/cli.js"
@@ -59,6 +59,8 @@ from foundation.core.paths import get_repo_root, get_developer, get_developer_in
59
59
 
60
60
  SCRIPTS_DIR = str(get_repo_root())
61
61
  sys.path.insert(0, SCRIPTS_DIR)
62
+ # ⚠ run_script 需要搜 scripts/ 目录,SCRIPTS_DIR 是仓库根不是 scripts/
63
+ SCRIPTS_SEARCH_DIR = os.path.join(SCRIPTS_DIR, '.qoder', 'scripts')
62
64
 
63
65
  BASE = SCRIPTS_DIR
64
66
  CODE_DIR = os.path.join(BASE, 'data', 'code')
@@ -97,10 +99,10 @@ def run_script(script, *args, timeout=1800):
97
99
  if not script.endswith('.py'):
98
100
  script = script + '.py'
99
101
  # 先试 scripts/根
100
- cand = os.path.join(SCRIPTS_DIR, script)
102
+ cand = os.path.join(SCRIPTS_SEARCH_DIR, script)
101
103
  if not os.path.isfile(cand):
102
104
  # 递归找 scripts/**/<script>
103
- hits = glob.glob(os.path.join(SCRIPTS_DIR, '**', script), recursive=True)
105
+ hits = glob.glob(os.path.join(SCRIPTS_SEARCH_DIR, '**', script), recursive=True)
104
106
  if hits:
105
107
  cand = hits[0]
106
108
  else:
@@ -483,19 +485,33 @@ def check_index(fix):
483
485
  print('\n--- 5. 知识图谱 (data/index/) ---')
484
486
  age = index_age_days()
485
487
  if age is None:
486
- # 完全缺失 -> 需要全量 (唯一允许"重头再来"的情形)
488
+ # 完全缺失 先尝试 team_sync pull 拉管理员建好的 kg.duckdb
489
+ if fix:
490
+ print(' 索引缺失, 先从团队仓库拉取 (team_sync pull)...')
491
+ if run_script('team_sync.py', 'pull', timeout=120):
492
+ # pull 成功, 检查 kg.duckdb 是否拉到了
493
+ age2 = index_age_days()
494
+ if age2 is not None:
495
+ say(OK, '已从团队仓库拉取知识图谱 ({:.1f} 天前构建)'.format(age2))
496
+ actions.append('从团队拉取知识图谱')
497
+ return
498
+ # pull 了但 kg.duckdb 还是没到(管理员还没建过?)
499
+ print(' team_sync pull 完成, 但 kg.duckdb 未在仓库中')
500
+ else:
501
+ say(WARN, 'team_sync pull 失败 (离线? 冲突?)')
502
+
503
+ # pull 失败或没拉到 → 降级: 有源码就本地全量构建
487
504
  if _has_source_code():
488
- # 有源码 → 可以建索引
489
505
  if fix:
490
- print(' 索引缺失, 全量构建 (一次性, 之后都是增量) ...')
506
+ print(' 降级: 本地全量构建 (一次性, 之后都是增量) ...')
491
507
  if run_script('git_sync.py', '--index-only'):
492
- actions.append('全量构建知识图谱')
508
+ actions.append('全量构建知识图谱 (本地降级)')
493
509
  else:
494
510
  problem('索引构建失败, 查看上方报错')
495
511
  else:
496
- problem('知识图谱不存在', '加 --fix 全量构建 (仅首次)')
512
+ problem('知识图谱不存在', '加 --fix: 先拉团队, 拉不到再本地构建')
497
513
  else:
498
- # 无源码 → 建不了索引, 醒目告警 (不能只说"先解决第4项", 太含糊)
514
+ # 无源码 → 建不了索引
499
515
  problem('索引缺失且无源码 (data/code/ 为空)',
500
516
  '无法构建知识图谱。看下方"降级状态"说明, 配源码后重跑 init')
501
517
  return