vigthoria-cli 1.6.17 → 1.6.18
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/dist/commands/auth.js +5 -5
- package/dist/commands/bridge.js +2 -2
- package/dist/commands/chat.js +6 -6
- package/dist/commands/deploy.js +9 -9
- package/dist/commands/edit.js +3 -3
- package/dist/commands/explain.js +2 -2
- package/dist/commands/generate.js +2 -2
- package/dist/commands/repo.js +10 -10
- package/dist/commands/review.js +2 -2
- package/dist/index.js +6 -1
- package/dist/utils/api.d.ts +5 -0
- package/dist/utils/api.js +172 -33
- package/dist/utils/logger.d.ts +7 -0
- package/dist/utils/logger.js +10 -0
- package/package.json +1 -1
package/dist/commands/auth.js
CHANGED
|
@@ -8,8 +8,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.AuthCommand = void 0;
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
-
const ora_1 = __importDefault(require("ora"));
|
|
12
11
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
12
|
+
const logger_js_1 = require("../utils/logger.js");
|
|
13
13
|
const api_js_1 = require("../utils/api.js");
|
|
14
14
|
class AuthCommand {
|
|
15
15
|
config;
|
|
@@ -73,7 +73,7 @@ class AuthCommand {
|
|
|
73
73
|
validate: (input) => input.length >= 6 || 'Password must be at least 6 characters',
|
|
74
74
|
},
|
|
75
75
|
]);
|
|
76
|
-
const spinner = (0,
|
|
76
|
+
const spinner = (0, logger_js_1.createSpinner)('Logging in...').start();
|
|
77
77
|
const success = await this.api.login(credentials.email, credentials.password);
|
|
78
78
|
spinner.stop();
|
|
79
79
|
if (success) {
|
|
@@ -96,7 +96,7 @@ class AuthCommand {
|
|
|
96
96
|
await this.loginWithToken(token);
|
|
97
97
|
}
|
|
98
98
|
async loginWithToken(token) {
|
|
99
|
-
const spinner = (0,
|
|
99
|
+
const spinner = (0, logger_js_1.createSpinner)('Validating token...').start();
|
|
100
100
|
const success = await this.api.loginWithToken(token);
|
|
101
101
|
spinner.stop();
|
|
102
102
|
if (success) {
|
|
@@ -173,7 +173,7 @@ class AuthCommand {
|
|
|
173
173
|
});
|
|
174
174
|
console.log();
|
|
175
175
|
// API status
|
|
176
|
-
const spinner = (0,
|
|
176
|
+
const spinner = (0, logger_js_1.createSpinner)('Checking API status...').start();
|
|
177
177
|
const apiStatus = await this.api.getHealthStatus();
|
|
178
178
|
spinner.stop();
|
|
179
179
|
console.log(chalk_1.default.white('API Status:'));
|
|
@@ -198,7 +198,7 @@ class AuthCommand {
|
|
|
198
198
|
else {
|
|
199
199
|
console.log(chalk_1.default.gray(' Self-hosted Models: ') + chalk_1.default.gray('disabled'));
|
|
200
200
|
}
|
|
201
|
-
const capabilitySpinner = (0,
|
|
201
|
+
const capabilitySpinner = (0, logger_js_1.createSpinner)('Checking live capability truth...').start();
|
|
202
202
|
const capabilityStatus = await this.api.getCapabilityTruthStatus({
|
|
203
203
|
workspacePath: process.cwd(),
|
|
204
204
|
projectPath: process.cwd(),
|
package/dist/commands/bridge.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.BridgeCommand = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const
|
|
8
|
+
const logger_js_1 = require("../utils/logger.js");
|
|
9
9
|
const api_js_1 = require("../utils/api.js");
|
|
10
10
|
class BridgeCommand {
|
|
11
11
|
api;
|
|
@@ -13,7 +13,7 @@ class BridgeCommand {
|
|
|
13
13
|
this.api = new api_js_1.APIClient(config, logger);
|
|
14
14
|
}
|
|
15
15
|
async status() {
|
|
16
|
-
const spinner = (0,
|
|
16
|
+
const spinner = (0, logger_js_1.createSpinner)('Checking DevTools Bridge...').start();
|
|
17
17
|
const bridge = await this.api.getDevtoolsBridgeStatus();
|
|
18
18
|
spinner.stop();
|
|
19
19
|
console.log();
|
package/dist/commands/chat.js
CHANGED
|
@@ -38,11 +38,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.ChatCommand = void 0;
|
|
40
40
|
const chalk_1 = __importDefault(require("chalk"));
|
|
41
|
-
const ora_1 = __importDefault(require("ora"));
|
|
42
41
|
const fs = __importStar(require("fs"));
|
|
43
42
|
const os = __importStar(require("os"));
|
|
44
43
|
const path = __importStar(require("path"));
|
|
45
44
|
const readline = __importStar(require("readline"));
|
|
45
|
+
const logger_js_1 = require("../utils/logger.js");
|
|
46
46
|
const api_js_1 = require("../utils/api.js");
|
|
47
47
|
const tools_js_1 = require("../utils/tools.js");
|
|
48
48
|
const session_js_1 = require("../utils/session.js");
|
|
@@ -543,7 +543,7 @@ class ChatCommand {
|
|
|
543
543
|
const runtimeContext = await this.getPromptRuntimeContext(prompt);
|
|
544
544
|
const resolvedWorkflow = await this.api.resolveVigFlowWorkflow(selector);
|
|
545
545
|
const invocationMode = this.operatorMode ? 'operator' : this.agentMode ? 'agent' : 'chat';
|
|
546
|
-
const spinner = this.jsonOutput ? null : (0,
|
|
546
|
+
const spinner = this.jsonOutput ? null : (0, logger_js_1.createSpinner)({ text: `Running workflow ${resolvedWorkflow.name}...`, spinner: 'clock' }).start();
|
|
547
547
|
try {
|
|
548
548
|
const execution = await this.api.runVigFlowWorkflow(resolvedWorkflow.id, {
|
|
549
549
|
data: {
|
|
@@ -612,7 +612,7 @@ class ChatCommand {
|
|
|
612
612
|
return;
|
|
613
613
|
}
|
|
614
614
|
const runtimeContext = await this.getPromptRuntimeContext(prompt);
|
|
615
|
-
const spinner = this.jsonOutput ? null : (0,
|
|
615
|
+
const spinner = this.jsonOutput ? null : (0, logger_js_1.createSpinner)({ text: 'Thinking like an operator...', spinner: 'clock' }).start();
|
|
616
616
|
const executionPrompt = this.buildExecutionPrompt(prompt);
|
|
617
617
|
const workflowType = this.isDiagnosticPrompt(prompt) ? 'analysis_only' : 'full_autonomy';
|
|
618
618
|
try {
|
|
@@ -663,7 +663,7 @@ class ChatCommand {
|
|
|
663
663
|
async runSimplePrompt(prompt) {
|
|
664
664
|
this.lastActionableUserInput = prompt;
|
|
665
665
|
this.messages.push({ role: 'user', content: this.buildExecutionPrompt(prompt) });
|
|
666
|
-
const spinner = this.jsonOutput ? null : (0,
|
|
666
|
+
const spinner = this.jsonOutput ? null : (0, logger_js_1.createSpinner)({ text: 'Thinking...', spinner: 'clock' }).start();
|
|
667
667
|
try {
|
|
668
668
|
const response = await this.api.chat(this.getMessagesForModel(), this.currentModel);
|
|
669
669
|
if (spinner)
|
|
@@ -722,7 +722,7 @@ class ChatCommand {
|
|
|
722
722
|
this.saveSession();
|
|
723
723
|
const maxTurns = 10;
|
|
724
724
|
for (let turn = 0; turn < maxTurns; turn += 1) {
|
|
725
|
-
const spinner = this.jsonOutput ? null : (0,
|
|
725
|
+
const spinner = this.jsonOutput ? null : (0, logger_js_1.createSpinner)({ text: turn === 0 ? 'Planning...' : 'Continuing...', spinner: 'clock' }).start();
|
|
726
726
|
try {
|
|
727
727
|
const response = await this.api.chat(this.getMessagesForModel(), this.currentModel);
|
|
728
728
|
if (spinner)
|
|
@@ -935,7 +935,7 @@ class ChatCommand {
|
|
|
935
935
|
this.v3IterationCount = 0;
|
|
936
936
|
this.v3ToolCallCount = 0;
|
|
937
937
|
this.v3LastActivity = Date.now();
|
|
938
|
-
const spinner = this.jsonOutput ? null : (0,
|
|
938
|
+
const spinner = this.jsonOutput ? null : (0, logger_js_1.createSpinner)({
|
|
939
939
|
text: routingPolicy.cloudSelected ? 'Routing heavy task to Vigthoria Cloud...' : 'Routing to V3 Agent...',
|
|
940
940
|
spinner: 'clock',
|
|
941
941
|
}).start();
|
package/dist/commands/deploy.js
CHANGED
|
@@ -53,7 +53,7 @@ exports.DeployCommand = void 0;
|
|
|
53
53
|
const chalk_1 = __importDefault(require("chalk"));
|
|
54
54
|
const fs = __importStar(require("fs"));
|
|
55
55
|
const path = __importStar(require("path"));
|
|
56
|
-
const
|
|
56
|
+
const logger_js_1 = require("../utils/logger.js");
|
|
57
57
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
58
58
|
class DeployCommand {
|
|
59
59
|
config;
|
|
@@ -127,7 +127,7 @@ class DeployCommand {
|
|
|
127
127
|
* Deploy to preview URL (free)
|
|
128
128
|
*/
|
|
129
129
|
async deployToPreview(projectPath) {
|
|
130
|
-
const spinner = (0,
|
|
130
|
+
const spinner = (0, logger_js_1.createSpinner)('Deploying to preview...').start();
|
|
131
131
|
try {
|
|
132
132
|
const projectDir = projectPath || process.cwd();
|
|
133
133
|
const projectInfo = this.detectProjectInfo(projectDir);
|
|
@@ -160,7 +160,7 @@ class DeployCommand {
|
|
|
160
160
|
* Deploy to Vigthoria subdomain
|
|
161
161
|
*/
|
|
162
162
|
async deployToSubdomain(subdomain, projectPath) {
|
|
163
|
-
const spinner = (0,
|
|
163
|
+
const spinner = (0, logger_js_1.createSpinner)(`Deploying to ${subdomain}.vigthoria.io...`).start();
|
|
164
164
|
try {
|
|
165
165
|
// Validate subdomain format
|
|
166
166
|
if (!/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(subdomain) || subdomain.length < 3) {
|
|
@@ -213,7 +213,7 @@ class DeployCommand {
|
|
|
213
213
|
* Deploy to custom domain
|
|
214
214
|
*/
|
|
215
215
|
async deployToCustomDomain(domain, projectPath) {
|
|
216
|
-
const spinner = (0,
|
|
216
|
+
const spinner = (0, logger_js_1.createSpinner)(`Setting up ${domain}...`).start();
|
|
217
217
|
try {
|
|
218
218
|
const projectDir = projectPath || process.cwd();
|
|
219
219
|
const projectInfo = this.detectProjectInfo(projectDir);
|
|
@@ -303,7 +303,7 @@ class DeployCommand {
|
|
|
303
303
|
* Show hosting plans
|
|
304
304
|
*/
|
|
305
305
|
async showPlans() {
|
|
306
|
-
const spinner = (0,
|
|
306
|
+
const spinner = (0, logger_js_1.createSpinner)('Fetching hosting plans...').start();
|
|
307
307
|
try {
|
|
308
308
|
const response = await fetch(`${this.apiBase}/api/hosting/plans`, {
|
|
309
309
|
headers: this.getAuthHeaders()
|
|
@@ -344,7 +344,7 @@ class DeployCommand {
|
|
|
344
344
|
*/
|
|
345
345
|
async list() {
|
|
346
346
|
this.requireAuth();
|
|
347
|
-
const spinner = (0,
|
|
347
|
+
const spinner = (0, logger_js_1.createSpinner)('Fetching deployments...').start();
|
|
348
348
|
try {
|
|
349
349
|
const response = await fetch(`${this.apiBase}/api/hosting/domains`, {
|
|
350
350
|
headers: this.getAuthHeaders()
|
|
@@ -384,7 +384,7 @@ class DeployCommand {
|
|
|
384
384
|
*/
|
|
385
385
|
async status(domain) {
|
|
386
386
|
this.requireAuth();
|
|
387
|
-
const spinner = (0,
|
|
387
|
+
const spinner = (0, logger_js_1.createSpinner)('Checking status...').start();
|
|
388
388
|
try {
|
|
389
389
|
const endpoint = domain
|
|
390
390
|
? `${this.apiBase}/api/hosting/domain/${encodeURIComponent(domain)}/status`
|
|
@@ -411,7 +411,7 @@ class DeployCommand {
|
|
|
411
411
|
*/
|
|
412
412
|
async verify(domain) {
|
|
413
413
|
this.requireAuth();
|
|
414
|
-
const spinner = (0,
|
|
414
|
+
const spinner = (0, logger_js_1.createSpinner)(`Verifying DNS for ${domain}...`).start();
|
|
415
415
|
try {
|
|
416
416
|
const response = await fetch(`${this.apiBase}/api/hosting/domain/verify`, {
|
|
417
417
|
method: 'POST',
|
|
@@ -454,7 +454,7 @@ class DeployCommand {
|
|
|
454
454
|
console.log(chalk_1.default.yellow('\n⚠️ Removal cancelled.\n'));
|
|
455
455
|
return;
|
|
456
456
|
}
|
|
457
|
-
const spinner = (0,
|
|
457
|
+
const spinner = (0, logger_js_1.createSpinner)(`Removing ${domain}...`).start();
|
|
458
458
|
try {
|
|
459
459
|
const response = await fetch(`${this.apiBase}/api/hosting/domain/${encodeURIComponent(domain)}`, {
|
|
460
460
|
method: 'DELETE',
|
package/dist/commands/edit.js
CHANGED
|
@@ -8,8 +8,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.EditCommand = void 0;
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
-
const ora_1 = __importDefault(require("ora"));
|
|
12
11
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
12
|
+
const logger_js_1 = require("../utils/logger.js");
|
|
13
13
|
const api_js_1 = require("../utils/api.js");
|
|
14
14
|
const files_js_1 = require("../utils/files.js");
|
|
15
15
|
class EditCommand {
|
|
@@ -52,7 +52,7 @@ class EditCommand {
|
|
|
52
52
|
instruction = answer.instruction;
|
|
53
53
|
}
|
|
54
54
|
// Generate edit
|
|
55
|
-
const spinner = (0,
|
|
55
|
+
const spinner = (0, logger_js_1.createSpinner)({
|
|
56
56
|
text: 'Generating changes...',
|
|
57
57
|
spinner: 'dots',
|
|
58
58
|
}).start();
|
|
@@ -109,7 +109,7 @@ Return the complete modified code:`,
|
|
|
109
109
|
this.logger.section(`Fixing: ${file.relativePath}`);
|
|
110
110
|
console.log(chalk_1.default.gray(`Fix type: ${options.type} | Language: ${file.language}`));
|
|
111
111
|
console.log();
|
|
112
|
-
const spinner = (0,
|
|
112
|
+
const spinner = (0, logger_js_1.createSpinner)({
|
|
113
113
|
text: `Analyzing for ${options.type} issues...`,
|
|
114
114
|
spinner: 'dots',
|
|
115
115
|
}).start();
|
package/dist/commands/explain.js
CHANGED
|
@@ -8,9 +8,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.ExplainCommand = void 0;
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
-
const ora_1 = __importDefault(require("ora"));
|
|
12
11
|
const marked_1 = require("marked");
|
|
13
12
|
const marked_terminal_1 = require("marked-terminal");
|
|
13
|
+
const logger_js_1 = require("../utils/logger.js");
|
|
14
14
|
const api_js_1 = require("../utils/api.js");
|
|
15
15
|
const files_js_1 = require("../utils/files.js");
|
|
16
16
|
class ExplainCommand {
|
|
@@ -61,7 +61,7 @@ class ExplainCommand {
|
|
|
61
61
|
});
|
|
62
62
|
console.log(chalk_1.default.gray('─'.repeat(60)));
|
|
63
63
|
console.log();
|
|
64
|
-
const spinner = (0,
|
|
64
|
+
const spinner = (0, logger_js_1.createSpinner)({
|
|
65
65
|
text: 'Analyzing code...',
|
|
66
66
|
spinner: 'dots',
|
|
67
67
|
}).start();
|
|
@@ -10,8 +10,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.GenerateCommand = void 0;
|
|
12
12
|
const chalk_1 = __importDefault(require("chalk"));
|
|
13
|
-
const ora_1 = __importDefault(require("ora"));
|
|
14
13
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
14
|
+
const logger_js_1 = require("../utils/logger.js");
|
|
15
15
|
const api_js_1 = require("../utils/api.js");
|
|
16
16
|
const files_js_1 = require("../utils/files.js");
|
|
17
17
|
class GenerateCommand {
|
|
@@ -40,7 +40,7 @@ class GenerateCommand {
|
|
|
40
40
|
console.log(chalk_1.default.cyan('Pro Mode: Planning → Generating → Quality Check'));
|
|
41
41
|
}
|
|
42
42
|
console.log();
|
|
43
|
-
const spinner = (0,
|
|
43
|
+
const spinner = (0, logger_js_1.createSpinner)({
|
|
44
44
|
text: proMode ? 'Phase 1: Planning project structure...' : 'Generating code...',
|
|
45
45
|
spinner: 'dots',
|
|
46
46
|
}).start();
|
package/dist/commands/repo.js
CHANGED
|
@@ -54,7 +54,7 @@ exports.RepoCommand = void 0;
|
|
|
54
54
|
const chalk_1 = __importDefault(require("chalk"));
|
|
55
55
|
const fs = __importStar(require("fs"));
|
|
56
56
|
const path = __importStar(require("path"));
|
|
57
|
-
const
|
|
57
|
+
const logger_js_1 = require("../utils/logger.js");
|
|
58
58
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
59
59
|
const archiver_1 = __importDefault(require("archiver"));
|
|
60
60
|
const fs_1 = require("fs");
|
|
@@ -313,7 +313,7 @@ class RepoCommand {
|
|
|
313
313
|
console.log(chalk_1.default.red(`\n❌ Path does not exist: ${projectPath}\n`));
|
|
314
314
|
return;
|
|
315
315
|
}
|
|
316
|
-
const spinner = (0,
|
|
316
|
+
const spinner = (0, logger_js_1.createSpinner)('Analyzing project...').start();
|
|
317
317
|
try {
|
|
318
318
|
const projectInfo = this.detectProjectInfo(projectPath);
|
|
319
319
|
spinner.succeed(`Project detected: ${chalk_1.default.cyan(projectInfo.name)}`);
|
|
@@ -363,7 +363,7 @@ class RepoCommand {
|
|
|
363
363
|
console.log(chalk_1.default.yellow('\n⚠️ Push cancelled.\n'));
|
|
364
364
|
return;
|
|
365
365
|
}
|
|
366
|
-
const uploadSpinner = (0,
|
|
366
|
+
const uploadSpinner = (0, logger_js_1.createSpinner)('Preparing project files...').start();
|
|
367
367
|
const files = this.collectProjectFiles(projectPath);
|
|
368
368
|
if (files.length === 0) {
|
|
369
369
|
throw new Error('No readable text files found to push');
|
|
@@ -409,7 +409,7 @@ class RepoCommand {
|
|
|
409
409
|
*/
|
|
410
410
|
async pull(projectName, options = {}) {
|
|
411
411
|
this.requireAuth();
|
|
412
|
-
const spinner = (0,
|
|
412
|
+
const spinner = (0, logger_js_1.createSpinner)(`Fetching project: ${projectName}...`).start();
|
|
413
413
|
try {
|
|
414
414
|
const repo = await this.resolveRepoByName(projectName);
|
|
415
415
|
const response = await this.repoFetch('/api/repo/pull', {
|
|
@@ -437,7 +437,7 @@ class RepoCommand {
|
|
|
437
437
|
return;
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
|
-
const downloadSpinner = (0,
|
|
440
|
+
const downloadSpinner = (0, logger_js_1.createSpinner)('Downloading project files...').start();
|
|
441
441
|
// Create output directory
|
|
442
442
|
fs.mkdirSync(outputPath, { recursive: true });
|
|
443
443
|
// If we have a download URL, fetch and extract
|
|
@@ -496,7 +496,7 @@ class RepoCommand {
|
|
|
496
496
|
*/
|
|
497
497
|
async list(options = {}) {
|
|
498
498
|
this.requireAuth();
|
|
499
|
-
const spinner = (0,
|
|
499
|
+
const spinner = (0, logger_js_1.createSpinner)('Fetching your projects...').start();
|
|
500
500
|
try {
|
|
501
501
|
const repos = await this.getMyRepos();
|
|
502
502
|
const filteredRepos = options.visibility
|
|
@@ -596,7 +596,7 @@ class RepoCommand {
|
|
|
596
596
|
this.requireAuth();
|
|
597
597
|
const projectPath = process.cwd();
|
|
598
598
|
const projectInfo = this.detectProjectInfo(projectPath);
|
|
599
|
-
const spinner = (0,
|
|
599
|
+
const spinner = (0, logger_js_1.createSpinner)('Checking sync status...').start();
|
|
600
600
|
try {
|
|
601
601
|
const response = await fetch(`${this.apiBase}/api/repo/status/${encodeURIComponent(projectInfo.name)}`, {
|
|
602
602
|
method: 'GET',
|
|
@@ -644,7 +644,7 @@ class RepoCommand {
|
|
|
644
644
|
*/
|
|
645
645
|
async share(projectName, options = {}) {
|
|
646
646
|
this.requireAuth();
|
|
647
|
-
const spinner = (0,
|
|
647
|
+
const spinner = (0, logger_js_1.createSpinner)('Generating share link...').start();
|
|
648
648
|
try {
|
|
649
649
|
const response = await fetch(`${this.apiBase}/api/repo/share`, {
|
|
650
650
|
method: 'POST',
|
|
@@ -686,7 +686,7 @@ class RepoCommand {
|
|
|
686
686
|
console.log(chalk_1.default.yellow('\n⚠️ Delete cancelled.\n'));
|
|
687
687
|
return;
|
|
688
688
|
}
|
|
689
|
-
const spinner = (0,
|
|
689
|
+
const spinner = (0, logger_js_1.createSpinner)('Deleting project...').start();
|
|
690
690
|
try {
|
|
691
691
|
const response = await fetch(`${this.apiBase}/api/repo/projects/${encodeURIComponent(projectName)}`, {
|
|
692
692
|
method: 'DELETE',
|
|
@@ -712,7 +712,7 @@ class RepoCommand {
|
|
|
712
712
|
// Parse project URL or name
|
|
713
713
|
const projectIdMatch = projectUrl.match(/preview\/(\d+)/);
|
|
714
714
|
const projectId = projectIdMatch ? projectIdMatch[1] : projectUrl;
|
|
715
|
-
const spinner = (0,
|
|
715
|
+
const spinner = (0, logger_js_1.createSpinner)(`Cloning project...`).start();
|
|
716
716
|
try {
|
|
717
717
|
const response = await fetch(`${this.apiBase}/api/repo/clone/${projectId}`, {
|
|
718
718
|
method: 'GET',
|
package/dist/commands/review.js
CHANGED
|
@@ -8,9 +8,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.ReviewCommand = void 0;
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
-
const ora_1 = __importDefault(require("ora"));
|
|
12
11
|
const marked_1 = require("marked");
|
|
13
12
|
const marked_terminal_1 = require("marked-terminal");
|
|
13
|
+
const logger_js_1 = require("../utils/logger.js");
|
|
14
14
|
const api_js_1 = require("../utils/api.js");
|
|
15
15
|
const files_js_1 = require("../utils/files.js");
|
|
16
16
|
class ReviewCommand {
|
|
@@ -42,7 +42,7 @@ class ReviewCommand {
|
|
|
42
42
|
this.logger.section(`Reviewing: ${file.relativePath}`);
|
|
43
43
|
console.log(chalk_1.default.gray(`Language: ${file.language} | Lines: ${file.lines}`));
|
|
44
44
|
console.log();
|
|
45
|
-
const spinner = (0,
|
|
45
|
+
const spinner = (0, logger_js_1.createSpinner)({
|
|
46
46
|
text: 'Analyzing code quality...',
|
|
47
47
|
spinner: 'dots',
|
|
48
48
|
}).start();
|
package/dist/index.js
CHANGED
|
@@ -346,12 +346,17 @@ async function main() {
|
|
|
346
346
|
});
|
|
347
347
|
// Fix command - Fix code issues
|
|
348
348
|
program
|
|
349
|
-
.command('fix
|
|
349
|
+
.command('fix [file]')
|
|
350
350
|
.alias('f')
|
|
351
351
|
.description('Fix issues in a file')
|
|
352
352
|
.option('-t, --type <type>', 'Fix type (bugs, style, security, performance)', 'bugs')
|
|
353
353
|
.option('--apply', 'Automatically apply fixes', false)
|
|
354
354
|
.action(async (file, options) => {
|
|
355
|
+
if (!file) {
|
|
356
|
+
logger.error('Usage: vigthoria fix <file> [--type bugs|style|security|performance] [--apply]');
|
|
357
|
+
process.exitCode = 1;
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
355
360
|
const edit = new edit_js_1.EditCommand(config, logger);
|
|
356
361
|
await edit.fix(file, options);
|
|
357
362
|
});
|
package/dist/utils/api.d.ts
CHANGED
|
@@ -237,6 +237,11 @@ export declare class APIClient {
|
|
|
237
237
|
private isLikelyWindowsPath;
|
|
238
238
|
private resolveServerBindableWorkspacePath;
|
|
239
239
|
private buildLocalWorkspaceSummary;
|
|
240
|
+
/**
|
|
241
|
+
* Collect text file contents from the workspace for V3 agent hydration.
|
|
242
|
+
* Budget: up to ~2 MB total, per-file cap 200 KB, skip binary extensions.
|
|
243
|
+
*/
|
|
244
|
+
collectWorkspaceFileContents(rootPath: string, filePaths: string[]): Record<string, string>;
|
|
240
245
|
hasAgentWorkspaceOutput(context?: Record<string, any>): boolean;
|
|
241
246
|
getAgentWorkspaceSnapshot(rootPath: string): {
|
|
242
247
|
fileCount: number;
|
package/dist/utils/api.js
CHANGED
|
@@ -593,26 +593,37 @@ class APIClient {
|
|
|
593
593
|
error: artifacts.error || 'Frontend preview gate could not collect frontend artifacts.',
|
|
594
594
|
};
|
|
595
595
|
}
|
|
596
|
-
|
|
597
|
-
const
|
|
598
|
-
const
|
|
596
|
+
// Cap artifact sizes to prevent 413 Payload Too Large
|
|
597
|
+
const PREVIEW_MAX_ARTIFACT_BYTES = 500 * 1024;
|
|
598
|
+
const html = artifacts.html.slice(0, PREVIEW_MAX_ARTIFACT_BYTES);
|
|
599
|
+
const css = (artifacts.css || '').slice(0, PREVIEW_MAX_ARTIFACT_BYTES);
|
|
600
|
+
const js = (artifacts.js || '').slice(0, PREVIEW_MAX_ARTIFACT_BYTES);
|
|
599
601
|
const errors = [];
|
|
600
602
|
for (const baseUrl of this.getTemplateServiceBaseUrls()) {
|
|
601
603
|
try {
|
|
604
|
+
const proofPayload = JSON.stringify({
|
|
605
|
+
vision: String(context.rawPrompt || message || '').slice(0, 2000),
|
|
606
|
+
html,
|
|
607
|
+
css,
|
|
608
|
+
js,
|
|
609
|
+
entryPath: artifacts.htmlPath,
|
|
610
|
+
workspaceName: path_1.default.basename(rootPath),
|
|
611
|
+
});
|
|
612
|
+
// Skip preview proof if payload is still too large (> 4 MB)
|
|
613
|
+
if (Buffer.byteLength(proofPayload, 'utf8') > 4 * 1024 * 1024) {
|
|
614
|
+
return {
|
|
615
|
+
required: true,
|
|
616
|
+
passed: true,
|
|
617
|
+
error: 'Preview proof skipped: payload exceeds size limit.',
|
|
618
|
+
};
|
|
619
|
+
}
|
|
602
620
|
const response = await fetch(`${baseUrl}/preview-proof`, {
|
|
603
621
|
method: 'POST',
|
|
604
622
|
headers: {
|
|
605
623
|
'Content-Type': 'application/json',
|
|
606
624
|
Accept: 'application/json',
|
|
607
625
|
},
|
|
608
|
-
body:
|
|
609
|
-
vision: String(context.rawPrompt || message || ''),
|
|
610
|
-
html,
|
|
611
|
-
css,
|
|
612
|
-
js,
|
|
613
|
-
entryPath: artifacts.htmlPath,
|
|
614
|
-
workspaceName: path_1.default.basename(rootPath),
|
|
615
|
-
}),
|
|
626
|
+
body: proofPayload,
|
|
616
627
|
});
|
|
617
628
|
if (!response.ok) {
|
|
618
629
|
const errorText = await response.text().catch(() => '');
|
|
@@ -1553,6 +1564,9 @@ menu {
|
|
|
1553
1564
|
if (fs_1.default.existsSync(readmePath)) {
|
|
1554
1565
|
summary.readmeExcerpt = fs_1.default.readFileSync(readmePath, 'utf8').slice(0, 2500);
|
|
1555
1566
|
}
|
|
1567
|
+
// Hydrate workspace: include actual file contents so the V3 server
|
|
1568
|
+
// can populate the remote workspace before the agent starts.
|
|
1569
|
+
summary.workspaceFiles = this.collectWorkspaceFileContents(rootPath, snapshot.paths);
|
|
1556
1570
|
return summary;
|
|
1557
1571
|
}
|
|
1558
1572
|
catch (error) {
|
|
@@ -1560,6 +1574,52 @@ menu {
|
|
|
1560
1574
|
return null;
|
|
1561
1575
|
}
|
|
1562
1576
|
}
|
|
1577
|
+
/**
|
|
1578
|
+
* Collect text file contents from the workspace for V3 agent hydration.
|
|
1579
|
+
* Budget: up to ~2 MB total, per-file cap 200 KB, skip binary extensions.
|
|
1580
|
+
*/
|
|
1581
|
+
collectWorkspaceFileContents(rootPath, filePaths) {
|
|
1582
|
+
const MAX_TOTAL_BYTES = 2 * 1024 * 1024;
|
|
1583
|
+
const MAX_FILE_BYTES = 200 * 1024;
|
|
1584
|
+
const BINARY_EXTENSIONS = new Set([
|
|
1585
|
+
'.png', '.jpg', '.jpeg', '.gif', '.bmp', '.ico', '.svg', '.webp', '.avif',
|
|
1586
|
+
'.mp3', '.mp4', '.wav', '.ogg', '.webm', '.flac', '.aac',
|
|
1587
|
+
'.zip', '.gz', '.tar', '.rar', '.7z', '.bz2',
|
|
1588
|
+
'.exe', '.dll', '.so', '.dylib', '.bin', '.dat',
|
|
1589
|
+
'.woff', '.woff2', '.ttf', '.eot', '.otf',
|
|
1590
|
+
'.pdf', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx',
|
|
1591
|
+
'.db', '.sqlite', '.sqlite3',
|
|
1592
|
+
'.pyc', '.pyo', '.class', '.o', '.obj',
|
|
1593
|
+
'.DS_Store', '.lock',
|
|
1594
|
+
]);
|
|
1595
|
+
const result = {};
|
|
1596
|
+
let totalBytes = 0;
|
|
1597
|
+
for (const relativePath of filePaths) {
|
|
1598
|
+
if (totalBytes >= MAX_TOTAL_BYTES)
|
|
1599
|
+
break;
|
|
1600
|
+
const ext = path_1.default.extname(relativePath).toLowerCase();
|
|
1601
|
+
if (BINARY_EXTENSIONS.has(ext))
|
|
1602
|
+
continue;
|
|
1603
|
+
if (/(^|[\/\\])\.(git|hg)([\/\\]|$)/.test(relativePath))
|
|
1604
|
+
continue;
|
|
1605
|
+
const absolutePath = path_1.default.join(rootPath, relativePath);
|
|
1606
|
+
try {
|
|
1607
|
+
const stat = fs_1.default.statSync(absolutePath);
|
|
1608
|
+
if (!stat.isFile() || stat.size > MAX_FILE_BYTES || stat.size === 0)
|
|
1609
|
+
continue;
|
|
1610
|
+
const content = fs_1.default.readFileSync(absolutePath, 'utf8');
|
|
1611
|
+
// Skip likely binary content (high ratio of non-printable chars)
|
|
1612
|
+
if (/[\x00-\x08\x0e-\x1f]/.test(content.slice(0, 512)))
|
|
1613
|
+
continue;
|
|
1614
|
+
result[relativePath] = content;
|
|
1615
|
+
totalBytes += Buffer.byteLength(content, 'utf8');
|
|
1616
|
+
}
|
|
1617
|
+
catch {
|
|
1618
|
+
// Skip unreadable files
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
return result;
|
|
1622
|
+
}
|
|
1563
1623
|
hasAgentWorkspaceOutput(context = {}) {
|
|
1564
1624
|
try {
|
|
1565
1625
|
const root = this.resolveAgentTargetPath(context);
|
|
@@ -2231,6 +2291,30 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
2231
2291
|
serverWorkspaceRoot = event.workspace_root.trim();
|
|
2232
2292
|
}
|
|
2233
2293
|
this.captureV3AgentStreamMutation(event, streamedFiles, serverWorkspaceRoot);
|
|
2294
|
+
// Empty workspace guard: if the remote agent lists its root
|
|
2295
|
+
// and finds nothing while our local workspace has files, the
|
|
2296
|
+
// workspace was not hydrated. Abort early with a clear error
|
|
2297
|
+
// instead of letting the agent spin on an empty directory.
|
|
2298
|
+
if (event.type === 'tool_result'
|
|
2299
|
+
&& event.name === 'list_directory'
|
|
2300
|
+
&& event.success === true
|
|
2301
|
+
&& serverWorkspaceRoot
|
|
2302
|
+
&& typeof event.output === 'string') {
|
|
2303
|
+
const listOutput = event.output.trim();
|
|
2304
|
+
const looksEmpty = listOutput === `[${serverWorkspaceRoot}]`
|
|
2305
|
+
|| listOutput === `[${serverWorkspaceRoot}/]`
|
|
2306
|
+
|| listOutput === `[${serverWorkspaceRoot}]\\n`
|
|
2307
|
+
|| /^\[\/tmp\/vig-remote-server-[^\]]+\]\s*$/.test(listOutput);
|
|
2308
|
+
if (looksEmpty) {
|
|
2309
|
+
const localPath = this.resolveAgentTargetPath(context);
|
|
2310
|
+
const localHasFiles = localPath && fs_1.default.existsSync(localPath) && this.hasAgentWorkspaceOutput({ ...context, projectPath: localPath, targetPath: localPath });
|
|
2311
|
+
if (localHasFiles) {
|
|
2312
|
+
throw new Error('Remote workspace is empty — the V3 server did not receive your project files. '
|
|
2313
|
+
+ 'Your local workspace has files but the remote agent sees an empty directory. '
|
|
2314
|
+
+ 'This is a workspace sync failure. Falling back to local agent loop.');
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2234
2318
|
if (typeof context.onStreamEvent === 'function') {
|
|
2235
2319
|
try {
|
|
2236
2320
|
context.onStreamEvent(event);
|
|
@@ -3096,32 +3180,87 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
3096
3180
|
}
|
|
3097
3181
|
}
|
|
3098
3182
|
async getV3AgentHealth() {
|
|
3099
|
-
const
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
}
|
|
3105
|
-
|
|
3183
|
+
const baseUrl = this.getV3AgentBaseUrls()[0];
|
|
3184
|
+
// Try multiple health endpoint patterns — the V3 backend may expose
|
|
3185
|
+
// different paths depending on whether it's local (8030) or remote.
|
|
3186
|
+
const candidates = [
|
|
3187
|
+
`${baseUrl}/api/v3-agent/health`,
|
|
3188
|
+
`${baseUrl}/api/health`,
|
|
3189
|
+
`${baseUrl}/health`,
|
|
3190
|
+
];
|
|
3191
|
+
const headers = await this.getV3AgentHeaders();
|
|
3192
|
+
for (const endpoint of candidates) {
|
|
3193
|
+
try {
|
|
3194
|
+
const controller = new AbortController();
|
|
3195
|
+
const timer = setTimeout(() => controller.abort(), 8000);
|
|
3196
|
+
const response = await fetch(endpoint, {
|
|
3197
|
+
method: 'GET',
|
|
3198
|
+
headers,
|
|
3199
|
+
signal: controller.signal,
|
|
3200
|
+
});
|
|
3201
|
+
clearTimeout(timer);
|
|
3202
|
+
if (response.ok) {
|
|
3203
|
+
const data = await response.json().catch(() => ({}));
|
|
3204
|
+
return {
|
|
3205
|
+
name: 'V3 Agent',
|
|
3206
|
+
endpoint,
|
|
3207
|
+
ok: true,
|
|
3208
|
+
details: { health: data },
|
|
3209
|
+
};
|
|
3210
|
+
}
|
|
3211
|
+
// 404 means this path doesn't exist — try next candidate
|
|
3212
|
+
if (response.status === 404)
|
|
3213
|
+
continue;
|
|
3214
|
+
// 405 Method Not Allowed — endpoint exists but rejects GET.
|
|
3215
|
+
// Treat as reachable since the run endpoint (POST) will work.
|
|
3216
|
+
if (response.status === 405) {
|
|
3217
|
+
return {
|
|
3218
|
+
name: 'V3 Agent',
|
|
3219
|
+
endpoint,
|
|
3220
|
+
ok: true,
|
|
3221
|
+
details: { health: { reachable: true, note: 'Health endpoint returned 405 but run endpoint is available' } },
|
|
3222
|
+
};
|
|
3223
|
+
}
|
|
3224
|
+
// Other error
|
|
3106
3225
|
throw new Error(`V3 health ${response.status}`);
|
|
3107
3226
|
}
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3227
|
+
catch (error) {
|
|
3228
|
+
if (error instanceof Error && error.message.startsWith('V3 health')) {
|
|
3229
|
+
return {
|
|
3230
|
+
name: 'V3 Agent',
|
|
3231
|
+
endpoint,
|
|
3232
|
+
ok: false,
|
|
3233
|
+
error: error.message,
|
|
3234
|
+
};
|
|
3235
|
+
}
|
|
3236
|
+
// Network/timeout error — try next candidate
|
|
3237
|
+
}
|
|
3116
3238
|
}
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3239
|
+
// Last resort: probe the run endpoint with OPTIONS
|
|
3240
|
+
const runUrl = this.getV3AgentRunUrl(baseUrl);
|
|
3241
|
+
try {
|
|
3242
|
+
const controller = new AbortController();
|
|
3243
|
+
const timer = setTimeout(() => controller.abort(), 5000);
|
|
3244
|
+
const probe = await fetch(runUrl, { method: 'OPTIONS', headers, signal: controller.signal });
|
|
3245
|
+
clearTimeout(timer);
|
|
3246
|
+
if (probe.ok || probe.status === 204 || probe.status === 405) {
|
|
3247
|
+
return {
|
|
3248
|
+
name: 'V3 Agent',
|
|
3249
|
+
endpoint: runUrl,
|
|
3250
|
+
ok: true,
|
|
3251
|
+
details: { health: { reachable: true, method: 'OPTIONS' } },
|
|
3252
|
+
};
|
|
3253
|
+
}
|
|
3124
3254
|
}
|
|
3255
|
+
catch {
|
|
3256
|
+
// final attempt failed
|
|
3257
|
+
}
|
|
3258
|
+
return {
|
|
3259
|
+
name: 'V3 Agent',
|
|
3260
|
+
endpoint: candidates[0],
|
|
3261
|
+
ok: false,
|
|
3262
|
+
error: 'No V3 agent health endpoint responded.',
|
|
3263
|
+
};
|
|
3125
3264
|
}
|
|
3126
3265
|
async getHyperLoopHealth() {
|
|
3127
3266
|
const endpoint = process.env.VIGTHORIA_HYPERLOOP_URL || 'http://127.0.0.1:8020/api/hyperloop/health';
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Logger utility for Vigthoria CLI
|
|
3
3
|
*/
|
|
4
|
+
import { type Options as OraOptions, type Ora } from 'ora';
|
|
5
|
+
export type { Ora };
|
|
6
|
+
/**
|
|
7
|
+
* Create an ora spinner that writes to stderr so it never
|
|
8
|
+
* pollutes stdout JSON output or triggers PowerShell error styling.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createSpinner(textOrOpts: string | OraOptions): Ora;
|
|
4
11
|
export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'success';
|
|
5
12
|
export declare class Logger {
|
|
6
13
|
private verbose;
|
package/dist/utils/logger.js
CHANGED
|
@@ -7,7 +7,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.Logger = void 0;
|
|
10
|
+
exports.createSpinner = createSpinner;
|
|
10
11
|
const chalk_1 = __importDefault(require("chalk"));
|
|
12
|
+
const ora_1 = __importDefault(require("ora"));
|
|
13
|
+
/**
|
|
14
|
+
* Create an ora spinner that writes to stderr so it never
|
|
15
|
+
* pollutes stdout JSON output or triggers PowerShell error styling.
|
|
16
|
+
*/
|
|
17
|
+
function createSpinner(textOrOpts) {
|
|
18
|
+
const opts = typeof textOrOpts === 'string' ? { text: textOrOpts } : textOrOpts;
|
|
19
|
+
return (0, ora_1.default)({ ...opts, stream: process.stderr });
|
|
20
|
+
}
|
|
11
21
|
class Logger {
|
|
12
22
|
verbose = false;
|
|
13
23
|
setVerbose(verbose) {
|