mirror of
https://github.com/JimLiu/baoyu-skills.git
synced 2026-07-13 22:29:48 +08:00
5a11b49b00
## Problem The baoyu-post-to-wechat skill failed on Windows due to: 1. `new URL(import.meta.url).pathname` returns incorrect path format on Windows 2. Copy/paste operations used `xdotool` (Linux tool) which doesn't exist on Windows ## Solution 1. **md-to-wechat.ts**: Use `fileURLToPath()` to correctly resolve file paths on Windows 2. **wechat-article.ts**: Use CDP `Input.dispatchKeyEvent` for copy/paste operations - Replaces system-dependent tools (xdotool/osascript) - Works consistently across Windows/macOS/Linux - More reliable as it operates within Chrome session ## Changes - Import `fileURLToPath` from 'node:url' - Replace `new URL(import.meta.url).pathname` with `fileURLToPath(import.meta.url)` - Replace system tool calls with CDP keyboard events for Ctrl+C and Ctrl+V - Add platform-specific modifier handling (Cmd for macOS, Ctrl for Windows/Linux) ## Testing - Tested successfully on Windows 11 - Markdown conversion works correctly - HTML copy/paste to WeChat editor works correctly Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>