skills-manager 0.0.0 → 0.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 +151 -0
- package/dist/index.mjs +69 -5
- package/package.json +18 -21
- package/dist/index.d.mts +0 -4
package/README.md
CHANGED
|
@@ -1,5 +1,156 @@
|
|
|
1
1
|
# skills-manager
|
|
2
2
|
|
|
3
|
+
> 一个简单的 CLI 工具,用于管理 Alma 生态系统的技能包
|
|
4
|
+
|
|
3
5
|

|
|
4
6
|

|
|
5
7
|
|
|
8
|
+
## 特性
|
|
9
|
+
|
|
10
|
+
- ⚡️ **快速安装** - 使用 degit 从 GitHub 仓库快速克隆
|
|
11
|
+
- 🎯 **简单易用** - 清晰的 CLI 命令和友好的用户反馈
|
|
12
|
+
- 📦 **本地管理** - 技能包安装在当前项目目录
|
|
13
|
+
- 🔄 **依赖轻量** - 基于 degit,无需 git 配置
|
|
14
|
+
|
|
15
|
+
## 安装
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g skills-manager
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
或使用 pnpm:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add -g skills-manager
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 使用
|
|
28
|
+
|
|
29
|
+
### 查看可用技能
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
skills available
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 安装技能
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
skills add <skill-name>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
例如:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
skills add vue
|
|
45
|
+
skills add vite
|
|
46
|
+
skills add nuxt
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 列出已安装的技能
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
skills list
|
|
53
|
+
# 或
|
|
54
|
+
skills ls
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 删除技能
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
skills remove <skill-name>
|
|
61
|
+
# 或
|
|
62
|
+
skills rm <skill-name>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 查看帮助
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
skills --help
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 查看版本
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
skills --version
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 可用技能
|
|
78
|
+
|
|
79
|
+
以下是当前支持的技能包:
|
|
80
|
+
|
|
81
|
+
| 技能名称 | 描述 |
|
|
82
|
+
|---------|------|
|
|
83
|
+
| `antfu` | Anthony Fu 的个人技能集 |
|
|
84
|
+
| `nuxt` | Nuxt.js 框架技能 |
|
|
85
|
+
| `pnpm` | pnpm 包管理器技能 |
|
|
86
|
+
| `slidev` | Slidev 演示文稿工具 |
|
|
87
|
+
| `tsdown` | Tsdown 构建工具 |
|
|
88
|
+
| `unocss` | UnoCSS 引擎技能 |
|
|
89
|
+
| `vite` | Vite 构建工具 |
|
|
90
|
+
| `vitest` | Vitest 测试框架 |
|
|
91
|
+
| `vue-best-practices` | Vue 最佳实践 |
|
|
92
|
+
| `vue-router-best-practices` | Vue Router 最佳实践 |
|
|
93
|
+
| `vue-testing-best-practices` | Vue 测试最佳实践 |
|
|
94
|
+
| `vue` | Vue.js 框架技能 |
|
|
95
|
+
| `vueuse-functions` | VueUse 函数集合 |
|
|
96
|
+
| `web-design-guidelines` | Web 设计指南 |
|
|
97
|
+
| `mcp-builder` | MCP 构建器 |
|
|
98
|
+
| `skill-creator` | 技能创建器 |
|
|
99
|
+
| `cloudflare` | Cloudflare 平台技能 |
|
|
100
|
+
| `wrangler` | Wrangler CLI 工具 |
|
|
101
|
+
| `agent-browser` | Agent 浏览器技能 |
|
|
102
|
+
| `javascript-testing-patterns` | JavaScript 测试模式 |
|
|
103
|
+
| `modern-javascript-patterns` | 现代 JavaScript 模式 |
|
|
104
|
+
| `typescript-advanced-types` | TypeScript 高级类型 |
|
|
105
|
+
|
|
106
|
+
## 技能存储位置
|
|
107
|
+
|
|
108
|
+
技能包默认安装到当前工作目录的 `.alma/skills/` 目录下。
|
|
109
|
+
|
|
110
|
+
## 工作原理
|
|
111
|
+
|
|
112
|
+
1. **技能验证** - 从内置的技能注册表中验证技能名称
|
|
113
|
+
2. **使用 degit 克隆** - 使用 degit 从 GitHub 快速克隆技能包
|
|
114
|
+
3. **本地安装** - 将文件保存到 `./.alma/skills/` 目录
|
|
115
|
+
|
|
116
|
+
## 架构
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
src/
|
|
120
|
+
├── index.ts # CLI 入口点
|
|
121
|
+
├── manager.ts # 技能管理器(基于 degit)
|
|
122
|
+
└── skills.ts # 技能注册表
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 开发
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# 克隆项目
|
|
129
|
+
git clone https://github.com/jiakun-zhao/skills-manager.git
|
|
130
|
+
cd skills-manager
|
|
131
|
+
|
|
132
|
+
# 安装依赖
|
|
133
|
+
pnpm install
|
|
134
|
+
|
|
135
|
+
# 开发模式
|
|
136
|
+
pnpm dev
|
|
137
|
+
|
|
138
|
+
# 构建
|
|
139
|
+
pnpm build
|
|
140
|
+
|
|
141
|
+
# 发布
|
|
142
|
+
pnpm release
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## 依赖
|
|
146
|
+
|
|
147
|
+
- **[degit](https://github.com/Rich-Harris/degit)** - 用于从 GitHub 克隆仓库
|
|
148
|
+
- **[cac](https://github.com/cacjs/cac)** - CLI 命令行框架
|
|
149
|
+
|
|
150
|
+
## 许可证
|
|
151
|
+
|
|
152
|
+
[MIT](LICENSE)
|
|
153
|
+
|
|
154
|
+
## 作者
|
|
155
|
+
|
|
156
|
+
Jiakun Zhao
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { cac } from "cac";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { mkdir, readdir, writeFile } from "node:fs/promises";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { rimraf } from "rimraf";
|
|
7
|
+
import { joinURL } from "ufo";
|
|
8
|
+
|
|
9
|
+
//#region src/manager.ts
|
|
10
|
+
const print = console.log;
|
|
11
|
+
const CLAUDE_SKILLS_DIR = join(homedir(), ".claude", "skills");
|
|
12
|
+
async function list() {
|
|
13
|
+
print(chalk.gray("→"), chalk.gray(CLAUDE_SKILLS_DIR));
|
|
14
|
+
print();
|
|
15
|
+
(await readdir(CLAUDE_SKILLS_DIR, { withFileTypes: true })).forEach((it) => it.isDirectory() && print(chalk.gray("•"), it.name));
|
|
16
|
+
print();
|
|
17
|
+
}
|
|
18
|
+
async function remove(name) {
|
|
19
|
+
await rimraf(join(CLAUDE_SKILLS_DIR, name));
|
|
20
|
+
await list();
|
|
21
|
+
print(chalk.red("-", name));
|
|
22
|
+
print();
|
|
23
|
+
}
|
|
24
|
+
async function add(key, options) {
|
|
25
|
+
const { owner, repo, name, dir } = format(key);
|
|
26
|
+
const files = (await fetchUnGH(owner, repo, options.branch)).filter((file) => file.path.startsWith(dir)).map((file) => ({
|
|
27
|
+
remote: joinURL("https://cdn.jsdelivr.net/gh", owner, repo, file.path),
|
|
28
|
+
local: join(CLAUDE_SKILLS_DIR, name, file.path.slice(dir.length))
|
|
29
|
+
}));
|
|
30
|
+
await rimraf(join(CLAUDE_SKILLS_DIR, name));
|
|
31
|
+
await Promise.all(files.map(async (file) => {
|
|
32
|
+
await fetch(file.remote).then(async (res) => {
|
|
33
|
+
const data = await res.text();
|
|
34
|
+
await mkdir(dirname(file.local), { recursive: true });
|
|
35
|
+
await writeFile(file.local, data);
|
|
36
|
+
});
|
|
37
|
+
}));
|
|
38
|
+
await list();
|
|
39
|
+
print(chalk.green("+", name));
|
|
40
|
+
print();
|
|
41
|
+
}
|
|
42
|
+
function format(key) {
|
|
43
|
+
const [owner, repo, ...rest] = key.split("/");
|
|
44
|
+
return {
|
|
45
|
+
owner,
|
|
46
|
+
repo,
|
|
47
|
+
name: rest.at(-1),
|
|
48
|
+
dir: rest.join("/")
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
async function fetchUnGH(owner, repo, branch) {
|
|
52
|
+
const url = joinURL("https://api.zhaojiakun.com", "ungh", "repos", owner, repo, "files", branch);
|
|
53
|
+
return (await fetch(url).then((res) => res.json())).files;
|
|
4
54
|
}
|
|
5
|
-
console.log("Hello~");
|
|
6
55
|
|
|
7
56
|
//#endregion
|
|
8
|
-
|
|
57
|
+
//#region package.json
|
|
58
|
+
var name = "skills-manager";
|
|
59
|
+
var version = "0.0.3";
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/index.ts
|
|
63
|
+
const cli = cac(name);
|
|
64
|
+
cli.command("add <key>", "Add skill").option("-b, --branch", "Repo branch", { default: "main" }).action(add);
|
|
65
|
+
cli.command("list", "List skills").alias("ls").action(list);
|
|
66
|
+
cli.command("remove <name>", "Remove skill").alias("rm").action(remove);
|
|
67
|
+
cli.version(version);
|
|
68
|
+
cli.help();
|
|
69
|
+
cli.parse();
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,44 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skills-manager",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.0.0",
|
|
3
|
+
"version": "0.0.3",
|
|
5
4
|
"description": "",
|
|
6
|
-
"author": "Jiakun Zhao <hi@zhaojiakun.com>",
|
|
7
|
-
"license": "MIT",
|
|
8
5
|
"homepage": "https://github.com/jiakun-zhao/skills-manager#readme",
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/jiakun-zhao/skills-manager.git"
|
|
12
|
-
},
|
|
13
6
|
"bugs": {
|
|
14
7
|
"url": "https://github.com/jiakun-zhao/skills-manager/issues"
|
|
15
8
|
},
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "Jiakun Zhao <hi@zhaojiakun.com>",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/jiakun-zhao/skills-manager.git"
|
|
21
14
|
},
|
|
22
|
-
"
|
|
23
|
-
"module": "./dist/index.mjs",
|
|
24
|
-
"types": "./dist/index.d.mts",
|
|
15
|
+
"bin": "./dist/index.mjs",
|
|
25
16
|
"files": [
|
|
26
17
|
"dist"
|
|
27
18
|
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"cac": "^6.7.14",
|
|
22
|
+
"chalk": "^5.6.2",
|
|
23
|
+
"rimraf": "^6.1.2",
|
|
24
|
+
"ufo": "^1.6.3"
|
|
25
|
+
},
|
|
28
26
|
"devDependencies": {
|
|
29
|
-
"@jiakun-zhao/eslint-config": "^4.
|
|
27
|
+
"@jiakun-zhao/eslint-config": "^4.3.0",
|
|
28
|
+
"@types/degit": "^2.8.6",
|
|
30
29
|
"@types/node": "^25.2.0",
|
|
31
30
|
"bumpp": "^10.4.0",
|
|
32
31
|
"eslint": "^9.39.2",
|
|
33
32
|
"tsdown": "^0.20.1",
|
|
34
33
|
"tsx": "^4.21.0",
|
|
35
|
-
"typescript": "^5.9.3"
|
|
36
|
-
"vitest": "^4.0.18"
|
|
34
|
+
"typescript": "^5.9.3"
|
|
37
35
|
},
|
|
38
36
|
"scripts": {
|
|
39
37
|
"build": "tsdown",
|
|
40
38
|
"dev": "tsx src/index.ts",
|
|
41
|
-
"release": "bumpp && pnpm publish && pnpm dlx cnpm sync skills-manager"
|
|
42
|
-
"test": "vitest"
|
|
39
|
+
"release": "bumpp && pnpm publish && pnpm dlx cnpm sync skills-manager"
|
|
43
40
|
}
|
|
44
41
|
}
|
package/dist/index.d.mts
DELETED