tuzi-post-to-x

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Post to X (Twitter)

发布到X(Twitter)

Posts text, images, videos, and long-form articles to X via real Chrome browser (bypasses anti-bot detection).
通过真实Chrome浏览器将文字、图片、视频和长文发布到X(绕过反机器人检测)。

Script Directory

脚本目录

Important: All scripts are located in the
scripts/
subdirectory of this skill.
Agent Execution Instructions:
  1. Determine this SKILL.md file's directory path as
    SKILL_DIR
  2. Script path =
    ${SKILL_DIR}/scripts/<script-name>.ts
  3. Replace all
    ${SKILL_DIR}
    in this document with the actual path
Script Reference:
ScriptPurpose
scripts/x-browser.ts
Regular posts (text + images)
scripts/x-video.ts
Video posts (text + video)
scripts/x-quote.ts
Quote tweet with comment
scripts/x-article.ts
Long-form article publishing (Markdown)
scripts/md-to-html.ts
Markdown → HTML conversion
scripts/copy-to-clipboard.ts
Copy content to clipboard
scripts/paste-from-clipboard.ts
Send real paste keystroke
scripts/check-paste-permissions.ts
Verify environment & permissions
重要提示: 所有脚本都位于本skill的
scripts/
子目录下。
Agent执行说明:
  1. 将本SKILL.md文件所在目录路径设为
    SKILL_DIR
  2. 脚本路径 =
    ${SKILL_DIR}/scripts/<script-name>.ts
  3. 将本文档中所有
    ${SKILL_DIR}
    替换为实际路径
脚本参考:
脚本用途
scripts/x-browser.ts
普通发布(文字+图片)
scripts/x-video.ts
视频发布(文字+视频)
scripts/x-quote.ts
带评论的引用推文
scripts/x-article.ts
长文发布(Markdown)
scripts/md-to-html.ts
Markdown转HTML转换
scripts/copy-to-clipboard.ts
复制内容到剪贴板
scripts/paste-from-clipboard.ts
发送真实粘贴按键
scripts/check-paste-permissions.ts
验证环境与权限

Preferences (EXTEND.md)

偏好设置(EXTEND.md)

Use Bash to check EXTEND.md existence (priority order):
bash
undefined
使用Bash检查EXTEND.md是否存在(优先级顺序):
bash
undefined

Check project-level first

Check project-level first

test -f .tuzi-skills/tuzi-post-to-x/EXTEND.md && echo "project"
test -f .tuzi-skills/tuzi-post-to-x/EXTEND.md && echo "project"

Then user-level (cross-platform: $HOME works on macOS/Linux/WSL)

Then user-level (cross-platform: $HOME works on macOS/Linux/WSL)

test -f "$HOME/.tuzi-skills/tuzi-post-to-x/EXTEND.md" && echo "user"

┌──────────────────────────────────────────────────┬───────────────────┐
│                       Path                       │     Location      │
├──────────────────────────────────────────────────┼───────────────────┤
│ .tuzi-skills/tuzi-post-to-x/EXTEND.md          │ Project directory │
├──────────────────────────────────────────────────┼───────────────────┤
│ $HOME/.tuzi-skills/tuzi-post-to-x/EXTEND.md    │ User home         │
└──────────────────────────────────────────────────┴───────────────────┘

┌───────────┬───────────────────────────────────────────────────────────────────────────┐
│  Result   │                                  Action                                   │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Found     │ Read, parse, apply settings                                               │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Not found │ Use defaults                                                              │
└───────────┴───────────────────────────────────────────────────────────────────────────┘

**EXTEND.md Supports**: Default Chrome profile
test -f "$HOME/.tuzi-skills/tuzi-post-to-x/EXTEND.md" && echo "user"

┌──────────────────────────────────────────────────┬───────────────────┐
│                       路径                       │     位置      │
├──────────────────────────────────────────────────┼───────────────────┤
│ .tuzi-skills/tuzi-post-to-x/EXTEND.md          │ 项目目录 │
├──────────────────────────────────────────────────┼───────────────────┤
│ $HOME/.tuzi-skills/tuzi-post-to-x/EXTEND.md    │ 用户主目录 │
└──────────────────────────────────────────────────┴───────────────────┘

┌───────────┬───────────────────────────────────────────────────────────────────────────┐
│  结果   │                                  操作                                   │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ 找到     │ 读取、解析并应用设置                                               │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ 未找到 │ 使用默认设置                                                              │
└───────────┴───────────────────────────────────────────────────────────────────────────┘

**EXTEND.md支持**: 默认Chrome配置文件

Prerequisites

前置要求

  • Google Chrome or Chromium
  • bun
    runtime
  • First run: log in to X manually (session saved)
  • Google Chrome或Chromium
  • bun
    运行时
  • 首次运行:手动登录X(会话会被保存)

Pre-flight Check (Optional)

前置检查(可选)

Before first use, suggest running the environment check. User can skip if they prefer.
bash
npx -y bun ${SKILL_DIR}/scripts/check-paste-permissions.ts
Checks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystroke, Chrome conflicts.
If any check fails, provide fix guidance per item:
CheckFix
ChromeInstall Chrome or set
X_BROWSER_CHROME_PATH
env var
Profile dirEnsure
~/.local/share/x-browser-profile
is writable
Bun runtime
curl -fsSL https://bun.sh/install | bash
Accessibility (macOS)System Settings → Privacy & Security → Accessibility → enable terminal app
Clipboard copyEnsure Swift/AppKit available (macOS Xcode CLI tools:
xcode-select --install
)
Paste keystroke (macOS)Same as Accessibility fix above
Paste keystroke (Linux)Install
xdotool
(X11) or
ydotool
(Wayland)
首次使用前,建议运行环境检查。用户可根据意愿跳过。
bash
npx -y bun ${SKILL_DIR}/scripts/check-paste-permissions.ts
检查项:Chrome、配置文件隔离、Bun、无障碍权限、剪贴板、粘贴按键、Chrome冲突。
如果任何检查失败,按对应项提供修复指引:
检查项修复方案
Chrome安装Chrome或设置
X_BROWSER_CHROME_PATH
环境变量
配置文件目录确保
~/.local/share/x-browser-profile
可写
Bun运行时
curl -fsSL https://bun.sh/install | bash
无障碍权限(macOS)系统设置 → 隐私与安全性 → 无障碍 → 启用终端应用权限
剪贴板复制确保Swift/AppKit可用(macOS Xcode CLI工具:
xcode-select --install
粘贴按键(macOS)与上述无障碍权限修复方案相同
粘贴按键(Linux)安装
xdotool
(X11)或
ydotool
(Wayland)

References

参考文档

  • Regular Posts: See
    references/regular-posts.md
    for manual workflow, troubleshooting, and technical details
  • X Articles: See
    references/articles.md
    for long-form article publishing guide

  • 普通发布: 查看
    references/regular-posts.md
    了解手动工作流、故障排除和技术细节
  • X长文: 查看
    references/articles.md
    了解长文发布指南

Regular Posts

普通发布

Text + up to 4 images.
bash
npx -y bun ${SKILL_DIR}/scripts/x-browser.ts "Hello!" --image ./photo.png
Parameters:
ParameterDescription
<text>
Post content (positional)
--image <path>
Image file (repeatable, max 4)
--profile <dir>
Custom Chrome profile
Note: Script opens browser with content filled in. User reviews and publishes manually.

文字 + 最多4张图片。
bash
npx -y bun ${SKILL_DIR}/scripts/x-browser.ts "Hello!" --image ./photo.png
参数:
参数描述
<text>
发布内容(位置参数)
--image <path>
图片文件(可重复,最多4个)
--profile <dir>
自定义Chrome配置文件
注意: 脚本会打开浏览器并填充好内容,用户手动审核后发布。

Video Posts

视频发布

Text + video file.
bash
npx -y bun ${SKILL_DIR}/scripts/x-video.ts "Check this out!" --video ./clip.mp4
Parameters:
ParameterDescription
<text>
Post content (positional)
--video <path>
Video file (MP4, MOV, WebM)
--profile <dir>
Custom Chrome profile
Note: Script opens browser with content filled in. User reviews and publishes manually.
Limits: Regular 140s max, Premium 60min. Processing: 30-60s.

文字 + 视频文件。
bash
npx -y bun ${SKILL_DIR}/scripts/x-video.ts "Check this out!" --video ./clip.mp4
参数:
参数描述
<text>
发布内容(位置参数)
--video <path>
视频文件(MP4、MOV、WebM)
--profile <dir>
自定义Chrome配置文件
注意: 脚本会打开浏览器并填充好内容,用户手动审核后发布。
限制: 普通账号最长140秒,Premium账号最长60分钟,处理耗时30-60秒。

Quote Tweets

引用推文

Quote an existing tweet with comment.
bash
npx -y bun ${SKILL_DIR}/scripts/x-quote.ts https://x.com/user/status/123 "Great insight!"
Parameters:
ParameterDescription
<tweet-url>
URL to quote (positional)
<comment>
Comment text (positional, optional)
--profile <dir>
Custom Chrome profile
Note: Script opens browser with content filled in. User reviews and publishes manually.

引用现有推文并添加评论。
bash
npx -y bun ${SKILL_DIR}/scripts/x-quote.ts https://x.com/user/status/123 "Great insight!"
参数:
参数描述
<tweet-url>
要引用的推文URL(位置参数)
<comment>
评论文字(位置参数,可选)
--profile <dir>
自定义Chrome配置文件
注意: 脚本会打开浏览器并填充好内容,用户手动审核后发布。

X Articles

X长文

Long-form Markdown articles (requires X Premium).
bash
npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md
npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md --cover ./cover.jpg
Parameters:
ParameterDescription
<markdown>
Markdown file (positional)
--cover <path>
Cover image
--title <text>
Override title
Frontmatter:
title
,
cover_image
supported in YAML front matter.
Note: Script opens browser with article filled in. User reviews and publishes manually.
Post-Composition Check: The script automatically verifies after all images are inserted:
  • Remaining
    XIMGPH_
    placeholders in editor content
  • Expected vs actual image count
If the check fails (warnings in output), alert the user with the specific issues before they publish.

长格式Markdown文章(需要X Premium权限)。
bash
npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md
npx -y bun ${SKILL_DIR}/scripts/x-article.ts article.md --cover ./cover.jpg
参数:
参数描述
<markdown>
Markdown文件(位置参数)
--cover <path>
封面图片
--title <text>
覆盖默认标题
Frontmatter: 支持YAML头部中的
title
cover_image
字段。
注意: 脚本会打开浏览器并填充好文章内容,用户手动审核后发布。
内容撰写后检查: 所有图片插入后脚本会自动验证:
  • 编辑器内容中是否残留
    XIMGPH_
    占位符
  • 预期与实际图片数量是否一致
如果检查失败(输出中有警告),在用户发布前提醒具体问题。

Troubleshooting

故障排除

Chrome debug port not ready

Chrome调试端口未就绪

If a script fails with
Chrome debug port not ready
or
Unable to connect
, kill existing Chrome CDP instances first, then retry:
bash
pkill -f "Chrome.*remote-debugging-port" 2>/dev/null; pkill -f "Chromium.*remote-debugging-port" 2>/dev/null; sleep 2
Important: This should be done automatically — when encountering this error, kill Chrome CDP instances and retry the command without asking the user.
如果脚本运行失败,提示
Chrome debug port not ready
Unable to connect
,先终止现有Chrome CDP实例,然后重试:
bash
pkill -f "Chrome.*remote-debugging-port" 2>/dev/null; pkill -f "Chromium.*remote-debugging-port" 2>/dev/null; sleep 2
重要提示: 该操作应自动执行——遇到此错误时,无需询问用户,直接终止Chrome CDP实例并重试命令即可。

Notes

注意事项

  • First run: manual login required (session persists)
  • All scripts only fill content into the browser, user must review and publish manually
  • Cross-platform: macOS, Linux, Windows
  • 首次运行:需要手动登录(会话会持久保存)
  • 所有脚本仅负责将内容填充到浏览器,用户必须手动审核后发布
  • 跨平台支持:macOS、Linux、Windows

Extension Support

扩展支持

Custom configurations via EXTEND.md. See Preferences section for paths and supported options.
通过EXTEND.md实现自定义配置,路径和支持的选项见偏好设置部分。