@snapcommit/cli 1.1.1 → 1.1.3

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.
@@ -98,7 +98,7 @@ async function naturalCommand(userInput) {
98
98
  const authConfig = await (0, auth_1.ensureAuth)();
99
99
  if (!authConfig) {
100
100
  console.log(chalk_1.default.red('\n❌ Authentication required to use SnapCommit\n'));
101
- process.exit(1);
101
+ return;
102
102
  }
103
103
  // Check if in git repo
104
104
  if (!(0, git_1.isGitRepo)()) {
@@ -52,25 +52,25 @@ async function quickCommand() {
52
52
  const authConfig = await (0, auth_1.ensureAuth)();
53
53
  if (!authConfig) {
54
54
  console.log(chalk_1.default.red('\n❌ Authentication required to use SnapCommit\n'));
55
- process.exit(1);
55
+ return;
56
56
  }
57
57
  const token = (0, auth_1.getToken)();
58
58
  if (!token) {
59
59
  console.log(chalk_1.default.red('\n❌ No authentication token found\n'));
60
- process.exit(1);
60
+ return;
61
61
  }
62
62
  // Check git repo
63
63
  if (!(0, git_1.isGitRepo)()) {
64
- console.log(chalk_1.default.red('❌ Not a git repository'));
65
- process.exit(1);
64
+ console.log(chalk_1.default.red('❌ Not a git repository\n'));
65
+ return;
66
66
  }
67
67
  // Stage all changes
68
68
  try {
69
69
  (0, git_1.stageAllChanges)();
70
70
  }
71
71
  catch (error) {
72
- console.log(chalk_1.default.red('❌ Failed to stage changes'));
73
- process.exit(1);
72
+ console.log(chalk_1.default.red('❌ Failed to stage changes\n'));
73
+ return;
74
74
  }
75
75
  // Get diff
76
76
  let diff;
@@ -78,12 +78,12 @@ async function quickCommand() {
78
78
  diff = (0, git_1.getGitDiff)(true);
79
79
  }
80
80
  catch (error) {
81
- console.log(chalk_1.default.red('❌ Failed to get diff'));
82
- process.exit(1);
81
+ console.log(chalk_1.default.red('❌ Failed to get diff\n'));
82
+ return;
83
83
  }
84
84
  if (!diff.trim()) {
85
- console.log(chalk_1.default.yellow('⚠️ No changes to commit'));
86
- process.exit(0);
85
+ console.log(chalk_1.default.yellow('⚠️ No changes to commit\n'));
86
+ return;
87
87
  }
88
88
  // Truncate large diffs
89
89
  if (diff.length > 40000) {
@@ -103,7 +103,7 @@ async function quickCommand() {
103
103
  process.stdout.write(chalk_1.default.red('✗\n'));
104
104
  (0, analytics_1.trackEvent)({ event: 'commit_error' });
105
105
  console.log(chalk_1.default.red(`❌ ${error.message}\n`));
106
- process.exit(1);
106
+ return;
107
107
  }
108
108
  // Show message
109
109
  console.log(chalk_1.default.white(`📝 ${chalk_1.default.bold(message.split('\n')[0])}`));
@@ -126,6 +126,6 @@ async function quickCommand() {
126
126
  }
127
127
  catch (error) {
128
128
  console.log(chalk_1.default.red('\n❌ Commit failed\n'));
129
- process.exit(1);
129
+ return;
130
130
  }
131
131
  }
package/dist/repl.js CHANGED
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
@@ -37,13 +70,11 @@ async function startREPL() {
37
70
  console.log(chalk_1.default.yellow.bold('║ 🚀 UPDATE AVAILABLE! ║'));
38
71
  console.log(chalk_1.default.yellow.bold('╚════════════════════════════════════════╝'));
39
72
  console.log(chalk_1.default.white(` Current: ${chalk_1.default.red(updateInfo.currentVersion)} → Latest: ${chalk_1.default.green(updateInfo.latestVersion)}\n`));
40
- console.log(chalk_1.default.cyan.bold(' Update now: ') + chalk_1.default.white('npm install -g @snapcommit/cli@latest'));
73
+ console.log(chalk_1.default.cyan.bold(' Update now: ') + chalk_1.default.white('Type ') + chalk_1.default.cyan.bold('update') + chalk_1.default.white(' to upgrade'));
41
74
  console.log(chalk_1.default.gray(' (Faster AI, better UX, bug fixes!)\n'));
42
75
  }
43
76
  }).catch((err) => {
44
77
  // Silent fail - don't interrupt user experience
45
- // But log for debugging if needed
46
- console.error('Version check failed:', err);
47
78
  });
48
79
  // Check GitHub connection status
49
80
  const githubConnected = (0, github_connect_1.isGitHubConnected)();
@@ -139,8 +170,28 @@ async function startREPL() {
139
170
  rl.prompt();
140
171
  return;
141
172
  }
173
+ // Update command - update SnapCommit to latest version
174
+ if (line === 'update' || line === 'upgrade') {
175
+ console.log(chalk_1.default.cyan('\n⚡ Updating SnapCommit to latest version...\n'));
176
+ try {
177
+ const { execSync } = await Promise.resolve().then(() => __importStar(require('child_process')));
178
+ execSync('npm install -g @snapcommit/cli@latest', {
179
+ stdio: 'inherit',
180
+ encoding: 'utf-8'
181
+ });
182
+ console.log(chalk_1.default.green('\n✅ Update complete! Please restart snap to use the new version.\n'));
183
+ console.log(chalk_1.default.gray('Run: ') + chalk_1.default.cyan('exit') + chalk_1.default.gray(' then ') + chalk_1.default.cyan('snap\n'));
184
+ }
185
+ catch (error) {
186
+ console.log(chalk_1.default.red('\n❌ Update failed. Try manually:\n'));
187
+ console.log(chalk_1.default.cyan(' npm install -g @snapcommit/cli@latest\n'));
188
+ }
189
+ rl.prompt();
190
+ return;
191
+ }
142
192
  if (line === 'help' || line === 'h') {
143
193
  console.log(chalk_1.default.bold('\n💡 SnapCommit Commands:\n'));
194
+ console.log(chalk_1.default.gray(' • ') + chalk_1.default.cyan('update') + chalk_1.default.gray(' - Update SnapCommit to latest version'));
144
195
  console.log(chalk_1.default.gray(' • ') + chalk_1.default.cyan('cd /path/to/repo') + chalk_1.default.gray(' - Switch to a different repository'));
145
196
  console.log(chalk_1.default.gray(' • ') + chalk_1.default.cyan('repos') + chalk_1.default.gray(' - Show recent repositories'));
146
197
  console.log(chalk_1.default.gray(' • ') + chalk_1.default.cyan('quick') + chalk_1.default.gray(' - Quick AI commit (stage all + commit)'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapcommit/cli",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Instant AI commits. Beautiful progress tracking. Never write commit messages again.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {