skillhub 0.1.13 → 0.1.14
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 +23 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -101,7 +101,8 @@ async function searchSkills(query, options = {}) {
|
|
|
101
101
|
const params = new URLSearchParams({
|
|
102
102
|
q: query,
|
|
103
103
|
limit: String(options.limit || 10),
|
|
104
|
-
page: String(options.page || 1)
|
|
104
|
+
page: String(options.page || 1),
|
|
105
|
+
sort: options.sort || "downloads"
|
|
105
106
|
});
|
|
106
107
|
if (options.platform) {
|
|
107
108
|
params.set("platform", options.platform);
|
|
@@ -540,9 +541,13 @@ async function search(query, options) {
|
|
|
540
541
|
const spinner = ora2("Searching skills...").start();
|
|
541
542
|
try {
|
|
542
543
|
const limit = parseInt(options.limit || "10");
|
|
544
|
+
const page = parseInt(options.page || "1");
|
|
545
|
+
const sort = options.sort || "downloads";
|
|
543
546
|
const result = await searchSkills(query, {
|
|
544
547
|
platform: options.platform,
|
|
545
|
-
limit
|
|
548
|
+
limit,
|
|
549
|
+
page,
|
|
550
|
+
sort
|
|
546
551
|
});
|
|
547
552
|
spinner.stop();
|
|
548
553
|
if (result.skills.length === 0) {
|
|
@@ -550,35 +555,43 @@ async function search(query, options) {
|
|
|
550
555
|
console.log(chalk2.dim("Try a different search term or check the spelling."));
|
|
551
556
|
return;
|
|
552
557
|
}
|
|
553
|
-
|
|
558
|
+
const sortLabel = { downloads: "downloads", stars: "GitHub stars", rating: "rating", recent: "recently updated" }[sort] || sort;
|
|
559
|
+
console.log(chalk2.bold(`Found ${result.pagination.total} skills (sorted by ${sortLabel}):
|
|
554
560
|
`));
|
|
555
561
|
console.log(
|
|
556
562
|
chalk2.dim("\u2500".repeat(80))
|
|
557
563
|
);
|
|
558
|
-
|
|
564
|
+
const startIndex = (page - 1) * limit;
|
|
565
|
+
for (let i = 0; i < result.skills.length; i++) {
|
|
566
|
+
const skill = result.skills[i];
|
|
567
|
+
const num = chalk2.dim(`[${startIndex + i + 1}]`);
|
|
559
568
|
const verified = skill.isVerified ? chalk2.green("\u2713") : " ";
|
|
560
569
|
const security = skill.securityStatus ? getSecurityStatusBadge(skill.securityStatus) : getSecurityBadge(skill.securityScore);
|
|
561
570
|
console.log(
|
|
562
|
-
`${verified} ${chalk2.cyan(skill.id.padEnd(
|
|
571
|
+
`${num} ${verified} ${chalk2.cyan(skill.id.padEnd(38))} ${security}`
|
|
563
572
|
);
|
|
564
573
|
console.log(
|
|
565
|
-
` ${chalk2.dim(skill.description.slice(0,
|
|
574
|
+
` \u2B07 ${formatNumber(skill.downloadCount).padStart(6)} \u2B50 ${formatNumber(skill.githubStars).padStart(6)} ${chalk2.dim(skill.description.slice(0, 55))}${skill.description.length > 55 ? "..." : ""}`
|
|
566
575
|
);
|
|
567
576
|
const showRating = (skill.ratingCount ?? 0) >= 3;
|
|
568
577
|
if (showRating && skill.rating) {
|
|
569
578
|
console.log(
|
|
570
|
-
`
|
|
579
|
+
` ${chalk2.yellow("\u2605")} ${skill.rating.toFixed(1)} ${chalk2.dim(`(${skill.ratingCount} ratings)`)}`
|
|
571
580
|
);
|
|
572
581
|
}
|
|
573
582
|
console.log(chalk2.dim("\u2500".repeat(80)));
|
|
574
583
|
}
|
|
575
584
|
console.log();
|
|
576
585
|
console.log(chalk2.dim(`Install with: ${chalk2.white("npx skillhub install <skill-id>")}`));
|
|
577
|
-
|
|
586
|
+
const totalPages = result.pagination.totalPages;
|
|
587
|
+
if (totalPages > 1) {
|
|
578
588
|
console.log(
|
|
579
|
-
chalk2.dim(`
|
|
589
|
+
chalk2.dim(`Page ${page} of ${totalPages}. Use ${chalk2.white(`--page ${page + 1}`)} for next page.`)
|
|
580
590
|
);
|
|
581
591
|
}
|
|
592
|
+
if (sort === "downloads") {
|
|
593
|
+
console.log(chalk2.dim(`Sort options: ${chalk2.white("--sort stars|rating|recent")}`));
|
|
594
|
+
}
|
|
582
595
|
} catch (error) {
|
|
583
596
|
spinner.fail("Search failed");
|
|
584
597
|
const err = error;
|
|
@@ -799,7 +812,7 @@ program.command("install <skill-id>").description("Install a skill from the regi
|
|
|
799
812
|
// Commander converts --no-api to api: false
|
|
800
813
|
});
|
|
801
814
|
});
|
|
802
|
-
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) => {
|
|
815
|
+
program.command("search <query>").description("Search for skills in the registry").option("-p, --platform <platform>", "Filter by platform").option("-s, --sort <sort>", "Sort by: downloads, stars, rating, recent", "downloads").option("-l, --limit <number>", "Number of results", "10").option("--page <number>", "Page number", "1").action(async (query, options) => {
|
|
803
816
|
await search(query, options);
|
|
804
817
|
});
|
|
805
818
|
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) => {
|
package/package.json
CHANGED