@hasnatools/skills 0.1.16 → 0.1.18

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 +161 -77
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -21026,14 +21026,98 @@ async function searchCommand(query) {
21026
21026
  // src/commands/install.ts
21027
21027
  import { existsSync as existsSync3, writeFileSync as writeFileSync3 } from "fs";
21028
21028
  import { join as join3 } from "path";
21029
+
21030
+ // src/lib/theme.ts
21031
+ var colors = {
21032
+ primary: source_default.hex("#6366f1"),
21033
+ primaryBold: source_default.hex("#6366f1").bold,
21034
+ primaryDim: source_default.hex("#818cf8"),
21035
+ primaryBg: source_default.bgHex("#6366f1").white.bold,
21036
+ primaryBgDim: source_default.bgHex("#4f46e5").white,
21037
+ secondary: source_default.hex("#64748b"),
21038
+ secondaryBold: source_default.hex("#64748b").bold,
21039
+ success: source_default.hex("#22c55e"),
21040
+ successBold: source_default.hex("#22c55e").bold,
21041
+ warning: source_default.hex("#eab308"),
21042
+ warningBold: source_default.hex("#eab308").bold,
21043
+ error: source_default.hex("#ef4444"),
21044
+ errorBold: source_default.hex("#ef4444").bold,
21045
+ info: source_default.hex("#3b82f6"),
21046
+ infoBold: source_default.hex("#3b82f6").bold,
21047
+ dim: source_default.dim,
21048
+ bold: source_default.bold,
21049
+ white: source_default.white,
21050
+ gray: source_default.gray,
21051
+ highlight: source_default.hex("#a78bfa"),
21052
+ link: source_default.hex("#60a5fa").underline,
21053
+ code: source_default.hex("#f472b6")
21054
+ };
21055
+ var symbols = {
21056
+ success: colors.success("✓"),
21057
+ error: colors.error("✗"),
21058
+ warning: colors.warning("!"),
21059
+ info: colors.info("i"),
21060
+ arrow: colors.primary("→"),
21061
+ bullet: colors.dim("•"),
21062
+ star: colors.warning("★"),
21063
+ check: colors.success("✓"),
21064
+ cross: colors.error("✗"),
21065
+ pointer: colors.primary("❯")
21066
+ };
21067
+ function header(text, width = 50) {
21068
+ const padding = Math.max(0, width - text.length - 2);
21069
+ const leftPad = Math.floor(padding / 2);
21070
+ const rightPad = padding - leftPad;
21071
+ const paddedText = " ".repeat(leftPad) + text + " ".repeat(rightPad);
21072
+ return colors.primaryBg(` ${paddedText} `);
21073
+ }
21074
+ function keyValue(key, value, keyWidth = 15) {
21075
+ const paddedKey = key.padEnd(keyWidth);
21076
+ return `${colors.dim(paddedKey)} ${value}`;
21077
+ }
21078
+ function successItem(text, indent = 0) {
21079
+ return " ".repeat(indent) + symbols.success + " " + text;
21080
+ }
21081
+ function errorItem(text, indent = 0) {
21082
+ return " ".repeat(indent) + symbols.error + " " + text;
21083
+ }
21084
+ function command(cmd) {
21085
+ return colors.code(cmd);
21086
+ }
21087
+ function path6(p) {
21088
+ return colors.highlight(p);
21089
+ }
21090
+ function skillName(name) {
21091
+ return colors.primaryBold(name);
21092
+ }
21093
+ function count(n) {
21094
+ return colors.primaryBold(String(n));
21095
+ }
21096
+ function progressBar(percent, width = 20) {
21097
+ const filled = Math.round(percent / 100 * width);
21098
+ const empty = width - filled;
21099
+ return colors.primary("█".repeat(filled)) + colors.dim("░".repeat(empty));
21100
+ }
21101
+ function banner(title) {
21102
+ console.log();
21103
+ console.log(header(title));
21104
+ console.log();
21105
+ }
21106
+ function completionBanner(title) {
21107
+ console.log();
21108
+ console.log(header(title));
21109
+ console.log();
21110
+ }
21111
+
21112
+ // src/commands/install.ts
21029
21113
  async function installCommand(slug, options = {}) {
21030
21114
  if (options.all) {
21031
21115
  return installAllSkills(options);
21032
21116
  }
21033
21117
  if (!slug || slug.trim() === "") {
21034
- console.log(source_default.yellow("Please provide a skill name"));
21035
- console.log(source_default.dim("Usage: skills install <name>"));
21036
- console.log(source_default.dim(" skills install --all"));
21118
+ console.log(colors.warning("Please provide a skill name"));
21119
+ console.log(colors.dim("Usage: skills install <name>"));
21120
+ console.log(colors.dim(" skills install --all"));
21037
21121
  return;
21038
21122
  }
21039
21123
  const isLocal = options.local ?? false;
@@ -21042,20 +21126,23 @@ async function installCommand(slug, options = {}) {
21042
21126
  let installDir;
21043
21127
  if (isLocal) {
21044
21128
  if (!hasLocalConfig()) {
21045
- console.log(source_default.yellow("Not in a skills.md project"));
21046
- console.log(source_default.dim("Run `skills init` first or install globally (default)"));
21129
+ console.log(colors.warning("Not in a skills.md project"));
21130
+ console.log(colors.dim("Run `skills init` first or install globally (default)"));
21047
21131
  return;
21048
21132
  }
21049
21133
  installDir = target === "claude" ? getProjectClaudeSkillsDir() : getProjectCodexSkillsDir();
21050
21134
  } else {
21051
21135
  installDir = target === "claude" ? getClaudeSkillsDir() : getCodexSkillsDir();
21052
21136
  }
21053
- const spinner = ora(`Fetching skill "${slug}"...`).start();
21137
+ const spinner = ora({
21138
+ text: `Fetching skill "${slug}"...`,
21139
+ color: "magenta"
21140
+ }).start();
21054
21141
  try {
21055
21142
  const skillResult = await installSkill(slug);
21056
21143
  if (skillResult.error || !skillResult.data) {
21057
- spinner.fail("Skill not found");
21058
- console.error(source_default.red(skillResult.error || `Could not find skill: ${slug}`));
21144
+ spinner.fail(colors.error("Skill not found"));
21145
+ console.error(colors.error(skillResult.error || `Could not find skill: ${slug}`));
21059
21146
  return;
21060
21147
  }
21061
21148
  const skill = skillResult.data;
@@ -21070,22 +21157,22 @@ async function installCommand(slug, options = {}) {
21070
21157
  if (apiKey) {
21071
21158
  await installSkillRemote(slug);
21072
21159
  }
21073
- spinner.succeed(`Installed ${source_default.bold(skill.name)} v${skill.version}`);
21160
+ spinner.succeed(colors.success(`Installed ${skillName(skill.name)} v${skill.version}`));
21074
21161
  console.log();
21075
- console.log(source_default.green("✓") + ` Installed to ${source_default.dim(skillDir)}`);
21076
- console.log(source_default.green("✓") + ` Created exports/ directory`);
21077
- console.log(source_default.green("✓") + ` Created logs/ directory`);
21078
- console.log(source_default.green("✓") + ` Target: ${source_default.bold(target)}`);
21079
- console.log(source_default.green("✓") + ` Scope: ${isLocal ? "project" : "global"}`);
21162
+ console.log(successItem(`Installed to ${path6(skillDir)}`));
21163
+ console.log(successItem("Created exports/ directory"));
21164
+ console.log(successItem("Created logs/ directory"));
21165
+ console.log(successItem(`Target: ${colors.primaryBold(target)}`));
21166
+ console.log(successItem(`Scope: ${colors.primaryBold(isLocal ? "project" : "global")}`));
21080
21167
  console.log();
21081
- console.log(source_default.dim("Usage:"));
21082
- console.log(` skills run ${slug} -- "your prompt or args"`);
21168
+ console.log(colors.dim("Usage:"));
21169
+ console.log(` ${command(`skills run ${slug} -- "your prompt or args"`)}`);
21083
21170
  console.log();
21084
- console.log(source_default.dim("Skill execution happens remotely via API."));
21085
- console.log(source_default.dim("Exports will be saved to: ") + source_default.cyan(`${skillDir}/exports/`));
21171
+ console.log(colors.dim("Skill execution happens remotely via API."));
21172
+ console.log(colors.dim("Exports will be saved to: ") + path6(`${skillDir}/exports/`));
21086
21173
  } catch (error) {
21087
- spinner.fail("Installation failed");
21088
- console.error(source_default.red(error instanceof Error ? error.message : "Unknown error"));
21174
+ spinner.fail(colors.error("Installation failed"));
21175
+ console.error(colors.error(error instanceof Error ? error.message : "Unknown error"));
21089
21176
  }
21090
21177
  }
21091
21178
  async function installAllSkills(options) {
@@ -21095,33 +21182,33 @@ async function installAllSkills(options) {
21095
21182
  let installDir;
21096
21183
  if (isLocal) {
21097
21184
  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)"));
21185
+ console.log(colors.warning("Not in a skills.md project"));
21186
+ console.log(colors.dim("Run `skills init` first or install globally (default)"));
21100
21187
  return;
21101
21188
  }
21102
21189
  installDir = target === "claude" ? getProjectClaudeSkillsDir() : getProjectCodexSkillsDir();
21103
21190
  } else {
21104
21191
  installDir = target === "claude" ? getClaudeSkillsDir() : getCodexSkillsDir();
21105
21192
  }
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();
21193
+ banner("Installing All Skills");
21194
+ const fetchSpinner = ora({
21195
+ text: "Fetching skill catalog...",
21196
+ color: "magenta"
21197
+ }).start();
21112
21198
  try {
21113
21199
  const result = await getAllMarketplaceSkills();
21114
21200
  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"));
21201
+ fetchSpinner.fail(colors.error("Failed to fetch skills"));
21202
+ console.error(colors.error(result.error || "Could not fetch skill catalog"));
21117
21203
  return;
21118
21204
  }
21119
21205
  const skills = result.data.skills;
21120
21206
  const total = skills.length;
21121
- fetchSpinner.succeed(`Found ${source_default.bold(total)} skills in marketplace`);
21207
+ fetchSpinner.succeed(colors.success(`Found ${count(total)} skills in marketplace`));
21122
21208
  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}`));
21209
+ console.log(keyValue("Target", colors.primaryBold(target)));
21210
+ console.log(keyValue("Scope", colors.primaryBold(isLocal ? "project" : "global")));
21211
+ console.log(keyValue("Directory", path6(installDir)));
21125
21212
  console.log();
21126
21213
  const results = {
21127
21214
  success: [],
@@ -21130,13 +21217,11 @@ async function installAllSkills(options) {
21130
21217
  };
21131
21218
  for (let i = 0;i < skills.length; i++) {
21132
21219
  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)}...`);
21220
+ const current = i + 1;
21221
+ const percent = Math.round(current / total * 100);
21222
+ const padWidth = String(total).length;
21223
+ const progress = `[${String(current).padStart(padWidth, " ")}/${total}]`;
21224
+ process.stdout.write(`\r${colors.dim(progress)} ${progressBar(percent)} ${colors.dim(`${percent}%`)} Installing ${colors.primary(skill.slug)}...`);
21140
21225
  process.stdout.write("\x1B[K");
21141
21226
  try {
21142
21227
  const skillResult = await installSkill(skill.slug);
@@ -21166,41 +21251,37 @@ async function installAllSkills(options) {
21166
21251
  }
21167
21252
  }
21168
21253
  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();
21254
+ completionBanner("Installation Complete");
21174
21255
  if (results.success.length > 0) {
21175
- console.log(source_default.green("✓") + ` Successfully installed: ${source_default.bold.green(results.success.length)} skills`);
21256
+ console.log(successItem(`Successfully installed: ${colors.successBold(String(results.success.length))} skills`));
21176
21257
  }
21177
21258
  if (results.failed.length > 0) {
21178
- console.log(source_default.red("✗") + ` Failed to install: ${source_default.bold.red(results.failed.length)} skills`);
21259
+ console.log(errorItem(`Failed to install: ${colors.errorBold(String(results.failed.length))} skills`));
21179
21260
  console.log();
21180
- console.log(source_default.dim("Failed skills:"));
21261
+ console.log(colors.dim("Failed skills:"));
21181
21262
  for (const fail of results.failed.slice(0, 10)) {
21182
- console.log(source_default.red(` ${fail.slug}: ${fail.error}`));
21263
+ console.log(colors.error(` ${symbols.bullet} ${fail.slug}: ${fail.error}`));
21183
21264
  }
21184
21265
  if (results.failed.length > 10) {
21185
- console.log(source_default.dim(` ... and ${results.failed.length - 10} more`));
21266
+ console.log(colors.dim(` ... and ${results.failed.length - 10} more`));
21186
21267
  }
21187
21268
  }
21188
21269
  console.log();
21189
- console.log(source_default.dim("Installation directory:"));
21190
- console.log(` ${source_default.cyan(installDir)}`);
21270
+ console.log(colors.dim("Installation directory:"));
21271
+ console.log(` ${path6(installDir)}`);
21191
21272
  console.log();
21192
- console.log(source_default.dim("Run any skill with:"));
21193
- console.log(` ${source_default.cyan('skills run <skill-name> -- "your prompt"')}`);
21273
+ console.log(colors.dim("Run any skill with:"));
21274
+ console.log(` ${command('skills run <skill-name> -- "your prompt"')}`);
21194
21275
  console.log();
21195
21276
  } catch (error) {
21196
- fetchSpinner.fail("Installation failed");
21197
- console.error(source_default.red(error instanceof Error ? error.message : "Unknown error"));
21277
+ fetchSpinner.fail(colors.error("Installation failed"));
21278
+ console.error(colors.error(error instanceof Error ? error.message : "Unknown error"));
21198
21279
  }
21199
21280
  }
21200
21281
  async function uninstallCommand(slug, options = {}) {
21201
21282
  if (!slug || slug.trim() === "") {
21202
- console.log(source_default.yellow("Please provide a skill name"));
21203
- console.log(source_default.dim("Usage: skills uninstall <name>"));
21283
+ console.log(colors.warning("Please provide a skill name"));
21284
+ console.log(colors.dim("Usage: skills uninstall <name>"));
21204
21285
  return;
21205
21286
  }
21206
21287
  const isLocal = options.local ?? false;
@@ -21208,8 +21289,8 @@ async function uninstallCommand(slug, options = {}) {
21208
21289
  let installDir;
21209
21290
  if (isLocal) {
21210
21291
  if (!hasLocalConfig()) {
21211
- console.log(source_default.yellow("Not in a skills.md project"));
21212
- console.log(source_default.dim("Run `skills init` first or uninstall from global (default)"));
21292
+ console.log(colors.warning("Not in a skills.md project"));
21293
+ console.log(colors.dim("Run `skills init` first or uninstall from global (default)"));
21213
21294
  return;
21214
21295
  }
21215
21296
  installDir = target === "claude" ? getProjectClaudeSkillsDir() : getProjectCodexSkillsDir();
@@ -21220,20 +21301,23 @@ async function uninstallCommand(slug, options = {}) {
21220
21301
  if (!existsSync3(skillDir)) {
21221
21302
  const oldSkillDir = join3(installDir, slug);
21222
21303
  if (!existsSync3(oldSkillDir)) {
21223
- console.log(source_default.yellow(`Skill "${slug}" is not installed`));
21304
+ console.log(colors.warning(`Skill "${slug}" is not installed`));
21224
21305
  return;
21225
21306
  }
21226
21307
  }
21227
- const spinner = ora(`Uninstalling "${slug}"...`).start();
21308
+ const spinner = ora({
21309
+ text: `Uninstalling "${slug}"...`,
21310
+ color: "magenta"
21311
+ }).start();
21228
21312
  try {
21229
21313
  const { rmSync: rmSync2 } = await import("fs");
21230
21314
  rmSync2(skillDir, { recursive: true, force: true });
21231
- spinner.succeed(`Uninstalled ${source_default.bold(slug)}`);
21315
+ spinner.succeed(colors.success(`Uninstalled ${skillName(slug)}`));
21232
21316
  console.log();
21233
- console.log(source_default.green("✓") + ` Removed from ${source_default.dim(skillDir)}`);
21317
+ console.log(successItem(`Removed from ${path6(skillDir)}`));
21234
21318
  } catch (error) {
21235
- spinner.fail("Uninstallation failed");
21236
- console.error(source_default.red(error instanceof Error ? error.message : "Unknown error"));
21319
+ spinner.fail(colors.error("Uninstallation failed"));
21320
+ console.error(colors.error(error instanceof Error ? error.message : "Unknown error"));
21237
21321
  }
21238
21322
  }
21239
21323
 
@@ -21597,8 +21681,8 @@ async function targetCommand(target) {
21597
21681
  setDefaultTarget(target);
21598
21682
  console.log(source_default.green("✓") + ` Default target set to ${source_default.bold(target)}`);
21599
21683
  }
21600
- function getNestedValue(obj, path6) {
21601
- const keys = path6.split(".");
21684
+ function getNestedValue(obj, path7) {
21685
+ const keys = path7.split(".");
21602
21686
  let current = obj;
21603
21687
  for (const key of keys) {
21604
21688
  if (current === null || current === undefined)
@@ -21920,14 +22004,14 @@ var LOCAL_SKILLS = {
21920
22004
  video: "generate-video",
21921
22005
  audio: "generate-audio"
21922
22006
  };
21923
- function findLocalSkill(skillName) {
21924
- const globalDir = join7(homedir3(), ".claude", "skills", skillName);
22007
+ function findLocalSkill(skillName2) {
22008
+ const globalDir = join7(homedir3(), ".claude", "skills", skillName2);
21925
22009
  if (existsSync7(globalDir)) {
21926
22010
  return globalDir;
21927
22011
  }
21928
22012
  const projectRoot = findProjectRoot();
21929
22013
  if (projectRoot) {
21930
- const projectDir = join7(projectRoot, ".claude", "skills", skillName);
22014
+ const projectDir = join7(projectRoot, ".claude", "skills", skillName2);
21931
22015
  if (existsSync7(projectDir)) {
21932
22016
  return projectDir;
21933
22017
  }
@@ -22782,7 +22866,7 @@ function parseFrontmatter2(content) {
22782
22866
  }
22783
22867
  return result;
22784
22868
  }
22785
- async function updateCommand(skillName, options = {}) {
22869
+ async function updateCommand(skillName2, options = {}) {
22786
22870
  const target = options.target ?? getDefaultTarget();
22787
22871
  const skillsDir = target === "claude" ? getClaudeSkillsDir() : getCodexSkillsDir();
22788
22872
  if (!existsSync9(skillsDir)) {
@@ -22801,7 +22885,7 @@ async function updateCommand(skillName, options = {}) {
22801
22885
  const content = readFileSync5(skillMdPath, "utf-8");
22802
22886
  const frontmatter = parseFrontmatter2(content);
22803
22887
  const slug = entry.name.replace("skill-", "");
22804
- if (skillName && slug !== skillName && frontmatter.name !== skillName) {
22888
+ if (skillName2 && slug !== skillName2 && frontmatter.name !== skillName2) {
22805
22889
  continue;
22806
22890
  }
22807
22891
  installedSkills.push({
@@ -22812,8 +22896,8 @@ async function updateCommand(skillName, options = {}) {
22812
22896
  });
22813
22897
  }
22814
22898
  if (installedSkills.length === 0) {
22815
- if (skillName) {
22816
- console.log(source_default.yellow(`Skill "${skillName}" not found`));
22899
+ if (skillName2) {
22900
+ console.log(source_default.yellow(`Skill "${skillName2}" not found`));
22817
22901
  } else {
22818
22902
  console.log(source_default.dim("No skills installed"));
22819
22903
  }
@@ -23051,9 +23135,9 @@ async function doctorCommand() {
23051
23135
  }
23052
23136
 
23053
23137
  // src/index.ts
23054
- var indigo12 = source_default.hex("#6366f1");
23138
+ var indigo12 = colors.primary;
23055
23139
  var program2 = new Command;
23056
- program2.name("skills").description("CLI for skills.md - AI Agent Skills Marketplace").version("0.1.16");
23140
+ program2.name("skills").description("CLI for skills.md - AI Agent Skills Marketplace").version("0.1.18");
23057
23141
  program2.command("init").description("Initialize skills.md in current project").option("-f, --force", "Force re-initialization (removes existing .skills/)").action((options) => {
23058
23142
  initCommand({ force: options.force });
23059
23143
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasnatools/skills",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "CLI for skills.md - AI Agent Skills Marketplace",
5
5
  "type": "module",
6
6
  "bin": {