fix(baoyu-post-to-x): keep browser open for manual publishing

This commit is contained in:
Jim Liu 宝玉 2026-03-07 16:10:19 -06:00
parent 4435366898
commit 4300e6899c
4 changed files with 12 additions and 11 deletions

View File

@ -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!"

View File

@ -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!"

View File

@ -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

View File

@ -187,20 +187,13 @@ export async function postToX(options: XBrowserOptions): Promise<void> {
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();
}
}