eskill 1.0.30 → 1.0.31

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.
Files changed (3) hide show
  1. package/cli.js +1 -1
  2. package/lib/installer.js +21 -26
  3. package/package.json +1 -1
package/cli.js CHANGED
@@ -13,7 +13,7 @@ const program = new Command();
13
13
  program
14
14
  .name('eskill')
15
15
  .description('Unified AI Agent Skills Management - Install skills from Git URLs')
16
- .version('1.0.30')
16
+ .version('1.0.31')
17
17
  .option('-g, --global', '使用全局技能目录(~/.eskill/skills/),否则使用当前目录(./.claude/skills/)', false);
18
18
 
19
19
  // 安装命令
package/lib/installer.js CHANGED
@@ -319,30 +319,32 @@ function confirmAction(message) {
319
319
  export async function installFromGitUrl(gitUrl, options = {}) {
320
320
  const { agent = 'claude', link = false, force = false, global = false } = options;
321
321
 
322
- // 本地模式:询问是否在当前目录安装
323
- if (!global) {
324
- const currentDir = process.cwd();
325
- const confirmed = await confirmAction(`是否在【${currentDir}】下安装此技能?`);
326
- if (!confirmed) {
327
- console.log('\n已取消安装\n');
328
- return { success: false, cancelled: true };
329
- }
330
- }
331
-
332
322
  // 检测并处理 name@author 格式
333
323
  let actualUrl = await handleSkillAtAuthorFormat(gitUrl);
334
324
 
335
- // 如果 URL 被转换了(即原来是 name@author 格式),需要确认
336
- if (actualUrl !== gitUrl) {
337
- const confirmed = await confirmAction('是否安装此技能?');
338
- if (!confirmed) {
339
- console.log('\n已取消安装');
340
- return { success: false, cancelled: true };
341
- }
342
- }
343
-
344
325
  // 解析 Git URL
345
326
  const parsed = parseGitUrl(actualUrl);
327
+ const skillsDir = getSkillsDir(global);
328
+
329
+ // 确定技能名称
330
+ const skillName = parsed.path ? basename(parsed.path) : parsed.repo;
331
+ const targetPath = join(skillsDir, skillName);
332
+
333
+ // 确认安装(带路径信息)
334
+ let confirmMessage = '';
335
+ if (!global) {
336
+ // 本地模式:显示当前目录
337
+ confirmMessage = `是否在【${process.cwd()}】下安装此技能?`;
338
+ } else {
339
+ // 全局模式:显示 skill 仓库
340
+ confirmMessage = `是否在【skill 仓库】中安装此技能?`;
341
+ }
342
+
343
+ const confirmed = await confirmAction(confirmMessage);
344
+ if (!confirmed) {
345
+ console.log('\n已取消安装\n');
346
+ return { success: false, cancelled: true };
347
+ }
346
348
  console.log(`平台: ${parsed.platform}`);
347
349
  console.log(`仓库: ${parsed.owner}/${parsed.repo}`);
348
350
  console.log(`分支: ${parsed.branch}`);
@@ -350,18 +352,11 @@ export async function installFromGitUrl(gitUrl, options = {}) {
350
352
  console.log(`路径: ${parsed.path}`);
351
353
  }
352
354
 
353
- // 获取技能目录(技能文件存放位置)
354
- const skillsDir = getSkillsDir(global);
355
-
356
355
  // 确保技能目录存在
357
356
  if (!existsSync(skillsDir)) {
358
357
  mkdirSync(skillsDir, { recursive: true });
359
358
  }
360
359
 
361
- // 确定技能名称
362
- const skillName = parsed.path ? basename(parsed.path) : parsed.repo;
363
- const targetPath = join(skillsDir, skillName);
364
-
365
360
  // 检查是否已存在
366
361
  if (existsSync(targetPath)) {
367
362
  if (!force) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eskill",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "Unified AI Agent Skills Management - Install skills from Git URLs",
5
5
  "main": "index.js",
6
6
  "type": "module",