skillhub 0.1.8 → 0.1.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/dist/index.js +22 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -371,6 +371,28 @@ async function install(skillId, options) {
|
|
|
371
371
|
}
|
|
372
372
|
const actualName = parsed.metadata.name || skillName;
|
|
373
373
|
const installPath = getSkillPath(options.platform, actualName, options.project);
|
|
374
|
+
const metadataPath = path.join(installPath, ".skillhub.json");
|
|
375
|
+
if (await fs.pathExists(metadataPath)) {
|
|
376
|
+
try {
|
|
377
|
+
const existingMetadata = await fs.readJson(metadataPath);
|
|
378
|
+
if (existingMetadata.skillId && existingMetadata.skillId !== skillId) {
|
|
379
|
+
spinner.warn(`Name collision detected!`);
|
|
380
|
+
console.log(chalk.yellow(`
|
|
381
|
+
A different skill is already installed with the name "${actualName}":`));
|
|
382
|
+
console.log(chalk.dim(` Existing: ${existingMetadata.skillId}`));
|
|
383
|
+
console.log(chalk.dim(` New: ${skillId}`));
|
|
384
|
+
console.log();
|
|
385
|
+
if (!options.force) {
|
|
386
|
+
console.log(chalk.red("Installation cancelled to prevent overwriting."));
|
|
387
|
+
console.log(chalk.dim("Use --force to overwrite the existing skill."));
|
|
388
|
+
process.exit(1);
|
|
389
|
+
} else {
|
|
390
|
+
console.log(chalk.yellow("Overwriting existing skill (--force flag used).\n"));
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
} catch {
|
|
394
|
+
}
|
|
395
|
+
}
|
|
374
396
|
if (installed && options.force) {
|
|
375
397
|
await fs.remove(installPath);
|
|
376
398
|
}
|
package/package.json
CHANGED