sc-skill 1.0.1 → 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 +12 -12
- package/dist/cli.js +4 -4
- package/dist/config.js +2 -2
- package/dist/manager.js +7 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# sc
|
|
2
2
|
|
|
3
|
-
团队技能同步工具 -
|
|
3
|
+
团队技能同步工具 - 使用复制方式管理 Claude Code 技能
|
|
4
4
|
|
|
5
5
|
## 功能特性
|
|
6
6
|
|
|
7
7
|
- 🔄 从团队仓库同步技能到本地缓存
|
|
8
8
|
- 🎯 交互式勾选启用/禁用技能
|
|
9
|
-
-
|
|
9
|
+
- 📋 通过复制方式启用/禁用技能
|
|
10
10
|
- 📦 支持多平台 (Windows/macOS/Linux)
|
|
11
11
|
|
|
12
12
|
## 安装
|
|
@@ -22,36 +22,36 @@ npm link
|
|
|
22
22
|
### 1. 同步技能到缓存
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
|
|
25
|
+
sc sync
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
从团队仓库 `https://codeup.aliyun.com/sczlcq/skills.git` 拉取最新技能到 `~/.
|
|
28
|
+
从团队仓库 `https://codeup.aliyun.com/sczlcq/skills.git` 拉取最新技能到 `~/.sc/cache`
|
|
29
29
|
|
|
30
30
|
### 2. 交互式管理技能
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
|
|
33
|
+
sc toggle
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
使用空格键勾选/取消勾选技能,回车确认。选中的技能会直接复制到 `~/.claude/skills`
|
|
37
37
|
|
|
38
38
|
### 3. 查看技能状态
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
|
|
41
|
+
sc list
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
显示所有缓存的技能及其启用状态
|
|
45
45
|
|
|
46
46
|
## 工作原理
|
|
47
47
|
|
|
48
|
-
1. **缓存区**: 技能存储在 `~/.
|
|
49
|
-
2.
|
|
50
|
-
3. **目标目录**: `~/.claude/skills`
|
|
48
|
+
1. **缓存区**: 技能存储在 `~/.sc/cache`,通过 git 管理
|
|
49
|
+
2. **复制启用**: 启用的技能会从缓存区复制到目标目录
|
|
50
|
+
3. **目标目录**: `~/.claude/skills` 保存启用后的实际技能文件
|
|
51
51
|
|
|
52
52
|
## 配置
|
|
53
53
|
|
|
54
|
-
配置文件位置: `~/.
|
|
54
|
+
配置文件位置: `~/.sc/config.json`
|
|
55
55
|
|
|
56
56
|
```json
|
|
57
57
|
{
|
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import { DEFAULT_CONFIG, getConfigPath } from './config.js';
|
|
|
7
7
|
import fs from 'fs-extra';
|
|
8
8
|
const program = new Command();
|
|
9
9
|
program
|
|
10
|
-
.name('
|
|
10
|
+
.name('sc')
|
|
11
11
|
.description('团队技能同步工具')
|
|
12
12
|
.version('1.0.0');
|
|
13
13
|
program
|
|
@@ -22,7 +22,7 @@ program
|
|
|
22
22
|
console.log('✓ 已拉取最新技能到缓存');
|
|
23
23
|
await saveLastSync();
|
|
24
24
|
console.log('✅ 同步完成');
|
|
25
|
-
console.log('\n💡 运行
|
|
25
|
+
console.log('\n💡 运行 sc toggle 来启用/禁用技能');
|
|
26
26
|
}
|
|
27
27
|
catch (error) {
|
|
28
28
|
console.error('❌ 同步失败:', error);
|
|
@@ -38,7 +38,7 @@ program
|
|
|
38
38
|
const available = await manager.getAvailableSkills();
|
|
39
39
|
const enabled = await manager.getEnabledSkills();
|
|
40
40
|
if (available.length === 0) {
|
|
41
|
-
console.log('❌ 缓存中没有技能,请先运行
|
|
41
|
+
console.log('❌ 缓存中没有技能,请先运行 sc sync');
|
|
42
42
|
process.exit(1);
|
|
43
43
|
}
|
|
44
44
|
const answers = await inquirer.prompt([
|
|
@@ -80,7 +80,7 @@ program
|
|
|
80
80
|
const available = await manager.getAvailableSkills();
|
|
81
81
|
const enabled = await manager.getEnabledSkills();
|
|
82
82
|
if (available.length === 0) {
|
|
83
|
-
console.log('缓存中没有技能,请先运行
|
|
83
|
+
console.log('缓存中没有技能,请先运行 sc sync');
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
console.log(`\n📦 缓存中的技能 (${available.length}):`);
|
package/dist/config.js
CHANGED
|
@@ -7,11 +7,11 @@ export const getSkillsDir = () => {
|
|
|
7
7
|
};
|
|
8
8
|
export const getCacheDir = () => {
|
|
9
9
|
const home = os.homedir();
|
|
10
|
-
return path.join(home, '.
|
|
10
|
+
return path.join(home, '.sc', 'cache');
|
|
11
11
|
};
|
|
12
12
|
export const getConfigPath = () => {
|
|
13
13
|
const home = os.homedir();
|
|
14
|
-
return path.join(home, '.
|
|
14
|
+
return path.join(home, '.sc', 'config.json');
|
|
15
15
|
};
|
|
16
16
|
export const DEFAULT_CONFIG = {
|
|
17
17
|
repo: DEFAULT_REPO,
|
package/dist/manager.js
CHANGED
|
@@ -52,10 +52,16 @@ export class SkillManager {
|
|
|
52
52
|
for (const skill of skillNames) {
|
|
53
53
|
const sourcePath = path.join(this.cacheDir, skill);
|
|
54
54
|
const targetPath = path.join(this.targetDir, skill);
|
|
55
|
+
if (!(await fs.pathExists(sourcePath))) {
|
|
56
|
+
throw new Error(`技能不存在: ${skill}`);
|
|
57
|
+
}
|
|
55
58
|
if (await fs.pathExists(targetPath)) {
|
|
56
59
|
await fs.remove(targetPath);
|
|
57
60
|
}
|
|
58
|
-
await fs.
|
|
61
|
+
await fs.copy(sourcePath, targetPath, {
|
|
62
|
+
overwrite: true,
|
|
63
|
+
errorOnExist: false,
|
|
64
|
+
});
|
|
59
65
|
}
|
|
60
66
|
}
|
|
61
67
|
async disableSkills(skillNames) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sc-skill",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "团队技能同步工具",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cli.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
31
|
-
"url": "https://github.com/yourusername/
|
|
31
|
+
"url": "https://github.com/yourusername/sc.git"
|
|
32
32
|
},
|
|
33
33
|
"packageManager": "pnpm@10.30.2",
|
|
34
34
|
"dependencies": {
|