@workskills/getskill 1.1.10 → 2.0.0

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
@@ -4,23 +4,15 @@ OpenClaw 技能管理工具 - 从 getskill.work 搜索、下载和更新技能
4
4
 
5
5
  ## 功能特性
6
6
 
7
- - 🔍 从 getskill.work API 搜索技能
7
+ - 🔍 从 `getskill.work` 静态技能索引(`data/skills.json`)搜索技能
8
8
  - 🧾 支持 JSON 格式搜索输出(`search --json`)
9
- - 📥 通过 Git 克隆技能仓库
10
- - 🏷️ 支持安装/更新指定版本(`--version <tag>`)
11
- - 🔄 通过 Git pull 更新已安装的技能
12
- - 🚀 支持将本地技能目录发布到 Git 远程仓库(`publish`)
13
- - 🛠️ 自动检测并引导安装 Git(如未安装)
9
+ - 📥 通过 HTTP 直接下载技能 ZIP 包,本地解压安装(**无需安装 Git**)
10
+ - 🏷️ 支持安装/更新指定版本(`--version <version>`)
11
+ - 🔄 基于版本号比较的增量更新(`update` / `update --all`)
14
12
  - 📂 跨平台支持(Windows/macOS/Linux)
15
13
  - 💾 自动管理技能文件到 OpenClaw skills 目录
16
- - ⚙️ 支持自定义 API 地址
17
-
18
- ## 工作原理
19
-
20
- 1. **搜索**: 从 `getskill.work` API 获取技能列表,包含 Git 仓库地址
21
- 2. **安装**: 使用 `git clone` 克隆技能仓库到缓存目录
22
- 3. **复制**: 将仓库目录(排除 `.git`)复制到 OpenClaw skills 目录
23
- 4. **更新**: 使用 `git pull` 更新仓库,并重新复制技能目录
14
+ - ⚙️ 支持自定义索引地址
15
+ - 📦 零第三方运行时依赖(内置 ZIP 解析/解压实现)
24
16
 
25
17
  ## 目录结构
26
18
 
@@ -29,7 +21,7 @@ OpenClaw 技能管理工具 - 从 getskill.work 搜索、下载和更新技能
29
21
  ├── skills/ # OpenClaw 技能目录
30
22
  │ ├── skill1/
31
23
  │ └── skill2/
32
- └── skills-cache/ # Git 仓库缓存
24
+ └── skills-cache/ # ZIP 下载与解压缓存
33
25
  ├── skill1/
34
26
  └── skill2/
35
27
  ```
@@ -75,7 +67,7 @@ npm link
75
67
 
76
68
  ### 搜索技能
77
69
 
78
- > `search` / `install` / `update` / `list` / `inspect` / `clean` **默认都不需要登录**。只有 `publish` 才需要登录。
70
+ > 所有命令**全部无需登录、无需 Git**,直接通过 HTTPS 下载 ZIP 包并本地解压。
79
71
 
80
72
  ```bash
81
73
  getskill search <关键词>
@@ -90,15 +82,17 @@ getskill search <关键词> --json
90
82
  示例输出:
91
83
 
92
84
  ```
93
- 找到 3 个技能:
85
+ 找到 2 个技能:
94
86
 
95
- 1. commit-helper
96
- 描述: 帮助生成规范的 git commit 信息
97
- Git: https://getskill.work/skills/commit-helper.git
87
+ 1. pdf-extract (v1.0.0)
88
+ 描述: 从 PDF 文件中提取文本和表格
89
+ 分类: 文档处理
90
+ 下载: https://getskill.work/skills/pdf-extract.zip
98
91
 
99
- 2. code-review
100
- 描述: AI 代码审查助手
101
- Git: https://getskill.work/skills/code-review.git
92
+ 2. xlsx (v1.0.0)
93
+ 描述: 电子表格文件的创建、编辑与分析
94
+ 分类: 文档处理
95
+ 下载: https://getskill.work/skills/xlsx.zip
102
96
  ```
103
97
 
104
98
  ### 安装技能
@@ -110,19 +104,20 @@ getskill install <技能名称>
110
104
  安装指定版本:
111
105
 
112
106
  ```bash
113
- getskill install <技能名称> --version <tag>
107
+ getskill install <技能名称> --version <version>
114
108
  ```
115
109
 
116
110
  示例:
117
111
 
118
112
  ```bash
119
- getskill install commit-helper
113
+ getskill install pdf-extract
120
114
  ```
121
115
 
122
116
  操作流程:
123
117
 
124
- 1. 执行 `git clone` 到 `~/.openclaw/skills-cache/commit-helper`
125
- 2. 将整个技能目录复制到 `~/.openclaw/skills/commit-helper`
118
+ 1. 在静态索引中定位技能条目,获取 `download_url`
119
+ 2. 下载 ZIP 包到 `~/.openclaw/skills-cache/<技能名称>` 并解压
120
+ 3. 将技能目录复制到 `~/.openclaw/skills/<技能名称>`,记录已安装版本
126
121
 
127
122
  ### 更新技能
128
123
 
@@ -130,12 +125,6 @@ getskill install commit-helper
130
125
  getskill update <技能名称>
131
126
  ```
132
127
 
133
- 示例:
134
-
135
- ```bash
136
- getskill update commit-helper
137
- ```
138
-
139
128
  批量更新所有已安装技能:
140
129
 
141
130
  ```bash
@@ -145,14 +134,14 @@ getskill update --all
145
134
  切换到指定版本:
146
135
 
147
136
  ```bash
148
- getskill update <技能名称> --version <tag>
137
+ getskill update <技能名称> --version <version>
149
138
  ```
150
139
 
151
- 操作流程:
140
+ 更新逻辑:
152
141
 
153
- 1. 进入缓存目录 `~/.openclaw/skills-cache/commit-helper`
154
- 2. 执行 `git pull`
155
- 3. 重新复制最新的技能目录
142
+ 1. 读取本地已安装技能的版本记录
143
+ 2. 拉取远端索引中的最新版本号
144
+ 3. 版本一致时提示"已是最新版本";不一致时重新下载 ZIP 并覆盖安装
156
145
 
157
146
  ### 卸载技能
158
147
 
@@ -163,7 +152,7 @@ getskill uninstall <技能名称>
163
152
  仅卸载本地技能目录、保留缓存:
164
153
 
165
154
  ```bash
166
- getskill uninstall commit-helper --keep-cache
155
+ getskill uninstall <技能名称> --keep-cache
167
156
  ```
168
157
 
169
158
  ### 查看安装状态
@@ -172,37 +161,6 @@ getskill uninstall commit-helper --keep-cache
172
161
  getskill inspect <技能名称>
173
162
  ```
174
163
 
175
- ### 发布技能目录
176
-
177
- ```bash
178
- getskill publish <目录>
179
- ```
180
-
181
- 默认行为:
182
-
183
- 1. 检查目录中是否存在 `SKILL.md`
184
- 2. 严格校验 `SKILL.md` 是否包含合法 front matter 和必要章节
185
- 3. 如果本地未登录,则自动提示输入用户名/邮箱/密码,尝试**注册并登录**
186
- 4. 自动在 `getskill.work` 创建同名仓库(若不存在)
187
- 5. 提交并推送到远程仓库
188
-
189
- 也可以显式指定仓库:
190
-
191
- ```bash
192
- getskill publish <目录> --repo <git-url>
193
- getskill publish <目录> --name <repo-name>
194
- ```
195
-
196
- 可选参数:
197
-
198
- - `--branch <name>`: 发布分支(默认 `main`)
199
- - `--message <text>`: 自定义提交信息
200
- - `--name <repo-name>`: 指定自动创建的仓库名称
201
- - `--username <name>` / `--email <mail>` / `--password <pwd>`: 非交互发布时提供注册/登录信息
202
- - `--private`: 创建私有仓库
203
-
204
- > 如果 `SKILL.md` 缺失,或不符合规范(缺少 front matter、`metadata`、`## 指令` 等关键结构),发布会被直接阻止。
205
-
206
164
  ### 列出本地技能
207
165
 
208
166
  ```bash
@@ -223,70 +181,84 @@ getskill path
223
181
  getskill clean
224
182
  ```
225
183
 
226
- 清理所有 Git 仓库缓存(不影响 skills 目录中的文件)
184
+ 清理 ZIP 下载与解压缓存(不影响 skills 目录中的文件)
227
185
 
228
- ### 配置 API 地址
186
+ ### 配置索引地址
229
187
 
230
- 查看当前 API 地址:
188
+ 查看当前索引地址:
231
189
 
232
190
  ```bash
233
191
  getskill config get
234
192
  ```
235
193
 
236
- 设置自定义 API 地址:
194
+ 设置自定义索引地址:
237
195
 
238
196
  ```bash
239
- getskill config set https://your-custom-api.com
197
+ getskill config set https://your-custom-index.com
240
198
  ```
241
199
 
242
200
  通过环境变量设置:
243
201
 
244
202
  ```bash
245
- GETSKILL_BASE_URL=https://your-custom-api.com getskill search keyword
203
+ GETSKILL_BASE_URL=https://your-custom-index.com getskill search keyword
246
204
  ```
247
205
 
248
- ## API 接口规范
206
+ ## 索引数据规范
249
207
 
250
- ### 搜索 API
208
+ ### 索引文件
251
209
 
252
210
  ```
253
- GET https://getskill.work/api/v1/repos/search?sort=updated&order=desc&q=<关键词>&page=1&limit=20
211
+ GET https://getskill.work/data/skills.json
254
212
  ```
255
213
 
256
214
  响应格式:
257
215
 
258
216
  ```json
259
217
  {
260
- "ok": true,
261
- "data": [
218
+ "updated": "2026-11-20",
219
+ "skills": [
262
220
  {
263
- "id": 1,
264
- "full_name": "skills/commit-helper",
265
- "description": "帮助生成规范的 git commit 信息",
266
- "html_url": "https://getskill.work/skills/commit-helper",
267
- "clone_url": "https://getskill.work/skills/commit-helper.git"
221
+ "id": "pdf-extract",
222
+ "name": "pdf-extract",
223
+ "description": "从 PDF 文件中提取文本和表格",
224
+ "category": "文档处理",
225
+ "tags": ["pdf", "提取"],
226
+ "version": "1.0.0",
227
+ "author": "Anthropic",
228
+ "updated": "2026-11-20",
229
+ "file": "skills/pdf-extract.zip",
230
+ "size": 173410,
231
+ "source": "https://github.com/anthropics/skills"
268
232
  }
269
233
  ]
270
234
  }
271
235
  ```
272
236
 
237
+ ### 技能 ZIP 包
238
+
239
+ ```
240
+ GET https://getskill.work/skills/<id>.zip
241
+ ```
242
+
243
+ ZIP 包根目录(或唯一包装目录)下应包含 `SKILL.md` 及配套文件。
244
+
273
245
  ## 编程接口
274
246
 
275
247
  ```javascript
276
248
  const getskill = require('@workskills/getskill');
277
249
 
278
- // 设置自定义 API 地址(可选)
279
- getskill.setBaseUrl('https://your-custom-api.com');
250
+ // 设置自定义索引地址(可选)
251
+ getskill.setBaseUrl('https://your-custom-index.com');
280
252
 
281
- // 搜索技能
282
- const results = await getskill.searchSkills('commit');
253
+ // 搜索技能(基于静态索引)
254
+ const results = await getskill.searchSkills('pdf');
283
255
 
284
- // 安装技能
285
- const result = await getskill.downloadSkill('skills/commit-helper');
256
+ // 安装技能(下载 ZIP + 解压 + 复制)
257
+ const result = await getskill.downloadSkill('pdf-extract');
286
258
  console.log(result.files); // 已复制的技能目录列表
287
259
 
288
- // 更新技能
289
- await getskill.updateSkill('commit-helper');
260
+ // 更新技能(版本比较)
261
+ await getskill.updateSkill('pdf-extract');
290
262
 
291
263
  // 列出本地技能
292
264
  const skills = getskill.listLocalSkills();
@@ -295,32 +267,32 @@ const skills = getskill.listLocalSkills();
295
267
  const skillsDir = getskill.getSkillsDirectory();
296
268
  const cacheDir = getskill.getSkillsCacheDirectory();
297
269
 
298
- // 获取当前 API 地址
270
+ // 获取当前索引地址
299
271
  const baseUrl = getskill.getBaseUrl();
300
272
  ```
301
273
 
302
- ## 技能仓库规范
274
+ ## 技能包规范
303
275
 
304
- 技能 Git 仓库应包含:
276
+ 技能 ZIP 包应包含:
305
277
 
306
- - 一个或多个 `.md` 技能文件(非 README)
278
+ - `SKILL.md` 技能定义文件(含 front matter 与指令内容)
307
279
  - 可选的 `README.md` 说明文档
308
- - 可选的示例代码或配置文件
280
+ - 可选的示例代码、脚本或配置文件
309
281
 
310
282
  示例结构:
311
283
 
312
284
  ```
313
- commit-helper/
314
- ├── commit-helper.md # 技能文件(仓库目录会被整体复制)
315
- ├── README.md # 说明文档(会随目录复制)
316
- └── examples/ # 示例(会随目录复制)
285
+ pdf-extract/
286
+ ├── SKILL.md # 技能定义文件(必需)
287
+ ├── README.md # 说明文档(可选,会随目录复制)
288
+ ├── scripts/ # 脚本(可选,会随目录复制)
289
+ └── examples/ # 示例(可选,会随目录复制)
317
290
  ```
318
291
 
319
292
  ## 依赖
320
293
 
321
294
  - Node.js >= 12(运行 CLI)
322
295
  - Node.js 18+(开发与测试工具)
323
- - Git 命令行工具(如未安装,程序会自动引导安装)
324
296
 
325
297
  ## 开发与质量保障
326
298
 
@@ -340,32 +312,10 @@ npm run coverage
340
312
  - [`CONTRIBUTING.md`](CONTRIBUTING.md)
341
313
  - [`docs/architecture.md`](docs/architecture.md)
342
314
 
343
- ## Git 自动检测与安装
344
-
345
- 首次运行 `install` 或 `update` 命令时,程序会自动检测系统是否已安装 Git:
346
-
347
- ### Windows
348
-
349
- - **自动下载**: 自动下载 Git 安装程序并启动安装向导
350
- - **手动安装**: 如果自动下载失败,会提示访问 https://git-scm.com/download/win
351
-
352
- ### macOS
353
-
354
- - 提示使用 Homebrew 安装:`brew install git`
355
- - 如未安装 Homebrew,会提示访问 https://brew.sh/
356
-
357
- ### Linux
358
-
359
- - 提示使用系统包管理器安装:
360
- - Ubuntu/Debian: `sudo apt-get install git`
361
- - CentOS/RHEL: `sudo yum install git`
362
- - Fedora: `sudo dnf install git`
363
- - Arch: `sudo pacman -S git`
364
-
365
315
  ## 许可证
366
316
 
367
317
  MIT
368
318
 
369
319
  ## 作者
370
320
 
371
- workskills.store
321
+ getskill.work
@@ -7,4 +7,3 @@ export declare function getSkillsDirectory(): string;
7
7
  export declare function getSkillsCacheDirectory(): string;
8
8
  export declare function getGetSkillConfigDirectory(): string;
9
9
  export declare function getStateFilePath(): string;
10
- export declare function getAuthFilePath(): string;
@@ -11,7 +11,6 @@ exports.getSkillsDirectory = getSkillsDirectory;
11
11
  exports.getSkillsCacheDirectory = getSkillsCacheDirectory;
12
12
  exports.getGetSkillConfigDirectory = getGetSkillConfigDirectory;
13
13
  exports.getStateFilePath = getStateFilePath;
14
- exports.getAuthFilePath = getAuthFilePath;
15
14
  const os_1 = __importDefault(require("os"));
16
15
  const path_1 = __importDefault(require("path"));
17
16
  let baseUrl = process.env.GETSKILL_BASE_URL || 'https://getskill.work';
@@ -42,6 +41,3 @@ function getGetSkillConfigDirectory() {
42
41
  function getStateFilePath() {
43
42
  return path_1.default.join(getGetSkillConfigDirectory(), 'state.json');
44
43
  }
45
- function getAuthFilePath() {
46
- return path_1.default.join(getGetSkillConfigDirectory(), 'auth.json');
47
- }
@@ -1,5 +1,12 @@
1
- import type { RequestOptions, RequestResponse, SearchApiPayload, SearchOptions, SearchSkill } from './types';
1
+ import type { RequestOptions, RequestResponse, SearchOptions, SearchSkill, SkillIndexEntry } from './types';
2
2
  export declare function request(url: string, options?: RequestOptions, redirectCount?: number): Promise<RequestResponse>;
3
- export declare function repositoryHasSkillFile(repoFullName: string): Promise<boolean>;
4
- export declare function transformSearchResults(result: SearchApiPayload, hasSkillFile?: (repoFullName: string) => Promise<boolean>): Promise<SearchSkill[]>;
3
+ export declare function downloadFile(url: string, destPath: string, redirectCount?: number): Promise<number>;
4
+ export declare function getSkillsIndexUrl(): string;
5
+ export declare function getSkillPackageUrl(entry: SkillIndexEntry): string;
6
+ export declare function fetchSkillsIndex(): Promise<SkillIndexEntry[]>;
7
+ export declare function normalizeSkillIndexKey(skillName: string): string;
8
+ export declare function filterIndexByKeyword(entries: SkillIndexEntry[], keyword: string, limit?: number, page?: number): SkillIndexEntry[];
9
+ export declare function mapIndexEntryToSearchSkill(entry: SkillIndexEntry): SearchSkill;
10
+ export declare function findSkillIndexEntry(skillName: string): Promise<SkillIndexEntry | null>;
11
+ export declare function repositoryHasSkillFile(skillName: string): Promise<boolean>;
5
12
  export declare function searchSkills(keyword: string, options?: SearchOptions): Promise<SearchSkill[]>;