Prerequisites
Use this file when the user specifies an article; otherwise wewrite run show. If
artifacts.illustrated_article exists and is non-empty, use it; otherwise use artifacts.article; read the title,
summary, cover, preview path, publishing permission, and fallback flag. A completed article can be directly typeset or published; do not resume the writing
task. The theme is taken from style.yaml's theme, default professional-clean。
Typesetting and publishing must not automatically call wewrite-visual. When there is no cover, generate the local preview as usual; only enter the visual module
when the user separately requests illustrations.
When the user explicitly requests in this turn to “push to the draft box/publish”, if there is a task, first run
wewrite run permission publish allow; when the user revokes, run wewrite run permission publish deny.
Typesetting only, preview only, or “complete production” cannot grant publishing permission.
When there is a task, enter:
wewrite run step publish in_progress
Pre-check
- The title exists and complies with WeChat limits; the summary does not exceed 120 bytes; the body is 200-20000 characters.
- Body images do not exceed 10 and are actually readable; tables do not exceed 4 columns.
- Publishing a draft must have a cover. Without a cover, do not assume WeChat will add a default image; switch to local preview.
- Publishing must simultaneously satisfy:
permissions.publish=true、flags.skip_publish=false, and the user has not revoked in this turn.
Actions
Always first generate the local preview; when there is a task, save it to artifacts.preview; for articles outside a task, save it next to the original file:
wewrite preview {article} --theme {theme} --no-open -o {preview}
Confirm that the preview artifact exists and passes the compatibility check. If there is no explicit publishing permission, the process ends here; “write an article” and “complete production” both do not equal permission to publish.
Execute only when the user explicitly requests the draft box and all pre-checks pass:
wewrite publish {article} --cover {cover} --theme {theme} --title "{title}" --digest "{digest}"
When publishing fails, keep the preview and do not automatically retry to produce external actions. When there is a task, update publish.preview_html; on success, then write
publish.media_id, and subsequently:
wewrite run step publish completed
Auxiliary functions
| The user says | Action |
|---|---|
| view themes | wewrite gallery |
| change theme | preview again; only publish again when explicitly requested again |
| make an image post | first confirm that the user really wants to push to the draft box, then execute wewrite image-post |
| typeset only | preview only |