@majkapp/majk-chat-cli 1.0.2 → 1.0.4
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 +440 -90
- package/dist/cli.js +214 -3
- package/dist/cli.js.map +1 -1
- package/dist/utils/credentials.d.ts +6 -0
- package/dist/utils/credentials.d.ts.map +1 -1
- package/dist/utils/credentials.js +58 -13
- package/dist/utils/credentials.js.map +1 -1
- package/dist/utils/profile-config.d.ts +92 -0
- package/dist/utils/profile-config.d.ts.map +1 -0
- package/dist/utils/profile-config.js +445 -0
- package/dist/utils/profile-config.js.map +1 -0
- package/package.json +6 -5
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { ProviderConfig } from '@majkapp/majk-chat-core';
|
|
2
|
+
export interface ProfileProviderConfig {
|
|
3
|
+
openai?: {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
organizationId?: string;
|
|
6
|
+
};
|
|
7
|
+
anthropic?: {
|
|
8
|
+
apiKey: string;
|
|
9
|
+
};
|
|
10
|
+
'azure-openai'?: {
|
|
11
|
+
apiKey: string;
|
|
12
|
+
endpoint: string;
|
|
13
|
+
deploymentName: string;
|
|
14
|
+
};
|
|
15
|
+
bedrock?: {
|
|
16
|
+
accessKeyId: string;
|
|
17
|
+
secretAccessKey: string;
|
|
18
|
+
sessionToken?: string;
|
|
19
|
+
region: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface ProfileConfig {
|
|
23
|
+
providers: ProfileProviderConfig;
|
|
24
|
+
}
|
|
25
|
+
export interface MagicChatConfig {
|
|
26
|
+
profiles: Record<string, ProfileConfig>;
|
|
27
|
+
}
|
|
28
|
+
export interface ValidationResult {
|
|
29
|
+
provider: string;
|
|
30
|
+
profile: string;
|
|
31
|
+
valid: boolean;
|
|
32
|
+
error?: string;
|
|
33
|
+
model?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface DirectConfigOptions {
|
|
36
|
+
setOpenaiKey?: string;
|
|
37
|
+
openaiOrgId?: string;
|
|
38
|
+
setAnthropicKey?: string;
|
|
39
|
+
setAzureOpenaiKey?: string;
|
|
40
|
+
azureOpenaiEndpoint?: string;
|
|
41
|
+
azureOpenaiDeployment?: string;
|
|
42
|
+
setBedrock?: boolean;
|
|
43
|
+
awsAccessKeyId?: string;
|
|
44
|
+
awsSecretAccessKey?: string;
|
|
45
|
+
awsSessionToken?: string;
|
|
46
|
+
awsRegion?: string;
|
|
47
|
+
profile?: string;
|
|
48
|
+
skipValidation?: boolean;
|
|
49
|
+
}
|
|
50
|
+
export declare class ProfileConfigManager {
|
|
51
|
+
private configPath;
|
|
52
|
+
constructor();
|
|
53
|
+
loadConfig(): Promise<MagicChatConfig>;
|
|
54
|
+
saveConfig(config: MagicChatConfig): Promise<void>;
|
|
55
|
+
getProfile(profileName?: string): Promise<ProfileConfig | null>;
|
|
56
|
+
setProfile(profileName: string, profileConfig: ProfileConfig): Promise<void>;
|
|
57
|
+
deleteProfile(profileName: string): Promise<boolean>;
|
|
58
|
+
listProfiles(): Promise<string[]>;
|
|
59
|
+
/**
|
|
60
|
+
* Get provider credentials from profile for use with existing CredentialManager
|
|
61
|
+
*/
|
|
62
|
+
getProviderCredentials(provider: string, profileName?: string): Promise<ProviderConfig | null>;
|
|
63
|
+
/**
|
|
64
|
+
* Interactive configuration for a provider
|
|
65
|
+
*/
|
|
66
|
+
configureProvider(provider: string, profileName?: string, skipValidation?: boolean): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Direct configuration without interaction
|
|
69
|
+
*/
|
|
70
|
+
setDirectConfig(options: DirectConfigOptions): Promise<void>;
|
|
71
|
+
private configureOpenAI;
|
|
72
|
+
private configureAnthropic;
|
|
73
|
+
private configureAzureOpenAI;
|
|
74
|
+
private configureBedrock;
|
|
75
|
+
/**
|
|
76
|
+
* Validate provider configuration by making a test API call
|
|
77
|
+
*/
|
|
78
|
+
private validateProvider;
|
|
79
|
+
/**
|
|
80
|
+
* Test all providers in a profile
|
|
81
|
+
*/
|
|
82
|
+
testProfile(profileName: string): Promise<ValidationResult[]>;
|
|
83
|
+
/**
|
|
84
|
+
* Test specific provider in a profile
|
|
85
|
+
*/
|
|
86
|
+
testProvider(provider: string, profileName?: string): Promise<ValidationResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Test all profiles
|
|
89
|
+
*/
|
|
90
|
+
testAllProfiles(): Promise<ValidationResult[]>;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=profile-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-config.d.ts","sourceRoot":"","sources":["../../src/utils/profile-config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAIzD,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,SAAS,CAAC,EAAE;QACV,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,cAAc,CAAC,EAAE;QACf,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,OAAO,CAAC,EAAE;QACR,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,qBAAqB,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf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AE,MAAkB,EAAE,cAAc,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IA0B1H;;OAEG;IACG,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;YA0DpD,eAAe;YA4Bf,kBAAkB;YAqBlB,oBAAoB;YAmCpB,gBAAgB;IA0C9B;;OAEG;YACW,gBAAgB;IAmD9B;;OAEG;IACG,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAkBnE;;OAEG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,GAAE,MAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA0DhG;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAWrD"}
|
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.ProfileConfigManager = void 0;
|
|
40
|
+
const fs = __importStar(require("fs-extra"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const os = __importStar(require("os"));
|
|
43
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
44
|
+
const enquirer_1 = require("enquirer");
|
|
45
|
+
class ProfileConfigManager {
|
|
46
|
+
configPath;
|
|
47
|
+
constructor() {
|
|
48
|
+
this.configPath = path.join(os.homedir(), '.magic', 'chat', 'config.json');
|
|
49
|
+
}
|
|
50
|
+
async loadConfig() {
|
|
51
|
+
if (!await fs.pathExists(this.configPath)) {
|
|
52
|
+
return { profiles: {} };
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
return await fs.readJson(this.configPath);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.warn(chalk_1.default.yellow(`Warning: Could not parse config file: ${error}`));
|
|
59
|
+
return { profiles: {} };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async saveConfig(config) {
|
|
63
|
+
await fs.ensureDir(path.dirname(this.configPath));
|
|
64
|
+
await fs.writeJson(this.configPath, config, { spaces: 2 });
|
|
65
|
+
}
|
|
66
|
+
async getProfile(profileName = 'default') {
|
|
67
|
+
const config = await this.loadConfig();
|
|
68
|
+
return config.profiles[profileName] || null;
|
|
69
|
+
}
|
|
70
|
+
async setProfile(profileName, profileConfig) {
|
|
71
|
+
const config = await this.loadConfig();
|
|
72
|
+
config.profiles[profileName] = profileConfig;
|
|
73
|
+
await this.saveConfig(config);
|
|
74
|
+
}
|
|
75
|
+
async deleteProfile(profileName) {
|
|
76
|
+
const config = await this.loadConfig();
|
|
77
|
+
if (config.profiles[profileName]) {
|
|
78
|
+
delete config.profiles[profileName];
|
|
79
|
+
await this.saveConfig(config);
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
async listProfiles() {
|
|
85
|
+
const config = await this.loadConfig();
|
|
86
|
+
return Object.keys(config.profiles);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get provider credentials from profile for use with existing CredentialManager
|
|
90
|
+
*/
|
|
91
|
+
async getProviderCredentials(provider, profileName = 'default') {
|
|
92
|
+
const profile = await this.getProfile(profileName);
|
|
93
|
+
if (!profile || !profile.providers[provider]) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const providerConfig = profile.providers[provider];
|
|
97
|
+
switch (provider) {
|
|
98
|
+
case 'openai':
|
|
99
|
+
const openaiConfig = providerConfig;
|
|
100
|
+
return {
|
|
101
|
+
apiKey: openaiConfig?.apiKey,
|
|
102
|
+
organizationId: openaiConfig?.organizationId
|
|
103
|
+
};
|
|
104
|
+
case 'anthropic':
|
|
105
|
+
const anthropicConfig = providerConfig;
|
|
106
|
+
return {
|
|
107
|
+
apiKey: anthropicConfig?.apiKey
|
|
108
|
+
};
|
|
109
|
+
case 'azure-openai':
|
|
110
|
+
const azureConfig = providerConfig;
|
|
111
|
+
return {
|
|
112
|
+
apiKey: azureConfig?.apiKey,
|
|
113
|
+
endpoint: azureConfig?.endpoint,
|
|
114
|
+
deploymentName: azureConfig?.deploymentName
|
|
115
|
+
};
|
|
116
|
+
case 'bedrock':
|
|
117
|
+
const bedrockConfig = providerConfig;
|
|
118
|
+
return {
|
|
119
|
+
accessKeyId: bedrockConfig?.accessKeyId,
|
|
120
|
+
secretAccessKey: bedrockConfig?.secretAccessKey,
|
|
121
|
+
sessionToken: bedrockConfig?.sessionToken,
|
|
122
|
+
region: bedrockConfig?.region || 'us-east-1'
|
|
123
|
+
};
|
|
124
|
+
default:
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Interactive configuration for a provider
|
|
130
|
+
*/
|
|
131
|
+
async configureProvider(provider, profileName = 'default', skipValidation = false) {
|
|
132
|
+
console.log(chalk_1.default.cyan(`\nConfiguring ${provider} for profile: ${chalk_1.default.bold(profileName)}`));
|
|
133
|
+
const profile = await this.getProfile(profileName) || { providers: {} };
|
|
134
|
+
switch (provider) {
|
|
135
|
+
case 'openai':
|
|
136
|
+
await this.configureOpenAI(profile, skipValidation);
|
|
137
|
+
break;
|
|
138
|
+
case 'anthropic':
|
|
139
|
+
await this.configureAnthropic(profile, skipValidation);
|
|
140
|
+
break;
|
|
141
|
+
case 'azure-openai':
|
|
142
|
+
await this.configureAzureOpenAI(profile, skipValidation);
|
|
143
|
+
break;
|
|
144
|
+
case 'bedrock':
|
|
145
|
+
await this.configureBedrock(profile, skipValidation);
|
|
146
|
+
break;
|
|
147
|
+
default:
|
|
148
|
+
throw new Error(`Unsupported provider: ${provider}`);
|
|
149
|
+
}
|
|
150
|
+
await this.setProfile(profileName, profile);
|
|
151
|
+
console.log(chalk_1.default.green(`\n✓ ${provider} configuration saved to profile: ${profileName}`));
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Direct configuration without interaction
|
|
155
|
+
*/
|
|
156
|
+
async setDirectConfig(options) {
|
|
157
|
+
const profileName = options.profile || 'default';
|
|
158
|
+
const profile = await this.getProfile(profileName) || { providers: {} };
|
|
159
|
+
// OpenAI
|
|
160
|
+
if (options.setOpenaiKey) {
|
|
161
|
+
profile.providers.openai = {
|
|
162
|
+
apiKey: options.setOpenaiKey,
|
|
163
|
+
organizationId: options.openaiOrgId
|
|
164
|
+
};
|
|
165
|
+
if (!options.skipValidation) {
|
|
166
|
+
await this.validateProvider('openai', profile.providers.openai, profileName);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Anthropic
|
|
170
|
+
if (options.setAnthropicKey) {
|
|
171
|
+
profile.providers.anthropic = {
|
|
172
|
+
apiKey: options.setAnthropicKey
|
|
173
|
+
};
|
|
174
|
+
if (!options.skipValidation) {
|
|
175
|
+
await this.validateProvider('anthropic', profile.providers.anthropic, profileName);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
// Azure OpenAI
|
|
179
|
+
if (options.setAzureOpenaiKey && options.azureOpenaiEndpoint && options.azureOpenaiDeployment) {
|
|
180
|
+
profile.providers['azure-openai'] = {
|
|
181
|
+
apiKey: options.setAzureOpenaiKey,
|
|
182
|
+
endpoint: options.azureOpenaiEndpoint,
|
|
183
|
+
deploymentName: options.azureOpenaiDeployment
|
|
184
|
+
};
|
|
185
|
+
if (!options.skipValidation) {
|
|
186
|
+
await this.validateProvider('azure-openai', profile.providers['azure-openai'], profileName);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// Bedrock
|
|
190
|
+
if (options.setBedrock && options.awsAccessKeyId && options.awsSecretAccessKey) {
|
|
191
|
+
profile.providers.bedrock = {
|
|
192
|
+
accessKeyId: options.awsAccessKeyId,
|
|
193
|
+
secretAccessKey: options.awsSecretAccessKey,
|
|
194
|
+
sessionToken: options.awsSessionToken,
|
|
195
|
+
region: options.awsRegion || 'us-east-1'
|
|
196
|
+
};
|
|
197
|
+
if (!options.skipValidation) {
|
|
198
|
+
await this.validateProvider('bedrock', profile.providers.bedrock, profileName);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
await this.setProfile(profileName, profile);
|
|
202
|
+
console.log(chalk_1.default.green(`✓ Configuration saved to profile: ${profileName}`));
|
|
203
|
+
}
|
|
204
|
+
async configureOpenAI(profile, skipValidation) {
|
|
205
|
+
const response = await (0, enquirer_1.prompt)([
|
|
206
|
+
{
|
|
207
|
+
type: 'password',
|
|
208
|
+
name: 'apiKey',
|
|
209
|
+
message: 'OpenAI API Key:',
|
|
210
|
+
validate: (value) => value.length > 0 || 'API key is required'
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
type: 'input',
|
|
214
|
+
name: 'organizationId',
|
|
215
|
+
message: 'OpenAI Organization ID (optional):',
|
|
216
|
+
required: false
|
|
217
|
+
}
|
|
218
|
+
]);
|
|
219
|
+
const config = {
|
|
220
|
+
apiKey: response.apiKey,
|
|
221
|
+
organizationId: response.organizationId || undefined
|
|
222
|
+
};
|
|
223
|
+
if (!skipValidation) {
|
|
224
|
+
await this.validateProvider('openai', config, 'temp');
|
|
225
|
+
}
|
|
226
|
+
profile.providers.openai = config;
|
|
227
|
+
}
|
|
228
|
+
async configureAnthropic(profile, skipValidation) {
|
|
229
|
+
const response = await (0, enquirer_1.prompt)([
|
|
230
|
+
{
|
|
231
|
+
type: 'password',
|
|
232
|
+
name: 'apiKey',
|
|
233
|
+
message: 'Anthropic API Key:',
|
|
234
|
+
validate: (value) => value.length > 0 || 'API key is required'
|
|
235
|
+
}
|
|
236
|
+
]);
|
|
237
|
+
const config = {
|
|
238
|
+
apiKey: response.apiKey
|
|
239
|
+
};
|
|
240
|
+
if (!skipValidation) {
|
|
241
|
+
await this.validateProvider('anthropic', config, 'temp');
|
|
242
|
+
}
|
|
243
|
+
profile.providers.anthropic = config;
|
|
244
|
+
}
|
|
245
|
+
async configureAzureOpenAI(profile, skipValidation) {
|
|
246
|
+
const response = await (0, enquirer_1.prompt)([
|
|
247
|
+
{
|
|
248
|
+
type: 'password',
|
|
249
|
+
name: 'apiKey',
|
|
250
|
+
message: 'Azure OpenAI API Key:',
|
|
251
|
+
validate: (value) => value.length > 0 || 'API key is required'
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
type: 'input',
|
|
255
|
+
name: 'endpoint',
|
|
256
|
+
message: 'Azure OpenAI Endpoint:',
|
|
257
|
+
validate: (value) => value.length > 0 || 'Endpoint is required'
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
type: 'input',
|
|
261
|
+
name: 'deploymentName',
|
|
262
|
+
message: 'Azure OpenAI Deployment Name:',
|
|
263
|
+
validate: (value) => value.length > 0 || 'Deployment name is required'
|
|
264
|
+
}
|
|
265
|
+
]);
|
|
266
|
+
const config = {
|
|
267
|
+
apiKey: response.apiKey,
|
|
268
|
+
endpoint: response.endpoint,
|
|
269
|
+
deploymentName: response.deploymentName
|
|
270
|
+
};
|
|
271
|
+
if (!skipValidation) {
|
|
272
|
+
await this.validateProvider('azure-openai', config, 'temp');
|
|
273
|
+
}
|
|
274
|
+
profile.providers['azure-openai'] = config;
|
|
275
|
+
}
|
|
276
|
+
async configureBedrock(profile, skipValidation) {
|
|
277
|
+
const response = await (0, enquirer_1.prompt)([
|
|
278
|
+
{
|
|
279
|
+
type: 'password',
|
|
280
|
+
name: 'accessKeyId',
|
|
281
|
+
message: 'AWS Access Key ID:',
|
|
282
|
+
validate: (value) => value.length > 0 || 'Access Key ID is required'
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
type: 'password',
|
|
286
|
+
name: 'secretAccessKey',
|
|
287
|
+
message: 'AWS Secret Access Key:',
|
|
288
|
+
validate: (value) => value.length > 0 || 'Secret Access Key is required'
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
type: 'password',
|
|
292
|
+
name: 'sessionToken',
|
|
293
|
+
message: 'AWS Session Token (optional):',
|
|
294
|
+
required: false
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
type: 'input',
|
|
298
|
+
name: 'region',
|
|
299
|
+
message: 'AWS Region:',
|
|
300
|
+
initial: 'us-east-1'
|
|
301
|
+
}
|
|
302
|
+
]);
|
|
303
|
+
const config = {
|
|
304
|
+
accessKeyId: response.accessKeyId,
|
|
305
|
+
secretAccessKey: response.secretAccessKey,
|
|
306
|
+
sessionToken: response.sessionToken || undefined,
|
|
307
|
+
region: response.region
|
|
308
|
+
};
|
|
309
|
+
if (!skipValidation) {
|
|
310
|
+
await this.validateProvider('bedrock', config, 'temp');
|
|
311
|
+
}
|
|
312
|
+
profile.providers.bedrock = config;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Validate provider configuration by making a test API call
|
|
316
|
+
*/
|
|
317
|
+
async validateProvider(provider, config, _profileName) {
|
|
318
|
+
console.log(chalk_1.default.yellow(`\nValidating ${provider} credentials...`));
|
|
319
|
+
try {
|
|
320
|
+
// Import majk-chat-core dynamically to avoid circular dependencies
|
|
321
|
+
const { MajkChatBuilder } = await Promise.resolve().then(() => __importStar(require('@majkapp/majk-chat-core')));
|
|
322
|
+
const builder = new MajkChatBuilder();
|
|
323
|
+
// Configure the specific provider
|
|
324
|
+
switch (provider) {
|
|
325
|
+
case 'openai':
|
|
326
|
+
builder.withOpenAI(config);
|
|
327
|
+
break;
|
|
328
|
+
case 'anthropic':
|
|
329
|
+
builder.withAnthropic(config);
|
|
330
|
+
break;
|
|
331
|
+
case 'azure-openai':
|
|
332
|
+
builder.withAzureOpenAI(config);
|
|
333
|
+
break;
|
|
334
|
+
case 'bedrock':
|
|
335
|
+
builder.withBedrock(config);
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
const chat = builder.build();
|
|
339
|
+
const providerAdapter = chat.getProvider(provider);
|
|
340
|
+
// Try to list models as a quick validation
|
|
341
|
+
await providerAdapter.listModels({
|
|
342
|
+
requestId: `validation-${Date.now()}`
|
|
343
|
+
});
|
|
344
|
+
console.log(chalk_1.default.green(`✓ ${provider} credentials are valid`));
|
|
345
|
+
}
|
|
346
|
+
catch (error) {
|
|
347
|
+
console.log(chalk_1.default.red(`✗ ${provider} credentials validation failed:`));
|
|
348
|
+
console.log(chalk_1.default.red(` ${error instanceof Error ? error.message : error}`));
|
|
349
|
+
const { confirm } = await (0, enquirer_1.prompt)({
|
|
350
|
+
type: 'confirm',
|
|
351
|
+
name: 'proceed',
|
|
352
|
+
message: 'Save configuration anyway?',
|
|
353
|
+
initial: false
|
|
354
|
+
});
|
|
355
|
+
if (!confirm) {
|
|
356
|
+
throw new Error('Configuration cancelled due to validation failure');
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Test all providers in a profile
|
|
362
|
+
*/
|
|
363
|
+
async testProfile(profileName) {
|
|
364
|
+
const profile = await this.getProfile(profileName);
|
|
365
|
+
if (!profile) {
|
|
366
|
+
throw new Error(`Profile '${profileName}' not found`);
|
|
367
|
+
}
|
|
368
|
+
const results = [];
|
|
369
|
+
for (const [provider, config] of Object.entries(profile.providers)) {
|
|
370
|
+
if (config) {
|
|
371
|
+
const result = await this.testProvider(provider, profileName);
|
|
372
|
+
results.push(result);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return results;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Test specific provider in a profile
|
|
379
|
+
*/
|
|
380
|
+
async testProvider(provider, profileName = 'default') {
|
|
381
|
+
const config = await this.getProviderCredentials(provider, profileName);
|
|
382
|
+
if (!config) {
|
|
383
|
+
return {
|
|
384
|
+
provider,
|
|
385
|
+
profile: profileName,
|
|
386
|
+
valid: false,
|
|
387
|
+
error: 'No configuration found'
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
try {
|
|
391
|
+
const { MajkChatBuilder } = await Promise.resolve().then(() => __importStar(require('@majkapp/majk-chat-core')));
|
|
392
|
+
const builder = new MajkChatBuilder();
|
|
393
|
+
switch (provider) {
|
|
394
|
+
case 'openai':
|
|
395
|
+
builder.withOpenAI(config);
|
|
396
|
+
break;
|
|
397
|
+
case 'anthropic':
|
|
398
|
+
builder.withAnthropic(config);
|
|
399
|
+
break;
|
|
400
|
+
case 'azure-openai':
|
|
401
|
+
builder.withAzureOpenAI(config);
|
|
402
|
+
break;
|
|
403
|
+
case 'bedrock':
|
|
404
|
+
builder.withBedrock(config);
|
|
405
|
+
break;
|
|
406
|
+
default:
|
|
407
|
+
throw new Error(`Unsupported provider: ${provider}`);
|
|
408
|
+
}
|
|
409
|
+
const chat = builder.build();
|
|
410
|
+
const providerAdapter = chat.getProvider(provider);
|
|
411
|
+
const modelsResponse = await providerAdapter.listModels({
|
|
412
|
+
requestId: `test-${Date.now()}`
|
|
413
|
+
});
|
|
414
|
+
const firstModel = modelsResponse.data[0]?.id || 'unknown';
|
|
415
|
+
return {
|
|
416
|
+
provider,
|
|
417
|
+
profile: profileName,
|
|
418
|
+
valid: true,
|
|
419
|
+
model: firstModel
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
catch (error) {
|
|
423
|
+
return {
|
|
424
|
+
provider,
|
|
425
|
+
profile: profileName,
|
|
426
|
+
valid: false,
|
|
427
|
+
error: error instanceof Error ? error.message : String(error)
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Test all profiles
|
|
433
|
+
*/
|
|
434
|
+
async testAllProfiles() {
|
|
435
|
+
const profileNames = await this.listProfiles();
|
|
436
|
+
const results = [];
|
|
437
|
+
for (const profileName of profileNames) {
|
|
438
|
+
const profileResults = await this.testProfile(profileName);
|
|
439
|
+
results.push(...profileResults);
|
|
440
|
+
}
|
|
441
|
+
return results;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
exports.ProfileConfigManager = ProfileConfigManager;
|
|
445
|
+
//# sourceMappingURL=profile-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-config.js","sourceRoot":"","sources":["../../src/utils/profile-config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AM,OAAO,GAAuB,EAAE,CAAC;QAEvC,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;YACvC,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;YAC3D,OAAO,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAhdD,oDAgdC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@majkapp/majk-chat-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "CLI for multi-provider LLM chat interactions",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -30,13 +30,14 @@
|
|
|
30
30
|
"author": "Jules White",
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@majkapp/majk-chat-
|
|
34
|
-
"@majkapp/majk-chat-
|
|
35
|
-
"@majkapp/majk-chat-
|
|
36
|
-
"@majkapp/majk-chat-sessions": "^1.0.
|
|
33
|
+
"@majkapp/majk-chat-basic-tools": "^1.0.4",
|
|
34
|
+
"@majkapp/majk-chat-core": "^1.0.3",
|
|
35
|
+
"@majkapp/majk-chat-mcp": "^1.0.2",
|
|
36
|
+
"@majkapp/majk-chat-sessions": "^1.0.2",
|
|
37
37
|
"chalk": "^4.1.2",
|
|
38
38
|
"commander": "^12.0.0",
|
|
39
39
|
"dotenv": "^16.4.0",
|
|
40
|
+
"enquirer": "2.4.1",
|
|
40
41
|
"fs-extra": "^11.2.0",
|
|
41
42
|
"inquirer": "^8.2.7",
|
|
42
43
|
"ora": "^5.4.1",
|