vigthoria-cli 1.8.19 → 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 +9 -0
- package/dist/commands/chat.js +221 -33
- 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 +374 -34
- package/dist/utils/api.d.ts +61 -1
- package/dist/utils/api.js +558 -86
- 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
|
@@ -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
|
}
|