nia-wizard 0.1.32 → 0.1.34

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,11 +8,15 @@ import {
8
8
  runWizard,
9
9
  shutdown,
10
10
  track
11
- } from "./chunk-D6YKHBNX.js";
11
+ } from "./chunk-MZY5RGCT.js";
12
12
 
13
13
  // src/bin.ts
14
14
  import yargs from "yargs";
15
15
  import { hideBin } from "yargs/helpers";
16
+ process.on("SIGINT", async () => {
17
+ await shutdown();
18
+ process.exit(0);
19
+ });
16
20
  var isInteractive = Boolean(process.stdin.isTTY);
17
21
  function printCliError(error) {
18
22
  if (error instanceof Error) {
package/dist/bin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport { runWizard } from './run.js';\nimport { runMCPAdd, runMCPRemove } from './mcp.js';\nimport { runSkillAdd } from './skill.js';\nimport { printAgentGuide } from './agent-guide.js';\nimport { track, shutdown } from './utils/analytics.js';\n\nconst isInteractive = Boolean(process.stdin.isTTY);\n\nfunction printCliError(error: unknown): void {\n if (error instanceof Error) {\n console.error(`Error: ${error.message}`);\n return;\n }\n\n console.error('Error:', error);\n}\n\nconst cli = yargs(hideBin(process.argv))\n .scriptName('nia-wizard')\n .usage('$0 [api-key] [options]')\n .usage('$0 mcp add [options]')\n .usage('$0 mcp remove [options]')\n .usage('$0 skill add [options]')\n .command(\n '$0 [api-key]',\n 'Install Nia to your coding agents',\n (yargs) =>\n yargs\n .positional('api-key', {\n type: 'string',\n description: 'Nia API key (nk_xxx)',\n })\n .option('local', {\n type: 'boolean',\n description: 'Use local mode (requires pipx)',\n })\n .option('remote', {\n type: 'boolean',\n description: 'Use remote mode (cloud)',\n })\n .option('debug', {\n type: 'boolean',\n default: false,\n description: 'Enable debug logging',\n })\n .option('ci', {\n type: 'boolean',\n default: false,\n description: 'CI mode (skip prompts)',\n })\n .option('agent', {\n type: 'boolean',\n default: false,\n description: 'Print agent-facing Nia CLI onboarding prompt',\n }),\n async (argv) => {\n try {\n if (argv.agent) {\n printAgentGuide();\n return;\n }\n\n const apiKeyArg = typeof argv['api-key'] === 'string'\n ? argv['api-key']\n : typeof argv.apiKey === 'string'\n ? argv.apiKey\n : undefined;\n\n if (apiKeyArg === 'agent-guide') {\n printAgentGuide();\n return;\n }\n\n const ci = argv.ci || !isInteractive;\n if (!isInteractive && !argv.ci) {\n console.log('Non-interactive terminal detected, running in CI mode.');\n console.log('For the full interactive experience, run: npx nia-wizard\\n');\n }\n\n await runWizard({\n apiKey: argv['api-key'],\n local: argv.local ?? (argv.remote ? false : undefined),\n debug: argv.debug,\n ci,\n });\n } catch (error) {\n track('cli_wizard_error', { error_type: 'wizard', error_message: error instanceof Error ? error.message : String(error) });\n await shutdown();\n printCliError(error);\n process.exit(1);\n }\n },\n )\n .command(\n 'skill <command>',\n 'Manage skill installation',\n (yargs) =>\n yargs\n .command(\n 'add',\n 'Add Nia skill',\n (yargs) =>\n yargs\n .option('api-key', {\n type: 'string',\n alias: 'k',\n description: 'Nia API key (nk_xxx)',\n })\n .option('source', {\n type: 'string',\n default: 'nozomio-labs/nia-skill',\n description: 'Skill source to install',\n })\n .option('target', {\n type: 'string',\n description: 'Target coding agent for skill installation',\n })\n .option('all-agents', {\n type: 'boolean',\n default: false,\n description: 'Install to all detected agents (non-interactive)',\n })\n .option('global', {\n type: 'boolean',\n description: 'Install to global user skills directories',\n })\n .option('yes', {\n type: 'boolean',\n default: false,\n description: 'Auto-confirm prompts when supported by the skills CLI',\n })\n .option('non-interactive', {\n type: 'boolean',\n default: false,\n description: 'Fail fast instead of waiting for prompts',\n })\n .option('json', {\n type: 'boolean',\n default: false,\n description: 'Print machine-readable install result',\n })\n .option('debug', {\n type: 'boolean',\n default: false,\n description: 'Enable debug logging',\n })\n .option('ci', {\n type: 'boolean',\n default: false,\n description: 'CI mode (implies non-interactive behavior)',\n }),\n async (argv) => {\n try {\n await runSkillAdd({\n apiKey: argv['api-key'],\n source: argv.source,\n target: argv.target,\n allAgents: argv['all-agents'],\n global: argv.global,\n yes: argv.yes,\n nonInteractive: argv['non-interactive'],\n json: argv.json,\n debug: argv.debug,\n ci: argv.ci,\n });\n } catch (error) {\n printCliError(error);\n process.exit(1);\n }\n },\n )\n .demandCommand(1, 'You need to specify a command (add)'),\n () => {},\n )\n .command(\n 'mcp <command>',\n 'Manage direct agent setup',\n (yargs) =>\n yargs\n .command(\n 'add',\n 'Add Nia to coding agents',\n (yargs) =>\n yargs\n .option('api-key', {\n type: 'string',\n alias: 'k',\n description: 'Nia API key (nk_xxx)',\n })\n .option('local', {\n type: 'boolean',\n description: 'Use local mode',\n })\n .option('remote', {\n type: 'boolean',\n description: 'Use remote mode',\n })\n .option('debug', {\n type: 'boolean',\n default: false,\n description: 'Enable debug logging',\n })\n .option('ci', {\n type: 'boolean',\n default: false,\n description: 'CI mode (skip prompts)',\n }),\n async (argv) => {\n try {\n await runMCPAdd({\n apiKey: argv['api-key'],\n local: argv.local ?? (argv.remote ? false : undefined),\n debug: argv.debug,\n ci: argv.ci,\n });\n } catch (error) {\n printCliError(error);\n process.exit(1);\n }\n },\n )\n .command(\n 'remove',\n 'Remove Nia from coding agents',\n (yargs) =>\n yargs.option('debug', {\n type: 'boolean',\n default: false,\n description: 'Enable debug logging',\n }),\n async (argv) => {\n try {\n await runMCPRemove({ debug: argv.debug });\n } catch (error) {\n printCliError(error);\n process.exit(1);\n }\n },\n )\n .demandCommand(1, 'You need to specify a command (add or remove)'),\n () => {},\n )\n .help()\n .version()\n .strict();\n\ncli.parse();\n"],"mappings":";;;;;;;;;;;;;AAEA,OAAO,WAAW;AAClB,SAAS,eAAe;AAOxB,IAAM,gBAAgB,QAAQ,QAAQ,MAAM,KAAK;AAEjD,SAAS,cAAc,OAAsB;AAC3C,MAAI,iBAAiB,OAAO;AAC1B,YAAQ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AAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,IACA,CAACA,WACCA,OAAM,OAAO,SAAS;AAAA,MACpB,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,IACf,CAAC;AAAA,IACH,OAAO,SAAS;AACd,UAAI;AACF,cAAM,aAAa,EAAE,OAAO,KAAK,MAAM,CAAC;AAAA,MAC1C,SAAS,OAAO;AACd,sBAAc,KAAK;AACnB,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,IACF;AAAA,EACF,EACC,cAAc,GAAG,+CAA+C;AAAA,EACrE,MAAM;AAAA,EAAC;AACT,EACC,KAAK,EACL,QAAQ,EACR,OAAO;AAEV,IAAI,MAAM;","names":["yargs"]}
1
+ {"version":3,"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport { runWizard } from './run.js';\nimport { runMCPAdd, runMCPRemove } from './mcp.js';\nimport { runSkillAdd } from './skill.js';\nimport { printAgentGuide } from './agent-guide.js';\nimport { track, shutdown } from './utils/analytics.js';\n\n// Flush analytics on Ctrl+C so wizard_completed events aren't lost\nprocess.on('SIGINT', async () => {\n await shutdown();\n process.exit(0);\n});\n\nconst isInteractive = Boolean(process.stdin.isTTY);\n\nfunction printCliError(error: unknown): void {\n if (error instanceof Error) {\n console.error(`Error: ${error.message}`);\n return;\n }\n\n console.error('Error:', error);\n}\n\nconst cli = yargs(hideBin(process.argv))\n .scriptName('nia-wizard')\n .usage('$0 [api-key] [options]')\n .usage('$0 mcp add [options]')\n .usage('$0 mcp remove [options]')\n .usage('$0 skill add [options]')\n .command(\n '$0 [api-key]',\n 'Install Nia to your coding agents',\n (yargs) =>\n yargs\n .positional('api-key', {\n type: 'string',\n description: 'Nia API key (nk_xxx)',\n })\n .option('local', {\n type: 'boolean',\n description: 'Use local mode (requires pipx)',\n })\n .option('remote', {\n type: 'boolean',\n description: 'Use remote mode (cloud)',\n })\n .option('debug', {\n type: 'boolean',\n default: false,\n description: 'Enable debug logging',\n })\n .option('ci', {\n type: 'boolean',\n default: false,\n description: 'CI mode (skip prompts)',\n })\n .option('agent', {\n type: 'boolean',\n default: false,\n description: 'Print agent-facing Nia CLI onboarding prompt',\n }),\n async (argv) => {\n try {\n if (argv.agent) {\n printAgentGuide();\n return;\n }\n\n const apiKeyArg = typeof argv['api-key'] === 'string'\n ? argv['api-key']\n : typeof argv.apiKey === 'string'\n ? argv.apiKey\n : undefined;\n\n if (apiKeyArg === 'agent-guide') {\n printAgentGuide();\n return;\n }\n\n const ci = argv.ci || !isInteractive;\n if (!isInteractive && !argv.ci) {\n console.log('Non-interactive terminal detected, running in CI mode.');\n console.log('For the full interactive experience, run: npx nia-wizard\\n');\n }\n\n await runWizard({\n apiKey: argv['api-key'],\n local: argv.local ?? (argv.remote ? false : undefined),\n debug: argv.debug,\n ci,\n });\n } catch (error) {\n track('cli_wizard_error', { error_type: 'wizard', error_message: error instanceof Error ? error.message : String(error) });\n await shutdown();\n printCliError(error);\n process.exit(1);\n }\n },\n )\n .command(\n 'skill <command>',\n 'Manage skill installation',\n (yargs) =>\n yargs\n .command(\n 'add',\n 'Add Nia skill',\n (yargs) =>\n yargs\n .option('api-key', {\n type: 'string',\n alias: 'k',\n description: 'Nia API key (nk_xxx)',\n })\n .option('source', {\n type: 'string',\n default: 'nozomio-labs/nia-skill',\n description: 'Skill source to install',\n })\n .option('target', {\n type: 'string',\n description: 'Target coding agent for skill installation',\n })\n .option('all-agents', {\n type: 'boolean',\n default: false,\n description: 'Install to all detected agents (non-interactive)',\n })\n .option('global', {\n type: 'boolean',\n description: 'Install to global user skills directories',\n })\n .option('yes', {\n type: 'boolean',\n default: false,\n description: 'Auto-confirm prompts when supported by the skills CLI',\n })\n .option('non-interactive', {\n type: 'boolean',\n default: false,\n description: 'Fail fast instead of waiting for prompts',\n })\n .option('json', {\n type: 'boolean',\n default: false,\n description: 'Print machine-readable install result',\n })\n .option('debug', {\n type: 'boolean',\n default: false,\n description: 'Enable debug logging',\n })\n .option('ci', {\n type: 'boolean',\n default: false,\n description: 'CI mode (implies non-interactive behavior)',\n }),\n async (argv) => {\n try {\n await runSkillAdd({\n apiKey: argv['api-key'],\n source: argv.source,\n target: argv.target,\n allAgents: argv['all-agents'],\n global: argv.global,\n yes: argv.yes,\n nonInteractive: argv['non-interactive'],\n json: argv.json,\n debug: argv.debug,\n ci: argv.ci,\n });\n } catch (error) {\n printCliError(error);\n process.exit(1);\n }\n },\n )\n .demandCommand(1, 'You need to specify a command (add)'),\n () => {},\n )\n .command(\n 'mcp <command>',\n 'Manage direct agent setup',\n (yargs) =>\n yargs\n .command(\n 'add',\n 'Add Nia to coding agents',\n (yargs) =>\n yargs\n .option('api-key', {\n type: 'string',\n alias: 'k',\n description: 'Nia API key (nk_xxx)',\n })\n .option('local', {\n type: 'boolean',\n description: 'Use local mode',\n })\n .option('remote', {\n type: 'boolean',\n description: 'Use remote mode',\n })\n .option('debug', {\n type: 'boolean',\n default: false,\n description: 'Enable debug logging',\n })\n .option('ci', {\n type: 'boolean',\n default: false,\n description: 'CI mode (skip prompts)',\n }),\n async (argv) => {\n try {\n await runMCPAdd({\n apiKey: argv['api-key'],\n local: argv.local ?? (argv.remote ? false : undefined),\n debug: argv.debug,\n ci: argv.ci,\n });\n } catch (error) {\n printCliError(error);\n process.exit(1);\n }\n },\n )\n .command(\n 'remove',\n 'Remove Nia from coding agents',\n (yargs) =>\n yargs.option('debug', {\n type: 'boolean',\n default: false,\n description: 'Enable debug logging',\n }),\n async (argv) => {\n try {\n await runMCPRemove({ debug: argv.debug });\n } catch (error) {\n printCliError(error);\n process.exit(1);\n }\n },\n )\n .demandCommand(1, 'You need to specify a command (add or remove)'),\n () => {},\n )\n .help()\n .version()\n .strict();\n\ncli.parse();\n"],"mappings":";;;;;;;;;;;;;AAEA,OAAO,WAAW;AAClB,SAAS,eAAe;AAQxB,QAAQ,GAAG,UAAU,YAAY;AAC/B,QAAM,SAAS;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5C,OAAO,KAAK;AAAA,UACZ,IAAI,KAAK;AAAA,QACX,CAAC;AAAA,MACH,SAAS,OAAO;AACd,sBAAc,KAAK;AACnB,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,IACF;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,IACA,CAACA,WACCA,OAAM,OAAO,SAAS;AAAA,MACpB,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,IACf,CAAC;AAAA,IACH,OAAO,SAAS;AACd,UAAI;AACF,cAAM,aAAa,EAAE,OAAO,KAAK,MAAM,CAAC;AAAA,MAC1C,SAAS,OAAO;AACd,sBAAc,KAAK;AACnB,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,IACF;AAAA,EACF,EACC,cAAc,GAAG,+CAA+C;AAAA,EACrE,MAAM;AAAA,EAAC;AACT,EACC,KAAK,EACL,QAAQ,EACR,OAAO;AAEV,IAAI,MAAM;","names":["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.32",
12
+ version: "0.1.34",
13
13
  description: "CLI wizard to install Nia to your coding agents",
14
14
  packageManager: "pnpm@10.30.3",
15
15
  type: "module",
@@ -520,6 +520,10 @@ async function runDeviceFlow() {
520
520
  clack_default.log.error("Failed to connect to Nia servers. Check your internet connection.");
521
521
  debug(`Device flow error: ${error}`);
522
522
  }
523
+ track("cli_wizard_error", {
524
+ error_type: "device_session_start_failed",
525
+ error_message: isDeviceFlowError(error) ? error.message : "Failed to connect to Nia servers"
526
+ });
523
527
  printManualOnboardingFallback();
524
528
  clack_default.log.info("Falling back to manual API key entry.");
525
529
  return await promptForManualApiKey();
@@ -557,18 +561,78 @@ async function runDeviceFlow() {
557
561
  function sleep(ms) {
558
562
  return new Promise((resolve) => setTimeout(resolve, ms));
559
563
  }
560
- async function waitForAuthorizationAndExchange(session) {
564
+ async function waitForAuthorizationAndExchange(initialSession) {
561
565
  const spinner = clack_default.spinner();
562
566
  spinner.start("Waiting for browser authorization...");
563
567
  const POLL_INTERVAL_MS = 2e3;
564
568
  const MAX_NETWORK_ERRORS = 5;
569
+ const MAX_SESSION_RETRIES = 2;
565
570
  let consecutiveNetworkErrors = 0;
571
+ let session = initialSession;
572
+ let sessionRetries = 0;
573
+ let pollCount = 0;
566
574
  while (true) {
567
575
  if (!isSessionValid(session)) {
568
- spinner.stop("Session expired");
569
- clack_default.log.error("Authorization session expired before completing.");
570
- printManualOnboardingFallback();
571
- return abort("Session expired", 1);
576
+ if (sessionRetries < MAX_SESSION_RETRIES) {
577
+ sessionRetries++;
578
+ spinner.stop("Session expired \u2014 starting a new one...");
579
+ try {
580
+ session = await startDeviceSession();
581
+ track("cli_device_flow_started", {
582
+ authorization_session_id: session.authorization_session_id,
583
+ retry: sessionRetries
584
+ });
585
+ const formattedCode = formatUserCode(session.user_code);
586
+ const timeRemaining = getSessionTimeRemaining(session);
587
+ console.log("");
588
+ clack_default.note(
589
+ `${chalk.bold("New authorization code:")}
590
+
591
+ ${chalk.bold.green(formattedCode)}
592
+
593
+ ` + chalk.dim(`Code expires in ${Math.floor(timeRemaining / 60)} minutes`),
594
+ "Session Renewed"
595
+ );
596
+ try {
597
+ await open(session.verification_url);
598
+ } catch {
599
+ }
600
+ clack_default.log.message(
601
+ chalk.dim("Browser opened. If not, go to:\n") + ` ${chalk.cyan(session.verification_url)}`
602
+ );
603
+ console.log("");
604
+ spinner.start("Waiting for browser authorization...");
605
+ pollCount = 0;
606
+ consecutiveNetworkErrors = 0;
607
+ continue;
608
+ } catch {
609
+ track("cli_wizard_error", {
610
+ error_type: "device_session_retry_failed",
611
+ error_message: "Failed to start new device session after expiry"
612
+ });
613
+ printManualOnboardingFallback();
614
+ clack_default.log.info("Falling back to manual API key entry.");
615
+ return await promptForManualApiKey();
616
+ }
617
+ } else {
618
+ spinner.stop("Session expired");
619
+ clack_default.log.error("Authorization session expired after multiple attempts.");
620
+ track("cli_wizard_error", {
621
+ error_type: "auth_session_expired",
622
+ error_message: `Session expired after ${MAX_SESSION_RETRIES} retries`
623
+ });
624
+ printManualOnboardingFallback();
625
+ return abort("Session expired", 1);
626
+ }
627
+ }
628
+ const remaining = getSessionTimeRemaining(session);
629
+ const mins = Math.floor(remaining / 60);
630
+ const secs = remaining % 60;
631
+ const timeStr = `${mins}:${secs.toString().padStart(2, "0")}`;
632
+ if (pollCount > 0 && pollCount % 15 === 0) {
633
+ spinner.message(`Waiting... (${timeStr} remaining) \u2014 ${session.verification_url}`);
634
+ } else {
635
+ spinner.message(`Waiting for browser authorization... (${timeStr} remaining)`);
572
636
  }
573
637
  try {
574
638
  const apiKey = await exchangeForApiKey(session);
@@ -582,18 +646,25 @@ async function waitForAuthorizationAndExchange(session) {
582
646
  consecutiveNetworkErrors = 0;
583
647
  break;
584
648
  case "expired":
585
- spinner.stop("Session expired");
586
- clack_default.log.error("Authorization session expired.");
587
- printManualOnboardingFallback();
588
- return abort("Session expired", 1);
649
+ session = { ...session, expires_at: (/* @__PURE__ */ new Date(0)).toISOString() };
650
+ consecutiveNetworkErrors = 0;
651
+ break;
589
652
  case "consumed":
590
653
  spinner.stop("Session already used");
591
654
  clack_default.log.error("This session was already used.");
592
655
  clack_default.log.info("Please run the wizard again to start a new session.");
656
+ track("cli_wizard_error", {
657
+ error_type: "auth_session_consumed",
658
+ error_message: error.message
659
+ });
593
660
  return abort("Session already used", 1);
594
661
  case "invalid":
595
662
  spinner.stop("Invalid session");
596
663
  clack_default.log.error(error.message);
664
+ track("cli_wizard_error", {
665
+ error_type: "auth_session_invalid",
666
+ error_message: error.message
667
+ });
597
668
  printManualOnboardingFallback();
598
669
  return abort("Invalid session", 1);
599
670
  case "network":
@@ -601,6 +672,10 @@ async function waitForAuthorizationAndExchange(session) {
601
672
  if (consecutiveNetworkErrors >= MAX_NETWORK_ERRORS) {
602
673
  spinner.stop("Connection failed");
603
674
  clack_default.log.error(`Failed to reach Nia servers after ${MAX_NETWORK_ERRORS} attempts.`);
675
+ track("cli_wizard_error", {
676
+ error_type: "auth_network_failure",
677
+ error_message: `${MAX_NETWORK_ERRORS} consecutive network errors`
678
+ });
604
679
  printManualOnboardingFallback();
605
680
  return await promptForManualApiKey();
606
681
  }
@@ -608,6 +683,10 @@ async function waitForAuthorizationAndExchange(session) {
608
683
  default:
609
684
  spinner.stop("Error");
610
685
  clack_default.log.error(error.message);
686
+ track("cli_wizard_error", {
687
+ error_type: "auth_unknown_error",
688
+ error_message: error.message
689
+ });
611
690
  printManualOnboardingFallback();
612
691
  return await promptForManualApiKey();
613
692
  }
@@ -617,11 +696,16 @@ async function waitForAuthorizationAndExchange(session) {
617
696
  spinner.stop("Connection failed");
618
697
  clack_default.log.error("Lost connection to Nia servers.");
619
698
  debug(`Exchange error: ${error}`);
699
+ track("cli_wizard_error", {
700
+ error_type: "auth_network_failure",
701
+ error_message: "Lost connection after consecutive errors"
702
+ });
620
703
  printManualOnboardingFallback();
621
704
  return await promptForManualApiKey();
622
705
  }
623
706
  }
624
707
  }
708
+ pollCount++;
625
709
  const backoff = consecutiveNetworkErrors > 0 ? POLL_INTERVAL_MS * Math.min(consecutiveNetworkErrors, 4) : POLL_INTERVAL_MS;
626
710
  await sleep(backoff);
627
711
  }
@@ -3120,7 +3204,7 @@ async function removeMCPServerFromClientsStep() {
3120
3204
  }
3121
3205
 
3122
3206
  // src/run.ts
3123
- import chalk3 from "chalk";
3207
+ import chalk4 from "chalk";
3124
3208
  import { spawnSync as spawnSync6 } from "child_process";
3125
3209
 
3126
3210
  // src/utils/api-key.ts
@@ -3439,6 +3523,59 @@ function runNiaAuthLogin(apiKey) {
3439
3523
  return runLatestNia(["auth", "login", "--api-key", apiKey]);
3440
3524
  }
3441
3525
 
3526
+ // src/utils/outro.ts
3527
+ import chalk3 from "chalk";
3528
+ var pad = " ";
3529
+ function dimBullet(text) {
3530
+ return `${pad}${chalk3.dim("\u2022")} ${text}`;
3531
+ }
3532
+ function buildSuccessOutro(options) {
3533
+ const { installedNiaCliSkill } = options;
3534
+ const sections = [
3535
+ chalk3.green.bold("Nia is ready"),
3536
+ chalk3.dim(
3537
+ "Search indexed code, docs, and papers with citations. Vaults keep synthesized wikis; on macOS you can opt in to personal data."
3538
+ ),
3539
+ "",
3540
+ chalk3.cyan.bold("Pick a starting point"),
3541
+ dimBullet(
3542
+ `${chalk3.white("Documentation")} ${chalk3.dim("\u2014")} ${chalk3.yellow("nia sources index")} ${chalk3.dim("the doc root URL, then")} ${chalk3.white("semantic search")} ${chalk3.dim("with")} ${chalk3.yellow("nia search query")} ${chalk3.dim("for cited answers across the site.")}`
3543
+ ),
3544
+ dimBullet(
3545
+ `${chalk3.white("Codebase")} ${chalk3.dim("\u2014")} ${chalk3.yellow("nia repos index")} ${chalk3.dim("or")} ${chalk3.yellow("nia project init")}${chalk3.dim(";")} ${chalk3.white("sandbox search")} ${chalk3.dim("with")} ${chalk3.yellow("nia search query")} ${chalk3.dim("\u2014 answers grounded in indexed files with citations.")}`
3546
+ ),
3547
+ dimBullet(
3548
+ `${chalk3.white("Research")} ${chalk3.dim("\u2014 index sources, then")} ${chalk3.yellow("nia oracle")} ${chalk3.dim("or deep search for multi-step work.")}`
3549
+ ),
3550
+ dimBullet(
3551
+ `${chalk3.white("Notes that last")} ${chalk3.dim("\u2014")} ${chalk3.yellow("nia vault init")} ${chalk3.dim("builds a wiki from your sources.")}`
3552
+ ),
3553
+ dimBullet(
3554
+ `${chalk3.white("This Mac (optional)")} ${chalk3.dim("\u2014")} ${chalk3.yellow("nia personal status")} ${chalk3.dim("then")} ${chalk3.yellow("nia personal init")} ${chalk3.dim("(sensitive; opt-in).")}`
3555
+ ),
3556
+ ...installedNiaCliSkill ? [
3557
+ dimBullet(
3558
+ `${chalk3.white("CLI skill in agents")} ${chalk3.dim("\u2014")} ${chalk3.yellow("nia skill")} ${chalk3.dim("chooses which coding agents get the Nia skill.")}`
3559
+ )
3560
+ ] : [],
3561
+ "",
3562
+ chalk3.cyan.bold("Ask your coding agent"),
3563
+ `${pad}${chalk3.yellow('"Use Nia to find from how to set up oauth with betterauth propertly?"')}`,
3564
+ `${pad}${chalk3.yellow('"Use Nia to search what are the latest nextjs feature and how to migrate my codebase to it."')}`,
3565
+ `${pad}${chalk3.yellow('"Use Nia to find where we handle auth in this repo and cite the files."')}`,
3566
+ "",
3567
+ chalk3.cyan.bold("Open in the browser"),
3568
+ `${pad}${chalk3.dim("Explore")} ${chalk3.cyan("https://app.trynia.ai/explore")}`,
3569
+ `${pad}${chalk3.dim("App")} ${chalk3.cyan("https://app.trynia.ai")}`,
3570
+ "",
3571
+ chalk3.cyan.bold("Reference"),
3572
+ `${pad}${chalk3.dim("Docs")} ${chalk3.cyan("https://docs.trynia.ai")}`,
3573
+ `${pad}${chalk3.dim("API")} ${chalk3.cyan("https://docs.trynia.ai/api-guide")}`,
3574
+ `${pad}${chalk3.dim("Updates")} ${chalk3.cyan("https://x.com/nozomioai")}`
3575
+ ];
3576
+ return sections.join("\n");
3577
+ }
3578
+
3442
3579
  // src/run.ts
3443
3580
  async function runAddMcpInstall(apiKey) {
3444
3581
  clack_default.log.info("Launching add-mcp installer...\n");
@@ -3498,72 +3635,72 @@ async function runManualMode() {
3498
3635
  return;
3499
3636
  }
3500
3637
  console.log("");
3501
- clack_default.log.info(chalk3.bold(`Configuration for ${client.name}`));
3638
+ clack_default.log.info(chalk4.bold(`Configuration for ${client.name}`));
3502
3639
  console.log("");
3503
3640
  if (client.docsUrl) {
3504
- console.log(chalk3.cyan(" Documentation:"));
3505
- console.log(` ${chalk3.underline(client.docsUrl)}`);
3641
+ console.log(chalk4.cyan(" Documentation:"));
3642
+ console.log(` ${chalk4.underline(client.docsUrl)}`);
3506
3643
  console.log("");
3507
3644
  }
3508
3645
  if (client.note) {
3509
- console.log(chalk3.yellow(" Note:"));
3646
+ console.log(chalk4.yellow(" Note:"));
3510
3647
  console.log(` ${client.note}`);
3511
3648
  console.log("");
3512
3649
  }
3513
3650
  let configPath = "";
3514
3651
  try {
3515
3652
  configPath = await client.getConfigPath();
3516
- console.log(chalk3.cyan(" Config file path:"));
3653
+ console.log(chalk4.cyan(" Config file path:"));
3517
3654
  console.log(` ${configPath}`);
3518
3655
  console.log("");
3519
3656
  } catch {
3520
3657
  if (client.usesCLI) {
3521
- console.log(chalk3.cyan(" Configuration method:"));
3658
+ console.log(chalk4.cyan(" Configuration method:"));
3522
3659
  console.log(` Uses CLI commands (no config file)`);
3523
3660
  console.log("");
3524
3661
  }
3525
3662
  }
3526
3663
  const exampleApiKey = "nk_YOUR_API_KEY_HERE";
3527
- console.log(chalk3.cyan(" Local mode config (stdio):"));
3664
+ console.log(chalk4.cyan(" Local mode config (stdio):"));
3528
3665
  const localConfig = client.getServerConfig(exampleApiKey, "local");
3529
- console.log(chalk3.dim(" Add this to your config file under the servers section:"));
3666
+ console.log(chalk4.dim(" Add this to your config file under the servers section:"));
3530
3667
  console.log("");
3531
- console.log(chalk3.green(` "${client.name === "Cursor" ? "mcpServers" : client.getServerPropertyName()}": {`));
3532
- console.log(chalk3.green(` "nia": ${JSON.stringify(localConfig, null, 6).split("\n").map((line, i) => i === 0 ? line : " " + line).join("\n")}`));
3533
- console.log(chalk3.green(` }`));
3668
+ console.log(chalk4.green(` "${client.name === "Cursor" ? "mcpServers" : client.getServerPropertyName()}": {`));
3669
+ console.log(chalk4.green(` "nia": ${JSON.stringify(localConfig, null, 6).split("\n").map((line, i) => i === 0 ? line : " " + line).join("\n")}`));
3670
+ console.log(chalk4.green(` }`));
3534
3671
  console.log("");
3535
- console.log(chalk3.cyan(" Remote mode config (HTTP):"));
3672
+ console.log(chalk4.cyan(" Remote mode config (HTTP):"));
3536
3673
  const remoteConfig = client.getServerConfig(exampleApiKey, "remote");
3537
- console.log(chalk3.dim(" Add this to your config file under the servers section:"));
3674
+ console.log(chalk4.dim(" Add this to your config file under the servers section:"));
3538
3675
  console.log("");
3539
- console.log(chalk3.green(` "${client.name === "Cursor" ? "mcpServers" : client.getServerPropertyName()}": {`));
3540
- console.log(chalk3.green(` "nia": ${JSON.stringify(remoteConfig, null, 6).split("\n").map((line, i) => i === 0 ? line : " " + line).join("\n")}`));
3541
- console.log(chalk3.green(` }`));
3676
+ console.log(chalk4.green(` "${client.name === "Cursor" ? "mcpServers" : client.getServerPropertyName()}": {`));
3677
+ console.log(chalk4.green(` "nia": ${JSON.stringify(remoteConfig, null, 6).split("\n").map((line, i) => i === 0 ? line : " " + line).join("\n")}`));
3678
+ console.log(chalk4.green(` }`));
3542
3679
  console.log("");
3543
3680
  if (client.usesCLI) {
3544
- console.log(chalk3.cyan(" CLI commands:"));
3681
+ console.log(chalk4.cyan(" CLI commands:"));
3545
3682
  if (client.name === "Claude Code") {
3546
- console.log(chalk3.dim(" Local mode:"));
3683
+ console.log(chalk4.dim(" Local mode:"));
3547
3684
  console.log(` claude mcp add -e "NIA_API_KEY=${exampleApiKey}" -e "NIA_API_URL=https://apigcp.trynia.ai/" -s user nia -- pipx run --no-cache nia-mcp-server`);
3548
3685
  console.log("");
3549
- console.log(chalk3.dim(" Remote mode:"));
3686
+ console.log(chalk4.dim(" Remote mode:"));
3550
3687
  console.log(` claude mcp add --transport http --header "Authorization: Bearer ${exampleApiKey}" -s user nia "${REMOTE_MCP_URL}"`);
3551
3688
  } else if (client.name === "Codex CLI") {
3552
- console.log(chalk3.dim(" Local mode:"));
3689
+ console.log(chalk4.dim(" Local mode:"));
3553
3690
  console.log(` codex mcp add nia --env "NIA_API_KEY=${exampleApiKey}" --env "NIA_API_URL=https://apigcp.trynia.ai/" -- pipx run --no-cache nia-mcp-server`);
3554
3691
  } else if (client.name === "Factory") {
3555
- console.log(chalk3.dim(" Local mode:"));
3692
+ console.log(chalk4.dim(" Local mode:"));
3556
3693
  console.log(` droid mcp add nia "pipx run --no-cache nia-mcp-server" --env "NIA_API_KEY=${exampleApiKey}" --env "NIA_API_URL=https://apigcp.trynia.ai/"`);
3557
3694
  console.log("");
3558
- console.log(chalk3.dim(" Remote mode:"));
3695
+ console.log(chalk4.dim(" Remote mode:"));
3559
3696
  console.log(` droid mcp add nia ${REMOTE_MCP_URL} --type http --header "Authorization: Bearer ${exampleApiKey}"`);
3560
3697
  } else if (client.name === "Amp") {
3561
- console.log(chalk3.dim(" Remote mode:"));
3698
+ console.log(chalk4.dim(" Remote mode:"));
3562
3699
  console.log(` amp mcp add nia --header "Authorization=Bearer ${exampleApiKey}" ${REMOTE_MCP_URL}`);
3563
3700
  }
3564
3701
  console.log("");
3565
3702
  }
3566
- clack_default.outro(chalk3.dim("Press Enter to exit"));
3703
+ clack_default.outro(chalk4.dim("Press Enter to exit"));
3567
3704
  }
3568
3705
  async function runWizard(options) {
3569
3706
  if (options.debug) {
@@ -3630,6 +3767,7 @@ async function runWizard(options) {
3630
3767
  installedAddMcp = true;
3631
3768
  } else {
3632
3769
  clack_default.log.warn("add-mcp installation may have failed");
3770
+ track("cli_wizard_error", { error_type: "install_failed", install_method: "add-mcp" });
3633
3771
  }
3634
3772
  }
3635
3773
  if (action === "mcp") {
@@ -3657,7 +3795,7 @@ async function runWizard(options) {
3657
3795
  mode = "remote";
3658
3796
  clack_default.log.info("Switched to remote mode");
3659
3797
  } else {
3660
- clack_default.outro(chalk3.yellow("Please install dependencies and try again."));
3798
+ clack_default.outro(chalk4.yellow("Please install dependencies and try again."));
3661
3799
  process.exit(1);
3662
3800
  }
3663
3801
  }
@@ -3681,6 +3819,7 @@ async function runWizard(options) {
3681
3819
  installedSkills = true;
3682
3820
  } else {
3683
3821
  clack_default.log.warn("Skills installation may have failed");
3822
+ track("cli_wizard_error", { error_type: "install_failed", install_method: "skills" });
3684
3823
  }
3685
3824
  }
3686
3825
  if (action === "nia-cli") {
@@ -3688,10 +3827,10 @@ async function runWizard(options) {
3688
3827
  const success = await runNiaCliSkillInstall(apiKey);
3689
3828
  if (success) {
3690
3829
  clack_default.log.success("Nia CLI skill installed!");
3691
- clack_default.log.message(chalk3.dim("Run `nia skill` to manage your Nia CLI skill."));
3692
3830
  installedNiaCliSkill = true;
3693
3831
  } else {
3694
3832
  clack_default.log.warn("Nia CLI skill installation may have failed");
3833
+ track("cli_wizard_error", { error_type: "install_failed", install_method: "nia-cli" });
3695
3834
  }
3696
3835
  }
3697
3836
  track("cli_install_completed", {
@@ -3699,43 +3838,27 @@ async function runWizard(options) {
3699
3838
  success: installedAddMcp || installedMcp || installedSkills || installedNiaCliSkill,
3700
3839
  mode: action === "mcp" ? options.local ? "local" : "remote" : void 0
3701
3840
  });
3702
- if (installedAddMcp || installedMcp || installedSkills || installedNiaCliSkill) {
3703
- const niaSkillManagementHint = installedNiaCliSkill ? `
3704
- ${chalk3.cyan("Nia CLI skill management:")} ${chalk3.yellow("Run `nia skill` any time to manage your skill.")}
3705
- ` : "";
3706
- const outroMessage = `
3707
- ${chalk3.green("\u2713 Nia installed!")}
3708
-
3709
- ${niaSkillManagementHint}
3710
-
3711
- ${chalk3.cyan("Get started:")}
3712
- \u2022 Browse pre-indexed sources: ${chalk3.cyan("https://app.trynia.ai/explore")}
3713
- \u2022 Or index your own repos, docs, and papers
3714
-
3715
- ${chalk3.cyan("Try in your coding agent:")}
3716
- ${chalk3.yellow('"List my indexed sources"')}
3717
- ${chalk3.yellow('"Search vercel/ai-sdk for streaming"')}
3718
- ${chalk3.yellow('"Run deep research on agent tool protocols"')}
3719
-
3720
- ${chalk3.dim("Using as API?")} ${chalk3.cyan("https://docs.trynia.ai/api-guide")}
3721
- ${chalk3.dim("Follow us:")} ${chalk3.cyan("https://x.com/nozomioai")}
3722
- `;
3723
- clack_default.outro(outroMessage);
3724
- track("cli_wizard_completed", { outcome: "success", install_method: action, total_duration_ms: Date.now() - startTime });
3841
+ const wizardOutcome = installedAddMcp || installedMcp || installedSkills || installedNiaCliSkill ? "success" : "no_changes";
3842
+ track("cli_wizard_completed", {
3843
+ outcome: wizardOutcome,
3844
+ install_method: action,
3845
+ total_duration_ms: Date.now() - startTime
3846
+ });
3847
+ if (wizardOutcome === "success") {
3848
+ clack_default.outro(buildSuccessOutro({ installedNiaCliSkill }));
3725
3849
  } else {
3726
- clack_default.outro(chalk3.dim("No changes made."));
3727
- track("cli_wizard_completed", { outcome: "no_changes", install_method: action, total_duration_ms: Date.now() - startTime });
3850
+ clack_default.outro(chalk4.dim("No changes made."));
3728
3851
  }
3729
3852
  await shutdown();
3730
3853
  }
3731
3854
 
3732
3855
  // src/mcp.ts
3733
- import chalk4 from "chalk";
3856
+ import chalk5 from "chalk";
3734
3857
  async function runMCPAdd(options) {
3735
3858
  if (options.debug) {
3736
3859
  enableDebug();
3737
3860
  }
3738
- clack_default.intro(chalk4.bgCyan.black(" Nia Agent Setup "));
3861
+ clack_default.intro(chalk5.bgCyan.black(" Nia Agent Setup "));
3739
3862
  const apiKey = await getApiKey(options.apiKey);
3740
3863
  let mode;
3741
3864
  if (options.local !== void 0) {
@@ -3761,7 +3884,7 @@ async function runMCPAdd(options) {
3761
3884
  mode = "remote";
3762
3885
  clack_default.log.info("Switched to remote mode");
3763
3886
  } else {
3764
- clack_default.outro(chalk4.yellow("Please install dependencies and try again."));
3887
+ clack_default.outro(chalk5.yellow("Please install dependencies and try again."));
3765
3888
  process.exit(1);
3766
3889
  }
3767
3890
  }
@@ -3777,27 +3900,27 @@ async function runMCPAdd(options) {
3777
3900
  });
3778
3901
  if (installedClients.length > 0) {
3779
3902
  clack_default.log.message(
3780
- chalk4.dim("You may need to restart your coding agents to load Nia.")
3903
+ chalk5.dim("You may need to restart your coding agents to load Nia.")
3781
3904
  );
3782
3905
  }
3783
- clack_default.outro(chalk4.green("Done!"));
3906
+ clack_default.outro(chalk5.green("Done!"));
3784
3907
  }
3785
3908
  async function runMCPRemove(options = {}) {
3786
3909
  if (options.debug) {
3787
3910
  enableDebug();
3788
3911
  }
3789
- clack_default.intro(chalk4.bgRed.white(" Remove Nia "));
3912
+ clack_default.intro(chalk5.bgRed.white(" Remove Nia "));
3790
3913
  const removedClients = await removeMCPServerFromClientsStep();
3791
3914
  if (removedClients.length > 0) {
3792
3915
  clack_default.log.message(
3793
- chalk4.dim("You may need to restart your coding agents for changes to take effect.")
3916
+ chalk5.dim("You may need to restart your coding agents for changes to take effect.")
3794
3917
  );
3795
3918
  }
3796
- clack_default.outro(chalk4.green("Done!"));
3919
+ clack_default.outro(chalk5.green("Done!"));
3797
3920
  }
3798
3921
 
3799
3922
  // src/skill.ts
3800
- import chalk5 from "chalk";
3923
+ import chalk6 from "chalk";
3801
3924
  import { spawnSync as spawnSync7 } from "child_process";
3802
3925
  var DEFAULT_SKILL_SOURCE = "nozomio-labs/nia-skill";
3803
3926
  var NON_INTERACTIVE_TIMEOUT_MS = 3e4;
@@ -3809,7 +3932,7 @@ async function runSkillAdd(options) {
3809
3932
  const source = options.source || DEFAULT_SKILL_SOURCE;
3810
3933
  const allAgents = Boolean(options.allAgents);
3811
3934
  if (!options.json && !options.embedded) {
3812
- clack_default.intro(chalk5.bgCyan.black(" Nia Skill Installer "));
3935
+ clack_default.intro(chalk6.bgCyan.black(" Nia Skill Installer "));
3813
3936
  }
3814
3937
  if (allAgents && options.target) {
3815
3938
  throw new Error("Use either `--target` or `--all-agents`, not both.");
@@ -3867,7 +3990,7 @@ async function runSkillAdd(options) {
3867
3990
  if (!options.json) {
3868
3991
  clack_default.log.success("Nia skill installed!");
3869
3992
  if (!options.embedded) {
3870
- clack_default.outro(chalk5.green("Done!"));
3993
+ clack_default.outro(chalk6.green("Done!"));
3871
3994
  }
3872
3995
  }
3873
3996
  }
@@ -4136,4 +4259,4 @@ export {
4136
4259
  getAgentGuideMarkdown,
4137
4260
  printAgentGuide
4138
4261
  };
4139
- //# sourceMappingURL=chunk-D6YKHBNX.js.map
4262
+ //# sourceMappingURL=chunk-MZY5RGCT.js.map