vibecodingmachine-core 1.0.2 → 2025.11.2-7.1302

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 (49) hide show
  1. package/.babelrc +13 -13
  2. package/README.md +28 -28
  3. package/__tests__/applescript-manager-claude-fix.test.js +286 -286
  4. package/__tests__/requirement-2-auto-start-looping.test.js +69 -69
  5. package/__tests__/requirement-3-auto-start-looping.test.js +69 -69
  6. package/__tests__/requirement-4-auto-start-looping.test.js +69 -69
  7. package/__tests__/requirement-6-auto-start-looping.test.js +73 -73
  8. package/__tests__/requirement-7-status-tracking.test.js +332 -332
  9. package/jest.config.js +18 -18
  10. package/jest.setup.js +12 -12
  11. package/package.json +48 -48
  12. package/src/auth/access-denied.html +119 -119
  13. package/src/auth/shared-auth-storage.js +230 -230
  14. package/src/autonomous-mode/feature-implementer.cjs +70 -70
  15. package/src/autonomous-mode/feature-implementer.js +425 -425
  16. package/src/chat-management/chat-manager.cjs +71 -71
  17. package/src/chat-management/chat-manager.js +342 -342
  18. package/src/ide-integration/__tests__/applescript-manager-thread-closure.test.js +227 -227
  19. package/src/ide-integration/aider-cli-manager.cjs +850 -850
  20. package/src/ide-integration/applescript-manager.cjs +1088 -1088
  21. package/src/ide-integration/applescript-manager.js +2802 -2802
  22. package/src/ide-integration/applescript-utils.js +306 -306
  23. package/src/ide-integration/cdp-manager.cjs +221 -221
  24. package/src/ide-integration/cdp-manager.js +321 -321
  25. package/src/ide-integration/claude-code-cli-manager.cjs +301 -301
  26. package/src/ide-integration/cline-cli-manager.cjs +2252 -2252
  27. package/src/ide-integration/continue-cli-manager.js +431 -431
  28. package/src/ide-integration/provider-manager.cjs +354 -354
  29. package/src/ide-integration/quota-detector.cjs +34 -34
  30. package/src/ide-integration/quota-detector.js +349 -349
  31. package/src/ide-integration/windows-automation-manager.js +262 -262
  32. package/src/index.cjs +47 -43
  33. package/src/index.js +17 -17
  34. package/src/llm/direct-llm-manager.cjs +609 -609
  35. package/src/ui/ButtonComponents.js +247 -247
  36. package/src/ui/ChatInterface.js +499 -499
  37. package/src/ui/StateManager.js +259 -259
  38. package/src/utils/audit-logger.cjs +116 -116
  39. package/src/utils/config-helpers.cjs +94 -94
  40. package/src/utils/config-helpers.js +94 -94
  41. package/src/utils/electron-update-checker.js +113 -85
  42. package/src/utils/gcloud-auth.cjs +394 -394
  43. package/src/utils/logger.cjs +193 -193
  44. package/src/utils/logger.js +191 -191
  45. package/src/utils/repo-helpers.cjs +120 -120
  46. package/src/utils/repo-helpers.js +120 -120
  47. package/src/utils/requirement-helpers.js +432 -432
  48. package/src/utils/update-checker.js +227 -167
  49. 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
- resolve({
32
- hasUpdate: true,
33
- currentVersion,
34
- latestVersion,
35
- publishedDate: publishedDate.toLocaleString('en-US', {
36
- year: 'numeric',
37
- month: '2-digit',
38
- day: '2-digit',
39
- hour: '2-digit',
40
- minute: '2-digit',
41
- timeZoneName: 'short'
42
- }),
43
- packageName,
44
- description: versionInfo.description || ''
45
- });
46
- } else {
47
- resolve({
48
- hasUpdate: false,
49
- currentVersion,
50
- latestVersion,
51
- packageName
52
- });
53
- }
54
- } catch (error) {
55
- console.error('Error parsing registry response:', error);
56
- resolve({ hasUpdate: false, currentVersion, packageName, error: error.message });
57
- }
58
- });
59
- }).on('error', (error) => {
60
- console.error('Error checking for updates:', error);
61
- resolve({ hasUpdate: false, currentVersion, packageName, error: error.message });
62
- });
63
- });
64
- }
65
-
66
- /**
67
- * Get update info cache file path
68
- * @param {string} packageName - Package name
69
- * @returns {string} Path to cache file
70
- */
71
- function getUpdateCachePath(packageName) {
72
- const homeDir = require('os').homedir();
73
- const cacheDir = path.join(homeDir, '.config', 'vibecodingmachine');
74
-
75
- // Ensure cache directory exists
76
- if (!fs.existsSync(cacheDir)) {
77
- fs.mkdirSync(cacheDir, { recursive: true });
78
- }
79
-
80
- return path.join(cacheDir, `${packageName}-update-cache.json`);
81
- }
82
-
83
- /**
84
- * Load cached update info
85
- * @param {string} packageName - Package name
86
- * @returns {Object|null} Cached update info or null
87
- */
88
- function loadUpdateCache(packageName) {
89
- try {
90
- const cachePath = getUpdateCachePath(packageName);
91
- if (fs.existsSync(cachePath)) {
92
- const data = fs.readFileSync(cachePath, 'utf8');
93
- const cache = JSON.parse(data);
94
-
95
- // Cache is valid for 1 hour
96
- const cacheAge = Date.now() - cache.checkedAt;
97
- if (cacheAge < 3600000) { // 1 hour
98
- return cache.updateInfo;
99
- }
100
- }
101
- } catch (error) {
102
- console.error('Error loading update cache:', error);
103
- }
104
- return null;
105
- }
106
-
107
- /**
108
- * Save update info to cache
109
- * @param {string} packageName - Package name
110
- * @param {Object} updateInfo - Update info to cache
111
- */
112
- function saveUpdateCache(packageName, updateInfo) {
113
- try {
114
- const cachePath = getUpdateCachePath(packageName);
115
- const cache = {
116
- checkedAt: Date.now(),
117
- updateInfo
118
- };
119
- fs.writeFileSync(cachePath, JSON.stringify(cache, null, 2));
120
- } catch (error) {
121
- console.error('Error saving update cache:', error);
122
- }
123
- }
124
-
125
- /**
126
- * Check for updates with caching
127
- * @param {string} packageName - Package name
128
- * @param {string} currentVersion - Current version
129
- * @param {boolean} forceCheck - Force check even if cache is valid
130
- * @returns {Promise<Object>} Update info
131
- */
132
- async function checkForUpdatesWithCache(packageName, currentVersion, forceCheck = false) {
133
- if (!forceCheck) {
134
- const cached = loadUpdateCache(packageName);
135
- if (cached) {
136
- return cached;
137
- }
138
- }
139
-
140
- const updateInfo = await checkForUpdates(packageName, currentVersion);
141
- saveUpdateCache(packageName, updateInfo);
142
- return updateInfo;
143
- }
144
-
145
- /**
146
- * Clear update notification (mark as dismissed)
147
- * @param {string} packageName - Package name
148
- */
149
- function clearUpdateNotification(packageName) {
150
- try {
151
- const cachePath = getUpdateCachePath(packageName);
152
- if (fs.existsSync(cachePath)) {
153
- fs.unlinkSync(cachePath);
154
- }
155
- } catch (error) {
156
- console.error('Error clearing update notification:', error);
157
- }
158
- }
159
-
160
- module.exports = {
161
- checkForUpdates,
162
- checkForUpdatesWithCache,
163
- loadUpdateCache,
164
- saveUpdateCache,
165
- clearUpdateNotification,
166
- getUpdateCachePath
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
+ };