cvte-skills-cli 1.0.2 → 1.0.3
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/README.md +13 -11
- package/lib/index.js +10 -12
- package/lib/installers/claude.js +13 -29
- package/lib/installers/codex.js +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
| 助手 | 配置文件位置 |
|
|
8
8
|
|------|-------------|
|
|
9
|
-
| Claude Code | `~/.claude/
|
|
9
|
+
| Claude Code | `~/.claude/commands/` (全局) / `.claude/commands/` (项目) |
|
|
10
10
|
| Cursor | `~/.cursor/rules` (全局) / `.cursorrules` (项目) |
|
|
11
11
|
| Windsurf | `~/.windsurf/rules` (全局) / `.windsurfrules` (项目) |
|
|
12
12
|
| GitHub Copilot | `.github/copilot-instructions.md` |
|
|
13
|
-
| Codex CLI | `~/.codex/
|
|
13
|
+
| Codex CLI | `~/.codex/AGENTS.md` (全局) / `AGENTS.md` (项目) |
|
|
14
14
|
| Gemini CLI | `~/.gemini/instructions.md` (全局) / `GEMINI.md` (项目) |
|
|
15
15
|
|
|
16
16
|
## 包含的 Skills
|
|
@@ -149,15 +149,13 @@ description: "Skill 的简短描述"
|
|
|
149
149
|
### Claude Code
|
|
150
150
|
|
|
151
151
|
```bash
|
|
152
|
-
# 方式1:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
]
|
|
160
|
-
}
|
|
152
|
+
# 方式1: 安装为全局斜杠命令
|
|
153
|
+
mkdir -p ~/.claude/commands
|
|
154
|
+
cp /path/to/skills/skills/gitlab-commit-message/SKILL.md ~/.claude/commands/gitlab-commit-message.md
|
|
155
|
+
|
|
156
|
+
# 方式2: 安装为项目级斜杠命令
|
|
157
|
+
mkdir -p .claude/commands
|
|
158
|
+
cp /path/to/skills/skills/gitlab-commit-message/SKILL.md .claude/commands/gitlab-commit-message.md
|
|
161
159
|
```
|
|
162
160
|
|
|
163
161
|
### Cursor
|
|
@@ -168,6 +166,10 @@ claude config add skills /path/to/skills/skills/gitlab-commit-message
|
|
|
168
166
|
|
|
169
167
|
将 skill 内容复制到 `.github/copilot-instructions.md` 文件中。
|
|
170
168
|
|
|
169
|
+
### Codex CLI
|
|
170
|
+
|
|
171
|
+
将 skill 内容追加到项目根目录的 `AGENTS.md` 文件中。
|
|
172
|
+
|
|
171
173
|
## 许可证
|
|
172
174
|
|
|
173
175
|
MIT
|
package/lib/index.js
CHANGED
|
@@ -114,24 +114,22 @@ function getUsageHints(target, isGlobal) {
|
|
|
114
114
|
const hints = {
|
|
115
115
|
claude: {
|
|
116
116
|
project: [
|
|
117
|
-
'Skills have been added to .claude/
|
|
117
|
+
'Skills have been added to .claude/commands/',
|
|
118
118
|
'',
|
|
119
119
|
'Usage:',
|
|
120
120
|
' 1. Start Claude Code in this directory:',
|
|
121
121
|
' $ claude',
|
|
122
|
-
' 2.
|
|
123
|
-
'
|
|
124
|
-
' > Help me write a commit message',
|
|
122
|
+
' 2. Use the slash command to invoke a skill, e.g.:',
|
|
123
|
+
' > /gitlab-commit-message',
|
|
125
124
|
],
|
|
126
125
|
global: [
|
|
127
|
-
'Skills have been added to ~/.claude/
|
|
126
|
+
'Skills have been added to ~/.claude/commands/',
|
|
128
127
|
'',
|
|
129
128
|
'Usage:',
|
|
130
129
|
' 1. Start Claude Code anywhere:',
|
|
131
130
|
' $ claude',
|
|
132
|
-
' 2.
|
|
133
|
-
'
|
|
134
|
-
' > Help me write a commit message',
|
|
131
|
+
' 2. Use the slash command to invoke a skill, e.g.:',
|
|
132
|
+
' > /gitlab-commit-message',
|
|
135
133
|
],
|
|
136
134
|
},
|
|
137
135
|
cursor: {
|
|
@@ -184,20 +182,20 @@ function getUsageHints(target, isGlobal) {
|
|
|
184
182
|
},
|
|
185
183
|
codex: {
|
|
186
184
|
project: [
|
|
187
|
-
'Skills have been
|
|
185
|
+
'Skills have been appended to AGENTS.md in your project.',
|
|
188
186
|
'',
|
|
189
187
|
'Usage:',
|
|
190
188
|
' 1. Run Codex CLI in this directory:',
|
|
191
189
|
' $ codex',
|
|
192
|
-
' 2.
|
|
190
|
+
' 2. Codex will automatically follow the instructions in AGENTS.md.',
|
|
193
191
|
],
|
|
194
192
|
global: [
|
|
195
|
-
'Skills have been
|
|
193
|
+
'Skills have been appended to ~/.codex/AGENTS.md',
|
|
196
194
|
'',
|
|
197
195
|
'Usage:',
|
|
198
196
|
' 1. Run Codex CLI anywhere:',
|
|
199
197
|
' $ codex',
|
|
200
|
-
' 2.
|
|
198
|
+
' 2. Codex will automatically follow the global instructions.',
|
|
201
199
|
],
|
|
202
200
|
},
|
|
203
201
|
gemini: {
|
package/lib/installers/claude.js
CHANGED
|
@@ -1,45 +1,29 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import os from 'os';
|
|
4
|
-
import { getSkillsDir } from '../index.js';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Claude Code 安装器
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
* - 全局: ~/.claude/
|
|
11
|
-
* - 项目级: .claude/
|
|
8
|
+
* 将 skill 安装为 Claude Code 自定义斜杠命令:
|
|
9
|
+
* - 全局: ~/.claude/commands/<skill-name>.md
|
|
10
|
+
* - 项目级: .claude/commands/<skill-name>.md
|
|
11
|
+
*
|
|
12
|
+
* 安装后用户可通过 /<skill-name> 调用对应 skill。
|
|
12
13
|
*/
|
|
13
14
|
export async function installForClaude(skills, options = {}) {
|
|
14
15
|
const { isGlobal = false } = options;
|
|
15
16
|
|
|
16
|
-
const
|
|
17
|
-
? path.join(os.homedir(), '.claude', '
|
|
18
|
-
: path.join(process.cwd(), '.claude', '
|
|
19
|
-
|
|
20
|
-
// 确保目录存在
|
|
21
|
-
await fs.ensureDir(path.dirname(settingsPath));
|
|
22
|
-
|
|
23
|
-
let settings = {};
|
|
24
|
-
if (await fs.pathExists(settingsPath)) {
|
|
25
|
-
try {
|
|
26
|
-
settings = await fs.readJson(settingsPath);
|
|
27
|
-
} catch {
|
|
28
|
-
settings = {};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
17
|
+
const commandsDir = isGlobal
|
|
18
|
+
? path.join(os.homedir(), '.claude', 'commands')
|
|
19
|
+
: path.join(process.cwd(), '.claude', 'commands');
|
|
31
20
|
|
|
32
|
-
|
|
33
|
-
if (!Array.isArray(settings.skills)) {
|
|
34
|
-
settings.skills = [];
|
|
35
|
-
}
|
|
21
|
+
await fs.ensureDir(commandsDir);
|
|
36
22
|
|
|
37
|
-
// 添加 skill 路径
|
|
38
23
|
for (const skill of skills) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
24
|
+
const skillContent = await fs.readFile(skill.skillFile, 'utf-8');
|
|
25
|
+
const cleanContent = skillContent.replace(/^---\s*\n[\s\S]*?\n---\s*\n?/, '').trim();
|
|
26
|
+
const targetPath = path.join(commandsDir, `${skill.name}.md`);
|
|
27
|
+
await fs.writeFile(targetPath, cleanContent + '\n');
|
|
42
28
|
}
|
|
43
|
-
|
|
44
|
-
await fs.writeJson(settingsPath, settings, { spaces: 2 });
|
|
45
29
|
}
|
package/lib/installers/codex.js
CHANGED
|
@@ -5,16 +5,16 @@ import os from 'os';
|
|
|
5
5
|
/**
|
|
6
6
|
* OpenAI Codex CLI 安装器
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* - 全局: ~/.codex/
|
|
10
|
-
* - 项目级:
|
|
8
|
+
* 将 skill 内容追加到 AGENTS.md:
|
|
9
|
+
* - 全局: ~/.codex/AGENTS.md
|
|
10
|
+
* - 项目级: AGENTS.md
|
|
11
11
|
*/
|
|
12
12
|
export async function installForCodex(skills, options = {}) {
|
|
13
13
|
const { isGlobal = false } = options;
|
|
14
14
|
|
|
15
15
|
const targetPath = isGlobal
|
|
16
|
-
? path.join(os.homedir(), '.codex', '
|
|
17
|
-
: path.join(process.cwd(), '
|
|
16
|
+
? path.join(os.homedir(), '.codex', 'AGENTS.md')
|
|
17
|
+
: path.join(process.cwd(), 'AGENTS.md');
|
|
18
18
|
|
|
19
19
|
await fs.ensureDir(path.dirname(targetPath));
|
|
20
20
|
|