dsh-tool-gzh-publisher: Review and Push WeChat Official Account Drafts in DSH

Introduction

When writing WeChat Official Account drafts in DeepSeek Harness (DSH), the common practice is to run scripts locally for validation, then manually copy them to the backend or push them via a separate terminal. If the model directly execs external scripts, it must assemble parameters, parse Chinese output, and determine success or failure. If WeChat credentials and rate-limiting interfaces are wrapped in yet another layer, it’s easy to end up with two sets of “sources of truth”.

dsh-tool-gzh-publisher exposes the existing gzh_auto.py pipeline to the Agent as a typed tool: it first runs the publishing quality gate, then pushes content into the WeChat draft box, all completed within the conversation, without reimplementing the WeChat API.

What This Is

The plugin’s full name is dsh-tool-gzh-publisher, maintained by yuehancn, and categorized as a workflow in community directories like SkillHub. In one sentence: it is a WeChat Official Account pipeline for DSH—performing publishing gate validation on drafts and pushing them to the draft box after passing (without publishing directly to the public).

It is a layer of typed bridging: the access_token handshake, draft creation, and pre-publishing quality gate are still handled by the locally proven gzh_auto.py (from the gzh-auto-publisher skill); the plugin is responsible for typed parameters, structured output, and stable path configuration.

Compatibility note (from the repository README): built and tested on dsh 0.2.0-rc.2 (preview); the apply(ctx) plugin specification is relatively stable, but if you are using a newer version, please verify yourself.

Core Features

The plugin registers five tools with the Agent, distinguishing in descriptions whether they require network access, to avoid mistakenly triggering authentication when you “just want to check configuration.”

Tool Network Purpose
gzh_accounts No Read accounts.json, list locally publishable Official Accounts along with their positioning, keywords, and working directories
gzh_validate No Run the publishing gate on a specified draft (word count, golden quotes, emoji, AI tone, ending, etc.) without accessing the network
gzh_check No Account configuration health check: required fields, disk paths, whether APPID/SECRET exist in env
gzh_push_draft Yes Run the gate first, then push to the draft box; does not publish—final publishing still requires manual clicking in the WeChat backend
gzh_verify Yes Real credential handshake to exchange for an access_token

Configuration options allow you to set accounts, validate, check, push, and verify to false individually, disabling tools you don’t want to expose.

Permissions and data boundaries (summary): the plugin itself does not read credentials; gzh_auto.py reads WECHAT_APPID / WECHAT_APPSECRET from env_file; access_token is only sent to api.weixin.qq.com; offline tools do not access the network; no telemetry; no local file writing; it calls your configured pythonPath via execFile to execute scriptPath, which is the only process the plugin will start.

Installation and Activation

One-line Installation

The official installation command is as follows (replace desktop with your profile name; web is also supported):

dsh plugin --profile desktop add github:yuehancn/dsh-tool-gzh-publisher

After installing the plugin, it is not ready to use out of the box. You must prepare the bridged gzh_auto.py and accounts.json on your local machine, and configure paths in your profile; otherwise, the tool will report clear errors such as gzh: publisher script not found at "…".

Prerequisites and Configuration

Three external resources are needed, and you must override the plugin configuration in ~/.dsh/profiles/<profile>/cordis.patch.yml (the example id is tool-gzh-publisher):

Configuration Key Description
scriptPath Absolute path to gzh_auto.py (the default example points to …/gzh-auto-publisher/scripts/gzh_auto.py)
pythonPath Python interpreter to execute the script (the documentation example uses a local 3.13.12 venv)
accountsPath Absolute path to accounts.json
timeoutMs Default 180000; budget for gzh_push_draft calls, can be changed to e.g. 300000 as needed

Each account entry in accounts.json contains name, positioning, keywords, workdir, env_file, and gating fields such as min_cjk / max_cjk, min_gold, ending, author. The env_file contains WeChat secrets—do not commit it to any repository.

For manual development installation (junction, bundles activation, cordis.patch.yml override by id, etc.), refer to the “Installation (Manual, for Local Development)” section in the GitHub README; in production environments, the CLI dsh plugin add is the primary method.

Typical Usage

Below are reproducible workflows from the Agent side in common order (replace specific account names and draft paths with your local values).

  1. List Accounts: Call gzh_accounts to confirm which Official Accounts and working directories exist in accounts.json.
  2. Configuration Health Check: Call gzh_check --account <account_name> to confirm paths and env fields are complete (note: this does not “list draft box”; draft list still goes through the WeChat backend).
  3. Optional Authentication: Call gzh_verify when you need to confirm credentials are valid (this will access the network to exchange for a token).
  4. Validate Draft: Call gzh_validate on .md files, and revise drafts based on structured results (e.g., CJK character count, number of golden quotes, ending format).
  5. Push Draft: After validation passes, call gzh_push_draft with optional --title, --digest; after success, manually publish in the WeChat backend.

The plugin sets PYTHONIOENCODING=utf-8 and PYTHONUTF8=1 when calling Python, mitigating Chinese character garbling on Windows; success/failure determination is not based solely on exit codes but also considers whether the output contains ❌ (consistent with gzh_auto.py behavior).

Use Cases and Notes

Who It’s For: DSH users who are already using or willing to deploy gzh-auto-publisher + gzh_auto.py, and want to solidify “quality check + push to draft” as Agent-callable tools instead of having the model assemble shell commands each time.

Important Notes:

  • The plugin runs with the current dsh process permissions. Before installation, please read the GitHub source code and the MIT license, and evaluate credential and script execution risks yourself.
  • gzh_push_draft is one of the irreversible external actions (content will be sent to the WeChat draft box). Although it is not equivalent to clicking “Publish,” it should still be called only after confirming the account and draft.
  • Community directories (such as SkillHub) have no official affiliation with DeepSeek / HiDream; the DSH ecosystem is “everything is a plugin,” and this plugin is a workflow-type community contribution, not an official app store built-in capability.

To verify whether the plugin is loaded: on desktop versions, you can use the ELECTRON_RUN_AS_NODE=1 + --dump-config method from the README to grep for dsh-tool-gzh-publisher; do not place dump-config after the dsh plugin subcommand (it will be mistakenly passed through).

Links

  • Community directory page: https://www.skillhub.cn/plugins/yuehancn/dsh-tool-gzh-publisher
  • Source code and full documentation: https://github.com/yuehancn/dsh-tool-gzh-publisher

With the above steps, you can complete the quality gate and draft box push for Official Account drafts within DSH conversations, while continuing to consolidate WeChat API and credential logic in the single gzh_auto.py implementation.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye