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

@smartbi/cli

v2.1.0

Published

Smartbi API CLI

Downloads

670

Readme

@smartbi/cli

Smartbi OpenAPI 命令行工具。通过自然语言或命令发现、理解和调用 Smartbi 全部 OpenAPI 接口。

安装

npm install -g @smartbi/cli@latest

要求 Node.js >= 18。

快速开始

1. 初始化配置

smartbi init

按提示选择服务器类型(sdk-server / Smartbi)、填写服务器地址、选择 token 保存方式(环境变量 / 系统 keyring / 明文),一步生成可直接使用的 ~/.smartbi/config.yaml。

2. 发现可用接口

# 列出所有可用接口
smartbi list

# 按领域筛选
smartbi list --domain scheduletask

# 面向 AI Agent 的语义化输出
smartbi list --agent

3. 搜索接口

# 关键词搜索
smartbi search 定时

# 指定搜索范围
smartbi search "企微推送" --in description,summary

# 模糊匹配
smartbi search 订单 --fuzzy

4. 查看接口详情

smartbi describe scheduletask.createTask
smartbi describe scheduletask.createTask --agent

5. 调用接口

smartbi call scheduletask.createTask -d @payload.json

核心命令

| 命令 | 用途 | |------|------| | smartbi init | 初始化配置文件(向导一步生成可用配置) | | smartbi profile add <name> | 添加新的服务器环境(profile),支持多套服务器/凭证切换 | | smartbi list | 列出可用 API 接口 | | smartbi search <keyword> | 搜索接口 | | smartbi describe <operationKey> | 查看接口契约详情 | | smartbi call <operationKey> | 调用接口 |

常用选项

| 选项 | 说明 | |------|------| | --json | JSON 格式输出 | | --agent | 面向 AI Agent 的结构化输出(含错误 JSON) | | --verbose | 输出详细信息 | | --domain | 按领域筛选 | | -d @file.json | 从 JSON 文件传入请求体 | | --dry-run | 预览请求,不实际发送 |

配置文件

CLI 默认读取 ~/.smartbi/config.yaml,通过 smartbi init 生成。一个 config 可包含多个 profile(多套服务器环境):smartbi profile add <name> 添加、smartbi profile set-default <name> 切换默认、smartbi profile show 查看当前配置。

profile: dev
profiles:
  dev:
    serverType: smartbi
    baseUrl: "http://your-server:8080/smartbi"
    tokenEnv: "SMARTBI_TOKEN_DEV"
    timeoutMs: 300000

registry:
  source: remote
  checkIntervalSeconds: 300

支持通过环境变量配置(baseUrlEnv / tokenEnv),适合 CI/CD 场景。token 也可存入系统 keyring(init 向导选「系统 keyring」,配置为 tokenKeyring: true)。

典型场景

定时计划任务:smartbi list --domain scheduletask → smartbi describe scheduletask.createTask → smartbi call scheduletask.createTask -d @task.json

数据查询:smartbi search "执行 MQL 查询" → smartbi describe datamodel.queryDataByMql → smartbi call datamodel.queryDataByMql -d @query.json

文档

详细使用指南:smartbi --help