@hasnatools/skills 0.1.14 → 0.1.16

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.
Files changed (2) hide show
  1. package/dist/index.js +134 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -20709,6 +20709,22 @@ async function getMarketplaceSkills(options) {
20709
20709
  const query = params.toString();
20710
20710
  return apiRequest(`/skills${query ? `?${query}` : ""}`);
20711
20711
  }
20712
+ async function getAllMarketplaceSkills() {
20713
+ const allSkills = [];
20714
+ let page = 1;
20715
+ const limit = 100;
20716
+ let totalPages = 1;
20717
+ while (page <= totalPages) {
20718
+ const result = await getMarketplaceSkills({ page, limit });
20719
+ if (result.error || !result.data) {
20720
+ return { error: result.error || "Failed to fetch skills", status: result.status };
20721
+ }
20722
+ allSkills.push(...result.data.skills);
20723
+ totalPages = result.data.pagination.totalPages;
20724
+ page++;
20725
+ }
20726
+ return { data: { skills: allSkills, total: allSkills.length }, status: 200 };
20727
+ }
20712
20728
  async function getSkill(slug) {
20713
20729
  return apiRequest(`/skills/${slug}`);
20714
20730
  }
@@ -21011,9 +21027,13 @@ async function searchCommand(query) {
21011
21027
  import { existsSync as existsSync3, writeFileSync as writeFileSync3 } from "fs";
21012
21028
  import { join as join3 } from "path";
21013
21029
  async function installCommand(slug, options = {}) {
21030
+ if (options.all) {
21031
+ return installAllSkills(options);
21032
+ }
21014
21033
  if (!slug || slug.trim() === "") {
21015
21034
  console.log(source_default.yellow("Please provide a skill name"));
21016
21035
  console.log(source_default.dim("Usage: skills install <name>"));
21036
+ console.log(source_default.dim(" skills install --all"));
21017
21037
  return;
21018
21038
  }
21019
21039
  const isLocal = options.local ?? false;
@@ -21068,6 +21088,115 @@ async function installCommand(slug, options = {}) {
21068
21088
  console.error(source_default.red(error instanceof Error ? error.message : "Unknown error"));
21069
21089
  }
21070
21090
  }
21091
+ async function installAllSkills(options) {
21092
+ const isLocal = options.local ?? false;
21093
+ const target = options.target ?? getDefaultTarget();
21094
+ const apiKey = getApiKey();
21095
+ let installDir;
21096
+ if (isLocal) {
21097
+ if (!hasLocalConfig()) {
21098
+ console.log(source_default.yellow("Not in a skills.md project"));
21099
+ console.log(source_default.dim("Run `skills init` first or install globally (default)"));
21100
+ return;
21101
+ }
21102
+ installDir = target === "claude" ? getProjectClaudeSkillsDir() : getProjectCodexSkillsDir();
21103
+ } else {
21104
+ installDir = target === "claude" ? getClaudeSkillsDir() : getCodexSkillsDir();
21105
+ }
21106
+ console.log();
21107
+ console.log(source_default.bold.cyan("╔════════════════════════════════════════════╗"));
21108
+ console.log(source_default.bold.cyan("║") + source_default.bold(" Installing All Skills") + source_default.bold.cyan(" ║"));
21109
+ console.log(source_default.bold.cyan("╚════════════════════════════════════════════╝"));
21110
+ console.log();
21111
+ const fetchSpinner = ora("Fetching skill catalog...").start();
21112
+ try {
21113
+ const result = await getAllMarketplaceSkills();
21114
+ if (result.error || !result.data) {
21115
+ fetchSpinner.fail("Failed to fetch skills");
21116
+ console.error(source_default.red(result.error || "Could not fetch skill catalog"));
21117
+ return;
21118
+ }
21119
+ const skills = result.data.skills;
21120
+ const total = skills.length;
21121
+ fetchSpinner.succeed(`Found ${source_default.bold(total)} skills in marketplace`);
21122
+ console.log();
21123
+ console.log(source_default.dim(`Target: ${source_default.bold(target)} | Scope: ${isLocal ? "project" : "global"}`));
21124
+ console.log(source_default.dim(`Install directory: ${installDir}`));
21125
+ console.log();
21126
+ const results = {
21127
+ success: [],
21128
+ failed: [],
21129
+ skipped: []
21130
+ };
21131
+ for (let i = 0;i < skills.length; i++) {
21132
+ const skill = skills[i];
21133
+ const progress = `[${String(i + 1).padStart(String(total).length, " ")}/${total}]`;
21134
+ const progressPercent = Math.round((i + 1) / total * 100);
21135
+ const barWidth = 20;
21136
+ const filled = Math.round(progressPercent / 100 * barWidth);
21137
+ const empty = barWidth - filled;
21138
+ const progressBar = source_default.green("█".repeat(filled)) + source_default.gray("░".repeat(empty));
21139
+ process.stdout.write(`\r${source_default.dim(progress)} ${progressBar} ${source_default.dim(`${progressPercent}%`)} Installing ${source_default.cyan(skill.slug)}...`);
21140
+ process.stdout.write("\x1B[K");
21141
+ try {
21142
+ const skillResult = await installSkill(skill.slug);
21143
+ if (skillResult.error || !skillResult.data) {
21144
+ results.failed.push({ slug: skill.slug, error: skillResult.error || "Not found" });
21145
+ continue;
21146
+ }
21147
+ const skillData = skillResult.data;
21148
+ const skillDir = join3(installDir, `skill-${skill.slug}`);
21149
+ const exportsDir = join3(skillDir, "exports");
21150
+ const logsDir = join3(skillDir, "logs");
21151
+ ensureSkillsDir(skillDir);
21152
+ ensureSkillsDir(exportsDir);
21153
+ ensureSkillsDir(logsDir);
21154
+ writeFileSync3(join3(skillDir, "SKILL.md"), skillData.skillMdContent);
21155
+ if (apiKey) {
21156
+ try {
21157
+ await installSkillRemote(skill.slug);
21158
+ } catch {}
21159
+ }
21160
+ results.success.push(skill.slug);
21161
+ } catch (error) {
21162
+ results.failed.push({
21163
+ slug: skill.slug,
21164
+ error: error instanceof Error ? error.message : "Unknown error"
21165
+ });
21166
+ }
21167
+ }
21168
+ process.stdout.write("\r\x1B[K");
21169
+ console.log();
21170
+ console.log(source_default.bold.cyan("╔════════════════════════════════════════════╗"));
21171
+ console.log(source_default.bold.cyan("║") + source_default.bold(" Installation Complete") + source_default.bold.cyan(" ║"));
21172
+ console.log(source_default.bold.cyan("╚════════════════════════════════════════════╝"));
21173
+ console.log();
21174
+ if (results.success.length > 0) {
21175
+ console.log(source_default.green("✓") + ` Successfully installed: ${source_default.bold.green(results.success.length)} skills`);
21176
+ }
21177
+ if (results.failed.length > 0) {
21178
+ console.log(source_default.red("✗") + ` Failed to install: ${source_default.bold.red(results.failed.length)} skills`);
21179
+ console.log();
21180
+ console.log(source_default.dim("Failed skills:"));
21181
+ for (const fail of results.failed.slice(0, 10)) {
21182
+ console.log(source_default.red(` • ${fail.slug}: ${fail.error}`));
21183
+ }
21184
+ if (results.failed.length > 10) {
21185
+ console.log(source_default.dim(` ... and ${results.failed.length - 10} more`));
21186
+ }
21187
+ }
21188
+ console.log();
21189
+ console.log(source_default.dim("Installation directory:"));
21190
+ console.log(` ${source_default.cyan(installDir)}`);
21191
+ console.log();
21192
+ console.log(source_default.dim("Run any skill with:"));
21193
+ console.log(` ${source_default.cyan('skills run <skill-name> -- "your prompt"')}`);
21194
+ console.log();
21195
+ } catch (error) {
21196
+ fetchSpinner.fail("Installation failed");
21197
+ console.error(source_default.red(error instanceof Error ? error.message : "Unknown error"));
21198
+ }
21199
+ }
21071
21200
  async function uninstallCommand(slug, options = {}) {
21072
21201
  if (!slug || slug.trim() === "") {
21073
21202
  console.log(source_default.yellow("Please provide a skill name"));
@@ -22924,7 +23053,7 @@ async function doctorCommand() {
22924
23053
  // src/index.ts
22925
23054
  var indigo12 = source_default.hex("#6366f1");
22926
23055
  var program2 = new Command;
22927
- program2.name("skills").description("CLI for skills.md - AI Agent Skills Marketplace").version("0.1.14");
23056
+ program2.name("skills").description("CLI for skills.md - AI Agent Skills Marketplace").version("0.1.16");
22928
23057
  program2.command("init").description("Initialize skills.md in current project").option("-f, --force", "Force re-initialization (removes existing .skills/)").action((options) => {
22929
23058
  initCommand({ force: options.force });
22930
23059
  });
@@ -22941,10 +23070,11 @@ program2.command("marketplace").alias("market").description("Browse skills from
22941
23070
  category: options.category
22942
23071
  });
22943
23072
  });
22944
- 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) => {
22945
- installCommand(name, {
23073
+ program2.command("install [name]").alias("i").description("Install a skill or all skills (global by default)").option("-l, --local", "Install to current project instead of global").option("-t, --target <target>", "Target platform (claude, codex)").option("-a, --all", "Install all skills from marketplace").action((name, options) => {
23074
+ installCommand(name || "", {
22946
23075
  local: options.local,
22947
- target: options.target
23076
+ target: options.target,
23077
+ all: options.all
22948
23078
  });
22949
23079
  });
22950
23080
  program2.command("uninstall <name>").alias("remove").description("Uninstall a skill (global by default)").option("-l, --local", "Uninstall from current project instead of global").option("-t, --target <target>", "Target platform (claude, codex)").action((name, options) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasnatools/skills",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "CLI for skills.md - AI Agent Skills Marketplace",
5
5
  "type": "module",
6
6
  "bin": {