skillhub 0.1.10 → 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 +21 -7
- 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
|
}
|
|
@@ -477,16 +476,19 @@ async function search(query, options) {
|
|
|
477
476
|
);
|
|
478
477
|
for (const skill of result.skills) {
|
|
479
478
|
const verified = skill.isVerified ? chalk2.green("\u2713") : " ";
|
|
480
|
-
const security = getSecurityBadge(skill.securityScore);
|
|
479
|
+
const security = skill.securityStatus ? getSecurityStatusBadge(skill.securityStatus) : getSecurityBadge(skill.securityScore);
|
|
481
480
|
console.log(
|
|
482
481
|
`${verified} ${chalk2.cyan(skill.id.padEnd(40))} ${security} \u2B50 ${formatNumber(skill.githubStars).padStart(6)} \u2B07 ${formatNumber(skill.downloadCount).padStart(6)}`
|
|
483
482
|
);
|
|
484
483
|
console.log(
|
|
485
484
|
` ${chalk2.dim(skill.description.slice(0, 70))}${skill.description.length > 70 ? "..." : ""}`
|
|
486
485
|
);
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
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
|
+
}
|
|
490
492
|
console.log(chalk2.dim("\u2500".repeat(80)));
|
|
491
493
|
}
|
|
492
494
|
console.log();
|
|
@@ -512,6 +514,18 @@ function formatNumber(num) {
|
|
|
512
514
|
}
|
|
513
515
|
return num.toString();
|
|
514
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
|
+
}
|
|
515
529
|
function getSecurityBadge(score) {
|
|
516
530
|
if (score >= 90) return chalk2.green("\u25CF\u25CF\u25CF\u25CF\u25CF");
|
|
517
531
|
if (score >= 70) return chalk2.yellow("\u25CF\u25CF\u25CF\u25CF\u25CB");
|
package/package.json
CHANGED