
Security News
PolinRider: North Korea-Linked Supply Chain Campaign Expands Across Open Source Ecosystems
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.
多平台(飞书 & Telegram & 企业微信)机器人 ↔ Claude Code CLI 桥接服务。
用户在飞书、Telegram 或企业微信中发消息,服务器接收后调用 Claude Code 执行,并将输出实时流式推送回聊天窗口。
/new 重置-d 后台运行和 stop 停止,install 注册为 systemd 开机自启服务/watch 命令实时监控终端 Claude Code 的运行状态(工具调用、完成事件)要求:Node.js >= 20,需要预先安装 Claude Code CLI
可以同时启用多个平台,只需配置对应平台的凭证即可:
export FEISHU_APP_ID=your_app_id
export FEISHU_APP_SECRET=your_app_secret
export TELEGRAM_BOT_TOKEN=your_bot_token
export WECOM_BOT_ID=your_bot_id
export WECOM_BOT_SECRET=your_bot_secret
npx cc-im@latest
服务会自动检测已配置的平台并启动对应的 bot。
# 方式一:环境变量
export TELEGRAM_BOT_TOKEN=your_bot_token
npx cc-im@latest
# 方式二:从源码运行
pnpm install
cp .env.example .env
# 编辑 .env,填入 TELEGRAM_BOT_TOKEN
pnpm dev
/start 开始使用im:message、im:message:send_as_bot、im:message.group_msg、im:message.p2p_msg:readonly、im:resource、cardkit:card:writeim.message.receive_v1 — 接收消息im.message.recalled_v1 — 消息撤回(自动清理话题会话)card.action.trigger — 卡片交互(停止按钮)export FEISHU_APP_ID=your_app_id
export FEISHU_APP_SECRET=your_app_secret
npx cc-im@latest
export WECOM_BOT_ID=your_bot_id
export WECOM_BOT_SECRET=your_bot_secret
npx cc-im@latest
git clone https://github.com/congqiu/cc-im.git
cd cc-im
pnpm install
cp .env.example .env
# 编辑 .env 填入对应平台凭证
pnpm dev # 开发模式
pnpm build # 编译
pnpm start # 生产模式(前台)
# 后台启动
cc-im -d
# 停止服务
cc-im stop
# 查看运行状态
cc-im status
日志输出到 ~/.cc-im/logs/daemon.log。
在 Linux 上可注册为用户级 systemd 服务,开机自动启动:
# 注册并启动服务
cc-im install
# 卸载服务
cc-im uninstall
| 命令 | 说明 |
|---|---|
/start | 显示欢迎信息(Telegram) |
/help | 显示帮助信息 |
/new | 开始新会话 |
/cd <path> | 切换工作目录(同时重置会话) |
/pwd | 查看当前工作目录 |
/list | 列出所有项目的工作区 |
/cost | 查看 Claude API 用量和费用 |
/status | 查看当前会话状态 |
/model [name] | 查看或切换模型(按用户/话题粒度) |
/doctor | 运行 Claude 诊断 |
/compact [topic] | 压缩当前对话上下文 |
/history [page] | 查看当前会话的对话历史 |
/resume [n] | 浏览/恢复历史会话 |
/watch [level] | 监控终端 Claude Code(stop/tool/full/off) |
/threads | 列出所有话题会话(飞书) |
/stop | 停止当前运行的任务(企业微信) |
/allow 或 /y | 允许权限请求(按钮不可用时的备选) |
/deny 或 /n | 拒绝权限请求(按钮不可用时的备选) |
| 变量 | 说明 | 默认值 |
|---|---|---|
FEISHU_APP_ID | 飞书应用 App ID | 飞书平台必填 |
FEISHU_APP_SECRET | 飞书应用 App Secret | 飞书平台必填 |
TELEGRAM_BOT_TOKEN | Telegram Bot Token | Telegram 平台必填 |
WECOM_BOT_ID | 企业微信机器人 Bot ID | 企业微信平台必填 |
WECOM_BOT_SECRET | 企业微信机器人 Secret | 企业微信平台必填 |
WECOM_BOT_NAME | 企业微信机器人显示名称,用于精确去除群聊 @提及 | 空(启发式匹配) |
ALLOWED_USER_IDS | 白名单用户 ID,逗号分隔,留空不限制 | 空(不限制) |
CLAUDE_CLI_PATH | Claude CLI 可执行文件路径 | claude |
CLAUDE_WORK_DIR | 默认工作目录 | 当前目录 |
ALLOWED_BASE_DIRS | 允许 /cd 切换的基础目录,逗号分隔 | 同 CLAUDE_WORK_DIR |
CLAUDE_SKIP_PERMISSIONS | 跳过权限检查(生产环境建议 false) | false |
CLAUDE_TIMEOUT_MS | 执行超时(毫秒) | 600000(10分钟) |
CLAUDE_MODEL | 默认模型(如 sonnet、opus、haiku) | 空(由 Claude Code 决定) |
PROXY_URL | 代理地址,传递给 Claude CLI(如 http://127.0.0.1:7890) | 空 |
HOOK_SERVER_PORT | 权限确认 Hook 服务端口 | 18900 |
LOG_DIR | 日志文件存储目录 | ~/.cc-im/logs |
LOG_LEVEL | 日志等级(DEBUG/INFO/WARN/ERROR) | DEBUG |
ou_xxxx123456789(可通过 @userinfobot 获取)zhangsan除环境变量外,也支持通过 ~/.cc-im/config.json 文件配置:
{
"feishuAppId": "",
"feishuAppSecret": "",
"telegramBotToken": "your_bot_token",
"wecomBotId": "",
"wecomBotSecret": "",
"wecomBotName": "",
"allowedUserIds": ["123456789"],
"claudeCliPath": "/usr/local/bin/claude",
"claudeWorkDir": "/home/user/projects",
"allowedBaseDirs": ["/home/user/projects", "/tmp"],
"claudeSkipPermissions": false,
"claudeTimeoutMs": 600000,
"claudeModel": "sonnet",
"proxyUrl": "http://127.0.0.1:7890",
"hookPort": 18900,
"logDir": "/var/log/cc-im",
"logLevel": "INFO"
}
环境变量优先级高于配置文件。
默认数据目录:~/.cc-im(常量 APP_HOME)
~/.cc-im/
├── config.json # 配置文件
├── data/
│ ├── sessions.json # 会话持久化数据
│ └── active-chats.json # 活跃聊天记录(生命周期通知)
└── logs/ # 日志文件(可通过 LOG_DIR 自定义)
├── 2026-02-14.log
└── 2026-02-15.log
必须:在 Claude CLI 配置文件中添加 PreToolUse hook,使权限确认功能正常工作。
编辑 ~/.claude/settings.json,在 hooks 中添加:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash|Write|Edit",
"hooks": [
{
"type": "command",
"command": "<your-project-path>/dist/hook/hook-script.js"
}
]
}
]
}
}
将 <your-project-path> 替换为实际的项目路径(使用绝对路径)。hook 脚本需要执行权限:chmod +x dist/hook/hook-script.js
配置修改后需要完全退出 Claude Code 会话(exit)并重新启动才能生效。
当 CLAUDE_SKIP_PERMISSIONS=false 时,系统会通过 PreToolUse Hook 拦截敏感操作:
HOOK_SERVER_PORT 指定)以下只读工具会自动放行,无需确认:
Read、Glob、Grep、WebFetch、WebSearch、Task、TodoRead
src/
├── index.ts # 入口,多平台并行初始化
├── config.ts # 配置加载(环境变量 + ~/.cc-im/config.json)
├── constants.ts # 系统常量(节流、长度限制、错误码等)
├── logger.ts # 带标签的日志系统(自动脱敏)
├── sanitize.ts # 日志脱敏规则
├── cli.ts # CLI 入口(前台/守护进程/systemd 服务管理)
├── access/
│ └── access-control.ts # 白名单访问控制
├── claude/
│ ├── cli-runner.ts # Claude CLI 子进程管理
│ ├── stream-parser.ts # stream-json 格式解析
│ └── types.ts # Claude 消息类型定义
├── commands/
│ └── handler.ts # 平台无关的命令处理器
├── feishu/
│ ├── client.ts # 飞书 SDK 初始化
│ ├── event-handler.ts # 飞书事件处理
│ ├── message-sender.ts # 飞书消息发送封装
│ ├── card-builder.ts # 飞书卡片构建(JSON 1.0 + 2.0)
│ └── cardkit-manager.ts # CardKit 卡片生命周期管理
├── telegram/
│ ├── client.ts # Telegraf 初始化
│ ├── event-handler.ts # Telegram 事件处理
│ └── message-sender.ts # Telegram 消息发送
├── wecom/
│ ├── client.ts # 企业微信 WSClient 初始化
│ ├── event-handler.ts # 企业微信事件处理
│ └── message-sender.ts # 企业微信消息发送(流式回复、权限卡片)
├── hook/
│ ├── permission-server.ts # 权限确认 HTTP 服务 + 监控通知端点
│ ├── hook-script.ts # Claude Code PreToolUse Hook
│ ├── watch-script.ts # Claude Code 监控 Hook(PostToolUse/Stop 等)
│ ├── watch.ts # 监控状态管理与消息格式化
│ └── ensure-hook.ts # Hook 自动配置
├── shared/
│ ├── active-chats.ts # 活跃聊天记录(生命周期通知)
│ ├── claude-task.ts # 共享 Claude 任务执行层(节流、统计、竞态保护)
│ ├── history.ts # 会话历史读取与分页
│ ├── message-dedup.ts # 消息去重(飞书重复事件过滤)
│ ├── retry.ts # 通用重试工具
│ ├── task-cleanup.ts # 超时任务自动清理
│ ├── types.ts # 共享类型定义
│ ├── update-check.ts # 启动时版本更新检查
│ └── utils.ts # 共享工具函数
├── session/
│ └── session-manager.ts # 会话管理(持久化到 data/sessions.json)
└── queue/
└── request-queue.ts # 请求队列与并发控制
MIT
FAQs
Multi-platform bot bridge (Feishu & Telegram & WeCom) for Claude Code CLI
The npm package cc-im receives a total of 28 weekly downloads. As such, cc-im popularity was classified as not popular.
We found that cc-im demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.