/ego-skills:wechat-article-egofrom ego-skills
Saves Markdown content as a WeChat Official Account draft (article or image post) via Ego Lite browser. Only saves drafts, never publishes. Requires logged-in browser session.
Ships in ego-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
用 Ego Lite 里已经登录的微信公众平台会话,把一篇 Markdown 文章存成一篇图文草稿,或把一张或多张图片存成一篇贴图草稿(type 77)。只走 mp.weixin.qq.com 上看得见的编辑器。这不是视频号,也不会点「发表」。
Save one Official Account article draft, or one 贴图 image-post draft, through the visible editor. This is not WeChat Channels. --yes clicks 保存 or, for a 贴图, 保存为草稿 only.
成功标准是草稿能按标题或 appmsgid 重新打开。图文要核对标题、正文片段和图片张数。贴图要核对 type 77、标题、正文 innerText、话题文字、图片张数和保存时间。没有这条回读就不算成功。
Success is a draft that can be reopened. An article matches title, body text, and image count. A 贴图 matches type 77, title, body innerText, topic texts, image count, and the saved time.
先装 Ego Lite,保证 ego-browser 在 PATH。非交互 shell 找不到时,再试 ~/.local/bin/ego-browser。仍然缺失则 soft-fail(退出码 2),不要改用 Playwright、Puppeteer 或云端浏览器。
node scripts/check-login.mjs
node scripts/check-login.mjs --expect-account "账号名称"
| 退出码 | 含义 | Agent 做什么 |
|---|---|---|
0 | 已登录,且只看到一个公众号(昵称匹配,若传了 --expect-account) | 把 login_tip 告诉用户,继续 |
2 | 未登录 / 昵称不符 / 无 ego-browser | 展示 how_to_login,停。请人在 Ego 里扫码 |
4 | 看到多个公众号,或看不出是哪一个 | 把 accounts 给人看,停在第一次保存之前。不要猜 |
3 | 计划已打印 | 把计划给人看。没有 --yes 不上传、不保存 |
1 | 其它错误 | 报告 JSON error,不要假装已经存成草稿 |
不要另做 cookie-healthcheck。不要代填密码,不要粘贴 Cookie,不要从 URL 里抄 token。任务空间结束时一律 finish({ keep: [] })。没有 --keep。
没有 --yes:检查登录和账号,打印计划 JSON(标题、图片张数、哈希、保真说明),退出码 3。不打开编辑器,不上传。
有 --yes:才创建一篇新草稿并点「保存」或「保存草稿」。点之前会回读标题、正文和图片张数。对不上就不保存。
同一篇文章(同一哈希)如果回执已经是 saved,或者上次结果不确定但草稿箱里能对上标题,就不再保存一次。不确定时先对草稿箱,对不上才允许再存一篇。不要盲重点第二次保存,也不要覆盖或删除旧草稿。
仓库根目录。调用方传绝对路径。
node skills/wechat-article-ego/scripts/check-login.mjs --expect-account "账号名称"
node skills/wechat-article-ego/scripts/save-draft.mjs \
--markdown /absolute/path/to/article.md
node skills/wechat-article-ego/scripts/save-draft.mjs \
--markdown /absolute/path/to/article.md \
--source-url https://example.com/post \
--expect-account "账号名称" \
--yes --json
node skills/wechat-article-ego/scripts/save-draft.mjs \
--kind tietu \
--title "标题最多二十字" \
--text "正文。外链单独成行,保持纯文本。" \
--image /absolute/path/to/cover.jpg \
--topic 话题 \
--expect-account "账号名称"
node skills/wechat-article-ego/scripts/cleanup.mjs
| 退出码 | 含义 |
|---|---|
0 | 已登录,或草稿已在草稿箱确认,或这篇文章之前已经存过,或 cleanup 关掉了本技能的空间 |
3 | 计划已打印,没有上传 |
2 | 未登录、账号不符,或没有 ego-browser |
4 | 账号不唯一,或保存结果对不上唯一草稿 |
1 | 参数、素材、回读或浏览器错误 |
--json 打出摘要 JSON。不加 --json 且保存成功时,stdout 是一行 saved <标题>。
正文用编辑器的粘贴(keyboard.paste 的 text + html)和文件选择(waitForFileChooser / setInputFiles)。粘贴的 HTML 是浅色正文排版:无衬线正文、带下边线的标题、浅底引用、公众号链接蓝。样式是本技能自己写的行内样式,不内置 mdnice / wechat.bmpi.dev 的 GPL 主题,也不依赖在线编辑器。出处见 references/typography.md。图片从 Markdown 引用的本地文件或该文自己的 http(s) 图片下载后上传,不把外链留在正文里。细节见 references/editor.md。输入见 references/inputs.md。登录见 references/login.md。
--kind tietu 另存一篇贴图,不走图文编辑器。第一张 --image 是封面,其余按顺序上传。--title 最多 20 个字符,超了会在打开浏览器之前失败。--text 或 --text-file 二选一,正文最多 1000 个字符,URL 也算在里面;加上话题之后如果会撑破这 1000 字,同样失败。--topic 可重复,只写话题名,不要带 #,中间也不要空格。
The same command with --kind tietu saves one image post instead of an article. The first --image is the cover. --title allows 20 characters. --text / --text-file allow 1000 characters including URLs, and the typed topics have to fit in that same body. Repeat --topic with the name only: no #, no spaces.
没有 --yes 只打印计划并退出 3,不开编辑器、不上传。有 --yes 也只点一次「保存为草稿」。不点「发表」「预览」「群发」「定时群发」「发送预览」。保存结果对不上这一篇时退出 4,不把保存再点一次。
标题和正文打完之后,编辑器会在几秒内自动保存。页脚出现 HH:MM已保存,URL 带上 appmsgid,这次请求里应有非空的 cdn_url0 和 share_imageinfo0。所以命令如果在这之后失败,草稿箱里可能已经有一篇贴图,不要再盲目开一篇。手动「保存为草稿」要等这次自动保存完成(最多 30 秒),并用指针点击,去更新同一个 appmsgid。如果手动保存换成了另一个 id,或者请求里的图片字段是空的,就报错停下。
Without --yes the command prints the plan and exits 3. With --yes it clicks 保存为草稿 once, after the editor has autosaved. It does not click 发表, 预览, 群发, 定时群发, or 发送预览. An outcome that is not this one draft exits 4 and does not click save again.
After the title and body are typed, the editor autosaves within a few seconds: the footer shows HH:MM已保存, the URL gains appmsgid, and that request should carry non-empty cdn_url0 and share_imageinfo0. A 贴图 draft can therefore exist even if this command aborts later. Do not start another one blindly. The manual 保存为草稿 click waits for that autosave (up to 30 seconds) and is a real pointer click, so it updates the same appmsgid. A changed id, or a save request with empty image fields, stops the command.
贴图编辑器的「链接」只接受公众号内容、小程序或小店。正文里的 http(s) 地址保持纯文本行,保存之后也不能点击。不要把外链填进那个链接栏。
The 贴图 link field only accepts Official Account content, a mini program, or a store. Bare http(s) URLs stay plain text lines and are not clickable after saving. Do not put an external URL in that link field.
.image-selector 里要先出现预期张数的 mmbiz 图片,才点「保存为草稿」;只有文件名或上传响应不算成功,最多等 60 秒,对不上就退出 1 且不保存。点「保存为草稿」之后留在编辑页最多 20 秒,等 URL 或保存响应里的 appmsgid。这期间不打开草稿列表、不关掉标签页。截图、脱敏后的 URL、toast 和保存响应会先写入回执。没有 appmsgid 时错误是 save not confirmed,不会当成正文回读失败。拿到 id 之后才重新打开编辑地址,等到标题出现再比对,并对照贴图草稿列表。重新打开只读取,不会点「删除」「废弃」或「不保存」。JSON 里带回 appmsgid、type 77、title、正文 text(innerText)、topics、imageCount 和 savedTime。上传若 30 秒内看不到缩略图、文件名、占位消失或上传响应,会把截图和上传区域 HTML 写到截图或回执目录,并把路径放进错误 JSON。编辑器地址、上传控件和话题输入见 references/tietu.md。
After a save, the draft is reopened. The JSON includes appmsgid, type 77, title, body text (innerText), topics, imageCount, and savedTime. The editor URL, uploader, and topic typing are in references/tietu.md.
npm test
npm test 用 c8 统计 scripts/lib/**/*.mjs(不含 ego-deps.mjs),行覆盖率不低于 80%。单测不打开微信。
agents/openai.yaml (opens in a new tab)references/editor.md (opens in a new tab)references/inputs.md (opens in a new tab)references/login.md (opens in a new tab)references/tietu.md (opens in a new tab)references/typography.md (opens in a new tab)scripts/check-login.mjs (opens in a new tab)scripts/cleanup.mjs (opens in a new tab)scripts/lib/editor-flow.mjs (opens in a new tab)scripts/lib/ego-deps.mjs (opens in a new tab)scripts/lib/launch.mjs (opens in a new tab)scripts/lib/mp-dom.mjs (opens in a new tab)scripts/lib/prepare.mjs (opens in a new tab)scripts/lib/pure.mjs (opens in a new tab)scripts/lib/session.mjs (opens in a new tab)scripts/lib/tietu-dom.mjs (opens in a new tab)scripts/lib/tietu-flow.mjs (opens in a new tab)scripts/lib/tietu-prepare.mjs (opens in a new tab)scripts/lib/tietu-session.mjs (opens in a new tab)scripts/lib/tietu.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub terryso/ego-skills --plugin ego-skills14 skills in this plugin
/bilibili-videoPublish a local video to the Bilibili creator platform (member.bilibili.com) with Ego Lite via ego-browser. Login-check first. Bilibili wants TWO covers uploaded separately: --cover-4x3 (首页推荐) and --cover-16x9 (个人空间). Nothing is submitted without --yes: that run only prints a local plan and exits 3. --type selects a partition from the human-type list and reads it back; a missing name stops before 立即投稿. Success is 投稿成功 / 审核中, with a BV URL or identity unconfirmed. Bilibili has no private visibility on web upload: approved submissions go public. Use when the user asks to post to B站, 哔哩哔哩, B站投稿, or publish a video to bilibili./chatgpt-image-genExpand a rough image idea with the six-axis domain engine from codex-imagegen, then create one image on the free ChatGPT website inside Ego Lite. Login-check first. Soft-fail with exit 2 when ego-browser is missing, chatgpt.com is logged out, or login cannot be proven. enrich and generate without --yes are offline. --yes sends one prompt and saves the image to --out. Flowcharts and timelines are SVG, not images. Does not call codex exec and does not use an API key. Use when the user asks to generate an image, enrich a prompt, or use ChatGPT Images without a Codex subscription./douyin-videoPublish a local video to the Douyin creator center (creator.douyin.com) with Ego Lite via ego-browser. Login-check first. Title is a separate field of at most 30 characters. Success is a redirect to content management or a publish-success message. The caller supplies a local video file. This skill does not download video. Use when the user asks to post to 抖音, 抖音发视频, 发布到抖音创作者中心, or creator.douyin.com./instagram-saved-downloadDownload the user's own Instagram Saved posts (images, and MP4 when asked) with Ego Lite cookies via ego-browser. Soft-fails if Instagram is logged out and tells the user that signing in is what makes Saved readable. Personal archive only. Each run checks login itself./kuaishou-videoPublish a local video to the Kuaishou creator platform (cp.kuaishou.com) with Ego Lite via ego-browser. Login-check first. Success means the work shows 审核中. Optional comment from the creator comment manager. The caller supplies a local video file and a description. This skill does not download video. Use when the user asks to post to 快手, 快手发视频, 发布到快手创作者平台, or comment on a Kuaishou work from the creator backend./pinterest-downloadSearch Pinterest and save images or MP4s with the user's Ego Lite cookies. Also related pins, board feeds, and small previews the model can read. Parity with @sunkimkk/pinterest-mcp. Soft-fails if Pinterest is logged out, and always tells the user that signing in inside Ego improves results. Personal use only.Other plugins' skills for the same job