Convert Markdown articles to WeChat Official Account format and submit them to the drafts box. Based on wenyan-cli, supports themes, code highlighting, and local/network image uploads.
Trigger Scenarios
- Requests such as "post to Official Account," "push to Official Account," or "submit Official Account draft."
- Need to format Markdown as WeChat Official Account rich text with images.
- Need to choose an article theme, code highlighting, or troubleshoot image/API/whitelist issues.
Security Boundaries
- By default, only submit to the drafts box; do not replace review and formal publishing in the Official Account backend.
- Only perform networked publishing when explicitly requested; first run
--dry-run。 - Read from the current shell, CI Secret, or external key manager
WECHAT_APP_ID、WECHAT_APP_SECRET; writing credentials into repositories, templates, articles, or command history is prohibited. - Before publishing, run
scripts/validate_article.py. If suspected credentials, private keys, or local machine paths are found, stop and require cleanup, and do not echo the matching values. - Do not read private host environment configuration, personal configuration, or fixed absolute paths; do not automatically install global dependencies.
Standard Process
-
Prepare a Markdown file with frontmatter, preferably copying
assets/templates/article-template.md。 -
In the frontmatter, fill in
titleandcover; keep at least one accessible image in the body as a fallback cover. -
Use
python3 scripts/validate_article.py ARTICLE.mdto check the structure and sensitive information. -
Use
scripts/publish.sh --dry-run ARTICLE.mdpreview command. -
After explicitly obtaining the intent to "submit draft," set the credentials and execute:
export WECHAT_APP_ID='从密钥管理器注入的值' export WECHAT_APP_SECRET='从密钥管理器注入的值' ./scripts/publish.sh ARTICLE.md lapis solarized-light -
Review the draft in the WeChat Official Account backend; when formal publishing is needed, the operator completes it in the backend.
Templates and Reference Materials
assets/templates/article-template.md: General article skeleton.assets/templates/technical-tutorial.md: Technical tutorial template.assets/templates/product-update.md: Product/version update template.assets/templates/weekly-digest.md: Weekly report or news roundup template.assets/templates/cover-prompt.txt: Cover image generation prompt template.references/themes.md: Theme and code highlighting selection.references/content-checklist.md: Pre-publishing content checklist.references/troubleshooting.md: Common errors and troubleshooting paths.
Command Quick Reference
./scripts/publish.sh --help
./scripts/publish.sh --dry-run path/to/article.md
./scripts/publish.sh path/to/article.md
./scripts/setup.sh
publish.sh By default, use lapis theme and solarized-light code highlighting, which can also be overridden via parameters or environment variable WECHAT_PUBLISH_THEME、WECHAT_PUBLISH_HIGHLIGHT .