@postonus/cli

中文文档
0.1.10发布于 2026/11/02UNLICENSEDES Module

Schedule and publish social posts from your terminal

原始使用文档
文档目录6 节
  1. Commands
  2. Scheduling a post
  3. Scripting
  4. CI
  5. Environment
  6. Links

@postonus/cli

Schedule and publish social posts from your terminal.

npm install -g @postonus/cli
postonus login
postonus post "shipping today" --to x,linkedin --optimal

Requires Node.js 22.12 or newer. Needs a Postonus account.

Run without installing: npx @postonus/cli whoami

Commands

CommandWhat it does
login / logout / whoamiBrowser-approved sign in, and who you are
channels listConnected channels and their health
channels connectConnect a new channel over OAuth
post <text>Schedule a post (never publishes immediately)
queue listUpcoming scheduled posts
queue move <scheduleId> --atReschedule one queued post
media upload <path…>Upload images or video for use in posts
best-times --to <platforms>Recommended posting windows

postonus <command> --help for the flags on any of them.

Scheduling a post

postonus post "shipping today" --to x,linkedin --optimal
postonus post --file draft.md --to linkedin --at 2026-08-01T09:30:00Z
postonus post --editor --to x --draft
postonus post "with a video" --to x --media ./demo.mp4 --optimal
cat draft.md | postonus post --to x --optimal

post always schedules; it never publishes on the spot. Pick a time with --at <ISO timestamp> or --optimal for the next recommended window, or use --draft to save without a time. --dry-run shows what would happen and stops.

Scripting

Every command takes --json, which prints machine-readable JSON on stdout and skips all interactive rendering:

postonus queue list --json | jq -r '.queue[] | "\(.scheduledAt) \(.platform)"'
postonus post --file draft.md --to linkedin --at 2026-08-01T09:30:00Z --json

Data goes to stdout, progress and errors to stderr, so pipes stay clean. Exit codes are 0 success, 1 failure, 2 usage error. With no TTY the CLI never prompts — pass the flags instead, and use --no-input to make a missing one an error rather than a wait.

CI

Set POSTONUS_API_KEY to an API key from the dashboard. It takes precedence over a stored session, so no login step is needed:

- run: npx @postonus/cli post "$MESSAGE" --to x --optimal
  env:
    POSTONUS_API_KEY: ${{ secrets.POSTONUS_API_KEY }}

Environment

VariablePurpose
POSTONUS_API_KEYAPI key for non-interactive use; overrides login
POSTONUS_API_URLDashboard to talk to; defaults to production
EDITOR/VISUALEditor opened by post --editor
NO_COLORDisable coloured output
XDG_CONFIG_HOMEWhere the session is stored; defaults to ~/.config

postonus logout removes the stored credentials.

版本与发布记录

@postonus/cli 共发布 11 个版本,首次发布于 2026/08/23;过去 12 个月发布了 11 个版本。

版本发布日期距今
0.1.10latest2026/11/021 天前
0.1.92026/11/021 天前
0.1.82026/11/021 天前
0.1.72026/11/011 天前
0.1.62026/11/011 天前
0.1.52026/11/011 天前

关于 @postonus/cli 的常见问题

@postonus/cli 是什么?

从你的终端安排和发布社交帖子

如何安装 @postonus/cli?

在项目目录运行 npm install @postonus/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 postonus,可以用 npx postonus 直接运行。

@postonus/cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/postonus__cli 是否存在。

@postonus/cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@postonus/cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.12.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@postonus/cli 可以商用吗?

@postonus/cli 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@postonus/cli 还在维护吗?

最新版本 0.1.10 发布于 2026/11/02(1 天前);至今共发布 11 个版本,其中过去 12 个月发布了 11 个;首次发布于 2026/08/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。