vigthoria-cli 1.8.15 → 1.9.2
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 +2 -6
- package/dist/commands/auth.d.ts +49 -21
- package/dist/commands/auth.js +385 -343
- package/dist/commands/chat.d.ts +10 -2
- package/dist/commands/chat.js +328 -93
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +40 -20
- package/dist/commands/index.d.ts +12 -0
- package/dist/commands/index.js +182 -0
- package/dist/commands/legion.d.ts +39 -0
- package/dist/commands/legion.js +999 -71
- package/dist/index.d.ts +3 -1
- package/dist/index.js +506 -28
- package/dist/utils/api.d.ts +74 -18
- package/dist/utils/api.js +701 -805
- package/dist/utils/config.js +9 -10
- package/dist/utils/context-ranker.d.ts +24 -0
- package/dist/utils/context-ranker.js +147 -0
- package/dist/utils/post-write-validator.d.ts +25 -0
- package/dist/utils/post-write-validator.js +138 -0
- package/dist/utils/session.d.ts +19 -0
- package/dist/utils/session.js +91 -6
- package/dist/utils/task-display.d.ts +31 -0
- package/dist/utils/task-display.js +115 -0
- package/dist/utils/tools.d.ts +15 -0
- package/dist/utils/tools.js +341 -58
- package/dist/utils/workspace-cache.d.ts +31 -0
- package/dist/utils/workspace-cache.js +96 -0
- package/package.json +7 -3
|
@@ -16,6 +16,8 @@ export declare class ConfigCommand {
|
|
|
16
16
|
run(options: ConfigOptions): Promise<void>;
|
|
17
17
|
init(): Promise<void>;
|
|
18
18
|
private setConfig;
|
|
19
|
+
private formatConfigValueForDisplay;
|
|
20
|
+
private redactConfigUrl;
|
|
19
21
|
private getConfig;
|
|
20
22
|
private listConfig;
|
|
21
23
|
private resetConfig;
|
package/dist/commands/config.js
CHANGED
|
@@ -100,20 +100,14 @@ class ConfigCommand {
|
|
|
100
100
|
message: 'Default AI model:',
|
|
101
101
|
choices: [
|
|
102
102
|
{ name: '═══ Code Models ═══', disabled: true },
|
|
103
|
-
{ name: 'Vigthoria Code
|
|
104
|
-
{ name: 'Vigthoria Code
|
|
105
|
-
{ name: 'Vigthoria Code
|
|
103
|
+
{ name: 'Vigthoria v3 Code 35B - Flagship coding model', value: 'code' },
|
|
104
|
+
{ name: 'Vigthoria v3 Code 35B - Explicit 35B selection', value: 'code-35b' },
|
|
105
|
+
{ name: 'Vigthoria C1 Code 9B - Fast coding specialist', value: 'code-9b' },
|
|
106
106
|
{ name: '═══ General Models ═══', disabled: true },
|
|
107
|
-
{ name: 'Vigthoria
|
|
108
|
-
{ name: 'Vigthoria
|
|
109
|
-
{ name: 'Vigthoria Balanced (4B) - All-purpose', value: 'balanced' },
|
|
110
|
-
{ name: '═══ Creative Models ═══', disabled: true },
|
|
111
|
-
{ name: 'Vigthoria Creative V4 (9B) - Creative tasks', value: 'creative-v4' },
|
|
112
|
-
{ name: 'Vigthoria Creative V3 (9B) - Legacy creative', value: 'creative-v3' },
|
|
113
|
-
{ name: '═══ Specialized Models ═══', disabled: true },
|
|
114
|
-
{ name: 'Vigthoria Music Master (4B) - Music AI', value: 'music' },
|
|
107
|
+
{ name: 'Vigthoria Master 7.6B - Balanced general model', value: 'balanced' },
|
|
108
|
+
{ name: 'Vigthoria v3 Balanced 4B - Efficient general purpose', value: 'balanced-4b' },
|
|
115
109
|
],
|
|
116
|
-
default: 'code
|
|
110
|
+
default: 'code',
|
|
117
111
|
},
|
|
118
112
|
{
|
|
119
113
|
type: 'input',
|
|
@@ -172,13 +166,39 @@ class ConfigCommand {
|
|
|
172
166
|
};
|
|
173
167
|
if (configMap[key]) {
|
|
174
168
|
configMap[key](value);
|
|
175
|
-
this.logger.success(`Set ${key} = ${value}`);
|
|
169
|
+
this.logger.success(`Set ${key} = ${this.formatConfigValueForDisplay(key, value)}`);
|
|
176
170
|
}
|
|
177
171
|
else {
|
|
178
172
|
this.logger.error(`Unknown config key: ${key}`);
|
|
179
173
|
console.log(chalk_1.default.gray('Available keys: model, theme, autoApply, showDiffs, maxTokens, apiUrl, modelsApiUrl, wsUrl, selfHostedModelsApiUrl'));
|
|
180
174
|
}
|
|
181
175
|
}
|
|
176
|
+
formatConfigValueForDisplay(key, value) {
|
|
177
|
+
if (key === 'apiUrl' || key === 'modelsApiUrl' || key === 'wsUrl' || key === 'selfHostedModelsApiUrl') {
|
|
178
|
+
return this.redactConfigUrl(value);
|
|
179
|
+
}
|
|
180
|
+
return value;
|
|
181
|
+
}
|
|
182
|
+
redactConfigUrl(url) {
|
|
183
|
+
const text = String(url || '').trim();
|
|
184
|
+
if (!text)
|
|
185
|
+
return text;
|
|
186
|
+
try {
|
|
187
|
+
const parsed = new URL(text);
|
|
188
|
+
const host = parsed.hostname.toLowerCase();
|
|
189
|
+
const isLocal = host === 'localhost' || host === '127.0.0.1';
|
|
190
|
+
const isPrivate = /^10\./.test(host)
|
|
191
|
+
|| /^192\.168\./.test(host)
|
|
192
|
+
|| /^172\.(1[6-9]|2[0-9]|3[0-1])\./.test(host);
|
|
193
|
+
if (isLocal || isPrivate) {
|
|
194
|
+
return '[redacted-host]';
|
|
195
|
+
}
|
|
196
|
+
return text;
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
return text.replace(/\b(?:localhost|127\.0\.0\.1)(?::\d+)?\b/gi, '[redacted-host]');
|
|
200
|
+
}
|
|
201
|
+
}
|
|
182
202
|
getConfig(key) {
|
|
183
203
|
const all = this.config.getAll();
|
|
184
204
|
const flatConfig = {
|
|
@@ -207,9 +227,9 @@ class ConfigCommand {
|
|
|
207
227
|
console.log(chalk_1.default.cyan('═══ Vigthoria CLI Configuration ═══'));
|
|
208
228
|
console.log();
|
|
209
229
|
console.log(chalk_1.default.white('API:'));
|
|
210
|
-
console.log(chalk_1.default.gray(' URL: ') + chalk_1.default.cyan(all.apiUrl));
|
|
211
|
-
console.log(chalk_1.default.gray(' Models API: ') + chalk_1.default.cyan(all.modelsApiUrl));
|
|
212
|
-
console.log(chalk_1.default.gray(' WebSocket: ') + chalk_1.default.cyan(all.wsUrl));
|
|
230
|
+
console.log(chalk_1.default.gray(' URL: ') + chalk_1.default.cyan(this.redactConfigUrl(all.apiUrl)));
|
|
231
|
+
console.log(chalk_1.default.gray(' Models API: ') + chalk_1.default.cyan(this.redactConfigUrl(all.modelsApiUrl)));
|
|
232
|
+
console.log(chalk_1.default.gray(' WebSocket: ') + chalk_1.default.cyan(this.redactConfigUrl(all.wsUrl)));
|
|
213
233
|
console.log(chalk_1.default.gray(' Self-hosted Models: ') + chalk_1.default.cyan(all.selfHostedModelsApiUrl || 'disabled'));
|
|
214
234
|
console.log();
|
|
215
235
|
console.log(chalk_1.default.white('Preferences:'));
|
|
@@ -264,10 +284,10 @@ class ConfigCommand {
|
|
|
264
284
|
name: 'defaultModel',
|
|
265
285
|
message: 'Default AI model:',
|
|
266
286
|
choices: [
|
|
267
|
-
{ name: 'Vigthoria Code
|
|
268
|
-
{ name: 'Vigthoria
|
|
269
|
-
{ name: 'Vigthoria
|
|
270
|
-
{ name: 'Vigthoria
|
|
287
|
+
{ name: 'Vigthoria v3 Code 35B', value: 'code' },
|
|
288
|
+
{ name: 'Vigthoria C1 Code 9B', value: 'code-9b' },
|
|
289
|
+
{ name: 'Vigthoria Master 7.6B', value: 'balanced' },
|
|
290
|
+
{ name: 'Vigthoria v3 Balanced 4B', value: 'balanced-4b' },
|
|
271
291
|
],
|
|
272
292
|
default: current.preferences.defaultModel,
|
|
273
293
|
},
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
export interface CommandRegistrationResult {
|
|
3
|
+
name: string;
|
|
4
|
+
registered: boolean;
|
|
5
|
+
error?: Error;
|
|
6
|
+
}
|
|
7
|
+
export type CommandRegistrar = (program: Command) => void;
|
|
8
|
+
export declare function resolveCommand(name: string): CommandRegistrar | null;
|
|
9
|
+
export declare function registerCommands(cli: any): void;
|
|
10
|
+
export declare const setupCommands: typeof registerCommands;
|
|
11
|
+
export declare const configureCommands: typeof registerCommands;
|
|
12
|
+
export default registerCommands;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configureCommands = exports.setupCommands = void 0;
|
|
4
|
+
exports.resolveCommand = resolveCommand;
|
|
5
|
+
exports.registerCommands = registerCommands;
|
|
6
|
+
const auth_js_1 = require("./auth.js");
|
|
7
|
+
const bridge_js_1 = require("./bridge.js");
|
|
8
|
+
const cancel_js_1 = require("./cancel.js");
|
|
9
|
+
const chat_js_1 = require("./chat.js");
|
|
10
|
+
const config_js_1 = require("./config.js");
|
|
11
|
+
const deploy_js_1 = require("./deploy.js");
|
|
12
|
+
const edit_js_1 = require("./edit.js");
|
|
13
|
+
const explain_js_1 = require("./explain.js");
|
|
14
|
+
const fork_js_1 = require("./fork.js");
|
|
15
|
+
const generate_js_1 = require("./generate.js");
|
|
16
|
+
const history_js_1 = require("./history.js");
|
|
17
|
+
const hub_js_1 = require("./hub.js");
|
|
18
|
+
const legion_js_1 = require("./legion.js");
|
|
19
|
+
const preview_js_1 = require("./preview.js");
|
|
20
|
+
const replay_js_1 = require("./replay.js");
|
|
21
|
+
const repo_js_1 = require("./repo.js");
|
|
22
|
+
const review_js_1 = require("./review.js");
|
|
23
|
+
const workflow_js_1 = require("./workflow.js");
|
|
24
|
+
function isRegisterableCommand(value) {
|
|
25
|
+
return Boolean(value && typeof value === 'object');
|
|
26
|
+
}
|
|
27
|
+
function invokeRegistrar(instance, program) {
|
|
28
|
+
if (!isRegisterableCommand(instance)) {
|
|
29
|
+
throw new Error('Command instance is not registerable');
|
|
30
|
+
}
|
|
31
|
+
const registrar = instance.register ?? instance.setup ?? instance.configure;
|
|
32
|
+
if (typeof registrar !== 'function') {
|
|
33
|
+
throw new Error('Command does not expose register(), setup(), or configure()');
|
|
34
|
+
}
|
|
35
|
+
registrar.call(instance, program);
|
|
36
|
+
}
|
|
37
|
+
function createClassRegistrar(CommandClass) {
|
|
38
|
+
return (program) => {
|
|
39
|
+
invokeRegistrar(new CommandClass(), program);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function registerDoctorCommand(program) {
|
|
43
|
+
program
|
|
44
|
+
.command('doctor')
|
|
45
|
+
.description('Run local Vigthoria CLI diagnostics')
|
|
46
|
+
.action(() => {
|
|
47
|
+
const checks = [
|
|
48
|
+
['Node.js', process.version],
|
|
49
|
+
['Platform', `${process.platform} ${process.arch}`],
|
|
50
|
+
['Working directory', process.cwd()],
|
|
51
|
+
];
|
|
52
|
+
console.log('Vigthoria CLI diagnostics');
|
|
53
|
+
for (const [label, value] of checks) {
|
|
54
|
+
console.log(`- ${label}: ${value}`);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function registerVersionInfoCommand(program) {
|
|
59
|
+
program
|
|
60
|
+
.command('version-info')
|
|
61
|
+
.description('Show runtime version information')
|
|
62
|
+
.action(() => {
|
|
63
|
+
console.log(JSON.stringify({
|
|
64
|
+
node: process.version,
|
|
65
|
+
platform: process.platform,
|
|
66
|
+
arch: process.arch,
|
|
67
|
+
argv0: process.argv0,
|
|
68
|
+
}, null, 2));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const commandRegistry = [
|
|
72
|
+
{
|
|
73
|
+
name: 'auth',
|
|
74
|
+
handler: auth_js_1.registerAuthCommand,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'chat',
|
|
78
|
+
handler: createClassRegistrar(chat_js_1.ChatCommand),
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'edit',
|
|
82
|
+
handler: createClassRegistrar(edit_js_1.EditCommand),
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'generate',
|
|
86
|
+
handler: createClassRegistrar(generate_js_1.GenerateCommand),
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'explain',
|
|
90
|
+
handler: createClassRegistrar(explain_js_1.ExplainCommand),
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'config',
|
|
94
|
+
handler: createClassRegistrar(config_js_1.ConfigCommand),
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'review',
|
|
98
|
+
handler: createClassRegistrar(review_js_1.ReviewCommand),
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'hub',
|
|
102
|
+
handler: createClassRegistrar(hub_js_1.HubCommand),
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'repo',
|
|
106
|
+
handler: createClassRegistrar(repo_js_1.RepoCommand),
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'deploy',
|
|
110
|
+
handler: createClassRegistrar(deploy_js_1.DeployCommand),
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'bridge',
|
|
114
|
+
handler: createClassRegistrar(bridge_js_1.BridgeCommand),
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'workflow',
|
|
118
|
+
handler: createClassRegistrar(workflow_js_1.WorkflowCommand),
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'preview',
|
|
122
|
+
handler: createClassRegistrar(preview_js_1.PreviewCommand),
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: 'legion',
|
|
126
|
+
handler: createClassRegistrar(legion_js_1.LegionCommand),
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'history',
|
|
130
|
+
handler: createClassRegistrar(history_js_1.HistoryCommand),
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'replay',
|
|
134
|
+
handler: createClassRegistrar(replay_js_1.ReplayCommand),
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: 'fork',
|
|
138
|
+
handler: createClassRegistrar(fork_js_1.ForkCommand),
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: 'cancel',
|
|
142
|
+
handler: createClassRegistrar(cancel_js_1.CancelCommand),
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: 'doctor',
|
|
146
|
+
handler: registerDoctorCommand,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: 'version-info',
|
|
150
|
+
aliases: ['versionInfo'],
|
|
151
|
+
handler: registerVersionInfoCommand,
|
|
152
|
+
},
|
|
153
|
+
];
|
|
154
|
+
function normalizeCommandName(name) {
|
|
155
|
+
return name.trim().toLowerCase();
|
|
156
|
+
}
|
|
157
|
+
function commandNameMatches(entry, requestedName) {
|
|
158
|
+
if (normalizeCommandName(entry.name) === requestedName) {
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
return Boolean(entry.aliases?.some((alias) => normalizeCommandName(alias) === requestedName));
|
|
162
|
+
}
|
|
163
|
+
function resolveCommand(name) {
|
|
164
|
+
const requestedName = normalizeCommandName(name);
|
|
165
|
+
if (!requestedName) {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
const entry = commandRegistry.find((candidate) => commandNameMatches(candidate, requestedName));
|
|
169
|
+
return entry?.handler ?? null;
|
|
170
|
+
}
|
|
171
|
+
function registerCommands(cli) {
|
|
172
|
+
if (!cli || typeof cli.command !== 'function') {
|
|
173
|
+
throw new Error('registerCommands requires a Commander-compatible CLI instance');
|
|
174
|
+
}
|
|
175
|
+
const program = cli;
|
|
176
|
+
for (const entry of commandRegistry) {
|
|
177
|
+
entry.handler(program);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
exports.setupCommands = registerCommands;
|
|
181
|
+
exports.configureCommands = registerCommands;
|
|
182
|
+
exports.default = registerCommands;
|
|
@@ -15,14 +15,53 @@ interface LegionOptions {
|
|
|
15
15
|
status?: boolean;
|
|
16
16
|
worker?: string;
|
|
17
17
|
project?: string;
|
|
18
|
+
godmode?: boolean;
|
|
19
|
+
approve?: boolean;
|
|
20
|
+
noApprove?: boolean;
|
|
21
|
+
autoCharge?: boolean;
|
|
22
|
+
planOnly?: boolean;
|
|
23
|
+
models?: string;
|
|
24
|
+
timeoutSec?: number;
|
|
18
25
|
}
|
|
19
26
|
export declare class LegionCommand {
|
|
20
27
|
private config;
|
|
21
28
|
private logger;
|
|
22
29
|
constructor(config: Config, logger: Logger);
|
|
30
|
+
private getHyperloopUrls;
|
|
23
31
|
private getHeaders;
|
|
32
|
+
private readJsonResponse;
|
|
33
|
+
private propagateLegionApiError;
|
|
24
34
|
run(request: string | undefined, options: LegionOptions): Promise<void>;
|
|
35
|
+
private runGodmode;
|
|
36
|
+
private scanProject;
|
|
37
|
+
private resolveModelProfiles;
|
|
38
|
+
private buildRoleQuote;
|
|
39
|
+
private buildGodmodeExplicitSteps;
|
|
40
|
+
private buildBillingQuote;
|
|
41
|
+
private evaluateBillingGate;
|
|
42
|
+
private parseBooleanCandidate;
|
|
43
|
+
private fetchGodmodeEntitlement;
|
|
44
|
+
private isMasterAdminFree;
|
|
45
|
+
private getBillingBaseUrl;
|
|
46
|
+
private parseNumericCandidate;
|
|
47
|
+
private extractVigcoinBalance;
|
|
48
|
+
private getPurchaseUrlFromPayload;
|
|
49
|
+
private fetchWalletState;
|
|
50
|
+
private attemptDirectCharge;
|
|
51
|
+
private collectExecutionCharge;
|
|
52
|
+
private resolveBillingInsufficientFunds;
|
|
53
|
+
private printBillingGateSummary;
|
|
54
|
+
private printGodmodeQuote;
|
|
55
|
+
private confirmExecution;
|
|
56
|
+
/**
|
|
57
|
+
* SSE streaming URL for the Legion execution endpoint.
|
|
58
|
+
* Always hits Hyper Loop directly (port 8020) with the service key to avoid
|
|
59
|
+
* gateway JWT expiry killing long-running GodMode jobs.
|
|
60
|
+
*/
|
|
61
|
+
private getLegionStreamUrl;
|
|
62
|
+
private getLegionServiceKey;
|
|
25
63
|
private planAndExecute;
|
|
64
|
+
private formatLegionError;
|
|
26
65
|
private showWorkers;
|
|
27
66
|
private showStatus;
|
|
28
67
|
}
|