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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ismartify/inquirer

v0.0.5

Published

一个基于 [@inquirer/prompts](https://github.com/SBoudrias/Inquirer.js) 的简单CLI工具构建库。

Downloads

10

Readme

@ismartify/inquirer

一个基于 @inquirer/prompts 的简单CLI工具构建库。

特性

  • 🚀 简单易用:提供便捷方法快速添加命令
  • 🎯 多种命令类型:确认命令、输入命令、选择命令
  • 🔧 灵活配置:支持参数、选项、交互式执行
  • 📦 零依赖:除了@inquirer外无其他依赖

安装

pnpm add @ismartify/inquirer

快速开始

import CLI from '@ismartify/inquirer';

// 创建CLI实例
const cli = new CLI('My CLI Tool');

// 添加确认命令
cli.addConfirmCommand('clean', {
  description: '清理项目(clean)',
  message: '确定要清理项目吗?',
  action: async function() {
    console.log('正在清理...');
    // 执行清理逻辑
  }
});

// 启动CLI
import { main } from '@ismartify/inquirer';
main(cli);

API

CLI类

构造函数

new CLI(title = 'CLI Tool')
  • title: CLI工具的标题

方法

addCommand(name, config)

添加自定义命令。

cli.addCommand('command-name', {
  description: '命令描述',
  handler: async function() {
    // 命令逻辑
  },
  params: ['[param]'], // 可选参数
  interactive: true, // 是否支持交互式
  options: ['verbose'] // 支持的选项
});
addConfirmCommand(name, config)

添加需要确认的命令。

cli.addConfirmCommand('clean', {
  description: '清理项目(clean)',
  message: '确定要执行吗?',
  action: async function() {
    // 执行逻辑
  }
});
addInputCommand(name, config)

添加需要输入参数的命令。

cli.addInputCommand('create', {
  description: '创建项目(create)',
  inputs: [
    { message: '项目名称:', default: 'my-project' }
  ],
  action: async function(name) {
    // 使用name创建项目
  }
});
addSelectCommand(name, config)

添加选择命令。

cli.addSelectCommand('deploy', {
  description: '部署项目(deploy)',
  message: '选择环境:',
  choices: [
    { name: '开发环境', value: 'dev' },
    { name: '生产环境', value: 'prod' }
  ],
  action: async function(env) {
    // 部署到指定环境
  }
});

许可证

MIT