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 +1 -1
- package/src/commands/install.js +50 -21
package/package.json
CHANGED
package/src/commands/install.js
CHANGED
|
@@ -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
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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
|
-
|
|
197
|
-
|
|
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
|
|