@cantemizyurek/skillz 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.cjs CHANGED
@@ -11749,7 +11749,7 @@ program.command("whoami").description("Show current authenticated user").action(
11749
11749
  const me = await client.whoami();
11750
11750
  console.log(`${me.user.username} (${me.user.role})`);
11751
11751
  });
11752
- program.command("search").description("Search skills").argument("<query>", "search query").action(async (query, command) => {
11752
+ program.command("search").description("Search skills").argument("<query>", "search query").action(async (query, _options, command) => {
11753
11753
  const { client } = await makeClient(command, true);
11754
11754
  const result = await client.search(query);
11755
11755
  if (result.skills.length === 0) {
@@ -11758,11 +11758,13 @@ program.command("search").description("Search skills").argument("<query>", "sear
11758
11758
  }
11759
11759
  for (const skill of result.skills) {
11760
11760
  const latest = skill.latestVersion ?? "none";
11761
- console.log(`${skill.namespace}/${skill.name} latest=${latest}`);
11761
+ console.log(
11762
+ `${skill.namespace}/${skill.name} latest=${latest} downloads=${skill.downloadCount}`
11763
+ );
11762
11764
  console.log(` ${skill.description}`);
11763
11765
  }
11764
11766
  });
11765
- program.command("info").description("Show skill metadata and versions").argument("<namespace/skill>", "skill reference").action(async (skillRefInput, command) => {
11767
+ program.command("info").description("Show skill metadata and versions").argument("<namespace/skill>", "skill reference").action(async (skillRefInput, _options, command) => {
11766
11768
  namespaceNameSchema.parse(skillRefInput);
11767
11769
  const skillRef = parseSkillRef(skillRefInput);
11768
11770
  const { client } = await makeClient(command, true);
@@ -11771,6 +11773,7 @@ program.command("info").description("Show skill metadata and versions").argument
11771
11773
  console.log(`${info.skill.namespace}/${info.skill.name}`);
11772
11774
  console.log(info.skill.description);
11773
11775
  console.log(`Latest: ${info.skill.latestVersion ?? "none"}`);
11776
+ console.log(`Downloads: ${info.skill.downloadCount}`);
11774
11777
  console.log(`Versions: ${versions.versions.map((version) => version.version).join(", ") || "none"}`);
11775
11778
  });
11776
11779
  program.command("install").description("Install a skill").argument("<namespace/skill>", "skill reference").option("--version <x.y.z>", "specific version").option("--agent <agent>", "codex | claude | cursor").option("--scope <scope>", "user | project").option("--dir <path>", "custom root directory").action(async (skillRefInput, options2, command) => {
@@ -11915,8 +11918,9 @@ program.parseAsync(import_node_process.default.argv).catch((error) => {
11915
11918
  import_node_process.default.exit(1);
11916
11919
  });
11917
11920
  async function makeClient(command, requireAuth) {
11921
+ const commandContext = isCommand(command) ? command : program;
11918
11922
  const config = await loadConfig();
11919
- const registryBaseUrl = resolveRegistryBaseUrl(command, config);
11923
+ const registryBaseUrl = resolveRegistryBaseUrl(commandContext, config);
11920
11924
  const token = config.token;
11921
11925
  if (requireAuth && !token) {
11922
11926
  throw new Error("Not logged in. Run skillz login.");
@@ -11929,10 +11933,28 @@ async function makeClient(command, requireAuth) {
11929
11933
  };
11930
11934
  }
11931
11935
  function resolveRegistryBaseUrl(command, config) {
11932
- const options2 = command.optsWithGlobals() ?? {};
11936
+ const options2 = resolveGlobalOptions(command);
11933
11937
  const resolved = options2.registry ?? import_node_process.default.env.SKILLS_REGISTRY_API_URL ?? config.apiBaseUrl ?? "https://skillz-api.vercel.app";
11934
11938
  return resolved.replace(/\/$/, "");
11935
11939
  }
11940
+ function resolveGlobalOptions(command) {
11941
+ const chain = [];
11942
+ let cursor = command;
11943
+ while (cursor) {
11944
+ chain.push(cursor);
11945
+ cursor = cursor.parent;
11946
+ }
11947
+ const merged = {};
11948
+ for (const current of chain.reverse()) {
11949
+ if (typeof current.opts === "function") {
11950
+ Object.assign(merged, current.opts());
11951
+ }
11952
+ }
11953
+ return merged;
11954
+ }
11955
+ function isCommand(value) {
11956
+ return Boolean(value) && typeof value.opts === "function";
11957
+ }
11936
11958
  /*! Bundled license information:
11937
11959
 
11938
11960
  is-extendable/index.js: