[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-852":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":30,"lastSyncTime":31,"discoverSource":32},852,"wechat-cli","huohuoer\u002Fwechat-cli","huohuoer","A CLI tool to query your local WeChat data — chat history, contacts, sessions, favorites, and more. Designed for LLM integration.","https:\u002F\u002Fwesight.ai\u002F",null,"Python",1338,1544,10,6,0,49,140,569,147,107.57,"Apache License 2.0",false,"main",true,[],"2026-06-12 04:00:06","\u003Cdiv align=\"center\">\n\n# WeChat CLI\n\n**Query your local WeChat data from the command line.**\n\n[![npm version](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@canghe_ai\u002Fwechat-cli.svg)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@canghe_ai\u002Fwechat-cli)\n[![License: Apache-2.0](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-Apache%202.0-blue.svg)](https:\u002F\u002Fopensource.org\u002Flicenses\u002FApache-2.0)\n[![Platform](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fplatform-macOS%20%7C%20Windows%20%7C%20Linux-lightgrey.svg)](https:\u002F\u002Fgithub.com\u002Ffreestylefly\u002Fwechat-cli)\n\nChat history · Contacts · Sessions · Favorites · Statistics · Export\n\n[中文文档](README_CN.md)\n\n\u003C\u002Fdiv>\n\n---\n\n## ✨ Highlights\n\n- **🚀 Zero-config install** — `npm install -g` and you're done, no Python needed\n- **📦 11 commands** — sessions, history, search, contacts, members, stats, export, favorites, unread, new-messages, init\n- **🤖 AI-first** — JSON output by default, designed for LLM agent tool calls\n- **🔒 Fully local** — on-the-fly SQLCipher decryption, data never leaves your machine\n- **📊 Rich analytics** — top senders, message type breakdown, 24-hour activity charts\n- **📝 Flexible export** — Markdown or plain text, with time range filtering\n\n---\n\n## 📥 Installation (For Humans)\n\nAI Agents — skip ahead to \"Installation (For AI Agents)\" below.\n\n### npm (Recommended)\n\n```bash\nnpm install -g @canghe_ai\u002Fwechat-cli\n```\n\n> Currently ships a **macOS arm64** binary. Other platforms can use the pip method below. PRs with additional platform binaries are welcome.\n\n**Update to the latest version:**\n\n```bash\nnpm update -g @canghe_ai\u002Fwechat-cli\n```\n\n### pip\n\n```bash\npip install wechat-cli\n```\n\nRequires Python >= 3.10.\n\n### From Source\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Ffreestylefly\u002Fwechat-cli.git\ncd wechat-cli\npip install -e .\n```\n\n---\n\n## 📥 Installation (For AI Agents)\n\nSimply paste the following prompt into Claude Code, OpenClaw, or any AI coding agent:\n\n```bash\n帮我配置并安装：npm install -g @canghe_ai\u002Fwechat-cli\n```\n\nFor example, in Claude Code:\n\n![install-claude-code-1](image\u002Finstall-claude-code-1.png)\n\nNote: Make sure you have Node.js installed first. You can ask your agent to set it up if needed.\n\n---\n\n## 🚀 Quick Start\n\n### Step 1 — Initialize\n\nMake sure WeChat is running, then:\n\n```bash\n# macOS\u002FLinux: may need sudo for memory scanning\nsudo wechat-cli init\n\n# Windows: run in a terminal with sufficient privileges\nwechat-cli init\n```\n\nThis auto-detects your WeChat data directory, extracts encryption keys, and saves config to `~\u002F.wechat-cli\u002F`.\n\n![init-claude-code-1](image\u002Finit-claude-code-1.png)\n\nOn macOS, you'll need to run the `sudo` command and enter your password:\n\n![init-claude-code-2](image\u002Finit-claude-code-2.png)\n\nIf you have multiple WeChat accounts logged in locally, you'll be prompted to choose one. Select the account you're currently using (the default is the first one):\n\n![init-claude-code-3](image\u002Finit-claude-code-3.png)\n\nIf you're unsure which WeChat account is currently active, navigate to the data folder and sort by modification date to find out:\n\n![init-claude-code-4](image\u002Finit-claude-code-4.png)\n\n#### macOS: Grant Full Disk Access to Terminal\n\nBefore running `init`, make sure your terminal app has **Full Disk Access**:\n\n1. Open **System Settings → Privacy & Security → Full Disk Access**\n2. Add your terminal app (e.g. Terminal, iTerm2, or the terminal in your IDE)\n3. Restart the terminal after enabling\n\nWithout this permission, the tool cannot access WeChat's data directory and key extraction will fail.\n\n#### macOS: `task_for_pid failed` Error\n\nOn some macOS systems, `init` may fail with `task_for_pid failed` even when running with `sudo`. This is due to macOS security restrictions on process memory access.\n\n**WeChat CLI will automatically attempt to fix this** by re-signing WeChat with the required entitlement (original entitlements are preserved). Just follow the on-screen instructions:\n\n1. The tool will re-sign WeChat automatically\n2. Quit WeChat completely (not just minimize)\n3. Reopen WeChat and log in\n4. Run `sudo wechat-cli init` again\n\nIf auto re-signing fails, you can do it manually:\n\n```bash\n# Quit WeChat first, then:\nsudo codesign --force --sign - --entitlements \u002Fdev\u002Fstdin \u002FApplications\u002FWeChat.app \u003C\u003C'EOF'\n\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE plist PUBLIC \"-\u002F\u002FApple\u002F\u002FDTD PLIST 1.0\u002F\u002FEN\" \"http:\u002F\u002Fwww.apple.com\u002FDTDs\u002FPropertyList-1.0.dtd\">\n\u003Cplist version=\"1.0\">\n\u003Cdict>\n    \u003Ckey>com.apple.security.get-task-allow\u003C\u002Fkey>\n    \u003Ctrue\u002F>\n\u003C\u002Fdict>\n\u003C\u002Fplist>\nEOF\n```\n\n> **Heads up:** Re-signing WeChat is safe and will **not** cause account issues or bans. However, it may affect WeChat's auto-update mechanism. If you notice any feature not working properly, or want to update WeChat to the latest version, simply re-download and reinstall WeChat from the [official website](https:\u002F\u002Fmac.weixin.qq.com\u002F) — no need to re-run `init`, your existing config and keys will continue to work.\n\n### Step 2 — Use It\n\n```bash\nwechat-cli sessions                        # Recent chats\nwechat-cli history \"Alice\" --limit 20      # Chat messages\nwechat-cli search \"deadline\" --chat \"Team\" # Search messages\n```\n\n---\n\n## 🤖 Using with AI Agents\n\nWeChat CLI is designed as an AI agent tool. All commands output structured JSON by default.\n\n### Claude Code\n\nAdd to your project's `CLAUDE.md`:\n\n```markdown\n## WeChat CLI\n\nYou can use `wechat-cli` to query my local WeChat data.\n\nCommon commands:\n- `wechat-cli sessions --limit 10` — list recent chats\n- `wechat-cli history \"NAME\" --limit 20 --format text` — read chat history\n- `wechat-cli search \"KEYWORD\" --chat \"CHAT_NAME\"` — search messages\n- `wechat-cli contacts --query \"NAME\"` — search contacts\n- `wechat-cli unread` — show unread sessions\n- `wechat-cli new-messages` — get messages since last check\n- `wechat-cli members \"GROUP\"` — list group members\n- `wechat-cli stats \"CHAT\" --format text` — chat statistics\n```\n\nThen in conversation you can ask Claude things like:\n- \"Check my unread WeChat messages\"\n- \"Search for messages about the project deadline in the Team group\"\n- \"Who sent the most messages in the AI group this week?\"\n\n### OpenClaw \u002F MCP Integration\n\nWeChat CLI works with any AI tool that can execute shell commands:\n\n```bash\n# Get recent conversations\nwechat-cli sessions --limit 5\n\n# Read specific chat\nwechat-cli history \"Alice\" --limit 30 --format text\n\n# Search with filters\nwechat-cli search \"report\" --type file --limit 10\n\n# Monitor for new messages (great for cron\u002Fautomation)\nwechat-cli new-messages --format text\n```\n\n---\n\n## 📖 Command Reference\n\n### `sessions` — Recent Chats\n\n```bash\nwechat-cli sessions                        # Last 20 sessions\nwechat-cli sessions --limit 10             # Last 10\nwechat-cli sessions --format text          # Human-readable\n```\n\n### `history` — Chat Messages\n\n```bash\nwechat-cli history \"Alice\"                 # Last 50 messages\nwechat-cli history \"Alice\" --limit 100 --offset 50\nwechat-cli history \"Team\" --start-time \"2026-04-01\" --end-time \"2026-04-03\"\nwechat-cli history \"Alice\" --type link     # Only links\nwechat-cli history \"Alice\" --format text\n```\n\n**Options:** `--limit`, `--offset`, `--start-time`, `--end-time`, `--type`, `--format`\n\n### `search` — Search Messages\n\n```bash\nwechat-cli search \"hello\"                  # Global search\nwechat-cli search \"hello\" --chat \"Alice\"   # In specific chat\nwechat-cli search \"meeting\" --chat \"TeamA\" --chat \"TeamB\"  # Multiple chats\nwechat-cli search \"report\" --type file     # Only files\n```\n\n**Options:** `--chat` (repeatable), `--start-time`, `--end-time`, `--limit`, `--offset`, `--type`, `--format`\n\n### `contacts` — Contact Search & Details\n\n```bash\nwechat-cli contacts --query \"Li\"           # Search contacts\nwechat-cli contacts --detail \"Alice\"       # Contact details\nwechat-cli contacts --detail \"wxid_xxx\"    # By WeChat ID\n```\n\nReturns: nickname, remark, WeChat ID, bio, avatar URL, account type.\n\n### `members` — Group Members\n\n```bash\nwechat-cli members \"Team Group\"            # All members (JSON)\nwechat-cli members \"Team Group\" --format text\n```\n\n### `stats` — Chat Statistics\n\n```bash\nwechat-cli stats \"Team Group\"\nwechat-cli stats \"Alice\" --start-time \"2026-04-01\" --end-time \"2026-04-03\"\nwechat-cli stats \"Team Group\" --format text\n```\n\nReturns: total messages, type breakdown, top 10 senders, 24-hour activity distribution.\n\n### `export` — Export Conversations\n\n```bash\nwechat-cli export \"Alice\" --format markdown              # To stdout\nwechat-cli export \"Alice\" --format txt --output chat.txt  # To file\nwechat-cli export \"Team\" --start-time \"2026-04-01\" --limit 1000\n```\n\n**Options:** `--format markdown|txt`, `--output`, `--start-time`, `--end-time`, `--limit`\n\n### `favorites` — WeChat Bookmarks\n\n```bash\nwechat-cli favorites                       # Recent bookmarks\nwechat-cli favorites --type article        # Articles only\nwechat-cli favorites --query \"machine learning\"  # Search\n```\n\n**Types:** text, image, article, card, video\n\n### `unread` — Unread Sessions\n\n```bash\nwechat-cli unread                          # All unread sessions\nwechat-cli unread --limit 10 --format text\n```\n\n### `new-messages` — Incremental New Messages\n\n```bash\nwechat-cli new-messages                    # First: return unread + save state\nwechat-cli new-messages                    # Subsequent: only new since last call\n```\n\nState saved at `~\u002F.wechat-cli\u002Flast_check.json`. Delete to reset.\n\n---\n\n## 🔍 Message Type Filter\n\nThe `--type` option (on `history` and `search`):\n\n| Value | Description |\n|-------|-------------|\n| `text` | Text messages |\n| `image` | Images |\n| `voice` | Voice messages |\n| `video` | Videos |\n| `sticker` | Stickers\u002Femojis |\n| `location` | Location shares |\n| `link` | Links and app messages |\n| `file` | File attachments |\n| `call` | Voice\u002Fvideo calls |\n| `system` | System messages |\n\n---\n\n## 💻 System Requirements\n\n- **macOS** ≥ 26.3.1\n- **WeChat for Mac** ≤ 4.1.8.100\n\n> Older macOS versions or newer WeChat versions may not be compatible.\n\n---\n\n## 🖥️ Platform Support\n\n| Platform | Status | Notes |\n|----------|--------|-------|\n| macOS (Apple Silicon) | ✅ Supported | Bundled arm64 binary |\n| macOS (Intel) | ✅ Supported | x86_64 binary needed |\n| Windows | ✅ Supported | Reads Weixin.exe process memory |\n| Linux | ✅ Supported | Reads \u002Fproc\u002Fpid\u002Fmem, requires root |\n\n---\n\n## 🔧 How It Works\n\nWeChat stores chat data in SQLCipher-encrypted SQLite databases locally. WeChat CLI:\n\n1. **Extracts keys** — scans WeChat process memory for encryption keys (`init`)\n2. **Decrypts on-the-fly** — transparent page-level AES-256-CBC decryption with caching\n3. **Queries locally** — all data stays on your machine, no network access\n\n---\n\n## 📄 License\n\n[Apache License 2.0](LICENSE)\n\n---\n\n## ⚖️ Disclaimer\n\nThis project is a local data query tool for personal use only. Please note:\n\n- **Read-only** — this tool only reads locally stored data, it does not send, modify, or delete any messages\n- **No cloud transmission** — all data stays on your local machine, nothing is uploaded to any server\n- **No WeChat ecosystem disruption** — this tool does not interfere with WeChat's normal operation, does not automate any actions, and does not violate WeChat's Terms of Service\n- **Use at your own risk** — this project is for personal learning and research purposes only. Users are responsible for ensuring compliance with local laws and regulations\n\n---\n\n## 🙏 Acknowledgements\n\nThis project is built on top of [wechat-decrypt](https:\u002F\u002Fgithub.com\u002Fylytdeng\u002Fwechat-decrypt), which provides the core WeChat database decryption and data parsing capabilities.\n\n---\n\n## ⭐ Star History\n\n[![Star History Chart](https:\u002F\u002Fapi.star-history.com\u002Fsvg?repos=freestylefly\u002Fwechat-cli&type=Date)](https:\u002F\u002Fstar-history.com\u002F#freestylefly\u002Fwechat-cli&Date)\n","WeChat CLI 是一个命令行工具，用于查询本地微信数据，包括聊天记录、联系人、会话、收藏等。其核心功能包括零配置安装、11个命令选项（如会话、历史记录、搜索、联系人等）、默认JSON输出格式便于与大语言模型集成、完全本地化处理确保数据安全不外泄以及丰富的数据分析能力。该工具适合需要从技术角度分析个人或团队微信使用情况的用户，也适用于开发者希望将微信数据整合到自动化流程或AI应用中。支持macOS、Windows和Linux平台，并提供npm和pip两种安装方式。",2,"2026-06-11 02:39:46","CREATED_QUERY"]