WeMedia (wm) CLI: one command line for publishing articles across Juejin, WeChat, Xiaohongshu, and Zhihu
For developers building multi-platform publishing automation, wm demonstrates a robust architecture for moving content and identity into checkable local artifacts so that writes fail loudly and resumably rather than silently duplicating. Its capability-based extension model and generated schema give AI agents a way to discover platform-specific requirements without hardcoded prompts.
WeMedia (wm) is a CLI tool (installed as `wm`) that helps AI assistants publish content across multiple Chinese platforms: Juejin, WeChat Official Account, Xiaohongshu, and Zhihu. Its architecture separates each platform's specific rules (like input fields, image limits, and request handling) from the common mechanisms that all platforms share: content preparation, account and session management, execution, and result tracking.
wm builds a publish plan before executing it. A `PlanningService` captures a content snapshot and fixes the target accounts and intended operations; a separate `PublishingService` carries out the steps and records each one. If the network drops mid-publish, operation records and look-back checks distinguish failed from unknown, allowing safe recovery without accidentally duplicating content.
The tool also supports extensibility by organizing platform features as declarative capabilities with Zod-defined inputs, which feed both TypeScript inference and JSON Schema that AI assistants can query. A new platform requires implementing login, capability declarations, content conversion, and step orchestration, but can reuse the common content snapshot, account binding, task records, and result query mechanisms.
Capability declarations rather than a single unified interface are a pragmatically honest way to model platforms that differ drastically: callers get an explicit unavailable result instead of a fake success.
The separation of plan preparation from execution is an exercise in diff-friendly delegation: AI can see and approve the intended side effects before they become irreversible.
Treating a task as a snapshot of content plus a list of recorded facts makes recovery a matter of reconciling evidence rather than guessing intent.
The tool's explicit acknowledgment that network resends can be ambiguous is a useful departure from overclaiming at-least-once or exactly-once semantics in distributed systems.
Generating JSON Schema from the same Zod input definitions that drive TypeScript types closes a loop for AI agents: they can discover what the tool accepts without being hand-coded per platform.