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 CHANGED
@@ -6,11 +6,11 @@
6
6
 
7
7
  | 助手 | 配置文件位置 |
8
8
  |------|-------------|
9
- | Claude Code | `~/.claude/settings.json` (全局) / `CLAUDE.md` (项目) |
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/instructions.md` (全局) / `codex.md` (项目) |
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: 使用 claude 命令
153
- claude config add skills /path/to/skills/skills/gitlab-commit-message
154
-
155
- # 方式2: 编辑 ~/.claude/settings.json
156
- {
157
- "skills": [
158
- "/path/to/skills/skills/gitlab-commit-message"
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/settings.local.json',
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. Run /skills to see installed skills.',
123
- ' 3. Ask Claude to use the skill, e.g.:',
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/settings.json',
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. Run /skills to see installed skills.',
133
- ' 3. Ask Claude to use the skill, e.g.:',
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 added to codex.md in your project.',
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. The skills will be automatically loaded.',
190
+ ' 2. Codex will automatically follow the instructions in AGENTS.md.',
193
191
  ],
194
192
  global: [
195
- 'Skills have been added to ~/.codex/instructions.md',
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. The skills are globally available.',
198
+ ' 2. Codex will automatically follow the global instructions.',
201
199
  ],
202
200
  },
203
201
  gemini: {
@@ -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
- * Claude Code 使用 settings.json 中的 skills 数组来加载 skills
10
- * - 全局: ~/.claude/settings.json
11
- * - 项目级: .claude/settings.local.json
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 settingsPath = isGlobal
17
- ? path.join(os.homedir(), '.claude', 'settings.json')
18
- : path.join(process.cwd(), '.claude', 'settings.local.json');
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
- // 初始化 skills 数组
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
- if (!settings.skills.includes(skill.path)) {
40
- settings.skills.push(skill.path);
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
  }
@@ -5,16 +5,16 @@ import os from 'os';
5
5
  /**
6
6
  * OpenAI Codex CLI 安装器
7
7
  *
8
- * Codex 使用:
9
- * - 全局: ~/.codex/instructions.md
10
- * - 项目级: codex.md 或 AGENTS.md
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', 'instructions.md')
17
- : path.join(process.cwd(), 'codex.md');
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cvte-skills-cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "CLI tool to install custom skills for AI coding assistants",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",