joyskills-cli 0.2.7 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joyskills-cli",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Team-level skill governance compatible with open skill / Claude Skills",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -78,6 +78,38 @@ async function resolveAndInstall(skillInput, targetDir, projectRoot, options) {
78
78
  return;
79
79
  }
80
80
 
81
+ // ── Step 1.5: team:// protocol ──────────────────────────────────
82
+ if (skillInput.startsWith('team://')) {
83
+ const pathPart = skillInput.slice(7); // Remove team://
84
+ const parts = pathPart.split('/');
85
+ const registryName = parts[0];
86
+ const skillName = parts[1];
87
+
88
+ if (!registryName || !skillName) {
89
+ throw new Error(`Invalid team:// URL format: ${skillInput}. Expected: team://<registry>/<skill>`);
90
+ }
91
+
92
+ // Load registry config
93
+ const configPath = path.join(JOYSKILL_CONFIG_DIR, 'config.json');
94
+ if (!fs.existsSync(configPath)) {
95
+ throw new Error(`No registries configured. Run: joySkills team add <name> <git-url>`);
96
+ }
97
+
98
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
99
+ const registries = config.registries || {};
100
+ const reg = registries[registryName];
101
+
102
+ if (!reg?.path || !fs.existsSync(reg.path)) {
103
+ throw new Error(`Registry "${registryName}" not found. Run: joySkills team list`);
104
+ }
105
+
106
+ const hit = await tryInstallFromRegistryDir(skillName, reg.path, targetDir, projectRoot, options, `team:${registryName}`);
107
+ if (!hit) {
108
+ throw new Error(`Skill "${skillName}" not found in registry "${registryName}"`);
109
+ }
110
+ return;
111
+ }
112
+
81
113
  // ── Step 2: Project-level registry ──────────────────────────────
82
114
  const projectRegistryPath = path.join(projectRoot, '.joyskill', 'registry');
83
115
  if (!options.registry || options.registry === 'project') {
@@ -174,29 +206,26 @@ async function tryInstallFromRegistryDir(skillName, registryDirPath, targetDir,
174
206
  return false;
175
207
  }
176
208
  } else {
177
- // No registry.yaml: scan skill directories directly
178
- const skillPath = path.join(registryDirPath, skillName);
179
- if (fs.existsSync(path.join(skillPath, 'SKILL.md'))) {
180
- const targetPath = path.join(targetDir, skillName);
181
- copyRecursive(skillPath, targetPath);
182
-
183
- const content = fs.readFileSync(path.join(skillPath, 'SKILL.md'), 'utf-8');
184
- const versionMatch = content.match(/version:\s*(.+)/);
185
- const version = versionMatch?.[1]?.trim() || '1.0.0';
209
+ // No registry.yaml: scan skill directories recursively
210
+ const skills = await findSkills(registryDirPath);
211
+ const skill = skills.find(s => s.name === skillName);
212
+
213
+ if (!skill) return false;
214
+
215
+ const targetPath = path.join(targetDir, skillName);
216
+ copyRecursive(skill.path, targetPath);
186
217
 
187
- const lockfileManager = new LockfileManager(projectRoot);
188
- await lockfileManager.load();
189
- lockfileManager.updateSkill(skillName, {
190
- version,
191
- source: sourceLabel,
192
- installedAt: new Date().toISOString()
193
- });
194
- await lockfileManager.save();
218
+ const lockfileManager = new LockfileManager(projectRoot);
219
+ await lockfileManager.load();
220
+ lockfileManager.updateSkill(skillName, {
221
+ version: skill.version || '1.0.0',
222
+ source: sourceLabel,
223
+ installedAt: new Date().toISOString()
224
+ });
225
+ await lockfileManager.save();
195
226
 
196
- console.log(chalk.green(`✅ Installed ${skillName} v${version} from ${sourceLabel}`));
197
- return true;
198
- }
199
- return false;
227
+ console.log(chalk.green(`✅ Installed ${skillName} v${skill.version || '1.0.0'} from ${sourceLabel}`));
228
+ return true;
200
229
  }
201
230
  }
202
231