skillhub 0.1.10 → 0.1.12
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 +25 -9
- 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
|
}
|
|
@@ -397,8 +396,9 @@ A different skill is already installed with the name "${actualName}":`));
|
|
|
397
396
|
spinner.text = "Installing skill...";
|
|
398
397
|
await fs.ensureDir(installPath);
|
|
399
398
|
await fs.writeFile(path.join(installPath, "SKILL.md"), content.skillMd);
|
|
399
|
+
const canonicalId = skillInfo?.id || skillId;
|
|
400
400
|
await fs.writeJson(path.join(installPath, ".skillhub.json"), {
|
|
401
|
-
skillId,
|
|
401
|
+
skillId: canonicalId,
|
|
402
402
|
installedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
403
403
|
platform: options.platform,
|
|
404
404
|
version: parsed.metadata.version || null
|
|
@@ -419,7 +419,8 @@ A different skill is already installed with the name "${actualName}":`));
|
|
|
419
419
|
await fs.writeFile(path.join(refsDir, ref.name), ref.content);
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
|
|
422
|
+
const trackingId = skillInfo?.id || skillId;
|
|
423
|
+
await trackInstall(trackingId, options.platform, "cli");
|
|
423
424
|
spinner.succeed(`Skill ${chalk.green(actualName)} installed successfully!`);
|
|
424
425
|
console.log();
|
|
425
426
|
console.log(chalk.dim(`Path: ${installPath}`));
|
|
@@ -477,16 +478,19 @@ async function search(query, options) {
|
|
|
477
478
|
);
|
|
478
479
|
for (const skill of result.skills) {
|
|
479
480
|
const verified = skill.isVerified ? chalk2.green("\u2713") : " ";
|
|
480
|
-
const security = getSecurityBadge(skill.securityScore);
|
|
481
|
+
const security = skill.securityStatus ? getSecurityStatusBadge(skill.securityStatus) : getSecurityBadge(skill.securityScore);
|
|
481
482
|
console.log(
|
|
482
483
|
`${verified} ${chalk2.cyan(skill.id.padEnd(40))} ${security} \u2B50 ${formatNumber(skill.githubStars).padStart(6)} \u2B07 ${formatNumber(skill.downloadCount).padStart(6)}`
|
|
483
484
|
);
|
|
484
485
|
console.log(
|
|
485
486
|
` ${chalk2.dim(skill.description.slice(0, 70))}${skill.description.length > 70 ? "..." : ""}`
|
|
486
487
|
);
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
488
|
+
const showRating = (skill.ratingCount ?? 0) >= 3;
|
|
489
|
+
if (showRating && skill.rating) {
|
|
490
|
+
console.log(
|
|
491
|
+
` ${chalk2.yellow("\u2605")} ${skill.rating.toFixed(1)} ${chalk2.dim(`(${skill.ratingCount} ratings)`)}`
|
|
492
|
+
);
|
|
493
|
+
}
|
|
490
494
|
console.log(chalk2.dim("\u2500".repeat(80)));
|
|
491
495
|
}
|
|
492
496
|
console.log();
|
|
@@ -512,6 +516,18 @@ function formatNumber(num) {
|
|
|
512
516
|
}
|
|
513
517
|
return num.toString();
|
|
514
518
|
}
|
|
519
|
+
function getSecurityStatusBadge(status) {
|
|
520
|
+
switch (status) {
|
|
521
|
+
case "pass":
|
|
522
|
+
return chalk2.green("\u{1F6E1}\uFE0F Pass");
|
|
523
|
+
case "warning":
|
|
524
|
+
return chalk2.yellow("\u26A0\uFE0F Warn");
|
|
525
|
+
case "fail":
|
|
526
|
+
return chalk2.red("\u274C Fail");
|
|
527
|
+
default:
|
|
528
|
+
return chalk2.dim("- N/A");
|
|
529
|
+
}
|
|
530
|
+
}
|
|
515
531
|
function getSecurityBadge(score) {
|
|
516
532
|
if (score >= 90) return chalk2.green("\u25CF\u25CF\u25CF\u25CF\u25CF");
|
|
517
533
|
if (score >= 70) return chalk2.yellow("\u25CF\u25CF\u25CF\u25CF\u25CB");
|
package/package.json
CHANGED