vibecodingmachine-core 1.0.1 → 2025.11.2-7.1239

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/.babelrc +13 -13
  2. package/README.md +28 -28
  3. package/__tests__/applescript-manager-claude-fix.test.js +286 -286
  4. package/__tests__/requirement-2-auto-start-looping.test.js +69 -69
  5. package/__tests__/requirement-3-auto-start-looping.test.js +69 -69
  6. package/__tests__/requirement-4-auto-start-looping.test.js +69 -69
  7. package/__tests__/requirement-6-auto-start-looping.test.js +73 -73
  8. package/__tests__/requirement-7-status-tracking.test.js +332 -332
  9. package/jest.config.js +18 -18
  10. package/jest.setup.js +12 -12
  11. package/package.json +48 -48
  12. package/src/auth/access-denied.html +119 -119
  13. package/src/auth/shared-auth-storage.js +230 -230
  14. package/src/autonomous-mode/feature-implementer.cjs +70 -70
  15. package/src/autonomous-mode/feature-implementer.js +425 -425
  16. package/src/chat-management/chat-manager.cjs +71 -71
  17. package/src/chat-management/chat-manager.js +342 -342
  18. package/src/ide-integration/__tests__/applescript-manager-thread-closure.test.js +227 -227
  19. package/src/ide-integration/aider-cli-manager.cjs +850 -850
  20. package/src/ide-integration/applescript-manager.cjs +1088 -1088
  21. package/src/ide-integration/applescript-manager.js +2802 -2802
  22. package/src/ide-integration/applescript-utils.js +306 -306
  23. package/src/ide-integration/cdp-manager.cjs +221 -221
  24. package/src/ide-integration/cdp-manager.js +321 -321
  25. package/src/ide-integration/claude-code-cli-manager.cjs +301 -301
  26. package/src/ide-integration/cline-cli-manager.cjs +2252 -2252
  27. package/src/ide-integration/continue-cli-manager.js +431 -431
  28. package/src/ide-integration/provider-manager.cjs +354 -354
  29. package/src/ide-integration/quota-detector.cjs +34 -34
  30. package/src/ide-integration/quota-detector.js +349 -349
  31. package/src/ide-integration/windows-automation-manager.js +262 -262
  32. package/src/index.cjs +47 -43
  33. package/src/index.js +17 -17
  34. package/src/llm/direct-llm-manager.cjs +609 -609
  35. package/src/ui/ButtonComponents.js +247 -247
  36. package/src/ui/ChatInterface.js +499 -499
  37. package/src/ui/StateManager.js +259 -259
  38. package/src/utils/audit-logger.cjs +116 -116
  39. package/src/utils/config-helpers.cjs +94 -94
  40. package/src/utils/config-helpers.js +94 -94
  41. package/src/utils/electron-update-checker.js +113 -85
  42. package/src/utils/gcloud-auth.cjs +394 -394
  43. package/src/utils/logger.cjs +193 -193
  44. package/src/utils/logger.js +191 -191
  45. package/src/utils/repo-helpers.cjs +120 -120
  46. package/src/utils/repo-helpers.js +120 -120
  47. package/src/utils/requirement-helpers.js +432 -432
  48. package/src/utils/update-checker.js +227 -167
  49. package/src/utils/version-checker.js +169 -0
@@ -1,227 +1,227 @@
1
- /**
2
- * Jest tests for AppleScript Manager thread closure functionality
3
- * Tests the ability to close previous chat threads when starting new ones
4
- */
5
-
6
- import { AppleScriptManager } from '../applescript-manager.js';
7
- import { execSync } from 'child_process';
8
-
9
- // Mock child_process
10
- jest.mock('child_process', () => ({
11
- execSync: jest.fn()
12
- }));Windsurf: Open Chat
13
-
14
-
15
-
16
-
17
-
18
- // Mock fs
19
- jest.mock('fs', () => ({
20
- writeFileSync: jest.fn(),
21
- unlinkSync: jest.fn()
22
- }));
23
-
24
- // Mock os
25
- jest.mock('os', () => ({
26
- tmpdir: () => '/tmp'
27
- }));
28
-
29
- describe('AppleScriptManager - Thread Closure', () => {
30
- let appleScriptManager;
31
- let mockExecSync;
32
-
33
- beforeEach(() => {
34
- appleScriptManager = new AppleScriptManager();
35
- mockExecSync = execSync;
36
- mockExecSync.mockClear();
37
- });
38
-
39
- afterEach(() => {
40
- jest.clearAllMocks();
41
- });
42
-
43
- describe('closePreviousChatThread', () => {
44
- it('should close previous chat thread in Cursor', async () => {
45
- // Mock successful execution
46
- mockExecSync.mockReturnValue('Previous chat thread closed');
47
-
48
- const result = await appleScriptManager.closePreviousChatThread('cursor');
49
-
50
- expect(result.success).toBe(true);
51
- expect(result.message).toContain('Previous chat thread closed');
52
- expect(result.method).toBe('applescript');
53
- expect(mockExecSync).toHaveBeenCalled();
54
- });
55
-
56
- it('should close previous chat thread in VS Code', async () => {
57
- // Mock successful execution
58
- mockExecSync.mockReturnValue('Previous chat thread closed');
59
-
60
- const result = await appleScriptManager.closePreviousChatThread('vscode');
61
-
62
- expect(result.success).toBe(true);
63
- expect(result.message).toContain('Previous chat thread closed');
64
- expect(result.method).toBe('applescript');
65
- expect(mockExecSync).toHaveBeenCalled();
66
- });
67
-
68
- it('should close previous chat thread in Windsurf', async () => {
69
- // Mock successful execution
70
- mockExecSync.mockReturnValue('Previous chat thread closed');
71
-
72
- const result = await appleScriptManager.closePreviousChatThread('windsurf');
73
-
74
- expect(result.success).toBe(true);
75
- expect(result.message).toContain('Previous chat thread closed');
76
- expect(result.method).toBe('applescript');
77
- expect(mockExecSync).toHaveBeenCalled();
78
- });
79
-
80
- it('should handle errors gracefully when closing threads', async () => {
81
- // Mock execution error
82
- mockExecSync.mockImplementation(() => {
83
- throw new Error('Failed to close thread');
84
- });
85
-
86
- const result = await appleScriptManager.closePreviousChatThread('cursor');
87
-
88
- expect(result.success).toBe(false);
89
- expect(result.error).toContain('Failed to close thread');
90
- expect(result.method).toBe('applescript');
91
- });
92
-
93
- it('should return error for unsupported IDE', async () => {
94
- const result = await appleScriptManager.closePreviousChatThread('unsupported');
95
-
96
- expect(result.success).toBe(false);
97
- expect(result.error).toContain('Unsupported IDE');
98
- expect(mockExecSync).not.toHaveBeenCalled();
99
- });
100
- });
101
-
102
- describe('sendTextWithThreadClosure', () => {
103
- it('should close previous thread before sending new message to Cursor', async () => {
104
- // Mock successful executions
105
- mockExecSync
106
- .mockReturnValueOnce('Previous chat thread closed')
107
- .mockReturnValueOnce('Message sent to Cursor: Test message')
108
- .mockReturnValueOnce('Message sent to Cursor: Test message');
109
-
110
- const result = await appleScriptManager.sendTextWithThreadClosure('Test message', 'cursor');
111
-
112
- expect(result.success).toBe(true);
113
- expect(result.message).toContain('Test message');
114
- expect(mockExecSync).toHaveBeenCalledTimes(3); // Once for close, twice for send (sendText calls execSync twice)
115
- });
116
-
117
- it('should close previous thread before sending new message to VS Code', async () => {
118
- // Mock successful executions
119
- mockExecSync
120
- .mockReturnValueOnce('Previous chat thread closed')
121
- .mockImplementationOnce(() => {
122
- // Simulate successful AppleScript execution for text sending
123
- return 'Message sent via AppleScript to VS Code GitHub Copilot Chat';
124
- });
125
-
126
- const result = await appleScriptManager.sendTextWithThreadClosure('Test message', 'vscode');
127
-
128
- expect(result.success).toBe(true); // VS Code is now supported by AppleScript manager
129
- expect(result.method).toBe('applescript');
130
- expect(result.threadClosure).toContain('Previous thread closed');
131
- expect(mockExecSync).toHaveBeenCalledTimes(2); // Once for thread closure, once for sending
132
- });
133
-
134
- it('should close previous thread before sending new message to Windsurf', async () => {
135
- // Mock successful executions
136
- mockExecSync
137
- .mockReturnValueOnce('Previous chat thread closed')
138
- .mockImplementationOnce(() => {
139
- throw new Error('AppleScript failed');
140
- });
141
-
142
- const result = await appleScriptManager.sendTextWithThreadClosure('Test message', 'windsurf');
143
-
144
- expect(result.success).toBe(true);
145
- expect(result.message).toContain('Test message');
146
- expect(mockExecSync).toHaveBeenCalled(); // Should be called at least once for thread closure
147
- });
148
-
149
- it('should handle thread closure failure gracefully', async () => {
150
- // Mock thread closure failure but successful message send
151
- mockExecSync
152
- .mockImplementationOnce(() => {
153
- throw new Error('Failed to close thread');
154
- })
155
- .mockImplementationOnce(() => {
156
- throw new Error('AppleScript failed');
157
- });
158
-
159
- const result = await appleScriptManager.sendTextWithThreadClosure('Test message', 'cursor');
160
-
161
- expect(result.success).toBe(true);
162
- expect(result.message).toContain('Test message');
163
- expect(result.warning).toContain('Failed to close previous thread');
164
- expect(mockExecSync).toHaveBeenCalled(); // Should be called at least once
165
- });
166
-
167
- it('should handle both thread closure and message send failures', async () => {
168
- // Mock both failures
169
- mockExecSync
170
- .mockImplementationOnce(() => {
171
- throw new Error('Failed to close thread');
172
- })
173
- .mockImplementationOnce(() => {
174
- throw new Error('AppleScript failed');
175
- });
176
-
177
- const result = await appleScriptManager.sendTextWithThreadClosure('Test message', 'cursor');
178
-
179
- expect(result.success).toBe(true); // Should still succeed due to simulated fallback
180
- expect(result.message).toContain('Test message');
181
- expect(mockExecSync).toHaveBeenCalled(); // Should be called at least once
182
- });
183
-
184
- it('should validate input parameters', async () => {
185
- const result = await appleScriptManager.sendTextWithThreadClosure('', 'cursor');
186
-
187
- expect(result.success).toBe(false);
188
- expect(result.error).toContain('Invalid text');
189
- expect(mockExecSync).not.toHaveBeenCalled();
190
- });
191
- });
192
-
193
- describe('AppleScript Content Validation', () => {
194
- it('should generate correct AppleScript for Cursor thread closure', async () => {
195
- mockExecSync.mockReturnValue('Success');
196
-
197
- await appleScriptManager.closePreviousChatThread('cursor');
198
-
199
- const callArgs = mockExecSync.mock.calls[0][0];
200
- expect(callArgs).toContain('osascript');
201
- // The script content is written to a temp file, so we check the osascript call
202
- expect(mockExecSync).toHaveBeenCalledWith(expect.stringContaining('osascript'), expect.any(Object));
203
- });
204
-
205
- it('should generate correct AppleScript for VS Code thread closure', async () => {
206
- mockExecSync.mockReturnValue('Success');
207
-
208
- await appleScriptManager.closePreviousChatThread('vscode');
209
-
210
- const callArgs = mockExecSync.mock.calls[0][0];
211
- expect(callArgs).toContain('osascript');
212
- // The script content is written to a temp file, so we check the osascript call
213
- expect(mockExecSync).toHaveBeenCalledWith(expect.stringContaining('osascript'), expect.any(Object));
214
- });
215
-
216
- it('should generate correct AppleScript for Windsurf thread closure', async () => {
217
- mockExecSync.mockReturnValue('Success');
218
-
219
- await appleScriptManager.closePreviousChatThread('windsurf');
220
-
221
- const callArgs = mockExecSync.mock.calls[0][0];
222
- expect(callArgs).toContain('osascript');
223
- // The script content is written to a temp file, so we check the osascript call
224
- expect(mockExecSync).toHaveBeenCalledWith(expect.stringContaining('osascript'), expect.any(Object));
225
- });
226
- });
227
- });
1
+ /**
2
+ * Jest tests for AppleScript Manager thread closure functionality
3
+ * Tests the ability to close previous chat threads when starting new ones
4
+ */
5
+
6
+ import { AppleScriptManager } from '../applescript-manager.js';
7
+ import { execSync } from 'child_process';
8
+
9
+ // Mock child_process
10
+ jest.mock('child_process', () => ({
11
+ execSync: jest.fn()
12
+ }));Windsurf: Open Chat
13
+
14
+
15
+
16
+
17
+
18
+ // Mock fs
19
+ jest.mock('fs', () => ({
20
+ writeFileSync: jest.fn(),
21
+ unlinkSync: jest.fn()
22
+ }));
23
+
24
+ // Mock os
25
+ jest.mock('os', () => ({
26
+ tmpdir: () => '/tmp'
27
+ }));
28
+
29
+ describe('AppleScriptManager - Thread Closure', () => {
30
+ let appleScriptManager;
31
+ let mockExecSync;
32
+
33
+ beforeEach(() => {
34
+ appleScriptManager = new AppleScriptManager();
35
+ mockExecSync = execSync;
36
+ mockExecSync.mockClear();
37
+ });
38
+
39
+ afterEach(() => {
40
+ jest.clearAllMocks();
41
+ });
42
+
43
+ describe('closePreviousChatThread', () => {
44
+ it('should close previous chat thread in Cursor', async () => {
45
+ // Mock successful execution
46
+ mockExecSync.mockReturnValue('Previous chat thread closed');
47
+
48
+ const result = await appleScriptManager.closePreviousChatThread('cursor');
49
+
50
+ expect(result.success).toBe(true);
51
+ expect(result.message).toContain('Previous chat thread closed');
52
+ expect(result.method).toBe('applescript');
53
+ expect(mockExecSync).toHaveBeenCalled();
54
+ });
55
+
56
+ it('should close previous chat thread in VS Code', async () => {
57
+ // Mock successful execution
58
+ mockExecSync.mockReturnValue('Previous chat thread closed');
59
+
60
+ const result = await appleScriptManager.closePreviousChatThread('vscode');
61
+
62
+ expect(result.success).toBe(true);
63
+ expect(result.message).toContain('Previous chat thread closed');
64
+ expect(result.method).toBe('applescript');
65
+ expect(mockExecSync).toHaveBeenCalled();
66
+ });
67
+
68
+ it('should close previous chat thread in Windsurf', async () => {
69
+ // Mock successful execution
70
+ mockExecSync.mockReturnValue('Previous chat thread closed');
71
+
72
+ const result = await appleScriptManager.closePreviousChatThread('windsurf');
73
+
74
+ expect(result.success).toBe(true);
75
+ expect(result.message).toContain('Previous chat thread closed');
76
+ expect(result.method).toBe('applescript');
77
+ expect(mockExecSync).toHaveBeenCalled();
78
+ });
79
+
80
+ it('should handle errors gracefully when closing threads', async () => {
81
+ // Mock execution error
82
+ mockExecSync.mockImplementation(() => {
83
+ throw new Error('Failed to close thread');
84
+ });
85
+
86
+ const result = await appleScriptManager.closePreviousChatThread('cursor');
87
+
88
+ expect(result.success).toBe(false);
89
+ expect(result.error).toContain('Failed to close thread');
90
+ expect(result.method).toBe('applescript');
91
+ });
92
+
93
+ it('should return error for unsupported IDE', async () => {
94
+ const result = await appleScriptManager.closePreviousChatThread('unsupported');
95
+
96
+ expect(result.success).toBe(false);
97
+ expect(result.error).toContain('Unsupported IDE');
98
+ expect(mockExecSync).not.toHaveBeenCalled();
99
+ });
100
+ });
101
+
102
+ describe('sendTextWithThreadClosure', () => {
103
+ it('should close previous thread before sending new message to Cursor', async () => {
104
+ // Mock successful executions
105
+ mockExecSync
106
+ .mockReturnValueOnce('Previous chat thread closed')
107
+ .mockReturnValueOnce('Message sent to Cursor: Test message')
108
+ .mockReturnValueOnce('Message sent to Cursor: Test message');
109
+
110
+ const result = await appleScriptManager.sendTextWithThreadClosure('Test message', 'cursor');
111
+
112
+ expect(result.success).toBe(true);
113
+ expect(result.message).toContain('Test message');
114
+ expect(mockExecSync).toHaveBeenCalledTimes(3); // Once for close, twice for send (sendText calls execSync twice)
115
+ });
116
+
117
+ it('should close previous thread before sending new message to VS Code', async () => {
118
+ // Mock successful executions
119
+ mockExecSync
120
+ .mockReturnValueOnce('Previous chat thread closed')
121
+ .mockImplementationOnce(() => {
122
+ // Simulate successful AppleScript execution for text sending
123
+ return 'Message sent via AppleScript to VS Code GitHub Copilot Chat';
124
+ });
125
+
126
+ const result = await appleScriptManager.sendTextWithThreadClosure('Test message', 'vscode');
127
+
128
+ expect(result.success).toBe(true); // VS Code is now supported by AppleScript manager
129
+ expect(result.method).toBe('applescript');
130
+ expect(result.threadClosure).toContain('Previous thread closed');
131
+ expect(mockExecSync).toHaveBeenCalledTimes(2); // Once for thread closure, once for sending
132
+ });
133
+
134
+ it('should close previous thread before sending new message to Windsurf', async () => {
135
+ // Mock successful executions
136
+ mockExecSync
137
+ .mockReturnValueOnce('Previous chat thread closed')
138
+ .mockImplementationOnce(() => {
139
+ throw new Error('AppleScript failed');
140
+ });
141
+
142
+ const result = await appleScriptManager.sendTextWithThreadClosure('Test message', 'windsurf');
143
+
144
+ expect(result.success).toBe(true);
145
+ expect(result.message).toContain('Test message');
146
+ expect(mockExecSync).toHaveBeenCalled(); // Should be called at least once for thread closure
147
+ });
148
+
149
+ it('should handle thread closure failure gracefully', async () => {
150
+ // Mock thread closure failure but successful message send
151
+ mockExecSync
152
+ .mockImplementationOnce(() => {
153
+ throw new Error('Failed to close thread');
154
+ })
155
+ .mockImplementationOnce(() => {
156
+ throw new Error('AppleScript failed');
157
+ });
158
+
159
+ const result = await appleScriptManager.sendTextWithThreadClosure('Test message', 'cursor');
160
+
161
+ expect(result.success).toBe(true);
162
+ expect(result.message).toContain('Test message');
163
+ expect(result.warning).toContain('Failed to close previous thread');
164
+ expect(mockExecSync).toHaveBeenCalled(); // Should be called at least once
165
+ });
166
+
167
+ it('should handle both thread closure and message send failures', async () => {
168
+ // Mock both failures
169
+ mockExecSync
170
+ .mockImplementationOnce(() => {
171
+ throw new Error('Failed to close thread');
172
+ })
173
+ .mockImplementationOnce(() => {
174
+ throw new Error('AppleScript failed');
175
+ });
176
+
177
+ const result = await appleScriptManager.sendTextWithThreadClosure('Test message', 'cursor');
178
+
179
+ expect(result.success).toBe(true); // Should still succeed due to simulated fallback
180
+ expect(result.message).toContain('Test message');
181
+ expect(mockExecSync).toHaveBeenCalled(); // Should be called at least once
182
+ });
183
+
184
+ it('should validate input parameters', async () => {
185
+ const result = await appleScriptManager.sendTextWithThreadClosure('', 'cursor');
186
+
187
+ expect(result.success).toBe(false);
188
+ expect(result.error).toContain('Invalid text');
189
+ expect(mockExecSync).not.toHaveBeenCalled();
190
+ });
191
+ });
192
+
193
+ describe('AppleScript Content Validation', () => {
194
+ it('should generate correct AppleScript for Cursor thread closure', async () => {
195
+ mockExecSync.mockReturnValue('Success');
196
+
197
+ await appleScriptManager.closePreviousChatThread('cursor');
198
+
199
+ const callArgs = mockExecSync.mock.calls[0][0];
200
+ expect(callArgs).toContain('osascript');
201
+ // The script content is written to a temp file, so we check the osascript call
202
+ expect(mockExecSync).toHaveBeenCalledWith(expect.stringContaining('osascript'), expect.any(Object));
203
+ });
204
+
205
+ it('should generate correct AppleScript for VS Code thread closure', async () => {
206
+ mockExecSync.mockReturnValue('Success');
207
+
208
+ await appleScriptManager.closePreviousChatThread('vscode');
209
+
210
+ const callArgs = mockExecSync.mock.calls[0][0];
211
+ expect(callArgs).toContain('osascript');
212
+ // The script content is written to a temp file, so we check the osascript call
213
+ expect(mockExecSync).toHaveBeenCalledWith(expect.stringContaining('osascript'), expect.any(Object));
214
+ });
215
+
216
+ it('should generate correct AppleScript for Windsurf thread closure', async () => {
217
+ mockExecSync.mockReturnValue('Success');
218
+
219
+ await appleScriptManager.closePreviousChatThread('windsurf');
220
+
221
+ const callArgs = mockExecSync.mock.calls[0][0];
222
+ expect(callArgs).toContain('osascript');
223
+ // The script content is written to a temp file, so we check the osascript call
224
+ expect(mockExecSync).toHaveBeenCalledWith(expect.stringContaining('osascript'), expect.any(Object));
225
+ });
226
+ });
227
+ });