wechat-publish-pipeline
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWeChat Full Publish Pipeline
WeChat Full Publish Pipeline
全自动模式:从选题到草稿箱,中间不打断。收到指令后按以下步骤顺序执行,全程不等待用户确认。
Fully Automatic Mode: From topic selection to draft box, no interruptions during the process. After receiving the instruction, execute the following steps in order, no waiting for user confirmation throughout the whole process.
⚡ 进度汇报规范(强制执行)
⚡ Progress Reporting Specification (Mandatory Execution)
在每个 Step 完成后、开始下一个 Step 的工具调用之前,先输出一行汇报文字。 文字和下一步的工具调用在同一个响应里,顺序是:
[文字:✅ Step N 完成:...]
[工具调用:Step N+1 的第一个工具]这是唯一能让用户实时看到进度的方式。不要等用户回复,不要"结束本轮等待",文字和工具调用一起发出。
汇报格式:
✅ Step 0 完成:选题「{标题}」(HN {N} points)
✅ Step 1 完成:文章写好,{字数}字
✅ Step 2 完成:5张插图全部生成
✅ Step 3 完成:封面图生成
✅ Step 4 完成:排版完成
✅ Step 5 完成:已发布草稿箱,media_id: {id}After completing each Step and before invoking the tool for the next Step, output a line of progress report text first. The text and the tool invocation for the next step are in the same response, in the following order:
[Text: ✅ Step N completed: ...]
[Tool invocation: First tool for Step N+1]This is the only way for users to see real-time progress. Do not wait for user replies, do not "end this round and wait for feedback", send the text and tool invocation together.
Report Format:
✅ Step 0 completed: Selected topic 「{title}」 (HN {N} points)
✅ Step 1 completed: Article finished, {word count} words
✅ Step 2 completed: All 5 illustrations generated
✅ Step 3 completed: Cover image generated
✅ Step 4 completed: Typesetting finished
✅ Step 5 completed: Published to draft box, media_id: {id}Pipeline Steps
Pipeline Steps
Step 0: Topic Selection (web-search + judgment)
Step 1: Research & Write (url-to-markdown + translate + write)
Step 2: Article Illustrations (baoyu-article-illustrator)
Step 3: Cover Image (baoyu-imagine)
Step 4: Markdown → HTML (baoyu-markdown-to-html)
Step 5: Publish to Draft Box (baoyu-post-to-wechat API)每步完成后立即发一条进度消息给用户(见上方进度汇报规范)。
Step 0: Topic Selection (web-search + judgment)
Step 1: Research & Write (url-to-markdown + translate + write)
Step 2: Article Illustrations (baoyu-article-illustrator)
Step 3: Cover Image (baoyu-imagine)
Step 4: Markdown → HTML (baoyu-markdown-to-html)
Step 5: Publish to Draft Box (baoyu-post-to-wechat API)Send a progress message to the user immediately after each step is completed (refer to the progress reporting specification above).
Step 0: Topic Selection (自主选题)
Step 0: Topic Selection (Autonomous Selection)
完全自主,不询问用户。
Fully autonomous, no inquiry to the user.
0.1 采集热点
0.1 Hotspot Collection
同时搜索以下来源,取近 24-48 小时内容:
- Hacker News 热榜 Top 20(https://news.ycombinator.com/best)
- GitHub Trending(https://github.com/trending)
- 如有必要:Twitter/X AI/tech 话题Search the following sources at the same time, fetch content from the last 24-48 hours:
- Hacker News Hot List Top 20(https://news.ycombinator.com/best)
- GitHub Trending(https://github.com/trending)
- If necessary: Twitter/X AI/tech topics0.2 筛选标准
0.2 Filtering Criteria
优先选择满足以下条件的话题:
| 标准 | 说明 |
|---|---|
| 相关性 | AI、开发工具、技术趋势、安全事件、工程实践 |
| 时效性 | 事件发生在 48 小时内,有第一手资料可查 |
| 深度潜力 | 有技术细节可挖,不是纯新闻转述 |
| 受众匹配 | 适合技术向公众号读者(工程师、AI 从业者) |
| 未写过 | 检查 |
Prioritize topics that meet the following conditions:
| Criteria | Description |
|---|---|
| Relevance | AI, development tools, technology trends, security incidents, engineering practices |
| Timeliness | Event occurred within 48 hours, with first-hand information available |
| Depth Potential | Has technical details to explore, not pure news retelling |
| Audience Match | Suitable for technology-focused Official Account readers (engineers, AI practitioners) |
| Not Previously Written | Check |
0.3 自主决策
0.3 Autonomous Decision Making
从候选话题中选分数最高的一个,记录选题理由,直接进入 Step 1。不展示候选列表,不等待反馈。
📢 输出,然后在同一响应里立即开始 Step 1 的工具调用(抓取原文)。✅ Step 0 完成:选题「{标题}」(HN {N} points,来源:{URL})
Select the highest scored topic from the candidates, record the reason for topic selection, and directly proceed to Step 1. Do not display the candidate list, do not wait for feedback.
📢 Output, then immediately start the tool invocation for Step 1 (crawl the original text) in the same response.✅ Step 0 completed: Selected topic 「{title}」 (HN {N} points, source: {URL})
Step 1: Research & Write (研究与写作)
Step 1: Research & Write
1.1 获取原始资料
1.1 Obtain Original Materials
用 抓取主要来源页面:
baoyu-url-to-markdownbash
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-url-to-markdown"
npx -y bun "$SKILL_DIR/scripts/main.ts" --url "{source_url}" --output /tmp/source.md如有多个关键来源(原文 + 讨论帖),全部抓取。
Use to crawl the main source page:
baoyu-url-to-markdownbash
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-url-to-markdown"
npx -y bun "$SKILL_DIR/scripts/main.ts" --url "{source_url}" --output /tmp/source.mdIf there are multiple key sources (original text + discussion threads), crawl all of them.
1.2 如需翻译
1.2 Translation If Needed
若原文为英文,用 精翻核心内容作为参考(不直接发翻译稿):
baoyu-translatebash
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-translate"
npx -y bun "$SKILL_DIR/scripts/main.ts" /tmp/source.md --mode normal --to zhIf the original text is in English, use to accurately translate the core content as reference (do not directly send the translated text):
baoyu-translatebash
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-translate"
npx -y bun "$SKILL_DIR/scripts/main.ts" /tmp/source.md --mode normal --to zh1.3 撰写原创文章
1.3 Write Original Article
文章风格要求:
- 第一人称叙述视角("那天..."、"让我们从...")或第三人称叙事
- 开头用一个具体场景/事件钩住读者,不要从"背景"开始
- 有结构:开篇钩子 → 核心事件/概念 → 技术细节 → 影响/意义 → 结语
- 有自己的观点,不是新闻转述
- 代码示例、数据、引用要准确,来自原始资料
- 长度:2000-4000 字
- 语言:中文
文件命名与存储:
/agent/articles/drafts/{slug}-{YYYY-MM-DD}.mdslug: 英文 kebab-case,2-4 词,来自文章主题
Frontmatter:
yaml
---
title: 文章标题
date: YYYY-MM-DD
source: 原文URL
tags: [tag1, tag2]
digest: 文章摘要(≤15字,发布时传给微信)
---摘要要求:
- 不超过 15 字
- 点出核心事件/结论,不是标题的复述
- 示例:"AI供应链遭劫持,数千应用悄然中招"
📢 输出,然后在同一响应里立即开始 Step 2 的工具调用(创建插图 prompts)。✅ Step 1 完成:文章写好,约 {字数} 字,保存至 {路径}
Article Style Requirements:
- First-person narrative perspective ("That day...", "Let's start from...") or third-person narrative
- Hook readers with a specific scenario/event at the beginning, do not start with "background"
- Structured: opening hook → core event/concept → technical details → impact/significance → conclusion
- Have your own opinions, not just news retelling
- Code examples, data, citations must be accurate, from original sources
- Length: 2000-4000 words
- Language: Chinese
File Naming and Storage:
/agent/articles/drafts/{slug}-{YYYY-MM-DD}.mdslug: English kebab-case, 2-4 words, derived from the article topic
Frontmatter:
yaml
---
title: 文章标题
date: YYYY-MM-DD
source: 原文URL
tags: [tag1, tag2]
digest: 文章摘要(≤15字,发布时传给微信)
---Abstract Requirements:
- No more than 15 words
- Point out the core event/conclusion, not a retelling of the title
- Example: "AI supply chain hijacked, thousands of apps silently compromised"
📢 Output, then immediately start the tool invocation for Step 2 (create illustration prompts) in the same response.✅ Step 1 completed: Article finished, about {word count} words, saved to {path}
Step 2: Article Illustrations (配插图)
Step 2: Article Illustrations
Skill:
baoyu-article-illustratorSkill:
baoyu-article-illustrator2.1 分析文章,规划插图
2.1 Analyze Article, Plan Illustrations
读文章,判断:
- 内容类型 → 选 preset
- 技术/安全/AI → (infographic + blueprint)
tech-explainer - 叙事+技术混合 → ,关键事件用
tech-explainer类型timeline - 方法论/框架 →
system-design
- 技术/安全/AI →
- 密度:(每个主要章节至少 1 张)
per-section - 创建
{article-dir}/imgs/outline.md
好的插图位置:
- 文章开头之前(时间线或全局概览)
- 关键技术机制说明之后(流程图/框架图)
- 数据/对比节(infographic/comparison)
- 结论前的总结性图示
Read the article, judge:
- Content type → select preset
- Technology/security/AI → (infographic + blueprint)
tech-explainer - Narrative + technology mixed → , use
tech-explainertype for key eventstimeline - Methodology/framework →
system-design
- Technology/security/AI →
- Density: (at least 1 image per main chapter)
per-section - Create
{article-dir}/imgs/outline.md
Good Illustration Positions:
- Before the start of the article (timeline or overall overview)
- After explanation of key technical mechanisms (flowchart/framework diagram)
- Data/comparison sections (infographic/comparison)
- Summary illustration before conclusion
2.2 创建所有 prompt 文件(BLOCKING,必须全部创建后才能生成)
2.2 Create All Prompt Files (BLOCKING, must all be created before generation)
存到
{article-dir}/imgs/prompts/NN-{type}-{slug}.mdPrompt 质量要求:
- :描述整体构图
Layout - :每个区域有具体内容,不能模糊
ZONES - :使用文章中的实际数字/术语/引语
LABELS - :十六进制色值 + 语义说明
COLORS - :技术/安全类用 blueprint/dark/digital 风格
STYLE - : 16:9
ASPECT
内容审核安全规则(避免触发 OpenAI 内容政策):
- ❌ "fork bomb", "malware install", "exploit", "hack", "kill process"
- ✅ 改为描述行为/结果:"process multiplication", "malicious payload", "vulnerability abuse mechanism"
- 如果某张图被 拒绝,立即改写 prompt 描述行为而非技术名词,单独重试
moderation_blocked
Store to
{article-dir}/imgs/prompts/NN-{type}-{slug}.mdPrompt Quality Requirements:
- : Describe the overall composition
Layout - : Each zone has specific content, no ambiguity
ZONES - : Use actual numbers/terms/quotes from the article
LABELS - : Hex color value + semantic description
COLORS - : Use blueprint/dark/digital style for technology/security content
STYLE - : 16:9
ASPECT
Content Review Security Rules (avoid triggering OpenAI content policies):
- ❌ "fork bomb", "malware install", "exploit", "hack", "kill process"
- ✅ Change to describe behavior/result: "process multiplication", "malicious payload", "vulnerability abuse mechanism"
- If an image is rejected with , immediately rewrite the prompt to describe behavior instead of technical terms, retry individually
moderation_blocked
2.3 批量生成
2.3 Batch Generation
创建 :
{article-dir}/imgs/batch.jsonjson
{
"jobs": 3,
"tasks": [
{
"id": "01-slug",
"promptFiles": ["prompts/01-type-slug.md"],
"image": "01-type-slug.png",
"provider": "openai",
"model": "gpt-image-1",
"ar": "16:9",
"quality": "2k"
}
]
}bash
cd {article-dir}/imgs
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-imagine"
npx -y bun "$SKILL_DIR/scripts/main.ts" --batchfile batch.json --jobs 3Create :
{article-dir}/imgs/batch.jsonjson
{
"jobs": 3,
"tasks": [
{
"id": "01-slug",
"promptFiles": ["prompts/01-type-slug.md"],
"image": "01-type-slug.png",
"provider": "openai",
"model": "gpt-image-1",
"ar": "16:9",
"quality": "2k"
}
]
}bash
cd {article-dir}/imgs
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-imagine"
npx -y bun "$SKILL_DIR/scripts/main.ts" --batchfile batch.json --jobs 32.4 插入文章
2.4 Insert Into Article
每张图插入对应段落之后:
markdown
📢 输出,然后在同一响应里立即开始 Step 3 的工具调用(生成封面图)。✅ Step 2 完成:5张插图全部生成并插入文章
Insert each image after the corresponding paragraph:
markdown
📢 Output, then immediately start the tool invocation for Step 3 (generate cover image) in the same response.✅ Step 2 completed: All 5 illustrations generated and inserted into the article
Step 3: Cover Image (封面图)
Step 3: Cover Image
封面图存到 ( 默认读取此路径)。
{article-dir}/imgs/cover.pngwechat-api.tsStore the cover image to (read from this path by default by ).
{article-dir}/imgs/cover.pngwechat-api.ts3.1 创建封面 prompt
3.1 Create Cover Prompt
存到
{article-dir}/imgs/prompts/cover.md技术/AI 类文章封面选型:
type: conceptualpalette: darkrendering: digital- 情绪:bold,高对比度
- 配色:深海军蓝/黑底 + 电光红橙(威胁感)或青蓝(科技感)
- 不含文字(微信会单独显示标题)
- 主视觉元素要与文章主题强相关(不要通用科技图)
Store to
{article-dir}/imgs/prompts/cover.mdCover Selection for Technology/AI Articles:
type: conceptualpalette: darkrendering: digital- Mood: bold, high contrast
- Color scheme: Dark navy blue/black background + electric red-orange (sense of threat) or cyan-blue (sense of technology)
- No text (WeChat will display the title separately)
- The main visual element must be strongly related to the article topic (do not use generic technology images)
3.2 生成封面
3.2 Generate Cover
bash
cd {article-dir}/imgs
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-imagine"
npx -y bun "$SKILL_DIR/scripts/main.ts" \
--promptfiles "prompts/cover.md" \
--image "cover.png" \
--provider openai \
--model gpt-image-1 \
--ar 16:9 \
--quality 2k📢 输出,然后在同一响应里立即开始 Step 4 的工具调用(排版)。✅ Step 3 完成:封面图生成
bash
cd {article-dir}/imgs
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-imagine"
npx -y bun "$SKILL_DIR/scripts/main.ts" \
--promptfiles "prompts/cover.md" \
--image "cover.png" \
--provider openai \
--model gpt-image-1 \
--ar 16:9 \
--quality 2k📢 Output, then immediately start the tool invocation for Step 4 (typesetting) in the same response.✅ Step 3 completed: Cover image generated
Step 4: Markdown → HTML (排版)
Step 4: Markdown → HTML (Typesetting)
bash
cd {article-dir}
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-markdown-to-html"
npx -y bun "$SKILL_DIR/scripts/main.ts" {article-file} --theme grace --cite默认配置:
- Theme: (优雅,适合技术内容)
grace - :外链转底部引用(微信友好)
--cite
确认输出 JSON 中 包含所有插图后继续。
contentImages📢 输出,然后在同一响应里立即开始 Step 5 的工具调用(发布到微信)。✅ Step 4 完成:排版完成
bash
cd {article-dir}
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-markdown-to-html"
npx -y bun "$SKILL_DIR/scripts/main.ts" {article-file} --theme grace --citeDefault configuration:
- Theme: (elegant, suitable for technical content)
grace - : Convert external links to bottom references (WeChat friendly)
--cite
Confirm that in the output JSON contains all illustrations before proceeding.
contentImages📢 Output, then immediately start the tool invocation for Step 5 (publish to WeChat) in the same response.✅ Step 4 completed: Typesetting finished
Step 5: Publish to WeChat Draft Box (发布)
Step 5: Publish to WeChat Draft Box
bash
cd {article-dir}
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-post-to-wechat"
npx -y bun "$SKILL_DIR/scripts/wechat-api.ts" \
{article-file} \
--theme grace \
--color blue \
--cover imgs/cover.png关键注意事项:
- 传 文件,不传
.md(脚本内部处理转换和图片上传).html - 图片自动压缩到 <1MB JPEG 再上传
- 成功后返回
media_id
📢 最终汇报:发送,pipeline 结束。✅ Step 5 完成:已发布草稿箱,media_id: {media_id}
bash
cd {article-dir}
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-post-to-wechat"
npx -y bun "$SKILL_DIR/scripts/wechat-api.ts" \
{article-file} \
--theme grace \
--color blue \
--cover imgs/cover.pngKey Notes:
- Pass the file, do not pass
.md(the script handles conversion and image upload internally).html - Images are automatically compressed to <1MB JPEG before upload
- Return after success
media_id
📢 Final Report: Send, pipeline ends.✅ Step 5 completed: Published to draft box, media_id: {media_id}
首次运行环境检查
First Run Environment Check
EXTEND.md 检查与自动创建
EXTEND.md Check and Automatic Creation
bash
test -f "$HOME/.baoyu-skills/baoyu-article-illustrator/EXTEND.md" || mkdir -p "$HOME/.baoyu-skills/baoyu-article-illustrator" && cat > "$HOME/.baoyu-skills/baoyu-article-illustrator/EXTEND.md" << 'EOF'
---
version: 1
watermark:
enabled: false
content: ""
position: bottom-right
opacity: 0.7
preferred_style:
name: null
description: ""
default_output_dir: imgs-subdir
language: zh
custom_styles: []
---
EOF
test -f "$HOME/.baoyu-skills/baoyu-imagine/EXTEND.md" || mkdir -p "$HOME/.baoyu-skills/baoyu-imagine" && cat > "$HOME/.baoyu-skills/baoyu-imagine/EXTEND.md" << 'EOF'
---
version: 1
default_provider: openai
default_quality: 2k
default_aspect_ratio: null
default_image_size: null
default_model:
google: null
openai: gpt-image-1
azure: null
openrouter: null
dashscope: null
minimax: null
replicate: null
---
EOF
test -f "$HOME/.baoyu-skills/baoyu-cover-image/EXTEND.md" || mkdir -p "$HOME/.baoyu-skills/baoyu-cover-image" && cat > "$HOME/.baoyu-skills/baoyu-cover-image/EXTEND.md" << 'EOF'
---
version: 1
watermark:
enabled: false
content: ""
position: bottom-right
opacity: 0.7
preferred_type: null
preferred_palette: null
preferred_rendering: null
preferred_text: title-only
preferred_mood: balanced
preferred_font: clean
default_aspect: 16:9
default_output_dir: imgs-subdir
quick_mode: false
language: zh
custom_palettes: []
---
EOF
test -f "$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md" || mkdir -p "$HOME/.baoyu-skills/baoyu-post-to-wechat" && cat > "$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md" << 'EOF'
default_theme: grace
default_color: blue
default_publish_method: api
default_author: 宝玉
need_open_comment: 1
only_fans_can_comment: 0
EOFbash
test -f "$HOME/.baoyu-skills/baoyu-article-illustrator/EXTEND.md" || mkdir -p "$HOME/.baoyu-skills/baoyu-article-illustrator" && cat > "$HOME/.baoyu-skills/baoyu-article-illustrator/EXTEND.md" << 'EOF'
---
version: 1
watermark:
enabled: false
content: ""
position: bottom-right
opacity: 0.7
preferred_style:
name: null
description: ""
default_output_dir: imgs-subdir
language: zh
custom_styles: []
---
EOF
test -f "$HOME/.baoyu-skills/baoyu-imagine/EXTEND.md" || mkdir -p "$HOME/.baoyu-skills/baoyu-imagine" && cat > "$HOME/.baoyu-skills/baoyu-imagine/EXTEND.md" << 'EOF'
---
version: 1
default_provider: openai
default_quality: 2k
default_aspect_ratio: null
default_image_size: null
default_model:
google: null
openai: gpt-image-1
azure: null
openrouter: null
dashscope: null
minimax: null
replicate: null
---
EOF
test -f "$HOME/.baoyu-skills/baoyu-cover-image/EXTEND.md" || mkdir -p "$HOME/.baoyu-skills/baoyu-cover-image" && cat > "$HOME/.baoyu-skills/baoyu-cover-image/EXTEND.md" << 'EOF'
---
version: 1
watermark:
enabled: false
content: ""
position: bottom-right
opacity: 0.7
preferred_type: null
preferred_palette: null
preferred_rendering: null
preferred_text: title-only
preferred_mood: balanced
preferred_font: clean
default_aspect: 16:9
default_output_dir: imgs-subdir
quick_mode: false
language: zh
custom_palettes: []
---
EOF
test -f "$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md" || mkdir -p "$HOME/.baoyu-skills/baoyu-post-to-wechat" && cat > "$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md" << 'EOF'
default_theme: grace
default_color: blue
default_publish_method: api
default_author: 宝玉
need_open_comment: 1
only_fans_can_comment: 0
EOFnpm 依赖检查
npm Dependency Check
bash
ls /agent/skills/baoyu-skills/node_modules/jimp 2>/dev/null || \
(cd /agent/skills/baoyu-skills && npm install jimp @jsquash/webp)bash
ls /agent/skills/baoyu-skills/node_modules/jimp 2>/dev/null || \
(cd /agent/skills/baoyu-skills && npm install jimp @jsquash/webp)完成报告
Completion Report
WeChat Full Pipeline Complete!
选题: [topic]
来源: [source URL]
文章: [article path]
插图: X 张
封面: imgs/cover.png
主题: grace + blue
✓ 已发布至公众号草稿箱
• media_id: [media_id]
→ 草稿箱: https://mp.weixin.qq.com(内容管理 → 草稿箱)WeChat Full Pipeline Complete!
Topic: [topic]
Source: [source URL]
Article: [article path]
Illustrations: X pieces
Cover: imgs/cover.png
Theme: grace + blue
✓ Published to Official Account draft box
• media_id: [media_id]
→ Draft Box: https://mp.weixin.qq.com (Content Management → Draft Box)