@juspay/neurolink 7.34.0 → 7.35.0
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/CHANGELOG.md +6 -0
- package/README.md +64 -7
- package/dist/cli/commands/setup-anthropic.d.ts +16 -0
- package/dist/cli/commands/setup-anthropic.js +414 -0
- package/dist/cli/commands/setup-azure.d.ts +17 -0
- package/dist/cli/commands/setup-azure.js +415 -0
- package/dist/cli/commands/setup-bedrock.d.ts +13 -0
- package/dist/cli/commands/setup-bedrock.js +487 -0
- package/dist/cli/commands/setup-gcp.d.ts +18 -0
- package/dist/cli/commands/setup-gcp.js +569 -0
- package/dist/cli/commands/setup-google-ai.d.ts +16 -0
- package/dist/cli/commands/setup-google-ai.js +369 -0
- package/dist/cli/commands/setup-huggingface.d.ts +8 -0
- package/dist/cli/commands/setup-huggingface.js +200 -0
- package/dist/cli/commands/setup-mistral.d.ts +8 -0
- package/dist/cli/commands/setup-mistral.js +233 -0
- package/dist/cli/commands/setup-openai.d.ts +16 -0
- package/dist/cli/commands/setup-openai.js +402 -0
- package/dist/cli/commands/setup.d.ts +19 -0
- package/dist/cli/commands/setup.js +539 -0
- package/dist/cli/factories/commandFactory.d.ts +4 -0
- package/dist/cli/factories/commandFactory.js +41 -0
- package/dist/cli/factories/setupCommandFactory.d.ts +18 -0
- package/dist/cli/factories/setupCommandFactory.js +137 -0
- package/dist/cli/parser.js +4 -1
- package/dist/cli/utils/envManager.d.ts +3 -2
- package/dist/cli/utils/envManager.js +18 -4
- package/package.json +1 -1
@@ -0,0 +1,137 @@
|
|
1
|
+
/**
|
2
|
+
* Setup Command Factory for NeuroLink
|
3
|
+
* Consolidates all provider setup commands into a unified interface
|
4
|
+
*/
|
5
|
+
import { handleGCPSetup } from "../commands/setup-gcp.js";
|
6
|
+
import { handleBedrockSetup } from "../commands/setup-bedrock.js";
|
7
|
+
import { handleOpenAISetup } from "../commands/setup-openai.js";
|
8
|
+
import { handleGoogleAISetup } from "../commands/setup-google-ai.js";
|
9
|
+
import { handleAnthropicSetup } from "../commands/setup-anthropic.js";
|
10
|
+
import { handleAzureSetup } from "../commands/setup-azure.js";
|
11
|
+
import { handleHuggingFaceSetup } from "../commands/setup-huggingface.js";
|
12
|
+
import { handleMistralSetup } from "../commands/setup-mistral.js";
|
13
|
+
import { handleSetup } from "../commands/setup.js";
|
14
|
+
/**
|
15
|
+
* Setup Command Factory
|
16
|
+
*/
|
17
|
+
export class SetupCommandFactory {
|
18
|
+
/**
|
19
|
+
* Create the main setup command with all provider subcommands
|
20
|
+
*/
|
21
|
+
static createSetupCommands() {
|
22
|
+
return {
|
23
|
+
command: ["setup [provider]", "s [provider]"],
|
24
|
+
describe: "Setup AI provider configurations",
|
25
|
+
builder: (yargs) => {
|
26
|
+
return (yargs
|
27
|
+
.positional("provider", {
|
28
|
+
type: "string",
|
29
|
+
description: "Specific provider to set up",
|
30
|
+
choices: [
|
31
|
+
"google-ai",
|
32
|
+
"openai",
|
33
|
+
"anthropic",
|
34
|
+
"azure",
|
35
|
+
"bedrock",
|
36
|
+
"gcp",
|
37
|
+
"vertex",
|
38
|
+
"huggingface",
|
39
|
+
"mistral",
|
40
|
+
],
|
41
|
+
})
|
42
|
+
.option("list", {
|
43
|
+
type: "boolean",
|
44
|
+
description: "List all available providers",
|
45
|
+
alias: "l",
|
46
|
+
})
|
47
|
+
.option("status", {
|
48
|
+
type: "boolean",
|
49
|
+
description: "Show provider configuration status",
|
50
|
+
})
|
51
|
+
.option("check", {
|
52
|
+
type: "boolean",
|
53
|
+
description: "Only check existing configuration without prompting",
|
54
|
+
default: false,
|
55
|
+
})
|
56
|
+
.option("non-interactive", {
|
57
|
+
type: "boolean",
|
58
|
+
description: "Skip interactive prompts",
|
59
|
+
default: false,
|
60
|
+
})
|
61
|
+
.option("quiet", {
|
62
|
+
type: "boolean",
|
63
|
+
alias: "q",
|
64
|
+
default: false,
|
65
|
+
description: "Suppress non-essential output",
|
66
|
+
})
|
67
|
+
.option("debug", {
|
68
|
+
type: "boolean",
|
69
|
+
default: false,
|
70
|
+
description: "Enable debug output",
|
71
|
+
})
|
72
|
+
// Subcommands for each provider
|
73
|
+
.command("google-ai", "Setup Google AI Studio configuration", (y) => this.buildProviderOptions(y),
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
75
|
+
async (argv) => await handleGoogleAISetup(argv))
|
76
|
+
.command("openai", "Setup OpenAI configuration", (y) => this.buildProviderOptions(y),
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
78
|
+
async (argv) => await handleOpenAISetup(argv))
|
79
|
+
.command("anthropic", "Setup Anthropic Claude configuration", (y) => this.buildProviderOptions(y),
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
81
|
+
async (argv) => await handleAnthropicSetup(argv))
|
82
|
+
.command("azure", "Setup Azure OpenAI configuration", (y) => this.buildProviderOptions(y),
|
83
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
84
|
+
async (argv) => await handleAzureSetup(argv))
|
85
|
+
.command("bedrock", "Setup AWS Bedrock configuration", (y) => this.buildProviderOptions(y),
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
87
|
+
async (argv) => await handleBedrockSetup(argv))
|
88
|
+
.command(["gcp", "vertex"], "Setup Google Cloud Platform / Vertex AI configuration", (y) => this.buildProviderOptions(y),
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
90
|
+
async (argv) => await handleGCPSetup(argv))
|
91
|
+
.command("huggingface", "Setup Hugging Face configuration", (y) => this.buildProviderOptions(y),
|
92
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
93
|
+
async (argv) => await handleHuggingFaceSetup(argv))
|
94
|
+
.command("mistral", "Setup Mistral AI configuration", (y) => this.buildProviderOptions(y),
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
96
|
+
async (argv) => await handleMistralSetup(argv))
|
97
|
+
.example("$0 setup", "Interactive setup wizard")
|
98
|
+
.example("$0 setup google-ai", "Setup Google AI Studio")
|
99
|
+
.example("$0 setup openai --check", "Check OpenAI configuration")
|
100
|
+
.example("$0 setup --list", "List all providers")
|
101
|
+
.example("$0 setup --status", "Check provider status")
|
102
|
+
.help());
|
103
|
+
},
|
104
|
+
handler: async (argv) => {
|
105
|
+
// If no subcommand specified, run main setup wizard
|
106
|
+
await handleSetup(argv);
|
107
|
+
},
|
108
|
+
};
|
109
|
+
}
|
110
|
+
/**
|
111
|
+
* Build common options for provider setup commands
|
112
|
+
*/
|
113
|
+
static buildProviderOptions(yargs) {
|
114
|
+
return yargs
|
115
|
+
.option("check", {
|
116
|
+
type: "boolean",
|
117
|
+
describe: "Only check existing configuration without prompting",
|
118
|
+
default: false,
|
119
|
+
})
|
120
|
+
.option("non-interactive", {
|
121
|
+
type: "boolean",
|
122
|
+
describe: "Skip interactive prompts",
|
123
|
+
default: false,
|
124
|
+
})
|
125
|
+
.option("quiet", {
|
126
|
+
type: "boolean",
|
127
|
+
alias: "q",
|
128
|
+
default: false,
|
129
|
+
description: "Suppress non-essential output",
|
130
|
+
})
|
131
|
+
.option("debug", {
|
132
|
+
type: "boolean",
|
133
|
+
default: false,
|
134
|
+
description: "Enable debug output",
|
135
|
+
});
|
136
|
+
}
|
137
|
+
}
|
package/dist/cli/parser.js
CHANGED
@@ -6,6 +6,7 @@ import { CLICommandFactory } from "./factories/commandFactory.js";
|
|
6
6
|
import { globalSession } from "../lib/session/globalSessionState.js";
|
7
7
|
import { handleError } from "./errorHandler.js";
|
8
8
|
import { logger } from "../lib/utils/logger.js";
|
9
|
+
import { SetupCommandFactory } from "./factories/setupCommandFactory.js";
|
9
10
|
// Enhanced CLI with Professional UX
|
10
11
|
export function initializeCliParser() {
|
11
12
|
return (yargs(hideBin(process.argv))
|
@@ -154,5 +155,7 @@ export function initializeCliParser() {
|
|
154
155
|
// SageMaker Command Group - Using CLICommandFactory
|
155
156
|
.command(CLICommandFactory.createSageMakerCommands())
|
156
157
|
// Loop Command - Using CLICommandFactory
|
157
|
-
.command(CLICommandFactory.createLoopCommand())
|
158
|
+
.command(CLICommandFactory.createLoopCommand())
|
159
|
+
// Setup Commands - Using SetupCommandFactory
|
160
|
+
.command(SetupCommandFactory.createSetupCommands())); // Close the main return statement
|
158
161
|
}
|
@@ -12,6 +12,7 @@ export interface EnvUpdateResult {
|
|
12
12
|
updated: string[];
|
13
13
|
added: string[];
|
14
14
|
unchanged: string[];
|
15
|
+
deleted: string[];
|
15
16
|
}
|
16
17
|
/**
|
17
18
|
* Create a timestamped backup of the existing .env file
|
@@ -24,11 +25,11 @@ export declare function parseEnvFile(content: string): Record<string, string>;
|
|
24
25
|
/**
|
25
26
|
* Generate .env file content from key-value pairs
|
26
27
|
*/
|
27
|
-
export declare function generateEnvContent(envVars: Record<string, string>, existingContent?: string): string;
|
28
|
+
export declare function generateEnvContent(envVars: Record<string, string>, existingContent?: string, keysToDelete?: string[]): string;
|
28
29
|
/**
|
29
30
|
* Update .env file with new environment variables
|
30
31
|
*/
|
31
|
-
export declare function updateEnvFile(newVars: Record<string, string>, envPath?: string, createBackup?: boolean): EnvUpdateResult;
|
32
|
+
export declare function updateEnvFile(newVars: Record<string, string>, envPath?: string, createBackup?: boolean, keysToDelete?: string[]): EnvUpdateResult;
|
32
33
|
/**
|
33
34
|
* Display environment file update summary
|
34
35
|
*/
|
@@ -59,7 +59,7 @@ export function parseEnvFile(content) {
|
|
59
59
|
/**
|
60
60
|
* Generate .env file content from key-value pairs
|
61
61
|
*/
|
62
|
-
export function generateEnvContent(envVars, existingContent) {
|
62
|
+
export function generateEnvContent(envVars, existingContent, keysToDelete = []) {
|
63
63
|
const lines = [];
|
64
64
|
const _existingVars = existingContent ? parseEnvFile(existingContent) : {};
|
65
65
|
const processedKeys = new Set();
|
@@ -79,6 +79,10 @@ export function generateEnvContent(envVars, existingContent) {
|
|
79
79
|
continue;
|
80
80
|
}
|
81
81
|
const key = trimmedLine.substring(0, equalIndex).trim();
|
82
|
+
// Skip keys that should be deleted
|
83
|
+
if (keysToDelete.includes(key)) {
|
84
|
+
continue; // Skip this line - delete the key
|
85
|
+
}
|
82
86
|
if (Object.prototype.hasOwnProperty.call(envVars, key)) {
|
83
87
|
// Update existing variable
|
84
88
|
lines.push(`${key}=${envVars[key]}`);
|
@@ -108,12 +112,13 @@ export function generateEnvContent(envVars, existingContent) {
|
|
108
112
|
/**
|
109
113
|
* Update .env file with new environment variables
|
110
114
|
*/
|
111
|
-
export function updateEnvFile(newVars, envPath = ".env", createBackup = true) {
|
115
|
+
export function updateEnvFile(newVars, envPath = ".env", createBackup = true, keysToDelete = []) {
|
112
116
|
const result = {
|
113
117
|
backup: { existed: false },
|
114
118
|
updated: [],
|
115
119
|
added: [],
|
116
120
|
unchanged: [],
|
121
|
+
deleted: [],
|
117
122
|
};
|
118
123
|
// Create backup if requested and file exists
|
119
124
|
if (createBackup) {
|
@@ -126,6 +131,12 @@ export function updateEnvFile(newVars, envPath = ".env", createBackup = true) {
|
|
126
131
|
existingContent = fs.readFileSync(envPath, "utf8");
|
127
132
|
_existingVars = parseEnvFile(existingContent);
|
128
133
|
}
|
134
|
+
// Track keys to be deleted
|
135
|
+
for (const key of keysToDelete) {
|
136
|
+
if (Object.prototype.hasOwnProperty.call(_existingVars, key)) {
|
137
|
+
result.deleted.push(key);
|
138
|
+
}
|
139
|
+
}
|
129
140
|
// Categorize changes
|
130
141
|
for (const [key, value] of Object.entries(newVars)) {
|
131
142
|
if (Object.prototype.hasOwnProperty.call(_existingVars, key)) {
|
@@ -141,7 +152,7 @@ export function updateEnvFile(newVars, envPath = ".env", createBackup = true) {
|
|
141
152
|
}
|
142
153
|
}
|
143
154
|
// Generate new content
|
144
|
-
const newContent = generateEnvContent(newVars, existingContent);
|
155
|
+
const newContent = generateEnvContent(newVars, existingContent, keysToDelete);
|
145
156
|
// Write updated file
|
146
157
|
try {
|
147
158
|
fs.writeFileSync(envPath, newContent, "utf8");
|
@@ -167,10 +178,13 @@ export function displayEnvUpdateSummary(result, quiet = false) {
|
|
167
178
|
if (result.updated.length > 0) {
|
168
179
|
logger.always(chalk.yellow(`🔄 Updated ${result.updated.length} existing variables: ${result.updated.join(", ")}`));
|
169
180
|
}
|
181
|
+
if (result.deleted.length > 0) {
|
182
|
+
logger.always(chalk.red(`🗑️ Deleted ${result.deleted.length} variables: ${result.deleted.join(", ")}`));
|
183
|
+
}
|
170
184
|
if (result.unchanged.length > 0) {
|
171
185
|
logger.always(chalk.gray(`✓ ${result.unchanged.length} variables unchanged: ${result.unchanged.join(", ")}`));
|
172
186
|
}
|
173
|
-
const totalChanges = result.added.length + result.updated.length;
|
187
|
+
const totalChanges = result.added.length + result.updated.length + result.deleted.length;
|
174
188
|
if (totalChanges > 0) {
|
175
189
|
logger.always(chalk.blue(`📝 Environment file updated with ${totalChanges} changes`));
|
176
190
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@juspay/neurolink",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.35.0",
|
4
4
|
"description": "Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and deploy AI applications with 9 major providers: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure, Hugging Face, Ollama, and Mistral AI.",
|
5
5
|
"author": {
|
6
6
|
"name": "Juspay Technologies",
|