joyskills-cli 0.2.2 → 0.2.4

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