feng3d-cli 0.0.12 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-skill/README.md +274 -0
- package/.claude-skill/SKILL.md +188 -0
- package/.claude-skill/install.ps1 +76 -0
- package/.claude-skill/install.sh +66 -0
- package/.claude-skill/prompt.md +182 -0
- package/.claude-skill/skill.json +21 -0
- package/README.md +46 -0
- package/bin/cli.js +18 -1
- package/dist/index.js +71 -4
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +72 -6
- package/dist/index.umd.cjs.map +1 -1
- package/lib/commands/install-skill.d.ts +5 -0
- package/lib/commands/install-skill.d.ts.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# feng3d Claude Code Skill
|
|
2
|
+
|
|
3
|
+
这是 feng3d-cli 的 Claude Code Skill 配置,允许你在 Claude Code 中直接使用 feng3d-cli 功能。
|
|
4
|
+
|
|
5
|
+
## 快速安装 🚀
|
|
6
|
+
|
|
7
|
+
### 方法 1:通过 Skills.sh(推荐)⭐
|
|
8
|
+
|
|
9
|
+
使用 [Skills.sh](https://skills.sh/) 生态系统标准方式:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx skills add feng3d-labs/feng3d-cli
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**为什么推荐?**
|
|
16
|
+
- ✅ 生态系统标准方式
|
|
17
|
+
- ✅ 自动索引和发现
|
|
18
|
+
- ✅ 支持多个 AI 代理(Claude Code, Cursor, Windsurf 等)
|
|
19
|
+
- ✅ 安装统计和排行榜
|
|
20
|
+
|
|
21
|
+
### 方法 2:使用 feng3d-cli 命令
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx feng3d-cli skill
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**这条命令会:**
|
|
28
|
+
- ✅ 自动下载 feng3d-cli(如果未安装)
|
|
29
|
+
- ✅ 将 skill 复制到 `~/.claude/skills/feng3d`
|
|
30
|
+
- ✅ 无需额外配置或权限
|
|
31
|
+
|
|
32
|
+
> 💡 提示:也可以使用完整命令 `npx feng3d-cli install-skill`
|
|
33
|
+
|
|
34
|
+
**全局安装:**
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install -g feng3d-cli
|
|
38
|
+
feng3d-cli skill
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 方法 2:一键安装脚本
|
|
42
|
+
|
|
43
|
+
**macOS / Linux**:
|
|
44
|
+
```bash
|
|
45
|
+
curl -fsSL https://raw.githubusercontent.com/feng3d-labs/feng3d-cli/master/.claude-skill/install.sh | bash
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
或者手动下载并执行:
|
|
49
|
+
```bash
|
|
50
|
+
wget https://raw.githubusercontent.com/feng3d-labs/feng3d-cli/master/.claude-skill/install.sh
|
|
51
|
+
chmod +x install.sh
|
|
52
|
+
./install.sh
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Windows (PowerShell)**:
|
|
56
|
+
```powershell
|
|
57
|
+
irm https://raw.githubusercontent.com/feng3d-labs/feng3d-cli/master/.claude-skill/install.ps1 | iex
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
或者手动下载并执行:
|
|
61
|
+
```powershell
|
|
62
|
+
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/feng3d-labs/feng3d-cli/master/.claude-skill/install.ps1" -OutFile "install.ps1"
|
|
63
|
+
.\install.ps1
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 手动安装方法
|
|
69
|
+
|
|
70
|
+
### 方式 1:本地安装(推荐用于开发)
|
|
71
|
+
|
|
72
|
+
将此 skill 复制到你的 Claude Code skills 目录:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# 创建 skills 目录(如果不存在)
|
|
76
|
+
mkdir -p ~/.claude/skills
|
|
77
|
+
|
|
78
|
+
# 复制 skill 到 Claude 配置目录
|
|
79
|
+
cp -r .claude-skill ~/.claude/skills/feng3d
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 方式 2:作为 npm 包发布(推荐用于团队使用)
|
|
83
|
+
|
|
84
|
+
1. 在项目中添加 skill 相关文件到 npm 包:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
// package.json
|
|
88
|
+
{
|
|
89
|
+
"files": [
|
|
90
|
+
"bin",
|
|
91
|
+
"dist",
|
|
92
|
+
"lib",
|
|
93
|
+
"templates",
|
|
94
|
+
".claude-skill"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
2. 发布到 npm(如果还没发布):
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npm publish
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
3. 用户安装后,创建符号链接:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm install -g feng3d-cli
|
|
109
|
+
ln -s $(npm root -g)/feng3d-cli/.claude-skill ~/.claude/skills/feng3d
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 方式 3:直接从 GitHub 使用
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
mkdir -p ~/.claude/skills
|
|
116
|
+
git clone https://github.com/feng3d-labs/feng3d-cli.git /tmp/feng3d-cli
|
|
117
|
+
cp -r /tmp/feng3d-cli/.claude-skill ~/.claude/skills/feng3d
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## 使用方法
|
|
121
|
+
|
|
122
|
+
安装后,在 Claude Code 中可以通过以下方式使用:
|
|
123
|
+
|
|
124
|
+
### 方法 1:使用 /feng3d 命令(推荐)
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# 创建新项目
|
|
128
|
+
/feng3d create my-project
|
|
129
|
+
|
|
130
|
+
# 更新当前项目
|
|
131
|
+
/feng3d update
|
|
132
|
+
|
|
133
|
+
# 创建项目(带选项)
|
|
134
|
+
/feng3d create my-lib --no-examples
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 方法 2:直接对话
|
|
138
|
+
|
|
139
|
+
你也可以直接告诉 Claude:
|
|
140
|
+
|
|
141
|
+
- "用 feng3d 创建一个新项目"
|
|
142
|
+
- "更新我的项目到最新的 feng3d 规范"
|
|
143
|
+
- "帮我初始化一个 feng3d 项目"
|
|
144
|
+
|
|
145
|
+
Claude 会自动调用 feng3d skill 来完成任务。
|
|
146
|
+
|
|
147
|
+
## 功能说明
|
|
148
|
+
|
|
149
|
+
### 创建项目 (create)
|
|
150
|
+
|
|
151
|
+
创建一个符合 feng3d 规范的新项目,包含:
|
|
152
|
+
|
|
153
|
+
- 统一的项目结构
|
|
154
|
+
- 代码规范配置(ESLint)
|
|
155
|
+
- TypeScript 配置
|
|
156
|
+
- Vite 构建配置
|
|
157
|
+
- Vitest 测试配置
|
|
158
|
+
- GitHub Actions 工作流
|
|
159
|
+
- Git pre-commit 钩子
|
|
160
|
+
- 文档生成配置
|
|
161
|
+
|
|
162
|
+
**选项**:
|
|
163
|
+
- `-d, --directory <dir>` - 指定项目目录
|
|
164
|
+
- `--no-examples` - 不创建 examples 目录
|
|
165
|
+
- `--no-vitest` - 不包含 vitest 配置
|
|
166
|
+
|
|
167
|
+
### 更新项目 (update)
|
|
168
|
+
|
|
169
|
+
更新现有项目到最新的 feng3d 规范,会更新:
|
|
170
|
+
|
|
171
|
+
- 所有配置文件
|
|
172
|
+
- 依赖版本
|
|
173
|
+
- GitHub Actions 工作流
|
|
174
|
+
- 脚本文件
|
|
175
|
+
|
|
176
|
+
**选项**:
|
|
177
|
+
- `-d, --directory <dir>` - 指定项目目录
|
|
178
|
+
|
|
179
|
+
## 示例对话
|
|
180
|
+
|
|
181
|
+
### 示例 1:创建新项目
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
你:创建一个新的 feng3d 项目叫 my-library
|
|
185
|
+
|
|
186
|
+
Claude:我会为你创建一个 feng3d 项目。
|
|
187
|
+
[执行: npx feng3d-cli create my-library]
|
|
188
|
+
|
|
189
|
+
项目创建成功!接下来你需要:
|
|
190
|
+
1. cd my-library
|
|
191
|
+
2. npm install
|
|
192
|
+
3. npm run dev
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### 示例 2:更新现有项目
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
你:更新当前项目到最新的 feng3d 标准
|
|
199
|
+
|
|
200
|
+
Claude:我会更新你的项目配置。建议先提交当前更改,这样可以清楚地看到更新了哪些文件。
|
|
201
|
+
[执行: npx feng3d-cli update]
|
|
202
|
+
|
|
203
|
+
配置已更新!建议:
|
|
204
|
+
1. 运行 git diff 查看更改
|
|
205
|
+
2. 运行 npm install 安装新依赖
|
|
206
|
+
3. 运行 npm test 确保测试通过
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## 文件结构
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
.claude-skill/
|
|
213
|
+
├── skill.json # Skill 元数据配置
|
|
214
|
+
├── prompt.md # Skill 提示词指令
|
|
215
|
+
└── README.md # 使用文档(本文件)
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## 开发和贡献
|
|
219
|
+
|
|
220
|
+
如果你想改进这个 skill:
|
|
221
|
+
|
|
222
|
+
1. 修改 [prompt.md](./prompt.md) 来调整 Claude 的行为
|
|
223
|
+
2. 更新 [skill.json](./skill.json) 来修改元数据
|
|
224
|
+
3. 测试 skill 是否正常工作
|
|
225
|
+
4. 提交 Pull Request
|
|
226
|
+
|
|
227
|
+
## 技术细节
|
|
228
|
+
|
|
229
|
+
### 工作原理
|
|
230
|
+
|
|
231
|
+
这个 skill 是一个"包装器"skill,它:
|
|
232
|
+
|
|
233
|
+
1. 接收用户的指令
|
|
234
|
+
2. 通过 Claude 的 Bash 工具调用 `npx feng3d-cli`
|
|
235
|
+
3. 展示命令输出
|
|
236
|
+
4. 提供后续建议
|
|
237
|
+
|
|
238
|
+
### 与 feng3d-cli 的关系
|
|
239
|
+
|
|
240
|
+
- Skill 不修改 feng3d-cli 的核心代码
|
|
241
|
+
- 所有功能都通过调用 CLI 实现
|
|
242
|
+
- feng3d-cli 可以独立使用,不依赖 skill
|
|
243
|
+
- Skill 只是让在 Claude Code 中使用更方便
|
|
244
|
+
|
|
245
|
+
## 常见问题
|
|
246
|
+
|
|
247
|
+
### Q: 如何验证 skill 已安装?
|
|
248
|
+
|
|
249
|
+
A: 在 Claude Code 中输入 `/help`,应该能看到 feng3d skill 列出。
|
|
250
|
+
|
|
251
|
+
### Q: Skill 不工作怎么办?
|
|
252
|
+
|
|
253
|
+
A: 检查:
|
|
254
|
+
1. skill 文件是否正确复制到 `~/.claude/skills/feng3d/`
|
|
255
|
+
2. skill.json 格式是否正确
|
|
256
|
+
3. 重启 Claude Code
|
|
257
|
+
|
|
258
|
+
### Q: 可以自定义 skill 的行为吗?
|
|
259
|
+
|
|
260
|
+
A: 可以!编辑 `prompt.md` 文件来调整 Claude 的行为。
|
|
261
|
+
|
|
262
|
+
### Q: 这个 skill 会随 feng3d-cli 更新吗?
|
|
263
|
+
|
|
264
|
+
A: 如果使用方式 1 或 3,需要手动更新。如果使用方式 2(npm 包),运行 `npm update -g feng3d-cli` 后重新创建符号链接。
|
|
265
|
+
|
|
266
|
+
## 相关链接
|
|
267
|
+
|
|
268
|
+
- [feng3d-cli GitHub](https://github.com/feng3d-labs/feng3d-cli)
|
|
269
|
+
- [feng3d-cli 文档](https://feng3d.com/feng3d-cli/)
|
|
270
|
+
- [Claude Code 文档](https://github.com/anthropics/claude-code)
|
|
271
|
+
|
|
272
|
+
## 许可证
|
|
273
|
+
|
|
274
|
+
MIT
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "feng3d-cli"
|
|
3
|
+
description: "Create and update feng3d projects with unified standards, including ESLint, TypeScript, Vite, GitHub Actions, and pre-commit hooks. Automate project setup and configuration management for feng3d development."
|
|
4
|
+
version: "0.1.1"
|
|
5
|
+
author: "feng"
|
|
6
|
+
category: "Development"
|
|
7
|
+
tags:
|
|
8
|
+
- project-setup
|
|
9
|
+
- scaffolding
|
|
10
|
+
- standards
|
|
11
|
+
- typescript
|
|
12
|
+
- vite
|
|
13
|
+
- eslint
|
|
14
|
+
- automation
|
|
15
|
+
- cli
|
|
16
|
+
complexity: "simple"
|
|
17
|
+
repository: "https://github.com/feng3d-labs/feng3d-cli"
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# feng3d-cli Skill
|
|
21
|
+
|
|
22
|
+
Automate the creation and management of feng3d projects with unified standards.
|
|
23
|
+
|
|
24
|
+
## What This Skill Does
|
|
25
|
+
|
|
26
|
+
This skill enables Claude to help you:
|
|
27
|
+
- Create new feng3d projects with complete standard configurations
|
|
28
|
+
- Update existing projects to latest feng3d standards
|
|
29
|
+
- Manage unified dependency versions across projects
|
|
30
|
+
- Set up GitHub Actions workflows (CI/CD, Pages deployment, OSS upload)
|
|
31
|
+
- Configure development tools (ESLint, TypeScript, Vite, Vitest, Husky)
|
|
32
|
+
|
|
33
|
+
## When to Use This Skill
|
|
34
|
+
|
|
35
|
+
Use this skill when:
|
|
36
|
+
- Starting a new feng3d project
|
|
37
|
+
- Updating project configurations to match team standards
|
|
38
|
+
- Standardizing multiple projects across a monorepo
|
|
39
|
+
- Setting up CI/CD pipelines for feng3d projects
|
|
40
|
+
|
|
41
|
+
## Commands
|
|
42
|
+
|
|
43
|
+
### Create New Project
|
|
44
|
+
```bash
|
|
45
|
+
npx feng3d-cli create <project-name> [options]
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Options:
|
|
49
|
+
- `-d, --directory <dir>` - Project directory (default: current directory)
|
|
50
|
+
- `--no-examples` - Don't create examples directory
|
|
51
|
+
- `--no-vitest` - Don't include vitest test configuration
|
|
52
|
+
|
|
53
|
+
### Update Existing Project
|
|
54
|
+
```bash
|
|
55
|
+
npx feng3d-cli update [options]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Options:
|
|
59
|
+
- `-d, --directory <dir>` - Project directory (default: current directory)
|
|
60
|
+
|
|
61
|
+
### Install This Skill
|
|
62
|
+
```bash
|
|
63
|
+
npx feng3d-cli skill
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## What Gets Created/Updated
|
|
67
|
+
|
|
68
|
+
### Project Structure
|
|
69
|
+
- `package.json` - Unified dependencies and scripts
|
|
70
|
+
- `tsconfig.json` - TypeScript configuration
|
|
71
|
+
- `vite.config.js` - Vite build configuration
|
|
72
|
+
- `vitest.config.ts` - Vitest test configuration
|
|
73
|
+
- `eslint.config.js` - ESLint linting rules
|
|
74
|
+
- `typedoc.json` - Documentation generation
|
|
75
|
+
|
|
76
|
+
### Templates
|
|
77
|
+
- `LICENSE` - MIT license (Chinese)
|
|
78
|
+
- `.gitignore` - Git ignore rules
|
|
79
|
+
- `.cursorrules` - Cursor AI rules
|
|
80
|
+
- `.vscode/settings.json` - VS Code settings
|
|
81
|
+
- `.husky/pre-commit` - Pre-commit hooks (lint + test)
|
|
82
|
+
|
|
83
|
+
### Scripts
|
|
84
|
+
- `scripts/prepublish.js` - Pre-publish script
|
|
85
|
+
- `scripts/postpublish.js` - Post-publish script
|
|
86
|
+
- `scripts/postdocs.js` - Post-documentation script
|
|
87
|
+
|
|
88
|
+
### GitHub Actions
|
|
89
|
+
- `.github/workflows/pull-request.yml` - PR checks
|
|
90
|
+
- `.github/workflows/publish.yml` - Publish to npm
|
|
91
|
+
- `.github/workflows/pages.yml` - Deploy docs to GitHub Pages
|
|
92
|
+
- `.github/workflows/upload-oss.yml` - Upload to Aliyun OSS
|
|
93
|
+
|
|
94
|
+
## Code Standards
|
|
95
|
+
|
|
96
|
+
### Indentation
|
|
97
|
+
- Use 4 spaces
|
|
98
|
+
|
|
99
|
+
### Quotes
|
|
100
|
+
- Use single quotes
|
|
101
|
+
|
|
102
|
+
### Naming Conventions
|
|
103
|
+
- Variables and functions: camelCase
|
|
104
|
+
- Classes and interfaces: PascalCase
|
|
105
|
+
- Constants: UPPER_SNAKE_CASE
|
|
106
|
+
|
|
107
|
+
### Git Commit Convention
|
|
108
|
+
- Use Simplified Chinese
|
|
109
|
+
- Follow Conventional Commits format
|
|
110
|
+
- Types: feat, fix, refactor, perf, style, docs, test, chore, build, ci
|
|
111
|
+
|
|
112
|
+
### Pre-commit Checks
|
|
113
|
+
Before committing, automatically runs:
|
|
114
|
+
1. ESLint code style check
|
|
115
|
+
2. Unit tests via vitest
|
|
116
|
+
|
|
117
|
+
## Unified Versions
|
|
118
|
+
|
|
119
|
+
| Dependency | Version |
|
|
120
|
+
|------------|---------|
|
|
121
|
+
| TypeScript | 5.8.3 |
|
|
122
|
+
| ESLint | 9.26.0 |
|
|
123
|
+
| Vitest | ^3.1.3 |
|
|
124
|
+
| Vite | ^6.3.5 |
|
|
125
|
+
| TypeDoc | ^0.28.4 |
|
|
126
|
+
|
|
127
|
+
## Examples
|
|
128
|
+
|
|
129
|
+
### Example 1: Create a new library project
|
|
130
|
+
```
|
|
131
|
+
User: Create a feng3d library project called "my-3d-engine"
|
|
132
|
+
|
|
133
|
+
Claude: I'll create a new feng3d project for you.
|
|
134
|
+
[Executes: npx feng3d-cli create my-3d-engine]
|
|
135
|
+
|
|
136
|
+
Project created! Next steps:
|
|
137
|
+
1. cd my-3d-engine
|
|
138
|
+
2. npm install
|
|
139
|
+
3. npm run dev
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Example 2: Update project standards
|
|
143
|
+
```
|
|
144
|
+
User: Update my current project to latest feng3d standards
|
|
145
|
+
|
|
146
|
+
Claude: I'll update your project configuration. Make sure you've committed changes first.
|
|
147
|
+
[Executes: npx feng3d-cli update]
|
|
148
|
+
|
|
149
|
+
Configuration updated! Review changes with `git diff`.
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Example 3: Create without examples
|
|
153
|
+
```
|
|
154
|
+
User: Create a feng3d project without the examples directory
|
|
155
|
+
|
|
156
|
+
Claude: [Executes: npx feng3d-cli create my-project --no-examples]
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## OSS Upload Configuration
|
|
160
|
+
|
|
161
|
+
To enable OSS upload in GitHub Actions, configure these secrets in your repository:
|
|
162
|
+
- `OSS_REGION` - OSS region (e.g., `oss-cn-hangzhou`)
|
|
163
|
+
- `OSS_ACCESS_KEY_ID` - Aliyun AccessKey ID
|
|
164
|
+
- `OSS_ACCESS_KEY_SECRET` - Aliyun AccessKey Secret
|
|
165
|
+
- `OSS_BUCKET` - OSS Bucket name
|
|
166
|
+
|
|
167
|
+
## Installation
|
|
168
|
+
|
|
169
|
+
### Quick Install
|
|
170
|
+
```bash
|
|
171
|
+
npx feng3d-cli skill
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Manual Install
|
|
175
|
+
```bash
|
|
176
|
+
mkdir -p ~/.claude/skills
|
|
177
|
+
cp -r .claude-skill ~/.claude/skills/feng3d
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Resources
|
|
181
|
+
|
|
182
|
+
- [GitHub Repository](https://github.com/feng3d-labs/feng3d-cli)
|
|
183
|
+
- [Documentation](https://feng3d.com/feng3d-cli/)
|
|
184
|
+
- [npm Package](https://www.npmjs.com/package/feng3d-cli)
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
|
|
188
|
+
MIT
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# feng3d Skill 安装脚本(Windows PowerShell)
|
|
2
|
+
|
|
3
|
+
$ErrorActionPreference = "Stop"
|
|
4
|
+
|
|
5
|
+
$SkillDir = "$env:USERPROFILE\.claude\skills\feng3d"
|
|
6
|
+
$RepoUrl = "https://github.com/feng3d-labs/feng3d-cli.git"
|
|
7
|
+
|
|
8
|
+
Write-Host "📦 开始安装 feng3d Claude Code Skill..." -ForegroundColor Cyan
|
|
9
|
+
|
|
10
|
+
# 创建 skills 目录
|
|
11
|
+
Write-Host "1. 创建 skills 目录..." -ForegroundColor Yellow
|
|
12
|
+
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.claude\skills" | Out-Null
|
|
13
|
+
|
|
14
|
+
# 检查是否已安装
|
|
15
|
+
if (Test-Path $SkillDir) {
|
|
16
|
+
Write-Host "⚠️ 检测到已安装的 skill,将进行更新..." -ForegroundColor Yellow
|
|
17
|
+
Remove-Item -Recurse -Force $SkillDir
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
# 检测安装方式
|
|
21
|
+
if ((Test-Path ".git") -and (Test-Path ".claude-skill\skill.json")) {
|
|
22
|
+
# 本地仓库
|
|
23
|
+
Write-Host "2. 从本地仓库复制..." -ForegroundColor Yellow
|
|
24
|
+
Copy-Item -Path ".claude-skill" -Destination $SkillDir -Recurse -Force
|
|
25
|
+
}
|
|
26
|
+
elseif (Get-Command npm -ErrorAction SilentlyContinue) {
|
|
27
|
+
# 尝试从 npm 安装
|
|
28
|
+
Write-Host "2. 尝试从 npm 包安装..." -ForegroundColor Yellow
|
|
29
|
+
try {
|
|
30
|
+
$npmRoot = npm root -g 2>$null
|
|
31
|
+
$npmSkillPath = Join-Path $npmRoot "feng3d-cli\.claude-skill"
|
|
32
|
+
|
|
33
|
+
if (Test-Path $npmSkillPath) {
|
|
34
|
+
Copy-Item -Path $npmSkillPath -Destination $SkillDir -Recurse -Force
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
throw "npm 包未找到"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
Write-Host " npm 包未找到,从 GitHub 克隆..." -ForegroundColor Yellow
|
|
42
|
+
$TempDir = Join-Path $env:TEMP "feng3d-cli-$(Get-Random)"
|
|
43
|
+
git clone --depth 1 $RepoUrl $TempDir
|
|
44
|
+
Copy-Item -Path "$TempDir\.claude-skill" -Destination $SkillDir -Recurse -Force
|
|
45
|
+
Remove-Item -Recurse -Force $TempDir
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
# 从 GitHub 克隆
|
|
50
|
+
Write-Host "2. 从 GitHub 克隆..." -ForegroundColor Yellow
|
|
51
|
+
$TempDir = Join-Path $env:TEMP "feng3d-cli-$(Get-Random)"
|
|
52
|
+
git clone --depth 1 $RepoUrl $TempDir
|
|
53
|
+
Copy-Item -Path "$TempDir\.claude-skill" -Destination $SkillDir -Recurse -Force
|
|
54
|
+
Remove-Item -Recurse -Force $TempDir
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
# 验证安装
|
|
58
|
+
if (Test-Path "$SkillDir\skill.json") {
|
|
59
|
+
Write-Host ""
|
|
60
|
+
Write-Host "✅ feng3d Skill 安装成功!" -ForegroundColor Green
|
|
61
|
+
Write-Host ""
|
|
62
|
+
Write-Host "安装位置: $SkillDir" -ForegroundColor Cyan
|
|
63
|
+
Write-Host ""
|
|
64
|
+
Write-Host "使用方法:" -ForegroundColor Yellow
|
|
65
|
+
Write-Host " /feng3d create my-project"
|
|
66
|
+
Write-Host " /feng3d update"
|
|
67
|
+
Write-Host ""
|
|
68
|
+
Write-Host "或直接对话: `"用 feng3d 创建一个新项目`"" -ForegroundColor Yellow
|
|
69
|
+
Write-Host ""
|
|
70
|
+
Write-Host "💡 提示: 可能需要重启 Claude Code 使 skill 生效" -ForegroundColor Cyan
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
Write-Host ""
|
|
74
|
+
Write-Host "❌ 安装失败,请检查错误信息" -ForegroundColor Red
|
|
75
|
+
exit 1
|
|
76
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# feng3d Skill 安装脚本(macOS/Linux)
|
|
3
|
+
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
SKILL_DIR="$HOME/.claude/skills/feng3d"
|
|
7
|
+
REPO_URL="https://github.com/feng3d-labs/feng3d-cli.git"
|
|
8
|
+
|
|
9
|
+
echo "📦 开始安装 feng3d Claude Code Skill..."
|
|
10
|
+
|
|
11
|
+
# 创建 skills 目录
|
|
12
|
+
echo "1. 创建 skills 目录..."
|
|
13
|
+
mkdir -p "$HOME/.claude/skills"
|
|
14
|
+
|
|
15
|
+
# 检查是否已安装
|
|
16
|
+
if [ -d "$SKILL_DIR" ]; then
|
|
17
|
+
echo "⚠️ 检测到已安装的 skill,将进行更新..."
|
|
18
|
+
rm -rf "$SKILL_DIR"
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# 检测安装方式
|
|
22
|
+
if [ -d ".git" ] && [ -f ".claude-skill/skill.json" ]; then
|
|
23
|
+
# 本地仓库
|
|
24
|
+
echo "2. 从本地仓库复制..."
|
|
25
|
+
cp -r .claude-skill "$SKILL_DIR"
|
|
26
|
+
elif command -v npm &> /dev/null; then
|
|
27
|
+
# 尝试从 npm 安装
|
|
28
|
+
echo "2. 尝试从 npm 包安装..."
|
|
29
|
+
npm_root=$(npm root -g 2>/dev/null || echo "")
|
|
30
|
+
if [ -n "$npm_root" ] && [ -d "$npm_root/feng3d-cli/.claude-skill" ]; then
|
|
31
|
+
cp -r "$npm_root/feng3d-cli/.claude-skill" "$SKILL_DIR"
|
|
32
|
+
else
|
|
33
|
+
echo " npm 包未找到,从 GitHub 克隆..."
|
|
34
|
+
TEMP_DIR=$(mktemp -d)
|
|
35
|
+
git clone --depth 1 "$REPO_URL" "$TEMP_DIR"
|
|
36
|
+
cp -r "$TEMP_DIR/.claude-skill" "$SKILL_DIR"
|
|
37
|
+
rm -rf "$TEMP_DIR"
|
|
38
|
+
fi
|
|
39
|
+
else
|
|
40
|
+
# 从 GitHub 克隆
|
|
41
|
+
echo "2. 从 GitHub 克隆..."
|
|
42
|
+
TEMP_DIR=$(mktemp -d)
|
|
43
|
+
git clone --depth 1 "$REPO_URL" "$TEMP_DIR"
|
|
44
|
+
cp -r "$TEMP_DIR/.claude-skill" "$SKILL_DIR"
|
|
45
|
+
rm -rf "$TEMP_DIR"
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
# 验证安装
|
|
49
|
+
if [ -f "$SKILL_DIR/skill.json" ]; then
|
|
50
|
+
echo ""
|
|
51
|
+
echo "✅ feng3d Skill 安装成功!"
|
|
52
|
+
echo ""
|
|
53
|
+
echo "安装位置: $SKILL_DIR"
|
|
54
|
+
echo ""
|
|
55
|
+
echo "使用方法:"
|
|
56
|
+
echo " /feng3d create my-project"
|
|
57
|
+
echo " /feng3d update"
|
|
58
|
+
echo ""
|
|
59
|
+
echo "或直接对话: \"用 feng3d 创建一个新项目\""
|
|
60
|
+
echo ""
|
|
61
|
+
echo "💡 提示: 可能需要重启 Claude Code 使 skill 生效"
|
|
62
|
+
else
|
|
63
|
+
echo ""
|
|
64
|
+
echo "❌ 安装失败,请检查错误信息"
|
|
65
|
+
exit 1
|
|
66
|
+
fi
|