@snapcommit/cli 1.1.0 → 1.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.
- package/dist/commands/natural.js +1 -1
- package/dist/commands/quick.js +12 -12
- package/dist/repl.js +7 -4
- package/dist/utils/version.js +3 -2
- package/package.json +1 -1
package/dist/commands/natural.js
CHANGED
|
@@ -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
|
-
|
|
101
|
+
return;
|
|
102
102
|
}
|
|
103
103
|
// Check if in git repo
|
|
104
104
|
if (!(0, git_1.isGitRepo)()) {
|
package/dist/commands/quick.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
129
|
+
return;
|
|
130
130
|
}
|
|
131
131
|
}
|
package/dist/repl.js
CHANGED
|
@@ -30,17 +30,20 @@ async function startREPL() {
|
|
|
30
30
|
process.exit(1);
|
|
31
31
|
}
|
|
32
32
|
console.log(chalk_1.default.green(`✅ Logged in as ${chalk_1.default.bold(authConfig.email)}\n`));
|
|
33
|
-
// Check for updates (non-blocking)
|
|
33
|
+
// Check for updates (non-blocking, but show result)
|
|
34
34
|
(0, version_1.checkForUpdates)().then(updateInfo => {
|
|
35
35
|
if (updateInfo && updateInfo.hasUpdate) {
|
|
36
|
-
console.log(chalk_1.default.yellow.bold('╔════════════════════════════════════════╗'));
|
|
36
|
+
console.log(chalk_1.default.yellow.bold('\n╔════════════════════════════════════════╗'));
|
|
37
37
|
console.log(chalk_1.default.yellow.bold('║ 🚀 UPDATE AVAILABLE! ║'));
|
|
38
38
|
console.log(chalk_1.default.yellow.bold('╚════════════════════════════════════════╝'));
|
|
39
39
|
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(' Update now: ') + chalk_1.default.white('npm install -g @snapcommit/cli@latest
|
|
40
|
+
console.log(chalk_1.default.cyan.bold(' Update now: ') + chalk_1.default.white('npm install -g @snapcommit/cli@latest'));
|
|
41
|
+
console.log(chalk_1.default.gray(' (Faster AI, better UX, bug fixes!)\n'));
|
|
41
42
|
}
|
|
42
|
-
}).catch(() => {
|
|
43
|
+
}).catch((err) => {
|
|
43
44
|
// Silent fail - don't interrupt user experience
|
|
45
|
+
// But log for debugging if needed
|
|
46
|
+
console.error('Version check failed:', err);
|
|
44
47
|
});
|
|
45
48
|
// Check GitHub connection status
|
|
46
49
|
const githubConnected = (0, github_connect_1.isGitHubConnected)();
|
package/dist/utils/version.js
CHANGED
|
@@ -55,13 +55,14 @@ function getLatestVersionFromNpm(packageName) {
|
|
|
55
55
|
return new Promise((resolve, reject) => {
|
|
56
56
|
// Encode package name for URL (handles scoped packages like @snapcommit/cli)
|
|
57
57
|
const encodedName = packageName.replace('/', '%2F');
|
|
58
|
-
https_1.default.get(`https://registry.npmjs.org/${encodedName}
|
|
58
|
+
https_1.default.get(`https://registry.npmjs.org/${encodedName}`, (res) => {
|
|
59
59
|
let data = '';
|
|
60
60
|
res.on('data', (chunk) => data += chunk);
|
|
61
61
|
res.on('end', () => {
|
|
62
62
|
try {
|
|
63
63
|
const json = JSON.parse(data);
|
|
64
|
-
|
|
64
|
+
// Get the latest version from dist-tags
|
|
65
|
+
resolve(json['dist-tags']?.latest || json.version);
|
|
65
66
|
}
|
|
66
67
|
catch {
|
|
67
68
|
reject(new Error('Failed to parse npm response'));
|