joyskills-cli 0.2.2 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joyskills-cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Team-level skill governance compatible with open skill / Claude Skills",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -76,7 +76,9 @@ async function installPublicSkill(skillName, options, localManager, lockfileMana
76
76
  const tmpDir = `/tmp/joyskills-${Date.now()}`;
77
77
 
78
78
  try {
79
- // 1. 解析 skill 名称:anthropics/skills/pdf -> owner=anthropics, repo=skills, path=pdf
79
+ // 1. 解析 skill 名称
80
+ // anthropics/skills/pdf -> owner=anthropics, repo=skills, 相对路径=skills/pdf
81
+ // skillforge/code-review -> owner=skillforge, repo=code-review, 相对路径=code-review
80
82
  const parts = skillName.split('/');
81
83
  if (parts.length < 2) {
82
84
  throw new Error(`Invalid skill name: ${skillName}. Expected format: owner/repo or owner/repo/path`);
@@ -84,7 +86,11 @@ async function installPublicSkill(skillName, options, localManager, lockfileMana
84
86
 
85
87
  const owner = parts[0];
86
88
  const repo = parts[1];
87
- const skillPath = parts.slice(2).join('/') || repo; // 如果没有 path,默认用 repo 名
89
+
90
+ // 相对路径:如果有子路径,用 repo/subpath;否则用 repo
91
+ const relativePath = parts.length > 2
92
+ ? `${repo}/${parts.slice(2).join('/')}` // anthropics/skills/pdf -> skills/pdf
93
+ : repo; // skillforge/code-review -> code-review
88
94
 
89
95
  // 2. clone 仓库
90
96
  const repoUrl = `https://github.com/${owner}/${repo}`;
@@ -96,17 +102,18 @@ async function installPublicSkill(skillName, options, localManager, lockfileMana
96
102
  });
97
103
 
98
104
  // 3. 寻找 SKILL.md
99
- const skillSourceDir = path.join(tmpDir, skillPath);
105
+ const skillSourceDir = path.join(tmpDir, relativePath);
100
106
  const skillMdPath = path.join(skillSourceDir, 'SKILL.md');
101
107
 
102
108
  if (!fs.existsSync(skillMdPath)) {
103
- throw new Error(`SKILL.md not found at ${skillPath}. Please check the skill path.`);
109
+ throw new Error(`SKILL.md not found at ${relativePath}. Please check the skill path.`);
104
110
  }
105
111
 
106
- // 4. 确定安装目标目录
112
+ // 4. 确定安装目标目录(只用最后一级目录名)
113
+ const skillDirName = parts[parts.length - 1]; // anthropics/skills/pdf -> pdf
107
114
  const targetDir = options.global
108
- ? localManager.getGlobalSkillPath(skillPath)
109
- : localManager.getProjectSkillPath(skillPath);
115
+ ? localManager.getGlobalSkillPath(skillDirName)
116
+ : localManager.getProjectSkillPath(skillDirName);
110
117
 
111
118
  const location = options.global ? 'global (~/.claude/skills)' : 'project (./.claude/skills)';
112
119
  console.log(`📍 Location: ${location}`);