vigthoria-cli 1.10.47 → 1.10.49
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/agent-session-menu.js +2 -8
- package/dist/commands/auth.js +51 -68
- package/dist/commands/bridge.js +42 -22
- package/dist/commands/cancel.js +15 -22
- package/dist/commands/chat.d.ts +3 -0
- package/dist/commands/chat.js +326 -295
- package/dist/commands/config.js +33 -73
- package/dist/commands/deploy.js +83 -123
- package/dist/commands/device.js +21 -61
- package/dist/commands/edit.js +32 -39
- package/dist/commands/explain.js +18 -25
- package/dist/commands/fork.d.ts +17 -0
- package/dist/commands/fork.js +164 -0
- package/dist/commands/generate.js +37 -44
- package/dist/commands/history.d.ts +17 -0
- package/dist/commands/history.js +113 -0
- package/dist/commands/hub.js +95 -102
- package/dist/commands/index.js +41 -46
- package/dist/commands/legion.js +146 -186
- package/dist/commands/preview.d.ts +55 -0
- package/dist/commands/preview.js +467 -0
- package/dist/commands/replay.d.ts +18 -0
- package/dist/commands/replay.js +156 -0
- package/dist/commands/repo.d.ts +97 -0
- package/dist/commands/repo.js +773 -0
- package/dist/commands/review.js +29 -36
- package/dist/commands/security.js +5 -12
- package/dist/commands/update.d.ts +9 -0
- package/dist/commands/update.js +201 -0
- package/dist/commands/wallet.js +28 -35
- package/dist/commands/workflow.js +13 -20
- package/dist/index.d.ts +21 -0
- package/dist/index.js +1652 -0
- package/dist/utils/api.d.ts +544 -0
- package/dist/utils/api.js +5486 -0
- package/dist/utils/brain-hub-client.js +1 -5
- 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/codebase-indexer.js +4 -41
- package/dist/utils/config.d.ts +82 -0
- package/dist/utils/config.js +269 -0
- package/dist/utils/context-ranker.js +15 -21
- package/dist/utils/desktop-bridge-client.d.ts +12 -0
- package/dist/utils/desktop-bridge-client.js +30 -0
- package/dist/utils/files.js +5 -42
- package/dist/utils/logger.js +42 -50
- package/dist/utils/persona.js +3 -8
- package/dist/utils/post-write-validator.js +26 -33
- package/dist/utils/project-memory.js +16 -23
- package/dist/utils/session.d.ts +118 -0
- package/dist/utils/session.js +423 -0
- package/dist/utils/task-display.js +13 -20
- package/dist/utils/tools.d.ts +269 -0
- package/dist/utils/tools.js +3450 -0
- package/dist/utils/workspace-brain-service.js +8 -45
- package/dist/utils/workspace-cache.js +18 -26
- package/dist/utils/workspace-stream.js +21 -63
- package/package.json +2 -1
- package/scripts/release/validate-no-go-gates.sh +7 -4
package/dist/commands/review.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Review Command - Code review with AI
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const marked_terminal_1 = require("marked-terminal");
|
|
13
|
-
const logger_js_1 = require("../utils/logger.js");
|
|
14
|
-
const api_js_1 = require("../utils/api.js");
|
|
15
|
-
const files_js_1 = require("../utils/files.js");
|
|
16
|
-
class ReviewCommand {
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { Marked } from 'marked';
|
|
6
|
+
import { markedTerminal } from 'marked-terminal';
|
|
7
|
+
import { createSpinner, CH } from '../utils/logger.js';
|
|
8
|
+
import { APIClient, CLIError, classifyError, formatCLIError } from '../utils/api.js';
|
|
9
|
+
import { FileUtils } from '../utils/files.js';
|
|
10
|
+
export class ReviewCommand {
|
|
17
11
|
config;
|
|
18
12
|
logger;
|
|
19
13
|
api;
|
|
@@ -22,10 +16,10 @@ class ReviewCommand {
|
|
|
22
16
|
constructor(config, logger) {
|
|
23
17
|
this.config = config;
|
|
24
18
|
this.logger = logger;
|
|
25
|
-
this.api = new
|
|
26
|
-
this.fileUtils = new
|
|
27
|
-
this.marked = new
|
|
28
|
-
this.marked.use(
|
|
19
|
+
this.api = new APIClient(config, logger);
|
|
20
|
+
this.fileUtils = new FileUtils(process.cwd(), config.get('project').ignorePatterns);
|
|
21
|
+
this.marked = new Marked();
|
|
22
|
+
this.marked.use(markedTerminal({
|
|
29
23
|
showSectionPrefix: false,
|
|
30
24
|
tab: 2,
|
|
31
25
|
width: 80,
|
|
@@ -51,9 +45,9 @@ class ReviewCommand {
|
|
|
51
45
|
return;
|
|
52
46
|
}
|
|
53
47
|
this.logger.section(`Reviewing: ${file.relativePath}`);
|
|
54
|
-
console.log(
|
|
48
|
+
console.log(chalk.gray(`Language: ${file.language} | Lines: ${file.lines}`));
|
|
55
49
|
console.log();
|
|
56
|
-
const spinner =
|
|
50
|
+
const spinner = createSpinner({
|
|
57
51
|
text: 'Analyzing code quality...',
|
|
58
52
|
spinner: 'dots',
|
|
59
53
|
}).start();
|
|
@@ -76,15 +70,15 @@ class ReviewCommand {
|
|
|
76
70
|
}
|
|
77
71
|
catch (error) {
|
|
78
72
|
spinner.stop();
|
|
79
|
-
const cliErr = error instanceof
|
|
80
|
-
this.logger.error(
|
|
73
|
+
const cliErr = error instanceof CLIError ? error : classifyError(error);
|
|
74
|
+
this.logger.error(formatCLIError(cliErr));
|
|
81
75
|
}
|
|
82
76
|
}
|
|
83
77
|
printTextReview(review) {
|
|
84
78
|
// Score
|
|
85
|
-
const scoreColor = review.score >= 80 ?
|
|
79
|
+
const scoreColor = review.score >= 80 ? chalk.green : review.score >= 60 ? chalk.yellow : chalk.red;
|
|
86
80
|
console.log();
|
|
87
|
-
console.log(
|
|
81
|
+
console.log(chalk.bold('Quality Score: ') + scoreColor(`${review.score}/100`));
|
|
88
82
|
console.log(this.renderScoreBar(review.score));
|
|
89
83
|
console.log();
|
|
90
84
|
// Issues
|
|
@@ -94,7 +88,7 @@ class ReviewCommand {
|
|
|
94
88
|
const severityIcon = this.getSeverityIcon(issue.severity);
|
|
95
89
|
const severityColor = this.getSeverityColor(issue.severity);
|
|
96
90
|
console.log(severityColor(`${severityIcon} [${issue.type}]`) +
|
|
97
|
-
|
|
91
|
+
chalk.gray(` Line ${issue.line}:`) +
|
|
98
92
|
` ${issue.message}`);
|
|
99
93
|
});
|
|
100
94
|
console.log();
|
|
@@ -106,7 +100,7 @@ class ReviewCommand {
|
|
|
106
100
|
if (review.suggestions.length > 0) {
|
|
107
101
|
this.logger.section('Suggestions');
|
|
108
102
|
review.suggestions.forEach((suggestion, i) => {
|
|
109
|
-
console.log(
|
|
103
|
+
console.log(chalk.cyan(`${i + 1}.`) + ` ${suggestion}`);
|
|
110
104
|
});
|
|
111
105
|
console.log();
|
|
112
106
|
}
|
|
@@ -133,10 +127,10 @@ class ReviewCommand {
|
|
|
133
127
|
const width = 30;
|
|
134
128
|
const filled = Math.round((score / 100) * width);
|
|
135
129
|
const empty = width - filled;
|
|
136
|
-
const color = score >= 80 ?
|
|
130
|
+
const color = score >= 80 ? chalk.green : score >= 60 ? chalk.yellow : chalk.red;
|
|
137
131
|
const filledChar = process.platform === 'win32' ? '#' : '\u2588';
|
|
138
132
|
const emptyChar = process.platform === 'win32' ? '.' : '\u2591';
|
|
139
|
-
return color(filledChar.repeat(filled)) +
|
|
133
|
+
return color(filledChar.repeat(filled)) + chalk.gray(emptyChar.repeat(empty));
|
|
140
134
|
}
|
|
141
135
|
/**
|
|
142
136
|
* Clean marked-terminal output for release-grade CLI presentation.
|
|
@@ -157,26 +151,25 @@ class ReviewCommand {
|
|
|
157
151
|
getSeverityIcon(severity) {
|
|
158
152
|
switch (severity.toLowerCase()) {
|
|
159
153
|
case 'error':
|
|
160
|
-
return
|
|
154
|
+
return CH.error;
|
|
161
155
|
case 'warning':
|
|
162
|
-
return
|
|
156
|
+
return CH.warn;
|
|
163
157
|
case 'info':
|
|
164
|
-
return
|
|
158
|
+
return CH.info;
|
|
165
159
|
default:
|
|
166
|
-
return
|
|
160
|
+
return CH.bullet;
|
|
167
161
|
}
|
|
168
162
|
}
|
|
169
163
|
getSeverityColor(severity) {
|
|
170
164
|
switch (severity.toLowerCase()) {
|
|
171
165
|
case 'error':
|
|
172
|
-
return
|
|
166
|
+
return chalk.red;
|
|
173
167
|
case 'warning':
|
|
174
|
-
return
|
|
168
|
+
return chalk.yellow;
|
|
175
169
|
case 'info':
|
|
176
|
-
return
|
|
170
|
+
return chalk.blue;
|
|
177
171
|
default:
|
|
178
|
-
return
|
|
172
|
+
return chalk.white;
|
|
179
173
|
}
|
|
180
174
|
}
|
|
181
175
|
}
|
|
182
|
-
exports.ReviewCommand = ReviewCommand;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SecurityCommand = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
class SecurityCommand {
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
export class SecurityCommand {
|
|
10
4
|
config;
|
|
11
5
|
logger;
|
|
12
6
|
constructor(config, logger) {
|
|
@@ -21,11 +15,11 @@ class SecurityCommand {
|
|
|
21
15
|
return 'http://127.0.0.1:4008';
|
|
22
16
|
}
|
|
23
17
|
resolveDir(dir) {
|
|
24
|
-
return
|
|
18
|
+
return path.resolve(dir || process.cwd());
|
|
25
19
|
}
|
|
26
20
|
async execute(tool, parameters) {
|
|
27
21
|
const baseUrl = this.getMcpBaseUrl();
|
|
28
|
-
const response = await
|
|
22
|
+
const response = await axios.post(`${baseUrl}/mcp/execute`, {
|
|
29
23
|
tool,
|
|
30
24
|
parameters,
|
|
31
25
|
context: {
|
|
@@ -95,4 +89,3 @@ class SecurityCommand {
|
|
|
95
89
|
}
|
|
96
90
|
}
|
|
97
91
|
}
|
|
98
|
-
exports.SecurityCommand = SecurityCommand;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
|
|
2
|
+
interface UpdateOptions {
|
|
3
|
+
check?: boolean;
|
|
4
|
+
packageManager?: PackageManager;
|
|
5
|
+
global?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function updateCommand(options?: UpdateOptions): Promise<void>;
|
|
8
|
+
export declare function update(): Promise<void>;
|
|
9
|
+
export default updateCommand;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { promisify } from 'node:util';
|
|
6
|
+
import { installUpdateWindows } from '../utils/tools.js';
|
|
7
|
+
// ESM shim — __filename is unavailable under "type": "module".
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const execFileAsync = promisify(execFile);
|
|
10
|
+
function markSuccessExit() {
|
|
11
|
+
process.exitCode = 0;
|
|
12
|
+
}
|
|
13
|
+
function markErrorExit() {
|
|
14
|
+
process.exitCode = 1;
|
|
15
|
+
}
|
|
16
|
+
function findPackageJson(startDir) {
|
|
17
|
+
let currentDir = startDir;
|
|
18
|
+
for (let depth = 0; depth < 8; depth += 1) {
|
|
19
|
+
const candidate = path.join(currentDir, 'package.json');
|
|
20
|
+
if (existsSync(candidate)) {
|
|
21
|
+
return candidate;
|
|
22
|
+
}
|
|
23
|
+
const parentDir = path.join(currentDir, '..');
|
|
24
|
+
if (parentDir === currentDir) {
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
currentDir = parentDir;
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
function readOwnPackageJson() {
|
|
32
|
+
const currentFile = __filename;
|
|
33
|
+
const packagePath = findPackageJson(path.join(currentFile, '..'));
|
|
34
|
+
if (!packagePath) {
|
|
35
|
+
throw new Error('Unable to locate package.json for the Vigthoria CLI.');
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
return JSON.parse(readFileSync(packagePath, 'utf8'));
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
42
|
+
throw new Error(`Unable to read package metadata: ${message}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function compareVersions(a, b) {
|
|
46
|
+
const parse = (version) => version.replace(/^v/, '').split(/[.-]/).map((part) => {
|
|
47
|
+
const value = Number.parseInt(part, 10);
|
|
48
|
+
return Number.isNaN(value) ? 0 : value;
|
|
49
|
+
});
|
|
50
|
+
const left = parse(a);
|
|
51
|
+
const right = parse(b);
|
|
52
|
+
const length = Math.max(left.length, right.length);
|
|
53
|
+
for (let index = 0; index < length; index += 1) {
|
|
54
|
+
const leftValue = left[index] ?? 0;
|
|
55
|
+
const rightValue = right[index] ?? 0;
|
|
56
|
+
if (leftValue > rightValue)
|
|
57
|
+
return 1;
|
|
58
|
+
if (leftValue < rightValue)
|
|
59
|
+
return -1;
|
|
60
|
+
}
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
function quoteCmdArg(value) {
|
|
64
|
+
if (!/[\s"&()<>^|]/.test(value)) {
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
return `"${value.replace(/(\\*)"/g, '$1$1\\"')}"`;
|
|
68
|
+
}
|
|
69
|
+
function toPlatformCommand(command, args) {
|
|
70
|
+
if (process.platform !== 'win32') {
|
|
71
|
+
return { command, args };
|
|
72
|
+
}
|
|
73
|
+
const cmdPath = process.env.ComSpec || path.join(process.env.SystemRoot || 'C:\\Windows', 'System32', 'cmd.exe');
|
|
74
|
+
return {
|
|
75
|
+
command: cmdPath,
|
|
76
|
+
args: ['/d', '/s', '/c', [command, ...args].map(quoteCmdArg).join(' ')],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
async function execPackageManager(command, args, timeout) {
|
|
80
|
+
const platformCommand = toPlatformCommand(command, args);
|
|
81
|
+
const { stdout } = await execFileAsync(platformCommand.command, platformCommand.args, {
|
|
82
|
+
timeout,
|
|
83
|
+
maxBuffer: 1024 * 1024,
|
|
84
|
+
windowsHide: true,
|
|
85
|
+
});
|
|
86
|
+
return stdout;
|
|
87
|
+
}
|
|
88
|
+
async function getLatestVersion(packageName) {
|
|
89
|
+
try {
|
|
90
|
+
const stdout = await execPackageManager('npm', ['view', packageName, 'version'], 30_000);
|
|
91
|
+
const latest = stdout.trim();
|
|
92
|
+
if (!latest) {
|
|
93
|
+
throw new Error('npm returned an empty version response');
|
|
94
|
+
}
|
|
95
|
+
return latest;
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
99
|
+
throw new Error(`Unable to check the latest published version: ${message}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
async function getVersionInfo() {
|
|
103
|
+
const packageJson = readOwnPackageJson();
|
|
104
|
+
const packageName = packageJson.name;
|
|
105
|
+
const current = packageJson.version;
|
|
106
|
+
if (!packageName || !current) {
|
|
107
|
+
throw new Error('The CLI package metadata must include both name and version.');
|
|
108
|
+
}
|
|
109
|
+
const latest = await getLatestVersion(packageName);
|
|
110
|
+
return {
|
|
111
|
+
current,
|
|
112
|
+
latest,
|
|
113
|
+
packageName,
|
|
114
|
+
updateAvailable: compareVersions(current, latest) < 0,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function resolveInstallCommand(packageManager, packageName, installGlobal) {
|
|
118
|
+
const target = `${packageName}@latest`;
|
|
119
|
+
switch (packageManager) {
|
|
120
|
+
case 'pnpm':
|
|
121
|
+
return { command: 'pnpm', args: installGlobal ? ['add', '--global', target] : ['add', '-D', target] };
|
|
122
|
+
case 'yarn':
|
|
123
|
+
return { command: 'yarn', args: installGlobal ? ['global', 'add', target] : ['add', '--dev', target] };
|
|
124
|
+
case 'bun':
|
|
125
|
+
return { command: 'bun', args: installGlobal ? ['add', '--global', target] : ['add', '--dev', target] };
|
|
126
|
+
case 'npm':
|
|
127
|
+
default:
|
|
128
|
+
return { command: 'npm', args: installGlobal ? ['install', '--global', target] : ['install', '--save-dev', target] };
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function formatCommand(command) {
|
|
132
|
+
return [command.command, ...command.args].map(quoteCmdArg).join(' ');
|
|
133
|
+
}
|
|
134
|
+
async function runInstall(packageManager, packageName, installGlobal) {
|
|
135
|
+
const installCommand = resolveInstallCommand(packageManager, packageName, installGlobal);
|
|
136
|
+
await execPackageManager(installCommand.command, installCommand.args, 120_000);
|
|
137
|
+
}
|
|
138
|
+
export async function updateCommand(options = {}) {
|
|
139
|
+
try {
|
|
140
|
+
const info = await getVersionInfo();
|
|
141
|
+
console.log(`Vigthoria CLI current version: ${info.current}`);
|
|
142
|
+
console.log(`Vigthoria CLI latest version: ${info.latest}`);
|
|
143
|
+
if (!info.updateAvailable) {
|
|
144
|
+
console.log('You are already running the latest Vigthoria CLI.');
|
|
145
|
+
markSuccessExit();
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
console.log(`Update available for ${info.packageName}: ${info.current} → ${info.latest}`);
|
|
149
|
+
if (options.check) {
|
|
150
|
+
markSuccessExit();
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const packageManager = options.packageManager ?? 'npm';
|
|
154
|
+
const installGlobal = options.global ?? true;
|
|
155
|
+
console.log(`Installing ${info.packageName}@latest with ${packageManager}...`);
|
|
156
|
+
if (process.platform === 'win32') {
|
|
157
|
+
const installerResult = await installUpdateWindows();
|
|
158
|
+
if (!installerResult.success && installerResult.error === 'ENOENT') {
|
|
159
|
+
const fallbackCommand = resolveInstallCommand(packageManager, info.packageName, installGlobal);
|
|
160
|
+
console.warn('Windows update installer was not found (ENOENT).');
|
|
161
|
+
console.warn('The bundled Windows installer may be missing from this installation.');
|
|
162
|
+
console.warn(`Manual installation command: ${formatCommand(fallbackCommand)}`);
|
|
163
|
+
console.warn('If automatic fallback fails, run the command above manually or download the latest Windows installer from the Vigthoria release page.');
|
|
164
|
+
await execPackageManager(fallbackCommand.command, fallbackCommand.args, 120_000);
|
|
165
|
+
console.log('Package manager installation finished successfully.');
|
|
166
|
+
}
|
|
167
|
+
else if (!installerResult.success) {
|
|
168
|
+
throw new Error(installerResult.error || 'Windows installer failed to start.');
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
console.log('Windows installer started successfully. Complete the installer prompts to finish updating.');
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
await runInstall(packageManager, info.packageName, installGlobal);
|
|
176
|
+
console.log('Package manager installation finished successfully.');
|
|
177
|
+
}
|
|
178
|
+
console.log('Vigthoria CLI update complete.');
|
|
179
|
+
markSuccessExit();
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
183
|
+
console.error(`Update failed: ${message}`);
|
|
184
|
+
markErrorExit();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
export async function update() {
|
|
188
|
+
try {
|
|
189
|
+
await updateCommand();
|
|
190
|
+
if (process.exitCode === 1) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
markSuccessExit();
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
197
|
+
console.error(`Update failed: ${message}`);
|
|
198
|
+
markErrorExit();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
export default updateCommand;
|
package/dist/commands/wallet.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* wallet.ts — VigCoin wallet management for Vigthoria CLI.
|
|
4
3
|
*
|
|
@@ -6,20 +5,15 @@
|
|
|
6
5
|
* vigthoria wallet history [--n 20] — recent transactions
|
|
7
6
|
* vigthoria wallet cloud-status — show cloud access and model pricing
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
exports.WalletCommand = void 0;
|
|
14
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
15
|
-
const config_js_1 = require("../utils/config.js");
|
|
16
|
-
const logger_js_1 = require("../utils/logger.js");
|
|
17
|
-
class WalletCommand {
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import { Config } from '../utils/config.js';
|
|
10
|
+
import { Logger } from '../utils/logger.js';
|
|
11
|
+
export class WalletCommand {
|
|
18
12
|
config;
|
|
19
13
|
logger;
|
|
20
14
|
constructor() {
|
|
21
|
-
this.config = new
|
|
22
|
-
this.logger = new
|
|
15
|
+
this.config = new Config();
|
|
16
|
+
this.logger = new Logger();
|
|
23
17
|
}
|
|
24
18
|
getBaseUrl() {
|
|
25
19
|
return String(this.config.get('apiUrl') || 'https://coder.vigthoria.io').replace(/\/$/, '');
|
|
@@ -105,16 +99,16 @@ class WalletCommand {
|
|
|
105
99
|
return;
|
|
106
100
|
}
|
|
107
101
|
console.log('');
|
|
108
|
-
console.log(
|
|
109
|
-
console.log(
|
|
110
|
-
console.log(` Balance: ${
|
|
111
|
-
console.log(` Lifetime earned: ${
|
|
112
|
-
console.log(` Lifetime spent: ${
|
|
102
|
+
console.log(chalk.bold.cyan(' VigCoin Wallet'));
|
|
103
|
+
console.log(chalk.gray(' ─────────────────────────────'));
|
|
104
|
+
console.log(` Balance: ${chalk.bold.yellow(data.balance.toLocaleString())} ⓥ`);
|
|
105
|
+
console.log(` Lifetime earned: ${chalk.green(data.lifetimeEarned.toLocaleString())} ⓥ`);
|
|
106
|
+
console.log(` Lifetime spent: ${chalk.red(data.lifetimeSpent.toLocaleString())} ⓥ`);
|
|
113
107
|
if (data.lastUpdated) {
|
|
114
|
-
console.log(` Last updated: ${
|
|
108
|
+
console.log(` Last updated: ${chalk.gray(new Date(data.lastUpdated).toLocaleString())}`);
|
|
115
109
|
}
|
|
116
110
|
console.log('');
|
|
117
|
-
console.log(
|
|
111
|
+
console.log(chalk.gray(' Top up at: https://hub.vigthoria.io/credits'));
|
|
118
112
|
console.log('');
|
|
119
113
|
}
|
|
120
114
|
catch (err) {
|
|
@@ -132,17 +126,17 @@ class WalletCommand {
|
|
|
132
126
|
}
|
|
133
127
|
const txs = data.transactions || [];
|
|
134
128
|
console.log('');
|
|
135
|
-
console.log(
|
|
136
|
-
console.log(
|
|
129
|
+
console.log(chalk.bold.cyan(` VigCoin Transaction History (last ${txs.length})`));
|
|
130
|
+
console.log(chalk.gray(' ──────────────────────────────────────────────────────────'));
|
|
137
131
|
if (txs.length === 0) {
|
|
138
|
-
console.log(
|
|
132
|
+
console.log(chalk.gray(' No transactions found.'));
|
|
139
133
|
}
|
|
140
134
|
else {
|
|
141
135
|
for (const tx of txs) {
|
|
142
|
-
const sign = tx.amount >= 0 ?
|
|
136
|
+
const sign = tx.amount >= 0 ? chalk.green(`+${tx.amount}`) : chalk.red(String(tx.amount));
|
|
143
137
|
const date = new Date(tx.created_at).toLocaleString();
|
|
144
138
|
const desc = tx.description || tx.action || tx.type;
|
|
145
|
-
console.log(` ${
|
|
139
|
+
console.log(` ${chalk.gray(date)} ${sign.padStart(8)} ⓥ ${chalk.gray(`→`)} ${chalk.yellow(tx.balance_after)} ⓥ ${desc}`);
|
|
146
140
|
}
|
|
147
141
|
}
|
|
148
142
|
console.log('');
|
|
@@ -160,32 +154,32 @@ class WalletCommand {
|
|
|
160
154
|
return;
|
|
161
155
|
}
|
|
162
156
|
console.log('');
|
|
163
|
-
console.log(
|
|
164
|
-
console.log(
|
|
157
|
+
console.log(chalk.bold.cyan(' Cloud Access Status'));
|
|
158
|
+
console.log(chalk.gray(' ─────────────────────────────'));
|
|
165
159
|
if (data.isMasterAdmin) {
|
|
166
|
-
console.log(` Access: ${
|
|
160
|
+
console.log(` Access: ${chalk.bold.green('Master Admin — unlimited cloud access')}`);
|
|
167
161
|
}
|
|
168
162
|
else if (data.hasGrant) {
|
|
169
163
|
const models = data.grantDetails?.allowedModels === '*' ? 'All models' : data.grantDetails?.allowedModels;
|
|
170
164
|
const exp = data.grantDetails?.expiresAt ? ` (expires ${new Date(data.grantDetails.expiresAt).toLocaleDateString()})` : '';
|
|
171
|
-
console.log(` Access: ${
|
|
165
|
+
console.log(` Access: ${chalk.green(`Granted — ${models}${exp}`)}`);
|
|
172
166
|
}
|
|
173
167
|
else if (data.cloudAccessAllowed) {
|
|
174
|
-
console.log(` Access: ${
|
|
168
|
+
console.log(` Access: ${chalk.yellow('Enabled — pay per request with VigCoins')}`);
|
|
175
169
|
}
|
|
176
170
|
else {
|
|
177
|
-
console.log(` Access: ${
|
|
171
|
+
console.log(` Access: ${chalk.red('Not enabled — contact admin to request cloud access')}`);
|
|
178
172
|
}
|
|
179
173
|
console.log('');
|
|
180
174
|
if (data.cloudModels) {
|
|
181
|
-
console.log(
|
|
182
|
-
console.log(
|
|
175
|
+
console.log(chalk.bold(' Cloud Model Pricing'));
|
|
176
|
+
console.log(chalk.gray(' ─────────────────────────────'));
|
|
183
177
|
for (const [alias, cost] of Object.entries(data.cloudModels)) {
|
|
184
178
|
const displayName = alias.replace('vigthoria-cloud-', '').replace(/\b\w/g, c => c.toUpperCase());
|
|
185
|
-
console.log(` ${
|
|
179
|
+
console.log(` ${chalk.cyan(`vigthoria-cloud-${displayName.toLowerCase()}`).padEnd(36)} ${chalk.yellow(String(cost))} credits minimum reserve, then token-priced`);
|
|
186
180
|
}
|
|
187
181
|
console.log('');
|
|
188
|
-
console.log(
|
|
182
|
+
console.log(chalk.gray(' Use --model vigthoria-cloud-fast|balanced|code|power|maximum in vigthoria chat'));
|
|
189
183
|
}
|
|
190
184
|
console.log('');
|
|
191
185
|
}
|
|
@@ -195,4 +189,3 @@ class WalletCommand {
|
|
|
195
189
|
}
|
|
196
190
|
}
|
|
197
191
|
}
|
|
198
|
-
exports.WalletCommand = WalletCommand;
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.WorkflowCommand = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const api_js_1 = require("../utils/api.js");
|
|
9
|
-
const project_memory_js_1 = require("../utils/project-memory.js");
|
|
10
|
-
class WorkflowCommand {
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { APIClient, } from '../utils/api.js';
|
|
3
|
+
import { ProjectMemoryService } from '../utils/project-memory.js';
|
|
4
|
+
export class WorkflowCommand {
|
|
11
5
|
config;
|
|
12
6
|
logger;
|
|
13
7
|
api;
|
|
14
8
|
constructor(config, logger) {
|
|
15
9
|
this.config = config;
|
|
16
10
|
this.logger = logger;
|
|
17
|
-
this.api = new
|
|
11
|
+
this.api = new APIClient(config, logger);
|
|
18
12
|
}
|
|
19
13
|
ensureAuthenticated(json = false) {
|
|
20
14
|
if (this.config.isAuthenticated()) {
|
|
@@ -48,7 +42,7 @@ class WorkflowCommand {
|
|
|
48
42
|
console.log(JSON.stringify(payload, null, 2));
|
|
49
43
|
}
|
|
50
44
|
createProjectMemory() {
|
|
51
|
-
return new
|
|
45
|
+
return new ProjectMemoryService(process.cwd());
|
|
52
46
|
}
|
|
53
47
|
buildBrainPayload(workflowId, data) {
|
|
54
48
|
const memory = this.createProjectMemory();
|
|
@@ -103,7 +97,7 @@ class WorkflowCommand {
|
|
|
103
97
|
}
|
|
104
98
|
this.logger.section('Workflow Templates');
|
|
105
99
|
if (templates.length === 0) {
|
|
106
|
-
console.log(
|
|
100
|
+
console.log(chalk.yellow('No templates matched your filters.'));
|
|
107
101
|
return;
|
|
108
102
|
}
|
|
109
103
|
this.logger.table(['ID', 'Name', 'Category', 'Tags'], templates.map((template) => [
|
|
@@ -138,7 +132,7 @@ class WorkflowCommand {
|
|
|
138
132
|
}
|
|
139
133
|
this.logger.section('Workflows');
|
|
140
134
|
if (workflows.length === 0) {
|
|
141
|
-
console.log(
|
|
135
|
+
console.log(chalk.yellow('No workflows found for this account.'));
|
|
142
136
|
return;
|
|
143
137
|
}
|
|
144
138
|
this.logger.table(['ID', 'Name', 'Nodes', 'Runs', 'Updated'], workflows.map((workflow) => [
|
|
@@ -161,9 +155,9 @@ class WorkflowCommand {
|
|
|
161
155
|
return;
|
|
162
156
|
}
|
|
163
157
|
this.logger.success(`Created workflow ${workflow.name}`);
|
|
164
|
-
console.log(
|
|
158
|
+
console.log(chalk.gray(`Workflow ID: ${workflow.id}`));
|
|
165
159
|
if (workflow.fromTemplate) {
|
|
166
|
-
console.log(
|
|
160
|
+
console.log(chalk.gray(`Template: ${workflow.fromTemplate}`));
|
|
167
161
|
}
|
|
168
162
|
}
|
|
169
163
|
async run(workflowId, options) {
|
|
@@ -184,10 +178,10 @@ class WorkflowCommand {
|
|
|
184
178
|
return;
|
|
185
179
|
}
|
|
186
180
|
this.logger.success(`Workflow execution ${execution.status}`);
|
|
187
|
-
console.log(
|
|
188
|
-
console.log(
|
|
181
|
+
console.log(chalk.gray(`Execution ID: ${execution.executionId}`));
|
|
182
|
+
console.log(chalk.gray(`Nodes executed: ${execution.nodesExecuted ?? 0}`));
|
|
189
183
|
if (execution.error) {
|
|
190
|
-
console.log(
|
|
184
|
+
console.log(chalk.red(execution.error));
|
|
191
185
|
}
|
|
192
186
|
}
|
|
193
187
|
async status(executionId, options) {
|
|
@@ -210,4 +204,3 @@ class WorkflowCommand {
|
|
|
210
204
|
].join('\n'), 'Workflow Status');
|
|
211
205
|
}
|
|
212
206
|
}
|
|
213
|
-
exports.WorkflowCommand = WorkflowCommand;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Vigthoria CLI - AI-Powered Terminal Coding Assistant
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* vigthoria chat - Start interactive chat
|
|
7
|
+
* vigthoria edit <file> - Edit a file with AI assistance
|
|
8
|
+
* vigthoria generate <desc> - Generate code from description
|
|
9
|
+
* vigthoria explain <file> - Explain code in a file
|
|
10
|
+
* vigthoria fix <file> - Fix issues in a file
|
|
11
|
+
* vigthoria review <file> - Review code quality
|
|
12
|
+
* vigthoria login - Authenticate with Vigthoria
|
|
13
|
+
* vigthoria config - Configure settings
|
|
14
|
+
* vigthoria hub - Discover & activate API modules
|
|
15
|
+
* vigthoria workflow - Manage repeatable VigFlow workflows
|
|
16
|
+
* vigthoria operator - Start BMAD operator mode
|
|
17
|
+
*/
|
|
18
|
+
export declare function validateReleaseMetadata(): boolean;
|
|
19
|
+
export declare function setupErrorHandlers(): void;
|
|
20
|
+
export declare function main(args: string[]): Promise<void>;
|
|
21
|
+
export declare const __cliErrorHandlingReady = true;
|