@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.
- package/bin/cli.js +22 -13
- 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
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
token
|
|
728
|
-
|
|
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);
|