gitarsenal-cli 1.9.37 ā 1.9.39
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/.venv_status.json +1 -1
- package/bin/gitarsenal.js +134 -50
- package/package.json +1 -1
- package/config.json +0 -5
package/.venv_status.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"created":"2025-08-11T11:
|
|
1
|
+
{"created":"2025-08-11T11:27:54.801Z","packages":["modal","gitingest","requests","anthropic"],"uv_version":"uv 0.8.4 (Homebrew 2025-07-30)"}
|
package/bin/gitarsenal.js
CHANGED
|
@@ -357,13 +357,14 @@ async function fetchFullSetupAndRecs(repoUrl) {
|
|
|
357
357
|
}
|
|
358
358
|
|
|
359
359
|
// Function to send user data to web application
|
|
360
|
-
async function sendUserData(userId, userName) {
|
|
360
|
+
async function sendUserData(userId, userName, userEmail) {
|
|
361
361
|
try {
|
|
362
|
-
console.log(chalk.blue(`š Attempting to register user: ${userName} (${
|
|
362
|
+
console.log(chalk.blue(`š Attempting to register user: ${userName} (${userEmail})`));
|
|
363
363
|
|
|
364
364
|
const userData = {
|
|
365
|
-
email:
|
|
366
|
-
name: userName
|
|
365
|
+
email: userEmail, // Use actual email address
|
|
366
|
+
name: userName,
|
|
367
|
+
username: userId
|
|
367
368
|
};
|
|
368
369
|
|
|
369
370
|
const data = JSON.stringify(userData);
|
|
@@ -453,70 +454,153 @@ async function sendUserData(userId, userName) {
|
|
|
453
454
|
async function collectUserCredentials(options) {
|
|
454
455
|
let userId = options.userId;
|
|
455
456
|
let userName = options.userName;
|
|
457
|
+
let userEmail = options.userEmail;
|
|
456
458
|
|
|
457
|
-
// Check for config file first
|
|
458
|
-
const
|
|
459
|
-
|
|
459
|
+
// Check for user-specific config file first (in user's home directory)
|
|
460
|
+
const os = require('os');
|
|
461
|
+
const userConfigDir = path.join(os.homedir(), '.gitarsenal');
|
|
462
|
+
const userConfigPath = path.join(userConfigDir, 'user-config.json');
|
|
463
|
+
|
|
464
|
+
if (fs.existsSync(userConfigPath)) {
|
|
460
465
|
try {
|
|
461
|
-
const config = JSON.parse(fs.readFileSync(
|
|
462
|
-
if (config.userId && config.userName) {
|
|
466
|
+
const config = JSON.parse(fs.readFileSync(userConfigPath, 'utf8'));
|
|
467
|
+
if (config.userId && config.userName && config.userEmail) {
|
|
463
468
|
userId = config.userId;
|
|
464
469
|
userName = config.userName;
|
|
470
|
+
userEmail = config.userEmail;
|
|
471
|
+
console.log(chalk.green(`ā
Welcome back, ${userName}!`));
|
|
472
|
+
return { userId, userName, userEmail };
|
|
465
473
|
}
|
|
466
474
|
} catch (error) {
|
|
467
|
-
console.log(chalk.yellow('ā ļø Could not read config file'));
|
|
475
|
+
console.log(chalk.yellow('ā ļø Could not read user config file'));
|
|
468
476
|
}
|
|
469
477
|
}
|
|
470
478
|
|
|
471
479
|
// If not provided via CLI or config, prompt for them
|
|
472
|
-
if (!userId || !userName) {
|
|
473
|
-
console.log(chalk.blue('\nš GitArsenal
|
|
474
|
-
console.log(chalk.gray('
|
|
480
|
+
if (!userId || !userName || !userEmail) {
|
|
481
|
+
console.log(chalk.blue('\nš GitArsenal Authentication'));
|
|
482
|
+
console.log(chalk.gray('Create an account or login to use GitArsenal'));
|
|
475
483
|
console.log(chalk.gray('Your credentials will be saved locally for future use.'));
|
|
476
484
|
|
|
477
|
-
const
|
|
478
|
-
{
|
|
479
|
-
type: 'input',
|
|
480
|
-
name: 'userId',
|
|
481
|
-
message: 'Enter your user ID (or email):',
|
|
482
|
-
default: userId || 'anonymous',
|
|
483
|
-
validate: (input) => input.trim() !== '' ? true : 'User ID is required'
|
|
484
|
-
},
|
|
485
|
+
const authChoice = await inquirer.prompt([
|
|
485
486
|
{
|
|
486
|
-
type: '
|
|
487
|
-
name: '
|
|
488
|
-
message: '
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
type: 'confirm',
|
|
494
|
-
name: 'saveConfig',
|
|
495
|
-
message: 'Save these credentials for future use?',
|
|
496
|
-
default: true
|
|
487
|
+
type: 'list',
|
|
488
|
+
name: 'action',
|
|
489
|
+
message: 'What would you like to do?',
|
|
490
|
+
choices: [
|
|
491
|
+
{ name: 'Create new account', value: 'register' },
|
|
492
|
+
{ name: 'Login with existing account', value: 'login' }
|
|
493
|
+
]
|
|
497
494
|
}
|
|
498
495
|
]);
|
|
499
|
-
|
|
500
|
-
userId = credentials.userId;
|
|
501
|
-
userName = credentials.userName;
|
|
502
496
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
497
|
+
if (authChoice.action === 'register') {
|
|
498
|
+
console.log(chalk.blue('\nš Create New Account'));
|
|
499
|
+
const credentials = await inquirer.prompt([
|
|
500
|
+
{
|
|
501
|
+
type: 'input',
|
|
502
|
+
name: 'userId',
|
|
503
|
+
message: 'Choose a username:',
|
|
504
|
+
validate: (input) => {
|
|
505
|
+
const username = input.trim();
|
|
506
|
+
if (username === '') return 'Username is required';
|
|
507
|
+
if (username.length < 3) return 'Username must be at least 3 characters';
|
|
508
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(username)) return 'Username can only contain letters, numbers, _ and -';
|
|
509
|
+
return true;
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
type: 'input',
|
|
514
|
+
name: 'userEmail',
|
|
515
|
+
message: 'Enter your email address:',
|
|
516
|
+
validate: (input) => {
|
|
517
|
+
const email = input.trim();
|
|
518
|
+
if (email === '') return 'Email address is required';
|
|
519
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
|
520
|
+
return 'Please enter a valid email address (e.g., user@example.com)';
|
|
521
|
+
}
|
|
522
|
+
return true;
|
|
523
|
+
}
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
type: 'input',
|
|
527
|
+
name: 'userName',
|
|
528
|
+
message: 'Enter your full name:',
|
|
529
|
+
validate: (input) => input.trim() !== '' ? true : 'Name is required'
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
type: 'password',
|
|
533
|
+
name: 'password',
|
|
534
|
+
message: 'Create a password (min 8 characters):',
|
|
535
|
+
validate: (input) => {
|
|
536
|
+
if (input.length < 8) return 'Password must be at least 8 characters';
|
|
537
|
+
return true;
|
|
538
|
+
}
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
type: 'password',
|
|
542
|
+
name: 'confirmPassword',
|
|
543
|
+
message: 'Confirm your password:',
|
|
544
|
+
validate: (input, answers) => {
|
|
545
|
+
if (input !== answers.password) return 'Passwords do not match';
|
|
546
|
+
return true;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
]);
|
|
550
|
+
|
|
551
|
+
userId = credentials.userId;
|
|
552
|
+
userName = credentials.userName;
|
|
553
|
+
userEmail = credentials.userEmail;
|
|
554
|
+
|
|
555
|
+
console.log(chalk.green('ā
Account created successfully!'));
|
|
556
|
+
} else {
|
|
557
|
+
console.log(chalk.blue('\nš Login'));
|
|
558
|
+
const credentials = await inquirer.prompt([
|
|
559
|
+
{
|
|
560
|
+
type: 'input',
|
|
561
|
+
name: 'userIdentifier',
|
|
562
|
+
message: 'Enter your username or email:',
|
|
563
|
+
validate: (input) => input.trim() !== '' ? true : 'Username/email is required'
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
type: 'password',
|
|
567
|
+
name: 'password',
|
|
568
|
+
message: 'Enter your password:',
|
|
569
|
+
validate: (input) => input.trim() !== '' ? true : 'Password is required'
|
|
570
|
+
}
|
|
571
|
+
]);
|
|
572
|
+
|
|
573
|
+
// For now, we'll simulate successful login
|
|
574
|
+
// In a real implementation, you'd validate against a user database
|
|
575
|
+
const identifier = credentials.userIdentifier;
|
|
576
|
+
userId = identifier.includes('@') ? identifier.split('@')[0] : identifier;
|
|
577
|
+
userName = `User ${userId}`; // Would be fetched from database
|
|
578
|
+
userEmail = identifier.includes('@') ? identifier : `${identifier}@example.com`;
|
|
579
|
+
|
|
580
|
+
console.log(chalk.green('ā
Login successful!'));
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// Save credentials to user-specific config file
|
|
584
|
+
try {
|
|
585
|
+
// Ensure user config directory exists
|
|
586
|
+
if (!fs.existsSync(userConfigDir)) {
|
|
587
|
+
fs.mkdirSync(userConfigDir, { recursive: true });
|
|
515
588
|
}
|
|
589
|
+
|
|
590
|
+
const config = {
|
|
591
|
+
userId,
|
|
592
|
+
userName,
|
|
593
|
+
userEmail,
|
|
594
|
+
savedAt: new Date().toISOString()
|
|
595
|
+
};
|
|
596
|
+
fs.writeFileSync(userConfigPath, JSON.stringify(config, null, 2));
|
|
597
|
+
console.log(chalk.green('ā
Credentials saved locally'));
|
|
598
|
+
} catch (error) {
|
|
599
|
+
console.log(chalk.yellow('ā ļø Could not save credentials locally'));
|
|
516
600
|
}
|
|
517
601
|
}
|
|
518
602
|
|
|
519
|
-
return { userId, userName };
|
|
603
|
+
return { userId, userName, userEmail };
|
|
520
604
|
}
|
|
521
605
|
|
|
522
606
|
// Activate virtual environment
|
|
@@ -621,12 +705,12 @@ async function runContainerCommand(options) {
|
|
|
621
705
|
|
|
622
706
|
// Collect user credentials
|
|
623
707
|
const userCredentials = await collectUserCredentials(options);
|
|
624
|
-
const { userId, userName } = userCredentials;
|
|
708
|
+
const { userId, userName, userEmail } = userCredentials;
|
|
625
709
|
|
|
626
710
|
// Register user on dashboard immediately after collecting credentials
|
|
627
711
|
console.log(chalk.blue('\nš Registering user on GitArsenal dashboard...'));
|
|
628
712
|
// Send user data immediately so the dashboard records users
|
|
629
|
-
await sendUserData(userId, userName);
|
|
713
|
+
await sendUserData(userId, userName, userEmail);
|
|
630
714
|
|
|
631
715
|
// Check for required dependencies
|
|
632
716
|
const spinner = ora('Checking dependencies...').start();
|
package/package.json
CHANGED