{"_id":"@apexglory/agent-wechat2-cli","name":"@apexglory/agent-wechat2-cli","dist-tags":{"latest":"0.11.15"},"versions":{"0.11.15":{"name":"@apexglory/agent-wechat2-cli","version":"0.11.15","type":"module","bin":{"wx":"dist/cli.js"},"dependencies":{"qrcode-terminal":"^0.12.0"},"devDependencies":{"commander":"^14.0.3","esbuild":"^0.25.0","@types/node":"^22","@types/qrcode-terminal":"^0.12.2","typescript":"^5.4.5","@apexglory/agent-wechat2-shared":"0.11.15"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/apexglory/agent-wechat.git","directory":"packages/cli"},"scripts":{"build":"node build.js","typecheck":"tsc --noEmit"},"_id":"@apexglory/agent-wechat2-cli@0.11.15","description":"Command-line tool for managing agent-wechat2 containers and interacting with WeChat.","bugs":{"url":"https://github.com/apexglory/agent-wechat/issues"},"homepage":"https://github.com/apexglory/agent-wechat#readme","_integrity":"sha512-hDWhmR6cMFSo3Ts2z3W79cMAykw+zJy5np0nV4sdgdreyXivRHp3yzpN7Il5gAojY+0u4itGdhTTrGaK2NjWWg==","_resolved":"/private/var/folders/yf/4y5rz5254qg7k8v7bplkjjm40000gn/T/81b5b83ee3223ea49e0ca56cecc813c6/apexglory-agent-wechat2-cli-0.11.15.tgz","_from":"file:apexglory-agent-wechat2-cli-0.11.15.tgz","_nodeVersion":"24.11.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-hDWhmR6cMFSo3Ts2z3W79cMAykw+zJy5np0nV4sdgdreyXivRHp3yzpN7Il5gAojY+0u4itGdhTTrGaK2NjWWg==","shasum":"973c49ecf877b9811eea8af3d9424e8a5f3ca2e0","tarball":"https://registry.npmjs.org/@apexglory/agent-wechat2-cli/-/agent-wechat2-cli-0.11.15.tgz","fileCount":3,"unpackedSize":306203,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCq5pxXgfd3AtB42L8deHRJHI9X7kLuvC1Yr/0kVomGpAIgCYGLf1E2vaMd3ZrVq0I+rEyJYFjpSU1dtAsmzEfyMcY="}]},"_npmUser":{"name":"apexglory","email":"gloryofapex@gmail.com"},"directories":{},"maintainers":[{"name":"apexglory","email":"gloryofapex@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/agent-wechat2-cli_0.11.15_1778841831116_0.2749755442368451"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-15T10:43:51.015Z","0.11.15":"2026-05-15T10:43:51.257Z","modified":"2026-05-15T10:43:51.462Z"},"maintainers":[{"name":"apexglory","email":"gloryofapex@gmail.com"}],"description":"Command-line tool for managing agent-wechat2 containers and interacting with WeChat.","homepage":"https://github.com/apexglory/agent-wechat#readme","repository":{"type":"git","url":"git+https://github.com/apexglory/agent-wechat.git","directory":"packages/cli"},"bugs":{"url":"https://github.com/apexglory/agent-wechat/issues"},"readme":"# @apexglory/agent-wechat2-cli\n\nCommand-line tool for managing agent-wechat2 containers and interacting with WeChat.\n\n**[Documentation](https://apexglory.github.io/agent-wechat/getting-started/cli/commands/)**\n\n## Install\n\n```bash\nnpm install -g @apexglory/agent-wechat2-cli\n```\n\nThis installs the `wx` command globally.\n\n## Prerequisites\n\n- [Docker](https://docs.docker.com/get-docker/) installed and running\n\n`wx up` automatically pulls the Docker image from ghcr.io if it isn't found locally.\n\n> **Note:** agent-wechat requires `SYS_PTRACE` and `seccomp=unconfined` to interact with the WeChat desktop process. It cannot run in serverless or restricted container environments (AWS Fargate, Cloud Run, etc.). Use a VM or bare-metal Docker host.\n\n## Quick Start\n\n```bash\n# Start the container\nwx up\n\n# Check status\nwx status\n\n# Log in (displays QR code in terminal)\nwx auth login\n\n# List chats\nwx chats list\n\n# Send a message\nwx messages send <chatId> --text \"Hello\"\n```\n\n## Commands\n\n### Container\n\n| Command | Description |\n|---------|-------------|\n| `wx up [--proxy user:pass@host:port]` | Start the agent-wechat2 container |\n| `wx down` | Stop and remove the container |\n| `wx logs` | Tail container logs |\n| `wx status` | Show container up/down status and login status (when available) |\n\n### Auth\n\n| Command | Description |\n|---------|-------------|\n| `wx auth login` | Log in to WeChat (shows QR code) |\n| `wx auth logout` | Log out of WeChat |\n| `wx auth status` | Check login status |\n| `wx auth token` | Show current auth token |\n| `wx auth token --regenerate` | Generate a new auth token |\n\nLogin options:\n- `--timeout <seconds>` — login timeout (default: 300)\n- `--new` — switch to a new account instead of existing\n\n### Chats\n\n| Command | Description |\n|---------|-------------|\n| `wx chats list` | List chats from WeChat |\n| `wx chats get <chatId>` | Get details for a specific chat |\n| `wx chats find <name>` | Search chats by display name |\n| `wx chats open <chatId>` | Open a chat in the WeChat UI |\n\nOptions: `--limit <n>`, `--offset <n>`, `--json`\n\n### Messages\n\n| Command | Description |\n|---------|-------------|\n| `wx messages list <chatId>` | List messages in a chat |\n| `wx messages send <chatId>` | Send a message |\n| `wx messages media <chatId> <localId>` | Download a media attachment |\n\nSend options:\n- `--text \"message\"` — send text\n- `--image photo.jpg` — send an image\n- `--file document.pdf` — send a file\n\nMedia options:\n- `--output <path>` — save to a specific file path\n\n### Sessions\n\n| Command | Description |\n|---------|-------------|\n| `wx session list` | List all sessions |\n| `wx session create <name>` | Create a new session |\n| `wx session start <id>` | Start a session |\n| `wx session stop <id>` | Stop a session |\n| `wx session delete <id>` | Delete a session |\n\n### Debug\n\n| Command | Description |\n|---------|-------------|\n| `wx screenshot [file]` | Save a screenshot (default: screenshot.png) |\n| `wx a11y` | Dump the accessibility tree (`--format json|aria`) |\n\n## Global Options\n\n| Option | Description |\n|--------|-------------|\n| `-s, --session <name>` | Use a specific session (default: \"default\") |\n| `-V, --version` | Show version |\n| `-h, --help` | Show help |\n\n## Configuration\n\nThe CLI reads configuration from environment variables and a local token file:\n\n| Source | Description |\n|--------|-------------|\n| `AGENT_WECHAT_URL` | Server URL (default: `http://localhost:6174`) |\n| `AGENT_WECHAT_TOKEN` | Auth token (overrides token file) |\n| `~/.config/agent-wechat2/token` | Auto-generated auth token |\n\nThe auth token is generated automatically on first run and shared with the container via a read-only volume mount.\n\n## Running the Container\n\nThere are two ways to run the agent-wechat2 container.\n\n> **Note:** agent-wechat requires `SYS_PTRACE` and `seccomp=unconfined` because it uses ptrace to interact with the WeChat desktop process. It cannot run in serverless or restricted container environments (AWS Fargate, Cloud Run, Azure Container Instances, etc.). Use a VM or bare-metal Docker host.\n\n### Option 1: `wx up` (local development)\n\nThe simplest way. `wx up` pulls/starts the container with the right flags, volume mounts, and auth token:\n\n```bash\nwx up\n```\n\nThis starts a container named `agent-wechat2` with:\n- **Port 6174** — REST API + VNC web viewer at `/vnc/` (exposed to all interfaces)\n- Persistent volumes for data and WeChat home directory\n- Auth token from `~/.config/agent-wechat2/token` (auto-generated on first run)\n\nTo route all container traffic through a proxy:\n\n```bash\nwx up --proxy user:pass@host:port\n```\n\nThis sets up a transparent proxy (redsocks + iptables) inside the container — invisible to WeChat. Prefix with `socks5://` for SOCKS5 proxies.\n\n### Option 2: Docker Compose (production / networked)\n\nFor production or when running alongside other services (e.g., OpenClaw), use the `docker-compose.yml` in the repo root as a reference:\n\n```yaml\nservices:\n  agent-wechat2:\n    image: ghcr.io/apexglory/agent-wechat2:latest\n    container_name: agent-wechat2\n    security_opt:\n      - seccomp=unconfined\n    cap_add:\n      - SYS_PTRACE\n      - NET_ADMIN\n    ports:\n      - \"6174:6174\"\n    volumes:\n      - agent-wechat2-data:/data\n      - agent-wechat2-home:/home/wechat\n      - ~/.config/agent-wechat2/token:/data/auth-token:ro\n    environment:\n      - PROXY=${PROXY:-}    # optional: user:pass@host:port\n    restart: unless-stopped\n\nvolumes:\n  agent-wechat2-data:\n  agent-wechat2-home:\n```\n\nGenerate a token before starting:\n\n```bash\nmkdir -p ~/.config/agent-wechat\nopenssl rand -hex 32 > ~/.config/agent-wechat2/token\nchmod 600 ~/.config/agent-wechat2/token\n```\n\nIf running alongside OpenClaw on the same Docker network, set `serverUrl` to `http://agent-wechat2:6174` in your OpenClaw config.\n\n### Building locally\n\nTo build the Docker image from source instead of pulling from ghcr.io:\n\n```bash\n# From the repo root — auto-detects host architecture\npnpm build:image\n\n# Or specify architecture\npnpm build:image:arm64\npnpm build:image:amd64\n```\n","readmeFilename":"README.md","_rev":"1-0f4596effe8b3c8dd9c6269103db63b4"}