rampup 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/index.js +25 -39
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -992,49 +992,35 @@ program
992
992
  console.log(banner);
993
993
  console.log(chalk.bold.blue('šŸ” Login\n'));
994
994
 
995
- const configDir = path.join(process.env.HOME, '.ramp');
996
- const authFile = path.join(configDir, 'auth.json');
997
-
998
995
  // Check if already logged in
999
- try {
1000
- const auth = JSON.parse(await fs.readFile(authFile, 'utf8'));
1001
- if (auth.token) {
1002
- console.log(chalk.green(`Already logged in as ${auth.email}\n`));
1003
- const { logout } = await inquirer.prompt([{
1004
- type: 'confirm',
1005
- name: 'logout',
1006
- message: 'Log out?',
1007
- default: false
1008
- }]);
1009
- if (logout) {
1010
- await fs.unlink(authFile);
1011
- console.log(chalk.dim('\nLogged out.\n'));
1012
- }
1013
- return;
1014
- }
1015
- } catch {}
1016
-
1017
- console.log(chalk.dim('Create an account at: https://rampup.dev\n'));
1018
-
1019
- const { email, token } = await inquirer.prompt([
1020
- {
1021
- type: 'input',
1022
- name: 'email',
1023
- message: 'Email:'
1024
- },
1025
- {
1026
- type: 'password',
1027
- name: 'token',
1028
- message: 'API Token (from rampup.dev/settings):'
996
+ const userInfo = await getUserInfo();
997
+ if (userInfo) {
998
+ console.log(chalk.green(`Already logged in as ${userInfo.email}\n`));
999
+ const { logout } = await inquirer.prompt([{
1000
+ type: 'confirm',
1001
+ name: 'logout',
1002
+ message: 'Log out?',
1003
+ default: false
1004
+ }]);
1005
+ if (logout) {
1006
+ await clearCredentials();
1007
+ console.log(chalk.dim('\nLogged out.\n'));
1029
1008
  }
1030
- ]);
1009
+ return;
1010
+ }
1031
1011
 
1032
- // In production, validate token against backend
1033
- // For now, just save it
1034
- await fs.mkdir(configDir, { recursive: true });
1035
- await fs.writeFile(authFile, JSON.stringify({ email, token, created: new Date().toISOString() }, null, 2));
1012
+ // Browser-based OAuth login
1013
+ const spinner = ora('Opening browser for authentication...').start();
1036
1014
 
1037
- console.log(chalk.green('\nāœ“ Logged in successfully!\n'));
1015
+ try {
1016
+ const result = await loginWithBrowser();
1017
+ spinner.succeed(chalk.green(`Logged in as ${result.displayName || result.email}`));
1018
+ console.log(chalk.dim('\nYou can now use all Ramp CLI features.\n'));
1019
+ } catch (error) {
1020
+ spinner.fail(chalk.red('Login failed'));
1021
+ console.log(chalk.dim(`\nError: ${error.message}\n`));
1022
+ console.log(chalk.dim('Try again or visit https://app.rampup.dev to create an account.\n'));
1023
+ }
1038
1024
  });
1039
1025
 
1040
1026
  program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rampup",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Ramp - Understand any codebase in hours. AI-powered developer onboarding CLI.",
5
5
  "type": "module",
6
6
  "bin": {