vibecodingmachine-cli 2026.2.20-438 → 2026.2.26-1739
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/bin/auth/auth-compliance.js +126 -0
- package/bin/cli-program.js +104 -0
- package/bin/cli-setup.js +52 -0
- package/bin/commands/agent-commands.js +310 -0
- package/bin/commands/auto-commands.js +70 -0
- package/bin/commands/command-aliases.js +118 -0
- package/bin/commands/repo-commands.js +39 -0
- package/bin/commands/rui-commands.js +152 -0
- package/bin/config/cli-config.js +394 -0
- package/bin/init/environment-setup.js +84 -0
- package/bin/update/update-checker.js +126 -0
- package/bin/vibecodingmachine-new.js +50 -0
- package/bin/vibecodingmachine.js +29 -663
- package/package.json +8 -2
- package/src/commands/agents/add.js +277 -0
- package/src/commands/agents/check.js +380 -0
- package/src/commands/agents/list.js +471 -0
- package/src/commands/agents/remove.js +351 -0
- package/src/commands/analyze-file-sizes.js +428 -0
- package/src/commands/auto-direct/code-processor.js +282 -0
- package/src/commands/auto-direct/file-scanner.js +266 -0
- package/src/commands/auto-direct/provider-config.js +178 -0
- package/src/commands/auto-direct/provider-manager.js +219 -0
- package/src/commands/auto-direct/requirement-manager.js +172 -0
- package/src/commands/auto-direct/status-display.js +91 -0
- package/src/commands/auto-direct/utils.js +106 -0
- package/src/commands/auto-direct.js +875 -488
- package/src/commands/auto-execution.js +342 -0
- package/src/commands/auto-provider-management.js +102 -0
- package/src/commands/auto-requirement-management.js +161 -0
- package/src/commands/auto-status-helpers.js +141 -0
- package/src/commands/auto.js +105 -5155
- package/src/commands/check-compliance.js +536 -0
- package/src/commands/continuous-scan.js +119 -0
- package/src/commands/ide.js +16 -4
- package/src/commands/refactor-file.js +486 -0
- package/src/commands/requirements.js +301 -2
- package/src/commands/timeout.js +290 -0
- package/src/trui/TruiInterface.js +108 -0
- package/src/trui/agents/AgentInterface.js +580 -0
- package/src/utils/antigravity-installer.js +60 -6
- package/src/utils/clarification-actions.js +290 -0
- package/src/utils/config.js +123 -2
- package/src/utils/first-run.js +5 -5
- package/src/utils/ide-handlers.js +212 -0
- package/src/utils/interactive/clarification-actions.js +348 -0
- package/src/utils/interactive/core-ui.js +265 -0
- package/src/utils/interactive/file-backup.js +237 -0
- package/src/utils/interactive/file-import-export.js +305 -0
- package/src/utils/interactive/file-operations.js +49 -0
- package/src/utils/interactive/file-validation.js +276 -0
- package/src/utils/interactive/interactive-prompts.js +480 -0
- package/src/utils/interactive/requirement-actions.js +127 -0
- package/src/utils/interactive/requirement-crud.js +356 -0
- package/src/utils/interactive/requirements-navigation.js +286 -0
- package/src/utils/interactive.js +390 -3459
- package/src/utils/provider-checker/agent-checker.js +250 -0
- package/src/utils/provider-checker/agent-runner.js +450 -0
- package/src/utils/provider-checker/cli-installer.js +123 -0
- package/src/utils/provider-checker/cli-utils.js +15 -0
- package/src/utils/provider-checker/format-utils.js +32 -0
- package/src/utils/provider-checker/ide-manager.js +72 -0
- package/src/utils/provider-checker/ide-utils.js +71 -0
- package/src/utils/provider-checker/node-detector.js +56 -0
- package/src/utils/provider-checker/node-utils.js +61 -0
- package/src/utils/provider-checker/process-spawn.js +22 -0
- package/src/utils/provider-checker/process-utils.js +37 -0
- package/src/utils/provider-checker/provider-validator.js +160 -0
- package/src/utils/provider-checker/quota-checker.js +54 -0
- package/src/utils/provider-checker/quota-detector.js +44 -0
- package/src/utils/provider-checker/requirements-manager.js +94 -0
- package/src/utils/provider-checker/test-requirements.js +95 -0
- package/src/utils/provider-checker/time-formatter.js +18 -0
- package/src/utils/provider-checker-new.js +14 -0
- package/src/utils/provider-checker.js +12 -407
- package/src/utils/provider-checkers/ide-manager.js +128 -0
- package/src/utils/provider-checkers/node-executable-finder.js +51 -0
- package/src/utils/provider-checkers/provider-checker-core.js +172 -0
- package/src/utils/provider-checkers/provider-checker-main.js +107 -0
- package/src/utils/provider-manager.js +60 -4
- package/src/utils/provider-registry.js +26 -3
- package/src/utils/provider-utils.js +173 -0
- package/src/utils/quota-detectors.js +212 -0
- package/src/utils/requirement-action-handlers.js +288 -0
- package/src/utils/requirement-actions/clarification-actions.js +229 -0
- package/src/utils/requirement-actions/confirmation-prompts.js +93 -0
- package/src/utils/requirement-actions/file-operations.js +92 -0
- package/src/utils/requirement-actions/helpers.js +40 -0
- package/src/utils/requirement-actions/requirement-operations.js +335 -0
- package/src/utils/requirement-actions.js +46 -856
- package/src/utils/requirement-file-operations.js +259 -0
- package/src/utils/requirement-helpers.js +128 -0
- package/src/utils/requirement-management.js +279 -0
- package/src/utils/requirement-navigation.js +146 -0
- package/src/utils/requirement-organization.js +271 -0
- package/src/utils/simple-trui.js +75 -1
- package/src/utils/trui-navigation.js +28 -2
- package/src/utils/trui-req-tree.js +196 -11
- package/src/utils/trui-specifications.js +31 -1
- package/src/utils/interactive-backup.js +0 -5664
- package/src/utils/trui-provider-manager.js +0 -182
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const ora = require('ora');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const { spawn } = require('child_process');
|
|
6
|
+
const { logIDEMessage, runContinueCLIAutoMode, t, IDEHealthTracker } = require('vibecodingmachine-core');
|
|
7
|
+
const { getRepoPath, getAutoConfig, setAutoConfig, getStages } = require('../utils/config');
|
|
8
|
+
const { checkAutoModeStatus, startAutoMode, stopAutoMode, updateAutoModeStatus } = require('../utils/auto-mode');
|
|
9
|
+
const logger = require('../utils/logger');
|
|
10
|
+
const { createKeyboardHandler } = require('../utils/keyboard-handler');
|
|
11
|
+
const { getProviderDefinitions, getProviderPreferences } = require('../utils/provider-registry');
|
|
12
|
+
|
|
13
|
+
// Import our modular components
|
|
14
|
+
const { getAvailableProviders } = require('./auto-provider-management');
|
|
15
|
+
const {
|
|
16
|
+
isRequirementDone,
|
|
17
|
+
moveRequirementBackToTodo,
|
|
18
|
+
moveRequirementToFeedback,
|
|
19
|
+
moveCompletedRequirement,
|
|
20
|
+
getCurrentRequirementDetails,
|
|
21
|
+
getRequirementCounts
|
|
22
|
+
} = require('./auto-requirement-management');
|
|
23
|
+
const { getTimestamp, printStatusCard, updateRequirementsStatus } = require('./auto-status-helpers');
|
|
24
|
+
|
|
25
|
+
const PROVIDER_DEFINITIONS = getProviderDefinitions();
|
|
26
|
+
const PROVIDER_DEFINITION_MAP = new Map(PROVIDER_DEFINITIONS.map(def => [def.id, def]));
|
|
27
|
+
const { handleAutoStart: handleDirectAutoStart } = require('./auto-direct');
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Auto Execution Logic Module for Auto Command
|
|
31
|
+
* Handles the main auto-mode execution flow
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Start auto mode execution
|
|
36
|
+
* @param {Object} options - Command options
|
|
37
|
+
*/
|
|
38
|
+
async function start(options) {
|
|
39
|
+
// First Run Check
|
|
40
|
+
try {
|
|
41
|
+
const { checkFirstRun } = require('../utils/first-run');
|
|
42
|
+
await checkFirstRun();
|
|
43
|
+
} catch (e) {
|
|
44
|
+
// Continue if check fails
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// STRICT AUTH CHECK
|
|
48
|
+
const auth = require('../utils/auth');
|
|
49
|
+
const isAuth = await auth.isAuthenticated();
|
|
50
|
+
if (!isAuth) {
|
|
51
|
+
console.log(chalk.red('❌ Authentication required. Please run: vcm auth'));
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const repoPath = getRepoPath();
|
|
56
|
+
const config = getAutoConfig(repoPath);
|
|
57
|
+
const stages = getStages(repoPath);
|
|
58
|
+
|
|
59
|
+
// Validate config
|
|
60
|
+
if (!config || !config.providers || config.providers.length === 0) {
|
|
61
|
+
console.log(chalk.red('❌ No providers configured. Please run: vcm auto:config'));
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Check if auto mode is already running
|
|
66
|
+
const autoStatus = checkAutoModeStatus(repoPath);
|
|
67
|
+
if (autoStatus.isRunning) {
|
|
68
|
+
console.log(chalk.yellow('⚠️ Auto mode is already running'));
|
|
69
|
+
console.log(chalk.gray(` Started: ${autoStatus.startTime}`));
|
|
70
|
+
console.log(chalk.gray(` PID: ${autoStatus.pid}`));
|
|
71
|
+
console.log(chalk.gray(' To stop: vcm auto:stop'));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
console.log(chalk.blue('🚀 Starting Vibe Coding Machine Auto Mode...\n'));
|
|
76
|
+
|
|
77
|
+
// Display configuration
|
|
78
|
+
console.log(chalk.cyan('Configuration:'));
|
|
79
|
+
console.log(chalk.gray(' Repository:'), chalk.white(repoPath));
|
|
80
|
+
console.log(chalk.gray(' Providers:'), chalk.white(config.providers.map(p => p.provider).join(', ')));
|
|
81
|
+
console.log(chalk.gray(' Max chats:'), chalk.white(config.maxChats || 'unlimited'));
|
|
82
|
+
console.log(chalk.gray(' Never stop:'), chalk.white(config.neverStop ? 'yes' : 'no'));
|
|
83
|
+
console.log();
|
|
84
|
+
|
|
85
|
+
// Start auto mode
|
|
86
|
+
try {
|
|
87
|
+
await startAutoMode(repoPath, {
|
|
88
|
+
providers: config.providers,
|
|
89
|
+
maxChats: config.maxChats,
|
|
90
|
+
neverStop: config.neverStop
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Main auto mode loop
|
|
94
|
+
await runAutoModeLoop(repoPath, config, stages);
|
|
95
|
+
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error(chalk.red('Error starting auto mode:'), error.message);
|
|
98
|
+
await stopAutoMode(repoPath);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Main auto mode execution loop
|
|
105
|
+
* @param {string} repoPath - Repository path
|
|
106
|
+
* @param {Object} config - Auto configuration
|
|
107
|
+
* @param {Object} stages - Stages configuration
|
|
108
|
+
*/
|
|
109
|
+
async function runAutoModeLoop(repoPath, config, stages) {
|
|
110
|
+
let chatCount = 0;
|
|
111
|
+
const maxChats = config.maxChats;
|
|
112
|
+
const neverStop = config.neverStop;
|
|
113
|
+
|
|
114
|
+
// Create keyboard handler for graceful shutdown
|
|
115
|
+
const keyboardHandler = createKeyboardHandler({
|
|
116
|
+
onExit: async () => {
|
|
117
|
+
console.log(chalk.yellow('\n🛑 Stopping auto mode...'));
|
|
118
|
+
await stopAutoMode(repoPath);
|
|
119
|
+
process.exit(0);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
keyboardHandler.start();
|
|
124
|
+
|
|
125
|
+
console.log(chalk.green('✅ Auto mode started successfully'));
|
|
126
|
+
console.log(chalk.gray(` To stop: Press `) + chalk.white.bold('x') + chalk.gray(' or ') + chalk.white.bold('Ctrl+C') + chalk.gray(', or run \'vcm auto:stop\''));
|
|
127
|
+
console.log();
|
|
128
|
+
|
|
129
|
+
// Main execution loop
|
|
130
|
+
while ((neverStop || (maxChats && chatCount < maxChats))) {
|
|
131
|
+
try {
|
|
132
|
+
// Get current requirement details
|
|
133
|
+
const { title: currentTitle, status: currentStatus } = await getCurrentRequirementDetails(repoPath);
|
|
134
|
+
|
|
135
|
+
// Display status card
|
|
136
|
+
printStatusCard(currentTitle, currentStatus);
|
|
137
|
+
|
|
138
|
+
// Check if requirement is done
|
|
139
|
+
const requirementStatus = await isRequirementDone(repoPath);
|
|
140
|
+
if (requirementStatus.isDone && requirementStatus.actuallyComplete) {
|
|
141
|
+
console.log(chalk.green(`✅ Requirement completed: ${currentTitle}`));
|
|
142
|
+
|
|
143
|
+
// Move to next requirement
|
|
144
|
+
await moveToNextRequirement(repoPath);
|
|
145
|
+
chatCount++;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Execute current stage
|
|
150
|
+
const stageResult = await executeCurrentStage(repoPath, currentStatus, currentTitle);
|
|
151
|
+
if (!stageResult.success) {
|
|
152
|
+
console.error(chalk.red('Stage execution failed:'), stageResult.error);
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
chatCount++;
|
|
157
|
+
|
|
158
|
+
// Check if we should continue
|
|
159
|
+
if (!neverStop && maxChats && chatCount >= maxChats) {
|
|
160
|
+
console.log(chalk.yellow(`🏁 Reached maximum chat limit (${maxChats})`));
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Wait before next iteration
|
|
165
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
166
|
+
|
|
167
|
+
} catch (error) {
|
|
168
|
+
console.error(chalk.red('Error in auto mode loop:'), error.message);
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Cleanup
|
|
174
|
+
keyboardHandler.stop();
|
|
175
|
+
await stopAutoMode(repoPath);
|
|
176
|
+
console.log(chalk.green('\n🏁 Auto mode stopped'));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Execute the current stage based on status
|
|
181
|
+
* @param {string} repoPath - Repository path
|
|
182
|
+
* @param {string} currentStatus - Current status
|
|
183
|
+
* @param {string} currentTitle - Current requirement title
|
|
184
|
+
* @returns {Promise<{success: boolean, error?: string}>}
|
|
185
|
+
*/
|
|
186
|
+
async function executeCurrentStage(repoPath, currentStatus, currentTitle) {
|
|
187
|
+
try {
|
|
188
|
+
switch (currentStatus) {
|
|
189
|
+
case 'PREPARE':
|
|
190
|
+
return await executePrepareStage(repoPath, currentTitle);
|
|
191
|
+
case 'CREATE':
|
|
192
|
+
return await executeCreateStage(repoPath, currentTitle);
|
|
193
|
+
case 'CLEAN_UP':
|
|
194
|
+
return await executeCleanUpStage(repoPath, currentTitle);
|
|
195
|
+
case 'VERIFY':
|
|
196
|
+
return await executeVerifyStage(repoPath, currentTitle);
|
|
197
|
+
case 'NOT_WORKING':
|
|
198
|
+
return await executeNotWorkingStage(repoPath, currentTitle);
|
|
199
|
+
default:
|
|
200
|
+
return { success: false, error: `Unknown status: ${currentStatus}` };
|
|
201
|
+
}
|
|
202
|
+
} catch (error) {
|
|
203
|
+
return { success: false, error: error.message };
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Execute PREPARE stage
|
|
209
|
+
* @param {string} repoPath - Repository path
|
|
210
|
+
* @param {string} currentTitle - Current requirement title
|
|
211
|
+
* @returns {Promise<{success: boolean, error?: string}>}
|
|
212
|
+
*/
|
|
213
|
+
async function executePrepareStage(repoPath, currentTitle) {
|
|
214
|
+
console.log(chalk.cyan(`\n[${getTimestamp()}] 🔨 PREPARE: ${currentTitle}`));
|
|
215
|
+
|
|
216
|
+
// Update status to CREATE
|
|
217
|
+
const updateResult = await updateRequirementsStatus(repoPath, 'CREATE', `Starting implementation of: ${currentTitle}`);
|
|
218
|
+
if (!updateResult.success) {
|
|
219
|
+
return updateResult;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
console.log(chalk.green('✅ Preparation complete'));
|
|
223
|
+
return { success: true };
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Execute CREATE stage
|
|
228
|
+
* @param {string} repoPath - Repository path
|
|
229
|
+
* @param {string} currentTitle - Current requirement title
|
|
230
|
+
* @returns {Promise<{success: boolean, error?: string}>}
|
|
231
|
+
*/
|
|
232
|
+
async function executeCreateStage(repoPath, currentTitle) {
|
|
233
|
+
console.log(chalk.cyan(`\n[${getTimestamp()}] 🛠️ CREATE: ${currentTitle}`));
|
|
234
|
+
|
|
235
|
+
// This would integrate with the AI provider to implement the requirement
|
|
236
|
+
// For now, we'll simulate the implementation
|
|
237
|
+
console.log(chalk.blue('🤖 Implementing requirement...'));
|
|
238
|
+
|
|
239
|
+
// Simulate work
|
|
240
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
241
|
+
|
|
242
|
+
// Update status to CLEAN_UP
|
|
243
|
+
const updateResult = await updateRequirementsStatus(repoPath, 'CLEAN_UP', `Implementation complete for: ${currentTitle}`);
|
|
244
|
+
if (!updateResult.success) {
|
|
245
|
+
return updateResult;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
console.log(chalk.green('✅ Implementation complete'));
|
|
249
|
+
return { success: true };
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Execute CLEAN_UP stage
|
|
254
|
+
* @param {string} repoPath - Repository path
|
|
255
|
+
* @param {string} currentTitle - Current requirement title
|
|
256
|
+
* @returns {Promise<{success: boolean, error?: string}>}
|
|
257
|
+
*/
|
|
258
|
+
async function executeCleanUpStage(repoPath, currentTitle) {
|
|
259
|
+
console.log(chalk.cyan(`\n[${getTimestamp()}] 🧹 CLEAN_UP: ${currentTitle}`));
|
|
260
|
+
|
|
261
|
+
// Run linting, cleanup, etc.
|
|
262
|
+
console.log(chalk.blue('🧹 Running code cleanup...'));
|
|
263
|
+
|
|
264
|
+
// Simulate cleanup work
|
|
265
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
266
|
+
|
|
267
|
+
// Update status to VERIFY
|
|
268
|
+
const updateResult = await updateRequirementsStatus(repoPath, 'VERIFY', `Cleanup complete for: ${currentTitle}`);
|
|
269
|
+
if (!updateResult.success) {
|
|
270
|
+
return updateResult;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
console.log(chalk.green('✅ Cleanup complete'));
|
|
274
|
+
return { success: true };
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Execute VERIFY stage
|
|
279
|
+
* @param {string} repoPath - Repository path
|
|
280
|
+
* @param {string} currentTitle - Current requirement title
|
|
281
|
+
* @returns {Promise<{success: boolean, error?: string}>}
|
|
282
|
+
*/
|
|
283
|
+
async function executeVerifyStage(repoPath, currentTitle) {
|
|
284
|
+
console.log(chalk.cyan(`\n[${getTimestamp()}] ✅ VERIFY: ${currentTitle}`));
|
|
285
|
+
|
|
286
|
+
// Run tests, verification, etc.
|
|
287
|
+
console.log(chalk.blue('🔍 Running verification...'));
|
|
288
|
+
|
|
289
|
+
// Simulate verification work
|
|
290
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
291
|
+
|
|
292
|
+
// Update status to DONE
|
|
293
|
+
const updateResult = await updateRequirementsStatus(repoPath, 'DONE', `Verification complete for: ${currentTitle}`);
|
|
294
|
+
if (!updateResult.success) {
|
|
295
|
+
return updateResult;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
console.log(chalk.green('✅ Verification complete'));
|
|
299
|
+
return { success: true };
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Execute NOT_WORKING stage
|
|
304
|
+
* @param {string} repoPath - Repository path
|
|
305
|
+
* @param {string} currentTitle - Current requirement title
|
|
306
|
+
* @returns {Promise<{success: boolean, error?: string}>}
|
|
307
|
+
*/
|
|
308
|
+
async function executeNotWorkingStage(repoPath, currentTitle) {
|
|
309
|
+
console.log(chalk.red(`\n[${getTimestamp()}] ❌ NOT_WORKING: ${currentTitle}`));
|
|
310
|
+
|
|
311
|
+
// Move requirement to feedback section
|
|
312
|
+
const moveResult = await moveRequirementToFeedback(
|
|
313
|
+
repoPath,
|
|
314
|
+
currentTitle,
|
|
315
|
+
'Requirement marked as not working during auto mode execution'
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
if (!moveResult.success) {
|
|
319
|
+
return moveResult;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
console.log(chalk.yellow('📝 Requirement moved to feedback section'));
|
|
323
|
+
return { success: true };
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Move to the next requirement
|
|
328
|
+
* @param {string} repoPath - Repository path
|
|
329
|
+
* @returns {Promise<{success: boolean, error?: string}>}
|
|
330
|
+
*/
|
|
331
|
+
async function moveToNextRequirement(repoPath) {
|
|
332
|
+
// This would handle the logic to move to the next requirement
|
|
333
|
+
// For now, we'll just log that we're moving to the next requirement
|
|
334
|
+
console.log(chalk.blue('🔄 Moving to next requirement...'));
|
|
335
|
+
return { success: true };
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
module.exports = {
|
|
339
|
+
start,
|
|
340
|
+
executeCurrentStage,
|
|
341
|
+
runAutoModeLoop
|
|
342
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const { getProviderDefinitions } = require('../utils/provider-registry');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Provider Management Module for Auto Command
|
|
6
|
+
* Handles LLM provider operations and quota management
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Get available LLM providers from config and environment variables
|
|
11
|
+
* @param {Object} savedConfig - Config object from getAutoConfig()
|
|
12
|
+
* @returns {Array<{provider: string, model: string, apiKey?: string}>}
|
|
13
|
+
*/
|
|
14
|
+
function getAvailableProviders(savedConfig) {
|
|
15
|
+
const AutoModeBusinessLogic = require('vibecodingmachine-core/src/auto-mode/AutoModeBusinessLogic');
|
|
16
|
+
const autoModeLogic = new AutoModeBusinessLogic();
|
|
17
|
+
return autoModeLogic.getAvailableProviders(savedConfig);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* List all available agents with their quota status
|
|
22
|
+
*/
|
|
23
|
+
async function listAgents() {
|
|
24
|
+
const ProviderManager = require('vibecodingmachine-core/src/ide-integration/provider-manager.cjs');
|
|
25
|
+
const providerManager = new ProviderManager();
|
|
26
|
+
|
|
27
|
+
console.log(chalk.blue('\n📋 Available IDE Agents and Quota Status:\n'));
|
|
28
|
+
|
|
29
|
+
const formatTimeAmPm = (date) => {
|
|
30
|
+
const hours24 = date.getHours();
|
|
31
|
+
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
32
|
+
const ampm = hours24 >= 12 ? 'pm' : 'am';
|
|
33
|
+
const hours12 = (hours24 % 12) || 12;
|
|
34
|
+
return `${hours12}:${minutes} ${ampm}`;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const { formatResetsAtLabel } = require('../utils/date-formatter');
|
|
38
|
+
|
|
39
|
+
// Get all provider definitions
|
|
40
|
+
const providers = getProviderDefinitions();
|
|
41
|
+
|
|
42
|
+
// Check each provider's quota status
|
|
43
|
+
for (const provider of providers) {
|
|
44
|
+
const hasSubAgents = Array.isArray(provider.subAgents) && provider.subAgents.length > 0;
|
|
45
|
+
const rateLimitInfo = hasSubAgents ? { isRateLimited: false } : providerManager.getRateLimitInfo(provider.id);
|
|
46
|
+
|
|
47
|
+
let statusIcon = '✅';
|
|
48
|
+
let statusText = chalk.green('Available');
|
|
49
|
+
let quotaInfo = '';
|
|
50
|
+
|
|
51
|
+
if (rateLimitInfo.isRateLimited) {
|
|
52
|
+
statusIcon = '⚠️';
|
|
53
|
+
statusText = chalk.yellow('Quota Limit');
|
|
54
|
+
|
|
55
|
+
if (rateLimitInfo.resetTime) {
|
|
56
|
+
const label = formatResetsAtLabel(rateLimitInfo.resetTime);
|
|
57
|
+
quotaInfo = label ? chalk.gray(` (${label})`) : '';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (rateLimitInfo.reason) {
|
|
61
|
+
quotaInfo += chalk.gray(` - ${rateLimitInfo.reason}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
console.log(`${statusIcon} ${chalk.cyan(provider.name)} ${statusText}${quotaInfo}`);
|
|
66
|
+
if (provider.description) {
|
|
67
|
+
console.log(` ${chalk.gray(provider.description)}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// If provider has sub-agents, show them under the provider row
|
|
71
|
+
if (hasSubAgents) {
|
|
72
|
+
for (const sub of provider.subAgents) {
|
|
73
|
+
const subInfo = providerManager.getRateLimitInfo(provider.id, sub.model);
|
|
74
|
+
|
|
75
|
+
let subStatusIcon = '✅';
|
|
76
|
+
let subStatusText = chalk.green('Available');
|
|
77
|
+
let subQuotaInfo = '';
|
|
78
|
+
|
|
79
|
+
if (subInfo.isRateLimited) {
|
|
80
|
+
subStatusIcon = '⚠️';
|
|
81
|
+
subStatusText = chalk.yellow('Quota Limit');
|
|
82
|
+
if (subInfo.resetTime) {
|
|
83
|
+
const label = formatResetsAtLabel(subInfo.resetTime);
|
|
84
|
+
subQuotaInfo = label ? chalk.gray(` (${label})`) : '';
|
|
85
|
+
}
|
|
86
|
+
if (subInfo.reason) {
|
|
87
|
+
subQuotaInfo += chalk.gray(` - ${subInfo.reason}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
console.log(` ${subStatusIcon} ${chalk.cyan(sub.name)} ${subStatusText}${subQuotaInfo}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
console.log(chalk.gray('\n💡 Tip: Auto mode will automatically skip quota-limited agents\n'));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
module.exports = {
|
|
100
|
+
getAvailableProviders,
|
|
101
|
+
listAgents
|
|
102
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Requirement Management Module for Auto Command
|
|
3
|
+
* Handles requirement operations and status tracking
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Check if current requirement is DONE and actually completed
|
|
8
|
+
* @param {string} repoPath - Repository path
|
|
9
|
+
* @returns {Promise<{isDone: boolean, actuallyComplete: boolean, reason?: string}>}
|
|
10
|
+
*/
|
|
11
|
+
async function isRequirementDone(repoPath) {
|
|
12
|
+
const AutoModeBusinessLogic = require('vibecodingmachine-core/src/auto-mode/AutoModeBusinessLogic');
|
|
13
|
+
const autoModeLogic = new AutoModeBusinessLogic();
|
|
14
|
+
return autoModeLogic.isRequirementDone(repoPath);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Move a requirement from Verified back to Requirements not yet completed
|
|
19
|
+
* @param {string} repoPath - Repository path
|
|
20
|
+
* @param {string} requirementText - The requirement text to move back
|
|
21
|
+
* @returns {Promise<{success: boolean, error?: string}>}
|
|
22
|
+
*/
|
|
23
|
+
async function moveRequirementBackToTodo(repoPath, requirementText) {
|
|
24
|
+
const AutoModeBusinessLogic = require('vibecodingmachine-core/src/auto-mode/AutoModeBusinessLogic');
|
|
25
|
+
const autoModeLogic = new AutoModeBusinessLogic();
|
|
26
|
+
return autoModeLogic.moveRequirementBackToTodo(repoPath, requirementText);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Move a requirement from TODO to "Requirements needing manual feedback" section
|
|
31
|
+
* @param {string} repoPath - Repository path
|
|
32
|
+
* @param {string} requirementText - The requirement text to move
|
|
33
|
+
* @param {string} questions - Clarifying questions to add
|
|
34
|
+
* @returns {Promise<{success: boolean, error?: string}>}
|
|
35
|
+
*/
|
|
36
|
+
async function moveRequirementToFeedback(repoPath, requirementText, questions, findings = null) {
|
|
37
|
+
const AutoModeBusinessLogic = require('vibecodingmachine-core/src/auto-mode/AutoModeBusinessLogic');
|
|
38
|
+
const autoModeLogic = new AutoModeBusinessLogic();
|
|
39
|
+
return autoModeLogic.moveRequirementToFeedback(repoPath, requirementText, questions, findings);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Move completed requirement from TODO to TO VERIFY section (for human verification)
|
|
44
|
+
* @param {string} repoPath - Repository path
|
|
45
|
+
* @param {string} completedRequirement - The completed requirement text
|
|
46
|
+
* @returns {Promise<{success: boolean, error?: string}>}
|
|
47
|
+
*/
|
|
48
|
+
async function moveCompletedRequirement(repoPath, completedRequirement) {
|
|
49
|
+
const AutoModeBusinessLogic = require('vibecodingmachine-core/src/auto-mode/AutoModeBusinessLogic');
|
|
50
|
+
const autoModeLogic = new AutoModeBusinessLogic();
|
|
51
|
+
return autoModeLogic.moveCompletedRequirement(repoPath, completedRequirement);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Get current requirement details from REQUIREMENTS file
|
|
56
|
+
* @param {string} repoPath - Repository path
|
|
57
|
+
* @returns {Promise<{title: string, status: string}>}
|
|
58
|
+
*/
|
|
59
|
+
async function getCurrentRequirementDetails(repoPath) {
|
|
60
|
+
const { getRequirementsPath } = require('vibecodingmachine-core');
|
|
61
|
+
const fs = require('fs-extra');
|
|
62
|
+
const reqPath = await getRequirementsPath(repoPath);
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
const content = await fs.readFile(reqPath, 'utf8');
|
|
66
|
+
const lines = content.split('\n');
|
|
67
|
+
|
|
68
|
+
// Find the "🔨 Current In Progress Requirement" section
|
|
69
|
+
let currentSectionIndex = -1;
|
|
70
|
+
for (let i = 0; i < lines.length; i++) {
|
|
71
|
+
if (lines[i].includes('🔨 Current In Progress Requirement')) {
|
|
72
|
+
currentSectionIndex = i;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (currentSectionIndex === -1) {
|
|
78
|
+
return { title: 'No current requirement found', status: 'UNKNOWN' };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Look for the next requirement after the section header
|
|
82
|
+
for (let i = currentSectionIndex + 1; i < lines.length; i++) {
|
|
83
|
+
const line = lines[i].trim();
|
|
84
|
+
if (line.startsWith('- ')) {
|
|
85
|
+
const title = line.substring(2).trim();
|
|
86
|
+
|
|
87
|
+
// Look for status in the next few lines
|
|
88
|
+
let status = 'UNKNOWN';
|
|
89
|
+
for (let j = i + 1; j < Math.min(i + 10, lines.length); j++) {
|
|
90
|
+
if (lines[j].includes('🚦 Current Status')) {
|
|
91
|
+
const statusMatch = lines[j].match(/\[([A-Z_]+)\]/);
|
|
92
|
+
if (statusMatch) {
|
|
93
|
+
status = statusMatch[1];
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return { title, status };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return { title: 'No current requirement found', status: 'UNKNOWN' };
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.error('Error reading requirements file:', error);
|
|
106
|
+
return { title: 'Error reading requirements', status: 'ERROR' };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Count requirements in each section
|
|
112
|
+
* @param {string} repoPath - Repository path
|
|
113
|
+
* @returns {Promise<{todo: number, inProgress: number, verified: number, feedback: number}>}
|
|
114
|
+
*/
|
|
115
|
+
async function getRequirementCounts(repoPath) {
|
|
116
|
+
const { getRequirementsPath, getVibeCodingMachineDir } = require('vibecodingmachine-core');
|
|
117
|
+
const fs = require('fs-extra');
|
|
118
|
+
const reqPath = await getRequirementsPath(repoPath);
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
const content = await fs.readFile(reqPath, 'utf8');
|
|
122
|
+
const lines = content.split('\n');
|
|
123
|
+
|
|
124
|
+
const counts = {
|
|
125
|
+
todo: 0,
|
|
126
|
+
inProgress: 0,
|
|
127
|
+
verified: 0,
|
|
128
|
+
feedback: 0
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
let currentSection = '';
|
|
132
|
+
|
|
133
|
+
for (const line of lines) {
|
|
134
|
+
if (line.includes('Requirements not yet completed')) {
|
|
135
|
+
currentSection = 'todo';
|
|
136
|
+
} else if (line.includes('🔨 Current In Progress Requirement')) {
|
|
137
|
+
currentSection = 'inProgress';
|
|
138
|
+
} else if (line.includes('Verified by AI screenshot')) {
|
|
139
|
+
currentSection = 'verified';
|
|
140
|
+
} else if (line.includes('Requirements needing manual feedback')) {
|
|
141
|
+
currentSection = 'feedback';
|
|
142
|
+
} else if (line.trim().startsWith('- ') && currentSection) {
|
|
143
|
+
counts[currentSection]++;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return counts;
|
|
148
|
+
} catch (error) {
|
|
149
|
+
console.error('Error counting requirements:', error);
|
|
150
|
+
return { todo: 0, inProgress: 0, verified: 0, feedback: 0 };
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
module.exports = {
|
|
155
|
+
isRequirementDone,
|
|
156
|
+
moveRequirementBackToTodo,
|
|
157
|
+
moveRequirementToFeedback,
|
|
158
|
+
moveCompletedRequirement,
|
|
159
|
+
getCurrentRequirementDetails,
|
|
160
|
+
getRequirementCounts
|
|
161
|
+
};
|