vigthoria-cli 1.9.10 → 1.9.19
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/README.md +4 -4
- package/dist/commands/auth.js +48 -65
- package/dist/commands/bridge.js +12 -19
- package/dist/commands/cancel.js +15 -22
- package/dist/commands/chat.d.ts +11 -0
- package/dist/commands/chat.js +404 -248
- package/dist/commands/config.js +31 -71
- package/dist/commands/deploy.js +83 -123
- package/dist/commands/device.d.ts +35 -0
- package/dist/commands/device.js +239 -0
- package/dist/commands/edit.js +32 -39
- package/dist/commands/explain.js +18 -25
- package/dist/commands/fork.js +22 -27
- package/dist/commands/generate.js +37 -44
- package/dist/commands/history.js +20 -25
- package/dist/commands/hub.js +95 -102
- package/dist/commands/index.js +41 -46
- package/dist/commands/legion.d.ts +1 -0
- package/dist/commands/legion.js +162 -209
- package/dist/commands/preview.js +60 -98
- package/dist/commands/replay.js +27 -32
- package/dist/commands/repo.js +103 -141
- package/dist/commands/review.js +29 -36
- package/dist/commands/security.js +5 -12
- package/dist/commands/update.js +15 -49
- package/dist/commands/workflow.d.ts +8 -1
- package/dist/commands/workflow.js +53 -19
- package/dist/index.js +409 -234
- package/dist/utils/api.d.ts +5 -0
- package/dist/utils/api.js +373 -166
- package/dist/utils/bridge-client.js +11 -52
- package/dist/utils/cli-state.d.ts +54 -0
- package/dist/utils/cli-state.js +185 -0
- package/dist/utils/config.d.ts +5 -0
- package/dist/utils/config.js +35 -14
- package/dist/utils/context-ranker.js +15 -21
- package/dist/utils/files.js +5 -42
- package/dist/utils/logger.js +42 -50
- package/dist/utils/post-write-validator.js +22 -29
- package/dist/utils/project-memory.d.ts +56 -0
- package/dist/utils/project-memory.js +289 -0
- package/dist/utils/session.d.ts +29 -3
- package/dist/utils/session.js +137 -85
- package/dist/utils/task-display.js +13 -20
- package/dist/utils/tools.d.ts +19 -0
- package/dist/utils/tools.js +84 -87
- package/dist/utils/workspace-cache.js +18 -26
- package/dist/utils/workspace-stream.js +26 -64
- package/install.ps1 +14 -0
- package/package.json +5 -3
- package/scripts/release/LOCAL_MACHINE_USER_VERIFICATION.md +1 -1
- package/scripts/release/validate-no-go-gates.sh +2 -2
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Generate Command - Generate code from description
|
|
4
3
|
*
|
|
5
4
|
* Now with Senior Developer Mode (--pro) for impressive, production-ready output
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
14
|
-
const logger_js_1 = require("../utils/logger.js");
|
|
15
|
-
const api_js_1 = require("../utils/api.js");
|
|
16
|
-
const files_js_1 = require("../utils/files.js");
|
|
17
|
-
class GenerateCommand {
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import inquirer from 'inquirer';
|
|
8
|
+
import { createSpinner, CH } from '../utils/logger.js';
|
|
9
|
+
import { APIClient, CLIError, classifyError, formatCLIError } from '../utils/api.js';
|
|
10
|
+
import { FileUtils } from '../utils/files.js';
|
|
11
|
+
export class GenerateCommand {
|
|
18
12
|
config;
|
|
19
13
|
logger;
|
|
20
14
|
api;
|
|
@@ -22,8 +16,8 @@ class GenerateCommand {
|
|
|
22
16
|
constructor(config, logger) {
|
|
23
17
|
this.config = config;
|
|
24
18
|
this.logger = logger;
|
|
25
|
-
this.api = new
|
|
26
|
-
this.fileUtils = new
|
|
19
|
+
this.api = new APIClient(config, logger);
|
|
20
|
+
this.fileUtils = new FileUtils(process.cwd(), config.get('project').ignorePatterns);
|
|
27
21
|
}
|
|
28
22
|
async run(description, options) {
|
|
29
23
|
// Check auth
|
|
@@ -43,14 +37,14 @@ class GenerateCommand {
|
|
|
43
37
|
if (!options.language) {
|
|
44
38
|
options.language = this.detectLanguageFromDescription(description);
|
|
45
39
|
}
|
|
46
|
-
this.logger.section(proMode ? `${
|
|
47
|
-
console.log(
|
|
48
|
-
console.log(
|
|
40
|
+
this.logger.section(proMode ? `${CH.rocket} Senior Developer Mode` : 'Code Generation');
|
|
41
|
+
console.log(chalk.gray(`Language: ${options.language}`));
|
|
42
|
+
console.log(chalk.gray(`Description: ${description}`));
|
|
49
43
|
if (proMode) {
|
|
50
|
-
console.log(
|
|
44
|
+
console.log(chalk.cyan('Pro Mode: Planning → Generating → Quality Check'));
|
|
51
45
|
}
|
|
52
46
|
console.log();
|
|
53
|
-
const spinner =
|
|
47
|
+
const spinner = createSpinner({
|
|
54
48
|
text: proMode ? 'Phase 1: Planning project structure...' : 'Generating code...',
|
|
55
49
|
spinner: 'dots',
|
|
56
50
|
}).start();
|
|
@@ -69,20 +63,20 @@ class GenerateCommand {
|
|
|
69
63
|
if (quality) {
|
|
70
64
|
console.log();
|
|
71
65
|
this.logger.section('Quality Report');
|
|
72
|
-
console.log(
|
|
73
|
-
console.log(
|
|
66
|
+
console.log(chalk.gray(`Lines of code: ${quality.lineCount}`));
|
|
67
|
+
console.log(chalk.gray(`Quality score: ${quality.score}/5`));
|
|
74
68
|
console.log();
|
|
75
|
-
console.log(
|
|
76
|
-
console.log(` ${quality.checks?.hasAnimations ?
|
|
77
|
-
console.log(` ${quality.checks?.hasNeonEffects ?
|
|
78
|
-
console.log(` ${quality.checks?.hasResponsive ?
|
|
79
|
-
console.log(` ${quality.checks?.hasFontAwesome ?
|
|
80
|
-
console.log(` ${quality.checks?.hasGoogleFonts ?
|
|
69
|
+
console.log(chalk.gray('Visual Checks:'));
|
|
70
|
+
console.log(` ${quality.checks?.hasAnimations ? chalk.green('✓') : chalk.red('✗')} CSS Animations (@keyframes)`);
|
|
71
|
+
console.log(` ${quality.checks?.hasNeonEffects ? chalk.green('✓') : chalk.red('✗')} Neon/Glow Effects`);
|
|
72
|
+
console.log(` ${quality.checks?.hasResponsive ? chalk.green('✓') : chalk.red('✗')} Responsive Design (@media)`);
|
|
73
|
+
console.log(` ${quality.checks?.hasFontAwesome ? chalk.green('✓') : chalk.red('✗')} Font Awesome Icons`);
|
|
74
|
+
console.log(` ${quality.checks?.hasGoogleFonts ? chalk.green('✓') : chalk.red('✗')} Google Fonts`);
|
|
81
75
|
console.log();
|
|
82
|
-
console.log(
|
|
83
|
-
console.log(` ${quality.checks?.hasEmbeddedCSS ?
|
|
84
|
-
console.log(` ${quality.checks?.hasEmbeddedJS ?
|
|
85
|
-
console.log(` ${quality.checks?.singleFile ?
|
|
76
|
+
console.log(chalk.gray('Structure Checks:'));
|
|
77
|
+
console.log(` ${quality.checks?.hasEmbeddedCSS ? chalk.green('✓') : chalk.red('✗')} Embedded CSS (<style> tag)`);
|
|
78
|
+
console.log(` ${quality.checks?.hasEmbeddedJS ? chalk.green('✓') : chalk.red('✗')} Embedded JavaScript (<script> tag)`);
|
|
79
|
+
console.log(` ${quality.checks?.singleFile ? chalk.green('✓') : chalk.red('✗')} Single-file (no external CSS/JS)`);
|
|
86
80
|
console.log();
|
|
87
81
|
}
|
|
88
82
|
}
|
|
@@ -96,9 +90,9 @@ class GenerateCommand {
|
|
|
96
90
|
// Display generated code (skip display when --output is set to avoid noise)
|
|
97
91
|
if (!options.output) {
|
|
98
92
|
this.logger.section('Generated Code');
|
|
99
|
-
console.log(
|
|
93
|
+
console.log(chalk.gray('─'.repeat(60)));
|
|
100
94
|
console.log(this.highlightCode(code, options.language));
|
|
101
|
-
console.log(
|
|
95
|
+
console.log(chalk.gray('─'.repeat(60)));
|
|
102
96
|
console.log();
|
|
103
97
|
}
|
|
104
98
|
// Save options — when --output is specified, save directly (non-interactive)
|
|
@@ -112,8 +106,8 @@ class GenerateCommand {
|
|
|
112
106
|
}
|
|
113
107
|
catch (error) {
|
|
114
108
|
spinner.stop();
|
|
115
|
-
const cliErr = error instanceof
|
|
116
|
-
this.logger.error(
|
|
109
|
+
const cliErr = error instanceof CLIError ? error : classifyError(error);
|
|
110
|
+
this.logger.error(formatCLIError(cliErr));
|
|
117
111
|
}
|
|
118
112
|
}
|
|
119
113
|
/**
|
|
@@ -140,7 +134,7 @@ class GenerateCommand {
|
|
|
140
134
|
// In production, use a proper library like highlight.js
|
|
141
135
|
const lines = code.split('\n');
|
|
142
136
|
return lines.map((line, i) => {
|
|
143
|
-
const lineNum =
|
|
137
|
+
const lineNum = chalk.gray(String(i + 1).padStart(4, ' ') + ' │ ');
|
|
144
138
|
return lineNum + this.highlightLine(line, language);
|
|
145
139
|
}).join('\n');
|
|
146
140
|
}
|
|
@@ -158,14 +152,14 @@ class GenerateCommand {
|
|
|
158
152
|
// Highlight keywords
|
|
159
153
|
langKeywords.forEach(kw => {
|
|
160
154
|
const regex = new RegExp(`\\b${kw}\\b`, 'g');
|
|
161
|
-
highlighted = highlighted.replace(regex,
|
|
155
|
+
highlighted = highlighted.replace(regex, chalk.magenta(kw));
|
|
162
156
|
});
|
|
163
157
|
// Highlight strings
|
|
164
|
-
highlighted = highlighted.replace(/(["'`])(?:(?!\1)[^\\]|\\.)*\1/g, (match) =>
|
|
158
|
+
highlighted = highlighted.replace(/(["'`])(?:(?!\1)[^\\]|\\.)*\1/g, (match) => chalk.green(match));
|
|
165
159
|
// Highlight comments
|
|
166
|
-
highlighted = highlighted.replace(/(\/\/.*$|#.*$)/g, (match) =>
|
|
160
|
+
highlighted = highlighted.replace(/(\/\/.*$|#.*$)/g, (match) => chalk.gray(match));
|
|
167
161
|
// Highlight numbers
|
|
168
|
-
highlighted = highlighted.replace(/\b(\d+)\b/g, (match) =>
|
|
162
|
+
highlighted = highlighted.replace(/\b(\d+)\b/g, (match) => chalk.yellow(match));
|
|
169
163
|
return highlighted;
|
|
170
164
|
}
|
|
171
165
|
async saveToFile(filePath, code) {
|
|
@@ -177,7 +171,7 @@ class GenerateCommand {
|
|
|
177
171
|
}
|
|
178
172
|
}
|
|
179
173
|
async promptForAction(code, language) {
|
|
180
|
-
const { action } = await
|
|
174
|
+
const { action } = await inquirer.prompt([
|
|
181
175
|
{
|
|
182
176
|
type: 'list',
|
|
183
177
|
name: 'action',
|
|
@@ -194,10 +188,10 @@ class GenerateCommand {
|
|
|
194
188
|
case 'copy':
|
|
195
189
|
// Note: Clipboard access requires additional setup
|
|
196
190
|
this.logger.info('Code copied to clipboard');
|
|
197
|
-
console.log(
|
|
191
|
+
console.log(chalk.gray('(Note: Clipboard access may require additional permissions)'));
|
|
198
192
|
break;
|
|
199
193
|
case 'save':
|
|
200
|
-
const { filename } = await
|
|
194
|
+
const { filename } = await inquirer.prompt([
|
|
201
195
|
{
|
|
202
196
|
type: 'input',
|
|
203
197
|
name: 'filename',
|
|
@@ -262,4 +256,3 @@ class GenerateCommand {
|
|
|
262
256
|
return 'javascript';
|
|
263
257
|
}
|
|
264
258
|
}
|
|
265
|
-
exports.GenerateCommand = GenerateCommand;
|
package/dist/commands/history.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.HistoryCommand = void 0;
|
|
7
|
-
const api_js_1 = require("../utils/api.js");
|
|
1
|
+
import { isServerRuntime } from '../utils/api.js';
|
|
8
2
|
/**
|
|
9
3
|
* history.ts — List recent V3 agent runs with summaries.
|
|
10
4
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
7
|
+
import { createSpinner, CH } from '../utils/logger.js';
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
export class HistoryCommand {
|
|
14
10
|
config;
|
|
15
11
|
logger;
|
|
16
12
|
constructor(config, logger) {
|
|
@@ -33,7 +29,7 @@ class HistoryCommand {
|
|
|
33
29
|
}
|
|
34
30
|
getBaseUrl() {
|
|
35
31
|
const configuredApiUrl = String(this.config.get('apiUrl') || 'https://coder.vigthoria.io').replace(/\/$/, '');
|
|
36
|
-
const allowLocal =
|
|
32
|
+
const allowLocal = isServerRuntime() && process.env.VIGTHORIA_ALLOW_LOCAL_V3_AGENT === '1';
|
|
37
33
|
return (process.env.VIGTHORIA_V3_AGENT_URL ||
|
|
38
34
|
process.env.V3_AGENT_URL ||
|
|
39
35
|
(allowLocal ? 'http://127.0.0.1:8030' : null) ||
|
|
@@ -57,7 +53,7 @@ class HistoryCommand {
|
|
|
57
53
|
const limit = options.limit || 20;
|
|
58
54
|
const project = options.project || process.cwd();
|
|
59
55
|
const workspace = this.resolveWorkspaceRoot(project);
|
|
60
|
-
const spinner =
|
|
56
|
+
const spinner = createSpinner('Loading run history...').start();
|
|
61
57
|
try {
|
|
62
58
|
const baseUrl = this.getBaseUrl();
|
|
63
59
|
const params = new URLSearchParams({
|
|
@@ -86,26 +82,26 @@ class HistoryCommand {
|
|
|
86
82
|
return;
|
|
87
83
|
}
|
|
88
84
|
if (data.runs.length === 0) {
|
|
89
|
-
this.logger.info(
|
|
85
|
+
this.logger.info(chalk.dim('No runs found.'));
|
|
90
86
|
return;
|
|
91
87
|
}
|
|
92
|
-
console.log(
|
|
88
|
+
console.log(chalk.bold(`\n${CH.success} Recent Runs (${data.count})\n`));
|
|
93
89
|
for (const run of data.runs) {
|
|
94
90
|
const tier = run.seal_score?.tier || 'unknown';
|
|
95
|
-
const tierColor = tier === 'gold' ?
|
|
96
|
-
tier === 'silver' ?
|
|
97
|
-
tier === 'bronze' ?
|
|
98
|
-
tier === 'failed' ?
|
|
99
|
-
|
|
91
|
+
const tierColor = tier === 'gold' ? chalk.yellow :
|
|
92
|
+
tier === 'silver' ? chalk.white :
|
|
93
|
+
tier === 'bronze' ? chalk.hex('#cd7f32') :
|
|
94
|
+
tier === 'failed' ? chalk.red :
|
|
95
|
+
chalk.dim;
|
|
100
96
|
const score = run.seal_score?.overall != null ? `${run.seal_score.overall}` : '—';
|
|
101
97
|
const status = run.failed > 0
|
|
102
|
-
?
|
|
103
|
-
:
|
|
104
|
-
console.log(` ${
|
|
105
|
-
`${
|
|
98
|
+
? chalk.red(`${run.completed}/${run.task_count} ✗`)
|
|
99
|
+
: chalk.green(`${run.completed}/${run.task_count} ✓`);
|
|
100
|
+
console.log(` ${chalk.cyan(run.run_id.substring(0, 16))} ` +
|
|
101
|
+
`${chalk.dim(run.archived_at || '?')} ` +
|
|
106
102
|
`${status} ` +
|
|
107
103
|
`${tierColor(`[${tier} ${score}]`)} ` +
|
|
108
|
-
`${
|
|
104
|
+
`${chalk.white(run.request?.substring(0, 60) || '(no request)')}`);
|
|
109
105
|
}
|
|
110
106
|
console.log();
|
|
111
107
|
}
|
|
@@ -115,4 +111,3 @@ class HistoryCommand {
|
|
|
115
111
|
}
|
|
116
112
|
}
|
|
117
113
|
}
|
|
118
|
-
exports.HistoryCommand = HistoryCommand;
|
package/dist/commands/hub.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Vigthoria CLI - Hub/Marketplace Commands
|
|
4
3
|
*
|
|
5
4
|
* In-flow marketplace discovery and module activation
|
|
6
5
|
* Enables pay-as-you-go module usage directly from the terminal
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.HubCommand = void 0;
|
|
13
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
7
|
+
import chalk from 'chalk';
|
|
14
8
|
const API_BASE = 'https://api.vigthoria.io';
|
|
15
|
-
class HubCommand {
|
|
9
|
+
export class HubCommand {
|
|
16
10
|
config;
|
|
17
11
|
logger;
|
|
18
12
|
constructor(config, logger) {
|
|
@@ -23,7 +17,7 @@ class HubCommand {
|
|
|
23
17
|
* Search for modules by natural language query
|
|
24
18
|
*/
|
|
25
19
|
async search(query) {
|
|
26
|
-
console.log(
|
|
20
|
+
console.log(chalk.cyan('\n🔍 Searching Vigthoria Module Hub...\n'));
|
|
27
21
|
try {
|
|
28
22
|
const response = await fetch(`${API_BASE}/api/modules/search`, {
|
|
29
23
|
method: 'POST',
|
|
@@ -37,37 +31,37 @@ class HubCommand {
|
|
|
37
31
|
}
|
|
38
32
|
const data = await response.json();
|
|
39
33
|
if (data.results.length === 0) {
|
|
40
|
-
console.log(
|
|
41
|
-
console.log(
|
|
34
|
+
console.log(chalk.yellow('No modules found matching your query.'));
|
|
35
|
+
console.log(chalk.gray('Try: vigthoria hub list to see all available modules\n'));
|
|
42
36
|
return;
|
|
43
37
|
}
|
|
44
|
-
console.log(
|
|
38
|
+
console.log(chalk.green(`Found ${data.results.length} module(s):\n`));
|
|
45
39
|
data.results.forEach((module, index) => {
|
|
46
|
-
const statusColor = module.status === 'active' ?
|
|
47
|
-
console.log(
|
|
48
|
-
console.log(
|
|
49
|
-
console.log(
|
|
40
|
+
const statusColor = module.status === 'active' ? chalk.green : chalk.gray;
|
|
41
|
+
console.log(chalk.bold.white(` ${index + 1}. ${module.name}`));
|
|
42
|
+
console.log(chalk.gray(` ${module.description.substring(0, 80)}...`));
|
|
43
|
+
console.log(chalk.cyan(` 💰 ${module.pricing.example}`));
|
|
50
44
|
console.log(statusColor(` 📊 Status: ${module.status.toUpperCase()}`));
|
|
51
|
-
console.log(
|
|
45
|
+
console.log(chalk.gray(` 🔗 ${module.documentation}`));
|
|
52
46
|
console.log();
|
|
53
47
|
});
|
|
54
48
|
if (data.suggestion) {
|
|
55
|
-
console.log(
|
|
49
|
+
console.log(chalk.cyan(`💡 ${data.suggestion}`));
|
|
56
50
|
}
|
|
57
|
-
console.log(
|
|
58
|
-
console.log(
|
|
51
|
+
console.log(chalk.gray('\nTo activate a module: vigthoria hub activate <module-name>'));
|
|
52
|
+
console.log(chalk.gray('Example: vigthoria hub activate music\n'));
|
|
59
53
|
}
|
|
60
54
|
catch (error) {
|
|
61
55
|
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
62
|
-
console.log(
|
|
63
|
-
console.log(
|
|
56
|
+
console.log(chalk.red(`Error: ${errMsg}`));
|
|
57
|
+
console.log(chalk.gray('Make sure you have an active internet connection.'));
|
|
64
58
|
}
|
|
65
59
|
}
|
|
66
60
|
/**
|
|
67
61
|
* List all available modules
|
|
68
62
|
*/
|
|
69
63
|
async list(options) {
|
|
70
|
-
console.log(
|
|
64
|
+
console.log(chalk.cyan('\n📦 Vigthoria Module Hub\n'));
|
|
71
65
|
try {
|
|
72
66
|
let url = `${API_BASE}/api/modules`;
|
|
73
67
|
if (options.category) {
|
|
@@ -75,7 +69,7 @@ class HubCommand {
|
|
|
75
69
|
}
|
|
76
70
|
const response = await fetch(url);
|
|
77
71
|
const data = await response.json();
|
|
78
|
-
console.log(
|
|
72
|
+
console.log(chalk.bold.white('Available Modules:\n'));
|
|
79
73
|
// Group by category
|
|
80
74
|
const grouped = data.modules.reduce((acc, module) => {
|
|
81
75
|
if (!acc[module.category])
|
|
@@ -84,25 +78,25 @@ class HubCommand {
|
|
|
84
78
|
return acc;
|
|
85
79
|
}, {});
|
|
86
80
|
Object.entries(grouped).forEach(([category, modules]) => {
|
|
87
|
-
console.log(
|
|
88
|
-
console.log(
|
|
81
|
+
console.log(chalk.cyan.bold(` ${category.toUpperCase()}`));
|
|
82
|
+
console.log(chalk.gray(' ' + '─'.repeat(50)));
|
|
89
83
|
modules.forEach((module) => {
|
|
90
|
-
console.log(
|
|
91
|
-
console.log(
|
|
92
|
-
console.log(
|
|
84
|
+
console.log(chalk.white(` 📦 ${module.name.padEnd(25)} ${chalk.gray(module.id)}`));
|
|
85
|
+
console.log(chalk.gray(` ${module.description.substring(0, 60)}...`));
|
|
86
|
+
console.log(chalk.yellow(` ${module.pricing.example}`));
|
|
93
87
|
console.log();
|
|
94
88
|
});
|
|
95
89
|
});
|
|
96
|
-
console.log(
|
|
97
|
-
console.log(
|
|
98
|
-
console.log(
|
|
99
|
-
console.log(
|
|
100
|
-
console.log(
|
|
101
|
-
console.log(
|
|
90
|
+
console.log(chalk.gray('─'.repeat(60)));
|
|
91
|
+
console.log(chalk.cyan('\nCommands:'));
|
|
92
|
+
console.log(chalk.gray(' vigthoria hub search "generate music" - Semantic search'));
|
|
93
|
+
console.log(chalk.gray(' vigthoria hub activate <module> - Activate module'));
|
|
94
|
+
console.log(chalk.gray(' vigthoria hub active - Show active modules'));
|
|
95
|
+
console.log(chalk.gray(' vigthoria hub info <module> - Module details\n'));
|
|
102
96
|
}
|
|
103
97
|
catch (error) {
|
|
104
98
|
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
105
|
-
console.log(
|
|
99
|
+
console.log(chalk.red(`Error: ${errMsg}`));
|
|
106
100
|
}
|
|
107
101
|
}
|
|
108
102
|
/**
|
|
@@ -111,10 +105,10 @@ class HubCommand {
|
|
|
111
105
|
async activate(moduleId) {
|
|
112
106
|
const authToken = this.config.get('authToken');
|
|
113
107
|
if (!authToken) {
|
|
114
|
-
console.log(
|
|
108
|
+
console.log(chalk.red('\n❌ Not authenticated. Run: vigthoria login\n'));
|
|
115
109
|
return;
|
|
116
110
|
}
|
|
117
|
-
console.log(
|
|
111
|
+
console.log(chalk.cyan(`\n🔌 Activating module: ${moduleId}...\n`));
|
|
118
112
|
try {
|
|
119
113
|
const response = await fetch(`${API_BASE}/api/modules/${moduleId}/activate`, {
|
|
120
114
|
method: 'POST',
|
|
@@ -128,27 +122,27 @@ class HubCommand {
|
|
|
128
122
|
throw new Error(errorData.error || response.statusText);
|
|
129
123
|
}
|
|
130
124
|
const data = await response.json();
|
|
131
|
-
console.log(
|
|
125
|
+
console.log(chalk.green(`✅ ${data.message}`));
|
|
132
126
|
console.log();
|
|
133
|
-
console.log(
|
|
134
|
-
console.log(
|
|
127
|
+
console.log(chalk.white('📚 Documentation:'));
|
|
128
|
+
console.log(chalk.gray(` ${data.documentation}`));
|
|
135
129
|
console.log();
|
|
136
|
-
console.log(
|
|
130
|
+
console.log(chalk.white('🔗 Available Endpoints:'));
|
|
137
131
|
data.endpoints.forEach((ep) => {
|
|
138
|
-
console.log(
|
|
139
|
-
console.log(
|
|
132
|
+
console.log(chalk.gray(` ${ep.method.padEnd(6)} ${ep.path}`));
|
|
133
|
+
console.log(chalk.gray(` ${ep.description}`));
|
|
140
134
|
});
|
|
141
135
|
console.log();
|
|
142
|
-
console.log(
|
|
143
|
-
console.log(
|
|
144
|
-
console.log(
|
|
136
|
+
console.log(chalk.cyan('💡 Quick Start:'));
|
|
137
|
+
console.log(chalk.gray(` Use your API key in requests:`));
|
|
138
|
+
console.log(chalk.gray(` Authorization: Bearer ${authToken.substring(0, 8)}...`));
|
|
145
139
|
console.log();
|
|
146
140
|
}
|
|
147
141
|
catch (error) {
|
|
148
142
|
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
149
|
-
console.log(
|
|
150
|
-
console.log(
|
|
151
|
-
console.log(
|
|
143
|
+
console.log(chalk.red(`❌ Activation failed: ${errMsg}`));
|
|
144
|
+
console.log(chalk.gray('\nMake sure the module ID is correct.'));
|
|
145
|
+
console.log(chalk.gray('Run: vigthoria hub list to see available modules.'));
|
|
152
146
|
}
|
|
153
147
|
}
|
|
154
148
|
/**
|
|
@@ -157,10 +151,10 @@ class HubCommand {
|
|
|
157
151
|
async active() {
|
|
158
152
|
const authToken = this.config.get('authToken');
|
|
159
153
|
if (!authToken) {
|
|
160
|
-
console.log(
|
|
154
|
+
console.log(chalk.red('\n❌ Not authenticated. Run: vigthoria login\n'));
|
|
161
155
|
return;
|
|
162
156
|
}
|
|
163
|
-
console.log(
|
|
157
|
+
console.log(chalk.cyan('\n📦 Your Active Modules\n'));
|
|
164
158
|
try {
|
|
165
159
|
const response = await fetch(`${API_BASE}/api/modules/active`, {
|
|
166
160
|
headers: {
|
|
@@ -172,117 +166,116 @@ class HubCommand {
|
|
|
172
166
|
}
|
|
173
167
|
const data = await response.json();
|
|
174
168
|
if (data.allAccess) {
|
|
175
|
-
console.log(
|
|
169
|
+
console.log(chalk.green('🌟 You have access to ALL modules!\n'));
|
|
176
170
|
}
|
|
177
|
-
console.log(
|
|
171
|
+
console.log(chalk.white(`Tier: ${chalk.cyan.bold(data.tier.toUpperCase())}`));
|
|
178
172
|
console.log();
|
|
179
173
|
if (data.activeModules.length === 0) {
|
|
180
|
-
console.log(
|
|
181
|
-
console.log(
|
|
174
|
+
console.log(chalk.yellow('No modules activated yet.'));
|
|
175
|
+
console.log(chalk.gray('\nActivate modules with: vigthoria hub activate <module>'));
|
|
182
176
|
}
|
|
183
177
|
else {
|
|
184
|
-
console.log(
|
|
178
|
+
console.log(chalk.white('Active modules:'));
|
|
185
179
|
data.activeModules.forEach((module) => {
|
|
186
|
-
console.log(
|
|
187
|
-
console.log(
|
|
188
|
-
console.log(
|
|
180
|
+
console.log(chalk.green(` ✅ ${module.name}`));
|
|
181
|
+
console.log(chalk.gray(` Endpoint: ${module.endpoint}`));
|
|
182
|
+
console.log(chalk.yellow(` Cost: ${module.pricing.example}`));
|
|
189
183
|
console.log();
|
|
190
184
|
});
|
|
191
185
|
}
|
|
192
186
|
}
|
|
193
187
|
catch (error) {
|
|
194
188
|
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
195
|
-
console.log(
|
|
189
|
+
console.log(chalk.red(`Error: ${errMsg}`));
|
|
196
190
|
}
|
|
197
191
|
}
|
|
198
192
|
/**
|
|
199
193
|
* Get detailed info about a specific module
|
|
200
194
|
*/
|
|
201
195
|
async info(moduleId) {
|
|
202
|
-
console.log(
|
|
196
|
+
console.log(chalk.cyan(`\n📖 Module Info: ${moduleId}\n`));
|
|
203
197
|
try {
|
|
204
198
|
const response = await fetch(`${API_BASE}/api/modules/${moduleId}`);
|
|
205
199
|
if (!response.ok) {
|
|
206
200
|
throw new Error('Module not found');
|
|
207
201
|
}
|
|
208
202
|
const module = await response.json();
|
|
209
|
-
console.log(
|
|
210
|
-
console.log(
|
|
203
|
+
console.log(chalk.bold.white(`${module.name}`));
|
|
204
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
211
205
|
console.log();
|
|
212
|
-
console.log(
|
|
213
|
-
console.log(
|
|
206
|
+
console.log(chalk.white('Description:'));
|
|
207
|
+
console.log(chalk.gray(` ${module.description}`));
|
|
214
208
|
console.log();
|
|
215
|
-
console.log(
|
|
216
|
-
console.log(
|
|
209
|
+
console.log(chalk.white('Category:'), chalk.cyan(module.category));
|
|
210
|
+
console.log(chalk.white('Tags:'), chalk.gray(module.tags.join(', ')));
|
|
217
211
|
console.log();
|
|
218
|
-
console.log(
|
|
219
|
-
console.log(
|
|
220
|
-
console.log(
|
|
212
|
+
console.log(chalk.white('💰 Pricing:'));
|
|
213
|
+
console.log(chalk.yellow(` ${module.pricing.example}`));
|
|
214
|
+
console.log(chalk.gray(` Billed per ${module.pricing.unit}`));
|
|
221
215
|
console.log();
|
|
222
216
|
if (module.rateLimits) {
|
|
223
|
-
console.log(
|
|
217
|
+
console.log(chalk.white('📊 Rate Limits:'));
|
|
224
218
|
Object.entries(module.rateLimits).forEach(([tier, limit]) => {
|
|
225
|
-
console.log(
|
|
219
|
+
console.log(chalk.gray(` ${tier.padEnd(12)} ${limit} requests/minute`));
|
|
226
220
|
});
|
|
227
221
|
console.log();
|
|
228
222
|
}
|
|
229
223
|
if (module.endpoints) {
|
|
230
|
-
console.log(
|
|
224
|
+
console.log(chalk.white('🔗 Endpoints:'));
|
|
231
225
|
module.endpoints.forEach((ep) => {
|
|
232
|
-
console.log(
|
|
233
|
-
console.log(
|
|
226
|
+
console.log(chalk.cyan(` ${ep.method.padEnd(6)} ${ep.path}`));
|
|
227
|
+
console.log(chalk.gray(` ${ep.description}`));
|
|
234
228
|
});
|
|
235
229
|
console.log();
|
|
236
230
|
}
|
|
237
231
|
// Show code examples if available
|
|
238
232
|
if (module.codeExamples && Object.keys(module.codeExamples).length > 0) {
|
|
239
|
-
console.log(
|
|
233
|
+
console.log(chalk.white('📝 Code Examples:'));
|
|
240
234
|
if (module.codeExamples.curl) {
|
|
241
|
-
console.log(
|
|
242
|
-
console.log(
|
|
235
|
+
console.log(chalk.cyan('\n cURL:'));
|
|
236
|
+
console.log(chalk.gray(' ' + module.codeExamples.curl.split('\n').join('\n ')));
|
|
243
237
|
}
|
|
244
238
|
if (module.codeExamples.node) {
|
|
245
|
-
console.log(
|
|
246
|
-
console.log(
|
|
239
|
+
console.log(chalk.cyan('\n Node.js:'));
|
|
240
|
+
console.log(chalk.gray(' ' + module.codeExamples.node.split('\n').join('\n ')));
|
|
247
241
|
}
|
|
248
242
|
}
|
|
249
243
|
console.log();
|
|
250
|
-
console.log(
|
|
244
|
+
console.log(chalk.gray(`Documentation: ${module.documentation}`));
|
|
251
245
|
if (module.external) {
|
|
252
|
-
console.log(
|
|
246
|
+
console.log(chalk.gray(`External URL: ${module.external}`));
|
|
253
247
|
}
|
|
254
248
|
console.log();
|
|
255
|
-
console.log(
|
|
249
|
+
console.log(chalk.cyan('To activate: ') + chalk.white(`vigthoria hub activate ${moduleId}`));
|
|
256
250
|
console.log();
|
|
257
251
|
}
|
|
258
252
|
catch (error) {
|
|
259
253
|
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
260
|
-
console.log(
|
|
261
|
-
console.log(
|
|
254
|
+
console.log(chalk.red(`Error: ${errMsg}`));
|
|
255
|
+
console.log(chalk.gray('\nAvailable modules: pay, meet, llm, music, voice, images'));
|
|
262
256
|
}
|
|
263
257
|
}
|
|
264
258
|
/**
|
|
265
259
|
* Interactive discover mode - prompts user with suggestions
|
|
266
260
|
*/
|
|
267
261
|
async discover() {
|
|
268
|
-
console.log(
|
|
269
|
-
console.log(
|
|
262
|
+
console.log(chalk.cyan('\n🚀 Vigthoria Module Discovery\n'));
|
|
263
|
+
console.log(chalk.white('What are you building? Describe your project:\n'));
|
|
270
264
|
// Show common use cases
|
|
271
|
-
console.log(
|
|
272
|
-
console.log(
|
|
273
|
-
console.log(
|
|
274
|
-
console.log(
|
|
275
|
-
console.log(
|
|
276
|
-
console.log(
|
|
277
|
-
console.log(
|
|
278
|
-
console.log(
|
|
265
|
+
console.log(chalk.gray('Examples of what you can build:'));
|
|
266
|
+
console.log(chalk.gray(' • "I need background music for my app"'));
|
|
267
|
+
console.log(chalk.gray(' • "voice narration for videos"'));
|
|
268
|
+
console.log(chalk.gray(' • "AI chatbot for customer support"'));
|
|
269
|
+
console.log(chalk.gray(' • "payment processing for my SaaS"'));
|
|
270
|
+
console.log(chalk.gray(' • "image generation for social media"\n'));
|
|
271
|
+
console.log(chalk.cyan('Use: vigthoria hub search "<your use case>"'));
|
|
272
|
+
console.log(chalk.gray('The AI will find the best modules for your needs.\n'));
|
|
279
273
|
// Show pricing tiers
|
|
280
|
-
console.log(
|
|
281
|
-
console.log(
|
|
282
|
-
console.log(
|
|
283
|
-
console.log(
|
|
274
|
+
console.log(chalk.white('💳 Subscription Tiers:'));
|
|
275
|
+
console.log(chalk.gray(' Starter €49/mo 50 credits'));
|
|
276
|
+
console.log(chalk.gray(' Business €199/mo 500 credits'));
|
|
277
|
+
console.log(chalk.gray(' Enterprise €499/mo 2000 credits'));
|
|
284
278
|
console.log();
|
|
285
|
-
console.log(
|
|
279
|
+
console.log(chalk.cyan('Get started: https://landing.vigthoria.io/api-keys.html\n'));
|
|
286
280
|
}
|
|
287
281
|
}
|
|
288
|
-
exports.HubCommand = HubCommand;
|