wechat-pi
v0.1.0
Published
WeChat bridge for Pi Network AI coding agent
Downloads
19
Maintainers
Readme
Pi WeChat Agent Bridge
A TypeScript tool that bridges WeChat messaging with Pi's AI coding agent, enabling natural language interaction with an AI coding assistant through WeChat.
What is This?
WeChat Pi Bridge allows you to interact with Pi's AI coding agent directly from WeChat. This means you can:
- Send coding instructions and questions to the Pi agent
- Execute shell commands remotely
- Manage agent sessions (new session, switch models, compact history)
- All through familiar WeChat conversations
Quick Start
Installation
# Install globally for command-line usage
npm install -g wechat-pi
# Or run directly with npx
npx wechat-piRunning the Bridge
# Start the bridge with default settings
wechat-pi
# Or development mode (directly from source)
pnpm devAuthentication
- Launch the bridge - it will display a QR code in the terminal
- Open WeChat and scan the QR code
- Once authenticated, you can start sending messages
Usage
Sending Messages
After authentication, simply send messages to interact with the Pi agent:
Regular Text Messages
Ask questions or give coding instructions:
- "How do I read a file in Python?"
- "Create a function that sorts an array"
- "What does this code do? [paste code]"
Shell Commands
Execute terminal commands (prefix with !):
!ls -la
!git status
!npm testSpecial Commands
These commands control the bridge behavior:
| Command | Description |
|---------|-------------|
| /new | Start a fresh conversation session |
| /model [name] | List available models or switch to a specific model |
| /compact | Compact conversation history to reduce token usage |
| /session | Show session information (file, ID, messages, tokens, model) |
| /name [name] | Set or display the session name |
Command Line Options
wechat-pi [options]
Options:
--no-session Disable session persistence (in-memory only)
--session-dir Custom directory for session storage
--work-dir Working directory for the agent (default: current directory)
--verbose Enable verbose logging
--logout Clear WeChat credentials and exit
--status Show bridge status and exit
--help Show help informationDevelopment
Prerequisites
- Node.js >= 16
- pnpm (recommended) or npm
Setup
# Install dependencies
pnpm install
# Run in development mode
pnpm dev
# Run tests
pnpm test
# Build for production
pnpm build
# Run linter
pnpm lintProject Structure
wechat-pi/
├── src/
│ ├── bridge.ts # Main bridge logic
│ ├── cli.ts # Command-line interface
│ └── types.ts # TypeScript type definitions
├── dist/ # Compiled JavaScript
├── test/ # Test files
└── package.json # Package configurationHow It Works
The bridge acts as a mediator between WeChat messages and the Pi agent:
[WeChat] <──> [WeChat Bot] <──> [Bridge] <──> [Pi Agent Session] <──> [AI Models]- Message Receiving: The WeChat bot receives messages from authenticated users
- Command Processing: Special commands (
/new,/model,!cmd) are handled directly - Agent Interaction: Regular messages are sent to the Pi agent session
- Response Delivery: Assistant replies are sent back through WeChat
License
MIT © Jiajun Chen
