x-composer
10
总安装量
10
周安装量
#30972
全站排名
安装命令
npx skills add https://github.com/junghoonghae/x-composer --skill x-composer
Agent 安装分布
claude-code
10
openclaw
10
opencode
10
trae
9
kilo
9
replit
9
Skill 文档
X Composer
Post to X.com via Chrome DevTools Protocol (CDP). Uses real Chrome to bypass anti-bot detection.
Prerequisites
- Google Chrome installed
chrome-remote-interfacenpm package
Install if missing:
npm install -g chrome-remote-interface
Workflow
Posting to X involves these steps:
- Launch Chrome with CDP (run
scripts/cdp-launch.js) - Wait for X.com compose page to load (~3s)
- Type draft text (run
scripts/cdp-type.js) - User reviews and clicks Post manually
Step 1: Launch Chrome
Run scripts/cdp-launch.js with optional URL argument:
NODE_PATH=$(npm root -g) node scripts/cdp-launch.js
| URL | Purpose |
|---|---|
| (default) | https://x.com/compose/post |
https://x.com/home |
Open home feed |
https://x.com/search?q=QUERY&f=live |
Search posts |
Reuses existing Chrome CDP instance if running. First run requires manual X.com login â session persists in ~/.chrome-cdp-profile.
Wait ~3 seconds after launch before typing.
Step 2: Type Draft
Pipe JSON segments to scripts/cdp-type.js via stdin:
echo '[{"text":"Hello world!"}]' | NODE_PATH=$(npm root -g) node scripts/cdp-type.js
Segment Format
| Segment | Effect |
|---|---|
{"text": "string"} |
Insert text (emoji/unicode safe) |
{"enter": true} |
Single line break |
{"enter": 2} |
Multiple line breaks |
Example: Multi-paragraph post
cat << 'EOF' | NODE_PATH=$(npm root -g) node scripts/cdp-type.js
[
{"text": "Hook line with emoji"},
{"enter": 2},
{"text": "Main content paragraph."},
{"enter": 2},
{"text": "- Point one"},
{"enter": true},
{"text": "- Point two"},
{"enter": 2},
{"text": "https://example.com"},
{"enter": true},
{"text": "#hashtag #tags"}
]
EOF
Step 3: User Posts
Draft is entered in browser. User reviews and clicks “Post” manually. Never auto-post.
Troubleshooting
| Issue | Fix |
|---|---|
| Chrome not connecting | pkill -f "Chrome.*remote-debugging" then relaunch |
| No X.com tab found | Launch Chrome first, wait 3s |
| Text not typing | Click compose box in browser first |
| Module not found | npm install -g chrome-remote-interface |
| Login required | Use default profile path (~/.chrome-cdp-profile), login once |
Notes
NODE_PATH=$(npm root -g)resolves globally installedchrome-remote-interfaceInput.insertText()handles emoji/unicode reliably (not character-by-character)- Fixed
--user-data-dirpreserves login across Chrome restarts - If text appears scrambled, restart Chrome and retry