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

cnbcool-cli

v0.1.0

Published

CNB CLI inspired by gh

Readme

cnb

一个面向 CNB OpenAPI 的命令行工具,交互风格参考 gh

当前版本先覆盖最常用的几个场景:

  • auth: 保存和查看访问令牌
  • whoami: 查看当前登录用户
  • api: 直接调用任意 CNB OpenAPI 路径
  • repo: 查看仓库、列出仓库、搜索公开仓库、克隆仓库
  • issue: 查询、创建、评论、关闭、重新打开 Issue
  • pr: 查询、创建、关闭、重新打开、合并、评审 Pull Request
  • release: 列表、查看、创建、编辑、删除 Release
  • cicd: 构建记录、触发构建、停止构建、查看 stage 日志、管理云原生构建设置

安装

pnpm install
pnpm build
pnpm link --global

完成后即可直接使用 cnb

快速开始

先保存访问令牌:

cnb auth login --token <your-token>

验证账号:

cnb whoami

查看当前目录对应仓库的信息:

cnb repo view

列出当前用户仓库:

cnb repo list

搜索公开仓库:

cnb repo search demo

列出某个仓库的 PR:

cnb pr list owner/repo

关闭并重新打开 Issue:

cnb issue close 12 --repo owner/repo --reason completed
cnb issue reopen 12 --repo owner/repo

关闭 PR:

cnb pr close 18 --repo owner/repo

克隆仓库:

cnb repo clone owner/repo
cnb repo clone owner/repo my-local-dir --ssh

创建 PR:

cnb pr create --repo owner/repo --head feat/demo --base main --title "Add demo" --body "Introduce demo feature"

查看和创建 Release:

cnb release list owner/repo
cnb release view v1.0.0 --repo owner/repo
cnb release create v1.0.0 --repo owner/repo --title "v1.0.0" --notes "First stable release"

管理 CI/CD:

cnb cicd runs owner/repo
cnb cicd run --repo owner/repo --branch main --wait
cnb cicd view 123456 --repo owner/repo
cnb cicd logs 123456 --repo owner/repo --pipeline-id pipeline-1 --stage-id stage-1
cnb cicd settings view owner/repo

直接调用任意 OpenAPI:

cnb api /user
cnb api /owner/repo/-/issues -q state=open -q page=1
cnb api /owner/repo/-/pulls -X POST -F title="Demo" -F head=feat/demo -F base=main

认证

优先级如下:

  1. 命令行参数 --token
  2. 环境变量 CNB_TOKEN
  3. 本地配置文件 ~/.cnb/config.json

API 地址也支持覆盖:

  • 参数: --base-url
  • 环境变量: CNB_BASE_URL

仓库自动推断

当你在 Git 仓库目录中执行 cnb repo viewcnb issue listcnb pr list 这类命令时,如果没有显式传 repo,CLI 会尝试从 origin 远端地址中自动解析 CNB 仓库路径。

也可以手动设置:

set CNB_REPO=owner/repo

常用命令

cnb auth status
cnb repo view owner/repo
cnb repo clone owner/repo
cnb issue create --repo owner/repo --title "Bug" --body "Something is broken"
cnb issue comment 12 --repo owner/repo --body "I am working on this"
cnb issue close 12 --repo owner/repo --reason not_planned
cnb pr view 18 --repo owner/repo
cnb pr close 18 --repo owner/repo
cnb pr merge 18 --repo owner/repo --method squash
cnb pr review 18 --repo owner/repo --event approve --body "Looks good"
cnb release view v1.0.0 --repo owner/repo
cnb release delete v1.0.0 --repo owner/repo --yes
cnb cicd runs owner/repo --status running
cnb cicd run --repo owner/repo --branch main --env NODE_ENV=production
cnb cicd settings set --repo owner/repo --auto-trigger true

说明

  • CNB 文档使用的是 Bearer 认证头。
  • 当前实现已经覆盖仓库、Issue、Pull Request、Release 和 CI/CD 这些最接近 gh 的核心场景。
  • cnb release delete 为避免误删,需要显式追加 --yes
  • cnb cicd logs 需要你先通过 cnb cicd view <sn> --repo <repo> 拿到 pipeline idstage id
  • 若某个接口暂未封装,可以先用 cnb api 直接调用。