@workskills/getskill 2.0.0 → 2.1.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/dist/main.js CHANGED
@@ -4,17 +4,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.getBaseUrl = exports.setBaseUrl = exports.repositoryHasSkillFile = exports.copySkillFiles = exports.cloneOrUpdateRepo = exports.getSkillsCacheDirectory = exports.getSkillsDirectory = exports.getInstalledSkillInfo = exports.listLocalSkills = exports.uninstallSkill = exports.updateAllSkills = exports.updateSkill = exports.downloadSkill = exports.searchSkills = void 0;
7
+ exports.repositoryHasSkillFile = exports.copySkillFiles = exports.cloneOrUpdateRepo = exports.getBaseUrl = exports.setCacheDir = exports.setSkillsDir = exports.setAgent = exports.setBaseUrl = exports.unsetConfigValue = exports.setConfigValue = exports.getAgentLabel = exports.getAgentName = exports.listAgents = exports.getStateFilePath = exports.getConfigFilePath = exports.getConfigSummary = exports.getSkillsCacheDirectory = exports.getSkillsDirectory = exports.restartAgentGateway = exports.pruneInstallState = exports.getInstalledSkillInfo = exports.listLocalSkills = exports.uninstallSkill = exports.updateAllSkills = exports.updateSkill = exports.downloadSkill = exports.searchSkills = void 0;
8
8
  exports.printHelp = printHelp;
9
9
  exports.getCliVersion = getCliVersion;
10
+ exports.printConfigUsage = printConfigUsage;
11
+ exports.printConfigValues = printConfigValues;
12
+ exports.printAgents = printAgents;
13
+ exports.printPaths = printPaths;
14
+ exports.handleConfigCommand = handleConfigCommand;
10
15
  exports.cli = cli;
11
16
  const fs_1 = __importDefault(require("fs"));
12
17
  const path_1 = __importDefault(require("path"));
13
18
  const config_1 = require("./lib/config");
19
+ Object.defineProperty(exports, "getAgentLabel", { enumerable: true, get: function () { return config_1.getAgentLabel; } });
20
+ Object.defineProperty(exports, "getAgentName", { enumerable: true, get: function () { return config_1.getAgentName; } });
14
21
  Object.defineProperty(exports, "getBaseUrl", { enumerable: true, get: function () { return config_1.getBaseUrl; } });
22
+ Object.defineProperty(exports, "getConfigFilePath", { enumerable: true, get: function () { return config_1.getConfigFilePath; } });
23
+ Object.defineProperty(exports, "getConfigSummary", { enumerable: true, get: function () { return config_1.getConfigSummary; } });
15
24
  Object.defineProperty(exports, "getSkillsCacheDirectory", { enumerable: true, get: function () { return config_1.getSkillsCacheDirectory; } });
16
25
  Object.defineProperty(exports, "getSkillsDirectory", { enumerable: true, get: function () { return config_1.getSkillsDirectory; } });
26
+ Object.defineProperty(exports, "getStateFilePath", { enumerable: true, get: function () { return config_1.getStateFilePath; } });
27
+ Object.defineProperty(exports, "listAgents", { enumerable: true, get: function () { return config_1.listAgents; } });
28
+ Object.defineProperty(exports, "setAgent", { enumerable: true, get: function () { return config_1.setAgent; } });
17
29
  Object.defineProperty(exports, "setBaseUrl", { enumerable: true, get: function () { return config_1.setBaseUrl; } });
30
+ Object.defineProperty(exports, "setCacheDir", { enumerable: true, get: function () { return config_1.setCacheDir; } });
31
+ Object.defineProperty(exports, "setConfigValue", { enumerable: true, get: function () { return config_1.setConfigValue; } });
32
+ Object.defineProperty(exports, "setSkillsDir", { enumerable: true, get: function () { return config_1.setSkillsDir; } });
33
+ Object.defineProperty(exports, "unsetConfigValue", { enumerable: true, get: function () { return config_1.unsetConfigValue; } });
18
34
  const logger_1 = __importDefault(require("./lib/logger"));
19
35
  const network_1 = require("./lib/network");
20
36
  Object.defineProperty(exports, "repositoryHasSkillFile", { enumerable: true, get: function () { return network_1.repositoryHasSkillFile; } });
@@ -23,9 +39,11 @@ const state_1 = require("./lib/state");
23
39
  Object.defineProperty(exports, "copySkillFiles", { enumerable: true, get: function () { return state_1.copySkillFiles; } });
24
40
  Object.defineProperty(exports, "getInstalledSkillInfo", { enumerable: true, get: function () { return state_1.getInstalledSkillInfo; } });
25
41
  Object.defineProperty(exports, "listLocalSkills", { enumerable: true, get: function () { return state_1.listLocalSkills; } });
42
+ Object.defineProperty(exports, "pruneInstallState", { enumerable: true, get: function () { return state_1.pruneInstallState; } });
26
43
  const skill_manager_1 = require("./lib/skill-manager");
27
44
  Object.defineProperty(exports, "cloneOrUpdateRepo", { enumerable: true, get: function () { return skill_manager_1.cloneOrUpdateRepo; } });
28
45
  Object.defineProperty(exports, "downloadSkill", { enumerable: true, get: function () { return skill_manager_1.downloadSkill; } });
46
+ Object.defineProperty(exports, "restartAgentGateway", { enumerable: true, get: function () { return skill_manager_1.restartAgentGateway; } });
29
47
  Object.defineProperty(exports, "uninstallSkill", { enumerable: true, get: function () { return skill_manager_1.uninstallSkill; } });
30
48
  Object.defineProperty(exports, "updateAllSkills", { enumerable: true, get: function () { return skill_manager_1.updateAllSkills; } });
31
49
  Object.defineProperty(exports, "updateSkill", { enumerable: true, get: function () { return skill_manager_1.updateSkill; } });
@@ -71,7 +89,7 @@ function parseCommandOptions(rawArgs) {
71
89
  return { positionals, options };
72
90
  }
73
91
  function printHelp() {
74
- console.log('GetSkill - OpenClaw 技能管理工具 (getskill.work · Cloudflare 静态托管)');
92
+ console.log('GetSkill - AI Agent 技能管理工具 (getskill.work · Cloudflare 静态托管)');
75
93
  console.log('');
76
94
  console.log('用法:');
77
95
  console.log(' getskill --help - 显示帮助信息');
@@ -83,26 +101,42 @@ function printHelp() {
83
101
  console.log(' getskill update <技能名称> - 检查在线版本并更新技能');
84
102
  console.log(' getskill update <技能名称> --version <tag> - 更新到指定版本');
85
103
  console.log(' getskill update --all - 批量更新所有已安装技能');
104
+ console.log(' getskill update --all --prune - 批量更新并清理索引中已下架技能的本地记录');
86
105
  console.log(' getskill uninstall <技能名称> - 卸载本地技能');
87
106
  console.log(' getskill inspect <技能名称> - 查看本地安装与缓存状态');
88
107
  console.log(' getskill list - 列出本地技能');
89
- console.log(' getskill path - 显示目录路径');
90
- console.log(' getskill config set <URL> - 设置自定义站点地址');
91
- console.log(' getskill config get - 查看当前站点地址');
108
+ console.log(' getskill path - 显示 Agent 与目录/配置文件路径');
109
+ console.log(' getskill agents - 列出支持的 Agent 及当前生效项');
110
+ console.log(' getskill config get [key] - 查看配置 (base-url / agent / skills-dir / cache-dir)');
111
+ console.log(' getskill config set <key> <value> - 持久化保存配置项');
112
+ console.log(' getskill config unset <key> - 删除配置项,恢复自动识别/默认值');
92
113
  console.log(' getskill clean - 清理下载缓存');
93
114
  console.log('');
115
+ console.log('全局参数(仅对本次执行生效,不写入配置文件):');
116
+ console.log(` --agent <name> 指定目标 Agent: auto, ${config_1.AGENT_PRESETS.map((preset) => preset.name).join(', ')}`);
117
+ console.log(' --skills-dir <path> 指定任意 Agent 的技能目录');
118
+ console.log(' --cache-dir <path> 指定下载/解压缓存目录');
119
+ console.log(' --base-url <url> 指定技能索引站点地址');
120
+ console.log('');
121
+ console.log('环境变量:');
122
+ console.log(' GETSKILL_AGENT, GETSKILL_SKILLS_DIR, GETSKILL_CACHE_DIR');
123
+ console.log(' GETSKILL_BASE_URL, GETSKILL_HOME, GETSKILL_RESTART_CMD, GETSKILL_LOG_LEVEL');
124
+ console.log('');
94
125
  console.log('示例:');
95
- console.log(' getskill install ab-testing');
96
- console.log(' getskill install ab-testing --version 2.0.7');
97
126
  console.log(' getskill search pdf --json');
98
- console.log(' getskill update ab-testing');
127
+ console.log(' getskill install pdf-toolkit');
99
128
  console.log(' getskill update --all');
100
- console.log(' getskill inspect ab-testing');
129
+ console.log(' getskill inspect pdf-toolkit');
130
+ console.log(' getskill config set agent claude');
131
+ console.log(' getskill config set skills-dir ~/.my-agent/skills');
132
+ console.log(' getskill --agent cursor install pdf-toolkit');
101
133
  console.log('');
102
134
  console.log(`当前站点: ${(0, config_1.getBaseUrl)()}`);
103
135
  console.log(`技能索引: ${(0, config_1.getBaseUrl)()}/data/skills.json`);
136
+ console.log(`当前 Agent: ${(0, config_1.getAgentName)()} (${(0, config_1.getAgentLabel)()})`);
104
137
  console.log(`技能目录: ${(0, config_1.getSkillsDirectory)()}`);
105
138
  console.log(`缓存目录: ${(0, config_1.getSkillsCacheDirectory)()}`);
139
+ console.log(`配置文件: ${(0, config_1.getConfigFilePath)()}`);
106
140
  }
107
141
  function getCliVersion() {
108
142
  const candidatePaths = [
@@ -123,9 +157,196 @@ function getCliVersion() {
123
157
  return 'unknown';
124
158
  }
125
159
  }
160
+ function asStringValue(value) {
161
+ return typeof value === 'string' && value.trim() !== ''
162
+ ? value.trim()
163
+ : undefined;
164
+ }
165
+ const CONFIG_SOURCE_LABELS = {
166
+ cli: '命令行参数',
167
+ env: '环境变量',
168
+ file: '配置文件',
169
+ detect: '自动识别',
170
+ default: '默认值'
171
+ };
172
+ function getConfigRows() {
173
+ const config = (0, config_1.getConfigSummary)();
174
+ const persisted = (0, config_1.readConfigFile)();
175
+ return [
176
+ {
177
+ key: 'base-url',
178
+ value: config.baseUrl,
179
+ source: config.sources.baseUrl,
180
+ savedHint: persisted.baseUrl
181
+ ? `已保存: ${persisted.baseUrl}`
182
+ : '未保存,使用默认站点'
183
+ },
184
+ {
185
+ key: 'agent',
186
+ value: `${config.agent} (${config.agentLabel})`,
187
+ source: config.sources.agent,
188
+ savedHint: persisted.agent
189
+ ? `已保存: ${persisted.agent}`
190
+ : '未保存,自动识别本机 Agent'
191
+ },
192
+ {
193
+ key: 'skills-dir',
194
+ value: config.skillsDir,
195
+ source: config.sources.skillsDir,
196
+ savedHint: persisted.skillsDir
197
+ ? `已保存: ${persisted.skillsDir}`
198
+ : '未单独保存,由 agent 推导'
199
+ },
200
+ {
201
+ key: 'cache-dir',
202
+ value: config.cacheDir,
203
+ source: config.sources.cacheDir,
204
+ savedHint: persisted.cacheDir
205
+ ? `已保存: ${persisted.cacheDir}`
206
+ : '未保存,使用默认缓存目录'
207
+ }
208
+ ];
209
+ }
210
+ function printConfigRow(row) {
211
+ const source = CONFIG_SOURCE_LABELS[row.source] || row.source;
212
+ console.log(`${row.key}: ${row.value}`);
213
+ console.log(` 来源: ${source},${row.savedHint}`);
214
+ }
215
+ function printConfigUsage() {
216
+ console.log('用法:');
217
+ console.log(' getskill config get [key] - 查看全部或指定配置项');
218
+ console.log(' getskill config set <key> <value> - 保存配置项到配置文件');
219
+ console.log(' getskill config unset <key> - 删除已保存的配置项');
220
+ console.log(' getskill config path - 显示配置文件路径');
221
+ console.log(' getskill config agents - 列出支持的 Agent');
222
+ console.log('');
223
+ console.log('可用配置项: base-url, agent, skills-dir, cache-dir');
224
+ console.log('示例:');
225
+ console.log(' getskill config set base-url https://custom-index.example.com');
226
+ console.log(' getskill config set agent claude');
227
+ console.log(' getskill config set skills-dir ~/.my-agent/skills');
228
+ console.log(' getskill config unset agent');
229
+ }
230
+ function printConfigValues(key) {
231
+ const rows = getConfigRows();
232
+ if (key) {
233
+ const normalizedKey = (0, config_1.normalizeConfigKey)(key);
234
+ const targetKey = normalizedKey
235
+ .replace(/([A-Z])/g, '-$1')
236
+ .toLowerCase();
237
+ const row = rows.find((item) => item.key === targetKey);
238
+ if (!row) {
239
+ throw new Error(`未知配置项: ${key}`);
240
+ }
241
+ printConfigRow(row);
242
+ console.log(`配置文件: ${(0, config_1.getConfigFilePath)()}`);
243
+ return;
244
+ }
245
+ rows.forEach(printConfigRow);
246
+ console.log(`配置文件: ${(0, config_1.getConfigFilePath)()}`);
247
+ console.log(`状态文件: ${(0, config_1.getStateFilePath)()}`);
248
+ }
249
+ function printAgents() {
250
+ const config = (0, config_1.getConfigSummary)();
251
+ console.log(`当前 Agent: ${config.agent} (${config.agentLabel})`);
252
+ console.log(`技能目录: ${config.skillsDir}`);
253
+ console.log(`目录来源: ${CONFIG_SOURCE_LABELS[config.sources.skillsDir] ||
254
+ config.sources.skillsDir}`);
255
+ console.log('');
256
+ console.log('内置 Agent 预设 (* 表示当前生效):');
257
+ (0, config_1.listAgents)().forEach((agent) => {
258
+ const mark = agent.active ? '*' : ' ';
259
+ const exists = agent.exists ? '目录已存在' : '目录未创建';
260
+ console.log(` ${mark} ${agent.name.padEnd(10)} ${agent.label.padEnd(20)} ${agent.skillsDir} (${exists})`);
261
+ });
262
+ console.log('');
263
+ console.log('其他 Agent / 自定义目录(任选一种方式):');
264
+ console.log(' getskill config set skills-dir <path>');
265
+ console.log(' getskill --skills-dir <path> install <技能名称>');
266
+ console.log(' GETSKILL_SKILLS_DIR=<path> getskill install <技能名称>');
267
+ }
268
+ function printPaths() {
269
+ const config = (0, config_1.getConfigSummary)();
270
+ console.log(`Agent: ${config.agent} (${config.agentLabel})`);
271
+ console.log(`技能目录: ${config.skillsDir}`);
272
+ console.log(`缓存目录: ${config.cacheDir}`);
273
+ console.log(`配置文件: ${config.configFile}`);
274
+ console.log(`状态文件: ${config.stateFile}`);
275
+ console.log(`站点地址: ${config.baseUrl}`);
276
+ console.log(`重载命令: ${config.restartCommand ||
277
+ '(未配置,可通过 GETSKILL_RESTART_CMD 指定)'}`);
278
+ }
279
+ function handleConfigCommand(args) {
280
+ const [action, ...rest] = args;
281
+ switch ((action || 'get').toLowerCase()) {
282
+ case 'get':
283
+ case 'list':
284
+ case 'show':
285
+ printConfigValues(rest[0]);
286
+ break;
287
+ case 'set': {
288
+ if (rest.length === 0) {
289
+ printConfigUsage();
290
+ process.exit(1);
291
+ }
292
+ if (rest.length === 1) {
293
+ const rawUrl = rest[0];
294
+ if (!/^https?:\/\//i.test(rawUrl.trim())) {
295
+ throw new Error(`config set <URL> 只接受 http(s) 地址(收到: ${rawUrl})。设置 Agent 请用: getskill config set agent <name>`);
296
+ }
297
+ (0, config_1.setConfigValue)('base-url', rawUrl);
298
+ printConfigValues('base-url');
299
+ break;
300
+ }
301
+ const [key, ...valueParts] = rest;
302
+ (0, config_1.setConfigValue)(key, valueParts.join(' '));
303
+ printConfigValues(key);
304
+ break;
305
+ }
306
+ case 'unset':
307
+ case 'delete':
308
+ case 'remove':
309
+ case 'reset': {
310
+ if (!rest[0]) {
311
+ printConfigUsage();
312
+ process.exit(1);
313
+ }
314
+ (0, config_1.unsetConfigValue)(rest[0]);
315
+ console.log(`已删除配置项: ${rest[0]}`);
316
+ printConfigValues(rest[0]);
317
+ break;
318
+ }
319
+ case 'path':
320
+ console.log((0, config_1.getConfigFilePath)());
321
+ break;
322
+ case 'agents':
323
+ printAgents();
324
+ break;
325
+ default:
326
+ printConfigUsage();
327
+ process.exit(1);
328
+ }
329
+ }
126
330
  async function cli() {
127
331
  const args = process.argv.slice(2);
128
- const command = args[0];
332
+ // 全局参数只影响本次执行,不会写入配置文件;
333
+ // 同时过滤掉参数本身,使 `getskill --agent cursor path` 这类写法生效。
334
+ const { positionals, options } = parseCommandOptions(args);
335
+ (0, config_1.applyRuntimeOverrides)({
336
+ agent: asStringValue(options.agent),
337
+ skillsDir: asStringValue(options['skills-dir']),
338
+ cacheDir: asStringValue(options['cache-dir']),
339
+ baseUrl: asStringValue(options['base-url'])
340
+ });
341
+ const restArgs = positionals.slice(1);
342
+ let command = positionals[0];
343
+ if (args.includes('--help') || args.includes('-h')) {
344
+ command = '--help';
345
+ }
346
+ else if (!command &&
347
+ (args.includes('--version') || args.includes('-v'))) {
348
+ command = '--version';
349
+ }
129
350
  try {
130
351
  switch (command) {
131
352
  case '--help':
@@ -139,8 +360,7 @@ async function cli() {
139
360
  console.log(getCliVersion());
140
361
  break;
141
362
  case 'search': {
142
- const { positionals, options } = parseCommandOptions(args.slice(1));
143
- const keyword = positionals[0];
363
+ const keyword = restArgs[0];
144
364
  if (!keyword) {
145
365
  console.error('请提供搜索关键词');
146
366
  console.log('用法: getskill search <关键词>');
@@ -179,21 +399,21 @@ async function cli() {
179
399
  case 'install':
180
400
  case 'get':
181
401
  case 'download': {
182
- const { positionals, options } = parseCommandOptions(args.slice(1));
183
- const skillName = positionals[0];
402
+ const skillName = restArgs[0];
184
403
  const requestedVersion = typeof options.version === 'string'
185
404
  ? options.version
186
405
  : undefined;
187
406
  if (!skillName) {
188
407
  console.error('请提供技能ID或名称');
189
408
  console.log('用法: getskill install <技能名称>');
190
- console.log('示例: getskill install pdf-extract');
409
+ console.log('示例: getskill install pdf-toolkit');
191
410
  process.exit(1);
192
411
  }
193
412
  const result = await (0, skill_manager_1.downloadSkill)(skillName, {
194
413
  version: requestedVersion
195
414
  });
196
- console.log('\n技能已安装到 skills 目录:');
415
+ console.log(`\n目标 Agent: ${(0, config_1.getAgentName)()} (${(0, config_1.getAgentLabel)()})`);
416
+ console.log('技能已安装到 skills 目录:');
197
417
  result.files.forEach((file) => console.log(` - ${file}`));
198
418
  console.log(`\n本地缓存: ${result.repoPath}`);
199
419
  if (result.version) {
@@ -202,16 +422,28 @@ async function cli() {
202
422
  break;
203
423
  }
204
424
  case 'update': {
205
- const { positionals, options } = parseCommandOptions(args.slice(1));
206
425
  if (options.all) {
207
- const results = await (0, skill_manager_1.updateAllSkills)();
426
+ const results = await (0, skill_manager_1.updateAllSkills)({
427
+ prune: options.prune === true
428
+ });
208
429
  if (results.length === 0) {
209
430
  console.log('当前没有记录到可批量更新的技能。');
431
+ console.log(`技能目录: ${(0, config_1.getSkillsDirectory)()}(可用 getskill path 查看,或用 --agent/--skills-dir 切换)`);
210
432
  break;
211
433
  }
212
434
  const successCount = results.filter((item) => item.ok).length;
213
- const failed = results.filter((item) => !item.ok);
435
+ const skipped = results.filter((item) => item.skipped);
436
+ const failed = results.filter((item) => !item.ok && !item.skipped);
214
437
  console.log(`批量更新完成:${successCount}/${results.length} 个技能成功。`);
438
+ if (skipped.length > 0) {
439
+ console.log('以下技能在索引中已不存在,已跳过(非失败):');
440
+ skipped.forEach((item) => {
441
+ console.log(` - ${item.skillName}: ${item.error}`);
442
+ });
443
+ if (options.prune !== true) {
444
+ console.log('提示: 执行 getskill update --all --prune 可清理这些失效的本地记录。');
445
+ }
446
+ }
215
447
  if (failed.length > 0) {
216
448
  console.log('以下技能更新失败:');
217
449
  failed.forEach((item) => {
@@ -220,14 +452,14 @@ async function cli() {
220
452
  }
221
453
  break;
222
454
  }
223
- const skillName = positionals[0];
455
+ const skillName = restArgs[0];
224
456
  const requestedVersion = typeof options.version === 'string'
225
457
  ? options.version
226
458
  : undefined;
227
459
  if (!skillName) {
228
460
  console.error('请提供技能名称');
229
461
  console.log('用法: getskill update <技能名称>');
230
- console.log('示例: getskill update pdf-extract');
462
+ console.log('示例: getskill update pdf-toolkit');
231
463
  process.exit(1);
232
464
  }
233
465
  const result = await (0, skill_manager_1.updateSkill)(skillName, {
@@ -237,7 +469,8 @@ async function cli() {
237
469
  console.log(`\n技能已是最新版本 (v${result.version || 'unknown'}),无需更新。`);
238
470
  break;
239
471
  }
240
- console.log('\n技能已更新到 skills 目录:');
472
+ console.log(`\n目标 Agent: ${(0, config_1.getAgentName)()} (${(0, config_1.getAgentLabel)()})`);
473
+ console.log('技能已更新到 skills 目录:');
241
474
  result.files.forEach((file) => console.log(` - ${file}`));
242
475
  if (result.version) {
243
476
  console.log(`当前版本: ${result.version}`);
@@ -245,13 +478,13 @@ async function cli() {
245
478
  break;
246
479
  }
247
480
  case 'uninstall': {
248
- if (!args[1]) {
481
+ if (!restArgs[0]) {
249
482
  console.error('请提供技能名称');
250
483
  console.log('用法: getskill uninstall <技能名称> [--keep-cache]');
251
484
  process.exit(1);
252
485
  }
253
- const result = await (0, skill_manager_1.uninstallSkill)(args[1], {
254
- removeCache: !args.includes('--keep-cache')
486
+ const result = await (0, skill_manager_1.uninstallSkill)(restArgs[0], {
487
+ removeCache: options['keep-cache'] !== true
255
488
  });
256
489
  console.log('\n卸载结果:');
257
490
  console.log(` 技能目录: ${result.removedInstall ? '已删除' : '不存在'}`);
@@ -259,18 +492,21 @@ async function cli() {
259
492
  break;
260
493
  }
261
494
  case 'inspect': {
262
- if (!args[1]) {
495
+ if (!restArgs[0]) {
263
496
  console.error('请提供技能名称');
264
497
  console.log('用法: getskill inspect <技能名称>');
265
498
  process.exit(1);
266
499
  }
267
- const info = (0, state_1.getInstalledSkillInfo)(args[1]);
500
+ const info = (0, state_1.getInstalledSkillInfo)(restArgs[0]);
268
501
  console.log(`技能名称: ${info.skillName}`);
269
502
  console.log(`本地目录: ${info.localSkillName}`);
503
+ console.log(`目标 Agent: ${info.agent} (${info.agentLabel})`);
270
504
  console.log(`已安装: ${info.installed ? '是' : '否'}`);
271
505
  console.log(`已缓存: ${info.cached ? '是' : '否'}`);
272
506
  console.log(`技能路径: ${info.skillDir}`);
273
- console.log(`缓存路径: ${info.repoPath}`);
507
+ console.log(`技能目录: ${info.skillsDir}`);
508
+ console.log(`缓存目录: ${info.cacheDir}`);
509
+ console.log(`解压路径: ${info.repoPath}`);
274
510
  if (info.state) {
275
511
  console.log(`最后动作: ${info.state.lastAction || 'unknown'}`);
276
512
  console.log(`安装时间: ${info.state.installedAt || 'unknown'}`);
@@ -284,37 +520,37 @@ async function cli() {
284
520
  }
285
521
  case 'list': {
286
522
  const skills = (0, state_1.listLocalSkills)();
287
- console.log(`本地已安装的技能 (${skills.length}):`);
523
+ console.log(`本地已安装的技能 (${skills.length}) · Agent: ${(0, config_1.getAgentName)()} · 目录: ${(0, config_1.getSkillsDirectory)()}`);
288
524
  skills.forEach((skill, index) => {
289
525
  console.log(`${index + 1}. ${skill}`);
290
526
  });
291
527
  break;
292
528
  }
529
+ case 'agents':
530
+ printAgents();
531
+ break;
293
532
  case 'path':
294
- console.log(`技能目录: ${(0, config_1.getSkillsDirectory)()}`);
295
- console.log(`缓存目录: ${(0, config_1.getSkillsCacheDirectory)()}`);
533
+ printPaths();
296
534
  break;
297
535
  case 'config':
298
- if (args[1] === 'set' && args[2]) {
299
- const newBaseUrl = (0, config_1.setBaseUrl)(args[2]);
300
- console.log(`BASE_URL 已设置为: ${newBaseUrl}`);
301
- }
302
- else if (args[1] === 'get') {
303
- console.log(`当前 BASE_URL: ${(0, config_1.getBaseUrl)()}`);
304
- }
305
- else {
306
- console.log('用法:');
307
- console.log(' getskill config set <URL> - 设置自定义 API 地址');
308
- console.log(' getskill config get - 查看当前 API 地址');
309
- }
536
+ handleConfigCommand(restArgs);
310
537
  break;
311
538
  case 'clean': {
312
539
  const cacheDir = (0, config_1.getSkillsCacheDirectory)();
540
+ let cleaned = false;
313
541
  if (fs_1.default.existsSync(cacheDir)) {
314
542
  fs_1.default.rmSync(cacheDir, { recursive: true, force: true });
315
543
  console.log(`已清理缓存目录: ${cacheDir}`);
544
+ cleaned = true;
316
545
  }
317
- else {
546
+ (0, config_1.getLegacyCacheDirectories)().forEach((legacyDir) => {
547
+ if (fs_1.default.existsSync(legacyDir)) {
548
+ fs_1.default.rmSync(legacyDir, { recursive: true, force: true });
549
+ console.log(`已清理历史缓存目录: ${legacyDir}`);
550
+ cleaned = true;
551
+ }
552
+ });
553
+ if (!cleaned) {
318
554
  console.log('缓存目录不存在');
319
555
  }
320
556
  break;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@workskills/getskill",
3
- "description": "A skill management tool for OpenClaw that enables searching, downloading, and updating skill files from the getskill.work repository",
4
- "version": "2.0.0",
3
+ "description": "A skill management CLI for any AI agent (Claude Code, OpenClaw, Codex, Cursor, or a custom skills directory) that searches, installs, and updates skill files from the getskill.work registry",
4
+ "version": "2.1.0",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",
7
7
  "bin": {
@@ -32,6 +32,9 @@
32
32
  },
33
33
  "homepage": "https://github.com/work-skills/getskill#readme",
34
34
  "keywords": [
35
+ "agent",
36
+ "agents",
37
+ "agent-skills",
35
38
  "openclaw",
36
39
  "workskills",
37
40
  "skill",
@@ -41,6 +44,9 @@
41
44
  "update",
42
45
  "cli",
43
46
  "claude",
47
+ "claude-code",
48
+ "codex",
49
+ "cursor",
44
50
  "ai",
45
51
  "automation"
46
52
  ],
@@ -50,7 +56,7 @@
50
56
  },
51
57
  "license": "MIT",
52
58
  "engines": {
53
- "node": ">=12.0.0"
59
+ "node": ">=18.0.0"
54
60
  },
55
61
  "os": [
56
62
  "darwin",