Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Post text, images, videos, and long-form articles to X (Twitter) via real Chrome browser automation.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: baoyu-post-to-x3description: Posts content and articles to X (Twitter). Supports regular posts with images/videos and X Articles (long-form Markdown). Uses real Chrome with CDP to bypass anti-automation. Use when user asks to "post to X", "tweet", "publish to Twitter", or "share on X".4version: 1.56.25metadata:6openclaw:7homepage: https://github.com/JimLiu/baoyu-skills#baoyu-post-to-x8requires:9anyBins:10- bun11- npx12---1314# Post to X (Twitter)1516Posts text, images, videos, and long-form articles to X via real Chrome browser (bypasses anti-bot detection).1718## Script Directory1920**Important**: All scripts are located in the `scripts/` subdirectory of this skill.2122**Agent Execution Instructions**:231. Determine this SKILL.md file's directory path as `{baseDir}`242. Script path = `{baseDir}/scripts/<script-name>.ts`253. Replace all `{baseDir}` in this document with the actual path264. Resolve `${BUN_X}` runtime: if `bun` installed → `bun`; if `npx` available → `npx -y bun`; else suggest installing bun2728**Script Reference**:29| Script | Purpose |30|--------|---------|31| `scripts/x-browser.ts` | Regular posts (text + images) |32| `scripts/x-video.ts` | Video posts (text + video) |33| `scripts/x-quote.ts` | Quote tweet with comment |34| `scripts/x-article.ts` | Long-form article publishing (Markdown) |35| `scripts/md-to-html.ts` | Markdown → HTML conversion |36| `scripts/copy-to-clipboard.ts` | Copy content to clipboard |37| `scripts/paste-from-clipboard.ts` | Send real paste keystroke |38| `scripts/check-paste-permissions.ts` | Verify environment & permissions |3940## Preferences (EXTEND.md)4142Check EXTEND.md in priority order — the first one found wins:4344| Priority | Path | Scope |45|----------|------|-------|46| 1 | `.baoyu-skills/baoyu-post-to-x/EXTEND.md` | Project |47| 2 | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-post-to-x/EXTEND.md` | XDG |48| 3 | `$HOME/.baoyu-skills/baoyu-post-to-x/EXTEND.md` | User home |4950If none found, use defaults.5152**EXTEND.md supports**: Default Chrome profile5354## Prerequisites5556- Google Chrome or Chromium57- `bun` runtime58- First run: log in to X manually (session saved)5960## Pre-flight Check (Optional)6162Before first use, suggest running the environment check. User can skip if they prefer.6364```bash65${BUN_X} {baseDir}/scripts/check-paste-permissions.ts66```6768Checks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystroke, Chrome conflicts.6970**If any check fails**, provide fix guidance per item:7172| Check | Fix |73|-------|-----|74| Chrome | Install Chrome or set `X_BROWSER_CHROME_PATH` env var |75| Profile dir | Shared profile at `baoyu-skills/chrome-profile` (see CLAUDE.md Chrome Profile section) |76| Bun runtime | `brew install oven-sh/bun/bun` (macOS) or `npm install -g bun` |77| Accessibility (macOS) | System Settings → Privacy & Security → Accessibility → enable terminal app |78| Clipboard copy | Ensure Swift/AppKit available (macOS Xcode CLI tools: `xcode-select --install`) |79| Paste keystroke (macOS) | Same as Accessibility fix above |80| Paste keystroke (Linux) | Install `xdotool` (X11) or `ydotool` (Wayland) |8182## References8384- **Regular Posts**: See `references/regular-posts.md` for manual workflow, troubleshooting, and technical details85- **X Articles**: See `references/articles.md` for long-form article publishing guide8687---8889## Post Type Selection9091Unless the user explicitly specifies the post type:92- **Plain text** + within 10,000 characters → **Regular Post** (Premium members support up to 10,000 characters, non-Premium: 280)93- **Markdown file** (.md) → **X Article**9495## Regular Posts9697```bash98${BUN_X} {baseDir}/scripts/x-browser.ts "Hello!" --image ./photo.png99```100101**Parameters**:102| Parameter | Description |103|-----------|-------------|104| `<text>` | Post content (positional) |105| `--image <path>` | Image file (repeatable, max 4) |106| `--profile <dir>` | Custom Chrome profile |107108**Note**: Script opens browser with content filled in. User reviews and publishes manually.109110---111112## Video Posts113114Text + video file.115116```bash117${BUN_X} {baseDir}/scripts/x-video.ts "Check this out!" --video ./clip.mp4118```119120**Parameters**:121| Parameter | Description |122|-----------|-------------|123| `<text>` | Post content (positional) |124| `--video <path>` | Video file (MP4, MOV, WebM) |125| `--profile <dir>` | Custom Chrome profile |126127**Note**: Script opens browser with content filled in. User reviews and publishes manually.128129**Limits**: Regular 140s max, Premium 60min. Processing: 30-60s.130131---132133## Quote Tweets134135Quote an existing tweet with comment.136137```bash138${BUN_X} {baseDir}/scripts/x-quote.ts https://x.com/user/status/123 "Great insight!"139```140141**Parameters**:142| Parameter | Description |143|-----------|-------------|144| `<tweet-url>` | URL to quote (positional) |145| `<comment>` | Comment text (positional, optional) |146| `--profile <dir>` | Custom Chrome profile |147148**Note**: Script opens browser with content filled in. User reviews and publishes manually.149150---151152## X Articles153154Long-form Markdown articles (requires X Premium).155156```bash157${BUN_X} {baseDir}/scripts/x-article.ts article.md158${BUN_X} {baseDir}/scripts/x-article.ts article.md --cover ./cover.jpg159```160161**Parameters**:162| Parameter | Description |163|-----------|-------------|164| `<markdown>` | Markdown file (positional) |165| `--cover <path>` | Cover image |166| `--title <text>` | Override title |167168**Frontmatter**: `title`, `cover_image` supported in YAML front matter.169170**Note**: Script opens browser with article filled in. User reviews and publishes manually.171172**Post-Composition Check**: The script automatically verifies after all images are inserted:173- Remaining `XIMGPH_` placeholders in editor content174- Expected vs actual image count175176If the check fails (warnings in output), alert the user with the specific issues before they publish.177178---179180## Troubleshooting181182### Chrome debug port not ready183184If a script fails with `Chrome debug port not ready` or `Unable to connect`, kill existing Chrome CDP instances first, then retry:185186```bash187pkill -f "Chrome.*remote-debugging-port" 2>/dev/null; pkill -f "Chromium.*remote-debugging-port" 2>/dev/null; sleep 2188```189190**Important**: This should be done automatically — when encountering this error, kill Chrome CDP instances and retry the command without asking the user.191192## Notes193194- First run: manual login required (session persists)195- All scripts only fill content into the browser, user must review and publish manually196- Cross-platform: macOS, Linux, Windows197198## Extension Support199200Custom configurations via EXTEND.md. See **Preferences** section for paths and supported options.201