vibecodingmachine-core 1.0.0

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 (54) hide show
  1. package/.babelrc +13 -0
  2. package/README.md +28 -0
  3. package/__tests__/applescript-manager-claude-fix.test.js +286 -0
  4. package/__tests__/requirement-2-auto-start-looping.test.js +69 -0
  5. package/__tests__/requirement-3-auto-start-looping.test.js +69 -0
  6. package/__tests__/requirement-4-auto-start-looping.test.js +69 -0
  7. package/__tests__/requirement-6-auto-start-looping.test.js +73 -0
  8. package/__tests__/requirement-7-status-tracking.test.js +332 -0
  9. package/jest.config.js +18 -0
  10. package/jest.setup.js +12 -0
  11. package/package.json +46 -0
  12. package/src/auth/access-denied.html +119 -0
  13. package/src/auth/shared-auth-storage.js +230 -0
  14. package/src/autonomous-mode/feature-implementer.cjs +70 -0
  15. package/src/autonomous-mode/feature-implementer.js +425 -0
  16. package/src/chat-management/chat-manager.cjs +71 -0
  17. package/src/chat-management/chat-manager.js +342 -0
  18. package/src/ide-integration/__tests__/applescript-manager-thread-closure.test.js +227 -0
  19. package/src/ide-integration/aider-cli-manager.cjs +850 -0
  20. package/src/ide-integration/applescript-diagnostics.js +0 -0
  21. package/src/ide-integration/applescript-manager.cjs +1088 -0
  22. package/src/ide-integration/applescript-manager.js +2803 -0
  23. package/src/ide-integration/applescript-open-apps.js +0 -0
  24. package/src/ide-integration/applescript-read-response.js +0 -0
  25. package/src/ide-integration/applescript-send-text.js +0 -0
  26. package/src/ide-integration/applescript-thread-closure.js +0 -0
  27. package/src/ide-integration/applescript-utils.js +306 -0
  28. package/src/ide-integration/cdp-manager.cjs +221 -0
  29. package/src/ide-integration/cdp-manager.js +321 -0
  30. package/src/ide-integration/claude-code-cli-manager.cjs +301 -0
  31. package/src/ide-integration/cline-cli-manager.cjs +2252 -0
  32. package/src/ide-integration/continue-cli-manager.js +431 -0
  33. package/src/ide-integration/provider-manager.cjs +354 -0
  34. package/src/ide-integration/quota-detector.cjs +34 -0
  35. package/src/ide-integration/quota-detector.js +349 -0
  36. package/src/ide-integration/windows-automation-manager.js +262 -0
  37. package/src/index.cjs +43 -0
  38. package/src/index.js +17 -0
  39. package/src/llm/direct-llm-manager.cjs +609 -0
  40. package/src/ui/ButtonComponents.js +247 -0
  41. package/src/ui/ChatInterface.js +499 -0
  42. package/src/ui/StateManager.js +259 -0
  43. package/src/ui/StateManager.test.js +0 -0
  44. package/src/utils/audit-logger.cjs +116 -0
  45. package/src/utils/config-helpers.cjs +94 -0
  46. package/src/utils/config-helpers.js +94 -0
  47. package/src/utils/electron-update-checker.js +78 -0
  48. package/src/utils/gcloud-auth.cjs +394 -0
  49. package/src/utils/logger.cjs +193 -0
  50. package/src/utils/logger.js +191 -0
  51. package/src/utils/repo-helpers.cjs +120 -0
  52. package/src/utils/repo-helpers.js +120 -0
  53. package/src/utils/requirement-helpers.js +432 -0
  54. package/src/utils/update-checker.js +167 -0
@@ -0,0 +1,349 @@
1
+ // @vibecodingmachine/core - Quota Detector
2
+ // Handles quota detection for different IDEs using CDP and AppleScript
3
+
4
+ import CDP from 'chrome-remote-interface';
5
+ import { AppleScriptManager } from './applescript-manager.js';
6
+
7
+ /**
8
+ * Quota Detector for IDE interactions
9
+ * Detects quota warnings in different IDEs using CDP and AppleScript
10
+ */
11
+ export class QuotaDetector {
12
+ constructor() {
13
+ this.logger = console;
14
+ this.appleScriptManager = new AppleScriptManager();
15
+ }
16
+
17
+ /**
18
+ * Timeout utility function
19
+ * @param {number} ms - Timeout in milliseconds
20
+ * @param {Promise} promise - Promise to timeout
21
+ * @returns {Promise} Promise with timeout
22
+ */
23
+ timeout(ms, promise) {
24
+ return Promise.race([
25
+ promise,
26
+ new Promise((_, reject) =>
27
+ setTimeout(() => reject(new Error(`Operation timed out after ${ms}ms`)), ms)
28
+ )
29
+ ]);
30
+ }
31
+
32
+ /**
33
+ * Detect quota warnings in an IDE
34
+ * @param {string} ide - The IDE name ('vscode', 'cursor', 'windsurf')
35
+ * @returns {Promise<Object>} Quota detection result
36
+ */
37
+ async detectQuotaWarning(ide = 'vscode') {
38
+ this.logger.log(`🔍 Starting quota detection for ${ide}...`);
39
+
40
+ // Determine the port based on the IDE
41
+ const port = ide === 'windsurf' ? 9224 : ide === 'cursor' ? 9225 : 9222;
42
+ const ideName = ide === 'windsurf' ? 'Windsurf' : ide === 'cursor' ? 'Cursor' : 'VS Code';
43
+
44
+ this.logger.log(`🔌 Checking ${ideName} on port ${port}...`);
45
+
46
+ // For Windsurf, use AppleScript detection since CDP is not supported
47
+ if (ide === 'windsurf') {
48
+ this.logger.log('🔍 Windsurf detected - using AppleScript quota detection');
49
+ return await this.appleScriptManager.detectQuotaWarning(ide);
50
+ }
51
+
52
+ // For VS Code and Cursor, use CDP detection
53
+ try {
54
+ this.logger.log(`🔍 Attempting CDP connection to ${ideName} on port ${port}...`);
55
+
56
+ // Try to connect to CDP
57
+ const targets = await this.timeout(5000, CDP.List({ port }));
58
+
59
+ if (!targets || targets.length === 0) {
60
+ this.logger.log(`❌ No CDP targets found on port ${port}`);
61
+
62
+ // For Windsurf, fall back to AppleScript
63
+ if (ide === 'windsurf') {
64
+ this.logger.log('🔍 Falling back to enhanced AppleScript quota detection...');
65
+ return await this.appleScriptManager.detectQuotaWarning(ide);
66
+ }
67
+
68
+ return {
69
+ hasQuotaWarning: false,
70
+ error: `Could not find ${ideName}. Make sure ${ideName} is running with --remote-debugging-port=${port}`,
71
+ note: 'CDP connection failed'
72
+ };
73
+ }
74
+
75
+ this.logger.log(`✅ Found ${targets.length} CDP targets`);
76
+
77
+ // For Cursor, prefer the workspace target over settings
78
+ let workbench;
79
+ if (ide === 'cursor') {
80
+ workbench = targets.find(t => t.title !== 'Cursor Settings' && t.type === 'page') ||
81
+ targets.find(t => t.url && t.url.includes('workbench')) ||
82
+ targets[0];
83
+ } else {
84
+ workbench = targets.find(t => t.url && t.url.includes('workbench')) || targets[0];
85
+ }
86
+
87
+ if (!workbench) {
88
+ this.logger.log(`❌ No suitable workbench target found`);
89
+ return {
90
+ hasQuotaWarning: false,
91
+ error: `No ${ideName} workbench target found.`,
92
+ note: 'No workbench target available'
93
+ };
94
+ }
95
+
96
+ this.logger.log(`✅ Selected workbench: ${workbench.title}`);
97
+
98
+ // Connect to CDP
99
+ const client = await this.timeout(10000, CDP({ port, target: workbench }));
100
+ const { Runtime, Page } = client;
101
+
102
+ await this.timeout(5000, Runtime.enable());
103
+ if (Page && Page.bringToFront) {
104
+ try {
105
+ await this.timeout(3000, Page.bringToFront());
106
+ } catch (error) {
107
+ this.logger.log(`⚠️ Bring to front failed: ${error.message}`);
108
+ }
109
+ }
110
+
111
+ // Execute JavaScript to detect quota warnings
112
+ const detectionScript = `
113
+ (() => {
114
+ console.log('🔍 Starting quota detection in ${ideName}...');
115
+
116
+ // Common quota warning patterns
117
+ const quotaPatterns = [
118
+ 'not enough credits',
119
+ 'upgrade to a paid plan',
120
+ 'switch to swe-1-lite',
121
+ 'quota exceeded',
122
+ 'credits exhausted',
123
+ 'payment required',
124
+ 'out of credits',
125
+ 'insufficient credits',
126
+ 'billing required',
127
+ 'subscription needed'
128
+ ];
129
+
130
+ // Function to check if text contains quota warnings
131
+ function containsQuotaWarning(text) {
132
+ if (!text) return false;
133
+ const lowerText = text.toLowerCase();
134
+ return quotaPatterns.some(pattern => lowerText.includes(pattern));
135
+ }
136
+
137
+ // Method 1: Check all text content in the document
138
+ const allText = document.body.innerText || document.body.textContent || '';
139
+ if (containsQuotaWarning(allText)) {
140
+ console.log('❌ Quota warning detected in document text');
141
+ return {
142
+ hasQuotaWarning: true,
143
+ method: 'document-text',
144
+ matchedText: allText.substring(0, 200) + '...'
145
+ };
146
+ }
147
+
148
+ // Method 2: Check specific elements that might contain quota warnings
149
+ const quotaElements = [
150
+ // VS Code specific selectors
151
+ '.monaco-workbench .part.auxiliarybar',
152
+ '.monaco-workbench .part.sidebar.right',
153
+ '.monaco-workbench .chat-view',
154
+ '.monaco-workbench .chat-input',
155
+
156
+ // Cursor specific selectors
157
+ '.aislash-editor-input',
158
+ '.aislash-chat-container',
159
+ '.aislash-panel',
160
+
161
+ // Generic selectors
162
+ '[data-testid*="chat"]',
163
+ '[aria-label*="chat"]',
164
+ '[class*="chat"]',
165
+ '[class*="quota"]',
166
+ '[class*="credits"]',
167
+ '[class*="billing"]'
168
+ ];
169
+
170
+ for (const selector of quotaElements) {
171
+ const elements = document.querySelectorAll(selector);
172
+ for (const element of elements) {
173
+ const elementText = element.innerText || element.textContent || '';
174
+ if (containsQuotaWarning(elementText)) {
175
+ console.log('❌ Quota warning detected in element:', selector);
176
+ return {
177
+ hasQuotaWarning: true,
178
+ method: 'element-specific',
179
+ selector: selector,
180
+ matchedText: elementText.substring(0, 200) + '...'
181
+ };
182
+ }
183
+ }
184
+ }
185
+
186
+ // Method 3: Check for disabled input fields (common when quota is exceeded)
187
+ const disabledInputs = document.querySelectorAll('input[disabled], textarea[disabled], [contenteditable="true"][aria-disabled="true"]');
188
+ if (disabledInputs.length > 0) {
189
+ console.log('⚠️ Found disabled input fields, checking for quota context...');
190
+
191
+ // Check if there are quota-related messages near disabled inputs
192
+ for (const input of disabledInputs) {
193
+ const parentText = input.parentElement?.innerText || '';
194
+ if (containsQuotaWarning(parentText)) {
195
+ console.log('❌ Quota warning detected near disabled input');
196
+ return {
197
+ hasQuotaWarning: true,
198
+ method: 'disabled-input-context',
199
+ matchedText: parentText.substring(0, 200) + '...'
200
+ };
201
+ }
202
+ }
203
+ }
204
+
205
+ // Method 4: Check for specific UI elements that indicate quota issues
206
+ const quotaButtons = document.querySelectorAll('button, a, [role="button"]');
207
+ for (const button of quotaButtons) {
208
+ const buttonText = button.innerText || button.textContent || '';
209
+ if (containsQuotaWarning(buttonText)) {
210
+ console.log('❌ Quota warning detected in button:', buttonText);
211
+ return {
212
+ hasQuotaWarning: true,
213
+ method: 'button-text',
214
+ matchedText: buttonText
215
+ };
216
+ }
217
+ }
218
+
219
+ // Method 5: Check for error messages or notifications
220
+ const errorElements = document.querySelectorAll('[class*="error"], [class*="warning"], [class*="notification"], [role="alert"]');
221
+ for (const error of errorElements) {
222
+ const errorText = error.innerText || error.textContent || '';
223
+ if (containsQuotaWarning(errorText)) {
224
+ console.log('❌ Quota warning detected in error element');
225
+ return {
226
+ hasQuotaWarning: true,
227
+ method: 'error-element',
228
+ matchedText: errorText.substring(0, 200) + '...'
229
+ };
230
+ }
231
+ }
232
+
233
+ console.log('✅ No quota warnings detected');
234
+ return {
235
+ hasQuotaWarning: false,
236
+ method: 'cdp-comprehensive',
237
+ note: 'No quota warnings found in ${ideName}'
238
+ };
239
+ })()
240
+ `;
241
+
242
+ const { result } = await this.timeout(10000, Runtime.evaluate({
243
+ expression: detectionScript,
244
+ returnByValue: true
245
+ }));
246
+
247
+ const detectionResult = result.value || result.unserializableValue;
248
+
249
+ this.logger.log('🔍 CDP quota detection result:', detectionResult);
250
+
251
+ if (detectionResult && detectionResult.hasQuotaWarning) {
252
+ this.logger.log('❌ Quota warning detected via CDP');
253
+ return {
254
+ hasQuotaWarning: true,
255
+ method: detectionResult.method,
256
+ note: detectionResult.matchedText || 'Quota warning detected via CDP',
257
+ debug: detectionResult
258
+ };
259
+ }
260
+
261
+ this.logger.log('✅ No quota warnings detected via CDP');
262
+ return {
263
+ hasQuotaWarning: false,
264
+ method: 'cdp-comprehensive',
265
+ note: 'No quota warnings found in ' + ideName,
266
+ debug: detectionResult
267
+ };
268
+
269
+ } catch (error) {
270
+ this.logger.log(`❌ CDP quota detection failed: ${error.message}`);
271
+
272
+ // For Windsurf, fall back to AppleScript
273
+ if (ide === 'windsurf') {
274
+ this.logger.log('🔍 Falling back to AppleScript quota detection...');
275
+ return await this.appleScriptManager.detectQuotaWarning(ide);
276
+ }
277
+
278
+ return {
279
+ hasQuotaWarning: false,
280
+ error: error.message,
281
+ note: `CDP quota detection failed for ${ideName}`
282
+ };
283
+ }
284
+ }
285
+
286
+ /**
287
+ * Get available IDEs without quota warnings
288
+ * @param {Array<string>} ides - Array of IDE names to check
289
+ * @returns {Promise<Array<string>>} Array of available IDE names
290
+ */
291
+ async getAvailableIdes(ides = ['vscode', 'cursor', 'windsurf']) {
292
+ this.logger.log('🔍 Checking available IDEs without quota warnings...');
293
+
294
+ const availableIdes = [];
295
+
296
+ for (const ide of ides) {
297
+ try {
298
+ const quotaResult = await this.detectQuotaWarning(ide);
299
+
300
+ if (!quotaResult.hasQuotaWarning) {
301
+ availableIdes.push(ide);
302
+ this.logger.log(`✅ ${ide} is available (no quota warnings)`);
303
+ } else {
304
+ this.logger.log(`❌ ${ide} has quota warnings: ${quotaResult.note || 'Unknown quota issue'}`);
305
+ }
306
+ } catch (error) {
307
+ this.logger.log(`⚠️ Error checking ${ide}: ${error.message}`);
308
+ // If we can't check quota, assume the IDE is available
309
+ availableIdes.push(ide);
310
+ }
311
+ }
312
+
313
+ this.logger.log(`📋 Available IDEs: ${availableIdes.join(', ')}`);
314
+ return availableIdes;
315
+ }
316
+
317
+ /**
318
+ * Test quota detection with a test message
319
+ * @param {string} ide - The IDE name to test
320
+ * @returns {Promise<Object>} Test result
321
+ */
322
+ async testQuotaDetection(ide) {
323
+ this.logger.log(`🧪 Testing quota detection for ${ide}...`);
324
+
325
+ try {
326
+ const quotaResult = await this.detectQuotaWarning(ide);
327
+
328
+ this.logger.log(`🧪 Quota detection test result for ${ide}:`, quotaResult);
329
+
330
+ return {
331
+ ide,
332
+ success: true,
333
+ hasQuotaWarning: quotaResult.hasQuotaWarning,
334
+ method: quotaResult.method,
335
+ note: quotaResult.note,
336
+ debug: quotaResult
337
+ };
338
+ } catch (error) {
339
+ this.logger.log(`❌ Quota detection test failed for ${ide}: ${error.message}`);
340
+
341
+ return {
342
+ ide,
343
+ success: false,
344
+ error: error.message,
345
+ note: `Quota detection test failed for ${ide}`
346
+ };
347
+ }
348
+ }
349
+ }
@@ -0,0 +1,262 @@
1
+ // @vibecodingmachine/core - Windows Automation Manager
2
+ // Handles Windows-specific automation for IDE interactions
3
+
4
+ const { execSync, spawn } = require('child_process');
5
+ const AppleScriptUtils = require('./applescript-utils');
6
+ const { writeFileSync, unlinkSync } = require('fs');
7
+ const { join } = require('path');
8
+ const { tmpdir } = require('os');
9
+
10
+ /**
11
+ * Windows Automation Manager for IDE interactions
12
+ * Handles Windows-specific automation for IDEs like Cursor using PowerShell and Windows API
13
+ */
14
+ class WindowsAutomationManager {
15
+ constructor() {
16
+ this.logger = console;
17
+ this.appleScriptUtils = new AppleScriptUtils();
18
+ }
19
+
20
+ /**
21
+ * Send text to Cursor on Windows using PowerShell automation
22
+ * @param {string} text - The text to send
23
+ * @returns {Promise<Object>} Result object with success status and details
24
+ */
25
+ async sendTextToCursor(text) {
26
+ try {
27
+ this.logger.log('🔧 Windows: Sending text to Cursor using PowerShell automation...');
28
+
29
+ // Use shared PowerShell script for Cursor automation
30
+ const powershellScript = this.appleScriptUtils.generateWindowsAIPanelScript(text);
31
+
32
+ // Write PowerShell script to temporary file
33
+ const scriptPath = join(tmpdir(), 'cursor-automation.ps1');
34
+ writeFileSync(scriptPath, powershellScript, 'utf8');
35
+
36
+ try {
37
+ // Execute PowerShell script
38
+ const result = execSync(`powershell.exe -ExecutionPolicy Bypass -File "${scriptPath}"`, {
39
+ encoding: 'utf8',
40
+ timeout: 10000,
41
+ stdio: 'pipe'
42
+ });
43
+
44
+ // Clean up script file
45
+ unlinkSync(scriptPath);
46
+
47
+ if (result.includes('SUCCESS')) {
48
+ this.logger.log('✅ Windows: Successfully sent text to Cursor');
49
+ return {
50
+ success: true,
51
+ message: 'Message sent to Cursor via Windows automation',
52
+ method: 'windows-automation'
53
+ };
54
+ } else {
55
+ throw new Error(result);
56
+ }
57
+ } catch (error) {
58
+ // Clean up script file on error
59
+ try { unlinkSync(scriptPath); } catch (_) {}
60
+ throw error;
61
+ }
62
+ } catch (error) {
63
+ this.logger.error('❌ Windows: Error sending text to Cursor:', error.message);
64
+ return {
65
+ success: false,
66
+ error: `Windows automation error: ${error.message}`,
67
+ method: 'windows-automation'
68
+ };
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Alternative method using Windows API via Node.js native module
74
+ * This is a more robust approach but requires additional dependencies
75
+ */
76
+ async sendTextToCursorNative(text) {
77
+ try {
78
+ this.logger.log('🔧 Windows: Attempting native Windows API approach...');
79
+
80
+ // This would require a native module like 'robotjs' or 'nut-js'
81
+ // For now, we'll use a simpler approach with PowerShell
82
+
83
+ const powershellScript = `
84
+ # Alternative Windows Cursor Automation using Windows API
85
+ Add-Type -TypeDefinition @"
86
+ using System;
87
+ using System.Runtime.InteropServices;
88
+ using System.Text;
89
+
90
+ public class Win32 {
91
+ [DllImport("user32.dll")]
92
+ public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
93
+
94
+ [DllImport("user32.dll")]
95
+ public static extern bool SetForegroundWindow(IntPtr hWnd);
96
+
97
+ [DllImport("user32.dll")]
98
+ public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
99
+
100
+ [DllImport("user32.dll")]
101
+ public static extern bool IsWindowVisible(IntPtr hWnd);
102
+
103
+ public const int SW_RESTORE = 9;
104
+ }
105
+ "@
106
+
107
+ Add-Type -AssemblyName System.Windows.Forms
108
+
109
+ try {
110
+ # Find Cursor window by process name
111
+ $cursorProcesses = Get-Process | Where-Object {
112
+ $_.ProcessName -like "*cursor*" -and $_.MainWindowHandle -ne [IntPtr]::Zero
113
+ }
114
+
115
+ if ($cursorProcesses.Count -eq 0) {
116
+ Write-Output "ERROR: No Cursor windows found"
117
+ exit 1
118
+ }
119
+
120
+ $cursorWindow = $cursorProcesses[0].MainWindowHandle
121
+ Write-Output "Found Cursor window handle: $cursorWindow"
122
+
123
+ # Bring window to foreground
124
+ [Win32]::ShowWindow($cursorWindow, [Win32]::SW_RESTORE)
125
+ [Win32]::SetForegroundWindow($cursorWindow)
126
+ Start-Sleep -Milliseconds 500
127
+
128
+ # AI Panel Focus Strategy - same as basic PowerShell approach
129
+ # Step 1: Open Command Palette (Ctrl+Shift+P on Windows)
130
+ [System.Windows.Forms.SendKeys]::SendWait("^+p")
131
+ Start-Sleep -Milliseconds 500
132
+
133
+ # Step 2: Type "View: Focus into Secondary Side Bar"
134
+ [System.Windows.Forms.SendKeys]::SendWait("View: Focus into Secondary Side Bar")
135
+ Start-Sleep -Milliseconds 500
136
+
137
+ # Step 3: Press Enter to focus AI Panel
138
+ [System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
139
+ Start-Sleep -Milliseconds 1500
140
+
141
+ # Step 4: Clear any existing text in the chat input (Ctrl+A, Delete)
142
+ [System.Windows.Forms.SendKeys]::SendWait("^a")
143
+ Start-Sleep -Milliseconds 200
144
+ [System.Windows.Forms.SendKeys]::SendWait("{DELETE}")
145
+ Start-Sleep -Milliseconds 200
146
+
147
+ # Step 5: Type the message
148
+ [System.Windows.Forms.SendKeys]::SendWait("${text.replace(/"/g, '""')}")
149
+ Start-Sleep -Milliseconds 500
150
+
151
+ # Step 6: Send with Ctrl+Enter (standard for chat interfaces)
152
+ [System.Windows.Forms.SendKeys]::SendWait("^{ENTER}")
153
+ Start-Sleep -Milliseconds 1000
154
+
155
+ Write-Output "SUCCESS: Message sent via Windows API"
156
+ exit 0
157
+
158
+ } catch {
159
+ Write-Output "ERROR: $($_.Exception.Message)"
160
+ exit 1
161
+ }
162
+ `;
163
+
164
+ const scriptPath = join(tmpdir(), 'cursor-native-automation.ps1');
165
+ writeFileSync(scriptPath, powershellScript, 'utf8');
166
+
167
+ try {
168
+ const result = execSync(`powershell.exe -ExecutionPolicy Bypass -File "${scriptPath}"`, {
169
+ encoding: 'utf8',
170
+ timeout: 10000,
171
+ stdio: 'pipe'
172
+ });
173
+
174
+ unlinkSync(scriptPath);
175
+
176
+ if (result.includes('SUCCESS')) {
177
+ return {
178
+ success: true,
179
+ message: 'Message sent to Cursor via Windows API',
180
+ method: 'windows-native'
181
+ };
182
+ } else {
183
+ throw new Error(result);
184
+ }
185
+ } catch (error) {
186
+ try { unlinkSync(scriptPath); } catch (_) {}
187
+ throw error;
188
+ }
189
+ } catch (error) {
190
+ this.logger.error('❌ Windows: Native API error:', error.message);
191
+ return {
192
+ success: false,
193
+ error: `Windows native API error: ${error.message}`,
194
+ method: 'windows-native'
195
+ };
196
+ }
197
+ }
198
+
199
+ /**
200
+ * Open Cursor IDE on Windows
201
+ * @param {string} repoPath - Optional repository path to open
202
+ * @returns {Promise<Object>} Result object with success status and details
203
+ */
204
+ async openCursor(repoPath = null) {
205
+ try {
206
+ this.logger.log('🔧 Windows: Opening Cursor...');
207
+
208
+ let command = 'cursor';
209
+ if (repoPath) {
210
+ command += ` "${repoPath}"`;
211
+ }
212
+
213
+ // Try to open Cursor
214
+ execSync(command, { stdio: 'pipe' });
215
+
216
+ // Wait for Cursor to start
217
+ await new Promise(resolve => setTimeout(resolve, 3000));
218
+
219
+ this.logger.log('✅ Windows: Cursor opened successfully');
220
+ return {
221
+ success: true,
222
+ message: repoPath ? `Cursor opened with repository: ${repoPath}` : 'Cursor opened successfully',
223
+ method: 'windows-command'
224
+ };
225
+ } catch (error) {
226
+ this.logger.error('❌ Windows: Error opening Cursor:', error.message);
227
+ return {
228
+ success: false,
229
+ error: error.message,
230
+ method: 'windows-command'
231
+ };
232
+ }
233
+ }
234
+
235
+ /**
236
+ * Check if Cursor is running on Windows
237
+ * @returns {Promise<Object>} Result object with status
238
+ */
239
+ async isCursorRunning() {
240
+ try {
241
+ const result = execSync('tasklist /FI "IMAGENAME eq cursor.exe" /FO CSV', {
242
+ encoding: 'utf8',
243
+ stdio: 'pipe'
244
+ });
245
+
246
+ const isRunning = result.includes('cursor.exe');
247
+ return {
248
+ success: true,
249
+ running: isRunning,
250
+ message: isRunning ? 'Cursor is running' : 'Cursor is not running'
251
+ };
252
+ } catch (error) {
253
+ return {
254
+ success: false,
255
+ running: false,
256
+ error: error.message
257
+ };
258
+ }
259
+ }
260
+ }
261
+
262
+ module.exports = WindowsAutomationManager;
package/src/index.cjs ADDED
@@ -0,0 +1,43 @@
1
+ // @vibecodingmachine/core - Main entry point (CommonJS)
2
+ // This file exports all the core functionality for CommonJS environments
3
+
4
+ const { CDPManager } = require('./ide-integration/cdp-manager.cjs');
5
+ const { AppleScriptManager } = require('./ide-integration/applescript-manager.cjs');
6
+ const { QuotaDetector } = require('./ide-integration/quota-detector.cjs');
7
+ const { ClineCLIManager } = require('./ide-integration/cline-cli-manager.cjs');
8
+ const { AiderCLIManager } = require('./ide-integration/aider-cli-manager.cjs');
9
+ const ClaudeCodeCLIManager = require('./ide-integration/claude-code-cli-manager.cjs');
10
+ const { runContinueCLICommand, runContinueCLIAutoMode } = require('./ide-integration/continue-cli-manager.js');
11
+ const DirectLLMManager = require('./llm/direct-llm-manager.cjs');
12
+ const { ChatManager } = require('./chat-management/chat-manager.cjs');
13
+ const { FeatureImplementer } = require('./autonomous-mode/feature-implementer.cjs');
14
+ const { logger } = require('./utils/logger.cjs');
15
+ const repoHelpers = require('./utils/repo-helpers.cjs');
16
+ const configHelpers = require('./utils/config-helpers.cjs');
17
+ const auditLogger = require('./utils/audit-logger.cjs');
18
+ const { GCloudAuth } = require('./utils/gcloud-auth.cjs');
19
+ const requirementHelpers = require('./utils/requirement-helpers.js');
20
+ const updateChecker = require('./utils/update-checker.js');
21
+ const electronUpdateChecker = require('./utils/electron-update-checker.js');
22
+
23
+ module.exports = {
24
+ CDPManager,
25
+ AppleScriptManager,
26
+ QuotaDetector,
27
+ ClineCLIManager,
28
+ AiderCLIManager,
29
+ ClaudeCodeCLIManager,
30
+ runContinueCLICommand,
31
+ runContinueCLIAutoMode,
32
+ DirectLLMManager,
33
+ ChatManager,
34
+ FeatureImplementer,
35
+ logger,
36
+ GCloudAuth,
37
+ ...repoHelpers,
38
+ ...configHelpers,
39
+ ...auditLogger,
40
+ ...requirementHelpers,
41
+ ...updateChecker,
42
+ ...electronUpdateChecker
43
+ };
package/src/index.js ADDED
@@ -0,0 +1,17 @@
1
+ // @vibecodingmachine/core - Main entry point
2
+ // This file exports all the core functionality
3
+
4
+ export { CDPManager } from './ide-integration/cdp-manager.js';
5
+ export { AppleScriptManager } from './ide-integration/applescript-manager.js';
6
+ export { QuotaDetector } from './ide-integration/quota-detector.js';
7
+ export * from './ide-integration/continue-cli-manager.js';
8
+ export { ChatManager } from './chat-management/chat-manager.js';
9
+ export { FeatureImplementer } from './autonomous-mode/feature-implementer.js';
10
+ export { logger } from './utils/logger.js';
11
+ export * from './utils/repo-helpers.js';
12
+ export * from './utils/config-helpers.js';
13
+
14
+ // UI Components
15
+ export * from './ui/ButtonComponents.js';
16
+ export * from './ui/StateManager.js';
17
+ export { ChatInterface } from './ui/ChatInterface.js';