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

@atools/cf

v2.0.1

Published

A guided, interactive CLI framework for Node.js that helps you create elegant command-line tools with minimal effort.

Readme

@atools/cf

CF Framework 的主应用包,提供完整的命令行工具和模板系统。

安装

npm install @atools/cf
# 或
yarn add @atools/cf
# 或
pnpm add @atools/cf

特性

  • 🎯 命令行工具 - 提供完整的命令行界面
  • 📝 模板系统 - 内置模板,快速创建新命令
  • 🎨 优雅设计 - 简洁的 API 设计,易于使用

基本使用

add 命令

add 命令是框架最重要的功能之一,用于快速创建新的命令模块:

# 使用默认配置
$ cf add

# 自定义输出目录
$ cf add -o custom-commands

# 自定义模板
$ cf add -t custom-template.tpl

[CF] -> command name: hello
[CF] -> command alias: h
[CF] -> command description: Say hello to someone

支持的选项:

  • -o, --output <path>: 输出目录,默认为 commands
  • -t, --template <path>: 模板文件路径,默认使用内置模板

生成的命令文件示例(commands/hello/index.js):

const { BaseCommand } = require('@atools/cf-core');

class Hello extends BaseCommand {
  constructor(config) {
    super(config);
  }

  init(commander) {
    commander
      .option('-n, --name <name>', '要问候的名字');
  }

  async do() {
    const { name = '世界' } = this.config;
    console.log(`你好, ${name}!`);
  }
}

Hello.command = 'hello';
Hello.alias = 'h';
Hello.description = 'Say hello to someone';

module.exports = Hello;

创建命令

你也可以直接创建命令类:

const { BaseCommand } = require('@atools/cf-core');

class MyCommand extends BaseCommand {
  constructor(config) {
    super(config);
  }

  init(commander) {
    commander
      .option('-n, --name <name>', '选项描述');
  }

  async do() {
    const { name } = this.config;
    // 实现你的命令逻辑
  }
}

MyCommand.command = 'my-command';
MyCommand.alias = 'mc';
MyCommand.description = '命令描述';

module.exports = MyCommand;

命令状态

| 命令 | 状态 | 描述 | |------|------|------| | add | ✅ 可用 | 添加新命令 | | ui | 🚧 开发中 | 交互式 UI | | init | 🚧 开发中 | 项目初始化 | | remove | 🚧 开发中 | 移除命令 |

版本说明

当前版本:2.0.0

这是一个重大版本更新,作为 CF Framework monorepo 重构的一部分发布。主要变化:

  • 核心功能已移至 @atools/cf-core
  • 改进了模板系统
  • 优化了包体积

从 1.x 升级

如果你正在使用 1.x 版本,需要使用我们的迁移 🔧 工具

# 升级到最新版本
npm install @atools/cf@latest

贡献

欢迎提交 issue 和 PR!

许可证

MIT