remote-claude 1.0.4 → 1.0.5

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": "remote-claude",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "双端共享 Claude CLI 工具",
5
5
  "bin": {
6
6
  "remote-claude": "bin/remote-claude",
package/remote_claude.py CHANGED
@@ -696,6 +696,20 @@ def cmd_deps(args):
696
696
  return 0
697
697
 
698
698
 
699
+ def cmd_lark_init(args):
700
+ """飞书机器人配置向导(扫码自动创建应用)"""
701
+ from lark_client.setup_wizard import SetupWizard
702
+ check_only = getattr(args, "check", False)
703
+ new_only = getattr(args, "new", False)
704
+ wizard = SetupWizard(check_only=check_only, new_only=new_only)
705
+ rc = wizard.run()
706
+ # 配置成功后自动重启飞书客户端(--check / --new 模式跳过)
707
+ if rc == 0 and not check_only and not new_only:
708
+ print("\n正在重启飞书客户端以应用新配置...")
709
+ cmd_lark_restart(args)
710
+ return rc
711
+
712
+
699
713
  def cmd_lark(args):
700
714
  """飞书客户端管理(兼容旧命令)"""
701
715
  # 如果没有子命令,默认显示状态或启动
@@ -704,6 +718,7 @@ def cmd_lark(args):
704
718
  else:
705
719
  print("飞书客户端未运行")
706
720
  print("\n可用命令:")
721
+ print(" python3 remote_claude.py lark init - 配置向导(首次使用)")
707
722
  print(" python3 remote_claude.py lark start - 启动客户端")
708
723
  print(" python3 remote_claude.py lark stop - 停止客户端")
709
724
  print(" python3 remote_claude.py lark restart - 重启客户端")
@@ -725,6 +740,9 @@ def main():
725
740
  %(prog)s status mywork 显示 mywork 会话状态
726
741
 
727
742
  飞书客户端:
743
+ %(prog)s lark init 配置向导(首次使用,扫码自动创建应用)
744
+ %(prog)s lark init --check 检查当前配置状态
745
+ %(prog)s lark init --new 扫码创建新应用(不修改已有配置)
728
746
  %(prog)s lark start 启动飞书客户端
729
747
  %(prog)s lark stop 停止飞书客户端
730
748
  %(prog)s lark restart 重启飞书客户端
@@ -827,6 +845,13 @@ def main():
827
845
  lark_status_parser = lark_subparsers.add_parser("status", help="查看飞书客户端状态")
828
846
  lark_status_parser.set_defaults(func=cmd_lark_status)
829
847
 
848
+ # lark init
849
+ lark_init_parser = lark_subparsers.add_parser("init", help="配置向导(扫码自动创建应用)")
850
+ lark_init_group = lark_init_parser.add_mutually_exclusive_group()
851
+ lark_init_group.add_argument("--check", action="store_true", help="仅检查当前配置状态")
852
+ lark_init_group.add_argument("--new", action="store_true", help="扫码创建新应用(不修改已有配置)")
853
+ lark_init_parser.set_defaults(func=cmd_lark_init)
854
+
830
855
  # 如果只输入 lark 没有子命令,使用默认处理
831
856
  lark_parser.set_defaults(func=cmd_lark)
832
857
 
@@ -1,43 +0,0 @@
1
- #!/bin/bash
2
- # 检查 .env 中 FEISHU_APP_ID/APP_SECRET 是否已配置,未配置则交互引导
3
- # 用法: source scripts/check-env.sh "$INSTALL_DIR"
4
-
5
- INSTALL_DIR="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
6
- ENV_FILE="$HOME/.remote-claude/.env"
7
- mkdir -p "$HOME/.remote-claude"
8
- ENV_OK=false
9
-
10
- if [ -f "$ENV_FILE" ]; then
11
- APP_ID=$(grep -E '^FEISHU_APP_ID=' "$ENV_FILE" | cut -d= -f2)
12
- APP_SECRET=$(grep -E '^FEISHU_APP_SECRET=' "$ENV_FILE" | cut -d= -f2)
13
- if [ -n "$APP_ID" ] && [ "$APP_ID" != "cli_xxxxx" ] && \
14
- [ -n "$APP_SECRET" ] && [ "$APP_SECRET" != "xxxxx" ]; then
15
- ENV_OK=true
16
- fi
17
- fi
18
-
19
- if [ "$ENV_OK" = false ]; then
20
- echo ""
21
- echo "飞书客户端尚未配置,需要填写应用凭证。"
22
- echo "(在飞书开发者后台创建应用获取: https://open.feishu.cn/app)"
23
- echo ""
24
- echo -e "\033[33m飞书机器人配置文档参考:https://github.com/yyzybb537/remote_claude\033[0m"
25
- echo ""
26
- read -p "FEISHU_APP_ID: " INPUT_APP_ID
27
- read -p "FEISHU_APP_SECRET: " INPUT_APP_SECRET
28
-
29
- if [ -z "$INPUT_APP_ID" ] || [ -z "$INPUT_APP_SECRET" ]; then
30
- echo "错误: APP_ID 和 APP_SECRET 不能为空"
31
- exit 1
32
- fi
33
-
34
- cp "$INSTALL_DIR/.env.example" "$ENV_FILE"
35
- sed -i.bak "s/^FEISHU_APP_ID=.*/FEISHU_APP_ID=$INPUT_APP_ID/" "$ENV_FILE"
36
- sed -i.bak "s/^FEISHU_APP_SECRET=.*/FEISHU_APP_SECRET=$INPUT_APP_SECRET/" "$ENV_FILE"
37
- rm -f "$ENV_FILE.bak"
38
-
39
- echo ""
40
- echo "配置已保存到 $ENV_FILE"
41
- echo "(可选配置, 如"白名单"等可稍后编辑该文件)"
42
- echo ""
43
- fi