joyskills-cli 0.3.7 → 0.3.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/README.md +1 -1
- package/package.json +1 -1
- package/src/commands/install.js +19 -10
- package/src/commands/upgrade.js +4 -2
package/README.md
CHANGED
package/package.json
CHANGED
package/src/commands/install.js
CHANGED
|
@@ -387,8 +387,9 @@ async function tryInstallFromRegistryDir(skillName, registryDirPath, targetDir,
|
|
|
387
387
|
|
|
388
388
|
if (!skill) return false;
|
|
389
389
|
|
|
390
|
-
// Use
|
|
391
|
-
const
|
|
390
|
+
// Use the last segment of relativePath as target name
|
|
391
|
+
const targetName = skill.relativePath ? skill.relativePath.split('/').pop() : skill.name;
|
|
392
|
+
const targetPath = path.join(targetDir, targetName);
|
|
392
393
|
copyRecursive(skill.path, targetPath);
|
|
393
394
|
|
|
394
395
|
// Get git commit for the skill source
|
|
@@ -398,7 +399,7 @@ async function tryInstallFromRegistryDir(skillName, registryDirPath, targetDir,
|
|
|
398
399
|
if (!options.global) {
|
|
399
400
|
const lockfileManager = new LockfileManager(projectRoot);
|
|
400
401
|
await lockfileManager.load();
|
|
401
|
-
lockfileManager.updateSkill(
|
|
402
|
+
lockfileManager.updateSkill(targetName, {
|
|
402
403
|
version: skill.version || '1.0.0',
|
|
403
404
|
source: sourceLabel,
|
|
404
405
|
commit: commitHash,
|
|
@@ -407,7 +408,7 @@ async function tryInstallFromRegistryDir(skillName, registryDirPath, targetDir,
|
|
|
407
408
|
await lockfileManager.save();
|
|
408
409
|
}
|
|
409
410
|
|
|
410
|
-
console.log(chalk.green(`✅ Installed ${
|
|
411
|
+
console.log(chalk.green(`✅ Installed ${targetName} v${skill.version || '1.0.0'} from ${sourceLabel}`));
|
|
411
412
|
return true;
|
|
412
413
|
}
|
|
413
414
|
}
|
|
@@ -597,7 +598,9 @@ async function installFromGitUrl(gitUrl, targetDir, options, subPath = '') {
|
|
|
597
598
|
}
|
|
598
599
|
|
|
599
600
|
for (const skill of selectedSkills) {
|
|
600
|
-
|
|
601
|
+
// For Git URL installs with subPath, use the last part of subPath as target name
|
|
602
|
+
const targetName = skill.relativePath ? skill.relativePath.split('/').pop() : skill.name;
|
|
603
|
+
await installSkillFiles(skill, targetDir, targetName);
|
|
601
604
|
}
|
|
602
605
|
|
|
603
606
|
// Update lockfile only for project-level installation (npm-like behavior)
|
|
@@ -605,7 +608,8 @@ async function installFromGitUrl(gitUrl, targetDir, options, subPath = '') {
|
|
|
605
608
|
const lockfileManager = new LockfileManager(process.cwd());
|
|
606
609
|
await lockfileManager.load();
|
|
607
610
|
for (const skill of selectedSkills) {
|
|
608
|
-
|
|
611
|
+
const targetName = skill.relativePath ? skill.relativePath.split('/').pop() : skill.name;
|
|
612
|
+
lockfileManager.updateSkill(targetName, {
|
|
609
613
|
version: skill.version || '1.0.0',
|
|
610
614
|
source: 'git',
|
|
611
615
|
repository: gitUrl,
|
|
@@ -691,7 +695,10 @@ async function installFromGitHub(owner, repo, skillPath, targetDir, options) {
|
|
|
691
695
|
|
|
692
696
|
// Install selected skills
|
|
693
697
|
for (const skill of selectedSkills) {
|
|
694
|
-
|
|
698
|
+
// Always use the last segment of relativePath as target name
|
|
699
|
+
// e.g., "skills/pdf" -> "pdf", "anthropics/skills/pdf" -> "pdf"
|
|
700
|
+
const targetName = skill.relativePath ? skill.relativePath.split('/').pop() : skill.name;
|
|
701
|
+
await installSkillFiles(skill, targetDir, targetName);
|
|
695
702
|
}
|
|
696
703
|
|
|
697
704
|
// Update lockfile only for project-level installation (npm-like behavior)
|
|
@@ -699,7 +706,9 @@ async function installFromGitHub(owner, repo, skillPath, targetDir, options) {
|
|
|
699
706
|
const lockfileManager = new LockfileManager(process.cwd());
|
|
700
707
|
await lockfileManager.load();
|
|
701
708
|
for (const skill of selectedSkills) {
|
|
702
|
-
|
|
709
|
+
// Use the same targetName for lockfile consistency
|
|
710
|
+
const targetName = skill.relativePath ? skill.relativePath.split('/').pop() : skill.name;
|
|
711
|
+
lockfileManager.updateSkill(targetName, {
|
|
703
712
|
version: skill.version || '1.0.0',
|
|
704
713
|
source: 'github',
|
|
705
714
|
repository: `${owner}/${repo}`,
|
|
@@ -904,8 +913,8 @@ function formatSize(bytes) {
|
|
|
904
913
|
return (bytes / (1024 * 1024)).toFixed(1) + 'MB';
|
|
905
914
|
}
|
|
906
915
|
|
|
907
|
-
async function installSkillFiles(skill, targetDir) {
|
|
908
|
-
const targetPath = path.join(targetDir, skill.name);
|
|
916
|
+
async function installSkillFiles(skill, targetDir, targetName = null) {
|
|
917
|
+
const targetPath = path.join(targetDir, targetName || skill.name);
|
|
909
918
|
|
|
910
919
|
if (fs.existsSync(targetPath)) {
|
|
911
920
|
fs.rmSync(targetPath, { recursive: true, force: true });
|
package/src/commands/upgrade.js
CHANGED
|
@@ -328,7 +328,8 @@ async function upgradeFromGitHub(skill, skillsDir) {
|
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
// Remove old version
|
|
331
|
-
const
|
|
331
|
+
const targetName = skillInfo.relativePath ? skillInfo.relativePath.split('/').pop() : skill.name;
|
|
332
|
+
const targetPath = path.join(skillsDir, targetName);
|
|
332
333
|
if (fs.existsSync(targetPath)) {
|
|
333
334
|
fs.rmSync(targetPath, { recursive: true, force: true });
|
|
334
335
|
}
|
|
@@ -373,7 +374,8 @@ async function upgradeFromRegistry(skill, skillsDir) {
|
|
|
373
374
|
}
|
|
374
375
|
|
|
375
376
|
// Remove old version
|
|
376
|
-
const
|
|
377
|
+
const targetName = skillInfo.relativePath ? skillInfo.relativePath.split('/').pop() : skill.name;
|
|
378
|
+
const targetPath = path.join(skillsDir, targetName);
|
|
377
379
|
if (fs.existsSync(targetPath)) {
|
|
378
380
|
fs.rmSync(targetPath, { recursive: true, force: true });
|
|
379
381
|
}
|