publish-x-article

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

X Article Publisher

X 文章发布工具

Publish Markdown content into X (Twitter) Articles as a draft, preserving formatting via rich text paste and deterministic image insertion.
将Markdown内容以草稿形式发布到X(Twitter)文章,通过富文本粘贴和固定规则插入图片来保留格式。

Hard Rules (Safety)

硬性规则(安全要求)

  1. Never auto-publish (draft only; user publishes manually).
  2. User must be logged in before automation starts.
  3. First image = cover image (if any).
  1. 绝不自动发布(仅生成草稿;需用户手动发布)。
  2. 自动化开始前用户必须已登录
  3. 首张图片将作为封面图(如果存在图片的话)。

Prerequisites

前置条件

  • Browser automation available (Playwright MCP or equivalent)
  • X account can access Articles (Premium / Premium Plus)
  • macOS recommended (clipboard helper uses Cocoa)
  • Python 3.9+ with:
    • pip install Pillow pyobjc-framework-Cocoa
  • 具备浏览器自动化能力(如Playwright MCP或同类工具)
  • X账号可访问Articles功能(需Premium或Premium Plus会员)
  • 推荐使用macOS系统(剪贴板助手依赖Cocoa)
  • Python 3.9及以上版本,并安装以下依赖:
    • pip install Pillow pyobjc-framework-Cocoa

Inputs / Outputs (Recommended)

输入/输出(推荐配置)

Inputs (paths only):
  • article_md_path
    : Markdown file to publish
  • Optional:
    run_dir
    for artifacts (otherwise use
    /tmp/
    )
Outputs (recommended artifacts):
  • /tmp/x_article.json
    (parsed structure)
  • /tmp/x_article.html
    (HTML body for paste)
  • Optional:
    run_dir/05-final/x-article-draft.md
    (what was done + links)
输入(仅支持路径):
  • article_md_path
    :待发布的Markdown文件路径
  • 可选:
    run_dir
    :用于存储产物的目录(默认使用
    /tmp/
输出(推荐产物):
  • /tmp/x_article.json
    (解析后的结构文件)
  • /tmp/x_article.html
    (用于粘贴的HTML主体内容)
  • 可选:
    run_dir/05-final/x-article-draft.md
    (记录操作内容及链接)

Bundled Scripts

内置脚本

Installed path (typical):
  • ~/.claude/skills/publish-x-article/scripts/parse_markdown.py
  • ~/.claude/skills/publish-x-article/scripts/copy_to_clipboard.py
默认安装路径:
  • ~/.claude/skills/publish-x-article/scripts/parse_markdown.py
  • ~/.claude/skills/publish-x-article/scripts/copy_to_clipboard.py

Runbook (Step-by-step)

操作手册(分步指南)

Follow:
references/runbook.md
请参考:
references/runbook.md