raqeb-cli 1.3.1 → 1.3.2
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 +17 -1
- package/lib/interactive.js +67 -18
- package/package.json +1 -1
package/bin/raqeb.js
CHANGED
|
@@ -360,6 +360,22 @@ Installation:
|
|
|
360
360
|
program
|
|
361
361
|
.name('raqeb')
|
|
362
362
|
.description('Raqeb CLI - Database PAM and Secrets Management')
|
|
363
|
-
.version('1.
|
|
363
|
+
.version('1.3.2')
|
|
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
|
+
});
|
|
364
375
|
|
|
365
376
|
program.parse();
|
|
377
|
+
|
|
378
|
+
// If no command specified and no -i flag, show help
|
|
379
|
+
if (!process.argv.slice(2).length) {
|
|
380
|
+
program.outputHelp();
|
|
381
|
+
}
|
package/lib/interactive.js
CHANGED
|
@@ -84,26 +84,51 @@ class InteractiveShell {
|
|
|
84
84
|
showWelcome() {
|
|
85
85
|
console.clear();
|
|
86
86
|
|
|
87
|
-
//
|
|
87
|
+
// Raqeb ASCII Logo with brand colors
|
|
88
|
+
const blue = chalk.hex('#3B82F6');
|
|
89
|
+
const green = chalk.hex('#10B981');
|
|
90
|
+
const cyan = chalk.hex('#06B6D4');
|
|
91
|
+
|
|
92
|
+
console.log('');
|
|
93
|
+
console.log(blue(' ●'));
|
|
94
|
+
console.log(blue(' ╱'));
|
|
95
|
+
console.log(blue(' ╱'));
|
|
96
|
+
console.log(blue(' ╭──○'));
|
|
97
|
+
console.log(blue(' ╱') + ' ' + green('╱ ╲'));
|
|
98
|
+
console.log(blue(' ╱') + ' ' + green('╱ ╲'));
|
|
99
|
+
console.log(blue(' ╱') + ' ' + green('╱') + cyan(' ● ') + green('╲'));
|
|
100
|
+
console.log(blue(' │') + ' ' + green('│') + cyan(' ╱ ╲ ') + green('│'));
|
|
101
|
+
console.log(blue(' │') + ' ' + chalk.bold.white('RAQEB') + ' ' + green('│') + cyan('│ │') + green('│'));
|
|
102
|
+
console.log(blue(' │') + ' ' + green('│') + cyan(' ╲ ╱ ') + green('│'));
|
|
103
|
+
console.log(blue(' ╲') + ' ' + green('╲') + cyan(' ● ') + green('╱'));
|
|
104
|
+
console.log(blue(' ╲') + ' ' + green('╲ ╱'));
|
|
105
|
+
console.log(blue(' ╲') + ' ' + green('╲ ╱'));
|
|
106
|
+
console.log(blue(' ╰──○'));
|
|
107
|
+
console.log(blue(' ╲'));
|
|
108
|
+
console.log(blue(' ╲'));
|
|
109
|
+
console.log(blue(' ●'));
|
|
110
|
+
console.log('');
|
|
111
|
+
|
|
112
|
+
// Header box with user info
|
|
88
113
|
const userEmail = this.userInfo?.email || 'Not logged in';
|
|
89
114
|
const tenantName = this.userInfo?.tenant_name || this.userInfo?.tenant_id || 'Unknown';
|
|
90
115
|
const userRole = this.userInfo?.role || 'user';
|
|
91
116
|
|
|
92
|
-
console.log(
|
|
93
|
-
console.log(
|
|
94
|
-
console.log(
|
|
95
|
-
console.log(
|
|
96
|
-
console.log(
|
|
97
|
-
console.log(
|
|
98
|
-
console.log(
|
|
117
|
+
console.log(blue('╔════════════════════════════════════════════════════════════════════════════╗'));
|
|
118
|
+
console.log(blue('║') + chalk.bold.white(' 🌐 Raqeb CLI - Interactive Mode v1.3.2 ') + blue('║'));
|
|
119
|
+
console.log(blue('╠════════════════════════════════════════════════════════════════════════════╣'));
|
|
120
|
+
console.log(blue('║ ') + chalk.gray('User: ') + green(userEmail.padEnd(64)) + blue(' ║'));
|
|
121
|
+
console.log(blue('║ ') + chalk.gray('Tenant: ') + green(tenantName.padEnd(64)) + blue(' ║'));
|
|
122
|
+
console.log(blue('║ ') + chalk.gray('Role: ') + chalk.hex('#F59E0B')(userRole.padEnd(64)) + blue(' ║'));
|
|
123
|
+
console.log(blue('╚════════════════════════════════════════════════════════════════════════════╝'));
|
|
99
124
|
|
|
100
|
-
console.log(
|
|
125
|
+
console.log(green('\n💡 Type / to see all commands, or /help for help\n'));
|
|
101
126
|
}
|
|
102
127
|
|
|
103
128
|
async handleCommand(input) {
|
|
104
129
|
try {
|
|
105
130
|
if (input === '/') {
|
|
106
|
-
this.
|
|
131
|
+
await this.showCommandMenu();
|
|
107
132
|
} else if (input === '/help') {
|
|
108
133
|
this.showHelp();
|
|
109
134
|
} else if (input === '/exit' || input === '/quit') {
|
|
@@ -128,16 +153,40 @@ class InteractiveShell {
|
|
|
128
153
|
}
|
|
129
154
|
}
|
|
130
155
|
|
|
156
|
+
async showCommandMenu() {
|
|
157
|
+
const commands = [
|
|
158
|
+
{ name: chalk.cyan('/db ') + chalk.gray('Database operations'), value: '/db' },
|
|
159
|
+
{ name: chalk.cyan('/secrets ') + chalk.gray('Secrets management'), value: '/secrets' },
|
|
160
|
+
{ name: chalk.cyan('/keys ') + chalk.gray('API keys management'), value: '/keys' },
|
|
161
|
+
{ name: chalk.cyan('/audit ') + chalk.gray('Audit logs'), value: '/audit' },
|
|
162
|
+
{ name: chalk.cyan('/help ') + chalk.gray('Show help'), value: '/help' },
|
|
163
|
+
{ name: chalk.cyan('/clear ') + chalk.gray('Clear screen'), value: '/clear' },
|
|
164
|
+
{ name: chalk.cyan('/exit ') + chalk.gray('Exit interactive mode'), value: '/exit' }
|
|
165
|
+
];
|
|
166
|
+
|
|
167
|
+
const answer = await inquirer.prompt([{
|
|
168
|
+
type: 'list',
|
|
169
|
+
name: 'command',
|
|
170
|
+
message: chalk.bold('📋 Available Commands:'),
|
|
171
|
+
choices: commands,
|
|
172
|
+
pageSize: 10
|
|
173
|
+
}]);
|
|
174
|
+
|
|
175
|
+
if (answer.command) {
|
|
176
|
+
await this.handleCommand(answer.command);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
131
180
|
showAllCommands() {
|
|
132
181
|
console.log(chalk.bold('\n📋 Available Commands:\n'));
|
|
133
|
-
console.log(chalk.cyan(' /db') + '
|
|
134
|
-
console.log(chalk.cyan(' /secrets') + '
|
|
135
|
-
console.log(chalk.cyan(' /keys') + '
|
|
136
|
-
console.log(chalk.cyan(' /audit') + '
|
|
137
|
-
console.log(chalk.cyan(' /help') + '
|
|
138
|
-
console.log(chalk.cyan(' /clear') + '
|
|
139
|
-
console.log(chalk.cyan(' /exit') + '
|
|
140
|
-
console.log();
|
|
182
|
+
console.log(chalk.cyan(' /db ') + 'Database operations');
|
|
183
|
+
console.log(chalk.cyan(' /secrets ') + 'Secrets management');
|
|
184
|
+
console.log(chalk.cyan(' /keys ') + 'API keys management');
|
|
185
|
+
console.log(chalk.cyan(' /audit ') + 'Audit logs');
|
|
186
|
+
console.log(chalk.cyan(' /help ') + 'Show this help');
|
|
187
|
+
console.log(chalk.cyan(' /clear ') + 'Clear screen');
|
|
188
|
+
console.log(chalk.cyan(' /exit ') + 'Exit interactive mode');
|
|
189
|
+
console.log('');
|
|
141
190
|
}
|
|
142
191
|
|
|
143
192
|
showHelp() {
|