{"id":48056794,"url":"https://github.com/joewongjc/feishu-claude-code","last_synced_at":"2026-04-04T14:28:50.145Z","repository":{"id":342255394,"uuid":"1173401908","full_name":"joewongjc/feishu-claude-code","owner":"joewongjc","description":"Bridge Claude Code CLI with Feishu/Lark via WebSocket. 飞书 × Claude Code 实时对话。","archived":false,"fork":false,"pushed_at":"2026-04-03T05:01:22.000Z","size":163,"stargazers_count":47,"open_issues_count":1,"forks_count":14,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-03T05:21:17.070Z","etag":null,"topics":["ai","chatbot","claude","claude-code","feishu","lark","mcp"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joewongjc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-05T10:24:29.000Z","updated_at":"2026-04-03T05:01:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/joewongjc/feishu-claude-code","commit_stats":null,"previous_names":["joewongjc/feishu-claude-code"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/joewongjc/feishu-claude-code","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joewongjc%2Ffeishu-claude-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joewongjc%2Ffeishu-claude-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joewongjc%2Ffeishu-claude-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joewongjc%2Ffeishu-claude-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joewongjc","download_url":"https://codeload.github.com/joewongjc/feishu-claude-code/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joewongjc%2Ffeishu-claude-code/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31402498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","chatbot","claude","claude-code","feishu","lark","mcp"],"created_at":"2026-04-04T14:28:49.067Z","updated_at":"2026-04-04T14:28:49.812Z","avatar_url":"https://github.com/joewongjc.png","language":"Python","readme":"# feishu-claude-code\n\n在飞书里直接和你本机的 Claude Code 对话。\n\nWebSocket 长连接，流式卡片输出，手机上随时 code review、debug、问问题。\n\n\u003e 复用 Claude Max/Pro 订阅，不需要 API Key，不需要公网 IP。\n\n## 特性\n\n**核心能力**\n\n- **流式卡片输出** — Claude 边想边输出，工具调用进度实时可见，不是等半天发一坨\n- **Session 跨设备** — 手机上开始的对话，回到电脑前接着聊；CLI 终端的会话也能在飞书恢复\n- **图片识别** — 直接发截图给 Claude 分析\n- **斜杠命令** — 切换模型、恢复会话、查看用量、管理工作目录\n- **Skills 透传** — `/commit`、`/review` 等 Claude Code Skills 直接在飞书里用\n\n**群聊支持 (beta)**\n\n- 拉机器人进群，**@机器人** 即可对话，不 @ 的消息静默忽略\n- 每个群独立 session、模型、工作目录，和私聊互不干扰\n- `/ws` 命令为不同群绑定不同项目目录，多群并发互不阻塞\n\n**部署简单**\n\n- **无需公网 IP** — 飞书 WebSocket 长连接，部署在家里的 Mac 上就行\n- **零额外成本** — 直接调用本机 `claude` CLI，复用已有订阅\n- **看门狗自愈** — 4 小时自动重启，防止 WebSocket 连接假死\n\n## 快速开始\n\n### 前置条件\n\n| 依赖 | 最低版本 | 验证命令 |\n|------|---------|---------|\n| Python | 3.11+ | `python3 --version` |\n| Claude Code CLI | 最新 | `claude --version` |\n| Claude Max/Pro 订阅 | — | `claude \"hi\"` 能正常回复 |\n\n### 安装与启动\n\n```bash\ngit clone https://github.com/joewongjc/feishu-claude-code.git\ncd feishu-claude-code\n\npython3 -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\n\ncp .env.example .env\n# 编辑 .env，填入飞书应用凭证（见下方「飞书应用配置」）\n\npython main.py\n```\n\n预期输出：\n\n```\n🚀 飞书 Claude Bot 启动中...\n   App ID      : cli_xxx...\n✅ 连接飞书 WebSocket 长连接（自动重连）...\n```\n\n\u003e 从旧版升级的用户可运行 `python migrate_sessions.py` 迁移 session 数据（会自动备份）。\n\n## 命令速查\n\n**会话管理**\n\n| 命令 | 说明 |\n|------|------|\n| `/new` | 开始新 session |\n| `/resume` | 查看历史 sessions |\n| `/resume 序号` | 恢复指定 session |\n| `/stop` | 停止当前正在运行的任务 |\n| `/status` | 当前 session 信息 |\n\n**模型与模式**\n\n| 命令 | 说明 |\n|------|------|\n| `/model opus` | 切换模型 (opus / sonnet / haiku) |\n| `/mode bypass` | 切换权限模式 |\n\n**工作目录**\n\n| 命令 | 说明 |\n|------|------|\n| `/cd ~/project` | 切换工作目录 |\n| `/ls` | 查看当前工作目录内容 |\n| `/ws save 名称 路径` | 保存命名工作空间 |\n| `/ws use 名称` | 绑定当前群组/私聊到工作空间 |\n\n**信息查询**\n\n| 命令 | 说明 |\n|------|------|\n| `/usage` | 查看 Claude Max 用量 (macOS) |\n| `/skills` | 列出 Claude Skills |\n| `/mcp` | 列出 MCP Servers |\n| `/help` | 帮助 |\n\n**Skills 透传**\n\n`/commit` 等未注册的斜杠命令会直接转发给 Claude CLI 执行。\n\n## 架构\n\n```\n┌──────────┐  WebSocket  ┌────────────────┐  subprocess  ┌────────────┐\n│  飞书 App │◄───────────►│ feishu-claude  │─────────────►│ claude CLI │\n│  (用户)   │  长连接      │  (main.py)     │ stream-json  │  (本机)     │\n└──────────┘             └────────────────┘              └────────────┘\n```\n\n飞书通过 WebSocket 推送消息到本机进程，进程调用 `claude` CLI 的 `--print --output-format stream-json` 模式获取流式输出，再通过飞书卡片消息的 patch API 实时更新内容。\n\n## 飞书应用配置\n\n### 1. 创建应用\n\n1. 打开 [飞书开放平台](https://open.feishu.cn/app)，点击「创建企业自建应用」\n2. 填写应用名称（如 `Claude Code`），选择图标，点击创建\n\n### 2. 添加机器人能力\n\n1. 进入应用详情，左侧菜单选择「添加应用能力」\n2. 添加「机器人」能力\n\n### 3. 开启权限\n\n进入「权限管理」页面，搜索并开启以下权限：\n\n| 权限 scope | 说明 |\n|-----------|------|\n| `im:message` | 获取与发送单聊、群组消息 |\n| `im:message:send_as_bot` | 以应用的身份发送消息 |\n| `im:resource` | 获取消息中的资源文件（图片等） |\n\n### 4. 启用长连接模式\n\n1. 左侧菜单「事件与回调」→「事件配置」\n2. 订阅方式选择「使用长连接接收事件」（不是 Webhook）\n3. 添加事件：`im.message.receive_v1`（接收消息）\n\n### 5. 获取凭证\n\n1. 进入「凭证与基础信息」页面\n2. 复制 App ID 和 App Secret，填入 `.env` 文件\n\n### 6. 发布应用\n\n1. 点击「版本管理与发布」→「创建版本」\n2. 填写版本号和更新说明，提交审核\n3. 管理员在飞书管理后台审核通过后即可使用\n\n## 环境变量\n\n| 变量 | 必填 | 默认值 | 说明 |\n|------|:---:|-------|------|\n| `FEISHU_APP_ID` | 是 | — | 飞书应用 App ID |\n| `FEISHU_APP_SECRET` | 是 | — | 飞书应用 App Secret |\n| `DEFAULT_MODEL` | 否 | `claude-sonnet-4-6` | 默认使用的 Claude 模型 |\n| `DEFAULT_CWD` | 否 | `~` | Claude CLI 的默认工作目录 |\n| `PERMISSION_MODE` | 否 | `bypassPermissions` | 工具权限模式 |\n| `STREAM_CHUNK_SIZE` | 否 | `20` | 流式推送的字符积累阈值 |\n| `CLAUDE_CLI_PATH` | 否 | 自动查找 | Claude CLI 可执行文件路径 |\n\n## 持久化部署\n\n### macOS (launchctl)\n\n```bash\ncp deploy/feishu-claude.plist ~/Library/LaunchAgents/com.feishu-claude.bot.plist\n# 修改 plist 中的 /path/to/ 为实际路径\n\nlaunchctl load ~/Library/LaunchAgents/com.feishu-claude.bot.plist\nlaunchctl list | grep feishu-claude\ntail -f /tmp/feishu-claude.log\n```\n\n### Linux (systemd)\n\n```bash\nsudo cp deploy/feishu-claude.service /etc/systemd/system/\n# 修改 service 中的路径和 User\n\nsudo systemctl daemon-reload\nsudo systemctl enable feishu-claude\nsudo systemctl start feishu-claude\njournalctl -u feishu-claude -f\n```\n\n---\n\n## English\n\n**feishu-claude-code** bridges your local Claude Code CLI with Feishu/Lark messenger via WebSocket.\n\n- No public IP needed (Feishu WebSocket long connection)\n- Streaming card output (real-time typing effect with tool call progress)\n- Reuses Claude Max/Pro subscription (no API key required)\n- Full session management across devices\n- Group chat support with @mention filtering and session isolation (beta)\n- Image recognition, slash commands, Claude Skills passthrough\n\nQuick start: clone, `pip install -r requirements.txt`, configure `.env`, run `python main.py`.\n\nSee the Chinese sections above for detailed setup instructions.\n\n## License\n\n[MIT](LICENSE)\n","funding_links":[],"categories":["Agent Bridges"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoewongjc%2Ffeishu-claude-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoewongjc%2Ffeishu-claude-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoewongjc%2Ffeishu-claude-code/lists"}