From 52ade637affc2d38ee4bda55154da2347c165b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jim=20Liu=20=E5=AE=9D=E7=8E=89?= Date: Tue, 10 Feb 2026 15:46:14 -0600 Subject: [PATCH] fix(baoyu-post-to-x): fix Chrome launch on macOS and cover image path resolution Use open -na on macOS to avoid process blocking; resolve relative cover image paths to absolute paths. --- skills/baoyu-post-to-x/scripts/x-article.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/skills/baoyu-post-to-x/scripts/x-article.ts b/skills/baoyu-post-to-x/scripts/x-article.ts index 31224dd..ad9673b 100644 --- a/skills/baoyu-post-to-x/scripts/x-article.ts +++ b/skills/baoyu-post-to-x/scripts/x-article.ts @@ -109,7 +109,7 @@ export async function publishArticle(options: ArticleOptions): Promise { console.log(`[x-article] Reusing existing Chrome instance on port ${port}`); } else { console.log(`[x-article] Launching Chrome...`); - spawn(chromePath, [ + const chromeArgs = [ `--remote-debugging-port=${port}`, `--user-data-dir=${profileDir}`, '--no-first-run', @@ -117,7 +117,13 @@ export async function publishArticle(options: ArticleOptions): Promise { '--disable-blink-features=AutomationControlled', '--start-maximized', X_ARTICLES_URL, - ], { stdio: 'ignore' }); + ]; + if (process.platform === 'darwin') { + const appPath = chromePath.replace(/\/Contents\/MacOS\/Google Chrome$/, ''); + spawn('open', ['-na', appPath, '--args', ...chromeArgs], { stdio: 'ignore' }); + } else { + spawn(chromePath, chromeArgs, { stdio: 'ignore' }); + } } let cdp: CdpConnection | null = null; @@ -732,7 +738,8 @@ async function main(): Promise { if (arg === '--title' && args[i + 1]) { title = args[++i]; } else if (arg === '--cover' && args[i + 1]) { - coverImage = args[++i]; + const raw = args[++i]!; + coverImage = path.isAbsolute(raw) ? raw : path.resolve(process.cwd(), raw); } else if (arg === '--submit') { submit = true; } else if (arg === '--profile' && args[i + 1]) {