@snapcommit/cli 1.1.2 → 1.1.4

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/dist/repl.js +67 -3
  2. package/package.json +1 -1
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,41 @@ 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
+ }
192
+ // Detect npm/shell commands and provide helpful guidance
193
+ if (line.startsWith('npm ') || line.startsWith('yarn ') || line.startsWith('pnpm ')) {
194
+ console.log(chalk_1.default.yellow('\nšŸ’” You\'re inside the SnapCommit REPL!\n'));
195
+ if (line.includes('install') && line.includes('snapcommit')) {
196
+ console.log(chalk_1.default.white(' To update SnapCommit, just type: ') + chalk_1.default.cyan.bold('update\n'));
197
+ }
198
+ else {
199
+ console.log(chalk_1.default.white(' Shell commands don\'t work here.'));
200
+ console.log(chalk_1.default.gray(' Exit with ') + chalk_1.default.cyan('exit') + chalk_1.default.gray(' to run shell commands\n'));
201
+ }
202
+ rl.prompt();
203
+ return;
204
+ }
142
205
  if (line === 'help' || line === 'h') {
143
206
  console.log(chalk_1.default.bold('\nšŸ’” SnapCommit Commands:\n'));
207
+ console.log(chalk_1.default.gray(' • ') + chalk_1.default.cyan('update') + chalk_1.default.gray(' - Update SnapCommit to latest version'));
144
208
  console.log(chalk_1.default.gray(' • ') + chalk_1.default.cyan('cd /path/to/repo') + chalk_1.default.gray(' - Switch to a different repository'));
145
209
  console.log(chalk_1.default.gray(' • ') + chalk_1.default.cyan('repos') + chalk_1.default.gray(' - Show recent repositories'));
146
210
  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.2",
3
+ "version": "1.1.4",
4
4
  "description": "Instant AI commits. Beautiful progress tracking. Never write commit messages again.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {