← 返回 Skills 市场
CLI Scaffold Generator
作者
Sunshine-del-ux
· GitHub ↗
· v1.0.0
420
总下载
0
收藏
2
当前安装
1
版本数
在 OpenClaw 中安装
/install cli-scaffold-generator
功能描述
生成专业 CLI 脚手架,支持 Commander.js, yargs, oclif 等主流 CLI 框架,一键生成完整项目结构。
使用说明 (SKILL.md)
CLI Scaffold Generator
快速生成专业的 CLI 应用程序脚手架。
功能
- ⚡ 快速生成项目结构
- 📝 支持多种 CLI 框架
- 🎯 完整的命令模板
- 📖 自动生成帮助文档
- 🧪 测试模板
- 📦 发布到 npm
支持的框架
| 框架 | 说明 | 流行度 |
|---|---|---|
| Commander.js | Node.js CLI 标准 | ⭐⭐⭐⭐⭐ |
| yargs | 参数解析强大 | ⭐⭐⭐⭐ |
| oclif | Salesforce 出品 | ⭐⭐⭐⭐ |
| Ink | React-based CLI | ⭐⭐⭐ |
使用方法
基本用法
# 使用 Commander 生成 CLI
cli-scaffold-generator my-cli --framework commander
# 使用 yargs
cli-scaffold-generator my-tool --framework yargs
# 指定描述
cli-scaffold-generator my-app --framework commander --description "My awesome CLI tool"
选项
| 选项 | 说明 |
|---|---|
--framework, -f |
CLI 框架 (commander/yargs/oclif/ink) |
--description, -d |
项目描述 |
--author |
作者名称 |
--output, -o |
输出目录 |
生成的项目结构
my-cli/
├── bin/
│ └── my-cli.js # 入口文件
├── lib/
│ └── command.js # 命令实现
├── test/
│ └── index.test.js # 测试文件
├── package.json
├── README.md
└── .gitignore
包含的功能
- ✅ 命令行参数解析
- ✅ 帮助信息自动生成
- ✅ 子命令支持
- ✅ 选项和标志
- ✅ 错误处理
- ✅ 彩色输出
示例输出
package.json
{
"name": "my-cli",
"version": "1.0.0",
"description": "My awesome CLI tool",
"bin": {
"my-cli": "./bin/my-cli.js"
},
"scripts": {
"test": "jest"
}
}
入口文件
#!/usr/bin/env node
const { Command } = require('commander');
const program = new Command();
program
.name('my-cli')
.description('My awesome CLI tool')
.version('1.0.0');
program
.command('greet')
.description('Greet someone')
.argument('\x3Cname>', 'Name to greet')
.action((name) => {
console.log(`Hello, ${name}!`);
});
program.parse();
本地测试
cd my-cli
npm link
my-cli greet World
发布到 npm
npm login
npm publish
变现思路
- CLI 工具模板 - 销售专业 CLI 模板
- 定制开发 - 为企业定制 CLI 工具
- 培训课程 - CLI 开发教程
- 工具库 - 收集常用 CLI 工具打包出售
安装
# 无需额外依赖
安全使用建议
This package is inconsistent rather than obviously malicious, but you should not run it blindly. Specific points to check before using: (1) inspect cli-scaffold-generator.sh — it always generates a Commander.js template (contrary to the SKILL.md), and package.json unconditionally includes commander and chalk; (2) the generated JavaScript contains a syntax error (extra closing parenthesis in 'new Command());') that will break the scaffolded CLI; (3) SKILL.md shows flag-style CLI options, but the script expects positional arguments — the interfaces are mismatched; (4) run the script only in an isolated directory or container to avoid unexpected file writes, and consider fixing the script (syntax error and framework selection logic) or using a vetted generator instead; (5) if you plan to execute generated package scripts (npm install, npm publish), review package.json and node scripts first. If you want higher assurance, ask the author for an updated implementation that actually implements framework selection, corrects the JS syntax, and documents exact usage.
功能分析
Type: OpenClaw Skill
Name: cli-scaffold-generator
Version: 1.0.0
The `cli-scaffold-generator.sh` script is vulnerable to shell injection. It directly uses user-supplied arguments (`$NAME`, `$DESCRIPTION`, `$AUTHOR`) without proper sanitization when creating directories and files. Specifically, the `$NAME` variable is used in `mkdir -p "$NAME"/{bin,lib,test}` and `cat > "$NAME/package.json"`, allowing an attacker to inject arbitrary commands or create files in unintended locations by crafting a malicious `NAME` input. While there is no evidence of intentional malicious behavior like data exfiltration or backdoors, this critical vulnerability makes the skill suspicious.
能力评估
Purpose & Capability
The README/description claims support for multiple CLI frameworks (commander, yargs, oclif, ink) and flag-style invocation (--framework, --description). The included cli-scaffold-generator.sh implements only a simple positional-argument generator that always emits a Commander-based template and always lists 'commander' and 'chalk' in dependencies regardless of chosen framework. That mismatch between claimed capabilities and actual code is inconsistent with the stated purpose.
Instruction Scope
SKILL.md contains only innocuous usage examples and no requests for secrets or system paths. The provided shell script creates files and sets an executable bit in the current directory (expected for a scaffold generator). It does not access network endpoints or environment variables. However, SKILL.md shows flag-style usage that the script does not implement (positional args only), which is misleading.
Install Mechanism
No install spec is present and the skill is 'instruction-only' with one helper shell script. Nothing is downloaded or extracted from external URLs, so there is no extra install-time risk.
Credentials
No credentials, config paths, or environment variables are requested. The script does not attempt to read unrelated files or secrets.
Persistence & Privilege
The skill is not always-enabled and does not request persistent privileges. It writes only to a subdirectory named by the provided project name (normal for a scaffold generator).
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install cli-scaffold-generator - 安装完成后,直接呼叫该 Skill 的名称或使用
/cli-scaffold-generator触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of CLI Scaffold Generator.
- Generate professional CLI application scaffolds for Node.js.
- Supports popular frameworks: Commander.js, yargs, oclif, Ink.
- Provides complete project structure with command templates, documentation, and test setup.
- Includes CLI option parsing, auto-generated help, subcommand support, and color output.
- Quick project generation with customizable options such as framework, description, author, and output directory.
元数据
常见问题
CLI Scaffold Generator 是什么?
生成专业 CLI 脚手架,支持 Commander.js, yargs, oclif 等主流 CLI 框架,一键生成完整项目结构。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 420 次。
如何安装 CLI Scaffold Generator?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install cli-scaffold-generator」即可一键安装,无需额外配置。
CLI Scaffold Generator 是免费的吗?
是的,CLI Scaffold Generator 完全免费(开源免费),可自由下载、安装和使用。
CLI Scaffold Generator 支持哪些平台?
CLI Scaffold Generator 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 CLI Scaffold Generator?
由 Sunshine-del-ux(@sunshine-del-ux)开发并维护,当前版本 v1.0.0。
推荐 Skills