@skillport/cli 0.1.0 → 0.1.1

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 +42 -23
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2496,26 +2496,37 @@ import { createServer } from "node:http";
2496
2496
  import { randomBytes } from "node:crypto";
2497
2497
  import chalk9 from "chalk";
2498
2498
  import inquirer4 from "inquirer";
2499
- async function loginCommand() {
2499
+ async function loginCommand(options) {
2500
2500
  const config = loadConfig();
2501
2501
  console.log(chalk9.bold("SkillPort Market Login"));
2502
2502
  console.log(chalk9.dim(`Marketplace: ${config.marketplace_url}`));
2503
2503
  console.log();
2504
- const { method } = await inquirer4.prompt([
2505
- {
2506
- type: "list",
2507
- name: "method",
2508
- message: "Login method:",
2509
- choices: [
2510
- { name: "Browser (GitHub OAuth)", value: "browser" },
2511
- { name: "Paste API token", value: "token" }
2512
- ]
2513
- }
2514
- ]);
2515
- if (method === "token") {
2516
- const { token: token2 } = await inquirer4.prompt([
2517
- { type: "password", name: "token", message: "Enter your API token:" }
2504
+ let method = options.method;
2505
+ if (options.token) {
2506
+ method = "token";
2507
+ }
2508
+ if (!options.yes && method === "browser" && !options.token) {
2509
+ const answer = await inquirer4.prompt([
2510
+ {
2511
+ type: "list",
2512
+ name: "method",
2513
+ message: "Login method:",
2514
+ choices: [
2515
+ { name: "Browser (GitHub OAuth)", value: "browser" },
2516
+ { name: "Paste API token", value: "token" }
2517
+ ]
2518
+ }
2518
2519
  ]);
2520
+ method = answer.method;
2521
+ }
2522
+ if (method === "token") {
2523
+ let token2 = options.token;
2524
+ if (!token2) {
2525
+ const answer = await inquirer4.prompt([
2526
+ { type: "password", name: "token", message: "Enter your API token:" }
2527
+ ]);
2528
+ token2 = answer.token;
2529
+ }
2519
2530
  config.auth_token = token2;
2520
2531
  saveConfig(config);
2521
2532
  console.log(chalk9.green("Login successful! Token saved."));
@@ -2524,15 +2535,23 @@ async function loginCommand() {
2524
2535
  const state = randomBytes(16).toString("hex");
2525
2536
  const port = 9876;
2526
2537
  const authUrl = `${config.marketplace_url}/auth/cli?state=${state}&port=${port}`;
2527
- console.log(chalk9.dim(`Opening browser to: ${authUrl}`));
2528
- console.log(chalk9.dim("Waiting for authentication..."));
2529
- const { exec } = await import("node:child_process");
2530
- const openCmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
2531
- exec(`${openCmd} "${authUrl}"`);
2538
+ if (options.browser === false) {
2539
+ console.log(chalk9.bold("Open this URL in your browser to authenticate:"));
2540
+ console.log();
2541
+ console.log(` ${authUrl}`);
2542
+ console.log();
2543
+ console.log(chalk9.dim("Waiting for authentication callback..."));
2544
+ } else {
2545
+ console.log(chalk9.dim(`Opening browser to: ${authUrl}`));
2546
+ console.log(chalk9.dim("Waiting for authentication..."));
2547
+ const { exec } = await import("node:child_process");
2548
+ const openCmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
2549
+ exec(`${openCmd} "${authUrl}"`);
2550
+ }
2532
2551
  const token = await new Promise((resolve, reject) => {
2533
2552
  const timeout = setTimeout(() => {
2534
2553
  server.close();
2535
- reject(new Error("Authentication timed out (60s)"));
2554
+ reject(new Error("Authentication timed out (60s). Try again or use: skillport login --method token --token <your-token>"));
2536
2555
  }, 6e4);
2537
2556
  const server = createServer(async (req, res) => {
2538
2557
  const url = new URL(req.url || "", `http://localhost:${port}`);
@@ -2678,7 +2697,7 @@ async function publishCommand(sspPath) {
2678
2697
 
2679
2698
  // src/index.ts
2680
2699
  var program = new Command();
2681
- program.name("skillport").description("SkillPort \u2014 secure skill distribution for OpenClaw").version("0.1.0");
2700
+ program.name("skillport").description("SkillPort \u2014 secure skill distribution for OpenClaw").version("0.1.1");
2682
2701
  program.command("init").description("Generate Ed25519 key pair for signing").action(initCommand);
2683
2702
  program.command("scan <path>").description("Run security scan on a skill directory or .ssp file").action(scanCommand);
2684
2703
  program.command("export <path>").description("Export a skill directory as a SkillPort package (.ssp)").option("-o, --output <file>", "Output file path").option("-y, --yes", "Non-interactive mode (include all, skip prompts)").option("--id <id>", "Skill ID (author-slug/skill-slug)").option("--name <name>", "Skill name").option("--description <desc>", "Skill description").option("--skill-version <ver>", "Skill version (semver)").option("--author <name>", "Author name").option("--openclaw-compat <range>", "OpenClaw compatibility range").option("--os <os...>", "Compatible OS (macos, linux, windows)").action(exportCommand);
@@ -2687,6 +2706,6 @@ program.command("verify <ssp>").description("Verify SkillPort package signatures
2687
2706
  program.command("install <target>").description("Install a SkillPort package").option("--accept-risk", "Accept high-risk permissions (shell, critical flags)").option("-y, --yes", "Non-interactive mode (auto-approve, use defaults)").action(installCommand);
2688
2707
  program.command("dry-run <ssp>").description("Run installation diagnostics without installing").action(dryRunCommand);
2689
2708
  program.command("uninstall <id>").description("Uninstall an installed skill").action(uninstallCommand);
2690
- program.command("login").description("Authenticate with SkillPort Market").action(loginCommand);
2709
+ program.command("login").description("Authenticate with SkillPort Market").option("--method <method>", "Login method: browser or token", "browser").option("--token <token>", "API token (for --method token)").option("-y, --yes", "Non-interactive mode (skip prompts)").option("--no-browser", "Print auth URL instead of opening browser").action(loginCommand);
2691
2710
  program.command("publish <ssp>").description("Publish a SkillPort package to the marketplace").action(publishCommand);
2692
2711
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillport/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "SkillPort CLI — secure skill distribution for OpenClaw. Export, scan, sign, and install AI skill packages.",
5
5
  "type": "module",
6
6
  "license": "MIT",