nia-wizard 0.1.24 → 0.1.26

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/README.md CHANGED
@@ -24,7 +24,7 @@ This will:
24
24
  npx nia-wizard
25
25
  ```
26
26
 
27
- Press Enter to continue with the recommended default setup, which signs you in and installs `nia-cli`, or use the arrow keys to choose advanced or manual setup.
27
+ Press Enter to continue with the recommended default setup, which signs you in and installs or updates `nia-cli` to the latest version, or use the arrow keys to choose advanced or manual setup.
28
28
 
29
29
  ### With API Key
30
30
 
@@ -68,7 +68,7 @@ npx nia-wizard
68
68
 
69
69
  The wizard stores your API key at `~/.config/nia/api_key`.
70
70
 
71
- - Select `Install Nia CLI (recommended)` to auto-install `@nozomioai/nia`, run `nia auth login --api-key ...`, and then run `nia skill`.
71
+ - Select `Install Nia CLI (recommended)` to auto-install or update `@nozomioai/nia` to the latest version, run `nia auth login --api-key ...`, and then run `nia skill`.
72
72
  - Select `Install Nia Skill` to use the existing `skills` CLI flow.
73
73
  - Select `Install via add-mcp` for a quick install to supported agents.
74
74
 
package/dist/bin.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  runWizard,
9
9
  shutdown,
10
10
  track
11
- } from "./chunk-IWMEVHHX.js";
11
+ } from "./chunk-TOXYR2OK.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.24",
12
+ version: "0.1.26",
13
13
  description: "CLI wizard to install Nia to your coding agents",
14
14
  type: "module",
15
15
  main: "dist/index.js",
@@ -3096,6 +3096,17 @@ async function removeMCPServerFromClientsStep() {
3096
3096
  import chalk3 from "chalk";
3097
3097
  import { spawnSync as spawnSync6 } from "child_process";
3098
3098
 
3099
+ // src/utils/api-key.ts
3100
+ import * as fs33 from "fs";
3101
+ import * as os33 from "os";
3102
+ import * as path33 from "path";
3103
+ var NIA_CONFIG_DIR = path33.join(os33.homedir(), ".config", "nia");
3104
+ var NIA_KEY_PATH = path33.join(NIA_CONFIG_DIR, "api_key");
3105
+ function storeApiKey(apiKey) {
3106
+ fs33.mkdirSync(NIA_CONFIG_DIR, { recursive: true });
3107
+ fs33.writeFileSync(NIA_KEY_PATH, apiKey, { mode: 384 });
3108
+ }
3109
+
3099
3110
  // src/utils/dependencies.ts
3100
3111
  import { execSync as execSync5, spawnSync as spawnSync4 } from "child_process";
3101
3112
  import chalk2 from "chalk";
@@ -3299,46 +3310,65 @@ function dependenciesReady() {
3299
3310
  return true;
3300
3311
  }
3301
3312
 
3302
- // src/utils/api-key.ts
3303
- import * as fs33 from "fs";
3304
- import * as os33 from "os";
3305
- import * as path33 from "path";
3306
- var NIA_CONFIG_DIR = path33.join(os33.homedir(), ".config", "nia");
3307
- var NIA_KEY_PATH = path33.join(NIA_CONFIG_DIR, "api_key");
3308
- function storeApiKey(apiKey) {
3309
- fs33.mkdirSync(NIA_CONFIG_DIR, { recursive: true });
3310
- fs33.writeFileSync(NIA_KEY_PATH, apiKey, { mode: 384 });
3311
- }
3312
-
3313
3313
  // src/utils/nia-cli.ts
3314
3314
  import { spawnSync as spawnSync5 } from "child_process";
3315
3315
  var NIA_CLI_PACKAGE = "@nozomioai/nia";
3316
+ var LATEST_NIA_CLI_PACKAGE = `${NIA_CLI_PACKAGE}@latest`;
3316
3317
  function npmCommand() {
3317
3318
  return process.platform === "win32" ? "npm.cmd" : "npm";
3318
3319
  }
3320
+ function bunCommand() {
3321
+ return process.platform === "win32" ? "bun.exe" : "bun";
3322
+ }
3319
3323
  function npxCommand() {
3320
3324
  return process.platform === "win32" ? "npx.cmd" : "npx";
3321
3325
  }
3322
- function niaCommand() {
3323
- return process.platform === "win32" ? "nia.cmd" : "nia";
3326
+ function bunxCommand() {
3327
+ return process.platform === "win32" ? "bunx.exe" : "bunx";
3324
3328
  }
3325
- function isNiaCliInstalled() {
3326
- const result = spawnSync5(niaCommand(), ["--version"], {
3329
+ function hasCommand(command, args = ["--version"]) {
3330
+ const result = spawnSync5(command, args, {
3327
3331
  stdio: "pipe",
3328
3332
  encoding: "utf-8",
3329
3333
  shell: false
3330
3334
  });
3331
- debug("nia --version status", result.status);
3335
+ debug(`${command} ${args.join(" ")} status`, result.status);
3336
+ return result.status === 0;
3337
+ }
3338
+ function isNiaCliInstalled() {
3339
+ return hasCommand(process.platform === "win32" ? "nia.cmd" : "nia");
3340
+ }
3341
+ function hasBun() {
3342
+ return hasCommand(bunCommand());
3343
+ }
3344
+ function runLatestNia(args) {
3345
+ if (hasBun()) {
3346
+ const result2 = spawnSync5(bunxCommand(), ["-p", LATEST_NIA_CLI_PACKAGE, "nia", ...args], {
3347
+ stdio: "inherit",
3348
+ shell: false
3349
+ });
3350
+ return result2.status === 0;
3351
+ }
3352
+ const result = spawnSync5(npxCommand(), ["-y", "-p", LATEST_NIA_CLI_PACKAGE, "nia", ...args], {
3353
+ stdio: "inherit",
3354
+ shell: false
3355
+ });
3332
3356
  return result.status === 0;
3333
3357
  }
3334
3358
  function ensureNiaCliInstalled() {
3359
+ const bunAvailable = hasBun();
3360
+ const installSpinner = clack_default.spinner();
3335
3361
  if (isNiaCliInstalled()) {
3336
- return true;
3362
+ clack_default.log.info(`Updating ${LATEST_NIA_CLI_PACKAGE} globally with ${bunAvailable ? "bun" : "npm"}...`);
3363
+ } else {
3364
+ clack_default.log.info(`Installing ${LATEST_NIA_CLI_PACKAGE} globally with ${bunAvailable ? "bun" : "npm"}...`);
3337
3365
  }
3338
- clack_default.log.info("Installing @nozomioai/nia globally with npm...");
3339
- const installSpinner = clack_default.spinner();
3340
- installSpinner.start("Installing @nozomioai/nia...");
3341
- const installResult = spawnSync5(npmCommand(), ["install", "-g", NIA_CLI_PACKAGE], {
3366
+ installSpinner.start(`Installing ${LATEST_NIA_CLI_PACKAGE}...`);
3367
+ const installResult = bunAvailable ? spawnSync5(bunCommand(), ["add", "-g", LATEST_NIA_CLI_PACKAGE], {
3368
+ stdio: "pipe",
3369
+ encoding: "utf-8",
3370
+ shell: false
3371
+ }) : spawnSync5(npmCommand(), ["install", "-g", LATEST_NIA_CLI_PACKAGE], {
3342
3372
  stdio: "pipe",
3343
3373
  encoding: "utf-8",
3344
3374
  shell: false
@@ -3350,53 +3380,27 @@ function ensureNiaCliInstalled() {
3350
3380
  clack_default.log.error(installOutput);
3351
3381
  }
3352
3382
  clack_default.log.error("Could not install @nozomioai/nia automatically.");
3353
- clack_default.log.info("Install manually: npm install -g @nozomioai/nia");
3383
+ clack_default.log.info(
3384
+ `Install manually: ${bunAvailable ? "bun add -g" : "npm install -g"} ${LATEST_NIA_CLI_PACKAGE}`
3385
+ );
3354
3386
  return false;
3355
3387
  }
3356
3388
  if (!isNiaCliInstalled()) {
3357
3389
  installSpinner.stop("Installed @nozomioai/nia, but `nia` is not available");
3358
3390
  clack_default.log.error("The `nia` command is still unavailable in your PATH.");
3359
- clack_default.log.info("Open a new terminal or run: npm install -g @nozomioai/nia");
3391
+ clack_default.log.info(
3392
+ `Open a new terminal or run: ${bunAvailable ? "bun add -g" : "npm install -g"} ${LATEST_NIA_CLI_PACKAGE}`
3393
+ );
3360
3394
  return false;
3361
3395
  }
3362
- installSpinner.stop("@nozomioai/nia installed!");
3396
+ installSpinner.stop(`${LATEST_NIA_CLI_PACKAGE} ready!`);
3363
3397
  return true;
3364
3398
  }
3365
3399
  function runNiaSkill() {
3366
- const runResult = spawnSync5(niaCommand(), ["skill"], {
3367
- stdio: "inherit",
3368
- shell: false
3369
- });
3370
- if (runResult.status === 0) {
3371
- return true;
3372
- }
3373
- debug("nia skill failed, falling back to npx @nozomioai/nia skill", runResult.status);
3374
- clack_default.log.warn("`nia skill` failed. Trying `npx -y @nozomioai/nia skill`...");
3375
- const fallbackResult = spawnSync5(npxCommand(), ["-y", NIA_CLI_PACKAGE, "skill"], {
3376
- stdio: "inherit",
3377
- shell: false
3378
- });
3379
- return fallbackResult.status === 0;
3400
+ return runLatestNia(["skill", "--all"]);
3380
3401
  }
3381
3402
  function runNiaAuthLogin(apiKey) {
3382
- const authResult = spawnSync5(niaCommand(), ["auth", "login", "--api-key", apiKey], {
3383
- stdio: "inherit",
3384
- shell: false
3385
- });
3386
- if (authResult.status === 0) {
3387
- return true;
3388
- }
3389
- debug("nia auth login failed, falling back to npx @nozomioai/nia auth login", authResult.status);
3390
- clack_default.log.warn("`nia auth login` failed. Trying `npx -y @nozomioai/nia auth login`...");
3391
- const fallbackResult = spawnSync5(
3392
- npxCommand(),
3393
- ["-y", NIA_CLI_PACKAGE, "auth", "login", "--api-key", apiKey],
3394
- {
3395
- stdio: "inherit",
3396
- shell: false
3397
- }
3398
- );
3399
- return fallbackResult.status === 0;
3403
+ return runLatestNia(["auth", "login", "--api-key", apiKey]);
3400
3404
  }
3401
3405
 
3402
3406
  // src/run.ts
@@ -4072,4 +4076,4 @@ export {
4072
4076
  runSkillAdd,
4073
4077
  printAgentGuide
4074
4078
  };
4075
- //# sourceMappingURL=chunk-IWMEVHHX.js.map
4079
+ //# sourceMappingURL=chunk-TOXYR2OK.js.map