raqeb-cli 1.3.0 → 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 CHANGED
@@ -325,11 +325,11 @@ Examples:
325
325
  $ raqeb -i
326
326
  $ raqeb shell
327
327
  `)
328
- .action(() => {
328
+ .action(async () => {
329
329
  const InteractiveShell = require('../lib/interactive');
330
330
  const client = getClient();
331
331
  const shell = new InteractiveShell(client);
332
- shell.start();
332
+ await shell.start();
333
333
  });
334
334
 
335
335
  // Completion command
@@ -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.0.0');
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
+ }
@@ -84,35 +84,51 @@ class InteractiveShell {
84
84
  showWelcome() {
85
85
  console.clear();
86
86
 
87
- // ASCII Logo
88
- console.log(chalk.cyan.bold(`
89
- ██████╗ ██████╗ ██████╗ ███████╗██████╗
90
- ██╔══██╗██╔═══██╗██╔═══██╗██╔════╝██╔══██╗
91
- ██████╔╝███████║██║ ██║█████╗ ██████╔╝
92
- ██╔══██╗██╔══██║██║▄▄ ██║██╔══╝ ██╔══██╗
93
- ██║ ██║██║ ██║╚██████╔╝███████╗██████╔╝
94
- ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══▀▀═╝ ╚══════╝╚═════╝
95
- `));
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');
96
91
 
97
- console.log(chalk.cyan('╔═══════════════════════════════════════════════════════════╗'));
98
- console.log(chalk.cyan('║ Raqeb CLI - Interactive Mode v1.3.0 ║'));
99
- console.log(chalk.cyan('╚═══════════════════════════════════════════════════════════╝'));
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('');
100
111
 
101
- // Show user info if available
102
- if (this.userInfo) {
103
- console.log(chalk.gray('\n📊 Session Information:'));
104
- console.log(chalk.white(` User: ${chalk.green(this.userInfo.email || 'Unknown')}`));
105
- console.log(chalk.white(` Tenant: ${chalk.green(this.userInfo.tenant_name || this.userInfo.tenant_id || 'Unknown')}`));
106
- console.log(chalk.white(` Role: ${chalk.yellow(this.userInfo.role || 'user')}`));
107
- }
112
+ // Header box with user info
113
+ const userEmail = this.userInfo?.email || 'Not logged in';
114
+ const tenantName = this.userInfo?.tenant_name || this.userInfo?.tenant_id || 'Unknown';
115
+ const userRole = this.userInfo?.role || 'user';
116
+
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('╚════════════════════════════════════════════════════════════════════════════╝'));
108
124
 
109
- console.log(chalk.cyan('\n💡 Type / to see all commands, or /help for help\n'));
125
+ console.log(green('\n💡 Type / to see all commands, or /help for help\n'));
110
126
  }
111
127
 
112
128
  async handleCommand(input) {
113
129
  try {
114
130
  if (input === '/') {
115
- this.showAllCommands();
131
+ await this.showCommandMenu();
116
132
  } else if (input === '/help') {
117
133
  this.showHelp();
118
134
  } else if (input === '/exit' || input === '/quit') {
@@ -137,16 +153,40 @@ class InteractiveShell {
137
153
  }
138
154
  }
139
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
+
140
180
  showAllCommands() {
141
181
  console.log(chalk.bold('\n📋 Available Commands:\n'));
142
- console.log(chalk.cyan(' /db') + ' Database operations');
143
- console.log(chalk.cyan(' /secrets') + ' Secrets management');
144
- console.log(chalk.cyan(' /keys') + ' API keys management');
145
- console.log(chalk.cyan(' /audit') + ' Audit logs');
146
- console.log(chalk.cyan(' /help') + ' Show this help');
147
- console.log(chalk.cyan(' /clear') + ' Clear screen');
148
- console.log(chalk.cyan(' /exit') + ' Exit interactive mode');
149
- 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('');
150
190
  }
151
191
 
152
192
  showHelp() {
@@ -368,7 +408,7 @@ class InteractiveShell {
368
408
 
369
409
  async listSecrets() {
370
410
  try {
371
- const response = await this.client.get('/service-accounts/secrets');
411
+ const response = await this.client.get('/secrets');
372
412
  const secrets = response.data;
373
413
 
374
414
  if (!secrets || secrets.length === 0) {
@@ -405,9 +445,7 @@ class InteractiveShell {
405
445
  }
406
446
 
407
447
  try {
408
- const response = await this.client.post('/service-accounts/secrets/retrieve', null, {
409
- params: { secret_id: secretId }
410
- });
448
+ const response = await this.client.get(`/secrets/${secretId}`);
411
449
  const data = response.data;
412
450
 
413
451
  console.log(chalk.cyan(`\n🔐 Secret: ${data.name}`));
@@ -442,7 +480,7 @@ class InteractiveShell {
442
480
  }
443
481
  ]);
444
482
 
445
- await this.client.post('/service-accounts/secrets', {
483
+ await this.client.post('/secrets', {
446
484
  name: answers.name,
447
485
  value: answers.value,
448
486
  description: answers.description || undefined
@@ -474,7 +512,7 @@ class InteractiveShell {
474
512
  return;
475
513
  }
476
514
 
477
- await this.client.delete(`/service-accounts/secrets/${secretName}`);
515
+ await this.client.delete(`/secrets/${secretName}`);
478
516
  console.log(chalk.green(`\n✓ Secret '${secretName}' deleted successfully\n`));
479
517
  } catch (error) {
480
518
  throw new Error(error.response?.data?.detail || error.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raqeb-cli",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Raqeb CLI - Command-line tool for Database PAM and Developer Secrets Management",
5
5
  "main": "index.js",
6
6
  "bin": {