joyskills-cli 0.3.8 → 0.3.9

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
@@ -32,7 +32,7 @@ joySkills install pdf
32
32
 
33
33
  ## 文档
34
34
 
35
- - [📖 完整文档](./docs/yuanshi.md) - 原理、使用场景、最佳实践
35
+ - [📖 完整文档](yuanshi.md) - 原理、使用场景、最佳实践
36
36
  - [📋 详细说明](./docs/详细说明.md) - 所有命令和选项
37
37
 
38
38
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joyskills-cli",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "JoySkills CLI v2.0 - Multi-agent skill management with JoyCode native support",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -387,8 +387,9 @@ async function tryInstallFromRegistryDir(skillName, registryDirPath, targetDir,
387
387
 
388
388
  if (!skill) return false;
389
389
 
390
- // Use skill.name for target path to maintain subdirectory structure
391
- const targetPath = path.join(targetDir, skill.name);
390
+ // Use the last segment of relativePath as target name
391
+ const targetName = skill.relativePath ? skill.relativePath.split('/').pop() : skill.name;
392
+ const targetPath = path.join(targetDir, targetName);
392
393
  copyRecursive(skill.path, targetPath);
393
394
 
394
395
  // Get git commit for the skill source
@@ -398,7 +399,7 @@ async function tryInstallFromRegistryDir(skillName, registryDirPath, targetDir,
398
399
  if (!options.global) {
399
400
  const lockfileManager = new LockfileManager(projectRoot);
400
401
  await lockfileManager.load();
401
- lockfileManager.updateSkill(skill.name, {
402
+ lockfileManager.updateSkill(targetName, {
402
403
  version: skill.version || '1.0.0',
403
404
  source: sourceLabel,
404
405
  commit: commitHash,
@@ -407,7 +408,7 @@ async function tryInstallFromRegistryDir(skillName, registryDirPath, targetDir,
407
408
  await lockfileManager.save();
408
409
  }
409
410
 
410
- console.log(chalk.green(`✅ Installed ${skill.name} v${skill.version || '1.0.0'} from ${sourceLabel}`));
411
+ console.log(chalk.green(`✅ Installed ${targetName} v${skill.version || '1.0.0'} from ${sourceLabel}`));
411
412
  return true;
412
413
  }
413
414
  }
@@ -598,7 +599,7 @@ async function installFromGitUrl(gitUrl, targetDir, options, subPath = '') {
598
599
 
599
600
  for (const skill of selectedSkills) {
600
601
  // For Git URL installs with subPath, use the last part of subPath as target name
601
- const targetName = subPath ? subPath.split('/').pop() : skill.name;
602
+ const targetName = skill.relativePath ? skill.relativePath.split('/').pop() : skill.name;
602
603
  await installSkillFiles(skill, targetDir, targetName);
603
604
  }
604
605
 
@@ -607,7 +608,7 @@ async function installFromGitUrl(gitUrl, targetDir, options, subPath = '') {
607
608
  const lockfileManager = new LockfileManager(process.cwd());
608
609
  await lockfileManager.load();
609
610
  for (const skill of selectedSkills) {
610
- const targetName = subPath ? subPath.split('/').pop() : skill.name;
611
+ const targetName = skill.relativePath ? skill.relativePath.split('/').pop() : skill.name;
611
612
  lockfileManager.updateSkill(targetName, {
612
613
  version: skill.version || '1.0.0',
613
614
  source: 'git',
@@ -694,9 +695,9 @@ async function installFromGitHub(owner, repo, skillPath, targetDir, options) {
694
695
 
695
696
  // Install selected skills
696
697
  for (const skill of selectedSkills) {
697
- // For GitHub installs, use the last part of skillPath as target name
698
- // e.g., "anthropics/skills/pdf" -> install as "pdf", not "skills/pdf"
699
- const targetName = skillPath ? skillPath.split('/').pop() : skill.name;
698
+ // Always use the last segment of relativePath as target name
699
+ // e.g., "skills/pdf" -> "pdf", "anthropics/skills/pdf" -> "pdf"
700
+ const targetName = skill.relativePath ? skill.relativePath.split('/').pop() : skill.name;
700
701
  await installSkillFiles(skill, targetDir, targetName);
701
702
  }
702
703
 
@@ -706,7 +707,7 @@ async function installFromGitHub(owner, repo, skillPath, targetDir, options) {
706
707
  await lockfileManager.load();
707
708
  for (const skill of selectedSkills) {
708
709
  // Use the same targetName for lockfile consistency
709
- const targetName = skillPath ? skillPath.split('/').pop() : skill.name;
710
+ const targetName = skill.relativePath ? skill.relativePath.split('/').pop() : skill.name;
710
711
  lockfileManager.updateSkill(targetName, {
711
712
  version: skill.version || '1.0.0',
712
713
  source: 'github',
@@ -328,7 +328,8 @@ async function upgradeFromGitHub(skill, skillsDir) {
328
328
  }
329
329
 
330
330
  // Remove old version
331
- const targetPath = path.join(skillsDir, skill.name);
331
+ const targetName = skillInfo.relativePath ? skillInfo.relativePath.split('/').pop() : skill.name;
332
+ const targetPath = path.join(skillsDir, targetName);
332
333
  if (fs.existsSync(targetPath)) {
333
334
  fs.rmSync(targetPath, { recursive: true, force: true });
334
335
  }
@@ -373,7 +374,8 @@ async function upgradeFromRegistry(skill, skillsDir) {
373
374
  }
374
375
 
375
376
  // Remove old version
376
- const targetPath = path.join(skillsDir, skill.name);
377
+ const targetName = skillInfo.relativePath ? skillInfo.relativePath.split('/').pop() : skill.name;
378
+ const targetPath = path.join(skillsDir, targetName);
377
379
  if (fs.existsSync(targetPath)) {
378
380
  fs.rmSync(targetPath, { recursive: true, force: true });
379
381
  }