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,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Requirement management functions for auto-direct command
|
|
3
|
+
* Extracted from auto-direct.js to reduce file size
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const fs = require('fs-extra');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const { getRequirementsPath, readRequirements } = require('vibecodingmachine-core');
|
|
9
|
+
const chalk = require('chalk');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Update requirements file status
|
|
13
|
+
* @param {string} repoPath - Repository path
|
|
14
|
+
* @param {string} status - Status to set (PREPARE, ACT, CLEAN UP, VERIFY, DONE)
|
|
15
|
+
*/
|
|
16
|
+
async function updateRequirementsStatus(repoPath, status) {
|
|
17
|
+
try {
|
|
18
|
+
const reqPath = await getRequirementsPath(repoPath);
|
|
19
|
+
if (!reqPath || !await fs.pathExists(reqPath)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let content = await fs.readFile(reqPath, 'utf8');
|
|
24
|
+
|
|
25
|
+
// Find and replace the status section
|
|
26
|
+
const statusSectionRegex = /## 🚦 Current Status\s*\n\s*\n(.+?)(?=\n##|\n$)/s;
|
|
27
|
+
const match = content.match(statusSectionRegex);
|
|
28
|
+
|
|
29
|
+
if (match) {
|
|
30
|
+
content = content.replace(statusSectionRegex, `## 🚦 Current Status\n\n${status}`);
|
|
31
|
+
} else {
|
|
32
|
+
// If no status section found, add it after the first line
|
|
33
|
+
const lines = content.split('\n');
|
|
34
|
+
lines.splice(1, 0, '', '## 🚦 Current Status', '', status);
|
|
35
|
+
content = lines.join('\n');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
await fs.writeFile(reqPath, content);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.error('Error updating requirements status:', error.message);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get current requirement from REQUIREMENTS file
|
|
46
|
+
*/
|
|
47
|
+
async function getCurrentRequirement(repoPath) {
|
|
48
|
+
try {
|
|
49
|
+
const reqPath = await getRequirementsPath(repoPath);
|
|
50
|
+
if (!reqPath || !await fs.pathExists(reqPath)) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const content = await fs.readFile(reqPath, 'utf8');
|
|
55
|
+
const currentSection = content.match(/## 🔨 Current In Progress Requirement\s*\n([\s\S]*?)(?=\n## |\n$)/);
|
|
56
|
+
|
|
57
|
+
if (currentSection) {
|
|
58
|
+
return currentSection[1].trim();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return null;
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error('Error getting current requirement:', error.message);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Count total TODO requirements
|
|
70
|
+
*/
|
|
71
|
+
async function countTodoRequirements(repoPath) {
|
|
72
|
+
try {
|
|
73
|
+
const reqPath = await getRequirementsPath(repoPath);
|
|
74
|
+
if (!reqPath || !await fs.pathExists(reqPath)) {
|
|
75
|
+
return 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const content = await fs.readFile(reqPath, 'utf8');
|
|
79
|
+
const todoSection = content.match(/## Requirements not yet completed\s*\n([\s\S]*?)(?=\n## |\n$)/);
|
|
80
|
+
|
|
81
|
+
if (todoSection) {
|
|
82
|
+
const todoItems = todoSection[1].match(/^- \[ \]/g);
|
|
83
|
+
return todoItems ? todoItems.length : 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return 0;
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.error('Error counting TODO requirements:', error.message);
|
|
89
|
+
return 0;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Move requirement from TODO to TO VERIFY BY HUMAN
|
|
95
|
+
*/
|
|
96
|
+
async function moveRequirementToVerify(repoPath, requirementText) {
|
|
97
|
+
try {
|
|
98
|
+
const reqPath = await getRequirementsPath(repoPath);
|
|
99
|
+
if (!reqPath || !await fs.pathExists(reqPath)) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
let content = await fs.readFile(reqPath, 'utf8');
|
|
104
|
+
|
|
105
|
+
// Remove from TODO section
|
|
106
|
+
const todoSection = content.match(/## Requirements not yet completed\s*\n([\s\S]*?)(?=\n## |\n$)/);
|
|
107
|
+
if (todoSection) {
|
|
108
|
+
const updatedTodo = todoSection[1].replace(new RegExp(`- \\[ \\] ${escapeRegExp(requirementText)}`, 'g'), '');
|
|
109
|
+
content = content.replace(todoSection[0], `## Requirements not yet completed\n${updatedTodo}`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Add to verify section
|
|
113
|
+
const verifySection = content.match(/## Verified by AI screenshot\. Needs Human to Verify and move to CHANGELOG\s*\n([\s\S]*?)(?=\n## |\n$)/);
|
|
114
|
+
if (verifySection) {
|
|
115
|
+
const newVerifyItem = `- [ ] ${requirementText}`;
|
|
116
|
+
const updatedVerify = verifySection[1] + '\n' + newVerifyItem;
|
|
117
|
+
content = content.replace(verifySection[0], `## Verified by AI screenshot. Needs Human to Verify and move to CHANGELOG\n${updatedVerify}`);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
await fs.writeFile(reqPath, content);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error('Error moving requirement to verify:', error.message);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Move requirement to recycled section
|
|
128
|
+
*/
|
|
129
|
+
async function moveRequirementToRecycle(repoPath, requirementText) {
|
|
130
|
+
try {
|
|
131
|
+
const reqPath = await getRequirementsPath(repoPath);
|
|
132
|
+
if (!reqPath || !await fs.pathExists(reqPath)) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
let content = await fs.readFile(reqPath, 'utf8');
|
|
137
|
+
|
|
138
|
+
// Remove from TODO section
|
|
139
|
+
const todoSection = content.match(/## Requirements not yet completed\s*\n([\s\S]*?)(?=\n## |\n$)/);
|
|
140
|
+
if (todoSection) {
|
|
141
|
+
const updatedTodo = todoSection[1].replace(new RegExp(`- \\[ \\] ${escapeRegExp(requirementText)}`, 'g'), '');
|
|
142
|
+
content = content.replace(todoSection[0], `## Requirements not yet completed\n${updatedTodo}`);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Add to recycled section
|
|
146
|
+
const recycledSection = content.match(/## Recycled Requirements \(do not work on\)\s*\n([\s\S]*?)(?=\n## |\n$)/);
|
|
147
|
+
if (recycledSection) {
|
|
148
|
+
const newRecycledItem = `- [ ] ${requirementText}`;
|
|
149
|
+
const updatedRecycled = recycledSection[1] + '\n' + newRecycledItem;
|
|
150
|
+
content = content.replace(recycledSection[0], `## Recycled Requirements (do not work on)\n${updatedRecycled}`);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
await fs.writeFile(reqPath, content);
|
|
154
|
+
} catch (error) {
|
|
155
|
+
console.error('Error moving requirement to recycle:', error.message);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Escape special characters for regex
|
|
161
|
+
*/
|
|
162
|
+
function escapeRegExp(string) {
|
|
163
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
module.exports = {
|
|
167
|
+
updateRequirementsStatus,
|
|
168
|
+
getCurrentRequirement,
|
|
169
|
+
countTodoRequirements,
|
|
170
|
+
moveRequirementToVerify,
|
|
171
|
+
moveRequirementToRecycle
|
|
172
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status display functions for auto-direct command
|
|
3
|
+
* Extracted from auto-direct.js to reduce file size
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const chalk = require('chalk');
|
|
7
|
+
const { getAutoConfig, getStages, DEFAULT_STAGES } = require('../../utils/config');
|
|
8
|
+
|
|
9
|
+
// Configured stages (will be loaded from config)
|
|
10
|
+
let configuredStages = DEFAULT_STAGES;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Print status card showing current stage
|
|
14
|
+
* Uses full terminal width
|
|
15
|
+
* Now uses persistent header that stays at top while output scrolls
|
|
16
|
+
*/
|
|
17
|
+
function printStatusCard(currentTitle, currentStatus) {
|
|
18
|
+
const stages = configuredStages;
|
|
19
|
+
const stageMap = {};
|
|
20
|
+
stages.forEach((s, i) => stageMap[s] = i);
|
|
21
|
+
|
|
22
|
+
// Get terminal width
|
|
23
|
+
const terminalWidth = process.stdout.columns || 80;
|
|
24
|
+
|
|
25
|
+
// Calculate widths
|
|
26
|
+
const padding = 2;
|
|
27
|
+
const maxTitleWidth = Math.floor((terminalWidth - padding * 2) * 0.4);
|
|
28
|
+
const maxStatusWidth = Math.floor((terminalWidth - padding * 2) * 0.6);
|
|
29
|
+
|
|
30
|
+
// Truncate title if too long
|
|
31
|
+
let displayTitle = currentTitle;
|
|
32
|
+
if (displayTitle.length > maxTitleWidth) {
|
|
33
|
+
displayTitle = displayTitle.substring(0, maxTitleWidth - 3) + '...';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Build status line
|
|
37
|
+
let statusLine = '';
|
|
38
|
+
stages.forEach((stage, index) => {
|
|
39
|
+
const isCurrent = stage === currentStatus;
|
|
40
|
+
const isCompleted = stageMap[currentStatus] > index;
|
|
41
|
+
const isPending = stageMap[currentStatus] < index;
|
|
42
|
+
|
|
43
|
+
let stageDisplay = stage;
|
|
44
|
+
if (stage === 'PREPARE') stageDisplay = '🔍 PREPARE';
|
|
45
|
+
else if (stage === 'ACT') stageDisplay = '⚡ ACT';
|
|
46
|
+
else if (stage === 'CLEAN UP') stageDisplay = '🧹 CLEAN UP';
|
|
47
|
+
else if (stage === 'VERIFY') stageDisplay = '✅ VERIFY';
|
|
48
|
+
else if (stage === 'DONE') stageDisplay = '🎉 DONE';
|
|
49
|
+
|
|
50
|
+
if (isCurrent) {
|
|
51
|
+
statusLine += chalk.bgBlue.white(` ${stageDisplay} `);
|
|
52
|
+
} else if (isCompleted) {
|
|
53
|
+
statusLine += chalk.bgGreen.black(` ${stageDisplay} `);
|
|
54
|
+
} else if (isPending) {
|
|
55
|
+
statusLine += chalk.bgGray.white(` ${stageDisplay} `);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (index < stages.length - 1) {
|
|
59
|
+
statusLine += ' ';
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Build the card
|
|
64
|
+
const border = '─'.repeat(terminalWidth);
|
|
65
|
+
const titleLine = displayTitle.padEnd(terminalWidth - padding * 2);
|
|
66
|
+
const statusLinePadded = statusLine.padEnd(terminalWidth - padding * 2);
|
|
67
|
+
|
|
68
|
+
console.log();
|
|
69
|
+
console.log(chalk.gray(border));
|
|
70
|
+
console.log(chalk.gray(`│ ${titleLine} │`));
|
|
71
|
+
console.log(chalk.gray(`│ ${statusLinePadded} │`));
|
|
72
|
+
console.log(chalk.gray(border));
|
|
73
|
+
console.log();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Load configured stages from config
|
|
78
|
+
*/
|
|
79
|
+
async function loadConfiguredStages() {
|
|
80
|
+
try {
|
|
81
|
+
configuredStages = await getStages();
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.warn('Warning: Could not load configured stages, using defaults');
|
|
84
|
+
configuredStages = DEFAULT_STAGES;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
module.exports = {
|
|
89
|
+
printStatusCard,
|
|
90
|
+
loadConfiguredStages
|
|
91
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for auto-direct command
|
|
3
|
+
* Extracted from auto-direct.js to reduce file size
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const chalk = require('chalk');
|
|
7
|
+
const stringWidth = require('string-width');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Get timestamp for logging
|
|
11
|
+
*/
|
|
12
|
+
function getTimestamp() {
|
|
13
|
+
const now = new Date();
|
|
14
|
+
return now.toLocaleTimeString('en-US', {
|
|
15
|
+
hour: '2-digit',
|
|
16
|
+
minute: '2-digit',
|
|
17
|
+
second: '2-digit'
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get a human-friendly timestamp for log prefixes that includes date, time, and timezone
|
|
23
|
+
* Example: "2025-01-02 3:45 PM MST"
|
|
24
|
+
*/
|
|
25
|
+
function getLogTimestamp(date = new Date()) {
|
|
26
|
+
const datePart = date.toISOString().split('T')[0]; // YYYY-MM-DD
|
|
27
|
+
const timePart = date.toLocaleTimeString('en-US', {
|
|
28
|
+
hour: 'numeric',
|
|
29
|
+
minute: '2-digit',
|
|
30
|
+
timeZoneName: 'short'
|
|
31
|
+
});
|
|
32
|
+
return `${datePart} ${timePart}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Translate workflow stage names
|
|
37
|
+
*/
|
|
38
|
+
function translateStage(stage) {
|
|
39
|
+
const stageMap = {
|
|
40
|
+
'PREPARE': 'workflow.stage.prepare',
|
|
41
|
+
'REPRODUCE': 'workflow.stage.reproduce',
|
|
42
|
+
'ACT': 'workflow.stage.act',
|
|
43
|
+
'CLEAN UP': 'workflow.stage.cleanup',
|
|
44
|
+
'VERIFY': 'workflow.stage.verify',
|
|
45
|
+
'DONE': 'workflow.stage.done'
|
|
46
|
+
};
|
|
47
|
+
return stageMap[stage] || stage;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Strip ANSI escape codes from a string
|
|
52
|
+
*/
|
|
53
|
+
function stripAnsi(str) {
|
|
54
|
+
// eslint-disable-next-line no-control-regex
|
|
55
|
+
return str.replace(/\x1B\[[0-9;]*[mGKH]/g, '');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Get visual width of a string accounting for ANSI codes, emojis, and wide characters
|
|
60
|
+
* Uses string-width library for accurate Unicode width calculation
|
|
61
|
+
*/
|
|
62
|
+
function getVisualWidth(str) {
|
|
63
|
+
return stringWidth(str);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Pad string to visual width accounting for emojis, ANSI codes, and wide characters
|
|
68
|
+
*/
|
|
69
|
+
function padToVisualWidth(str, targetWidth) {
|
|
70
|
+
const visualWidth = getVisualWidth(str);
|
|
71
|
+
const paddingNeeded = targetWidth - visualWidth;
|
|
72
|
+
if (paddingNeeded <= 0) {
|
|
73
|
+
return str;
|
|
74
|
+
}
|
|
75
|
+
return str + ' '.repeat(paddingNeeded);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Check if message indicates rate limiting
|
|
80
|
+
*/
|
|
81
|
+
function isRateLimitMessage(text) {
|
|
82
|
+
if (!text) return false;
|
|
83
|
+
const lower = text.toLowerCase();
|
|
84
|
+
return lower.includes('rate limit') ||
|
|
85
|
+
lower.includes('rate limited') ||
|
|
86
|
+
lower.includes('too many requests') ||
|
|
87
|
+
lower.includes('limit reached');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Sleep for specified milliseconds
|
|
92
|
+
*/
|
|
93
|
+
function sleep(ms) {
|
|
94
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
module.exports = {
|
|
98
|
+
getTimestamp,
|
|
99
|
+
getLogTimestamp,
|
|
100
|
+
translateStage,
|
|
101
|
+
stripAnsi,
|
|
102
|
+
getVisualWidth,
|
|
103
|
+
padToVisualWidth,
|
|
104
|
+
isRateLimitMessage,
|
|
105
|
+
sleep
|
|
106
|
+
};
|