@nexusmcp/cli 1.1.0 → 1.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/bin/cli.js +22 -13
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -714,19 +714,28 @@ if (command === 'uninstall') runUninstall();
714
714
  if (command === 'init') {
715
715
  console.log('[NEXUS-CLI] 🚀 Initializing Nexus MCP in current repository...');
716
716
 
717
- const apiUrl = (flags.server || flags.url || process.env.NEXUS_API_URL || DEFAULT_API_URL).replace(/\/$/, '');
718
- let token = flags.token || process.env.NEXUS_API_KEY;
719
- let projectId = flags['project-id'] || process.env.NEXUS_PROJECT_ID;
720
-
721
- if (flags.token) {
722
- console.warn('[NEXUS-CLI] Warning: --token may be retained in shell history. Prefer setting NEXUS_API_KEY in the process environment.');
723
- }
724
-
725
- if (!token || token === 'nx_live_default_token') {
726
- const authorized = await authorizeDevice(apiUrl);
727
- token = authorized.token;
728
- projectId = authorized.projectId;
729
- }
717
+ const apiUrl = (flags.server || flags.url || process.env.NEXUS_API_URL || DEFAULT_API_URL).replace(/\/$/, '');
718
+ let token = flags.token || process.env.NEXUS_API_KEY;
719
+ let projectId = flags['project-id'] || process.env.NEXUS_PROJECT_ID;
720
+ const manualCredentialFlagProvided = Boolean(flags.token || flags['project-id']);
721
+
722
+ if (flags.token) {
723
+ console.warn('[NEXUS-CLI] Warning: --token may be retained in shell history. Prefer setting NEXUS_API_KEY in the process environment.');
724
+ }
725
+
726
+ if (manualCredentialFlagProvided && (!token || !projectId)) {
727
+ console.error('[NEXUS-CLI] Manual credential mode requires both --token and --project-id (or the missing matching environment value).');
728
+ process.exit(1);
729
+ }
730
+
731
+ if (!token || !projectId || token === 'nx_live_default_token') {
732
+ if (token || projectId) {
733
+ console.log('[NEXUS-CLI] Ignoring incomplete Nexus environment credentials and starting browser authorization.');
734
+ }
735
+ const authorized = await authorizeDevice(apiUrl);
736
+ token = authorized.token;
737
+ projectId = authorized.projectId;
738
+ }
730
739
  if (!projectId) {
731
740
  console.error('[NEXUS-CLI] Missing project id. Pass --project-id or set NEXUS_PROJECT_ID so hooks cannot ingest into the wrong tenant.');
732
741
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexusmcp/cli",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Nexus MCP Lightweight Onboarding CLI & Session Hook Assistant",
5
5
  "main": "bin/cli.js",
6
6
  "files": [