rampup 0.1.11 → 0.1.12

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 +76 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -28,7 +28,46 @@ const execAsync = promisify(exec);
28
28
  const __filename = fileURLToPath(import.meta.url);
29
29
  const __dirname = path.dirname(__filename);
30
30
 
31
- const VERSION = '0.1.0';
31
+ const VERSION = '0.1.12';
32
+ const PACKAGE_NAME = 'rampup';
33
+
34
+ // Check for updates and auto-update if available
35
+ async function checkForUpdates() {
36
+ try {
37
+ // Check npm registry for latest version
38
+ const response = await fetch(`https://registry.npmjs.org/${PACKAGE_NAME}/latest`);
39
+ if (!response.ok) return;
40
+
41
+ const data = await response.json();
42
+ const latestVersion = data.version;
43
+
44
+ if (latestVersion && latestVersion !== VERSION) {
45
+ // Compare versions
46
+ const current = VERSION.split('.').map(Number);
47
+ const latest = latestVersion.split('.').map(Number);
48
+
49
+ const isNewer = latest[0] > current[0] ||
50
+ (latest[0] === current[0] && latest[1] > current[1]) ||
51
+ (latest[0] === current[0] && latest[1] === current[1] && latest[2] > current[2]);
52
+
53
+ if (isNewer) {
54
+ console.log(chalk.yellow(`\nšŸ“¦ Update available: ${VERSION} → ${latestVersion}`));
55
+ console.log(chalk.dim(` Run: npm i -g ${PACKAGE_NAME}\n`));
56
+
57
+ // Auto-update option (uncomment to enable)
58
+ // console.log(chalk.dim(' Updating automatically...'));
59
+ // await execAsync(`npm i -g ${PACKAGE_NAME}`);
60
+ // console.log(chalk.green(' āœ“ Updated! Please restart ramp.\n'));
61
+ // process.exit(0);
62
+ }
63
+ }
64
+ } catch {
65
+ // Silently fail - don't block CLI usage
66
+ }
67
+ }
68
+
69
+ // Run update check in background (non-blocking)
70
+ checkForUpdates();
32
71
 
33
72
  // ASCII art banner
34
73
  const banner = `
@@ -2040,6 +2079,42 @@ program
2040
2079
  console.log(chalk.green(`āœ“ Logged out from ${user.email}\n`));
2041
2080
  });
2042
2081
 
2082
+ program
2083
+ .command('update')
2084
+ .description('Update Ramp CLI to the latest version')
2085
+ .action(async () => {
2086
+ console.log(banner);
2087
+ console.log(chalk.bold.blue('šŸ“¦ Updating Ramp CLI\n'));
2088
+
2089
+ const spinner = ora('Checking for updates...').start();
2090
+
2091
+ try {
2092
+ // Check npm registry for latest version
2093
+ const response = await fetch(`https://registry.npmjs.org/${PACKAGE_NAME}/latest`);
2094
+ if (!response.ok) throw new Error('Failed to check npm registry');
2095
+
2096
+ const data = await response.json();
2097
+ const latestVersion = data.version;
2098
+
2099
+ if (latestVersion === VERSION) {
2100
+ spinner.succeed(`Already on latest version (${VERSION})\n`);
2101
+ return;
2102
+ }
2103
+
2104
+ spinner.text = `Updating ${VERSION} → ${latestVersion}...`;
2105
+
2106
+ // Run npm update
2107
+ await execAsync(`npm i -g ${PACKAGE_NAME}@latest`);
2108
+
2109
+ spinner.succeed(`Updated to ${latestVersion}!\n`);
2110
+ console.log(chalk.green('Please restart ramp to use the new version.\n'));
2111
+ } catch (error) {
2112
+ spinner.fail('Update failed');
2113
+ console.error(chalk.red(`Error: ${error.message}`));
2114
+ console.log(chalk.dim(`\nTry manually: npm i -g ${PACKAGE_NAME}\n`));
2115
+ }
2116
+ });
2117
+
2043
2118
  program
2044
2119
  .command('whoami')
2045
2120
  .description('Show current logged in user')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rampup",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Ramp - Understand any codebase in hours. AI-powered developer onboarding CLI.",
5
5
  "type": "module",
6
6
  "bin": {