生成专业 CLI 脚手架,支持 Commander.js, yargs, oclif 等主流 CLI 框架,一键生成完整项目结构。
快速生成专业的 CLI 应用程序脚手架。
| 框架 | 说明 | 流行度 |
|---|---|---|
| Commander.js | Node.js CLI 标准 | ⭐⭐⭐⭐⭐ |
| yargs |
bash
| 选项 | 说明 |
|---|---|
| --framework, -f | CLI 框架 (commander/yargs/oclif/ink) |
| --description, -d |
my-cli/
├── bin/
│ └── my-cli.js # 入口文件
├── lib/
│ └── command.js # 命令实现
├── test/
│ └── index.test.js # 测试文件
├── package.json
├── README.md
└── .gitignore
json
{
name: my-cli,
version: 1.0.0,
description: 我的超棒 CLI 工具,
bin: {
my-cli: ./bin/my-cli.js
},
scripts: {
test: jest
}
}
javascript
#!/usr/bin/env node
const { Command } = require(commander);
const program = new Command();
program
.name(my-cli)
.description(我的超棒 CLI 工具)
.version(1.0.0);
program
.command(greet)
.description(向某人打招呼)
.argument(
.action((name) => {
console.log(你好,${name}!);
});
program.parse();
bash
cd my-cli
npm link
my-cli greet World
bash
npm login
npm publish
bash
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 cli-scaffold-generator-1776282003 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 cli-scaffold-generator-1776282003 技能
skillhub install cli-scaffold-generator-1776282003
文件大小: 3.38 KB | 发布时间: 2026-4-16 18:19