UNLINEARITY/CLI-WeChat-Bridge

Bridge WeChat, WeCom & Telegram to local Codex, Claude Code, OpenCode & Pi. Keep the native terminal experience & CLI options with bidirectional interaction, multi-session bridging, CLI switching, file transfer, approvals & status sync. 微信、企业微信与 Telegram 接入本地 Codex、Claude Code、OpenCode 和 Pi,保留原生终端体验与高级启动参数,支持原生双向交互、多会话桥接、多 CLI 切换、文件传输、审批交互与运行状态同步。

CLI WeChat Bridge – What It Is

CLI WeChat Bridge is a Node‑JS command‑line tool that lets you keep working with local AI‑coding assistants (OpenAI Codex, Anthropic Claude Code, OpenCode, Pi) while using WeChat or Enterprise WeChat as a remote entry point. In practice you run the bridge on your computer, log in to WeChat (or set up an Enterprise WeChat bot), and then you can send prompts, files, or control commands from the chat app. The bridge forwards those messages to the chosen local CLI, captures the output, and sends the reply (or status updates) back to the chat conversation.

The project is focused on preserving the native terminal experience – the AI model runs in its original CLI, with all its flags and interactive features, while WeChat merely acts as a thin remote UI.


Who Might Use It

  • Developers who already rely on Codex, Claude Code, OpenCode or Pi via their command‑line interfaces.
  • People who want to trigger those tools from a phone or another device without moving to a web UI.
  • Teams that use Enterprise WeChat bots for internal automation and want to hook them into their existing local AI workflows.

Core Features (as described in the README)

Feature What It Does
Bridge to multiple AI‑CLI tools Supports Codex, Claude Code, OpenCode and Pi. The bridge launches or re‑uses the native CLI and forwards prompts.
Two remote channels Personal WeChat (wechat‑setup, wechat‑* commands) and Enterprise WeChat (wecom‑setup, wecom‑* commands).
Daemon mode wechat‑daemon / wecom‑daemon keeps a persistent connection, lets you switch between the four AI tools on‑the‑fly, and manages a single working directory.
Single‑command shortcuts wechat‑codex, wechat‑claude, wechat‑opencode, wechat‑pi (and the wecom‑ equivalents) start the chosen CLI directly.
File transfer Images or generic files sent from WeChat are saved locally and the file path is appended to the prompt so the AI model can read it.
Rich remote commands /codex, /claude, /opencode, /pi to switch tools; /status, /model, /plan, /stop, /reset, /new, /resume, /confirm, /deny, /daemon‑stop, etc.
Emoji bindings Certain emojis at the start of a message can be bound to commands (e.g., ✅ → /confirm).
Context token handling The bridge keeps a context_token so replies are correctly routed back to the originating chat.
Cross‑platform support Works on Windows, macOS and Linux; uses node‑pty for PTY emulation where needed.
Installation & updates Distributed via npm (cli‑wechat‑bridge or the scoped @unlinearity/cli‑wechat‑bridge).
Troubleshooting helpers wechat‑daemon --doctor, detailed docs for PTY issues, proxy settings, token limits, etc.

How It Works – High‑Level Architecture

  1. Login / Pairing – You run wechat‑setup (QR‑code login) or wecom‑setup (Bot ID + Secret) to obtain credentials stored locally.
  2. Bridge Process – A Node.js runtime watches the WeChat/Enterprise WeChat channel for incoming messages.
  3. Adapter Layer – For each supported AI tool there is an adapter that knows how to start the CLI (via PTY or WebSocket RPC) and how to feed it a prompt.
  4. Message Flow
    • Chat message → bridge → appropriate adapter → local CLI.
    • CLI output (including final answer, status updates, approval requests) → bridge → chat.
  5. Daemon – When you start wechat‑daemon, the bridge stays alive, holds a lock on the working directory, and can switch adapters on demand without restarting the whole process.
  6. IPC – The daemon exposes a token‑protected local IPC endpoint so other programs (e.g., custom web panels) can send text to the same bridge.

Getting Started (Quick Steps)

  1. Prerequisites – Node ≥ 22.13, and one of the AI CLIs installed and reachable in PATH.
  2. Install – npm install -g cli-wechat-bridge.
  3. Log in – wechat-setup (scan QR) or wecom-setup (enter Bot ID/Secret).
  4. Send a test message from WeChat (e.g., hello). This primes the context_token.
  5. Run a CLI – wechat-codex (or any of the other shortcuts) inside your project folder, or start the persistent daemon with wechat-daemon.
  6. Control – Use the slash commands listed above to switch tools, stop a run, change the model, etc.

Who Maintains It?

The repository is owned by UNLINEARITY (GitHub user/organization). The README links to a product homepage, CI badge, and a fairly extensive documentation set, indicating an actively maintained open‑source project.


License

Dual‑licensing: AGPL‑3.0‑or‑later for open‑source use, with a commercial license option for closed‑source deployments.


Bottom line: CLI WeChat Bridge is a genuine tool that connects local AI‑coding command‑line interfaces to WeChat/Enterprise WeChat, letting you keep your preferred terminal workflow while issuing commands from a mobile chat client.

Related

  • Project
  • Project
  • Project
  • Project
  • Project