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

@gewulogic/hive-cli

v0.1.7

Published

CLI for common Hive gateway operations

Readme

hive-cli

hive-cli 是 Hive 网关常用操作的命令行工具。它把后台已经有的接口收成一组适合命令行使用的入口,默认请求生产环境 https://api.iot.gewulogic.com

安装

npm install -g @gewulogic/hive-cli

如果只是本地验证,也可以在包目录里先打包再安装:

npm pack
npm install -g ./gewulogic-hive-cli-0.1.2.tgz

登录

hive-cli auth login admin

也可以直接带参数:

hive-cli auth login admin \
  --email [email protected] \
  --password 'your-password'

查看当前会话:

hive-cli auth whoami

退出登录:

hive-cli auth logout

网关命令

所有需要指定网关的命令都支持两种写法:

  • --gateway-id <gateway-uuid>
  • --machine-id <machine-id>

升级指定服务镜像:

hive-cli gateway upgrade --machine-id GW-2026-0001

默认会升级 beezer:production。如果要覆盖默认值,也可以显式传:

hive-cli gateway upgrade beezer_updater \
  --gateway-id 11111111-1111-4111-8111-111111111111 \
  --tag canary

从本地文件创建新版本、激活并下发配置:

hive-cli gateway config apply \
  --machine-id GW-2026-0001 \
  --file ./beezer-config.yaml \
  --name "2026-04-13" \
  --description "update line A"

创建、激活、下发并重启 beezer

hive-cli gateway config rollout \
  --machine-id GW-2026-0001 \
  --file ./beezer-config.yaml

单独重启 beezer

hive-cli gateway restart beezer \
  --machine-id GW-2026-0001

通过网关终端执行命令:

hive-cli gateway exec \
  --machine-id GW-2026-0001 \
  --cmd 'df -hT'

命令本身带较多参数时,建议使用 --cmd 保留原始命令字符串。也可以关闭实时输出,只在结束后汇总:

hive-cli gateway exec \
  --gateway-id 11111111-1111-4111-8111-111111111111 \
  --cmd 'chroot /host/root du -xh /var/lib/docker --max-depth=1' \
  --no-stream

创建 TCP tunnel 并写出 visitor.toml

hive-cli gateway tcp-tunnel open \
  --machine-id GW-2026-0001 \
  --target-host 192.168.10.20 \
  --target-port 502 \
  --output-dir ./tunnel-out

查看当前活动 tunnel:

hive-cli gateway tcp-tunnel status \
  --machine-id GW-2026-0001

关闭 tunnel:

hive-cli gateway tcp-tunnel close \
  --machine-id GW-2026-0001 \
  --session-id session-123

查看命令状态:

hive-cli gateway command status --command-id cmd-123

Integrations 命令

查看租户 integrations:

hive-cli integrations list \
  --tenant-id 11111111-1111-4111-8111-111111111111

查看单个 integration 详情:

hive-cli integrations show \
  --integration-id 22222222-2222-4222-8222-222222222222

创建 MQTT integration:

hive-cli integrations create \
  --tenant-id 11111111-1111-4111-8111-111111111111 \
  --name 'MES MQTT' \
  --broker-url 'ws://mqtt.example.com:8083/mqtt' \
  --client-id 'hive-mes-tenant' \
  --username 'mqtt-user' \
  --mqtt-password 'your-mqtt-password' \
  --topic-template 'factory/{tenant_slug}/{device_id}/telemetry' \
  --qos 1 \
  --allowlist 'mqtt.example.com'

修改 MQTT integration:

hive-cli integrations update \
  --integration-id 22222222-2222-4222-8222-222222222222 \
  --broker-url mqtts://mqtt.example.com:8883 \
  --topic-template 'factory/{device_id}/telemetry' \
  --qos 1 \
  --enable

写入 MQTT broker 密码:

hive-cli integrations update \
  --integration-id 22222222-2222-4222-8222-222222222222 \
  --mqtt-password 'your-mqtt-password'

上传转换脚本并只做 dry-run 校验,不激活:

hive-cli integrations script upload \
  --integration-id 22222222-2222-4222-8222-222222222222 \
  --file ./transform.py \
  --dry-run-event-file ./event.json

上传并激活转换脚本:

hive-cli integrations script upload \
  --integration-id 22222222-2222-4222-8222-222222222222 \
  --file ./transform.py \
  --dry-run-event-json '{"value":42}' \
  --activate

查看 active 转换脚本:

hive-cli integrations script show \
  --integration-id 22222222-2222-4222-8222-222222222222

下载指定版本转换脚本:

hive-cli integrations script download \
  --integration-id 22222222-2222-4222-8222-222222222222 \
  --version 3 \
  --file ./transform.py

删除 MQTT integration:

hive-cli integrations delete \
  --integration-id 22222222-2222-4222-8222-222222222222

自动化脚本可加 --yes 跳过确认。

其他地址

如果要请求其他环境,可以在单次命令里显式覆盖:

hive-cli auth login admin --base-url http://localhost:8000

或设置环境变量:

export HIVE_CLI_BASE_URL=http://localhost:8000