@snapcommit/cli 3.8.7 → 3.8.9

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/dist/index.js CHANGED
@@ -8,6 +8,7 @@ const commander_1 = require("commander");
8
8
  const chalk_1 = __importDefault(require("chalk"));
9
9
  const dotenv_1 = require("dotenv");
10
10
  const path_1 = __importDefault(require("path"));
11
+ const fs_1 = require("fs");
11
12
  const version_1 = require("./utils/version");
12
13
  const commit_1 = require("./commands/commit");
13
14
  const stats_1 = require("./commands/stats");
@@ -24,6 +25,8 @@ const github_connect_1 = require("./commands/github-connect");
24
25
  const repl_1 = require("./repl");
25
26
  // Load environment variables from root .env
26
27
  (0, dotenv_1.config)({ path: path_1.default.join(__dirname, '../../.env') });
28
+ // Read version from package.json
29
+ const packageJson = JSON.parse((0, fs_1.readFileSync)(path_1.default.join(__dirname, '../package.json'), 'utf-8'));
27
30
  const program = new commander_1.Command();
28
31
  // Check for updates (async, non-blocking)
29
32
  (0, version_1.checkForUpdates)().then((result) => {
@@ -40,7 +43,7 @@ const program = new commander_1.Command();
40
43
  program
41
44
  .name('snapcommit')
42
45
  .description('Snap. Commit. Track. - Instant AI commits with beautiful stats')
43
- .version('1.0.0');
46
+ .version(packageJson.version);
44
47
  // Command: devflow commit
45
48
  program
46
49
  .command('commit')
@@ -103,6 +103,21 @@ async function startREPL() {
103
103
  rl.prompt();
104
104
  return;
105
105
  }
106
+ // Update command
107
+ if (trimmed === 'update' || trimmed === 'upgrade') {
108
+ console.log(chalk_1.default.cyan('\nšŸ“¦ Updating SnapCommit...\n'));
109
+ const { execSync } = await Promise.resolve().then(() => __importStar(require('child_process')));
110
+ try {
111
+ execSync('npm install -g @snapcommit/cli@latest', { stdio: 'inherit' });
112
+ console.log(chalk_1.default.green('\nāœ… Updated successfully!'));
113
+ console.log(chalk_1.default.yellow('āš ļø Please exit and restart snap to use the new version.\n'));
114
+ }
115
+ catch (error) {
116
+ console.log(chalk_1.default.red('\nāŒ Update failed. Try manually: npm install -g @snapcommit/cli@latest\n'));
117
+ }
118
+ rl.prompt();
119
+ return;
120
+ }
106
121
  // Multi-repo commands
107
122
  if (trimmed === 'repos' || trimmed === 'list repos' || trimmed === 'show repos') {
108
123
  multiRepo.listRepos();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapcommit/cli",
3
- "version": "3.8.7",
3
+ "version": "3.8.9",
4
4
  "description": "Instant AI commits. Beautiful progress tracking. Never write commit messages again.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {