raqeb-cli 1.3.4 → 1.3.6
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/raqeb.js +9 -18
- package/lib/interactive.js +24 -20
- package/package.json +1 -1
package/bin/raqeb.js
CHANGED
|
@@ -32,17 +32,19 @@ function saveConfig(config) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// Get API client
|
|
35
|
-
function getClient() {
|
|
35
|
+
function getClient(allowUnauthenticated = false) {
|
|
36
36
|
const config = loadConfig();
|
|
37
|
-
if (!config.api_key) {
|
|
37
|
+
if (!config.api_key && !allowUnauthenticated) {
|
|
38
38
|
console.error(chalk.red('❌ Not authenticated. Run: raqeb login --api-key <key>'));
|
|
39
39
|
process.exit(1);
|
|
40
40
|
}
|
|
41
41
|
return axios.create({
|
|
42
|
-
baseURL: config.base_url,
|
|
43
|
-
headers: {
|
|
42
|
+
baseURL: config.base_url || 'https://app.raqeb.cloud/api/v1',
|
|
43
|
+
headers: config.api_key ? {
|
|
44
44
|
'Authorization': `Bearer ${config.api_key}`,
|
|
45
45
|
'Content-Type': 'application/json'
|
|
46
|
+
} : {
|
|
47
|
+
'Content-Type': 'application/json'
|
|
46
48
|
}
|
|
47
49
|
});
|
|
48
50
|
}
|
|
@@ -327,7 +329,7 @@ Examples:
|
|
|
327
329
|
`)
|
|
328
330
|
.action(async () => {
|
|
329
331
|
const InteractiveShell = require('../lib/interactive');
|
|
330
|
-
const client = getClient();
|
|
332
|
+
const client = getClient(true); // Allow unauthenticated for interactive mode
|
|
331
333
|
const shell = new InteractiveShell(client);
|
|
332
334
|
await shell.start();
|
|
333
335
|
});
|
|
@@ -360,22 +362,11 @@ Installation:
|
|
|
360
362
|
program
|
|
361
363
|
.name('raqeb')
|
|
362
364
|
.description('Raqeb CLI - Database PAM and Secrets Management')
|
|
363
|
-
.version('1.3.
|
|
364
|
-
.option('-i, --interactive', 'Launch interactive mode')
|
|
365
|
-
.hook('preAction', async (thisCommand, actionCommand) => {
|
|
366
|
-
// Handle -i flag
|
|
367
|
-
if (thisCommand.opts().interactive) {
|
|
368
|
-
const InteractiveShell = require('../lib/interactive');
|
|
369
|
-
const client = getClient();
|
|
370
|
-
const shell = new InteractiveShell(client);
|
|
371
|
-
await shell.start();
|
|
372
|
-
process.exit(0);
|
|
373
|
-
}
|
|
374
|
-
});
|
|
365
|
+
.version('1.3.6');
|
|
375
366
|
|
|
376
367
|
program.parse();
|
|
377
368
|
|
|
378
|
-
// If no command specified
|
|
369
|
+
// If no command specified, show help
|
|
379
370
|
if (!process.argv.slice(2).length) {
|
|
380
371
|
program.outputHelp();
|
|
381
372
|
}
|
package/lib/interactive.js
CHANGED
|
@@ -29,9 +29,15 @@ class InteractiveShell {
|
|
|
29
29
|
|
|
30
30
|
async fetchUserInfo() {
|
|
31
31
|
try {
|
|
32
|
+
// Check if we have a valid API key
|
|
33
|
+
if (!this.config || !this.config.api_key) {
|
|
34
|
+
throw new Error('No API key found');
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
const response = await this.client.get('/auth/me');
|
|
33
38
|
this.userInfo = response.data;
|
|
34
39
|
} catch (error) {
|
|
40
|
+
// Set defaults if not logged in
|
|
35
41
|
this.userInfo = {
|
|
36
42
|
email: 'Not logged in',
|
|
37
43
|
tenant_name: 'Unknown',
|
|
@@ -89,29 +95,27 @@ class InteractiveShell {
|
|
|
89
95
|
showWelcome() {
|
|
90
96
|
console.clear();
|
|
91
97
|
|
|
92
|
-
// Raqeb ASCII Logo -
|
|
98
|
+
// Raqeb ASCII Logo - EXACT from user's screenshot (hexagon with diamond)
|
|
93
99
|
const blue = chalk.hex('#0066cc');
|
|
94
100
|
const green = chalk.hex('#00cc99');
|
|
95
|
-
const cyan = chalk.hex('#
|
|
101
|
+
const cyan = chalk.hex('#00ffcc');
|
|
96
102
|
|
|
97
103
|
console.log('');
|
|
98
|
-
console.log('
|
|
99
|
-
console.log('
|
|
100
|
-
console.log('
|
|
101
|
-
console.log('
|
|
102
|
-
console.log('
|
|
103
|
-
console.log('
|
|
104
|
-
console.log('
|
|
105
|
-
console.log('
|
|
106
|
-
console.log('
|
|
107
|
-
console.log('
|
|
108
|
-
console.log('
|
|
109
|
-
console.log('
|
|
110
|
-
console.log('
|
|
111
|
-
console.log('
|
|
112
|
-
console.log('
|
|
113
|
-
console.log(' ' + blue('╲ ╱'));
|
|
114
|
-
console.log(' ' + blue('●'));
|
|
104
|
+
console.log(' ' + blue('●'));
|
|
105
|
+
console.log(' ' + blue('╱ ╲'));
|
|
106
|
+
console.log(' ' + blue('╭───○') + ' ' + blue('○───╮'));
|
|
107
|
+
console.log(' ' + blue('╱') + ' ' + green('╱╲') + ' ' + green('╱╲') + ' ' + blue('╲'));
|
|
108
|
+
console.log(' ' + blue('╱') + ' ' + green('╱') + cyan(' ● ') + green('╲') + ' ' + blue('╲'));
|
|
109
|
+
console.log(' ' + blue('╱') + ' ' + green('╱') + cyan(' ╱╲ ') + green('╲') + ' ' + blue('╲'));
|
|
110
|
+
console.log(' ' + blue('│') + ' ' + green('│') + cyan(' ││ ') + green('│') + ' ' + blue('│'));
|
|
111
|
+
console.log(' ' + blue('│') + ' ' + chalk.bold.white('RAQEB') + ' ' + cyan('│') + green(' ● ') + cyan('│') + ' ' + blue('│'));
|
|
112
|
+
console.log(' ' + blue('│') + ' ' + green('│') + cyan(' ││ ') + green('│') + ' ' + blue('│'));
|
|
113
|
+
console.log(' ' + blue('╲') + ' ' + green('╲') + cyan(' ╲╱ ') + green('╱') + ' ' + blue('╱'));
|
|
114
|
+
console.log(' ' + blue('╲') + ' ' + green('╲') + cyan(' ● ') + green('╱') + ' ' + blue('╱'));
|
|
115
|
+
console.log(' ' + blue('╲') + ' ' + green('╲╱') + ' ' + green('╲╱') + ' ' + blue('╱'));
|
|
116
|
+
console.log(' ' + blue('╰───○') + ' ' + blue('○───╯'));
|
|
117
|
+
console.log(' ' + blue('╲ ╱'));
|
|
118
|
+
console.log(' ' + blue('●'));
|
|
115
119
|
console.log('');
|
|
116
120
|
|
|
117
121
|
// Header box with user info
|
|
@@ -120,7 +124,7 @@ class InteractiveShell {
|
|
|
120
124
|
const userRole = this.userInfo?.role || 'user';
|
|
121
125
|
|
|
122
126
|
console.log(blue('╔════════════════════════════════════════════════════════════════════════════╗'));
|
|
123
|
-
console.log(blue('║') + chalk.bold.white(' 🌐 Raqeb CLI - Interactive Mode v1.3.
|
|
127
|
+
console.log(blue('║') + chalk.bold.white(' 🌐 Raqeb CLI - Interactive Mode v1.3.6 ') + blue('║'));
|
|
124
128
|
console.log(blue('╠════════════════════════════════════════════════════════════════════════════╣'));
|
|
125
129
|
console.log(blue('║ ') + chalk.gray('User: ') + green(userEmail.padEnd(64)) + blue(' ║'));
|
|
126
130
|
console.log(blue('║ ') + chalk.gray('Tenant: ') + green(tenantName.padEnd(64)) + blue(' ║'));
|