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

@kriston-ai/kst-im-cli

v0.0.9

Published

KST IM CLI 工具

Readme

kst-im-cli

快商通 IM 命令行工具,用于管理渠道账号、网页站点、查询统计看板和历史会话。

安装

npm install -g @kriston-ai/kst-im-cli

需要 Node.js >= 18。

快速开始

# 登录
kst-im-cli auth login -k <API_KEY>

# Agent / CI:通过环境变量注入 key,无需 auth login
export KST_ONLINE_CLI_API_KEY=<API_KEY>
kst-im-cli channel type list

# 查看登录状态
kst-im-cli auth status

# 渠道账号
kst-im-cli channel type list
kst-im-cli channel account list --channelKey weixin

# 网页站点
kst-im-cli site list
kst-im-cli site get --siteId 118501

# 统计看板
kst-im-cli stats init
kst-im-cli stats basic-board channel --period today --accounts 101,102
kst-im-cli stats basic-board web --period today --sites 118501,118503

# 历史会话
kst-im-cli history schema
kst-im-cli history web --start "2026-06-01 00:00:00" --end "2026-06-03 23:59:59"
kst-im-cli history channel --start "2026-06-01 00:00:00" --end "2026-06-03 23:59:59"

命令列表

| 命令 | 说明 | |------|------| | auth login -k <key> | 登录认证 | | auth logout | 登出 | | auth status | 查看登录状态 | | config get <key> | 获取配置项 | | config set <key> <value> | 设置配置项 | | channel type list | 列出渠道类型 | | channel type get --key <key> | 查询单个渠道类型 | | channel account list [--channelKey <keys>] [--keyword <text>] | 列出渠道账号 | | channel account get --accountId <id> | 查询单个渠道账号 | | site list [--with-codes] | 列出网页站点 | | site get --siteId <id> [--with-codes] | 查询单个站点 | | stats init | 拉取并缓存统计基础数据 | | stats basic-board channel | 渠道基础看板 | | stats basic-board web | 网页站点看板 | | history schema | 历史记录字段说明 | | history web --start <time> --end <time> | 查询网页历史会话 | | history channel --start <time> --end <time> | 查询渠道历史会话 |

输出格式

所有命令支持 --format 选项:

  • json — JSON 信封(默认):{ ok: true, data: ..., meta: { count: N } }
  • table — 表格
  • pretty — 格式化 JSON

统计看板用法

时间范围

--period 快捷值:todayyesterdayweeklast-week

也可用自定义时间:--start "yyyy-MM-dd HH:mm:ss" --end "yyyy-MM-dd HH:mm:ss"

两者互斥。

筛选对象

  • --accounts <ids>:渠道账号 ID(逗号分隔,来源 channel account list
  • --sites <ids>:站点 ID(逗号分隔,来源 site list

省略则查询全部对象的指标汇总。

历史会话用法

查询前建议先执行 history schema 了解返回字段含义。

kst-im-cli history web \
  --start "2026-06-01 00:00:00" \
  --end "2026-06-03 23:59:59" \
  --site-ids 118501,118504 \
  --page 1 --page-size 500
  • --page-size 最大 1000,大范围查询请分页
  • 时间格式固定为 yyyy-MM-dd HH:mm:ss

配置

配置文件位于 ~/.config/.kst-im-cli/config.json,可通过环境变量 KST_IM_CLI_CONFIG_DIR 覆盖路径。

API Key 也可通过环境变量 KST_ONLINE_CLI_API_KEY 注入(优先级高于配置文件),适合 Agent 沙箱场景。

License

ISC