@moonpay/cli 0.2.3 → 0.2.5

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 CHANGED
@@ -2259,6 +2259,10 @@ var require_nacl_fast = __commonJS({
2259
2259
 
2260
2260
  // src/index.ts
2261
2261
  import { createRequire } from "module";
2262
+ import { readdirSync as readdirSync3, readFileSync as readFileSync5, mkdirSync as mkdirSync4, cpSync, existsSync as existsSync3 } from "fs";
2263
+ import { join as join5, dirname } from "path";
2264
+ import { homedir as homedir4 } from "os";
2265
+ import { fileURLToPath } from "url";
2262
2266
  import { Command } from "commander";
2263
2267
 
2264
2268
  // src/auth.ts
@@ -2282,7 +2286,7 @@ var CONFIG_PATH = path.join(CONFIG_DIR, "config.json");
2282
2286
  var CREDENTIALS_PATH = path.join(CONFIG_DIR, "credentials.json");
2283
2287
  var LOCK_PATH = path.join(CONFIG_DIR, ".credentials.lock");
2284
2288
  var CALLBACK_PORT = 3847;
2285
- var CALLBACK_URL = `http://127.0.0.1:${CALLBACK_PORT}/callback`;
2289
+ var CALLBACK_URL = `http://localhost:${CALLBACK_PORT}/callback`;
2286
2290
  var DEFAULT_CONFIG = {
2287
2291
  baseUrl: "https://agents.moonpay.com",
2288
2292
  clientId: "mooniq_zin3s5jz3olzkdfxpmbeaogv"
@@ -2423,7 +2427,7 @@ async function login(config) {
2423
2427
  } else if (code2) {
2424
2428
  res.writeHead(200, { "Content-Type": "text/html" });
2425
2429
  res.end(
2426
- `<!DOCTYPE html><html><head><meta charset="utf-8"><title>MoonPay Agents</title></head><body style="font-family:system-ui,-apple-system,sans-serif;display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100vh;margin:0;padding:2rem;text-align:center;background:#0a0a0a;color:#fafafa"><img src="https://agents.moonpay.com/logo.png" alt="MoonPay" style="width:64px;height:64px;border-radius:16px;margin-bottom:1.5rem" /><h1 style="margin:0 0 0.5rem;font-size:1.5rem;font-weight:600">Your agent has money now.</h1><p style="color:#a1a1aa;margin:0;font-size:1rem">You can close this tab and return to the terminal.</p></body></html>`
2430
+ `<!DOCTYPE html><html><head><meta charset="utf-8"><title>MoonPay Agents</title></head><body style="font-family:system-ui,-apple-system,sans-serif;display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100vh;margin:0;padding:2rem;text-align:center;background:#0a0a0a;color:#fafafa"><img src="https://agents.moonpay.com/logos/moonpay.jpg" alt="MoonPay" style="width:64px;height:64px;border-radius:16px;margin-bottom:1.5rem" /><h1 style="margin:0 0 0.5rem;font-size:1.5rem;font-weight:600">Your agent has money now.</h1><p style="color:#a1a1aa;margin:0;font-size:1rem">You can close this tab and return to the terminal.</p></body></html>`
2427
2431
  );
2428
2432
  resolveCallback(code2);
2429
2433
  } else {
@@ -4325,7 +4329,7 @@ var { version } = require2("../package.json");
4325
4329
  var getUpdateNotice = startVersionCheck(version);
4326
4330
  var DEFAULT_BASE_URL = "https://agents.moonpay.com";
4327
4331
  var program = new Command();
4328
- program.name("moonpay").description("MoonPay CLI \u2014 non-custodial crypto tools").version(version).option("-f, --format <type>", "Output format: json, compact, or table", "json");
4332
+ program.name("moonpay").description("MoonPay CLI \u2014 non-custodial crypto tools\n\n Run `mp skill install` to install AI skills for Claude Code.").version(version).option("-f, --format <type>", "Output format: json, compact, or table", "json");
4329
4333
  function getFormat() {
4330
4334
  const fmt = program.opts().format;
4331
4335
  if (fmt === "json" || fmt === "compact" || fmt === "table") return fmt;
@@ -4508,5 +4512,71 @@ program.command("tools").description("List available tools").action(() => {
4508
4512
  console.log(lines.join("\n"));
4509
4513
  printUpdateNotice();
4510
4514
  });
4515
+ function getSkillsDir() {
4516
+ const __filename = fileURLToPath(import.meta.url);
4517
+ const __dirname = dirname(__filename);
4518
+ return join5(__dirname, "..", "skills");
4519
+ }
4520
+ function listSkills() {
4521
+ const skillsDir = getSkillsDir();
4522
+ if (!existsSync3(skillsDir)) return [];
4523
+ return readdirSync3(skillsDir, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name.startsWith("moonpay-")).map((e) => {
4524
+ const md = readFileSync5(join5(skillsDir, e.name, "SKILL.md"), "utf-8");
4525
+ const descMatch = md.match(/^description:\s*(.+)$/m);
4526
+ return {
4527
+ name: e.name,
4528
+ description: descMatch?.[1]?.replace(/^["']|["']$/g, "") ?? ""
4529
+ };
4530
+ }).sort((a, b) => a.name.localeCompare(b.name));
4531
+ }
4532
+ var skillGroup = program.command("skill").description("AI skills for Claude Code and other agents");
4533
+ skillGroup.command("list").description("List available skills").action(() => {
4534
+ const skills = listSkills();
4535
+ if (!skills.length) {
4536
+ console.log("No skills found.");
4537
+ return;
4538
+ }
4539
+ for (const s of skills) {
4540
+ console.log(` ${color.green(s.name.padEnd(30))} ${color.dim(s.description)}`);
4541
+ }
4542
+ console.log("");
4543
+ console.log(color.dim(`${skills.length} skills \u2014 run \`mp skill install\` to install for Claude Code`));
4544
+ });
4545
+ skillGroup.command("retrieve").description("Show a skill's full instructions").requiredOption("--name <name>", "Skill name (e.g. moonpay-swap-tokens)").action((opts) => {
4546
+ const skillPath = join5(getSkillsDir(), opts.name, "SKILL.md");
4547
+ if (!existsSync3(skillPath)) {
4548
+ console.error(`Skill "${opts.name}" not found.`);
4549
+ console.error(`Run \`mp skill list\` to see available skills.`);
4550
+ process.exit(1);
4551
+ }
4552
+ console.log(readFileSync5(skillPath, "utf-8"));
4553
+ });
4554
+ skillGroup.command("install").description("Install skills to ~/.claude/skills/ for Claude Code").option("--force", "Overwrite existing skills", false).action((opts) => {
4555
+ const srcDir = getSkillsDir();
4556
+ const destDir = join5(homedir4(), ".claude", "skills");
4557
+ const skills = listSkills();
4558
+ if (!skills.length) {
4559
+ console.log("No skills found to install.");
4560
+ return;
4561
+ }
4562
+ mkdirSync4(destDir, { recursive: true });
4563
+ let installed = 0;
4564
+ for (const s of skills) {
4565
+ const dest = join5(destDir, s.name);
4566
+ if (existsSync3(dest) && !opts.force) {
4567
+ console.log(` ${color.dim("skip")} ${s.name} (already exists, use --force to overwrite)`);
4568
+ continue;
4569
+ }
4570
+ cpSync(join5(srcDir, s.name), dest, { recursive: true, force: true });
4571
+ console.log(` ${color.green("\u2713")} ${s.name}`);
4572
+ installed++;
4573
+ }
4574
+ console.log("");
4575
+ if (installed > 0) {
4576
+ console.log(`Installed ${installed} skills to ${destDir}`);
4577
+ } else {
4578
+ console.log("All skills already installed. Use --force to overwrite.");
4579
+ }
4580
+ });
4511
4581
  program.parse();
4512
4582
  //# sourceMappingURL=index.js.map