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

@dashi6174/hubcli

v1.0.0

Published

AI Hub Platform Package Installation and Management Tool

Readme

hubcli

npm version Node.js Version License

hubcli 是一个强大的命令行工具,用于在 AI Hub 平台上管理软件包。它提供了一个简洁的命令行界面来安装、卸载、搜索和管理 NPM 包,支持多个 NPM 注册表(Registry)。

🌟 特性

  • 包管理 - 安装、卸载、列出和搜索包
  • 包信息 - 查看包的详细信息(版本、作者、许可证等)
  • 注册表管理 - 支持多个 NPM 注册表,可快速切换
  • 灵活的安装 - 支持指定版本号和自定义注册表
  • 友好的输出 - 清晰的 Emoji 图标和格式化输出
  • 详细模式 - --verbose 标志用于调试

📦 安装

全局安装(推荐)

npm install -g hubcli

安装后,可以在任何位置直接使用 hubcli 命令。

局部安装

npm install hubcli

然后在项目中使用 npx hubcli 来运行命令。

🚀 快速开始

查看帮助信息

hubcli --help
hubcli -h

查看版本号

hubcli --version
hubcli -v

安装包

# 安装最新版本
hubcli install lodash

# 安装指定版本
hubcli install [email protected]

# 使用自定义注册表
hubcli install lodash --registry https://registry.npmmirror.com

# 简短命令
hubcli i react

卸载包

hubcli uninstall lodash
hubcli un lodash
hubcli remove lodash
hubcli rm lodash

列出已安装的包

# 仅列出顶级依赖
hubcli list

# 显示指定深度的依赖树
hubcli list --depth 2

# JSON 格式输出
hubcli list --json

# 简短命令
hubcli ls

搜索包

# 搜索包
hubcli search react

# 简短命令
hubcli s typescript

查看包详情

# 查看包信息
hubcli show lodash
hubcli info react

# 使用自定义注册表
hubcli show lodash --registry https://registry.npmmirror.com

# JSON 格式输出
hubcli show express --json

🔧 注册表管理

查看当前注册表

hubcli registry
hubcli registry show

输出示例:

📍 Current Registry Configuration

Registry URL: https://registry.npmjs.org

📚 Available Registries:
  npm   → https://registry.npmjs.org
  taobao → https://registry.npmmirror.com
  cnpm  → https://r.cnpmjs.org
  yarn  → https://registry.yarnpkg.com

切换注册表

# 使用别名
hubcli registry set npm
hubcli registry set taobao

# 使用完整 URL
hubcli registry set https://registry.npmmirror.com
hubcli registry set https://r.cnpmjs.org

预配置的注册表

| 别名 | URL | 说明 | |------|-----|------| | npm | https://registry.npmjs.org | 官方 NPM 注册表 | | taobao | https://registry.npmmirror.com | 淘宝 NPM 镜像 | | cnpm | https://r.cnpmjs.org | CNPM 注册表 | | yarn | https://registry.yarnpkg.com | Yarn 注册表 |

📋 完整命令参考

Usage:
  hubcli <command> [options]

Commands:
  install <pkg> [--registry <url>] [--version <ver>]   安装包
  uninstall <pkg>                                       卸载包
  list [--depth <n>]                                    列出已安装的包
  search <keyword>                                      搜索包
  show <pkg> [--registry <url>]                         显示包详情
  info <pkg> [--registry <url>]                         显示包详情(别名)
  registry [show|set|get]                               管理注册表
  registry set <url>                                    设置注册表

Options:
  -h, --help                                            显示帮助信息
  -v, --version                                         显示版本号
  --verbose                                             启用详细输出
  --json                                                JSON 格式输出
  --registry <url>                                      指定注册表 URL
  --version <ver>                                       指定包版本
  --depth <n>                                           显示依赖深度

Examples:
  # 包安装
  hubcli install lodash
  hubcli install [email protected]
  hubcli install my-pkg --registry https://registry.npmmirror.com

  # 包管理
  hubcli list
  hubcli uninstall lodash
  hubcli search typescript

  # 包信息
  hubcli show react
  hubcli info express --registry https://registry.npmmirror.com

  # 注册表管理
  hubcli registry show
  hubcli registry set taobao
  hubcli registry set https://registry.npmmirror.com

🎯 常见用途

使用淘宝 NPM 镜像

# 设置淘宝镜像
hubcli registry set taobao

# 现在所有安装都会使用淘宝镜像
hubcli install react

搜索和安装包

# 搜索包
hubcli search "date"

# 查看包详情
hubcli show moment

# 安装特定版本
hubcli install [email protected]

管理依赖

# 查看已安装的包
hubcli list

# 卸载包
hubcli uninstall moment

# 查看深层依赖
hubcli list --depth 3

💾 配置存储

hubcli 将配置信息存储在用户主目录中:

  • 配置目录: ~/.hubcli/
  • 配置文件: ~/.hubcli/config.json

配置文件示例:

{
  "registry": "https://registry.npmmirror.com"
}

🔍 环境变量

DEBUG 模式

启用调试输出以查看详细的错误信息:

# Linux/macOS
DEBUG=1 hubcli install lodash

# Windows
set DEBUG=1 && hubcli install lodash

npm 相关变量

hubcli 会继承 npm 的环境变量,包括:

  • npm_config_registry - NPM 注册表 URL

⚠️ 故障排查

包安装失败

# 1. 检查网络连接
hubcli registry show

# 2. 使用详细模式查看错误
hubcli install lodash --verbose

# 3. 尝试不同的注册表
hubcli registry set taobao
hubcli install lodash

搜索失败

# 增加搜索超时时间,或尝试其他注册表
hubcli registry set npm
hubcli search react

清除 NPM 缓存

npm cache clean --force
hubcli install <package>

📝 更新日志

v1.0.0

  • ✅ 初始版本发布
  • ✅ 支持基本的包管理功能(安装、卸载、列表)
  • ✅ 支持包搜索和详情查看
  • ✅ 支持多注册表管理
  • ✅ 友好的命令行界面
  • ✅ 配置持久化

🤝 贡献

欢迎提交 Issue 和 Pull Request!

开发

# 克隆仓库
git clone https://github.com/dashi6174/hubcli.git
cd hubcli

# 安装依赖
npm install

# 开发模式运行
npm start

# 运行测试
npm test

📄 许可证

ISC License © 2024 dashi6174

🔗 相关链接

👤 作者

dashi6174


Made with ❤️ for the AI Hub Platform

hubcli uninstall <package>

卸载已安装的包。

hubcli uninstall my-ai-plugin

hubcli list

列出所有已安装的包。

hubcli list

hubcli search <keyword>

在 Hub 平台搜索包。

hubcli search translator

hubcli info <package>

查看包的详细信息。

hubcli info my-ai-plugin

hubcli registry

管理 Registry 地址。

# 查看当前 registry
hubcli registry

# 设置新的 registry
hubcli registry set https://registry.example.com

配置

hubcli 的配置文件默认存储在 ~/.hubcli/config.json,你也可以通过环境变量覆盖:

| 环境变量 | 说明 | 默认值 | |----------|------|--------| | HUBCLI_REGISTRY | Registry 地址 | https://registry.npmjs.org | | HUBCLI_TOKEN | 认证 Token | - |

开发

# 克隆项目
git clone https://github.com/dashi6174/hubcli.git
cd hubcli

# 安装依赖
npm install

# 本地链接(方便本地调试)
npm link

# 运行测试
npm test

许可证

ISC © dashi6174