npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fateforge/wechat-mp-cli

v1.0.5

Published

AI-native CLI for WeChat Official Account drafting, publishing, assets, comments, analytics, menus, users, and webhooks

Downloads

348

Readme

wechat-mp-cli

English | 中文

CI npm version License: MIT

AI-native CLI for WeChat Official Account operations. The current milestone is API-first: account setup, token checks, image processing/upload, Markdown-to-draft creation, draft management, publish lifecycle, comments, article analytics, permanent and temporary materials, custom menus, remote API proxy helpers, and webhook verification.

Why This Exists

Most WeChat Official Account workflows are browser-heavy and hard for agents to operate safely. wechat-mp-cli exposes the workflow as a deterministic CLI contract:

  • JSON envelope output by default.
  • context, doctor, and reference for live self-description.
  • --dry-run to --confirm <confirm_token> for writes.
  • Local encrypted AppSecret storage with environment variable override.
  • Stable exit codes and E_* error codes for agent recovery.

Worst-case risk tier: T2. This tool can create drafts and submit public publication jobs with the configured WeChat credential.

Install

npm install -g @fateforge/wechat-mp-cli
npx skills add fatecannotbealtered/wechat-mp-cli -y -g

Local development:

make build
./bin/wechat-mp-cli context --compact

Configuration

Config file: ~/.wechat-mp-cli/config.json.

Environment variables take precedence:

| Variable | Purpose | | --- | --- | | WECHAT_MP_CLI_ACCOUNT | Account alias for env-provided credentials | | WECHAT_MP_CLI_APP_ID | WeChat Official Account AppID | | WECHAT_MP_CLI_APP_SECRET | WeChat Official Account AppSecret | | WECHAT_MP_CLI_API_BASE | API base URL override, defaults to https://api.weixin.qq.com | | WECHAT_MP_CLI_API_PROXY | Optional API proxy, for example socks5://127.0.0.1:1080 |

Add a saved account:

export WECHAT_SECRET=...
wechat-mp-cli setup account add --alias prod --app-id wx123 --secret-env WECHAT_SECRET --default --dry-run --compact
wechat-mp-cli setup account add --alias prod --app-id wx123 --secret-env WECHAT_SECRET --default --confirm <confirm_token> --compact

Core Workflow

wechat-mp-cli context --compact
wechat-mp-cli doctor --compact
wechat-mp-cli reference --compact

wechat-mp-cli setup account test --account prod --compact
wechat-mp-cli token refresh --account prod --compact

wechat-mp-cli image upload cover.png --type material --account prod --dry-run --compact
wechat-mp-cli draft create --markdown article.md --account prod --dry-run --compact
wechat-mp-cli publish submit --media-id <draft_media_id> --account prod --dry-run --compact
wechat-mp-cli publish status --publish-id <publish_id> --account prod --compact

Writes must be repeated with the returned confirm_token. Tokens bind the operation, payload hash, expiry, and a machine-local HMAC secret.

Markdown frontmatter can supply draft metadata:

---
title: Article title
author: Alice
summary: Short summary
cover: imgs/cover.png
sourceUrl: https://example.com/original
need_open_comment: 1
only_fans_can_comment: 0
---

Local inline images are uploaded to WeChat body-image storage and <img src> values are replaced with returned WeChat URLs after confirmation. The cover image can come from --cover-media-id, --cover-file, frontmatter cover, or the first local inline image.

Remote API Egress

If your local IP is not in the WeChat API allowlist, run an SSH SOCKS tunnel through an allowlisted server:

wechat-mp-cli remote ssh-command --host server.example.com --user deploy --local-port 1080 --compact
ssh -N -D 127.0.0.1:1080 [email protected]
wechat-mp-cli setup proxy set --url socks5://127.0.0.1:1080 --dry-run --compact

Current Commands

| Area | Commands | | --- | --- | | Self-description | context, doctor, reference, changelog, update --check | | Account setup | setup account add/list/default/remove/test | | API proxy | setup proxy status/set/clear, remote ssh-command | | Token | token status/refresh | | Rendering | render markdown/html | | Images | image prepare/upload | | Materials | asset count/list/get/delete, asset temp upload/get/get-hd-voice | | Drafts | draft create/update/count/list/get/delete, draft switch status/enable | | Publish | publish submit/status/list/get-article/delete | | Comments | comment open/close/list/mark/unmark/delete/reply-add/reply-delete | | Analytics | analytics article summary/total/read/read-hour/share/share-hour/published-read/published-share/published-summary/published-detail, analytics user summary/cumulate | | Menu | menu get/set/delete/addconditional | | QR codes | qrcode create | | Followers | user info/list | | Follower tags | tag get/create/update/delete/members/tagging/untagging | | Webhook | webhook verify |

Planned next: richer WeChat typography themes and browser fallback.

Development

make fmt
make test
make build
npm install --package-lock-only --ignore-scripts

Runnable examples live in examples/, including a frontmatter article and a custom menu JSON payload.

The quality bar follows ai-native-cli-spec: public behavior documented in README, Skill, reference, context, doctor, changelog, and update should have command-level or package-level tests.

Links