How fly-jelly/wechat-cli works
WeChat CLI is a local-data query tool: users initialize configuration and encryption keys, then invoke commands to inspect chats, messages, contacts, and related information as JSON or text. The main CLI creates shared application context and dispatches commands; that context loads configuration, keys, and a decrypted-database cache. Command modules query the local databases, with new-messages additionally persisting a check state. The README documents the full command suite and analytics/export capabilities. Some command and platform-scanner internals were not excerpted, so only indexed or documented relationships are shown.
Main entry points: main.py Command dispatcher · contacts.py Contact data access · context.py Shared app context · db_cache.py Decrypted DB cache
Components 26
CLI entry and setup
- Command dispatcher
wechat_cli/main.py - Initialization command
wechat_cli/commands/init.py - Configuration
wechat_cli/core/config.py - Shared app context
wechat_cli/core/context.py - Key scanner routing
wechat_cli/keys/__init__.py - macOS key scanner
wechat_cli/keys/scanner_macos.py - Linux key scanner
wechat_cli/keys/scanner_linux.py - Windows key scanner
wechat_cli/keys/scanner_windows.py - Shared key scanning
wechat_cli/keys/common.py
Local data access
- Decrypted DB cache
wechat_cli/core/db_cache.py - Database decryption
wechat_cli/core/crypto.py - Key path utilities
wechat_cli/core/key_utils.py - Contact data access
wechat_cli/core/contacts.py - Message query engine
wechat_cli/core/messages.py
Query capabilities
- Sessions and unread
wechat_cli/commands/sessions.py - Chat history
wechat_cli/commands/history.py - Message search
wechat_cli/commands/search.py - Contact lookup
wechat_cli/commands/contacts.py - Group members
wechat_cli/commands/members.py - Favorites
wechat_cli/commands/favorites.py - Chat statistics
wechat_cli/commands/stats.py - Conversation export
wechat_cli/commands/export.py - New messages
wechat_cli/commands/new_messages.py
Output
- JSON and text formatter
wechat_cli/output/formatter.py - Check-state file
wechat_cli/commands/new_messages.py
Other components
- CLI user
Connections 42
- CLI user → Command dispatcher: runs command
README.md - Command dispatcher → Shared app context: creates context
wechat_cli/main.py - Command dispatcher → Initialization command: dispatches init
wechat_cli/main.py - Command dispatcher → Sessions and unread: dispatches
wechat_cli/main.py - Command dispatcher → Chat history: dispatches
wechat_cli/main.py - Command dispatcher → Message search: dispatches
wechat_cli/main.py - Command dispatcher → Contact lookup: dispatches
wechat_cli/main.py - Command dispatcher → Group members: dispatches
wechat_cli/main.py - Command dispatcher → Favorites: dispatches
wechat_cli/main.py - Command dispatcher → Chat statistics: dispatches
wechat_cli/main.py - Command dispatcher → Conversation export: dispatches
wechat_cli/main.py - Command dispatcher → New messages: dispatches
wechat_cli/main.py - Shared app context → Configuration: loads config
wechat_cli/core/context.py - Shared app context → Decrypted DB cache: creates cache
wechat_cli/core/context.py - Shared app context → Key path utilities: strips key metadata
wechat_cli/core/context.py - Shared app context → Message query engine: finds message keys
wechat_cli/core/context.py - Initialization command → Configuration: loads setup
wechat_cli/commands/init.py - Initialization command → Key scanner routing: uses scanners
wechat_cli/commands/init.py - Key scanner routing → macOS key scanner: selects platform
wechat_cli/keys/__init__.py - Key scanner routing → Linux key scanner: selects platform
wechat_cli/keys/__init__.py - Key scanner routing → Windows key scanner: selects platform
wechat_cli/keys/__init__.py - macOS key scanner → Shared key scanning: uses shared scan
wechat_cli/keys/scanner_macos.py - Linux key scanner → Shared key scanning: uses shared scan
wechat_cli/keys/scanner_linux.py - Windows key scanner → Shared key scanning: uses shared scan
wechat_cli/keys/scanner_windows.py - Decrypted DB cache → Database decryption: decrypts databases
wechat_cli/core/db_cache.py - Decrypted DB cache → Key path utilities: resolves keys
wechat_cli/core/db_cache.py - Sessions and unread → Decrypted DB cache: reads session DB
wechat_cli/commands/sessions.py - Sessions and unread → Contact data access: loads contact names
wechat_cli/commands/sessions.py - Message search → Contact data access: loads contact names
wechat_cli/commands/search.py - Message search → Message query engine: searches messages
wechat_cli/commands/search.py - Chat history → Message query engine: queries history
wechat_cli/commands/history.py - Conversation export → Message query engine: queries messages
wechat_cli/commands/export.py - Conversation export → Contact data access: resolves contacts
wechat_cli/commands/export.py - Contact lookup → Contact data access: queries contacts
wechat_cli/commands/contacts.py - Group members → Contact data access: loads members
wechat_cli/commands/members.py - Favorites → Contact data access: resolves contacts
wechat_cli/commands/favorites.py - Chat statistics → Message query engine: computes statistics
wechat_cli/commands/stats.py - New messages → Decrypted DB cache: reads session DB
wechat_cli/commands/new_messages.py - New messages → Check-state file: reads and writes
wechat_cli/commands/new_messages.py - Message search → JSON and text formatter: formats output
wechat_cli/commands/search.py - Sessions and unread → JSON and text formatter: formats output
wechat_cli/commands/sessions.py - New messages → JSON and text formatter: formats output
wechat_cli/commands/new_messages.py