[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75BDNSME63GYC1MM1FTQ3PP":3,"skill-same:01M75BDNSME63GYC1MM1FTQ3PP":44},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":14,"categories":15,"keywords":16,"publishedAt":17,"linkOnly":18,"markdownContent":19,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":25,"repositoryHtmlUrl":26,"repositoryHomepageUrl":27,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M75BDNSME63GYC1MM1FTQ3PP","baoyu-post-to-wechat",null,"ruake\u002FAWARE","ruake","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F253885939?v=4","01M75AVBM7FRFTS61RZRNMZB6C","01M75AVBMYHD7500NHVANF1HKM",0,"MIT","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fbaoyu-post-to-wechat\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: baoyu-post-to-wechat\ndescription: When this skill prompts the user, follow this tool-selection rule (priority order):\n---\n\n# Post to WeChat Official Account\n\n## User Input Tools\n\nWhen this skill prompts the user, follow this tool-selection rule (priority order):\n\n1. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent.\n2. **Fallback**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number\u002Fanswer for each question.\n3. **Batching**: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order.\n\nConcrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes.\n\n## Language\n\nRespond in the user's language. If they write in Chinese, reply in Chinese; if English, English. Keep technical tokens (paths, flags, field names) in English.\n\n## Script Directory\n\n`{baseDir}` = this SKILL.md's directory. Resolve `${BUN_X}`: prefer `bun`; else `npx -y bun`; else suggest `brew install oven-sh\u002Fbun\u002Fbun`.\n\n| Script | Purpose |\n|--------|---------|\n| `scripts\u002Fwechat-browser.ts` | Image-text posts (图文) |\n| `scripts\u002Fwechat-article.ts` | Article posting via browser (文章) |\n| `scripts\u002Fwechat-api.ts` | Article posting via API (文章) |\n| `scripts\u002Fmd-to-wechat.ts` | Markdown → WeChat-ready HTML with image placeholders |\n| `scripts\u002Fcheck-permissions.ts` | Verify environment & permissions |\n\n## Preferences (EXTEND.md)\n\nCheck these paths in order; first hit wins:\n\n| Path | Scope |\n|------|-------|\n| `.baoyu-skills\u002Fbaoyu-post-to-wechat\u002FEXTEND.md` | Project |\n| `${XDG_CONFIG_HOME:-$HOME\u002F.config}\u002Fbaoyu-skills\u002Fbaoyu-post-to-wechat\u002FEXTEND.md` | XDG |\n| `$HOME\u002F.baoyu-skills\u002Fbaoyu-post-to-wechat\u002FEXTEND.md` | User home |\n\nFound → read, parse, apply. Not found → run first-time setup (`references\u002Fconfig\u002Ffirst-time-setup.md`) before anything else.\n\n**Minimum keys** (case-insensitive, accept `1\u002F0` or `true\u002Ffalse`):\n\n| Key | Default | Mapping |\n|-----|---------|---------|\n| `default_author` | empty | Fallback for `author` when CLI\u002Ffrontmatter not provided |\n| `need_open_comment` | `1` | `articles[].need_open_comment` in `draft\u002Fadd` |\n| `only_fans_can_comment` | `0` | `articles[].only_fans_can_comment` in `draft\u002Fadd` |\n\n**Recommended EXTEND.md**:\n\n```md\ndefault_theme: default\ndefault_color: blue\ndefault_publish_method: browser\ndefault_author: 宝玉\nneed_open_comment: 1\nonly_fans_can_comment: 0\nchrome_profile_path: \u002Fpath\u002Fto\u002Fchrome\u002Fprofile\n\n# Remote API publishing (optional) — only set if WeChat's IP allowlist\n# excludes your local machine. See \"Remote API Method\" below.\n# remote_publish_host: server.example.com\n# remote_publish_user: deploy\n# remote_publish_port: 22\n# remote_publish_identity_file: ~\u002F.ssh\u002Fid_ed25519\n# remote_publish_known_hosts_file: ~\u002F.ssh\u002Fknown_hosts\n# remote_publish_strict_host_key_checking: accept-new\n# remote_publish_connect_timeout: 10\n# remote_publish_proxy_jump: bastion.example.com\n```\n\nRaw `ssh` \u002F `scp` options are intentionally not supported; only the typed keys above are honored. Authentication is SSH key only (no passwords).\n\n**Theme options**: default, grace, simple, modern. **Color presets**: blue, green, vermilion, yellow, purple, sky, rose, olive, black, gray, pink, red, orange (or hex).\n\n**Value priority**: CLI args → frontmatter → EXTEND.md (account-level → global) → skill defaults.\n\n## Multi-Account Support\n\nEXTEND.md supports an `accounts:` block for managing multiple Official Accounts. With 2+ entries, the workflow inserts a Step 0.5 to prompt for account selection (or auto-selects based on `default: true` or `--account \u003Calias>`).\n\nFull details — compatibility rules, per-account keys, credential resolution, per-account Chrome profiles, CLI usage — in `references\u002Fmulti-account.md`.\n\n## Pre-flight Check (Optional)\n\nBefore first use, suggest the environment check (user can skip):\n\n```bash\n${BUN_X} {baseDir}\u002Fscripts\u002Fcheck-permissions.ts\n```\n\nChecks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystroke, API credentials, Chrome conflicts.\n\n| Check fails | Fix |\n|-------------|-----|\n| Chrome | Install Chrome or set `WECHAT_BROWSER_CHROME_PATH` |\n| Profile dir | Shared profile at `baoyu-skills\u002Fchrome-profile` |\n| Bun runtime | `brew install oven-sh\u002Fbun\u002Fbun` or `npm install -g bun` |\n| Accessibility (macOS) | System Settings → Privacy & Security → Accessibility → enable terminal app |\n| Clipboard copy | Ensure Swift\u002FAppKit (macOS: `xcode-select --install`) |\n| Paste keystroke (Linux) | Install `xdotool` (X11) or `ydotool` (Wayland) |\n| API credentials | Follow guided setup in Step 2, or set in `.baoyu-skills\u002F.env` |\n\n## Image-Text Posting (图文)\n\nShort posts with multiple images (up to 9):\n\n```bash\n${BUN_X} {baseDir}\u002Fscripts\u002Fwechat-browser.ts --markdown article.md --images .\u002Fimages\u002F\n${BUN_X} {baseDir}\u002Fscripts\u002Fwechat-browser.ts --title \"标题\" --content \"内容\" --image img.png --submit\n```\n\nDetails: `references\u002Fimage-text-posting.md`.\n\n## Article Posting Workflow (文章)\n\n```\n- [ ] Step 0: Load preferences (EXTEND.md)\n- [ ] Step 0.5: Resolve account (multi-account only — see references\u002Fmulti-account.md)\n- [ ] Step 1: Determine input type\n- [ ] Step 2: Select method and configure credentials\n- [ ] Step 3: Resolve theme\u002Fcolor and validate metadata\n- [ ] Step 4: Publish to WeChat\n- [ ] Step 5: Report completion\n```\n\n### Step 0: Load Preferences\n\nCheck and load EXTEND.md (see \"Preferences\" above). If not found, complete first-time setup before any other questions. Resolve and cache for later steps: `default_theme`, `default_color`, `default_author`, `need_open_comment`, `only_fans_can_comment`.\n\n### Step 1: Determine Input Type\n\n| Input | Detection | Next |\n|-------|-----------|------|\n| HTML file | Path ends `.html`, file exists | Skip to Step 3 |\n| Markdown file | Path ends `.md`, file exists | Step 2 |\n| Plain text | Not a file path, or file doesn't exist | Save to markdown, then Step 2 |\n\n**Plain-text handling**:\n\n1. Generate slug (first 2-4 meaningful words, kebab-case; translate Chinese to English for the slug).\n2. Save to `post-to-wechat\u002FYYYY-MM-DD\u002F\u003Cslug>.md` (create directory if needed).\n3. Continue as a markdown file.\n\n### Step 2: Select Publishing Method and Configure\n\nAsk method unless specified in EXTEND.md or CLI:\n\n| Method | Speed | Requires |\n|--------|-------|----------|\n| `api` (Recommended) | Fast | API credentials (local IP allowlisted) |\n| `browser` | Slow | Chrome + logged-in session |\n| `remote-api` | Fast | API credentials + an SSH-reachable server whose IP is on the WeChat allowlist |\n\n**API selected + missing credentials** → run guided setup per `references\u002Fapi-setup.md` (writes to `.baoyu-skills\u002F.env`).\n\n**`remote-api` method**: WeChat's \"公众号设置 → IP 白名单\" often limits API access to one or two fixed IPs. If your local machine's IP is not on that list but a cloud server's is, use `remote-api`: all markdown rendering, image processing, draft assembly, and HTML rewriting still happen locally, and only the outbound HTTPS calls to `api.weixin.qq.com` (token, uploadimg, add_material, draft\u002Fadd) are tunneled through an SSH SOCKS5 dynamic port forward (`ssh -N -D`) so that WeChat sees the remote server as the source IP. No files are written to the remote host; `AppSecret` never leaves the local process. Requires only `sshd` and outbound network on the remote host — no Python, no agent process. See \"Remote API Method\" below.\n\n### Step 3: Resolve Theme\u002FColor and Validate Metadata\n\n1. **Theme**: CLI `--theme` → EXTEND.md `default_theme` → `default` (first match wins; do NOT ask if resolved).\n2. **Color**: CLI `--color` → EXTEND.md `default_color` → omit (theme default applies).\n3. **Validate metadata** (frontmatter for markdown, meta tags for HTML):\n\n| Field | Missing → |\n|-------|-----------|\n| Title | Ask, or press Enter to auto-generate from content |\n| Summary | Frontmatter `description` → `summary` → ask or auto-generate |\n| Author | CLI `--author` → frontmatter `author` → EXTEND.md `default_author` |\n| Source URL | CLI `--source-url` → frontmatter `sourceUrl`\u002F`contentSourceUrl`\u002F`content_source_url` |\n\nAuto-generation: title = first H1\u002FH2 or first sentence; summary = first paragraph, truncated to 120 chars.\n\n4. **Cover image** (required for API `article_type=news`): CLI `--cover` → frontmatter (`coverImage` \u002F `featureImage` \u002F `cover` \u002F `image`) → `imgs\u002Fcover.png` → first inline image → stop and request one if still missing.\n\n### Step 4: Publish\n\n**Important — never pre-convert markdown to HTML.** Publishing scripts handle the conversion internally and the two methods render images differently: API renders `\u003Cimg>` tags for upload, browser uses placeholders for paste-and-replace. Passing a pre-converted HTML breaks one or the other.\n\n**Markdown citation default**: for markdown input, ordinary external links are converted to bottom citations by default. Use `--no-cite` only if the user explicitly wants to keep inline links. Existing HTML input is left as-is.\n\n**API method** (accepts `.md` or `.html`):\n\n```bash\n${BUN_X} {baseDir}\u002Fscripts\u002Fwechat-api.ts \u003Cfile> --theme \u003Ctheme> [--color \u003Ccolor>] [--title \u003Ctitle>] [--summary \u003Csummary>] [--author \u003Cauthor>] [--cover \u003Ccover_path>] [--source-url \u003Curl>] [--no-cite]\n```\n\nAlways pass `--theme` even if it's `default`. Only pass `--color` when explicitly set by the user or EXTEND.md.\n\n**Remote API method** (same script, adds `--remote`):\n\n```bash\n${BUN_X} {baseDir}\u002Fscripts\u002Fwechat-api.ts \u003Cfile> --theme \u003Ctheme> --remote [--remote-host \u003Chost>] [--remote-user \u003Cuser>] [--remote-port \u003Cport>] [--remote-identity-file \u003Cpath>] [--remote-known-hosts-file \u003Cpath>] [--remote-strict-host-key-checking yes|no|accept-new] [--remote-connect-timeout \u003Cs>] [--remote-proxy-jump \u003Cspec>]\n```\n\nAny `--remote-*` flag implies `--remote`. CLI values override account-level then global `remote_publish_*` keys from EXTEND.md. Setting `default_publish_method: remote-api` also enables remote mode without `--remote`.\n\n**`draft\u002Fadd` payload rules**:\n- Endpoint: `POST https:\u002F\u002Fapi.weixin.qq.com\u002Fcgi-bin\u002Fdraft\u002Fadd?access_token=ACCESS_TOKEN`\n- `article_type`: `news` (default) or `newspic`\n- For `news`, include `thumb_media_id` (cover required)\n- Always include `need_open_comment` (default `1`) and `only_fans_can_comment` (default `0`) in the request body, even if the CLI doesn't expose them\n- For `news`, optionally include `content_source_url` (original article URL, shown as \"阅读原文\" link, max 1KB). Provide via `--source-url` CLI flag or frontmatter `sourceUrl`\u002F`contentSourceUrl`\u002F`content_source_url`\n\n**Browser method** (accepts `--markdown` or `--html`):\n\n```bash\n${BUN_X} {baseDir}\u002Fscripts\u002Fwechat-article.ts --markdown \u003Cmarkdown_file> --theme \u003Ctheme> [--color \u003Ccolor>] [--no-cite]\n${BUN_X} {baseDir}\u002Fscripts\u002Fwechat-article.ts --html \u003Chtml_file>\n```\n\n### Step 5: Completion Report\n\n```\nWeChat Publishing Complete!\n\nInput: [type] - [path]\nMethod: [API | Browser]\nTheme: [theme] [color if set]\n\nArticle:\n• Title: [title]\n• Summary: [summary]\n• Images: [N] inline\n• Comments: [open\u002Fclosed], [fans-only\u002Fall]    ← API method only\n\nResult:\n✓ Draft saved to WeChat Official Account\n• media_id: [media_id]                         ← API method only\n\nNext Steps (API):\n→ Manage drafts: https:\u002F\u002Fmp.weixin.qq.com (登录后进入「内容管理」→「草稿箱」)\n\nFiles created:\n[• post-to-wechat\u002FYYYY-MM-DD\u002Fslug.md (if plain text input)]\n[• slug.html (converted)]\n```\n\n## Feature Comparison\n\n| Feature | Image-Text | Article (API) | Article (Remote API) | Article (Browser) |\n|---------|:---:|:---:|:---:|:---:|\n| Plain text input | ✗ | ✓ | ✓ | ✓ |\n| HTML input | ✗ | ✓ | ✓ | ✓ |\n| Markdown input | Title\u002Fcontent | ✓ | ✓ | ✓ |\n| Multiple images | ✓ (up to 9) | ✓ (inline) | ✓ (inline) | ✓ (inline) |\n| Themes | ✗ | ✓ | ✓ | ✓ |\n| Auto-generate metadata | ✗ | ✓ | ✓ | ✓ |\n| Default cover fallback (`imgs\u002Fcover.png`) | ✗ | ✓ | ✓ | ✗ |\n| Comment control | ✗ | ✓ | ✓ | ✗ |\n| Requires Chrome | ✓ | ✗ | ✗ | ✓ |\n| Requires API credentials | ✗ | ✓ | ✓ | ✗ |\n| Requires SSH-reachable server with allowlisted IP | ✗ | ✗ | ✓ | ✗ |\n| Speed | Medium | Fast | Fast | Slow |\n\n## Troubleshooting\n\n| Issue | Fix |\n|-------|-----|\n| Missing API credentials | Follow guided setup in Step 2 |\n| Access token error | Verify credentials valid and not expired |\n| Not logged in (browser) | First run opens browser — scan QR to log in. Set `TELEGRAM_BOT_TOKEN` + `TELEGRAM_CHAT_ID` to receive the QR image via Telegram |\n| Chrome not found | Set `WECHAT_BROWSER_CHROME_PATH` |\n| Title\u002Fsummary missing | Use auto-generation or provide manually |\n| No cover image | Add frontmatter cover or place `imgs\u002Fcover.png` in article directory |\n| Wrong comment defaults | Check `need_open_comment` \u002F `only_fans_can_comment` in EXTEND.md |\n| Paste fails | Check system clipboard permissions |\n| `Remote publish host is required` | Set `--remote-host` or `remote_publish_host` in EXTEND.md |\n| `SOCKS proxy on 127.0.0.1:… not ready` | SSH could not start the tunnel — check key, host, `StrictHostKeyChecking`, or use `--remote-connect-timeout` |\n| `ssh exited early` during remote publish | Verify the user can `ssh` non-interactively to the server; raise `--remote-connect-timeout` if the link is slow |\n| Remote API call returns `errcode 40164` (invalid IP) | The remote server's egress IP is not on WeChat's allowlist; add it in 公众号设置 → IP 白名单 |\n\n## References\n\n| File | Content |\n|------|---------|\n| `references\u002Fimage-text-posting.md` | Image-text parameters, auto-compression |\n| `references\u002Farticle-posting.md` | Article themes, image handling |\n| `references\u002Fmulti-account.md` | Multi-account compatibility, credentials, Chrome profiles, CLI |\n| `references\u002Fapi-setup.md` | Guided credential setup |\n| `references\u002Fconfig\u002Ffirst-time-setup.md` | First-time EXTEND.md setup |\n\n## Extension Support\n\nCustom configurations via EXTEND.md. See \"Preferences\" for paths and supported options.\n","# Post to WeChat Official Account\n\n## User Input Tools\n\nWhen this skill prompts the user, follow this tool-selection rule (priority order):\n\n1. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent.\n2. **Fallback**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number\u002Fanswer for each question.\n3. **Batching**: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order.\n\nConcrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes.\n\n## Language\n\nRespond in the user's language. If they write in Chinese, reply in Chinese; if English, English. Keep technical tokens (paths, flags, field names) in English.\n\n## Script Directory\n\n`{baseDir}` = this SKILL.md's directory. Resolve `${BUN_X}`: prefer `bun`; else `npx -y bun`; else suggest `brew install oven-sh\u002Fbun\u002Fbun`.\n\n| Script | Purpose |\n|--------|---------|\n| `scripts\u002Fwechat-browser.ts` | Image-text posts (图文) |\n| `scripts\u002Fwechat-article.ts` | Article posting via browser (文章) |\n| `scripts\u002Fwechat-api.ts` | Article posting via API (文章) |\n| `scripts\u002Fmd-to-wechat.ts` | Markdown → WeChat-ready HTML with image placeholders |\n| `scripts\u002Fcheck-permissions.ts` | Verify environment & permissions |\n\n## Preferences (EXTEND.md)\n\nCheck these paths in order; first hit wins:\n\n| Path | Scope |\n|------|-------|\n| `.baoyu-skills\u002Fbaoyu-post-to-wechat\u002FEXTEND.md` | Project |\n| `${XDG_CONFIG_HOME:-$HOME\u002F.config}\u002Fbaoyu-skills\u002Fbaoyu-post-to-wechat\u002FEXTEND.md` | XDG |\n| `$HOME\u002F.baoyu-skills\u002Fbaoyu-post-to-wechat\u002FEXTEND.md` | User home |\n\nFound → read, parse, apply. Not found → run first-time setup (`references\u002Fconfig\u002Ffirst-time-setup.md`) before anything else.\n\n**Minimum keys** (case-insensitive, accept `1\u002F0` or `true\u002Ffalse`):\n\n| Key | Default | Mapping |\n|-----|---------|---------|\n| `default_author` | empty | Fallback for `author` when CLI\u002Ffrontmatter not provided |\n| `need_open_comment` | `1` | `articles[].need_open_comment` in `draft\u002Fadd` |\n| `only_fans_can_comment` | `0` | `articles[].only_fans_can_comment` in `draft\u002Fadd` |\n\n**Recommended EXTEND.md**:\n\n```md\ndefault_theme: default\ndefault_color: blue\ndefault_publish_method: browser\ndefault_author: 宝玉\nneed_open_comment: 1\nonly_fans_can_comment: 0\nchrome_profile_path: \u002Fpath\u002Fto\u002Fchrome\u002Fprofile\n\n# Remote API publishing (optional) — only set if WeChat's IP allowlist\n# excludes your local machine. See \"Remote API Method\" below.\n# remote_publish_host: server.example.com\n# remote_publish_user: deploy\n# remote_publish_port: 22\n# remote_publish_identity_file: ~\u002F.ssh\u002Fid_ed25519\n# remote_publish_known_hosts_file: ~\u002F.ssh\u002Fknown_hosts\n# remote_publish_strict_host_key_checking: accept-new\n# remote_publish_connect_timeout: 10\n# remote_publish_proxy_jump: bastion.example.com\n```\n\nRaw `ssh` \u002F `scp` options are intentionally not supported; only the typed keys above are honored. Authentication is SSH key only (no passwords).\n\n**Theme options**: default, grace, simple, modern. **Color presets**: blue, green, vermilion, yellow, purple, sky, rose, olive, black, gray, pink, red, orange (or hex).\n\n**Value priority**: CLI args → frontmatter → EXTEND.md (account-level → global) → skill defaults.\n\n## Multi-Account Support\n\nEXTEND.md supports an `accounts:` block for managing multiple Official Accounts. With 2+ entries, the workflow inserts a Step 0.5 to prompt for account selection (or auto-selects based on `default: true` or `--account \u003Calias>`).\n\nFull details — compatibility rules, per-account keys, credential resolution, per-account Chrome profiles, CLI usage — in `references\u002Fmulti-account.md`.\n\n## Pre-flight Check (Optional)\n\nBefore first use, suggest the environment check (user can skip):\n\n```bash\n${BUN_X} {baseDir}\u002Fscripts\u002Fcheck-permissions.ts\n```\n\nChecks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystroke, API credentials, Chrome conflicts.\n\n| Check fails | Fix |\n|-------------|-----|\n| Chrome | Install Chrome or set `WECHAT_BROWSER_CHROME_PATH` |\n| Profile dir | Shared profile at `baoyu-skills\u002Fchrome-profile` |\n| Bun runtime | `brew install oven-sh\u002Fbun\u002Fbun` or `npm install -g bun` |\n| Accessibility (macOS) | System Settings → Privacy & Security → Accessibility → enable terminal app |\n| Clipboard copy | Ensure Swift\u002FAppKit (macOS: `xcode-select --install`) |\n| Paste keystroke (Linux) | Install `xdotool` (X11) or `ydotool` (Wayland) |\n| API credentials | Follow guided setup in Step 2, or set in `.baoyu-skills\u002F.env` |\n\n## Image-Text Posting (图文)\n\nShort posts with multiple images (up to 9):\n\n```bash\n${BUN_X} {baseDir}\u002Fscripts\u002Fwechat-browser.ts --markdown article.md --images .\u002Fimages\u002F\n${BUN_X} {baseDir}\u002Fscripts\u002Fwechat-browser.ts --title \"标题\" --content \"内容\" --image img.png --submit\n```\n\nDetails: `references\u002Fimage-text-posting.md`.\n\n## Article Posting Workflow (文章)\n\n```\n- [ ] Step 0: Load preferences (EXTEND.md)\n- [ ] Step 0.5: Resolve account (multi-account only — see references\u002Fmulti-account.md)\n- [ ] Step 1: Determine input type\n- [ ] Step 2: Select method and configure credentials\n- [ ] Step 3: Resolve theme\u002Fcolor and validate metadata\n- [ ] Step 4: Publish to WeChat\n- [ ] Step 5: Report completion\n```\n\n### Step 0: Load Preferences\n\nCheck and load EXTEND.md (see \"Preferences\" above). If not found, complete first-time setup before any other questions. Resolve and cache for later steps: `default_theme`, `default_color`, `default_author`, `need_open_comment`, `only_fans_can_comment`.\n\n### Step 1: Determine Input Type\n\n| Input | Detection | Next |\n|-------|-----------|------|\n| HTML file | Path ends `.html`, file exists | Skip to Step 3 |\n| Markdown file | Path ends `.md`, file exists | Step 2 |\n| Plain text | Not a file path, or file doesn't exist | Save to markdown, then Step 2 |\n\n**Plain-text handling**:\n\n1. Generate slug (first 2-4 meaningful words, kebab-case; translate Chinese to English for the slug).\n2. Save to `post-to-wechat\u002FYYYY-MM-DD\u002F\u003Cslug>.md` (create directory if needed).\n3. Continue as a markdown file.\n\n### Step 2: Select Publishing Method and Configure\n\nAsk method unless specified in EXTEND.md or CLI:\n\n| Method | Speed | Requires |\n|--------|-------|----------|\n| `api` (Recommended) | Fast | API credentials (local IP allowlisted) |\n| `browser` | Slow | Chrome + logged-in session |\n| `remote-api` | Fast | API credentials + an SSH-reachable server whose IP is on the WeChat allowlist |\n\n**API selected + missing credentials** → run guided setup per `references\u002Fapi-setup.md` (writes to `.baoyu-skills\u002F.env`).\n\n**`remote-api` method**: WeChat's \"公众号设置 → IP 白名单\" often limits API access to one or two fixed IPs. If your local machine's IP is not on that list but a cloud server's is, use `remote-api`: all markdown rendering, image processing, draft assembly, and HTML rewriting still happen locally, and only the outbound HTTPS calls to `api.weixin.qq.com` (token, uploadimg, add_material, draft\u002Fadd) are tunneled through an SSH SOCKS5 dynamic port forward (`ssh -N -D`) so that WeChat sees the remote server as the source IP. No files are written to the remote host; `AppSecret` never leaves the local process. Requires only `sshd` and outbound network on the remote host — no Python, no agent process. See \"Remote API Method\" below.\n\n### Step 3: Resolve Theme\u002FColor and Validate Metadata\n\n1. **Theme**: CLI `--theme` → EXTEND.md `default_theme` → `default` (first match wins; do NOT ask if resolved).\n2. **Color**: CLI `--color` → EXTEND.md `default_color` → omit (theme default applies).\n3. **Validate metadata** (frontmatter for markdown, meta tags for HTML):\n\n| Field | Missing → |\n|-------|-----------|\n| Title | Ask, or press Enter to auto-generate from content |\n| Summary | Frontmatter `description` → `summary` → ask or auto-generate |\n| Author | CLI `--author` → frontmatter `author` → EXTEND.md `default_author` |\n| Source URL | CLI `--source-url` → frontmatter `sourceUrl`\u002F`contentSourceUrl`\u002F`content_source_url` |\n\nAuto-generation: title = first H1\u002FH2 or first sentence; summary = first paragraph, truncated to 120 chars.\n\n4. **Cover image** (required for API `article_type=news`): CLI `--cover` → frontmatter (`coverImage` \u002F `featureImage` \u002F `cover` \u002F `image`) → `imgs\u002Fcover.png` → first inline image → stop and request one if still missing.\n\n### Step 4: Publish\n\n**Important — never pre-convert markdown to HTML.** Publishing scripts handle the conversion internally and the two methods render images differently: API renders `\u003Cimg>` tags for upload, browser uses placeholders for paste-and-replace. Passing a pre-converted HTML breaks one or the other.\n\n**Markdown citation default**: for markdown input, ordinary external links are converted to bottom citations by default. Use `--no-cite` only if the user explicitly wants to keep inline links. Existing HTML input is left as-is.\n\n**API method** (accepts `.md` or `.html`):\n\n```bash\n${BUN_X} {baseDir}\u002Fscripts\u002Fwechat-api.ts \u003Cfile> --theme \u003Ctheme> [--color \u003Ccolor>] [--title \u003Ctitle>] [--summary \u003Csummary>] [--author \u003Cauthor>] [--cover \u003Ccover_path>] [--source-url \u003Curl>] [--no-cite]\n```\n\nAlways pass `--theme` even if it's `default`. Only pass `--color` when explicitly set by the user or EXTEND.md.\n\n**Remote API method** (same script, adds `--remote`):\n\n```bash\n${BUN_X} {baseDir}\u002Fscripts\u002Fwechat-api.ts \u003Cfile> --theme \u003Ctheme> --remote [--remote-host \u003Chost>] [--remote-user \u003Cuser>] [--remote-port \u003Cport>] [--remote-identity-file \u003Cpath>] [--remote-known-hosts-file \u003Cpath>] [--remote-strict-host-key-checking yes|no|accept-new] [--remote-connect-timeout \u003Cs>] [--remote-proxy-jump \u003Cspec>]\n```\n\nAny `--remote-*` flag implies `--remote`. CLI values override account-level then global `remote_publish_*` keys from EXTEND.md. Setting `default_publish_method: remote-api` also enables remote mode without `--remote`.\n\n**`draft\u002Fadd` payload rules**:\n- Endpoint: `POST https:\u002F\u002Fapi.weixin.qq.com\u002Fcgi-bin\u002Fdraft\u002Fadd?access_token=ACCESS_TOKEN`\n- `article_type`: `news` (default) or `newspic`\n- For `news`, include `thumb_media_id` (cover required)\n- Always include `need_open_comment` (default `1`) and `only_fans_can_comment` (default `0`) in the request body, even if the CLI doesn't expose them\n- For `news`, optionally include `content_source_url` (original article URL, shown as \"阅读原文\" link, max 1KB). Provide via `--source-url` CLI flag or frontmatter `sourceUrl`\u002F`contentSourceUrl`\u002F`content_source_url`\n\n**Browser method** (accepts `--markdown` or `--html`):\n\n```bash\n${BUN_X} {baseDir}\u002Fscripts\u002Fwechat-article.ts --markdown \u003Cmarkdown_file> --theme \u003Ctheme> [--color \u003Ccolor>] [--no-cite]\n${BUN_X} {baseDir}\u002Fscripts\u002Fwechat-article.ts --html \u003Chtml_file>\n```\n\n### Step 5: Completion Report\n\n```\nWeChat Publishing Complete!\n\nInput: [type] - [path]\nMethod: [API | Browser]\nTheme: [theme] [color if set]\n\nArticle:\n• Title: [title]\n• Summary: [summary]\n• Images: [N] inline\n• Comments: [open\u002Fclosed], [fans-only\u002Fall]    ← API method only\n\nResult:\n✓ Draft saved to WeChat Official Account\n• media_id: [media_id]                         ← API method only\n\nNext Steps (API):\n→ Manage drafts: https:\u002F\u002Fmp.weixin.qq.com (登录后进入「内容管理」→「草稿箱」)\n\nFiles created:\n[• post-to-wechat\u002FYYYY-MM-DD\u002Fslug.md (if plain text input)]\n[• slug.html (converted)]\n```\n\n## Feature Comparison\n\n| Feature | Image-Text | Article (API) | Article (Remote API) | Article (Browser) |\n|---------|:---:|:---:|:---:|:---:|\n| Plain text input | ✗ | ✓ | ✓ | ✓ |\n| HTML input | ✗ | ✓ | ✓ | ✓ |\n| Markdown input | Title\u002Fcontent | ✓ | ✓ | ✓ |\n| Multiple images | ✓ (up to 9) | ✓ (inline) | ✓ (inline) | ✓ (inline) |\n| Themes | ✗ | ✓ | ✓ | ✓ |\n| Auto-generate metadata | ✗ | ✓ | ✓ | ✓ |\n| Default cover fallback (`imgs\u002Fcover.png`) | ✗ | ✓ | ✓ | ✗ |\n| Comment control | ✗ | ✓ | ✓ | ✗ |\n| Requires Chrome | ✓ | ✗ | ✗ | ✓ |\n| Requires API credentials | ✗ | ✓ | ✓ | ✗ |\n| Requires SSH-reachable server with allowlisted IP | ✗ | ✗ | ✓ | ✗ |\n| Speed | Medium | Fast | Fast | Slow |\n\n## Troubleshooting\n\n| Issue | Fix |\n|-------|-----|\n| Missing API credentials | Follow guided setup in Step 2 |\n| Access token error | Verify credentials valid and not expired |\n| Not logged in (browser) | First run opens browser — scan QR to log in. Set `TELEGRAM_BOT_TOKEN` + `TELEGRAM_CHAT_ID` to receive the QR image via Telegram |\n| Chrome not found | Set `WECHAT_BROWSER_CHROME_PATH` |\n| Title\u002Fsummary missing | Use auto-generation or provide manually |\n| No cover image | Add frontmatter cover or place `imgs\u002Fcover.png` in article directory |\n| Wrong comment defaults | Check `need_open_comment` \u002F `only_fans_can_comment` in EXTEND.md |\n| Paste fails | Check system clipboard permissions |\n| `Remote publish host is required` | Set `--remote-host` or `remote_publish_host` in EXTEND.md |\n| `SOCKS proxy on 127.0.0.1:… not ready` | SSH could not start the tunnel — check key, host, `StrictHostKeyChecking`, or use `--remote-connect-timeout` |\n| `ssh exited early` during remote publish | Verify the user can `ssh` non-interactively to the server; raise `--remote-connect-timeout` if the link is slow |\n| Remote API call returns `errcode 40164` (invalid IP) | The remote server's egress IP is not on WeChat's allowlist; add it in 公众号设置 → IP 白名单 |\n\n## References\n\n| File | Content |\n|------|---------|\n| `references\u002Fimage-text-posting.md` | Image-text parameters, auto-compression |\n| `references\u002Farticle-posting.md` | Article themes, image handling |\n| `references\u002Fmulti-account.md` | Multi-account compatibility, credentials, Chrome profiles, CLI |\n| `references\u002Fapi-setup.md` | Guided credential setup |\n| `references\u002Fconfig\u002Ffirst-time-setup.md` | First-time EXTEND.md setup |\n\n## Extension Support\n\nCustom configurations via EXTEND.md. See \"Preferences\" for paths and supported options.\n",{},"main","6184979e01f673905139589c194eab38198db2f7",".opencode\u002Fskills\u002Fbaoyu-post-to-wechat",1,"https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE","https:\u002F\u002Fruake.github.io\u002FAWARE","https:\u002F\u002Fgithub.com\u002Fruake","2026-11-15 04:27:27",{"source":7,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add ruake\u002FAWARE --skill baoyu-post-to-wechat",{"tool":36,"command":37},"bunx","bunx skills add ruake\u002FAWARE --skill baoyu-post-to-wechat",{"tool":39,"command":40},"pnpm","pnpm dlx skills add ruake\u002FAWARE --skill baoyu-post-to-wechat","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fbaoyu-post-to-wechat\u002FSKILL.md",true,[],[45,51,58,65,72,78],{"skillNo":46,"name":47,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":48,"categories":49,"keywords":50,"publishedAt":17},"01M75BPBYT89TEE87CGBDX2KF5","xlsx","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fxlsx\u002FSKILL.md",[],[],{"skillNo":52,"name":53,"nameZh":6,"description":54,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":17},"01M75BPA000S9MTH5MY7CZNYYQ","writing-plans","Write comprehensive implementation plans assuming the engineer has zero context for our codebase and questionable taste.","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fwriting-plans\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":17},"01M75BP80ETH9GYVRH8A7QPCSG","web-design-guidelines","Review files for compliance with Web Interface Guidelines.","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fweb-design-guidelines\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":17},"01M75BP5XG8SX5Q2WWZB6QRVFT","web-component-design","Build reusable, maintainable UI components using modern frameworks with clean composition patterns and styling approache","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fweb-component-design\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":17},"01M75BP4B1FC4V81QR1VB56H1E","web-artifacts-builder","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fweb-artifacts-builder\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":17},"01M75BP1XVRW8WQ2XXAJBAYV2V","vueuse-functions","This skill is a decision-and-implementation guide for VueUse composables in Vue.js \u002F Nuxt projects. It maps requirements","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fvueuse-functions\u002FSKILL.md",[],[]]