From 4300e6899c185b988b1ad476c4b69942effb2f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jim=20Liu=20=E5=AE=9D=E7=8E=89?= Date: Sat, 7 Mar 2026 16:10:19 -0600 Subject: [PATCH] fix(baoyu-post-to-x): keep browser open for manual publishing --- README.md | 2 ++ README.zh.md | 2 ++ skills/baoyu-post-to-x/SKILL.md | 8 ++++++-- skills/baoyu-post-to-x/scripts/x-browser.ts | 11 ++--------- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 30e606c..5929dde 100644 --- a/README.md +++ b/README.md @@ -504,6 +504,8 @@ Smart article illustration skill with Type × Style two-dimension approach. Anal Post content and articles to X (Twitter). Supports regular posts with images and X Articles (long-form Markdown). Uses real Chrome with CDP to bypass anti-automation. +Plain text input is treated as a regular post. Markdown files are treated as X Articles. Scripts fill content into the browser, and the user reviews and publishes manually. + ```bash # Post with text /baoyu-post-to-x "Hello from Claude Code!" diff --git a/README.zh.md b/README.zh.md index 1a5ad5c..8d1a875 100644 --- a/README.zh.md +++ b/README.zh.md @@ -504,6 +504,8 @@ npx skills add jimliu/baoyu-skills 发布内容和文章到 X (Twitter)。支持带图片的普通帖子和 X 文章(长篇 Markdown)。使用真实 Chrome + CDP 绕过反自动化检测。 +纯文本输入默认按普通帖子处理,Markdown 文件默认按 X 文章处理。脚本会将内容填入浏览器,用户需手动检查并发布。 + ```bash # 发布文字 /baoyu-post-to-x "Hello from Claude Code!" diff --git a/skills/baoyu-post-to-x/SKILL.md b/skills/baoyu-post-to-x/SKILL.md index 8597e79..32b6c3d 100644 --- a/skills/baoyu-post-to-x/SKILL.md +++ b/skills/baoyu-post-to-x/SKILL.md @@ -98,9 +98,13 @@ Checks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystrok --- -## Regular Posts +## Post Type Selection -Text + up to 4 images. +Unless the user explicitly specifies the post type: +- **Plain text** + within 10,000 characters → **Regular Post** (Premium members support up to 10,000 characters, non-Premium: 280) +- **Markdown file** (.md) → **X Article** + +## Regular Posts ```bash ${BUN_X} ${SKILL_DIR}/scripts/x-browser.ts "Hello!" --image ./photo.png diff --git a/skills/baoyu-post-to-x/scripts/x-browser.ts b/skills/baoyu-post-to-x/scripts/x-browser.ts index 98dcc9b..c770b4f 100644 --- a/skills/baoyu-post-to-x/scripts/x-browser.ts +++ b/skills/baoyu-post-to-x/scripts/x-browser.ts @@ -187,20 +187,13 @@ export async function postToX(options: XBrowserOptions): Promise { await sleep(2000); console.log('[x-browser] Post submitted!'); } else { - console.log('[x-browser] Post composed (preview mode). Add --submit to post.'); - console.log('[x-browser] Browser will stay open for 30 seconds for preview...'); - await sleep(30_000); + console.log('[x-browser] Post composed. Please review and click the publish button in the browser.'); } } finally { if (cdp) { - try { await cdp.send('Browser.close', {}, { timeoutMs: 5_000 }); } catch {} cdp.close(); } - - setTimeout(() => { - if (!chrome.killed) try { chrome.kill('SIGKILL'); } catch {} - }, 2_000).unref?.(); - try { chrome.kill('SIGTERM'); } catch {} + chrome.unref(); } }