From f6d5df0594fc3f6c69d8fc76cb80c5a87a94c7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jim=20Liu=20=E5=AE=9D=E7=8E=89?= Date: Fri, 24 Apr 2026 02:15:30 -0500 Subject: [PATCH] fix(baoyu-post-to-x): add entry point guard to md-to-html.ts for module import compatibility Wrap main() in an import.meta.url check so that importing parseMarkdown from x-article.ts no longer triggers the CLI entry point. Mirrors the same fix applied to baoyu-post-to-weibo. --- skills/baoyu-post-to-x/SKILL.md | 2 +- skills/baoyu-post-to-x/scripts/md-to-html.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/skills/baoyu-post-to-x/SKILL.md b/skills/baoyu-post-to-x/SKILL.md index 6d3f0a5..8c45457 100644 --- a/skills/baoyu-post-to-x/SKILL.md +++ b/skills/baoyu-post-to-x/SKILL.md @@ -1,7 +1,7 @@ --- name: baoyu-post-to-x description: Posts content and articles to X (Twitter). Supports regular posts with images/videos and X Articles (long-form Markdown). Uses real Chrome with CDP to bypass anti-automation. Use when user asks to "post to X", "tweet", "publish to Twitter", or "share on X". -version: 1.56.1 +version: 1.56.2 metadata: openclaw: homepage: https://github.com/JimLiu/baoyu-skills#baoyu-post-to-x diff --git a/skills/baoyu-post-to-x/scripts/md-to-html.ts b/skills/baoyu-post-to-x/scripts/md-to-html.ts index cff3ef4..77fb331 100644 --- a/skills/baoyu-post-to-x/scripts/md-to-html.ts +++ b/skills/baoyu-post-to-x/scripts/md-to-html.ts @@ -5,6 +5,7 @@ import os from 'node:os'; import path from 'node:path'; import process from 'node:process'; import { createHash } from 'node:crypto'; +import { pathToFileURL } from 'node:url'; import frontMatter from 'front-matter'; import hljs from 'highlight.js/lib/common'; @@ -458,7 +459,9 @@ async function main(): Promise { } } -await main().catch((err) => { - console.error(`Error: ${err instanceof Error ? err.message : String(err)}`); - process.exit(1); -}); +if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { + await main().catch((err) => { + console.error(`Error: ${err instanceof Error ? err.message : String(err)}`); + process.exit(1); + }); +}