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

@colliejs/run

v1.0.1

Published

A minimalist yet powerful library for building Command Line Interfaces (CLI) using Node.js.

Readme

@colliejs/run 🚀

一个极简但功能强大的命令行工具(CLI)开发框架。专为追求极致易用性的开发者设计,让你只需编写一个简单的对象即可构建专业的 CLI。

✨ 功能特点

  • 直观的嵌套命令树:通过自然的 JS 对象定义多级子命令。无需复杂的路由配置,结构即逻辑。
  • 极致的易用设计:强制使用长选项(--option),舍弃混乱的短选项聚合,让命令更具可读性与易用性。
  • 智能帮助系统:根据你的对象结构自动生成美观的命令树和选项说明文档。
  • 轻量无负担:核心逻辑轻巧透明,仅依赖 minimist

📦 安装

pnpm add @colliejs/run

🚀 快速上手 (前所未有的简单)

创建一个 my-cli.ts 文件并开始编写:

import { run } from "@colliejs/run";

run({
  // 1. 最简单的函数形式
  hello: ({ name = "World" }) => console.log(`Hello, ${name}!`),

  // 2. 嵌套子命令 (通过对象组织)
  user: {
    create: () => console.log("用户已创建!"),
    list: () => console.log("正在列出用户..."),
  },

  // 3. 带有帮助信息的详细定义
  greet: {
    cmd: options => console.log(`消息: ${options.msg}`),
    help: {
      msg: { description: "消息内容", type: "string", default: "Hi" },
    },
  },
});

🛠 运行方式

利用 Node 23+ 的原生特性,有两种方式运行你的 TypeScript 脚本:

方式 1:直接运行(无需 Shebang)

node  my-cli.ts hello --name Leo

方式 2:作为可执行脚本(使用 Shebang)

my-cli.ts最顶部添加运行环境声明:

#!/usr/bin/env node

然后赋予执行权限并直接运行:

chmod +x my-cli.ts
./my-cli.ts hello --name Leo

创建符号链接到PATH目录中(可选):

ln -s /path/to/my-cli.ts /usr/local/bin/my-cli
my-cli hello --name Leo

📄 开源协议

MIT