@hasnatools/skills 0.1.1 → 0.1.3
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 +73 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20698,6 +20698,17 @@ async function apiRequest(path6, options = {}) {
|
|
|
20698
20698
|
async function searchSkills(query) {
|
|
20699
20699
|
return apiRequest(`/skills?q=${encodeURIComponent(query)}`);
|
|
20700
20700
|
}
|
|
20701
|
+
async function getMarketplaceSkills(options) {
|
|
20702
|
+
const params = new URLSearchParams;
|
|
20703
|
+
if (options?.limit)
|
|
20704
|
+
params.set("limit", options.limit.toString());
|
|
20705
|
+
if (options?.offset)
|
|
20706
|
+
params.set("offset", options.offset.toString());
|
|
20707
|
+
if (options?.category)
|
|
20708
|
+
params.set("category", options.category);
|
|
20709
|
+
const query = params.toString();
|
|
20710
|
+
return apiRequest(`/skills${query ? `?${query}` : ""}`);
|
|
20711
|
+
}
|
|
20701
20712
|
async function installSkill(slug) {
|
|
20702
20713
|
return apiRequest(`/skills/${slug}/install`);
|
|
20703
20714
|
}
|
|
@@ -21887,6 +21898,58 @@ function formatBytes(bytes) {
|
|
|
21887
21898
|
}
|
|
21888
21899
|
}
|
|
21889
21900
|
|
|
21901
|
+
// src/commands/marketplace.ts
|
|
21902
|
+
async function marketplaceCommand(options = {}) {
|
|
21903
|
+
const spinner = ora("Fetching skills from marketplace...").start();
|
|
21904
|
+
const limit = options.limit || 20;
|
|
21905
|
+
const page = options.page || 1;
|
|
21906
|
+
const offset = (page - 1) * limit;
|
|
21907
|
+
const result = await getMarketplaceSkills({
|
|
21908
|
+
limit,
|
|
21909
|
+
offset,
|
|
21910
|
+
category: options.category
|
|
21911
|
+
});
|
|
21912
|
+
if (result.error || !result.data) {
|
|
21913
|
+
spinner.fail("Failed to fetch marketplace");
|
|
21914
|
+
console.error(source_default.red(result.error || "Unknown error"));
|
|
21915
|
+
return;
|
|
21916
|
+
}
|
|
21917
|
+
const skills = result.data.skills;
|
|
21918
|
+
const total = result.data.total;
|
|
21919
|
+
const totalPages = Math.ceil(total / limit);
|
|
21920
|
+
spinner.stop();
|
|
21921
|
+
if (skills.length === 0) {
|
|
21922
|
+
console.log(source_default.dim("No skills found in marketplace"));
|
|
21923
|
+
return;
|
|
21924
|
+
}
|
|
21925
|
+
console.log();
|
|
21926
|
+
console.log(source_default.bold(`Skills Marketplace`) + source_default.dim(` (page ${page}/${totalPages}, ${total} total skills)`));
|
|
21927
|
+
console.log();
|
|
21928
|
+
for (const skill of skills) {
|
|
21929
|
+
const verified = skill.isVerified ? source_default.blue(" ✓") : "";
|
|
21930
|
+
const downloads = skill.downloadCount > 0 ? source_default.dim(` (${skill.downloadCount} installs)`) : "";
|
|
21931
|
+
console.log(" " + source_default.bold(skill.name) + verified + source_default.dim(` v${skill.version}`) + downloads);
|
|
21932
|
+
console.log(" " + source_default.dim(skill.description || "No description"));
|
|
21933
|
+
console.log(" " + source_default.cyan(`skills install ${skill.slug}`));
|
|
21934
|
+
console.log();
|
|
21935
|
+
}
|
|
21936
|
+
console.log(source_default.dim("─".repeat(50)));
|
|
21937
|
+
if (totalPages > 1) {
|
|
21938
|
+
const navHints = [];
|
|
21939
|
+
if (page > 1) {
|
|
21940
|
+
navHints.push(`${source_default.cyan(`skills marketplace -p ${page - 1}`)} for previous`);
|
|
21941
|
+
}
|
|
21942
|
+
if (page < totalPages) {
|
|
21943
|
+
navHints.push(`${source_default.cyan(`skills marketplace -p ${page + 1}`)} for next`);
|
|
21944
|
+
}
|
|
21945
|
+
if (navHints.length > 0) {
|
|
21946
|
+
console.log(source_default.dim(navHints.join(" | ")));
|
|
21947
|
+
}
|
|
21948
|
+
}
|
|
21949
|
+
console.log(source_default.dim(`Run ${source_default.cyan("skills install <name>")} to install a skill`));
|
|
21950
|
+
console.log(source_default.dim(`Run ${source_default.cyan("skills search <query>")} to search for specific skills`));
|
|
21951
|
+
}
|
|
21952
|
+
|
|
21890
21953
|
// src/index.ts
|
|
21891
21954
|
var program2 = new Command;
|
|
21892
21955
|
program2.name("skills").description("CLI for skills.md - AI Agent Skills Marketplace").version("0.1.0");
|
|
@@ -21899,6 +21962,13 @@ program2.command("login").description("Authenticate with skills.md").option("-k,
|
|
|
21899
21962
|
program2.command("logout").description("Log out of skills.md").action(logoutCommand);
|
|
21900
21963
|
program2.command("whoami").description("Show current user info").action(whoamiCommand);
|
|
21901
21964
|
program2.command("search <query>").description("Search for skills").action(searchCommand);
|
|
21965
|
+
program2.command("marketplace").alias("market").description("Browse skills from the marketplace").option("-l, --limit <number>", "Number of skills per page", "20").option("-p, --page <number>", "Page number", "1").option("-c, --category <category>", "Filter by category").action((options) => {
|
|
21966
|
+
marketplaceCommand({
|
|
21967
|
+
limit: parseInt(options.limit, 10),
|
|
21968
|
+
page: parseInt(options.page, 10),
|
|
21969
|
+
category: options.category
|
|
21970
|
+
});
|
|
21971
|
+
});
|
|
21902
21972
|
program2.command("install <name>").alias("i").description("Install a skill (global by default)").option("-l, --local", "Install to current project instead of global").option("-t, --target <target>", "Target platform (claude, codex)").action((name, options) => {
|
|
21903
21973
|
installCommand(name, {
|
|
21904
21974
|
local: options.local,
|
|
@@ -21963,6 +22033,9 @@ ${source_default.bold("Examples:")}
|
|
|
21963
22033
|
${source_default.dim("# Login to your account")}
|
|
21964
22034
|
$ skills login
|
|
21965
22035
|
|
|
22036
|
+
${source_default.dim("# Browse the marketplace")}
|
|
22037
|
+
$ skills marketplace
|
|
22038
|
+
|
|
21966
22039
|
${source_default.dim("# Search for skills")}
|
|
21967
22040
|
$ skills search code review
|
|
21968
22041
|
|