npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@northmoon-labs/social-cli

v0.1.0

Published

Agent-ready CLI for Northmoon Social account authorization, publishing, comments, analytics, webhooks, and auto replies.

Readme

Northmoon Social CLI

nmsocial 是给 Agent 使用的 Northmoon Social 命令行工具,让 Agent 可以通过稳定的命令完成社媒账号授权、素材管理、内容发布、评论处理、数据统计和自动回复配置。

你可以使用 nmsocial 完成:

  • 获取社媒账号授权链接
  • 查询已授权账号
  • 上传视频和图片素材
  • 创建视频 / 图文发布任务
  • 查询发布任务和发布记录
  • 查询评论并回复评论
  • 配置 webhook 转发地址
  • 查询账号、作品、平台统计数据
  • 管理自动回复策略

安装

npm install -g @northmoon-labs/social-cli

检查是否安装成功:

nmsocial --help

也可以直接用 npx 运行:

npx @northmoon-labs/social-cli --help

登录

推荐使用 --api-key-stdin 登录,避免 API Key 出现在 shell history 中:

nmsocial login --api-key-stdin

如果是 Agent 或自动化客户端调用,也可以直接传入 API Key:

nmsocial login --api-key YOUR_KEY

使用 --api-key 更方便自动化,但要注意不要把包含 API Key 的命令输出到公开日志中。

查看当前登录状态:

nmsocial status

退出登录:

nmsocial logout

更新 CLI

检查是否有新版本:

nmsocial update check

更新到 npm 上的最新版本:

nmsocial update

只查看将要执行的安装命令,不实际更新:

nmsocial update --dry-run

默认会根据当前运行环境选择包管理器,无法判断时使用 npm。你也可以手动指定:

nmsocial update --manager npm
nmsocial update --manager pnpm
nmsocial update --manager bun

给 Agent 使用

npm 包内包含一份给 Agent 阅读的 CLI 使用说明:

skills/nmsocial-cli/SKILL.md

如果你的 Agent 支持读取 skill、工具说明或外部上下文,可以把这个文件提供给它。该文件只说明如何调用 nmsocial,不包含内部开发文档。

全局参数

| 参数 | 说明 | | --- | --- | | --json | 输出稳定 JSON,适合脚本解析 | | --timeout MS | 设置请求超时时间,单位毫秒 | | --dry-run | 只预览请求内容,不发送请求 | | --help | 查看帮助 | | --version | 查看版本 |

输出格式

默认输出为简洁文本或表格,适合在终端里快速查看,也能减少 Agent 阅读结果时的无关内容。

如果要让脚本或 Agent 稳定解析返回结果,请加上 --json:

nmsocial accounts list --platform tiktok --json

平台参数

涉及平台的命令支持平台名称或平台数字:

| 平台名称 | 平台数字 | | --- | --- | | tiktok | 1 | | youtube | 2 | | instagram | 3 | | facebook | 4 |

示例:

nmsocial auth-url --platform tiktok
nmsocial auth-url --platform 1

账号授权

获取授权链接:

nmsocial auth-url --platform tiktok

查询已授权账号:

nmsocial accounts list --platform tiktok --status 1 --page 1 --page-size 20

按条件筛选账号:

nmsocial accounts list \
  --platform youtube \
  --username demo \
  --is-verified 1 \
  --page-size 50

YouTube 剧集

查询剧集列表:

nmsocial youtube series list --open-id CHANNEL_ID

创建剧集:

nmsocial youtube series create \
  --open-id CHANNEL_ID \
  --title "Demo Series" \
  --description "Demo description"

创建前预览请求内容:

nmsocial youtube series create \
  --open-id CHANNEL_ID \
  --title "Demo Series" \
  --dry-run \
  --json

素材

查询素材列表:

nmsocial materials list --type 1 --title demo --page 1 --page-size 20

上传素材:

nmsocial materials upload ./demo.mp4

支持的文件类型:

  • 视频:mp4、mov、avi、mkv、webm、flv、wmv、m4v、3gp
  • 图片:jpg、jpeg、png、gif、bmp、webp、heic、heif、tif、tiff

上传后的素材默认保留七天。

发布任务

创建视频发布任务:

nmsocial publish video \
  --account OPEN_ID_1 \
  --account OPEN_ID_2 \
  --content https://example.com/video1.mp4 \
  --caption "hello"

创建图文发布任务:

nmsocial publish image \
  --account OPEN_ID \
  --content https://example.com/image1.png \
  --content https://example.com/image2.png \
  --title "title" \
  --caption "caption"

定时发布:

nmsocial publish video \
  --account OPEN_ID \
  --content https://example.com/video.mp4 \
  --at 2026-07-18T10:00:00+08:00

创建前预览请求内容:

nmsocial publish video \
  --account OPEN_ID \
  --content https://example.com/video.mp4 \
  --video-assign-type 1 \
  --privacy public \
  --dry-run \
  --json

--account、--content、--playlist-id 等参数可以重复传入。

任务查询

查询发布任务:

nmsocial tasks list --platform tiktok --page 1 --page-size 20

按发布方式或时间筛选:

nmsocial tasks list \
  --platform tiktok \
  --video-assign-type 1 \
  --create-time-begin 1783990000000 \
  --create-time-end 1784000000000

发布记录

查询发布记录:

nmsocial posts list --platform tiktok --open-id OPEN_ID

查询已发布作品统计:

nmsocial posts stats --platform tiktok --main-task-id TASK_ID

评论

查询评论:

nmsocial comments list --platform tiktok --open-id OPEN_ID

回复评论:

nmsocial comments reply \
  --platform tiktok \
  --open-id OPEN_ID \
  --video-id VIDEO_ID \
  --comment-id COMMENT_ID \
  --text "Thanks"

回复前预览请求内容:

nmsocial comments reply \
  --platform tiktok \
  --open-id OPEN_ID \
  --video-id VIDEO_ID \
  --comment-id COMMENT_ID \
  --text "Thanks" \
  --dry-run \
  --json

Webhook

设置 webhook 转发地址:

nmsocial webhook set --url https://partner.example.com/spost/webhook

关闭 webhook 转发:

nmsocial webhook disable

数据统计

查询统计概览:

nmsocial stats overview --platform tiktok --start-date 2026-07-11 --end-date 2026-07-17

查询账号趋势:

nmsocial stats account trend --platform tiktok --metric followers

查询账号排行:

nmsocial stats account rank --metric followerIncrease --order desc --page 1 --page-size 20

查询作品趋势:

nmsocial stats post trend --platform tiktok --metric viewCount

查询作品排行:

nmsocial stats post rank --metric viewIncrease --order desc --page 1 --page-size 20

查询单个作品趋势:

nmsocial stats post detail-trend \
  --post-id POST_ID \
  --metric viewCount \
  --metric likeCount \
  --metric commentCount

查询平台汇总:

nmsocial stats platform summary --start-date 2026-07-11 --end-date 2026-07-17

日期参数格式为 yyyy-MM-dd。

自动回复

查询自动回复策略:

nmsocial auto-replies list --platform tiktok --page 1 --page-size 20

查看策略详情:

nmsocial auto-replies detail --id STRATEGY_ID

创建策略:

nmsocial auto-replies create \
  --name "Demo auto reply" \
  --platform tiktok \
  --account-id ACCOUNT_RECORD_ID \
  --trigger-rule keyword \
  --keyword price \
  --keyword coupon \
  --send-rule sequence \
  --content "Thanks for your comment" \
  --content-delay 0 \
  --once-per-user false \
  --repeat-interval-hours 24 \
  --stop-on-user-reply true \
  --enabled true

通过 JSON 文件创建:

nmsocial auto-replies create --from-file ./auto-reply.json --dry-run --json

通过 JSON 文件更新:

nmsocial auto-replies update --id STRATEGY_ID --from-file ./auto-reply.json

启用、停用或删除策略:

nmsocial auto-replies enable --id STRATEGY_ID
nmsocial auto-replies disable --id STRATEGY_ID
nmsocial auto-replies delete --id STRATEGY_ID

JSON 输出

需要在脚本中解析输出时,建议使用 --json。

成功响应:

{
  "ok": true,
  "data": {},
  "error": null,
  "meta": {
    "providerCode": 200,
    "providerMessage": "ok",
    "providerTimestamp": "2026-07-14T15:34:08.576+08:00",
    "requestId": "11"
  }
}

错误响应:

{
  "ok": false,
  "data": null,
  "error": {
    "code": "SOCIAL_API_ERROR",
    "message": "invalid api key",
    "status": 403,
    "payload": {}
  },
  "meta": null
}

使用建议

  • 创建或更新发布任务、评论回复、webhook、自动回复策略前,可以先使用 --dry-run --json 预览请求内容。
  • nmsocial status 会隐藏完整 API Key。
  • 不要把 API Key 直接写在 shell 命令中。