vibecodingmachine-core 1.0.2 → 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,301 +1,301 @@
1
- // Claude Code CLI Manager - handles Claude Code CLI execution
2
- const { execSync, spawn } = require('child_process');
3
- const fs = require('fs');
4
- const path = require('path');
5
- const os = require('os');
6
-
7
- // Helper function for timestamps
8
- function getTimestamp() {
9
- const now = new Date();
10
- return now.toLocaleTimeString('en-US', {
11
- hour: '2-digit',
12
- minute: '2-digit',
13
- hour12: false
14
- });
15
- }
16
-
17
- class ClaudeCodeCLIManager {
18
- constructor() {
19
- this.logger = console;
20
- this.runningProcesses = [];
21
- }
22
-
23
- /**
24
- * Check if Claude Code CLI is installed
25
- */
26
- isInstalled() {
27
- try {
28
- execSync('which claude', { stdio: 'pipe' });
29
- return true;
30
- } catch {
31
- return false;
32
- }
33
- }
34
-
35
- /**
36
- * Get Claude Code CLI version
37
- */
38
- getVersion() {
39
- try {
40
- const version = execSync('claude --version', { encoding: 'utf8', stdio: 'pipe' });
41
- return version.trim();
42
- } catch {
43
- return null;
44
- }
45
- }
46
-
47
- /**
48
- * Install Claude Code CLI
49
- * @returns {Promise<{success: boolean, error?: string, suggestions?: string[]}>}
50
- */
51
- async install() {
52
- try {
53
- console.log('\nšŸ“¦ Installing Claude Code CLI...\n');
54
-
55
- // Check if npm is available
56
- try {
57
- execSync('which npm', { stdio: 'pipe' });
58
- } catch {
59
- return {
60
- success: false,
61
- error: 'npm is not installed',
62
- suggestions: [
63
- 'Install Node.js and npm first:',
64
- ' macOS: brew install node',
65
- ' Linux: sudo apt-get install nodejs npm',
66
- ' Windows: Download from https://nodejs.org/'
67
- ]
68
- };
69
- }
70
-
71
- // Install Claude Code globally
72
- console.log('Running: npm install -g @anthropic-ai/claude-code');
73
- execSync('npm install -g @anthropic-ai/claude-code', {
74
- stdio: 'inherit',
75
- encoding: 'utf8'
76
- });
77
-
78
- // Verify installation
79
- if (this.isInstalled()) {
80
- const version = this.getVersion();
81
- console.log(`\nāœ“ Claude Code CLI installed successfully: ${version}\n`);
82
- return { success: true };
83
- } else {
84
- return {
85
- success: false,
86
- error: 'Installation completed but claude command not found',
87
- suggestions: [
88
- 'Try running: npm install -g @anthropic-ai/claude-code',
89
- 'Make sure your npm global bin directory is in PATH'
90
- ]
91
- };
92
- }
93
- } catch (error) {
94
- return {
95
- success: false,
96
- error: error.message,
97
- suggestions: [
98
- 'Try installing manually: npm install -g @anthropic-ai/claude-code',
99
- 'Check if you have permission to install global npm packages',
100
- 'You may need to use: sudo npm install -g @anthropic-ai/claude-code'
101
- ]
102
- };
103
- }
104
- }
105
-
106
- /**
107
- * Kill all running Claude Code processes
108
- */
109
- killAllProcesses() {
110
- for (const proc of this.runningProcesses) {
111
- try {
112
- if (!proc.killed) {
113
- proc.kill('SIGTERM');
114
- setTimeout(() => {
115
- if (!proc.killed) {
116
- proc.kill('SIGKILL');
117
- }
118
- }, 1000);
119
- }
120
- } catch (err) {
121
- // Ignore errors
122
- }
123
- }
124
- this.runningProcesses = [];
125
- }
126
-
127
- /**
128
- * Send a prompt to Claude Code and wait for completion
129
- * @param {string} text - The message/prompt to send
130
- * @param {string} cwd - Path to the repository (working directory)
131
- * @param {Object} options - Additional options
132
- * @param {Function} options.onOutput - Optional callback for output
133
- * @param {Function} options.onError - Optional callback for errors
134
- * @param {number} options.timeoutMs - Timeout in milliseconds (default 300000 = 5 minutes)
135
- * @returns {Promise<{success: boolean, output: string, error?: string}>}
136
- */
137
- async sendText(text, cwd = process.cwd(), options = {}) {
138
- if (!this.isInstalled()) {
139
- return {
140
- success: false,
141
- error: 'Claude Code CLI is not installed. Run install() first.',
142
- needsInstall: true
143
- };
144
- }
145
-
146
- try {
147
- const { onOutput, onError, timeoutMs = 300000 } = options;
148
-
149
- return new Promise((resolve) => {
150
- const startTime = Date.now();
151
- let stdout = '';
152
- let stderr = '';
153
- let completed = false;
154
- let timeoutKilled = false;
155
- let lastOutputTime = Date.now();
156
-
157
- // Spawn Claude Code in the repository directory
158
- const proc = spawn('claude', ['code'], {
159
- cwd: cwd,
160
- stdio: ['pipe', 'pipe', 'pipe'],
161
- env: { ...process.env }
162
- });
163
-
164
- this.runningProcesses.push(proc);
165
-
166
- // Status update interval - show progress every 10 seconds if no output
167
- const statusInterval = setInterval(() => {
168
- const timeSinceOutput = (Date.now() - lastOutputTime) / 1000;
169
- if (timeSinceOutput > 10) {
170
- const elapsed = ((Date.now() - startTime) / 1000).toFixed(0);
171
- const chalk = require('chalk');
172
- const timestamp = getTimestamp();
173
- console.log(chalk.yellow(`[${timestamp}] [CLAUDE] Still waiting... (${elapsed}s elapsed, ${timeSinceOutput.toFixed(0)}s since last output)`));
174
- }
175
- }, 10000);
176
-
177
- // Hard timeout - kill process if it runs too long
178
- const hardTimeout = setTimeout(() => {
179
- const elapsed = ((Date.now() - startTime) / 1000).toFixed(0);
180
- const chalk = require('chalk');
181
- const timestamp = getTimestamp();
182
- console.log(chalk.red(`\n[${timestamp}] ā° TIMEOUT: Claude Code process exceeded ${timeoutMs/1000}s limit (ran for ${elapsed}s)`));
183
- console.log(chalk.red(`[${timestamp}] Killing Claude Code process to prevent hanging...`));
184
- timeoutKilled = true;
185
- completed = true;
186
- clearInterval(statusInterval);
187
- proc.kill('SIGTERM');
188
- setTimeout(() => proc.kill('SIGKILL'), 2000); // Force kill after 2s
189
- }, timeoutMs);
190
-
191
- // Handle stdout
192
- proc.stdout.on('data', (chunk) => {
193
- const chunkText = chunk.toString();
194
- stdout += chunkText;
195
- lastOutputTime = Date.now();
196
-
197
- // Filter and show useful output
198
- const lines = chunkText.split('\n');
199
- for (const line of lines) {
200
- const trimmed = line.trim();
201
- if (!trimmed) continue;
202
-
203
- // Call output callback if provided
204
- if (onOutput) {
205
- onOutput(line + '\n');
206
- } else {
207
- // Fallback: write directly to stdout
208
- try {
209
- const chalk = require('chalk');
210
- process.stdout.write(chalk.gray(line + '\n'));
211
- } catch {
212
- process.stdout.write(line + '\n');
213
- }
214
- }
215
- }
216
- });
217
-
218
- // Handle stderr
219
- proc.stderr.on('data', (chunk) => {
220
- const chunkText = chunk.toString();
221
- stderr += chunkText;
222
-
223
- // Only show actual errors
224
- if (chunkText.includes('Error:') || chunkText.includes('Failed:') || chunkText.includes('error')) {
225
- if (onError) {
226
- onError(chunkText.trim());
227
- } else {
228
- this.logger.error('[Claude Code Error]', chunkText.trim());
229
- }
230
- }
231
- });
232
-
233
- // Send the message and close stdin
234
- proc.stdin.write(text + '\n');
235
- proc.stdin.end();
236
-
237
- // Handle process exit
238
- proc.on('close', (code) => {
239
- // Remove process from tracking array
240
- const index = this.runningProcesses.indexOf(proc);
241
- if (index > -1) {
242
- this.runningProcesses.splice(index, 1);
243
- }
244
-
245
- clearInterval(statusInterval);
246
- clearTimeout(hardTimeout);
247
- const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
248
- const chalk = require('chalk');
249
- const timestamp = getTimestamp();
250
-
251
- if (timeoutKilled) {
252
- console.log(chalk.red(`[${timestamp}] [CLAUDE] Process killed due to timeout after ${elapsed}s`));
253
- resolve({
254
- success: false,
255
- output: stdout,
256
- error: 'Timeout: Process exceeded maximum execution time',
257
- exitCode: -1,
258
- timeout: true
259
- });
260
- } else if (code === 0) {
261
- console.log(chalk.gray(`[${timestamp}] [CLAUDE] Process completed after ${elapsed}s with code: ${code}`));
262
- resolve({
263
- success: true,
264
- output: stdout,
265
- stderr: stderr,
266
- exitCode: code
267
- });
268
- } else {
269
- console.log(chalk.gray(`[${timestamp}] [CLAUDE] Process closed after ${elapsed}s with code: ${code}`));
270
- resolve({
271
- success: false,
272
- output: stdout,
273
- error: stderr || `Process exited with code ${code}`,
274
- exitCode: code
275
- });
276
- }
277
- });
278
-
279
- proc.on('error', (error) => {
280
- clearInterval(statusInterval);
281
- clearTimeout(hardTimeout);
282
- completed = true;
283
- const timestamp = getTimestamp();
284
- console.log(`\n[${timestamp}] āœ— Claude Code error: ${error.message}`);
285
- resolve({
286
- success: false,
287
- error: error.message,
288
- exitCode: -1
289
- });
290
- });
291
- });
292
- } catch (error) {
293
- return {
294
- success: false,
295
- error: error.message
296
- };
297
- }
298
- }
299
- }
300
-
301
- module.exports = ClaudeCodeCLIManager;
1
+ // Claude Code CLI Manager - handles Claude Code CLI execution
2
+ const { execSync, spawn } = require('child_process');
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const os = require('os');
6
+
7
+ // Helper function for timestamps
8
+ function getTimestamp() {
9
+ const now = new Date();
10
+ return now.toLocaleTimeString('en-US', {
11
+ hour: '2-digit',
12
+ minute: '2-digit',
13
+ hour12: false
14
+ });
15
+ }
16
+
17
+ class ClaudeCodeCLIManager {
18
+ constructor() {
19
+ this.logger = console;
20
+ this.runningProcesses = [];
21
+ }
22
+
23
+ /**
24
+ * Check if Claude Code CLI is installed
25
+ */
26
+ isInstalled() {
27
+ try {
28
+ execSync('which claude', { stdio: 'pipe' });
29
+ return true;
30
+ } catch {
31
+ return false;
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Get Claude Code CLI version
37
+ */
38
+ getVersion() {
39
+ try {
40
+ const version = execSync('claude --version', { encoding: 'utf8', stdio: 'pipe' });
41
+ return version.trim();
42
+ } catch {
43
+ return null;
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Install Claude Code CLI
49
+ * @returns {Promise<{success: boolean, error?: string, suggestions?: string[]}>}
50
+ */
51
+ async install() {
52
+ try {
53
+ console.log('\nšŸ“¦ Installing Claude Code CLI...\n');
54
+
55
+ // Check if npm is available
56
+ try {
57
+ execSync('which npm', { stdio: 'pipe' });
58
+ } catch {
59
+ return {
60
+ success: false,
61
+ error: 'npm is not installed',
62
+ suggestions: [
63
+ 'Install Node.js and npm first:',
64
+ ' macOS: brew install node',
65
+ ' Linux: sudo apt-get install nodejs npm',
66
+ ' Windows: Download from https://nodejs.org/'
67
+ ]
68
+ };
69
+ }
70
+
71
+ // Install Claude Code globally
72
+ console.log('Running: npm install -g @anthropic-ai/claude-code');
73
+ execSync('npm install -g @anthropic-ai/claude-code', {
74
+ stdio: 'inherit',
75
+ encoding: 'utf8'
76
+ });
77
+
78
+ // Verify installation
79
+ if (this.isInstalled()) {
80
+ const version = this.getVersion();
81
+ console.log(`\nāœ“ Claude Code CLI installed successfully: ${version}\n`);
82
+ return { success: true };
83
+ } else {
84
+ return {
85
+ success: false,
86
+ error: 'Installation completed but claude command not found',
87
+ suggestions: [
88
+ 'Try running: npm install -g @anthropic-ai/claude-code',
89
+ 'Make sure your npm global bin directory is in PATH'
90
+ ]
91
+ };
92
+ }
93
+ } catch (error) {
94
+ return {
95
+ success: false,
96
+ error: error.message,
97
+ suggestions: [
98
+ 'Try installing manually: npm install -g @anthropic-ai/claude-code',
99
+ 'Check if you have permission to install global npm packages',
100
+ 'You may need to use: sudo npm install -g @anthropic-ai/claude-code'
101
+ ]
102
+ };
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Kill all running Claude Code processes
108
+ */
109
+ killAllProcesses() {
110
+ for (const proc of this.runningProcesses) {
111
+ try {
112
+ if (!proc.killed) {
113
+ proc.kill('SIGTERM');
114
+ setTimeout(() => {
115
+ if (!proc.killed) {
116
+ proc.kill('SIGKILL');
117
+ }
118
+ }, 1000);
119
+ }
120
+ } catch (err) {
121
+ // Ignore errors
122
+ }
123
+ }
124
+ this.runningProcesses = [];
125
+ }
126
+
127
+ /**
128
+ * Send a prompt to Claude Code and wait for completion
129
+ * @param {string} text - The message/prompt to send
130
+ * @param {string} cwd - Path to the repository (working directory)
131
+ * @param {Object} options - Additional options
132
+ * @param {Function} options.onOutput - Optional callback for output
133
+ * @param {Function} options.onError - Optional callback for errors
134
+ * @param {number} options.timeoutMs - Timeout in milliseconds (default 300000 = 5 minutes)
135
+ * @returns {Promise<{success: boolean, output: string, error?: string}>}
136
+ */
137
+ async sendText(text, cwd = process.cwd(), options = {}) {
138
+ if (!this.isInstalled()) {
139
+ return {
140
+ success: false,
141
+ error: 'Claude Code CLI is not installed. Run install() first.',
142
+ needsInstall: true
143
+ };
144
+ }
145
+
146
+ try {
147
+ const { onOutput, onError, timeoutMs = 300000 } = options;
148
+
149
+ return new Promise((resolve) => {
150
+ const startTime = Date.now();
151
+ let stdout = '';
152
+ let stderr = '';
153
+ let completed = false;
154
+ let timeoutKilled = false;
155
+ let lastOutputTime = Date.now();
156
+
157
+ // Spawn Claude Code in the repository directory
158
+ const proc = spawn('claude', ['code'], {
159
+ cwd: cwd,
160
+ stdio: ['pipe', 'pipe', 'pipe'],
161
+ env: { ...process.env }
162
+ });
163
+
164
+ this.runningProcesses.push(proc);
165
+
166
+ // Status update interval - show progress every 10 seconds if no output
167
+ const statusInterval = setInterval(() => {
168
+ const timeSinceOutput = (Date.now() - lastOutputTime) / 1000;
169
+ if (timeSinceOutput > 10) {
170
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(0);
171
+ const chalk = require('chalk');
172
+ const timestamp = getTimestamp();
173
+ console.log(chalk.yellow(`[${timestamp}] [CLAUDE] Still waiting... (${elapsed}s elapsed, ${timeSinceOutput.toFixed(0)}s since last output)`));
174
+ }
175
+ }, 10000);
176
+
177
+ // Hard timeout - kill process if it runs too long
178
+ const hardTimeout = setTimeout(() => {
179
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(0);
180
+ const chalk = require('chalk');
181
+ const timestamp = getTimestamp();
182
+ console.log(chalk.red(`\n[${timestamp}] ā° TIMEOUT: Claude Code process exceeded ${timeoutMs/1000}s limit (ran for ${elapsed}s)`));
183
+ console.log(chalk.red(`[${timestamp}] Killing Claude Code process to prevent hanging...`));
184
+ timeoutKilled = true;
185
+ completed = true;
186
+ clearInterval(statusInterval);
187
+ proc.kill('SIGTERM');
188
+ setTimeout(() => proc.kill('SIGKILL'), 2000); // Force kill after 2s
189
+ }, timeoutMs);
190
+
191
+ // Handle stdout
192
+ proc.stdout.on('data', (chunk) => {
193
+ const chunkText = chunk.toString();
194
+ stdout += chunkText;
195
+ lastOutputTime = Date.now();
196
+
197
+ // Filter and show useful output
198
+ const lines = chunkText.split('\n');
199
+ for (const line of lines) {
200
+ const trimmed = line.trim();
201
+ if (!trimmed) continue;
202
+
203
+ // Call output callback if provided
204
+ if (onOutput) {
205
+ onOutput(line + '\n');
206
+ } else {
207
+ // Fallback: write directly to stdout
208
+ try {
209
+ const chalk = require('chalk');
210
+ process.stdout.write(chalk.gray(line + '\n'));
211
+ } catch {
212
+ process.stdout.write(line + '\n');
213
+ }
214
+ }
215
+ }
216
+ });
217
+
218
+ // Handle stderr
219
+ proc.stderr.on('data', (chunk) => {
220
+ const chunkText = chunk.toString();
221
+ stderr += chunkText;
222
+
223
+ // Only show actual errors
224
+ if (chunkText.includes('Error:') || chunkText.includes('Failed:') || chunkText.includes('error')) {
225
+ if (onError) {
226
+ onError(chunkText.trim());
227
+ } else {
228
+ this.logger.error('[Claude Code Error]', chunkText.trim());
229
+ }
230
+ }
231
+ });
232
+
233
+ // Send the message and close stdin
234
+ proc.stdin.write(text + '\n');
235
+ proc.stdin.end();
236
+
237
+ // Handle process exit
238
+ proc.on('close', (code) => {
239
+ // Remove process from tracking array
240
+ const index = this.runningProcesses.indexOf(proc);
241
+ if (index > -1) {
242
+ this.runningProcesses.splice(index, 1);
243
+ }
244
+
245
+ clearInterval(statusInterval);
246
+ clearTimeout(hardTimeout);
247
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
248
+ const chalk = require('chalk');
249
+ const timestamp = getTimestamp();
250
+
251
+ if (timeoutKilled) {
252
+ console.log(chalk.red(`[${timestamp}] [CLAUDE] Process killed due to timeout after ${elapsed}s`));
253
+ resolve({
254
+ success: false,
255
+ output: stdout,
256
+ error: 'Timeout: Process exceeded maximum execution time',
257
+ exitCode: -1,
258
+ timeout: true
259
+ });
260
+ } else if (code === 0) {
261
+ console.log(chalk.gray(`[${timestamp}] [CLAUDE] Process completed after ${elapsed}s with code: ${code}`));
262
+ resolve({
263
+ success: true,
264
+ output: stdout,
265
+ stderr: stderr,
266
+ exitCode: code
267
+ });
268
+ } else {
269
+ console.log(chalk.gray(`[${timestamp}] [CLAUDE] Process closed after ${elapsed}s with code: ${code}`));
270
+ resolve({
271
+ success: false,
272
+ output: stdout,
273
+ error: stderr || `Process exited with code ${code}`,
274
+ exitCode: code
275
+ });
276
+ }
277
+ });
278
+
279
+ proc.on('error', (error) => {
280
+ clearInterval(statusInterval);
281
+ clearTimeout(hardTimeout);
282
+ completed = true;
283
+ const timestamp = getTimestamp();
284
+ console.log(`\n[${timestamp}] āœ— Claude Code error: ${error.message}`);
285
+ resolve({
286
+ success: false,
287
+ error: error.message,
288
+ exitCode: -1
289
+ });
290
+ });
291
+ });
292
+ } catch (error) {
293
+ return {
294
+ success: false,
295
+ error: error.message
296
+ };
297
+ }
298
+ }
299
+ }
300
+
301
+ module.exports = ClaudeCodeCLIManager;