ryudi84-sovereign-project-setup-wizard
交互式项目脚手架,为 Node.js、Python、Go、Rust 生成完整可投产结构,含 .gitignore、README、CI/CD、Dockerfile 与测试配置。
安装 / 下载方式
TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~ryudi84-sovereign-project-setup-wizardcURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~ryudi84-sovereign-project-setup-wizard/file -o ryudi84-sovereign-project-setup-wizard.md## 概述(中文)
交互式项目脚手架,为 Node.js、Python、Go、Rust 生成完整可投产结构,含 .gitignore、README、CI/CD、Dockerfile 与测试配置。
## 技能正文
# 项目初始化向导
交互式项目脚手架工具,为 Node.js、Python、Go 和 Rust 生成完整、可投产的项目结构,含 .gitignore、README、CI/CD 配置与 Dockerfile。
## 概述
项目初始化向导通过生成以下内容,消除新项目启动的重复劳动:
- **完整目录结构**,遵循各语言约定
- **合适的 .gitignore**,针对所选语言与工具链
- **README.md**,含徽章、安装、用法与贡献章节
- **CI/CD 配置**,支持 GitHub Actions、GitLab CI 或 CircleCI
- **Dockerfile 与 docker-compose.yml**,多阶段构建
- **Linter 与格式化配置**(ESLint、Black、golangci-lint、rustfmt)
- **测试设置**,含示例测试与覆盖率配置
- **许可证文件**(MIT、Apache-2.0 或 GPL-3.0)
- **编辑器配置**(.editorconfig、VS Code 设置)
每个模板遵循当前最佳实践,可立即运行 — 只需添加你的代码。
## 安装
### 通过 ClawHub
```bash
openclaw install project-setup-wizard
```
### 手动安装
1. 将技能复制到 OpenClaw 技能目录:
```bash
mkdir -p ~/.openclaw/skills/
cp -r project-setup-wizard/ ~/.openclaw/skills/
```
2. 使脚本可执行:
```bash
chmod +x ~/.openclaw/skills/project-setup-wizard/scripts/setup.sh
```
3. 验证安装:
```bash
openclaw list --installed
```
## 要求
- **bash** (version 4.0 or higher)
- **git** (version 2.0 or higher)
可选(用于语言特定验证):
- **node** and **npm** (for Node.js projects)
- **python3** and **pip** (for Python projects)
- **go** (for Go projects)
- **cargo** (for Rust projects)
向导无需语言运行时即可创建所有文件,但安装运行时可在设置后进行验证与依赖安装。
## 用法
### 交互模式
无参数运行以使用交互式向导:
```bash
openclaw run project-setup-wizard
```
向导会询问:
1. 项目名称
2. 语言(Node.js、Python、Go、Rust)
3. 项目描述
4. 作者姓名与邮箱
5. 许可证类型
6. CI/CD 提供商
7. 是否包含 Docker 支持
8. 是否初始化 git 仓库
### 非交互模式
通过命令行标志传递所有选项:
```bash
openclaw run project-setup-wizard [OPTIONS]
Options:
--name <name> Project name (required in non-interactive mode)
--lang <language> Language: nodejs, python, go, rust
--description <text> Short project description
--author <name> Author name
--email <email> Author email
--license <type> License: mit, apache2, gpl3 (default: mit)
--ci <provider> CI provider: github, gitlab, circleci (default: github)
--docker Include Docker files (default: on)
--no-docker Disable Docker file generation
--git-init Initialize git repository (default: on)
--no-git-init Skip git initialization
--output-dir <path> Parent directory for the project (default: current dir)
--dry-run Show what would be created without writing files
--verbose Show detailed output during generation
```
### 直接运行脚本
```bash
./scripts/setup.sh --name my-api --lang python --ci github --docker
```
## 配置
### skill.json 设置
```json
{
"config": {
"supported_languages": ["nodejs", "python", "go", "rust"],
"include_docker": true,
"include_ci": true,
"include_readme": true,
"include_gitignore": true,
"ci_provider": "github-actions",
"license_type": "MIT"
}
}
```
| 设置 | 类型 | 默认值 | 说明 |
|------------------------|---------|------------------|------------------------------------|
| `supported_languages` | array | 全部四种 | 向导可用语言 |
| `include_docker` | boolean | true | 默认生成 Docker 文件 |
| `include_ci` | boolean | true | 默认生成 CI/CD 配置 |
| `include_readme` | boolean | true | 默认生成 README.md |
| `include_gitignore` | boolean | true | 默认生成 .gitignore |
| `ci_provider` | string | "github-actions" | 默认 CI/CD 提供商 |
| `license_type` | string | "MIT" | 新项目默认许可证 |
### 环境变量
```bash
export PSW_LANG=python
export PSW_CI=github
export PSW_LICENSE=mit
export PSW_AUTHOR="Your Name"
export PSW_EMAIL="you@example.com"
export PSW_DOCKER=true
```
## 生成的项目结构
### Node.js
```
my-project/
.github/
workflows/
ci.yml
src/
index.js
lib/
utils.js
tests/
index.test.js
.dockerignore
.editorconfig
.eslintrc.json
.gitignore
.prettierrc
Dockerfile
docker-compose.yml
LICENSE
package.json
README.md
```
### Python
```
my-project/
.github/
workflows/
ci.yml
src/
my_project/
__init__.py
main.py
utils.py
tests/
__init__.py
test_main.py
.dockerignore
.editorconfig
.gitignore
Dockerfile
docker-compose.yml
LICENSE
pyproject.toml
README.md
requirements.txt
requirements-dev.txt
setup.cfg
```
### Go
```
my-project/
.github/
workflows/
ci.yml
cmd/
my-project/
main.go
internal/
app/
app.go
pkg/
utils/
utils.go
.dockerignore
.editorconfig
.gitignore
.golangci.yml
Dockerfile
docker-compose.yml
go.mod
LICENSE
Makefile
README.md
```
### Rust
```
my-project/
.github/
workflows/
ci.yml
src/
main.rs
lib.rs
tests/
integration_test.rs
.dockerignore
.editorconfig
.gitignore
Cargo.toml
Dockerfile
docker-compose.yml
LICENSE
README.md
rustfmt.toml
```
## 模板详情
### .gitignore
每种语言基于 GitHub 官方 gitignore 模板定制,并扩展常见 IDE 文件、OS 产物与环境文件:
- Node.js: node_modules, dist, .env, coverage, .nyc_output
- Python: __pycache__, .venv, dist, *.egg-info, .mypy_cache
- Go: binary outputs, vendor (optional), .env
- Rust: target/, Cargo.lock (for libraries), .env
所有 .gitignore 还包含:
- `.env`, `.env.local`, `.env.*.local`
- `.DS_Store`, `Thumbs.db`
- `.idea/`, `.vscode/` (configurable)
- `*.log`, `*.tmp`
### CI/CD 配置
#### GitHub Actions
生成的工作流包含:
- 跨 OS 与语言版本的矩阵测试
- 依赖缓存加速构建
- Lint 步骤
- 带覆盖率报告的测试步骤
- 构建/编译步骤
- Docker 镜像构建(若启用 Docker)
#### GitLab CI
包含 lint、test、build、deploy 阶段,含适当缓存与产物管理。
#### CircleCI
包含目标语言 orbs、缓存与并行测试执行。
### Dockerfile
所有 Dockerfile 使用多阶段构建以最小化生产镜像:
| 语言 | 构建阶段 | 生产基础镜像 | 典型大小 |
|----------|------------------|-----------------|--------------|
| Node.js | node:20-alpine | node:20-alpine | ~120 MB |
| Python | python:3.12-slim | python:3.12-slim| ~150 MB |
| Go | golang:1.22 | scratch | ~10 MB |
| Rust | rust:1.76 | debian:slim | ~80 MB |
每个 Dockerfile 包含:
- 非 root 用户(安全)
- 健康检查端点
- 正确的信号处理
- 层缓存优化
- .dockerignore 控制构建上下文
## 示例
### 创建 Python API 项目
```bash
openclaw run project-setup-wizard \
--name user-api \
--lang python \
--description "REST API for user management" \
--license mit \
--ci github \
--docker
```
### 创建无 Docker 的 Go CLI 工具
```bash
openclaw run project-setup-wizard \
--name mytool \
--lang go \
--description "Command-line productivity tool" \
--no-docker \
--license apache2
```
### 创建 Rust 库
```bash
openclaw run project-setup-wizard \
--name fast-parser \
--lang rust \
--description "High-performance data parser" \
--ci github
```
### 试运行预览输出
```bash
openclaw run project-setup-wizard \
--name test-project \
--lang nodejs \
--dry-run
```
输出:
```
[DRY RUN] Would create the following structure:
test-project/
.github/workflows/ci.yml
src/index.js
src/lib/utils.js
tests/index.test.js
.dockerignore
.editorconfig
.eslintrc.json
.gitignore
.prettierrc
Dockerfile
docker-compose.yml
LICENSE
package.json
README.md
Total: 14 files in 5 directories
```
### 交互模式演示
```
$ openclaw run project-setup-wizard
Project Setup Wizard v1.0.0
? Project name: my-awesome-app
? Language: Python
? Description: A web application for task management
? Author: Jane Developer
? Email: jane@example.com
? License: MIT
? CI/CD provider: GitHub Actions
? Include Docker support? Yes
? Initialize git repository? Yes
Creating project structure...
Created: my-awesome-app/
Created: my-awesome-app/.github/workflows/ci.yml
Created: my-awesome-app/src/my_awesome_app/__init__.py
Created: my-awesome-app/src/my_awesome_app/main.py
...
Created: my-awesome-app/README.md
Done! 16 files created in my-awesome-app/
Next steps:
cd my-awesome-app
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
python -m pytest
```
## 扩展模板
在技能文件夹的 `templates/` 目录中放置文件即