| Crates.io | wx-uploader |
| lib.rs | wx-uploader |
| version | 0.6.0 |
| created_at | 2025-08-02 22:58:32.339346+00 |
| updated_at | 2025-09-13 05:17:06.125917+00 |
| description | A tool to upload articles to WeChat Official Account |
| homepage | https://github.com/tyrchen/wx-uploader |
| repository | https://github.com/tyrchen/wx-uploader |
| max_upload_size | |
| id | 1779189 |
| size | 223,749 |
A command-line tool to upload markdown files to WeChat public account with automatic AI-powered cover image generation. See README_CN.md for Chinese version.
Install directly from crates.io:
cargo install wx-uploader
Or build from source:
git clone https://github.com/tyrchen/wx-uploader.git
cd wx-uploader
cargo install --path .
Before using this tool, you need to set up the following environment variables:
# Required: WeChat public account credentials
export WECHAT_APP_ID="your_app_id"
export WECHAT_APP_SECRET="your_app_secret"
# Optional: OpenAI API key for automatic cover image generation
export OPENAI_API_KEY="your_openai_api_key"
# Upload all .md files that don't have `published: true` in their frontmatter
wx-uploader .
# Upload from a specific directory
wx-uploader ./posts
# Enable verbose output
wx-uploader --verbose ./posts
# Force upload a specific file (ignores publish status)
wx-uploader ./2025/08/01-chat-with-ai.md
published: true in its frontmatter, it will be uploadedpublished: draft and the cover filename (if generated)---
title: My Article Title
published: draft # or 'true' to skip upload
cover: cover.png # optional, auto-generated if missing and OpenAI key is set
description: Article description
author: Author Name
theme: lapis # optional theme
---
Your markdown content here...
When the OPENAI_API_KEY environment variable is set, the tool will automatically generate beautiful cover images for articles that don't have one specified.
For an article about "Building Rust Applications", the AI might generate a scene like:
"A cozy workshop filled with intricate gears and glowing mechanical tools, where a craftsman carefully assembles clockwork mechanisms. Warm golden light streams through tall windows, illuminating floating rust particles that sparkle like fireflies in the dusty air."
This becomes a beautiful Studio Ghibli-style cover image that visually represents your content.
The project includes comprehensive unit and integration tests:
# Run all tests
cargo test
# Run tests with output
cargo test -- --nocapture
# Run specific test module
cargo test test_frontmatter
# Run integration tests only
cargo test --test integration_tests
# Run clippy for linting
cargo clippy --all-targets --all-features
# Check for security vulnerabilities
cargo audit
# Format code
cargo fmt
# Generate documentation
cargo doc --open
wx-uploader/
├── src/
│ ├── main.rs # CLI entry point
│ ├── lib.rs # Public API
│ ├── cli.rs # Command-line interface
│ ├── error.rs # Error handling
│ ├── models.rs # Data structures
│ ├── markdown.rs # Markdown parsing
│ ├── openai.rs # AI integration
│ ├── output.rs # Console output formatting
│ └── wechat.rs # WeChat API integration
└── tests/
└── integration_tests.rs # Integration tests
published: true will be skipped during directory scans"true") and boolean (true) values for the published fieldMIT
Contributions are welcome! Please feel free to submit a Pull Request.