@hupan56/wlkj 3.1.31 → 3.1.32

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.31",
3
+ "version": "3.1.32",
4
4
  "description": "AI Product R&D Workflow - PRD/Prototype/Search/Task/Report",
5
5
  "bin": {
6
6
  "wlkj": "bin/cli.js"
@@ -664,6 +664,73 @@ def offer_cron(skip=False):
664
664
  print(' 跳过。以后可手动跑: bash .qoder/scripts/setup_weekly_cron.sh')
665
665
 
666
666
 
667
+ # ============================================================
668
+ # Step 3.6: 禅道凭据配置 (每个开发者配自己的禅道账号)
669
+ # ============================================================
670
+
671
+ def offer_zentao(name):
672
+ """引导禅道凭据配置。
673
+
674
+ 禅道 URL 团队共享(配在 config.yaml), 但用户名/密码是个人凭据,
675
+ 存 workspace/members/{dev}/.private/secrets/zentao.env (gitignored)。
676
+ 不配也能用 (kg/search/PRD 不依赖禅道), 但 /wl-task 禅道同步和
677
+ /wl-report 禅道查询需要。
678
+ """
679
+ print('\n--- 禅道凭据 (可选, 不配也能用核心功能) ---')
680
+
681
+ # 检查 config.yaml 有没有禅道 URL
682
+ zentao_url = ''
683
+ try:
684
+ from foundation.core.config import load_config_section, SECTIONS
685
+ cfg = load_config_section(SECTIONS.ZENTAO)
686
+ zentao_url = (cfg.get('url') or '').strip()
687
+ except Exception:
688
+ pass
689
+
690
+ if not zentao_url:
691
+ print(' 团队未配置禅道 URL (config.yaml 无 zentao.url)。')
692
+ print(' 管理员配: 在 config.yaml 加 zentao.url: http://你的禅道地址')
693
+ print(' 跳过禅道配置。配好 URL 后重跑 init 即可。')
694
+ return
695
+
696
+ print(f' 禅道地址: {zentao_url}')
697
+
698
+ # 检查是否已配
699
+ try:
700
+ from foundation.core.paths import get_secrets_dir
701
+ secrets_dir = get_secrets_dir(name)
702
+ env_file = os.path.join(secrets_dir, 'zentao.env')
703
+ if os.path.isfile(env_file):
704
+ ok('禅道凭据已配置 (zentao.env 存在)')
705
+ return
706
+ except Exception:
707
+ pass
708
+
709
+ if not ask('配置禅道账号? (用于同步任务/需求/Bug)', 'n'):
710
+ print(' 跳过。以后需要: npx @hupan56/wlkj init <名字> <角色>')
711
+ return
712
+
713
+ # 交互式收集禅道凭据
714
+ try:
715
+ zentao_user = input(' 禅道用户名: ').strip()
716
+ zentao_pwd = input(' 禅道密码: ').strip()
717
+ if not zentao_user or not zentao_pwd:
718
+ warn('用户名/密码为空, 跳过')
719
+ return
720
+
721
+ # 写入 zentao.env
722
+ secrets_dir = os.path.join(os.getcwd(), 'workspace', 'members', name, '.private', 'secrets')
723
+ os.makedirs(secrets_dir, exist_ok=True)
724
+ env_file = os.path.join(secrets_dir, 'zentao.env')
725
+ with open(env_file, 'w', encoding='utf-8') as f:
726
+ f.write(f'ZENTAO_USER={zentao_user}\n')
727
+ f.write(f'ZENTAO_PASSWORD={zentao_pwd}\n')
728
+ ok(f'禅道凭据已保存: {env_file}')
729
+ print(' (个人凭据, 已 gitignored, 不会 push 给团队)')
730
+ except (EOFError, KeyboardInterrupt):
731
+ print(' 跳过')
732
+
733
+
667
734
  # ============================================================
668
735
  # Step 4.5: 蓝湖 MCP (设计师直读蓝湖设计稿)
669
736
  # ============================================================
@@ -873,6 +940,9 @@ def main():
873
940
  # Step 3.5: 团队协作仓库 remote (workspace/ 产出 push 到这里)
874
941
  configure_team_remote()
875
942
 
943
+ # Step 3.6: 禅道凭据配置 (每个开发者都要配自己的禅道账号)
944
+ offer_zentao(name)
945
+
876
946
  # Step 4
877
947
  offer_cron(skip=args.skip_cron)
878
948