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

genwavejs-cli

v0.1.0

Published

A modern, extensible CLI toolkit framework with plugin support

Downloads

8

Readme

@genwavejs/cli

一个基于 TypeScript 构建的现代化、可扩展的 CLI 工具包框架,支持插件系统。

特性

  • 🚀 现代化架构: 使用 TypeScript 和 ES 模块构建
  • 🔌 插件系统: 可扩展的插件架构,支持自定义命令
  • 🛠️ 丰富的工具: 内置日志、文件操作、网络请求等实用工具
  • 📦 易于分发: 作为作用域 npm 包发布
  • 🎯 开发者友好: 完整的 TypeScript 支持和文档
  • 快速构建: 由 Vite 驱动的闪电般快速构建
  • 🧪 测试就绪: 配置了 Vitest 进行现代化测试

安装

# 全局安装
npm install -g @genwavejs/cli

# 或使用 npx
npx @genwavejs/cli --help

快速开始

# 显示帮助
genwavejs --help

# 运行演示命令
genwavejs demo --list
genwavejs demo github-pull user/repo

# 显示版本
genwavejs version

项目结构

@genwavejs/cli/
├── src/
│   ├── core/                  # 核心框架
│   │   ├── cli.ts            # 主 CLI 引擎
│   │   ├── command.ts        # 命令基类
│   │   └── plugin.ts         # 插件系统
│   ├── commands/             # 内置命令
│   │   └── demo/             # 演示命令
│   ├── utils/                # 工具函数
│   │   ├── logger.ts         # 日志系统
│   │   ├── config.ts         # 配置管理
│   │   ├── file.ts           # 文件操作
│   │   ├── network.ts        # 网络工具
│   │   └── spinner.ts        # 进度指示器
│   ├── types/                # TypeScript 类型定义
│   └── index.ts              # 主导出文件
├── bin/                      # 可执行文件
├── docs/                     # 文档
└── tests/                    # 测试文件

演示命令

GitHub 拉取演示

将 GitHub 仓库拉取到本地:

# 基本用法
genwavejs demo github-pull user/repo

# 指定目标目录
genwavejs demo github-pull user/repo ./my-project

# 指定分支和浅克隆
genwavejs demo github-pull user/repo --branch develop --depth 1

# 使用完整的 GitHub URL
genwavejs demo github-pull https://github.com/user/repo.git

开发

前置要求

  • Node.js >= 16.0.0
  • npm >= 7.0.0(或推荐使用 pnpm)

设置

# 克隆仓库
git clone https://github.com/genwavejs/cli.git
cd cli

# 安装依赖
pnpm install

# 构建项目
pnpm build

# 开发模式运行
pnpm dev

# 运行测试
pnpm test

# 代码检查
pnpm lint

# 格式化代码
pnpm format

创建自定义命令

  1. 创建一个继承 BaseCommand 的新命令类:
import { BaseCommand } from '@genwavejs/cli';
import type { CommandContext } from '@genwavejs/cli';

export class MyCommand extends BaseCommand {
  name = 'my-command';
  description = '我的自定义命令';

  async execute(context: CommandContext): Promise<void> {
    context.logger.info('来自我的命令的问候!');
  }
}
  1. 注册命令:
import { createCLI } from '@genwavejs/cli';
import { MyCommand } from './my-command';

const cli = createCLI();
cli.getCommandRegistry().register(new MyCommand());

插件开发

创建插件来扩展功能:

import type { Plugin, Command } from '@genwavejs/cli';

export const myPlugin: Plugin = {
  name: 'my-plugin',
  version: '1.0.0',
  description: '我的超棒插件',
  commands: [
    // 你的命令在这里
  ],
  async activate(context) {
    // 插件激活逻辑
  }
};

配置

在项目或主目录中创建 .genwavejsrc.json 文件:

{
  "logLevel": "info",
  "plugins": [
    "./path/to/plugin.js"
  ],
  "theme": {
    "primary": "#007acc",
    "success": "#28a745",
    "warning": "#ffc107",
    "error": "#dc3545"
  }
}

API 参考

核心类

  • CLIEngine: 主 CLI 引擎
  • BaseCommand: 命令基类
  • CommandRegistry: 命令注册和管理
  • PluginManager: 插件系统管理

工具类

  • Logger: 支持不同级别的日志记录
  • FileManager: 文件系统操作
  • NetworkManager: 带重试逻辑的 HTTP 请求
  • SpinnerManager: 进度指示器
  • ConfigManager: 配置管理

脚本

  • pnpm dev: 开发模式(监听模式)
  • pnpm build: 生产构建
  • pnpm test: 运行测试
  • pnpm test:coverage: 运行测试并生成覆盖率报告
  • pnpm lint: 代码检查
  • pnpm lint:fix: 修复代码检查问题
  • pnpm format: 使用 Prettier 格式化代码

贡献

  1. Fork 仓库
  2. 创建你的功能分支 (git checkout -b feature/amazing-feature)
  3. 提交你的更改 (git commit -m 'Add some amazing feature')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 打开一个 Pull Request

许可证

MIT 许可证 - 查看 LICENSE 文件了解详情。

支持


使用 TypeScript、Vite 和现代 Node.js 用 ❤️ 构建