vibecodingmachine-core 1.0.2 → 2025.11.2-7.1239
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/.babelrc +13 -13
- package/README.md +28 -28
- package/__tests__/applescript-manager-claude-fix.test.js +286 -286
- package/__tests__/requirement-2-auto-start-looping.test.js +69 -69
- package/__tests__/requirement-3-auto-start-looping.test.js +69 -69
- package/__tests__/requirement-4-auto-start-looping.test.js +69 -69
- package/__tests__/requirement-6-auto-start-looping.test.js +73 -73
- package/__tests__/requirement-7-status-tracking.test.js +332 -332
- package/jest.config.js +18 -18
- package/jest.setup.js +12 -12
- package/package.json +48 -48
- package/src/auth/access-denied.html +119 -119
- package/src/auth/shared-auth-storage.js +230 -230
- package/src/autonomous-mode/feature-implementer.cjs +70 -70
- package/src/autonomous-mode/feature-implementer.js +425 -425
- package/src/chat-management/chat-manager.cjs +71 -71
- package/src/chat-management/chat-manager.js +342 -342
- package/src/ide-integration/__tests__/applescript-manager-thread-closure.test.js +227 -227
- package/src/ide-integration/aider-cli-manager.cjs +850 -850
- package/src/ide-integration/applescript-manager.cjs +1088 -1088
- package/src/ide-integration/applescript-manager.js +2802 -2802
- package/src/ide-integration/applescript-utils.js +306 -306
- package/src/ide-integration/cdp-manager.cjs +221 -221
- package/src/ide-integration/cdp-manager.js +321 -321
- package/src/ide-integration/claude-code-cli-manager.cjs +301 -301
- package/src/ide-integration/cline-cli-manager.cjs +2252 -2252
- package/src/ide-integration/continue-cli-manager.js +431 -431
- package/src/ide-integration/provider-manager.cjs +354 -354
- package/src/ide-integration/quota-detector.cjs +34 -34
- package/src/ide-integration/quota-detector.js +349 -349
- package/src/ide-integration/windows-automation-manager.js +262 -262
- package/src/index.cjs +47 -43
- package/src/index.js +17 -17
- package/src/llm/direct-llm-manager.cjs +609 -609
- package/src/ui/ButtonComponents.js +247 -247
- package/src/ui/ChatInterface.js +499 -499
- package/src/ui/StateManager.js +259 -259
- package/src/utils/audit-logger.cjs +116 -116
- package/src/utils/config-helpers.cjs +94 -94
- package/src/utils/config-helpers.js +94 -94
- package/src/utils/electron-update-checker.js +113 -85
- package/src/utils/gcloud-auth.cjs +394 -394
- package/src/utils/logger.cjs +193 -193
- package/src/utils/logger.js +191 -191
- package/src/utils/repo-helpers.cjs +120 -120
- package/src/utils/repo-helpers.js +120 -120
- package/src/utils/requirement-helpers.js +432 -432
- package/src/utils/update-checker.js +227 -167
- package/src/utils/version-checker.js +169 -0
|
@@ -1,167 +1,227 @@
|
|
|
1
|
-
const https = require('https');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Check for updates from npm registry
|
|
7
|
-
* @param {string} packageName - Name of the package to check (e.g., 'vibecodingmachine-cli')
|
|
8
|
-
* @param {string} currentVersion - Current version (e.g., '1.0.0')
|
|
9
|
-
* @returns {Promise<Object>} Update info or null if no update available
|
|
10
|
-
*/
|
|
11
|
-
async function checkForUpdates(packageName, currentVersion) {
|
|
12
|
-
return new Promise((resolve, reject) => {
|
|
13
|
-
const registryUrl = `https://registry.npmjs.org/${packageName}`;
|
|
14
|
-
|
|
15
|
-
https.get(registryUrl, (res) => {
|
|
16
|
-
let data = '';
|
|
17
|
-
|
|
18
|
-
res.on('data', (chunk) => {
|
|
19
|
-
data += chunk;
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
res.on('end', () => {
|
|
23
|
-
try {
|
|
24
|
-
const packageInfo = JSON.parse(data);
|
|
25
|
-
const latestVersion = packageInfo['dist-tags'].latest;
|
|
26
|
-
|
|
27
|
-
if (latestVersion !== currentVersion) {
|
|
28
|
-
const versionInfo = packageInfo.versions[latestVersion];
|
|
29
|
-
const publishedDate = new Date(packageInfo.time[latestVersion]);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
*
|
|
68
|
-
* @param {string}
|
|
69
|
-
* @returns {
|
|
70
|
-
*/
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
*
|
|
127
|
-
* @
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
1
|
+
const https = require('https');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Check for updates from npm registry
|
|
7
|
+
* @param {string} packageName - Name of the package to check (e.g., 'vibecodingmachine-cli')
|
|
8
|
+
* @param {string} currentVersion - Current version (e.g., '1.0.0')
|
|
9
|
+
* @returns {Promise<Object>} Update info or null if no update available
|
|
10
|
+
*/
|
|
11
|
+
async function checkForUpdates(packageName, currentVersion) {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
const registryUrl = `https://registry.npmjs.org/${packageName}`;
|
|
14
|
+
|
|
15
|
+
https.get(registryUrl, (res) => {
|
|
16
|
+
let data = '';
|
|
17
|
+
|
|
18
|
+
res.on('data', (chunk) => {
|
|
19
|
+
data += chunk;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
res.on('end', () => {
|
|
23
|
+
try {
|
|
24
|
+
const packageInfo = JSON.parse(data);
|
|
25
|
+
const latestVersion = packageInfo['dist-tags'].latest;
|
|
26
|
+
|
|
27
|
+
if (latestVersion !== currentVersion) {
|
|
28
|
+
const versionInfo = packageInfo.versions[latestVersion];
|
|
29
|
+
const publishedDate = new Date(packageInfo.time[latestVersion]);
|
|
30
|
+
|
|
31
|
+
// Format date as YYYY-MM-DD
|
|
32
|
+
const year = publishedDate.getFullYear();
|
|
33
|
+
const month = String(publishedDate.getMonth() + 1).padStart(2, '0');
|
|
34
|
+
const day = String(publishedDate.getDate()).padStart(2, '0');
|
|
35
|
+
const formattedDate = `${year}-${month}-${day}`;
|
|
36
|
+
|
|
37
|
+
resolve({
|
|
38
|
+
hasUpdate: true,
|
|
39
|
+
currentVersion,
|
|
40
|
+
latestVersion,
|
|
41
|
+
publishedDate: formattedDate,
|
|
42
|
+
packageName,
|
|
43
|
+
description: versionInfo.description || ''
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
resolve({
|
|
47
|
+
hasUpdate: false,
|
|
48
|
+
currentVersion,
|
|
49
|
+
latestVersion,
|
|
50
|
+
packageName
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.error('Error parsing registry response:', error);
|
|
55
|
+
resolve({ hasUpdate: false, currentVersion, packageName, error: error.message });
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}).on('error', (error) => {
|
|
59
|
+
console.error('Error checking for updates:', error);
|
|
60
|
+
resolve({ hasUpdate: false, currentVersion, packageName, error: error.message });
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Check for CLI updates from S3 version manifest (unified with Electron)
|
|
67
|
+
* Both CLI and Electron now use the same timestamp-based versioning from git commits
|
|
68
|
+
* @param {string} currentVersion - Current CLI version (e.g., '2025.11.26.0519')
|
|
69
|
+
* @returns {Promise<Object>} Update info or null if no update available
|
|
70
|
+
*/
|
|
71
|
+
async function checkForCLIUpdates(currentVersion) {
|
|
72
|
+
return new Promise((resolve, reject) => {
|
|
73
|
+
const manifestUrl = `https://vibecodingmachine-website.s3.amazonaws.com/downloads/version.json?t=${Date.now()}`;
|
|
74
|
+
|
|
75
|
+
https.get(manifestUrl, (res) => {
|
|
76
|
+
let data = '';
|
|
77
|
+
|
|
78
|
+
// Check HTTP status code
|
|
79
|
+
if (res.statusCode !== 200) {
|
|
80
|
+
console.log(`ℹ️ Update check skipped: version manifest not available (HTTP ${res.statusCode})`);
|
|
81
|
+
resolve({ hasUpdate: false, currentVersion, error: `HTTP ${res.statusCode}` });
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
res.on('data', (chunk) => {
|
|
86
|
+
data += chunk;
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
res.on('end', () => {
|
|
90
|
+
try {
|
|
91
|
+
const manifest = JSON.parse(data);
|
|
92
|
+
const latestVersion = manifest.version;
|
|
93
|
+
const publishedDate = manifest.date;
|
|
94
|
+
|
|
95
|
+
if (latestVersion !== currentVersion) {
|
|
96
|
+
resolve({
|
|
97
|
+
hasUpdate: true,
|
|
98
|
+
currentVersion,
|
|
99
|
+
latestVersion,
|
|
100
|
+
publishedDate,
|
|
101
|
+
commit: manifest.commit || 'Unknown',
|
|
102
|
+
packageName: 'vibecodingmachine-cli'
|
|
103
|
+
});
|
|
104
|
+
} else {
|
|
105
|
+
resolve({
|
|
106
|
+
hasUpdate: false,
|
|
107
|
+
currentVersion,
|
|
108
|
+
latestVersion
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
} catch (error) {
|
|
112
|
+
console.error('Error parsing version manifest:', error);
|
|
113
|
+
resolve({ hasUpdate: false, currentVersion, error: error.message });
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}).on('error', (error) => {
|
|
117
|
+
console.error('Error checking for CLI updates:', error);
|
|
118
|
+
resolve({ hasUpdate: false, currentVersion, error: error.message });
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Get update info cache file path
|
|
126
|
+
* @param {string} packageName - Package name
|
|
127
|
+
* @returns {string} Path to cache file
|
|
128
|
+
*/
|
|
129
|
+
function getUpdateCachePath(packageName) {
|
|
130
|
+
const homeDir = require('os').homedir();
|
|
131
|
+
const cacheDir = path.join(homeDir, '.config', 'vibecodingmachine');
|
|
132
|
+
|
|
133
|
+
// Ensure cache directory exists
|
|
134
|
+
if (!fs.existsSync(cacheDir)) {
|
|
135
|
+
fs.mkdirSync(cacheDir, { recursive: true });
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return path.join(cacheDir, `${packageName}-update-cache.json`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Load cached update info
|
|
143
|
+
* @param {string} packageName - Package name
|
|
144
|
+
* @returns {Object|null} Cached update info or null
|
|
145
|
+
*/
|
|
146
|
+
function loadUpdateCache(packageName) {
|
|
147
|
+
try {
|
|
148
|
+
const cachePath = getUpdateCachePath(packageName);
|
|
149
|
+
if (fs.existsSync(cachePath)) {
|
|
150
|
+
const data = fs.readFileSync(cachePath, 'utf8');
|
|
151
|
+
const cache = JSON.parse(data);
|
|
152
|
+
|
|
153
|
+
// Cache is valid for 1 hour
|
|
154
|
+
const cacheAge = Date.now() - cache.checkedAt;
|
|
155
|
+
if (cacheAge < 3600000) { // 1 hour
|
|
156
|
+
return cache.updateInfo;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
} catch (error) {
|
|
160
|
+
console.error('Error loading update cache:', error);
|
|
161
|
+
}
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Save update info to cache
|
|
167
|
+
* @param {string} packageName - Package name
|
|
168
|
+
* @param {Object} updateInfo - Update info to cache
|
|
169
|
+
*/
|
|
170
|
+
function saveUpdateCache(packageName, updateInfo) {
|
|
171
|
+
try {
|
|
172
|
+
const cachePath = getUpdateCachePath(packageName);
|
|
173
|
+
const cache = {
|
|
174
|
+
checkedAt: Date.now(),
|
|
175
|
+
updateInfo
|
|
176
|
+
};
|
|
177
|
+
fs.writeFileSync(cachePath, JSON.stringify(cache, null, 2));
|
|
178
|
+
} catch (error) {
|
|
179
|
+
console.error('Error saving update cache:', error);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Check for updates with caching
|
|
185
|
+
* @param {string} packageName - Package name
|
|
186
|
+
* @param {string} currentVersion - Current version
|
|
187
|
+
* @param {boolean} forceCheck - Force check even if cache is valid
|
|
188
|
+
* @returns {Promise<Object>} Update info
|
|
189
|
+
*/
|
|
190
|
+
async function checkForUpdatesWithCache(packageName, currentVersion, forceCheck = false) {
|
|
191
|
+
if (!forceCheck) {
|
|
192
|
+
const cached = loadUpdateCache(packageName);
|
|
193
|
+
if (cached) {
|
|
194
|
+
return cached;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const updateInfo = await checkForUpdates(packageName, currentVersion);
|
|
199
|
+
saveUpdateCache(packageName, updateInfo);
|
|
200
|
+
return updateInfo;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Clear update notification (mark as dismissed)
|
|
205
|
+
* @param {string} packageName - Package name
|
|
206
|
+
*/
|
|
207
|
+
function clearUpdateNotification(packageName) {
|
|
208
|
+
try {
|
|
209
|
+
const cachePath = getUpdateCachePath(packageName);
|
|
210
|
+
if (fs.existsSync(cachePath)) {
|
|
211
|
+
fs.unlinkSync(cachePath);
|
|
212
|
+
}
|
|
213
|
+
} catch (error) {
|
|
214
|
+
console.error('Error clearing update notification:', error);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
module.exports = {
|
|
219
|
+
checkForUpdates,
|
|
220
|
+
checkForCLIUpdates,
|
|
221
|
+
checkForUpdatesWithCache,
|
|
222
|
+
loadUpdateCache,
|
|
223
|
+
saveUpdateCache,
|
|
224
|
+
clearUpdateNotification,
|
|
225
|
+
getUpdateCachePath
|
|
226
|
+
};
|
|
227
|
+
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version Checker - Check for updates and manage version display
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const fetch = require('node-fetch');
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const os = require('os');
|
|
9
|
+
|
|
10
|
+
const CACHE_FILE = path.join(os.tmpdir(), 'vibecodingmachine-version-cache.json');
|
|
11
|
+
const CACHE_DURATION = 1000 * 60 * 60; // 1 hour
|
|
12
|
+
const VERSION_URL = 'https://vibecodingmachine-website.s3.amazonaws.com/downloads/version.json';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Format version timestamp to YYYY.MM.DD.HHMM UTC
|
|
16
|
+
*/
|
|
17
|
+
function formatVersionTimestamp(versionString) {
|
|
18
|
+
// Version format: YYYY.MM.DD.HHMM
|
|
19
|
+
const match = versionString.match(/^(\d{4})\.(\d{2})\.(\d{2})\.(\d{2})(\d{2})$/);
|
|
20
|
+
if (!match) return versionString;
|
|
21
|
+
|
|
22
|
+
const [, year, month, day, hour, minute] = match;
|
|
23
|
+
return `${year}.${month}.${day}.${hour}${minute} UTC`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get formatted local time from UTC timestamp
|
|
28
|
+
*/
|
|
29
|
+
function formatLocalTime(isoTimestamp) {
|
|
30
|
+
try {
|
|
31
|
+
const date = new Date(isoTimestamp);
|
|
32
|
+
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
33
|
+
const timeZoneAbbr = new Intl.DateTimeFormat('en-US', {
|
|
34
|
+
timeZone,
|
|
35
|
+
timeZoneName: 'short'
|
|
36
|
+
}).format(date).split(' ').pop();
|
|
37
|
+
|
|
38
|
+
const formatted = new Intl.DateTimeFormat('en-US', {
|
|
39
|
+
year: 'numeric',
|
|
40
|
+
month: '2-digit',
|
|
41
|
+
day: '2-digit',
|
|
42
|
+
hour: '2-digit',
|
|
43
|
+
minute: '2-digit',
|
|
44
|
+
hour12: false
|
|
45
|
+
}).format(date);
|
|
46
|
+
|
|
47
|
+
// Convert to YYYY.MM.DD.HHMM format
|
|
48
|
+
const parts = formatted.match(/(\d{2})\/(\d{2})\/(\d{4}), (\d{2}):(\d{2})/);
|
|
49
|
+
if (parts) {
|
|
50
|
+
const [, month, day, year, hour, minute] = parts;
|
|
51
|
+
return `${year}.${month}.${day}.${hour}${minute} ${timeZoneAbbr}`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return formatted + ' ' + timeZoneAbbr;
|
|
55
|
+
} catch (error) {
|
|
56
|
+
return isoTimestamp;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Check for updates with caching
|
|
62
|
+
*/
|
|
63
|
+
async function checkForUpdatesWithCache(packageName, currentVersion) {
|
|
64
|
+
try {
|
|
65
|
+
// Check cache first
|
|
66
|
+
if (fs.existsSync(CACHE_FILE)) {
|
|
67
|
+
const cache = JSON.parse(fs.readFileSync(CACHE_FILE, 'utf8'));
|
|
68
|
+
if (cache.timestamp && Date.now() - cache.timestamp < CACHE_DURATION) {
|
|
69
|
+
return {
|
|
70
|
+
...cache.data,
|
|
71
|
+
fromCache: true
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Fetch latest version info
|
|
77
|
+
const response = await fetch(VERSION_URL);
|
|
78
|
+
if (!response.ok) {
|
|
79
|
+
return { hasUpdate: false, currentVersion };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const versionInfo = await response.json();
|
|
83
|
+
const latestVersion = versionInfo.version;
|
|
84
|
+
|
|
85
|
+
const result = {
|
|
86
|
+
hasUpdate: latestVersion !== currentVersion,
|
|
87
|
+
currentVersion,
|
|
88
|
+
latestVersion,
|
|
89
|
+
publishedDate: versionInfo.date ? formatLocalTime(versionInfo.date) : 'Unknown',
|
|
90
|
+
commit: versionInfo.commit || 'Unknown',
|
|
91
|
+
downloadUrl: getDownloadUrl()
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Cache result
|
|
95
|
+
fs.writeFileSync(CACHE_FILE, JSON.stringify({
|
|
96
|
+
timestamp: Date.now(),
|
|
97
|
+
data: result
|
|
98
|
+
}));
|
|
99
|
+
|
|
100
|
+
return result;
|
|
101
|
+
} catch (error) {
|
|
102
|
+
return {
|
|
103
|
+
hasUpdate: false,
|
|
104
|
+
currentVersion,
|
|
105
|
+
error: error.message
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Get download URL for current platform
|
|
112
|
+
*/
|
|
113
|
+
function getDownloadUrl() {
|
|
114
|
+
const platform = os.platform();
|
|
115
|
+
const baseUrl = 'https://vibecodingmachine-website.s3.amazonaws.com/downloads';
|
|
116
|
+
|
|
117
|
+
if (platform === 'darwin') {
|
|
118
|
+
return `${baseUrl}/VibeCodingMachine.dmg`;
|
|
119
|
+
} else if (platform === 'win32') {
|
|
120
|
+
return `${baseUrl}/VibeCodingMachine-win32-x64.zip`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return baseUrl;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Get current Electron app version
|
|
128
|
+
*/
|
|
129
|
+
async function getCurrentElectronVersion() {
|
|
130
|
+
try {
|
|
131
|
+
const response = await fetch(VERSION_URL);
|
|
132
|
+
if (!response.ok) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const versionInfo = await response.json();
|
|
137
|
+
return {
|
|
138
|
+
version: versionInfo.version,
|
|
139
|
+
date: versionInfo.date,
|
|
140
|
+
commit: versionInfo.commit,
|
|
141
|
+
formatted: formatVersionTimestamp(versionInfo.version)
|
|
142
|
+
};
|
|
143
|
+
} catch (error) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Clear version cache
|
|
150
|
+
*/
|
|
151
|
+
function clearVersionCache() {
|
|
152
|
+
try {
|
|
153
|
+
if (fs.existsSync(CACHE_FILE)) {
|
|
154
|
+
fs.unlinkSync(CACHE_FILE);
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
} catch (error) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
module.exports = {
|
|
163
|
+
checkForUpdatesWithCache,
|
|
164
|
+
getCurrentElectronVersion,
|
|
165
|
+
formatVersionTimestamp,
|
|
166
|
+
formatLocalTime,
|
|
167
|
+
getDownloadUrl,
|
|
168
|
+
clearVersionCache
|
|
169
|
+
};
|