nia-wizard 0.1.29 → 0.1.30

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/bin.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  runWizard,
9
9
  shutdown,
10
10
  track
11
- } from "./chunk-CUR7WEDI.js";
11
+ } from "./chunk-FFW4MJGP.js";
12
12
 
13
13
  // src/bin.ts
14
14
  import yargs from "yargs";
@@ -9,7 +9,7 @@ var require_package = __commonJS({
9
9
  "package.json"(exports, module) {
10
10
  module.exports = {
11
11
  name: "nia-wizard",
12
- version: "0.1.29",
12
+ version: "0.1.30",
13
13
  description: "CLI wizard to install Nia to your coding agents",
14
14
  packageManager: "pnpm@10.30.3",
15
15
  type: "module",
@@ -3341,6 +3341,7 @@ function dependenciesReady() {
3341
3341
  import { spawnSync as spawnSync5 } from "child_process";
3342
3342
  var NIA_CLI_PACKAGE = "@nozomioai/nia";
3343
3343
  var LATEST_NIA_CLI_PACKAGE = `${NIA_CLI_PACKAGE}@latest`;
3344
+ var API_KEY_PATTERN = /^nk_[A-Za-z0-9_-]+$/;
3344
3345
  function npmCommand() {
3345
3346
  return process.platform === "win32" ? "npm.cmd" : "npm";
3346
3347
  }
@@ -3357,17 +3358,21 @@ function hasCommand(command, args = ["--version"]) {
3357
3358
  const result = spawnSync5(command, args, {
3358
3359
  stdio: "pipe",
3359
3360
  encoding: "utf-8",
3360
- shell: false
3361
+ // On Windows, shell is needed to resolve .cmd shims (npm) via PATHEXT
3362
+ shell: process.platform === "win32"
3361
3363
  });
3362
3364
  debug(`${command} ${args.join(" ")} status`, result.status);
3363
3365
  return result.status === 0;
3364
3366
  }
3365
3367
  function isNiaCliInstalled() {
3366
- return hasCommand(process.platform === "win32" ? "nia.cmd" : "nia");
3368
+ return hasCommand("nia");
3367
3369
  }
3368
3370
  function hasBun() {
3369
3371
  return hasCommand(bunCommand());
3370
3372
  }
3373
+ function validateApiKey(apiKey) {
3374
+ return API_KEY_PATTERN.test(apiKey);
3375
+ }
3371
3376
  function runLatestNia(args) {
3372
3377
  if (hasBun()) {
3373
3378
  const result2 = spawnSync5(bunxCommand(), ["-p", LATEST_NIA_CLI_PACKAGE, "nia", ...args], {
@@ -3378,7 +3383,7 @@ function runLatestNia(args) {
3378
3383
  }
3379
3384
  const result = spawnSync5(npxCommand(), ["-y", "-p", LATEST_NIA_CLI_PACKAGE, "nia", ...args], {
3380
3385
  stdio: "inherit",
3381
- shell: false
3386
+ shell: process.platform === "win32"
3382
3387
  });
3383
3388
  return result.status === 0;
3384
3389
  }
@@ -3398,7 +3403,7 @@ function ensureNiaCliInstalled() {
3398
3403
  }) : spawnSync5(npmCommand(), ["install", "-g", LATEST_NIA_CLI_PACKAGE], {
3399
3404
  stdio: "pipe",
3400
3405
  encoding: "utf-8",
3401
- shell: false
3406
+ shell: process.platform === "win32"
3402
3407
  });
3403
3408
  if (installResult.status !== 0) {
3404
3409
  installSpinner.stop("Failed to install @nozomioai/nia");
@@ -3427,6 +3432,10 @@ function runNiaSkill() {
3427
3432
  return runLatestNia(["skill", "--all"]);
3428
3433
  }
3429
3434
  function runNiaAuthLogin(apiKey) {
3435
+ if (!validateApiKey(apiKey)) {
3436
+ clack_default.log.error("Invalid API key format. Keys should look like `nk_...` and contain only letters, numbers, `_`, or `-`.");
3437
+ return false;
3438
+ }
3430
3439
  return runLatestNia(["auth", "login", "--api-key", apiKey]);
3431
3440
  }
3432
3441
 
@@ -4089,4 +4098,4 @@ export {
4089
4098
  getAgentGuideMarkdown,
4090
4099
  printAgentGuide
4091
4100
  };
4092
- //# sourceMappingURL=chunk-CUR7WEDI.js.map
4101
+ //# sourceMappingURL=chunk-FFW4MJGP.js.map