vibecodingmachine-core 2026.2.26-1739 → 2026.3.9-850

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 (192) hide show
  1. package/package.json +1 -1
  2. package/src/agents/AgentCheckDiscoveryService.js +180 -0
  3. package/src/agents/AgentCheckService.js +18 -261
  4. package/src/agents/AgentCheckStatisticsService.js +195 -0
  5. package/src/agents/EnvironmentConfigurationManager.js +31 -380
  6. package/src/agents/InstallationType.js +19 -6
  7. package/src/agents/SimpleAgentCheckService.js +472 -0
  8. package/src/agents/config-managers/ConfigUtils.js +72 -0
  9. package/src/agents/config-managers/DefaultConfig.js +58 -0
  10. package/src/agents/config-managers/EnvVarLoader.js +66 -0
  11. package/src/agents/config-managers/FileConfigLoader.js +124 -0
  12. package/src/agents/config-managers/TypeConverters.js +61 -0
  13. package/src/agents/config-managers/VariableMappings.js +92 -0
  14. package/src/agents/discovery/AgentDiscoveryService-refactored.js +272 -0
  15. package/src/agents/discovery/AgentDiscoveryService.js +29 -403
  16. package/src/agents/discovery/agent-validator.js +262 -0
  17. package/src/agents/discovery/discovery-results.js +176 -0
  18. package/src/agents/discovery/discovery-scanner.js +268 -0
  19. package/src/agents/discovery/discovery-utils.js +161 -0
  20. package/src/agents/discovery/executable-analyzer.js +290 -0
  21. package/src/agents/discovery/history-manager.js +310 -0
  22. package/src/agents/verification/ResultAnalyzer-refactored.js +341 -0
  23. package/src/agents/verification/ResultAnalyzer.js +30 -431
  24. package/src/agents/verification/analysis-utils.js +310 -0
  25. package/src/agents/verification/batch-analyzer.js +440 -0
  26. package/src/agents/verification/pattern-recognizer.js +369 -0
  27. package/src/agents/verification/report-generator.js +320 -0
  28. package/src/agents/verification/test-analyzer.js +290 -0
  29. package/src/agents/windows/InstallerFactory.js +4 -0
  30. package/src/agents/windows/VSCodeExtensionInstaller.js +404 -0
  31. package/src/analysis/analysis-engine.js +314 -0
  32. package/src/analysis/ast-analyzer.js +342 -0
  33. package/src/analysis/boundary-detector-refactored.js +378 -0
  34. package/src/analysis/boundary-detector.js +200 -603
  35. package/src/analysis/boundary-scanner.js +609 -0
  36. package/src/analysis/boundary-types.js +118 -0
  37. package/src/analysis/boundary-utils.js +293 -0
  38. package/src/analysis/deadline-priority-calculator.js +18 -0
  39. package/src/analysis/detection-methods.js +347 -0
  40. package/src/analysis/importance-priority-calculator.js +18 -0
  41. package/src/analysis/priority/factor-calculators.js +204 -0
  42. package/src/analysis/priority/factor-helpers.js +71 -0
  43. package/src/analysis/priority/priority-constants.js +73 -0
  44. package/src/analysis/priority/priority-factor-calculators.js +301 -0
  45. package/src/analysis/priority/reasons-generator.js +44 -0
  46. package/src/analysis/priority-calculator.js +15 -580
  47. package/src/analysis/strategy-generator.js +16 -66
  48. package/src/analysis/type-priority-calculator.js +18 -0
  49. package/src/analysis/urgency-priority-calculator.js +18 -0
  50. package/src/auto-mode/AutoModeBusinessLogic.js +2 -40
  51. package/src/commands/disable-requirement.js +60 -0
  52. package/src/commands/disable-spec.js +60 -0
  53. package/src/commands/enable-requirement.js +60 -0
  54. package/src/commands/enable-spec.js +60 -0
  55. package/src/commands/registry.js +1 -6
  56. package/src/commands/requirements.js +8 -2
  57. package/src/ide-integration/applescript-manager.cjs +9 -24
  58. package/src/ide-integration/cdp-handlers/chat-reader.js +44 -0
  59. package/src/ide-integration/cdp-handlers/connection-handler.js +88 -0
  60. package/src/ide-integration/cdp-handlers/continuation-handler.js +314 -0
  61. package/src/ide-integration/cdp-handlers/message-submitter.js +75 -0
  62. package/src/ide-integration/cdp-handlers/text-sender.js +138 -0
  63. package/src/ide-integration/cdp-manager.js +28 -573
  64. package/src/ide-integration/claude-code-cli-manager.cjs +48 -12
  65. package/src/ide-integration/ide-openers/claude-opener.js +171 -0
  66. package/src/ide-integration/ide-openers/cursor-opener.js +53 -0
  67. package/src/ide-integration/ide-openers/other-ides-opener.js +230 -0
  68. package/src/ide-integration/ide-openers/vscode-opener.js +147 -0
  69. package/src/ide-integration/macos-ide-manager.js +20 -582
  70. package/src/ide-integration/macos-quota-checker.js +164 -0
  71. package/src/ide-integration/macos-text-sender.js +19 -38
  72. package/src/ide-integration/provider-manager.cjs +52 -7
  73. package/src/index.cjs +6 -0
  74. package/src/index.js +10 -0
  75. package/src/llm/direct-llm-manager.cjs +501 -0
  76. package/src/localization/translations/en-part1.js +363 -0
  77. package/src/localization/translations/en-part2.js +320 -0
  78. package/src/localization/translations/en.js +4 -687
  79. package/src/localization/translations/es-part1.js +363 -0
  80. package/src/localization/translations/es-part2.js +320 -0
  81. package/src/localization/translations/es.js +4 -688
  82. package/src/models/file-analysis-collection.js +139 -0
  83. package/src/models/file-analysis-metrics.js +50 -0
  84. package/src/models/file-analysis.js +15 -262
  85. package/src/models/plan-manager.js +410 -0
  86. package/src/models/refactoring-models.js +380 -0
  87. package/src/models/refactoring-plan-refactored.js +81 -0
  88. package/src/models/refactoring-plan.js +2 -663
  89. package/src/monitoring/alert-system.js +4 -45
  90. package/src/monitoring/continuous-scan-notifications.js +37 -191
  91. package/src/monitoring/notification-handlers/base-handler.js +58 -0
  92. package/src/monitoring/notification-handlers/error-handler.js +36 -0
  93. package/src/monitoring/notification-handlers/index.js +21 -0
  94. package/src/monitoring/notification-handlers/new-violation-handler.js +91 -0
  95. package/src/monitoring/notification-handlers/progress-handler.js +48 -0
  96. package/src/monitoring/notification-handlers/resolved-violation-handler.js +54 -0
  97. package/src/monitoring/notification-handlers/threshold-handler.js +36 -0
  98. package/src/provider-registry.js +8 -0
  99. package/src/refactoring/boundary/boundary-detector-refactored.js +58 -0
  100. package/src/refactoring/boundary/boundary-detector.js +26 -596
  101. package/src/refactoring/boundary/detectors/boundary-analyzers.js +281 -0
  102. package/src/refactoring/boundary/detectors/boundary-core.js +167 -0
  103. package/src/refactoring/boundary/detectors/class-detector.js +247 -0
  104. package/src/refactoring/boundary/detectors/config-detector.js +270 -0
  105. package/src/refactoring/boundary/detectors/constant-detector.js +269 -0
  106. package/src/refactoring/boundary/detectors/function-detector.js +248 -0
  107. package/src/refactoring/boundary/detectors/module-detector.js +249 -0
  108. package/src/refactoring/boundary/detectors/object-detector.js +247 -0
  109. package/src/refactoring/boundary/detectors/type-detectors.js +338 -0
  110. package/src/refactoring/boundary/detectors/utility-detector.js +270 -0
  111. package/src/refactoring/circular-dependency-resolver-original.js +16 -76
  112. package/src/refactoring/code-mover-refactored.js +309 -0
  113. package/src/refactoring/code-mover.js +48 -355
  114. package/src/refactoring/execution-status.js +18 -0
  115. package/src/refactoring/execution-strategies.js +172 -0
  116. package/src/refactoring/file-splitter-core.js +568 -0
  117. package/src/refactoring/file-splitter-types.js +136 -0
  118. package/src/refactoring/file-splitter.js +2 -682
  119. package/src/refactoring/functionality-validator.js +11 -51
  120. package/src/refactoring/import-manager-refactored.js +385 -0
  121. package/src/refactoring/import-manager.js +112 -487
  122. package/src/refactoring/import-models.js +189 -0
  123. package/src/refactoring/import-parser.js +306 -0
  124. package/src/refactoring/move-executor.js +431 -0
  125. package/src/refactoring/move-utils.js +368 -0
  126. package/src/refactoring/operation-executor.js +76 -0
  127. package/src/refactoring/plan-creator.js +36 -0
  128. package/src/refactoring/plan-executor.js +143 -0
  129. package/src/refactoring/plan-validator.js +68 -0
  130. package/src/refactoring/refactoring-executor-result.js +70 -0
  131. package/src/refactoring/refactoring-executor.js +34 -569
  132. package/src/refactoring/refactoring-operation.js +94 -0
  133. package/src/refactoring/refactoring-plan.js +69 -0
  134. package/src/refactoring/refactoring-rollback.js +22 -527
  135. package/src/refactoring/rollback-handlers/RollbackExecutor.js +107 -0
  136. package/src/refactoring/rollback-handlers/RollbackManager.js +265 -0
  137. package/src/refactoring/rollback-handlers/RollbackOperation.js +105 -0
  138. package/src/refactoring/rollback-handlers/RollbackResult.js +109 -0
  139. package/src/refactoring/rollback-handlers/RollbackStatistics.js +77 -0
  140. package/src/refactoring/test-validator.js +32 -448
  141. package/src/refactoring/validation/baseline-runner.js +71 -0
  142. package/src/refactoring/validation/report-generator.js +136 -0
  143. package/src/refactoring/validation/result-comparator.js +92 -0
  144. package/src/refactoring/validation/test-suite.js +59 -0
  145. package/src/refactoring/validation/test-validation-result.js +83 -0
  146. package/src/refactoring/validation/validation-runner.js +95 -0
  147. package/src/refactoring/validation/validation-status.js +18 -0
  148. package/src/rui/commands/AgentCommandParser.js +60 -369
  149. package/src/rui/commands/AgentResponseFormatter.js +7 -47
  150. package/src/rui/commands/parsers/CommandMapper.js +148 -0
  151. package/src/rui/commands/parsers/CommandValidator.js +228 -0
  152. package/src/rui/commands/parsers/ComponentExtractor.js +100 -0
  153. package/src/rui/commands/parsers/TokenParser.js +69 -0
  154. package/src/rui/commands/parsers/tokenizer.js +153 -0
  155. package/src/utils/current-requirement-operations.js +50 -1
  156. package/src/utils/report-generator.js +18 -514
  157. package/src/utils/report-generators/analysis-generator.js +115 -0
  158. package/src/utils/report-generators/base-generator.js +141 -0
  159. package/src/utils/report-generators/compliance-generator.js +41 -0
  160. package/src/utils/report-generators/format-handlers.js +185 -0
  161. package/src/utils/report-generators/refactoring-generator.js +46 -0
  162. package/src/utils/report-generators/validation-generator.js +63 -0
  163. package/src/utils/requirement-enable-disable.js +265 -0
  164. package/src/utils/requirement-helpers/requirement-file-ops.js +69 -1
  165. package/src/utils/requirement-helpers/requirement-mover.js +88 -1
  166. package/src/utils/requirement-helpers.js +5 -2
  167. package/src/utils/smoke-test-cli.js +45 -8
  168. package/src/utils/specification-enable-disable.js +122 -0
  169. package/src/utils/specification-helpers.js +30 -4
  170. package/src/utils/specification-migration.js +5 -5
  171. package/src/utils/test-comparator.js +118 -0
  172. package/src/utils/test-config.js +54 -0
  173. package/src/utils/test-executor.js +133 -0
  174. package/src/utils/test-parser.js +215 -0
  175. package/src/utils/test-runner-baseline.js +63 -0
  176. package/src/utils/test-runner-core.js +98 -0
  177. package/src/utils/test-runner-report.js +39 -0
  178. package/src/utils/test-runner-validation.js +71 -0
  179. package/src/utils/test-runner.js +11 -535
  180. package/src/validation/comparison-analyzer.js +333 -0
  181. package/src/validation/compliance-reporter-new.js +282 -0
  182. package/src/validation/compliance-reporter-refactored.js +344 -0
  183. package/src/validation/compliance-reporter.js +278 -591
  184. package/src/validation/compliance-utils.js +278 -0
  185. package/src/validation/html-generator.js +446 -0
  186. package/src/validation/metrics/category-calculator.js +137 -0
  187. package/src/validation/metrics/metrics-helpers.js +155 -0
  188. package/src/validation/metrics/overview-calculator.js +85 -0
  189. package/src/validation/metrics/overview-metrics.js +41 -0
  190. package/src/validation/metrics/quality-calculator.js +166 -0
  191. package/src/validation/metrics/size-calculator.js +69 -0
  192. package/src/validation/metrics-calculator.js +27 -551
@@ -20,7 +20,9 @@ const RATE_LIMIT_PATTERNS = [
20
20
  /try again in \d+[mh]\d*[ms]?/i,
21
21
  /please try again in/i,
22
22
  /session limit reached/i,
23
- /account limit reached/i
23
+ /account limit reached/i,
24
+ /spending cap reached/i,
25
+ /resets\s+[a-z]+\s+\d+\s+at\s+\d+[ap]m/i
24
26
  ];
25
27
 
26
28
  // Helper function for timestamps
@@ -183,27 +185,61 @@ class ClaudeCodeCLIManager {
183
185
 
184
186
  // Try to extract reset time if available
185
187
  let resetTime;
186
- // Match patterns like "resets 6am (America/Buenos_Aires)" or "resets at 6am (America/Buenos_Aires)"
187
- const resetMatch = error.match(/resets? (?:at )?(\d+)(?::(\d+))?\s*([ap]m)?\s*(\([^)]+\))?/i);
188
+ // Match patterns like "resets Mar 9 at 6pm" or "resets at 6pm"
189
+ const resetMatch = error.match(/resets?\s+(?:([a-z]+\s+\d+)\s+at\s+)?(\d+)(?::(\d+))?\s*([ap]m)?\s*(\([^)]*\))?/i);
188
190
  if (resetMatch) {
189
191
  try {
190
192
  const now = new Date();
191
- let hours = parseInt(resetMatch[1]);
192
- const minutes = resetMatch[2] ? parseInt(resetMatch[2]) : 0;
193
- const period = resetMatch[3] ? resetMatch[3].toLowerCase() : null;
193
+ const monthDay = resetMatch[1]; // "Mar 9" or undefined
194
+ let hours = parseInt(resetMatch[2]);
195
+ const minutes = resetMatch[3] ? parseInt(resetMatch[3]) : 0;
196
+ const period = resetMatch[4] ? resetMatch[4].toLowerCase() : null;
194
197
 
195
198
  // Convert to 24-hour format if period is specified
196
199
  if (period === 'pm' && hours < 12) hours += 12;
197
200
  if (period === 'am' && hours === 12) hours = 0;
198
201
 
199
- // Create reset time
200
- resetTime = new Date(now);
201
- resetTime.setHours(hours, minutes, 0, 0);
202
+ // Create reset date
203
+ const resetDate = new Date(now);
204
+ resetDate.setHours(hours, minutes, 0, 0);
202
205
 
203
- // If reset time is in the past, assume it's for tomorrow
204
- if (resetTime <= now) {
205
- resetTime.setDate(resetTime.getDate() + 1);
206
+ // If month/day is specified, set it
207
+ if (monthDay) {
208
+ const monthDayMatch = monthDay.match(/([a-z]+)\s+(\d+)/i);
209
+ if (monthDayMatch) {
210
+ const monthStr = monthDayMatch[1];
211
+ const day = parseInt(monthDayMatch[2]);
212
+ const months = {
213
+ jan: 0, january: 0,
214
+ feb: 1, february: 1,
215
+ mar: 2, march: 2,
216
+ apr: 3, april: 3,
217
+ may: 4,
218
+ jun: 5, june: 5,
219
+ jul: 6, july: 6,
220
+ aug: 7, august: 7,
221
+ sep: 8, sept: 8, september: 8,
222
+ oct: 9, october: 9,
223
+ nov: 10, november: 10,
224
+ dec: 11, december: 11
225
+ };
226
+ const monthIndex = months[monthStr.toLowerCase().substring(0, 3)];
227
+ if (monthIndex !== undefined) {
228
+ resetDate.setMonth(monthIndex, day);
229
+ // If the date is in the past, assume it's next month
230
+ if (resetDate < now) {
231
+ resetDate.setMonth(resetDate.getMonth() + 1);
232
+ }
233
+ }
234
+ }
235
+ } else {
236
+ // If no month/day specified and time is in the past, assume tomorrow
237
+ if (resetDate <= now) {
238
+ resetDate.setDate(resetDate.getDate() + 1);
239
+ }
206
240
  }
241
+
242
+ resetTime = resetDate;
207
243
  } catch (e) {
208
244
  console.error('Error parsing reset time:', e);
209
245
  resetTime = null;
@@ -0,0 +1,171 @@
1
+ // @vibecodingmachine/core - Claude Code Opener
2
+ // Handles Claude Code specific operations
3
+
4
+ const { execSync } = require('child_process');
5
+ const { writeFileSync, unlinkSync } = require('fs');
6
+ const { join } = require('path');
7
+ const { tmpdir } = require('os');
8
+
9
+ /**
10
+ * Claude Code Opener
11
+ * Manages opening Claude Code in terminal
12
+ */
13
+ class ClaudeOpener {
14
+ constructor(logger) {
15
+ this.logger = logger;
16
+ }
17
+
18
+ /**
19
+ * Open Claude in a new terminal or bring existing instance to foreground
20
+ * @param {string} repoPath - Optional repository path to open
21
+ * @returns {Promise<Object>} Result object with success status and details
22
+ */
23
+ async open(repoPath = null) {
24
+ try {
25
+ this.logger.log('Opening Claude in terminal or bringing to foreground...');
26
+
27
+ // First, check if any Claude process is running
28
+ try {
29
+ const claudeProcessCheck = execSync('ps aux | grep -i "claude" | grep -v grep | grep -v "Claude.app" | wc -l', { encoding: 'utf8' }).trim();
30
+ const claudeCount = parseInt(claudeProcessCheck);
31
+ this.logger.log(`🔍 [Claude] Found ${claudeCount} Claude processes running`);
32
+
33
+ if (claudeCount === 0) {
34
+ this.logger.log('No Claude process found, will create new terminal');
35
+ throw new Error('No Claude process running');
36
+ }
37
+ } catch (processCheckError) {
38
+ this.logger.log('No Claude process detected, will create new terminal');
39
+ return await this._openNewTerminal(repoPath);
40
+ }
41
+
42
+ // If we get here, Claude process exists - find the specific Claude terminal window
43
+ return await this._findAndFocusTerminal(repoPath);
44
+ } catch (error) {
45
+ this.logger.log('Error opening Claude:', error.message);
46
+ return {
47
+ success: false,
48
+ error: error.message,
49
+ method: 'applescript'
50
+ };
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Find and focus existing Claude terminal window
56
+ * @param {string} repoPath - Repository path for context
57
+ * @returns {Promise<Object>} Result object
58
+ */
59
+ async _findAndFocusTerminal(repoPath) {
60
+ try {
61
+ this.logger.log('🔍 [Claude] Claude process detected, searching for Claude terminal window...');
62
+ const escapedRepoPath = repoPath ? repoPath.replace(/'/g, "'\\''") : '';
63
+ const repoPathCheck = repoPath ? `and historyText contains "${escapedRepoPath}"` : '';
64
+
65
+ const findClaudeWindowScript = `
66
+ tell application "Terminal"
67
+ activate
68
+ delay 0.5
69
+
70
+ set claudeWindow to null
71
+ set windowCount to count of windows
72
+
73
+ -- Search through all terminal windows to find the one running Claude IN THE CORRECT DIRECTORY
74
+ repeat with i from 1 to windowCount
75
+ try
76
+ set currentWindow to window i
77
+ set currentTab to selected tab of currentWindow
78
+ set historyText to history of currentTab as text
79
+
80
+ -- Check for Claude AND optionally the correct repo path to avoid wrong terminal
81
+ if (historyText contains "Claude Code" or historyText contains "claude --dangerously-skip-permissions") ${repoPathCheck} then
82
+ set claudeWindow to currentWindow
83
+ exit repeat
84
+ end if
85
+ on error
86
+ -- Continue to next window
87
+ end try
88
+ end repeat
89
+
90
+ if claudeWindow is not null then
91
+ -- Found Claude window - bring it to front
92
+ set index of claudeWindow to 1
93
+ delay 0.5
94
+ return "claude-window-found"
95
+ else
96
+ return "claude-window-not-found"
97
+ end if
98
+ end tell
99
+ `;
100
+
101
+ const tempFile = join(tmpdir(), `claude_find_${Date.now()}.scpt`);
102
+ try {
103
+ writeFileSync(tempFile, findClaudeWindowScript, 'utf8');
104
+ const result = execSync(`osascript "${tempFile}"`, { stdio: 'pipe', encoding: 'utf8' }).trim();
105
+
106
+ if (result === 'claude-window-found') {
107
+ this.logger.log('✅ [Claude] Found and focused Claude terminal window');
108
+ return {
109
+ success: true,
110
+ message: 'Claude terminal window found and focused',
111
+ method: 'applescript',
112
+ action: 'focus'
113
+ };
114
+ } else {
115
+ this.logger.log('⚠️ [Claude] Claude window not found despite process running, will create new one');
116
+ }
117
+ } finally {
118
+ try {
119
+ unlinkSync(tempFile);
120
+ } catch (cleanupError) {
121
+ this.logger.log(`⚠️ Failed to cleanup temp file: ${cleanupError.message}`);
122
+ }
123
+ }
124
+
125
+ // No existing Claude found, open a new terminal
126
+ return await this._openNewTerminal(repoPath);
127
+ } catch (focusError) {
128
+ this.logger.log('⚠️ [Claude] Error finding Claude window, will create new one:', focusError.message);
129
+ return await this._openNewTerminal(repoPath);
130
+ }
131
+ }
132
+
133
+ /**
134
+ * Open new Claude terminal
135
+ * @param {string} repoPath - Repository path for context
136
+ * @returns {Promise<Object>} Result object
137
+ */
138
+ async _openNewTerminal(repoPath) {
139
+ const escapedPath = repoPath ? repoPath.replace(/'/g, "'\\''") : '';
140
+ const cdCommand = repoPath ? `cd '${escapedPath}' && ` : '';
141
+ const openClaudeScript = `
142
+ tell application "Terminal"
143
+ activate
144
+ set newWindow to do script "echo 'Starting Claude Code...' && ${cdCommand}claude --dangerously-skip-permissions"
145
+ delay 3
146
+ end tell
147
+ `;
148
+
149
+ const tempFile = join(tmpdir(), `claude_open_${Date.now()}.scpt`);
150
+ try {
151
+ writeFileSync(tempFile, openClaudeScript, 'utf8');
152
+ execSync(`osascript "${tempFile}"`, { stdio: 'pipe' });
153
+
154
+ this.logger.log('Claude opened in new terminal successfully');
155
+ return {
156
+ success: true,
157
+ message: repoPath ? `Claude opened in terminal with context: ${repoPath}` : 'Claude opened in new terminal',
158
+ method: 'applescript',
159
+ action: 'open'
160
+ };
161
+ } finally {
162
+ try {
163
+ unlinkSync(tempFile);
164
+ } catch (cleanupError) {
165
+ this.logger.log(`⚠️ Failed to cleanup temp file: ${cleanupError.message}`);
166
+ }
167
+ }
168
+ }
169
+ }
170
+
171
+ module.exports = ClaudeOpener;
@@ -0,0 +1,53 @@
1
+ // @vibecodingmachine/core - Cursor IDE Opener
2
+ // Handles Cursor IDE specific operations
3
+
4
+ const { execSync } = require('child_process');
5
+
6
+ /**
7
+ * Cursor IDE Opener
8
+ * Manages opening Cursor IDE with remote debugging
9
+ */
10
+ class CursorOpener {
11
+ constructor(logger) {
12
+ this.logger = logger;
13
+ }
14
+
15
+ /**
16
+ * Open Cursor IDE with optional repository path and remote debugging enabled
17
+ * @param {string} repoPath - Optional repository path to open
18
+ * @returns {Promise<Object>} Result object with success status and details
19
+ */
20
+ async open(repoPath = null) {
21
+ try {
22
+ this.logger.log('Opening Cursor with remote debugging enabled...');
23
+
24
+ // Launch Cursor with remote debugging enabled
25
+ let command = 'open -a "Cursor" --args --remote-debugging-port=9225';
26
+ if (repoPath) {
27
+ command = `open -a "Cursor" "${repoPath}" --args --remote-debugging-port=9225`;
28
+ }
29
+
30
+ execSync(command, { stdio: 'pipe' });
31
+
32
+ // Wait for Cursor to start and bind the debugging port
33
+ await new Promise(resolve => setTimeout(resolve, 3000));
34
+
35
+ this.logger.log('Cursor opened successfully with remote debugging on port 9225');
36
+ return {
37
+ success: true,
38
+ message: repoPath ? `Cursor opened with repository: ${repoPath} and remote debugging` : 'Cursor opened successfully with remote debugging',
39
+ method: 'applescript',
40
+ debugPort: 9225
41
+ };
42
+ } catch (error) {
43
+ this.logger.log('Error opening Cursor:', error.message);
44
+ return {
45
+ success: false,
46
+ error: error.message,
47
+ method: 'applescript'
48
+ };
49
+ }
50
+ }
51
+ }
52
+
53
+ module.exports = CursorOpener;
@@ -0,0 +1,230 @@
1
+ // @vibecodingmachine/core - Other IDEs Opener
2
+ // Handles Windsurf, Antigravity, Replit, Kiro, Gemini
3
+
4
+ const { execSync, spawn } = require('child_process');
5
+
6
+ /**
7
+ * Other IDEs Opener
8
+ * Manages opening various other supported IDEs
9
+ */
10
+ class OtherIDEsOpener {
11
+ constructor(logger) {
12
+ this.logger = logger;
13
+ }
14
+
15
+ /**
16
+ * Open Gemini (in VS Code)
17
+ * @param {string} repoPath - Optional repository path to open
18
+ * @param {Function} vsCodeOpener - VS Code opener function
19
+ * @returns {Promise<Object>} Result object with success status and details
20
+ */
21
+ async openGemini(repoPath, vsCodeOpener) {
22
+ this.logger.log('Opening Gemini, which runs in VS Code...');
23
+ return await vsCodeOpener(repoPath);
24
+ }
25
+
26
+ /**
27
+ * Open Replit Agent with optional repository path
28
+ * @param {string} repoPath - Optional repository path to open
29
+ * @returns {Promise<Object>} Result object with success status and details
30
+ */
31
+ async openReplit(repoPath = null) {
32
+ try {
33
+ this.logger.log('Opening Replit...');
34
+ this.logger.log(`Platform detected: ${process.platform}`);
35
+
36
+ // Replit typically uses web browser, so we'll open the Replit website
37
+ const replitUrl = repoPath
38
+ ? `https://replit.com/@replit/agent?path=${encodeURIComponent(repoPath)}`
39
+ : 'https://replit.com/@replit/agent';
40
+
41
+ const command = `open "${replitUrl}"`;
42
+ this.logger.log(`Using macOS command: ${command}`);
43
+
44
+ execSync(command, { stdio: 'pipe' });
45
+ await new Promise(resolve => setTimeout(resolve, 1000));
46
+
47
+ this.logger.log('Replit opened successfully');
48
+ return { success: true, message: 'Replit opened in browser', method: 'applescript' };
49
+ } catch (error) {
50
+ this.logger.log('Error opening Replit:', error.message);
51
+ return { success: false, error: error.message, method: 'applescript' };
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Open Windsurf IDE with optional repository path
57
+ * @param {string} repoPath - Optional repository path to open
58
+ * @returns {Promise<Object>} Result object with success status and details
59
+ */
60
+ async openWindsurf(repoPath = null) {
61
+ try {
62
+ this.logger.log('Opening Windsurf...');
63
+
64
+ // Try to find Windsurf installation
65
+ const possiblePaths = [
66
+ '/Users/jesseolsen/.codeium/windsurf/bin/windsurf', // macOS - Codeium installation
67
+ '/Applications/Windsurf.app/Contents/MacOS/Windsurf', // macOS - App Store
68
+ '/usr/local/bin/windsurf', // Linux
69
+ '/opt/windsurf/windsurf' // Linux alternative
70
+ ];
71
+
72
+ let windsurfPath = possiblePaths.find(path => {
73
+ try {
74
+ const fs = require('fs');
75
+ fs.accessSync(path);
76
+ return true;
77
+ } catch {
78
+ return false;
79
+ }
80
+ });
81
+
82
+ if (!windsurfPath) {
83
+ // Try using the 'windsurf' command directly
84
+ windsurfPath = 'windsurf';
85
+ }
86
+
87
+ let command;
88
+ if (windsurfPath.includes('Windsurf.app')) {
89
+ // macOS app bundle
90
+ command = `open -a "Windsurf"`;
91
+ if (repoPath) {
92
+ command += ` "${repoPath}"`;
93
+ }
94
+ } else {
95
+ // Direct executable - use --reuse-window flag to avoid hanging
96
+ command = `"${windsurfPath}" --reuse-window`;
97
+ if (repoPath) {
98
+ command += ` "${repoPath}"`;
99
+ }
100
+ }
101
+
102
+ this.logger.log(`Executing command: ${command}`);
103
+
104
+ // For Windsurf, we don't wait for the command to complete
105
+ if (windsurfPath.includes('windsurf')) {
106
+ // Use spawn to run in background
107
+ const windsurfProcess = spawn(windsurfPath, ['--reuse-window', repoPath], {
108
+ stdio: 'pipe',
109
+ detached: true
110
+ });
111
+
112
+ // Don't wait for completion, just give it a moment to start
113
+ await new Promise(resolve => setTimeout(resolve, 1000));
114
+ } else {
115
+ execSync(command, { stdio: 'pipe' });
116
+ // Wait a moment for Windsurf to start
117
+ await new Promise(resolve => setTimeout(resolve, 2000));
118
+ }
119
+
120
+ this.logger.log('Windsurf opened successfully');
121
+ return {
122
+ success: true,
123
+ message: repoPath ? `Windsurf opened with repository: ${repoPath}` : 'Windsurf opened successfully',
124
+ method: 'applescript'
125
+ };
126
+ } catch (error) {
127
+ this.logger.log('Error opening Windsurf:', error.message);
128
+ return {
129
+ success: false,
130
+ error: error.message,
131
+ method: 'applescript'
132
+ };
133
+ }
134
+ }
135
+
136
+ /**
137
+ * Open Google Antigravity with optional repository path
138
+ * @param {string} repoPath - Optional repository path to open
139
+ * @returns {Promise<Object>} Result object with success status and details
140
+ */
141
+ async openAntigravity(repoPath = null) {
142
+ try {
143
+ this.logger.log('Opening Google Antigravity...');
144
+
145
+ // Google Antigravity app path
146
+ const antigravityPath = '/Applications/Antigravity.app';
147
+
148
+ // Check if Antigravity is installed
149
+ try {
150
+ const fs = require('fs');
151
+ fs.accessSync(antigravityPath);
152
+ } catch {
153
+ throw new Error('Google Antigravity is not installed at /Applications/Antigravity.app');
154
+ }
155
+
156
+ let command = `open -a "Antigravity"`;
157
+ if (repoPath) {
158
+ command += ` "${repoPath}"`;
159
+ }
160
+
161
+ this.logger.log(`Executing command: ${command}`);
162
+ execSync(command, { stdio: 'pipe' });
163
+
164
+ // Wait a moment for Antigravity to start
165
+ await new Promise(resolve => setTimeout(resolve, 2000));
166
+
167
+ this.logger.log('Google Antigravity opened successfully');
168
+ return {
169
+ success: true,
170
+ message: repoPath ? `Google Antigravity opened with repository: ${repoPath}` : 'Google Antigravity opened successfully',
171
+ method: 'applescript'
172
+ };
173
+ } catch (error) {
174
+ this.logger.log('Error opening Google Antigravity:', error.message);
175
+ return {
176
+ success: false,
177
+ error: error.message,
178
+ method: 'applescript'
179
+ };
180
+ }
181
+ }
182
+
183
+ /**
184
+ * Open AWS Kiro IDE with optional repository path
185
+ * @param {string} repoPath - Optional repository path to open
186
+ * @returns {Promise<Object>} Result object with success status and details
187
+ */
188
+ async openKiro(repoPath = null) {
189
+ try {
190
+ this.logger.log('Opening AWS Kiro...');
191
+
192
+ let command = 'open -a "AWS Kiro"';
193
+ if (repoPath) {
194
+ command += ` "${repoPath}"`;
195
+ }
196
+
197
+ try {
198
+ this.logger.log(`Executing command: ${command}`);
199
+ execSync(command, { stdio: 'pipe' });
200
+ } catch (e) {
201
+ // Fallback to just "Kiro"
202
+ this.logger.log('Failed to open "AWS Kiro", trying "Kiro"...');
203
+ command = 'open -a "Kiro"';
204
+ if (repoPath) {
205
+ command += ` "${repoPath}"`;
206
+ }
207
+ execSync(command, { stdio: 'pipe' });
208
+ }
209
+
210
+ // Wait a moment for Kiro to start
211
+ await new Promise(resolve => setTimeout(resolve, 3000));
212
+
213
+ this.logger.log('AWS Kiro opened successfully');
214
+ return {
215
+ success: true,
216
+ message: repoPath ? `AWS Kiro opened with repository: ${repoPath}` : 'AWS Kiro opened successfully',
217
+ method: 'applescript'
218
+ };
219
+ } catch (error) {
220
+ this.logger.log('Error opening AWS Kiro:', error.message);
221
+ return {
222
+ success: false,
223
+ error: error.message,
224
+ method: 'applescript'
225
+ };
226
+ }
227
+ }
228
+ }
229
+
230
+ module.exports = OtherIDEsOpener;
@@ -0,0 +1,147 @@
1
+ // @vibecodingmachine/core - VS Code Opener
2
+ // Handles VS Code and VS Code extensions
3
+
4
+ const { execSync } = require('child_process');
5
+
6
+ /**
7
+ * VS Code Opener
8
+ * Manages opening VS Code with remote debugging and extensions
9
+ */
10
+ class VSCodeOpener {
11
+ constructor(logger) {
12
+ this.logger = logger;
13
+ }
14
+
15
+ /**
16
+ * Open VS Code with optional repository path
17
+ * @param {string} repoPath - Optional repository path to open
18
+ * @returns {Promise<Object>} Result object with success status and details
19
+ */
20
+ async open(repoPath = null) {
21
+ try {
22
+ this.logger.log('Opening VS Code with remote debugging enabled...');
23
+
24
+ // First, check if VS Code is already running
25
+ try {
26
+ const isRunning = execSync('pgrep -x "Code"', { encoding: 'utf8', stdio: 'pipe' }).trim();
27
+ if (isRunning) {
28
+ this.logger.log('VS Code is already running - closing it to enable remote debugging...');
29
+ execSync('pkill -x "Code"', { stdio: 'pipe' });
30
+ await new Promise(resolve => setTimeout(resolve, 1000));
31
+ }
32
+ } catch (err) {
33
+ // VS Code not running, that's fine
34
+ }
35
+
36
+ // Launch VS Code with remote debugging enabled for quota detection
37
+ let command = 'open -a "Visual Studio Code" --args --remote-debugging-port=9222';
38
+ if (repoPath) {
39
+ command = `open -a "Visual Studio Code" "${repoPath}" --args --remote-debugging-port=9222`;
40
+ this.logger.log(`Opening VS Code with repository: ${repoPath}`);
41
+ }
42
+
43
+ execSync(command, { stdio: 'pipe' });
44
+
45
+ await new Promise(resolve => setTimeout(resolve, 3000));
46
+
47
+ // Verify remote debugging port is accessible
48
+ try {
49
+ const CDP = require('chrome-remote-interface');
50
+ await CDP.List({ port: 9222 });
51
+ this.logger.log('✅ VS Code remote debugging port 9222 is accessible');
52
+ } catch (cdpError) {
53
+ this.logger.log(`⚠️ Warning: VS Code remote debugging port not accessible: ${cdpError.message}`);
54
+ this.logger.log(' Waiting additional 2 seconds for VS Code to fully start...');
55
+ await new Promise(resolve => setTimeout(resolve, 2000));
56
+ }
57
+
58
+ this.logger.log('VS Code opened successfully with remote debugging');
59
+ return { success: true, message: `VS Code opened with repository: ${repoPath}`, method: 'applescript' };
60
+ } catch (error) {
61
+ this.logger.log('Error opening VS Code:', error.message);
62
+ return { success: false, error: error.message, method: 'applescript' };
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Open VS Code with a specific extension installed
68
+ * @param {string} extension - Extension key (e.g., 'github-copilot', 'amazon-q')
69
+ * @param {string} repoPath - Optional repository path to open
70
+ * @returns {Promise<Object>} Result object with success status and details
71
+ */
72
+ async openWithExtension(extension, repoPath = null) {
73
+ try {
74
+ this.logger.log(`Opening VS Code with ${extension} extension...`);
75
+
76
+ // Extension IDs mapping
77
+ const extensionIds = {
78
+ 'github-copilot': 'GitHub.copilot',
79
+ 'amazon-q': 'amazonwebservices.amazon-q-vscode',
80
+ 'continue': 'Continue.continue'
81
+ };
82
+
83
+ const extensionId = extensionIds[extension];
84
+ if (!extensionId) {
85
+ return { success: false, error: `Unknown extension: ${extension}`, method: 'applescript' };
86
+ }
87
+
88
+ // First, check if the extension is installed
89
+ try {
90
+ const checkCmd = `code --list-extensions | grep -i "${extensionId}"`;
91
+ execSync(checkCmd, { stdio: 'pipe' });
92
+ this.logger.log(`Extension ${extension} is already installed`);
93
+ } catch (checkError) {
94
+ // Extension not found, try to install it
95
+ this.logger.log(`Extension ${extension} not found, installing...`);
96
+ try {
97
+ execSync(`code --install-extension ${extensionId} --force`, { stdio: 'pipe', timeout: 60000 });
98
+ this.logger.log(`Extension ${extension} installed successfully`);
99
+ } catch (installError) {
100
+ this.logger.log(`Failed to install extension ${extension}:`, installError.message);
101
+ return { success: false, error: `Failed to install extension: ${installError.message}`, method: 'applescript' };
102
+ }
103
+ }
104
+
105
+ // First, check if VS Code is already running
106
+ try {
107
+ const isRunning = execSync('pgrep -x "Code"', { encoding: 'utf8', stdio: 'pipe' }).trim();
108
+ if (isRunning) {
109
+ this.logger.log('VS Code is already running - closing it to enable remote debugging...');
110
+ execSync('pkill -x "Code"', { stdio: 'pipe' });
111
+ await new Promise(resolve => setTimeout(resolve, 1000));
112
+ }
113
+ } catch (err) {
114
+ // VS Code not running, that's fine
115
+ }
116
+
117
+ // Open VS Code with the repository and remote debugging enabled
118
+ let command = 'open -a "Visual Studio Code" --args --remote-debugging-port=9222';
119
+ if (repoPath) {
120
+ command = `open -a "Visual Studio Code" "${repoPath}" --args --remote-debugging-port=9222`;
121
+ this.logger.log(`Opening VS Code with repository: ${repoPath}`);
122
+ }
123
+
124
+ execSync(command, { stdio: 'pipe' });
125
+ await new Promise(resolve => setTimeout(resolve, 3000));
126
+
127
+ // Verify remote debugging port is accessible
128
+ try {
129
+ const CDP = require('chrome-remote-interface');
130
+ await CDP.List({ port: 9222 });
131
+ this.logger.log('✅ VS Code remote debugging port 9222 is accessible');
132
+ } catch (cdpError) {
133
+ this.logger.log(`⚠️ Warning: VS Code remote debugging port not accessible: ${cdpError.message}`);
134
+ this.logger.log(' Waiting additional 2 seconds for VS Code to fully start...');
135
+ await new Promise(resolve => setTimeout(resolve, 2000));
136
+ }
137
+
138
+ this.logger.log(`VS Code opened successfully with ${extension} extension and remote debugging`);
139
+ return { success: true, message: `VS Code opened with ${extension} extension`, method: 'applescript' };
140
+ } catch (error) {
141
+ this.logger.log(`Error opening VS Code with ${extension}:`, error.message);
142
+ return { success: false, error: error.message, method: 'applescript' };
143
+ }
144
+ }
145
+ }
146
+
147
+ module.exports = VSCodeOpener;