juejin-cli: A CLI Workflow That Humans and AI Agents Can Rely On for Publishing
For developers automating content pipelines, juejin-cli demonstrates a concrete pattern for making CLI interfaces consumable by AI agents: stable schemas, structured error output, and write receipts that make recovery explicit. Its separation of 'submitted' from 'published' also serves as a reminder that async review flows need their own success semantics.
Publishing a technical post to Juejin involves repetitive steps: picking categories, uploading images, creating drafts, choosing columns, and confirming acceptance. juejin-cli packages those steps into a CLI that both humans and AI agents drive through the same commands. It generates a machine-readable schema from Commander definitions, returns JSON results that hand off draft IDs to the next command, and records operation receipts so timeouts never get mistaken for failed writes.
Beyond the core publish flow, the tool now schedules daily check-ins via launchd, Task Scheduler, or systemd timers, and handles lottery draws with explicit `--allow-spend` flags. Batch publishing preflights an entire directory before writing and skips completed articles. A recent release cut unnecessary tag lookups by stopping on exact matches. The author's key design rule: never auto-replay a write after a timeout; verify the remote state first using the receipt.
Separating 'execute once' from 'when to execute' keeps the CLI surface simple while offloading schedule complexity to the operating system, a pattern worth copying for any periodic automation task.
The write-receipt recovery flow makes the unavoidable uncertainty of network timeouts a first-class part of the API design, forcing callers to reconcile state instead of blindly retrying.
The decision to lock automated tests to draft creation after one submission was rejected by review shows that mocking success at the API level is not enough; review outcomes must be treated as separate failure modes.
Using frontmatter for publishing metadata keeps the article file self-contained, which is a pragmatic way to let both humans and agents treat the Markdown file as the single source of truth.
Can it check in?
It's supported now—welcome to try it out on the official site.
Awesome awesome awesome.