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.
references/regular-posts.md
1# Regular Posts - Detailed Guide23Detailed documentation for posting text and images to X.45## Manual Workflow67If you prefer step-by-step control:89### Step 0: Prefer Chrome Computer Use in Codex1011When running inside Codex, first detect whether Chrome Computer Use is enabled:12131. If Computer Use tools are already visible, call `get_app_state` for `Google Chrome`.142. If not, use `tool_search` for `computer-use get_app_state click press_key drag scroll Google Chrome`, then call `get_app_state`.153. If `get_app_state` succeeds, use the user's real Chrome with Computer Use for all X UI actions.164. Use CDP scripts only when Computer Use is unavailable or explicitly requested.1718If the user explicitly asks for Chrome Computer Use, do not use Playwright, the in-app Browser, or CDP without approval.1920### Step 1: Copy Image to Clipboard2122```bash23${BUN_X} {baseDir}/scripts/copy-to-clipboard.ts image /path/to/image.png24```2526### Step 2: Paste from Clipboard2728```bash29# Simple paste to frontmost app30${BUN_X} {baseDir}/scripts/paste-from-clipboard.ts3132# Paste to Chrome with retries33${BUN_X} {baseDir}/scripts/paste-from-clipboard.ts --app "Google Chrome" --retries 53435# Quick paste with shorter delay36${BUN_X} {baseDir}/scripts/paste-from-clipboard.ts --delay 20037```3839### Step 3: Use Chrome Computer Use (Preferred)40411. Use `get_app_state` for `Google Chrome`.422. Navigate Chrome to `https://x.com/compose/post` if needed.433. Click the composer and type the post text.444. Copy each image to the clipboard with `copy-to-clipboard.ts image <path>`.455. Press `super+v` on macOS or `control+v` on Windows/Linux with Computer Use.466. Wait until X finishes media upload.477. Ask for explicit confirmation before clicking `Post`.4849## Image Support5051- Formats: PNG, JPEG, GIF, WebP52- Max 4 images per post53- Images copied to system clipboard, then pasted via keyboard shortcut5455## Example Session5657```58User: /post-to-x "Hello from Claude!" --image ./screenshot.png5960Claude:611. Detects Chrome Computer Use622. Opens X compose in the user's real Chrome633. Types text into editor644. Copies image to clipboard and pastes with Computer Use655. Waits for upload and verifies the preview666. Asks before clicking Post67```6869## Troubleshooting7071- **Chrome not found**: Set `X_BROWSER_CHROME_PATH` environment variable72- **Not logged in**: First run opens Chrome - log in manually, cookies are saved73- **Image paste fails**:74- Verify clipboard script: `${BUN_X} {baseDir}/scripts/copy-to-clipboard.ts image <path>`75- On macOS, grant "Accessibility" permission to Terminal/iTerm in System Settings > Privacy & Security > Accessibility76- Keep Chrome window visible and in front during paste operations77- **osascript permission denied**: Grant Terminal accessibility permissions in System Preferences78- **Rate limited**: Wait a few minutes before retrying7980## How It Works8182In Chrome Computer Use mode:831. Codex controls the user's visible Google Chrome window842. Text is typed through the real UI853. Images are copied to the system clipboard and pasted with real keystrokes864. The user confirms before the final public post8788The `x-browser.ts` script is the CDP fallback. It uses Chrome DevTools Protocol (CDP) to:891. Launch real Chrome (not Playwright) with `--disable-blink-features=AutomationControlled`902. Use persistent profile directory for saved login sessions913. Interact with X via CDP commands (Runtime.evaluate, Input.dispatchKeyEvent)924. **Paste images using osascript** (macOS): Sends real Cmd+V keystroke to Chrome, bypassing CDP's synthetic events that X can detect9394This approach bypasses X's anti-automation detection that blocks Playwright/Puppeteer.9596### Image Paste Mechanism (macOS)9798CDP's `Input.dispatchKeyEvent` sends "synthetic" keyboard events that websites can detect. X ignores synthetic paste events for security. The solution:991001. Copy image to system clipboard via Swift/AppKit (`copy-to-clipboard.ts`)1012. Bring Chrome to front via `osascript`1023. Send real Cmd+V keystroke via `osascript` and System Events1034. Wait for upload to complete104105This requires Terminal to have "Accessibility" permission in System Settings.106