JimLiu/baoyu-skills / skills/baoyu-post-to-x
baoyu-post-to-x
VerifiedPosts content and articles to X (Twitter). Supports regular posts with images/videos and X Articles (long-form Markdown). In Codex, honor explicit requests for the Codex Chrome plugin/@chrome by using the Chrome Extension workflow; otherwise use Chrome Computer Use when available and fall back to real Chrome CDP scripts only when allowed. Use when user asks to "post to X", "tweet", "publish to Twitter", or "share on X".
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 12.4 KB |
| references/articles.md | markdown | 5.0 KB |
| references/regular-posts.md | markdown | 2.5 KB |
| scripts/bun.lock | other | 23.4 KB |
| scripts/check-paste-permissions.ts | script | 8.1 KB |
| scripts/copy-to-clipboard.ts | script | 11.9 KB |
| scripts/md-to-html.test.ts | script | 5.5 KB |
| scripts/md-to-html.ts | script | 13.1 KB |
| scripts/package.json | manifest | 379 B |
| scripts/paste-from-clipboard.ts | script | 5.5 KB |
| scripts/x-article.ts | script | 31.0 KB |
| scripts/x-browser.ts | script | 8.8 KB |
| scripts/x-quote.ts | script | 8.9 KB |
| scripts/x-utils.test.ts | script | 1.6 KB |
| scripts/x-utils.ts | script | 8.6 KB |
| scripts/x-video.ts | script | 9.3 KB |
references/regular-posts.md
View on GitHub# Regular Posts - Detailed Guide
The Computer Use flow for regular posts is in SKILL.md ("Chrome Computer Use Mode").
## Detecting Chrome Computer Use (Codex)
1. If Computer Use tools are visible, call `get_app_state` for `Google Chrome`.
2. If not, `tool_search` for `computer-use get_app_state click press_key drag scroll Google Chrome`, then call `get_app_state`.
3. If it succeeds, use the user's real Chrome with Computer Use for all X UI actions; use CDP scripts only when Computer Use is unavailable or explicitly requested.
If the user explicitly asks for Chrome Computer Use, do not use Playwright, the in-app Browser, or CDP without approval.
## Manual Clipboard Steps
```bash
# Copy image to clipboard
${BUN_X} {baseDir}/scripts/copy-to-clipboard.ts image /path/to/image.png
# Paste to frontmost app
${BUN_X} {baseDir}/scripts/paste-from-clipboard.ts
# Paste to Chrome with retries
${BUN_X} {baseDir}/scripts/paste-from-clipboard.ts --app "Google Chrome" --retries 5
# Quick paste with shorter delay
${BUN_X} {baseDir}/scripts/paste-from-clipboard.ts --delay 200
```
## Image Support
PNG, JPEG, GIF, WebP; max 4 images per post. Images are copied to the system clipboard, then pasted via keyboard shortcut.
## Troubleshooting
- **Chrome not found**: Set `X_BROWSER_CHROME_PATH` environment variable
- **Not logged in**: First run opens Chrome - log in manually, cookies are saved
- **Image paste fails**:
- Verify clipboard script: `${BUN_X} {baseDir}/scripts/copy-to-clipboard.ts image <path>`
- On macOS, grant "Accessibility" permission to Terminal/iTerm in System Settings > Privacy & Security > Accessibility
- Keep Chrome window visible and in front during paste operations
- **osascript permission denied**: Grant Terminal accessibility permissions in System Preferences
- **Rate limited**: Wait a few minutes before retrying
## How the CDP Fallback Works (`x-browser.ts`)
1. Launches real Chrome (not Playwright) with `--disable-blink-features=AutomationControlled` — X blocks Playwright/Puppeteer
2. Persistent profile directory keeps the login
3. Interacts via CDP (`Runtime.evaluate`, `Input.dispatchKeyEvent`)
4. Pastes images with a real keystroke, because X ignores CDP's synthetic paste events (macOS):
1. Copy image to system clipboard via Swift/AppKit (`copy-to-clipboard.ts`)
2. Bring Chrome to front via `osascript`
3. Send real Cmd+V via `osascript` and System Events
4. Wait for upload to complete
This requires Terminal to have "Accessibility" permission in System Settings.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |