skillhub 0.1.9 → 0.1.11
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 +74 -27
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -123,11 +123,10 @@ async function getSkill(id) {
|
|
|
123
123
|
}
|
|
124
124
|
async function trackInstall(skillId, platform, method = "cli") {
|
|
125
125
|
try {
|
|
126
|
-
|
|
127
|
-
await httpsRequest(`${API_BASE_URL}/skills/${encodedPath}/install`, {
|
|
126
|
+
await httpsRequest(`${API_BASE_URL}/skills/install`, {
|
|
128
127
|
method: "POST",
|
|
129
128
|
headers: { "Content-Type": "application/json" },
|
|
130
|
-
body: JSON.stringify({ platform, method })
|
|
129
|
+
body: JSON.stringify({ skillId, platform, method })
|
|
131
130
|
});
|
|
132
131
|
} catch {
|
|
133
132
|
}
|
|
@@ -176,7 +175,6 @@ async function fetchSkillContent(owner, repo, skillPath, branch = "main") {
|
|
|
176
175
|
const client = getOctokit();
|
|
177
176
|
const skillMdPath = skillPath ? `${skillPath}/SKILL.md` : "SKILL.md";
|
|
178
177
|
let skillMdResponse;
|
|
179
|
-
let lastError;
|
|
180
178
|
const pathsToTry = [
|
|
181
179
|
skillMdPath,
|
|
182
180
|
// Common skill directories
|
|
@@ -194,7 +192,6 @@ async function fetchSkillContent(owner, repo, skillPath, branch = "main") {
|
|
|
194
192
|
});
|
|
195
193
|
break;
|
|
196
194
|
} catch (error) {
|
|
197
|
-
lastError = error;
|
|
198
195
|
if (error.message?.includes("timeout") || error.message?.includes("network")) {
|
|
199
196
|
try {
|
|
200
197
|
const rawContent = await fetchRawFile(owner, repo, pathToTry, branch);
|
|
@@ -479,16 +476,19 @@ async function search(query, options) {
|
|
|
479
476
|
);
|
|
480
477
|
for (const skill of result.skills) {
|
|
481
478
|
const verified = skill.isVerified ? chalk2.green("\u2713") : " ";
|
|
482
|
-
const security = getSecurityBadge(skill.securityScore);
|
|
479
|
+
const security = skill.securityStatus ? getSecurityStatusBadge(skill.securityStatus) : getSecurityBadge(skill.securityScore);
|
|
483
480
|
console.log(
|
|
484
481
|
`${verified} ${chalk2.cyan(skill.id.padEnd(40))} ${security} \u2B50 ${formatNumber(skill.githubStars).padStart(6)} \u2B07 ${formatNumber(skill.downloadCount).padStart(6)}`
|
|
485
482
|
);
|
|
486
483
|
console.log(
|
|
487
484
|
` ${chalk2.dim(skill.description.slice(0, 70))}${skill.description.length > 70 ? "..." : ""}`
|
|
488
485
|
);
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
486
|
+
const showRating = (skill.ratingCount ?? 0) >= 3;
|
|
487
|
+
if (showRating && skill.rating) {
|
|
488
|
+
console.log(
|
|
489
|
+
` ${chalk2.yellow("\u2605")} ${skill.rating.toFixed(1)} ${chalk2.dim(`(${skill.ratingCount} ratings)`)}`
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
492
|
console.log(chalk2.dim("\u2500".repeat(80)));
|
|
493
493
|
}
|
|
494
494
|
console.log();
|
|
@@ -514,6 +514,18 @@ function formatNumber(num) {
|
|
|
514
514
|
}
|
|
515
515
|
return num.toString();
|
|
516
516
|
}
|
|
517
|
+
function getSecurityStatusBadge(status) {
|
|
518
|
+
switch (status) {
|
|
519
|
+
case "pass":
|
|
520
|
+
return chalk2.green("\u{1F6E1}\uFE0F Pass");
|
|
521
|
+
case "warning":
|
|
522
|
+
return chalk2.yellow("\u26A0\uFE0F Warn");
|
|
523
|
+
case "fail":
|
|
524
|
+
return chalk2.red("\u274C Fail");
|
|
525
|
+
default:
|
|
526
|
+
return chalk2.dim("- N/A");
|
|
527
|
+
}
|
|
528
|
+
}
|
|
517
529
|
function getSecurityBadge(score) {
|
|
518
530
|
if (score >= 90) return chalk2.green("\u25CF\u25CF\u25CF\u25CF\u25CF");
|
|
519
531
|
if (score >= 70) return chalk2.yellow("\u25CF\u25CF\u25CF\u25CF\u25CB");
|
|
@@ -531,34 +543,69 @@ var ALL_PLATFORMS = ["claude", "codex", "copilot", "cursor", "windsurf"];
|
|
|
531
543
|
async function list(options) {
|
|
532
544
|
const platforms = options.platform ? [options.platform] : ALL_PLATFORMS;
|
|
533
545
|
let totalSkills = 0;
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
546
|
+
const checkGlobal = options.all || !options.project;
|
|
547
|
+
const checkProject = options.all || options.project;
|
|
548
|
+
if (checkGlobal) {
|
|
549
|
+
for (const platform of platforms) {
|
|
550
|
+
const skills = await getInstalledSkills(platform, false);
|
|
551
|
+
if (skills.length === 0) {
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
totalSkills += skills.length;
|
|
555
|
+
const header = options.all ? `${getPlatformName2(platform)} - Global (${skills.length} skills)` : `${getPlatformName2(platform)} (${skills.length} skills)`;
|
|
556
|
+
console.log(chalk3.bold(`
|
|
557
|
+
${header}:`));
|
|
558
|
+
console.log(chalk3.dim("\u2500".repeat(60)));
|
|
559
|
+
for (const skill of skills) {
|
|
560
|
+
const version = skill.version ? chalk3.dim(`v${skill.version}`) : "";
|
|
561
|
+
console.log(` ${chalk3.cyan(skill.name.padEnd(25))} ${version}`);
|
|
562
|
+
if (skill.description) {
|
|
563
|
+
console.log(` ${chalk3.dim(skill.description.slice(0, 55))}${skill.description.length > 55 ? "..." : ""}`);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
538
566
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
567
|
+
}
|
|
568
|
+
if (checkProject) {
|
|
569
|
+
for (const platform of platforms) {
|
|
570
|
+
const skills = await getInstalledSkills(platform, true);
|
|
571
|
+
if (skills.length === 0) {
|
|
572
|
+
continue;
|
|
573
|
+
}
|
|
574
|
+
totalSkills += skills.length;
|
|
575
|
+
const header = options.all ? `${getPlatformName2(platform)} - Project (${skills.length} skills)` : `${getPlatformName2(platform)} (${skills.length} skills)`;
|
|
576
|
+
console.log(chalk3.bold(`
|
|
577
|
+
${header}:`));
|
|
578
|
+
console.log(chalk3.dim("\u2500".repeat(60)));
|
|
579
|
+
console.log(chalk3.dim(` Path: ${getSkillsPath(platform, true)}`));
|
|
580
|
+
for (const skill of skills) {
|
|
581
|
+
const version = skill.version ? chalk3.dim(`v${skill.version}`) : "";
|
|
582
|
+
console.log(` ${chalk3.cyan(skill.name.padEnd(25))} ${version}`);
|
|
583
|
+
if (skill.description) {
|
|
584
|
+
console.log(` ${chalk3.dim(skill.description.slice(0, 55))}${skill.description.length > 55 ? "..." : ""}`);
|
|
585
|
+
}
|
|
548
586
|
}
|
|
549
587
|
}
|
|
550
588
|
}
|
|
551
589
|
if (totalSkills === 0) {
|
|
552
|
-
|
|
553
|
-
|
|
590
|
+
if (options.project) {
|
|
591
|
+
console.log(chalk3.yellow("\nNo skills installed in project."));
|
|
592
|
+
console.log(chalk3.dim("Install a skill with: npx skillhub install <skill-id> --project"));
|
|
593
|
+
} else if (options.all) {
|
|
594
|
+
console.log(chalk3.yellow("\nNo skills installed (global or project)."));
|
|
595
|
+
} else {
|
|
596
|
+
console.log(chalk3.yellow("\nNo skills installed globally."));
|
|
597
|
+
console.log(chalk3.dim("Use --project to list project-level skills"));
|
|
598
|
+
console.log(chalk3.dim("Use --all to list both global and project skills"));
|
|
599
|
+
}
|
|
600
|
+
console.log(chalk3.dim("\nSearch for skills with: npx skillhub search <query>"));
|
|
554
601
|
console.log(chalk3.dim("Install a skill with: npx skillhub install <skill-id>"));
|
|
555
602
|
} else {
|
|
556
603
|
console.log(chalk3.dim(`
|
|
557
604
|
${totalSkills} total skill(s) installed.`));
|
|
558
605
|
}
|
|
559
606
|
}
|
|
560
|
-
async function getInstalledSkills(platform) {
|
|
561
|
-
const skillsPath = getSkillsPath(platform);
|
|
607
|
+
async function getInstalledSkills(platform, project = false) {
|
|
608
|
+
const skillsPath = getSkillsPath(platform, project);
|
|
562
609
|
const skills = [];
|
|
563
610
|
if (!await fs2.pathExists(skillsPath)) {
|
|
564
611
|
return skills;
|
|
@@ -674,7 +721,7 @@ program.command("install <skill-id>").description("Install a skill from the regi
|
|
|
674
721
|
program.command("search <query>").description("Search for skills in the registry").option("-p, --platform <platform>", "Filter by platform").option("-l, --limit <number>", "Number of results", "10").action(async (query, options) => {
|
|
675
722
|
await search(query, options);
|
|
676
723
|
});
|
|
677
|
-
program.command("list").description("List installed skills").option("-p, --platform <platform>", "Filter by platform").action(async (options) => {
|
|
724
|
+
program.command("list").description("List installed skills").option("-p, --platform <platform>", "Filter by platform").option("--project", "List skills in the current project").option("--all", "List both global and project skills").action(async (options) => {
|
|
678
725
|
await list(options);
|
|
679
726
|
});
|
|
680
727
|
program.command("config").description("Manage CLI configuration").option("--set <key=value>", "Set a configuration value").option("--get <key>", "Get a configuration value").option("--list", "List all configuration values").action(async (options) => {
|
package/package.json
CHANGED