vibecodingmachine-core 1.0.0 → 1.0.1
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 +47 -45
- 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 +43 -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 +85 -78
- 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 +167 -167
|
@@ -1,262 +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;
|
|
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
CHANGED
|
@@ -1,43 +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
|
-
};
|
|
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
CHANGED
|
@@ -1,17 +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';
|
|
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';
|