vigthoria-cli 1.13.18 → 1.13.22
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/completions/_vigthoria +49 -0
- package/completions/vigthoria.bash +6 -0
- package/completions/vigthoria.fish +41 -0
- package/dist/commands/auth.d.ts +1 -0
- package/dist/commands/auth.js +84 -135
- package/dist/commands/background.d.ts +0 -2
- package/dist/commands/background.js +26 -34
- package/dist/commands/bridge.js +45 -41
- package/dist/commands/cancel.d.ts +1 -0
- package/dist/commands/cancel.js +22 -16
- package/dist/commands/chat.d.ts +5 -42
- package/dist/commands/chat.js +462 -1122
- package/dist/commands/coding-registration.d.ts +4 -0
- package/dist/commands/coding-registration.js +24 -0
- package/dist/commands/config.js +32 -42
- package/dist/commands/conversation-registration.d.ts +4 -0
- package/dist/commands/conversation-registration.js +122 -0
- package/dist/commands/deploy.d.ts +8 -2
- package/dist/commands/deploy.js +92 -90
- package/dist/commands/device.d.ts +1 -2
- package/dist/commands/device.js +37 -21
- package/dist/commands/doctor-registration.d.ts +4 -0
- package/dist/commands/doctor-registration.js +200 -0
- package/dist/commands/edit.js +22 -33
- package/dist/commands/explain.js +7 -10
- package/dist/commands/fork.d.ts +1 -2
- package/dist/commands/fork.js +72 -22
- package/dist/commands/game.d.ts +1 -1
- package/dist/commands/game.js +17 -6
- package/dist/commands/generate.js +7 -9
- package/dist/commands/history.js +11 -7
- package/dist/commands/hub.d.ts +2 -2
- package/dist/commands/hub.js +34 -35
- package/dist/commands/legion.d.ts +0 -1
- package/dist/commands/legion.js +62 -79
- package/dist/commands/music.d.ts +1 -2
- package/dist/commands/music.js +62 -27
- package/dist/commands/platform-registration.d.ts +4 -0
- package/dist/commands/platform-registration.js +45 -0
- package/dist/commands/preview.d.ts +0 -1
- package/dist/commands/preview.js +82 -35
- package/dist/commands/product-run-registration.d.ts +4 -0
- package/dist/commands/product-run-registration.js +490 -0
- package/dist/commands/replay.d.ts +1 -2
- package/dist/commands/replay.js +15 -11
- package/dist/commands/repo.d.ts +14 -7
- package/dist/commands/repo.js +245 -196
- package/dist/commands/review.js +9 -12
- package/dist/commands/security.d.ts +1 -2
- package/dist/commands/security.js +12 -6
- package/dist/commands/update-registration.d.ts +3 -0
- package/dist/commands/update-registration.js +338 -0
- package/dist/commands/v4-registration.d.ts +4 -0
- package/dist/commands/v4-registration.js +24 -0
- package/dist/commands/v4.d.ts +1 -1
- package/dist/commands/v4.js +46 -8
- package/dist/commands/wallet.d.ts +1 -3
- package/dist/commands/wallet.js +18 -45
- package/dist/commands/workflow.d.ts +2 -0
- package/dist/commands/workflow.js +52 -39
- package/dist/index.js +122 -1498
- package/dist/utils/agent-stream-state.d.ts +27 -0
- package/dist/utils/agent-stream-state.js +93 -0
- package/dist/utils/agentRoute.d.ts +2 -1
- package/dist/utils/agentRoute.js +22 -9
- package/dist/utils/agentRunOutcome.d.ts +16 -0
- package/dist/utils/agentRunOutcome.js +37 -2
- package/dist/utils/api-client-factory.d.ts +8 -0
- package/dist/utils/api-client-factory.js +8 -0
- package/dist/utils/api.d.ts +45 -269
- package/dist/utils/api.js +664 -3210
- package/dist/utils/auth-session.d.ts +41 -0
- package/dist/utils/auth-session.js +224 -0
- package/dist/utils/brain-hub-client.d.ts +0 -4
- package/dist/utils/brain-hub-client.js +6 -3
- package/dist/utils/bridge-client.js +2 -0
- package/dist/utils/capability-health-service.d.ts +48 -0
- package/dist/utils/capability-health-service.js +64 -0
- package/dist/utils/chat-prompt-policy.d.ts +18 -0
- package/dist/utils/chat-prompt-policy.js +61 -0
- package/dist/utils/chat-tool-call-parser.d.ts +11 -0
- package/dist/utils/chat-tool-call-parser.js +71 -0
- package/dist/utils/cli-state.d.ts +22 -4
- package/dist/utils/cli-state.js +105 -47
- package/dist/utils/code-operations-service.d.ts +104 -0
- package/dist/utils/code-operations-service.js +837 -0
- package/dist/utils/codebase-indexer.d.ts +1 -0
- package/dist/utils/codebase-indexer.js +28 -8
- package/dist/utils/command-contract.d.ts +61 -0
- package/dist/utils/command-contract.js +149 -0
- package/dist/utils/command-policy.d.ts +10 -0
- package/dist/utils/command-policy.js +54 -0
- package/dist/utils/config.d.ts +13 -5
- package/dist/utils/config.js +227 -99
- package/dist/utils/context-ranker.js +11 -2
- package/dist/utils/context-state.d.ts +39 -0
- package/dist/utils/context-state.js +52 -0
- package/dist/utils/deckEvents.d.ts +0 -5
- package/dist/utils/deckEvents.js +3 -2
- package/dist/utils/desktop-bridge-client.js +2 -0
- package/dist/utils/direct-output-policy.d.ts +3 -0
- package/dist/utils/direct-output-policy.js +76 -0
- package/dist/utils/durable-json.d.ts +57 -0
- package/dist/utils/durable-json.js +319 -0
- package/dist/utils/fastAgentRouter.d.ts +6 -7
- package/dist/utils/fastAgentRouter.js +21 -30
- package/dist/utils/files.js +21 -13
- package/dist/utils/frontend-preview-service.d.ts +76 -0
- package/dist/utils/frontend-preview-service.js +482 -0
- package/dist/utils/goaEvents.d.ts +0 -4
- package/dist/utils/goaEvents.js +5 -2
- package/dist/utils/logger.d.ts +2 -1
- package/dist/utils/logger.js +27 -20
- package/dist/utils/mcp-context-client.d.ts +24 -0
- package/dist/utils/mcp-context-client.js +58 -0
- package/dist/utils/model-governance.d.ts +18 -0
- package/dist/utils/model-governance.js +75 -0
- package/dist/utils/model-transport-service.d.ts +44 -0
- package/dist/utils/model-transport-service.js +111 -0
- package/dist/utils/mutation-journal.d.ts +42 -0
- package/dist/utils/mutation-journal.js +387 -0
- package/dist/utils/network-policy.d.ts +24 -0
- package/dist/utils/network-policy.js +202 -0
- package/dist/utils/operator-client.d.ts +45 -0
- package/dist/utils/operator-client.js +159 -0
- package/dist/utils/post-write-validator.js +7 -9
- package/dist/utils/preview-screenshot-adapter.d.ts +13 -0
- package/dist/utils/preview-screenshot-adapter.js +36 -0
- package/dist/utils/process-policy.d.ts +23 -0
- package/dist/utils/process-policy.js +284 -0
- package/dist/utils/project-memory.d.ts +13 -3
- package/dist/utils/project-memory.js +70 -17
- package/dist/utils/prompt-workspace-resolver.d.ts +14 -0
- package/dist/utils/prompt-workspace-resolver.js +64 -0
- package/dist/utils/release-install.d.ts +11 -0
- package/dist/utils/release-install.js +155 -0
- package/dist/utils/release-policy.d.ts +64 -0
- package/dist/utils/release-policy.js +293 -0
- package/dist/utils/requestIntent.js +22 -3
- package/dist/utils/runtime-capability.d.ts +8 -0
- package/dist/utils/runtime-capability.js +16 -0
- package/dist/utils/secret-policy.d.ts +20 -0
- package/dist/utils/secret-policy.js +160 -0
- package/dist/utils/session.d.ts +34 -2
- package/dist/utils/session.js +354 -110
- package/dist/utils/tool-approval-service.d.ts +17 -0
- package/dist/utils/tool-approval-service.js +78 -0
- package/dist/utils/tool-capability-providers.d.ts +57 -0
- package/dist/utils/tool-capability-providers.js +57 -0
- package/dist/utils/tools.d.ts +2 -23
- package/dist/utils/tools.js +216 -508
- package/dist/utils/update-policy.d.ts +18 -0
- package/dist/utils/update-policy.js +137 -0
- package/dist/utils/v3-agent-client.d.ts +40 -0
- package/dist/utils/v3-agent-client.js +165 -0
- package/dist/utils/v3-workspace-service.d.ts +28 -0
- package/dist/utils/v3-workspace-service.js +279 -0
- package/dist/utils/vigflow-client.d.ts +95 -0
- package/dist/utils/vigflow-client.js +105 -0
- package/dist/utils/workspace-boundary.d.ts +45 -0
- package/dist/utils/workspace-boundary.js +377 -0
- package/dist/utils/workspace-brain-service.d.ts +2 -0
- package/dist/utils/workspace-brain-service.js +11 -1
- package/dist/utils/workspace-cache.js +37 -15
- package/dist/utils/workspace-stream.js +35 -10
- package/install.ps1 +86 -143
- package/install.sh +76 -81
- package/package.json +44 -9
- package/release-policy.json +43 -0
- package/scripts/release/LOCAL_MACHINE_USER_VERIFICATION.md +1 -1
- package/scripts/release/generate-completions.mjs +24 -0
- package/scripts/release/install-release.mjs +10 -0
- package/scripts/release/publish-cli-release.mjs +116 -0
- package/scripts/release/publish-cli-release.sh +2 -70
- package/scripts/release/resolve-release-manifest.mjs +26 -0
- package/scripts/release/test-balanced-model-live.sh +42 -0
- package/scripts/release/validate-live-service-gates.sh +90 -0
- package/scripts/release/validate-no-go-gates.sh +135 -172
- package/scripts/release/verify-runtime-consistency.mjs +4 -1
- package/dist/commands/index.d.ts +0 -12
- package/dist/commands/index.js +0 -194
- package/dist/commands/update.d.ts +0 -9
- package/dist/commands/update.js +0 -301
- package/dist/utils/templateInstantPath.d.ts +0 -18
- package/dist/utils/templateInstantPath.js +0 -228
package/dist/index.js
CHANGED
|
@@ -16,52 +16,45 @@
|
|
|
16
16
|
* vigthoria operator - Start BMAD operator mode
|
|
17
17
|
*/
|
|
18
18
|
import { Command } from 'commander';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
19
|
+
import { registerConversationCommands } from './commands/conversation-registration.js';
|
|
20
|
+
import { registerCodingCommands } from './commands/coding-registration.js';
|
|
21
|
+
import { registerDoctorCommand } from './commands/doctor-registration.js';
|
|
22
|
+
import { registerProductAndRunCommands } from './commands/product-run-registration.js';
|
|
23
|
+
import { checkForUpdatesQuietly, registerUpdateCommand } from './commands/update-registration.js';
|
|
23
24
|
import { handleLogin, handleLogout, registerAuthCommands, statusAction } from './commands/auth.js';
|
|
24
25
|
import { ConfigCommand } from './commands/config.js';
|
|
25
|
-
import { ReviewCommand } from './commands/review.js';
|
|
26
|
-
import { HubCommand } from './commands/hub.js';
|
|
27
|
-
import { MusicCommand } from './commands/music.js';
|
|
28
|
-
import { RepoCommand } from './commands/repo.js';
|
|
29
|
-
import { DeployCommand } from './commands/deploy.js';
|
|
30
26
|
import { BridgeCommand } from './commands/bridge.js';
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import { PreviewCommand } from './commands/preview.js';
|
|
34
|
-
import { GameCommand } from './commands/game.js';
|
|
27
|
+
import { registerPlatformCommands } from './commands/platform-registration.js';
|
|
28
|
+
import { registerWorkflowCommands } from './commands/workflow.js';
|
|
35
29
|
import { LegionCommand } from './commands/legion.js';
|
|
36
|
-
import { HistoryCommand } from './commands/history.js';
|
|
37
|
-
import { ReplayCommand } from './commands/replay.js';
|
|
38
|
-
import { ForkCommand } from './commands/fork.js';
|
|
39
|
-
import { CancelCommand } from './commands/cancel.js';
|
|
40
|
-
import { BackgroundCommand } from './commands/background.js';
|
|
41
|
-
import { SecurityCommand } from './commands/security.js';
|
|
42
30
|
import { WalletCommand } from './commands/wallet.js';
|
|
43
|
-
import {
|
|
44
|
-
import { runV4Menu } from './commands/v4-menu.js';
|
|
31
|
+
import { registerV4Commands } from './commands/v4-registration.js';
|
|
45
32
|
import { Config } from './utils/config.js';
|
|
46
33
|
import { Logger, CH } from './utils/logger.js';
|
|
47
34
|
import chalk from 'chalk';
|
|
48
35
|
import * as fs from 'fs';
|
|
49
36
|
import * as path from 'path';
|
|
50
|
-
import * as os from 'os';
|
|
51
37
|
import { fileURLToPath } from 'url';
|
|
52
|
-
import { createHash } from 'crypto';
|
|
53
38
|
import axios from 'axios';
|
|
54
39
|
import { renderDynamicHelp, selectInteractiveCommand } from './utils/command-menu.js';
|
|
55
|
-
import { isIOSEnvironment, resolveClientOsSlug } from './utils/clientManifest.js';
|
|
56
40
|
// ESM shim — TypeScript emits ESM under "type": "module", so __dirname
|
|
57
41
|
// is not available natively. Restore the CommonJS-style helper so the
|
|
58
42
|
// pre-existing package-discovery logic continues to work unchanged.
|
|
59
43
|
const __filename = fileURLToPath(import.meta.url);
|
|
60
44
|
const __dirname = path.dirname(__filename);
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
45
|
+
import { sanitizeUserFacingErrorText } from './utils/api.js';
|
|
46
|
+
import { createAPIClient } from './utils/api-client-factory.js';
|
|
47
|
+
import { createGatewayPreflightCacheKey, isOfflineMode, isUpdateCheckSuppressed, readGatewayPreflightCache, writeGatewayPreflightCache, } from './utils/cli-state.js';
|
|
63
48
|
import { applyLocalTestfarmDefaults, isLocalTestfarmMode } from './utils/localTestMode.js';
|
|
49
|
+
import { installAxiosNetworkPolicy, installGlobalFetchPolicy } from './utils/network-policy.js';
|
|
50
|
+
import { installConsoleRedaction } from './utils/secret-policy.js';
|
|
51
|
+
import { commandNameFromArgv, failureEnvelope, normalizeCommandError, CliCommandError, } from './utils/command-contract.js';
|
|
52
|
+
import { commandAuthRequirement, commanderCommandPath } from './utils/command-policy.js';
|
|
64
53
|
applyLocalTestfarmDefaults();
|
|
54
|
+
if (process.env.VIGTHORIA_CAPTURE_RUNTIME_MODEL !== '1')
|
|
55
|
+
installConsoleRedaction();
|
|
56
|
+
installGlobalFetchPolicy();
|
|
57
|
+
installAxiosNetworkPolicy(axios, 'auto');
|
|
65
58
|
// --- Terminal column-width safety clamp -----------------------------------
|
|
66
59
|
// Node's `readline` module (used for the interactive chat `> ` prompt and a
|
|
67
60
|
// few other prompts) redraws the current input line on every keystroke using
|
|
@@ -100,13 +93,6 @@ if (process.stdout.isTTY) {
|
|
|
100
93
|
if (process.stderr.isTTY) {
|
|
101
94
|
process.stderr.on('resize', () => clampStreamSize(process.stderr));
|
|
102
95
|
}
|
|
103
|
-
function isApiError(error) {
|
|
104
|
-
return Boolean(error &&
|
|
105
|
-
typeof error === 'object' &&
|
|
106
|
-
typeof error.status === 'number' &&
|
|
107
|
-
typeof error.message === 'string' &&
|
|
108
|
-
typeof error.code === 'string');
|
|
109
|
-
}
|
|
110
96
|
function getInvokedBinaryName() {
|
|
111
97
|
const executable = process.argv[1] || 'vigthoria';
|
|
112
98
|
return path.basename(executable, path.extname(executable)).toLowerCase();
|
|
@@ -216,309 +202,67 @@ export function validateReleaseMetadata() {
|
|
|
216
202
|
return false;
|
|
217
203
|
}
|
|
218
204
|
}
|
|
219
|
-
function compareVersions(v1, v2) {
|
|
220
|
-
const parts1 = v1.split('.').map(Number);
|
|
221
|
-
const parts2 = v2.split('.').map(Number);
|
|
222
|
-
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
|
223
|
-
const p1 = parts1[i] || 0;
|
|
224
|
-
const p2 = parts2[i] || 0;
|
|
225
|
-
if (p1 < p2)
|
|
226
|
-
return -1;
|
|
227
|
-
if (p1 > p2)
|
|
228
|
-
return 1;
|
|
229
|
-
}
|
|
230
|
-
return 0;
|
|
231
|
-
}
|
|
232
|
-
function maxVersion(...versions) {
|
|
233
|
-
let best = null;
|
|
234
|
-
for (const version of versions) {
|
|
235
|
-
if (!version)
|
|
236
|
-
continue;
|
|
237
|
-
if (!best || compareVersions(version, best) > 0)
|
|
238
|
-
best = version;
|
|
239
|
-
}
|
|
240
|
-
return best;
|
|
241
|
-
}
|
|
242
|
-
async function fetchNpmLatestVersion() {
|
|
243
|
-
const { execSync } = await import('child_process');
|
|
244
|
-
try {
|
|
245
|
-
// Hard 5s timeout: a slow/blocked path to the public npm registry must
|
|
246
|
-
// never hang the caller (e.g. the Workbench's blocking `vigthoria update`
|
|
247
|
-
// invocation) indefinitely.
|
|
248
|
-
const latest = execSync('npm view vigthoria-cli version', {
|
|
249
|
-
encoding: 'utf8',
|
|
250
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
251
|
-
windowsHide: true,
|
|
252
|
-
timeout: 5000,
|
|
253
|
-
}).trim();
|
|
254
|
-
return latest || null;
|
|
255
|
-
}
|
|
256
|
-
catch {
|
|
257
|
-
return null;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
205
|
const VERSION = getVersion();
|
|
261
|
-
const VIGTHORIA_DEFAULT_MANIFEST_URL = process.env.VIGTHORIA_UPDATE_MANIFEST_URL || "https://coder.vigthoria.io/releases/manifest.json";
|
|
262
|
-
function resolveManifestEntry(manifest, channel) {
|
|
263
|
-
const normalized = String(channel || 'stable').trim() || 'stable';
|
|
264
|
-
if (manifest.channels && manifest.channels[normalized]) {
|
|
265
|
-
return manifest.channels[normalized];
|
|
266
|
-
}
|
|
267
|
-
const direct = manifest[normalized];
|
|
268
|
-
if (direct && typeof direct === 'object') {
|
|
269
|
-
return direct;
|
|
270
|
-
}
|
|
271
|
-
if (normalized === 'stable') {
|
|
272
|
-
const rootVersion = typeof manifest.version === 'string' ? manifest.version : '';
|
|
273
|
-
const rootUrl = typeof manifest.url === 'string' ? manifest.url : '';
|
|
274
|
-
const rootSha = typeof manifest.sha256 === 'string' ? manifest.sha256 : undefined;
|
|
275
|
-
if (rootVersion && rootUrl) {
|
|
276
|
-
return { version: rootVersion, url: rootUrl, sha256: rootSha };
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
async function downloadFile(url, targetPath) {
|
|
282
|
-
const response = await axios.get(url, {
|
|
283
|
-
responseType: 'arraybuffer',
|
|
284
|
-
timeout: 20000,
|
|
285
|
-
maxRedirects: 5,
|
|
286
|
-
validateStatus: (status) => status >= 200 && status < 300,
|
|
287
|
-
});
|
|
288
|
-
fs.writeFileSync(targetPath, Buffer.from(response.data));
|
|
289
|
-
}
|
|
290
|
-
const TRUSTED_RELEASE_HOSTS = new Set([
|
|
291
|
-
'extension.vigthoria.io',
|
|
292
|
-
'landing.vigthoria.io',
|
|
293
|
-
'coder.vigthoria.io',
|
|
294
|
-
'market.vigthoria.io',
|
|
295
|
-
]);
|
|
296
|
-
function validateReleaseUrl(rawUrl, allowLocalhost = false) {
|
|
297
|
-
const parsed = new URL(rawUrl);
|
|
298
|
-
const local = parsed.hostname === 'localhost' || parsed.hostname === '127.0.0.1' || parsed.hostname === '::1';
|
|
299
|
-
if (parsed.protocol !== 'https:' && !(allowLocalhost && local && parsed.protocol === 'http:')) {
|
|
300
|
-
throw new Error('Release URLs must use HTTPS (HTTP is allowed only for an explicit localhost manifest).');
|
|
301
|
-
}
|
|
302
|
-
if (!TRUSTED_RELEASE_HOSTS.has(parsed.hostname) && !(allowLocalhost && local)) {
|
|
303
|
-
throw new Error(`Untrusted release host: ${parsed.hostname}`);
|
|
304
|
-
}
|
|
305
|
-
return parsed;
|
|
306
|
-
}
|
|
307
|
-
function sha256File(filePath) {
|
|
308
|
-
const hash = createHash('sha256');
|
|
309
|
-
const data = fs.readFileSync(filePath);
|
|
310
|
-
hash.update(data);
|
|
311
|
-
return hash.digest('hex');
|
|
312
|
-
}
|
|
313
|
-
async function installGlobalPackageWithNpm(packageSpec) {
|
|
314
|
-
const { execFileSync, execSync } = await import('child_process');
|
|
315
|
-
const attempts = [];
|
|
316
|
-
if (process.platform === 'win32') {
|
|
317
|
-
// First-choice: cmd.exe /c npm — resolves npm.cmd shims on any Windows Node setup
|
|
318
|
-
const comspec = process.env.COMSPEC || 'cmd.exe';
|
|
319
|
-
attempts.push({
|
|
320
|
-
label: 'cmd.exe /c npm',
|
|
321
|
-
command: comspec,
|
|
322
|
-
args: ['/c', 'npm', 'install', '-g', packageSpec],
|
|
323
|
-
});
|
|
324
|
-
const npmExecPath = process.env.npm_execpath;
|
|
325
|
-
if (npmExecPath && fs.existsSync(npmExecPath)) {
|
|
326
|
-
attempts.push({
|
|
327
|
-
label: 'node+npm_execpath',
|
|
328
|
-
command: process.execPath,
|
|
329
|
-
args: [npmExecPath, 'install', '-g', packageSpec],
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
try {
|
|
333
|
-
const resolvedNpmCmd = execSync('where npm.cmd', {
|
|
334
|
-
encoding: 'utf8',
|
|
335
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
336
|
-
windowsHide: true,
|
|
337
|
-
}).split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
338
|
-
if (resolvedNpmCmd) {
|
|
339
|
-
attempts.push({
|
|
340
|
-
label: 'where npm.cmd',
|
|
341
|
-
command: resolvedNpmCmd,
|
|
342
|
-
args: ['install', '-g', packageSpec],
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
catch {
|
|
347
|
-
// Fall through to generic attempts below.
|
|
348
|
-
}
|
|
349
|
-
attempts.push({
|
|
350
|
-
label: 'npm.cmd',
|
|
351
|
-
command: 'npm.cmd',
|
|
352
|
-
args: ['install', '-g', packageSpec],
|
|
353
|
-
});
|
|
354
|
-
// Last-resort Windows shell fallback for PATH/cmd shim edge-cases.
|
|
355
|
-
attempts.push({
|
|
356
|
-
label: 'npm via shell',
|
|
357
|
-
command: 'npm',
|
|
358
|
-
args: ['install', '-g', packageSpec],
|
|
359
|
-
shell: true,
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
else {
|
|
363
|
-
let resolvedNpm = '';
|
|
364
|
-
try {
|
|
365
|
-
resolvedNpm = execSync('which npm', {
|
|
366
|
-
encoding: 'utf8',
|
|
367
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
368
|
-
}).trim();
|
|
369
|
-
}
|
|
370
|
-
catch {
|
|
371
|
-
// Keep resolvedNpm empty and use plain `npm` below.
|
|
372
|
-
}
|
|
373
|
-
attempts.push({
|
|
374
|
-
label: resolvedNpm ? 'which npm' : 'npm',
|
|
375
|
-
command: resolvedNpm || 'npm',
|
|
376
|
-
args: ['install', '-g', packageSpec],
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
let lastError = null;
|
|
380
|
-
for (const attempt of attempts) {
|
|
381
|
-
try {
|
|
382
|
-
console.log(chalk.gray(`[update] installer executable: ${attempt.command}${attempt.shell ? ' (shell)' : ''}`));
|
|
383
|
-
execFileSync(attempt.command, attempt.args, {
|
|
384
|
-
stdio: 'inherit',
|
|
385
|
-
windowsHide: true,
|
|
386
|
-
shell: attempt.shell === true,
|
|
387
|
-
// Hard cap so a stalled/hung npm install (registry outage, network
|
|
388
|
-
// issue, etc.) can never block the caller indefinitely - especially
|
|
389
|
-
// important since the Workbench invokes this synchronously.
|
|
390
|
-
timeout: 180000,
|
|
391
|
-
});
|
|
392
|
-
return;
|
|
393
|
-
}
|
|
394
|
-
catch (error) {
|
|
395
|
-
lastError = error;
|
|
396
|
-
const code = error?.code || error?.status || 'unknown';
|
|
397
|
-
console.error(chalk.yellow(`[update] install attempt failed via ${attempt.label}: ${code}`));
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
const finalCode = lastError?.code || lastError?.status || 'unknown';
|
|
401
|
-
throw new Error(`Unable to launch npm installer after ${attempts.length} attempt(s). Last error: ${finalCode}`);
|
|
402
|
-
}
|
|
403
|
-
function renderUpdateBanner(latestVersion) {
|
|
404
|
-
if (compareVersions(latestVersion, '1.4.0') >= 0 && compareVersions(VERSION, '1.4.0') < 0) {
|
|
405
|
-
console.log(chalk.red.bold(`\n${CH.warnEmoji} SECURITY UPDATE AVAILABLE`));
|
|
406
|
-
console.log(chalk.red(` Version ${VERSION} has security vulnerabilities.`));
|
|
407
|
-
console.log(chalk.yellow(` Please update to ${latestVersion} immediately:`));
|
|
408
|
-
console.log(chalk.white.bold(' npm install -g vigthoria-cli@latest\n'));
|
|
409
|
-
}
|
|
410
|
-
else {
|
|
411
|
-
console.log(chalk.yellow(`\n${CH.warnEmoji} Update available: ${VERSION} -> ${latestVersion}`));
|
|
412
|
-
console.log(chalk.gray(' Run `vigthoria update` to install\n'));
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
// Check for updates quietly on startup. Cached (24 h) so we never block
|
|
416
|
-
// startup on `npm view`. Honours VIGTHORIA_OFFLINE / VIGTHORIA_NO_UPDATE_CHECK.
|
|
417
|
-
async function checkForUpdatesQuietly() {
|
|
418
|
-
if (isUpdateCheckSuppressed()) {
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
const cached = readCachedLatestVersion();
|
|
422
|
-
if (cached) {
|
|
423
|
-
if (compareVersions(cached, VERSION) > 0) {
|
|
424
|
-
renderUpdateBanner(cached);
|
|
425
|
-
}
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
// Cache miss: probe npm registry in the background, with a hard 5 s
|
|
429
|
-
// timeout. Result is cached for 24 h so subsequent runs are instant.
|
|
430
|
-
try {
|
|
431
|
-
const { execSync } = await import('child_process');
|
|
432
|
-
const npmVersion = execSync('npm view vigthoria-cli version', {
|
|
433
|
-
encoding: 'utf8',
|
|
434
|
-
timeout: 5000,
|
|
435
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
436
|
-
windowsHide: true,
|
|
437
|
-
}).trim();
|
|
438
|
-
if (!npmVersion) {
|
|
439
|
-
return;
|
|
440
|
-
}
|
|
441
|
-
writeCachedLatestVersion(npmVersion);
|
|
442
|
-
if (compareVersions(npmVersion, VERSION) > 0) {
|
|
443
|
-
renderUpdateBanner(npmVersion);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
catch {
|
|
447
|
-
// Network or npm failure should never block CLI; do not cache failure.
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
206
|
const VIGTHORIA_GATEWAY_AUTH_FAILURE_MESSAGE = 'Vigthoria Gate way user authentification failed. Please log out and login again.';
|
|
451
|
-
function
|
|
452
|
-
for (let i = 2; i < argv.length; i++) {
|
|
453
|
-
const token = String(argv[i] || '').trim();
|
|
454
|
-
if (!token || token.startsWith('-'))
|
|
455
|
-
continue;
|
|
456
|
-
return token;
|
|
457
|
-
}
|
|
458
|
-
return '';
|
|
459
|
-
}
|
|
460
|
-
function isAuthProtectedCommand(command) {
|
|
461
|
-
const protectedCommands = new Set([
|
|
462
|
-
'chat', 'c', 'chat-resume',
|
|
463
|
-
'agent', 'a', 'operator', 'op',
|
|
464
|
-
'edit', 'e', 'generate', 'g', 'explain', 'x', 'fix', 'f', 'review', 'r',
|
|
465
|
-
'workflow', 'flow', 'hub', 'marketplace', 'deploy', 'host', 'preview', 'device',
|
|
466
|
-
'legion', 'history', 'runs', 'replay', 'fork', 'cancel', 'background', 'bg',
|
|
467
|
-
'repo', 'repository',
|
|
468
|
-
]);
|
|
469
|
-
return protectedCommands.has(command);
|
|
470
|
-
}
|
|
471
|
-
async function enforceGatewayAuthSession(config, logger, jsonOutputRequested) {
|
|
207
|
+
async function enforceGatewayAuthSession(config, logger) {
|
|
472
208
|
if (isLocalTestfarmMode()) {
|
|
473
|
-
return
|
|
209
|
+
return;
|
|
474
210
|
}
|
|
475
211
|
const explicitEnvToken = Boolean(process.env.VIGTHORIA_TOKEN || process.env.VIGTHORIA_AUTH_TOKEN);
|
|
476
212
|
if (!config.isAuthenticated() && !explicitEnvToken) {
|
|
477
|
-
return
|
|
213
|
+
return;
|
|
478
214
|
}
|
|
479
215
|
// Offline mode disables every outbound preflight call.
|
|
480
216
|
if (isOfflineMode()) {
|
|
481
|
-
return
|
|
217
|
+
return;
|
|
482
218
|
}
|
|
219
|
+
const credential = String(process.env.VIGTHORIA_TOKEN
|
|
220
|
+
|| process.env.VIGTHORIA_AUTH_TOKEN
|
|
221
|
+
|| config.get('authToken')
|
|
222
|
+
|| '');
|
|
223
|
+
const preflightCacheKey = createGatewayPreflightCacheKey({
|
|
224
|
+
endpoint: String(config.get('apiUrl') || 'https://coder.vigthoria.io'),
|
|
225
|
+
credential,
|
|
226
|
+
capability: 'gateway-auth-session',
|
|
227
|
+
relevantConfiguration: {
|
|
228
|
+
modelsApiUrl: config.get('modelsApiUrl'),
|
|
229
|
+
selfHostedModelsApiUrl: config.get('selfHostedModelsApiUrl'),
|
|
230
|
+
},
|
|
231
|
+
});
|
|
483
232
|
// Short-lived cache so back-to-back CLI invocations don't re-probe. Never use
|
|
484
233
|
// a cached success when an explicit env token overrides the stored session.
|
|
485
234
|
if (!explicitEnvToken) {
|
|
486
|
-
const cached = readGatewayPreflightCache();
|
|
235
|
+
const cached = readGatewayPreflightCache(preflightCacheKey);
|
|
487
236
|
if (cached === true) {
|
|
488
|
-
return
|
|
237
|
+
return;
|
|
489
238
|
}
|
|
490
239
|
}
|
|
491
|
-
const api =
|
|
240
|
+
const api = createAPIClient(config, logger);
|
|
492
241
|
try {
|
|
493
242
|
const tokenCheck = await api.validateToken();
|
|
494
243
|
if (!tokenCheck.valid) {
|
|
495
|
-
writeGatewayPreflightCache(false);
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}
|
|
500
|
-
else {
|
|
501
|
-
console.log(chalk.red(VIGTHORIA_GATEWAY_AUTH_FAILURE_MESSAGE));
|
|
502
|
-
}
|
|
503
|
-
return false;
|
|
244
|
+
writeGatewayPreflightCache(preflightCacheKey, false);
|
|
245
|
+
throw new CliCommandError(VIGTHORIA_GATEWAY_AUTH_FAILURE_MESSAGE, {
|
|
246
|
+
code: 'AUTH_SESSION_INVALID',
|
|
247
|
+
category: 'authentication',
|
|
248
|
+
});
|
|
504
249
|
}
|
|
505
|
-
writeGatewayPreflightCache(true);
|
|
506
|
-
return
|
|
250
|
+
writeGatewayPreflightCache(preflightCacheKey, true);
|
|
251
|
+
return;
|
|
507
252
|
}
|
|
508
|
-
catch {
|
|
253
|
+
catch (error) {
|
|
254
|
+
if (error instanceof CliCommandError)
|
|
255
|
+
throw error;
|
|
509
256
|
if (explicitEnvToken) {
|
|
510
|
-
writeGatewayPreflightCache(false);
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
console.log(chalk.red(VIGTHORIA_GATEWAY_AUTH_FAILURE_MESSAGE));
|
|
517
|
-
}
|
|
518
|
-
return false;
|
|
257
|
+
writeGatewayPreflightCache(preflightCacheKey, false);
|
|
258
|
+
throw new CliCommandError(VIGTHORIA_GATEWAY_AUTH_FAILURE_MESSAGE, {
|
|
259
|
+
code: 'AUTH_SESSION_INVALID',
|
|
260
|
+
category: 'authentication',
|
|
261
|
+
cause: error,
|
|
262
|
+
});
|
|
519
263
|
}
|
|
520
264
|
// Network or transient backend outages should not be misclassified as auth failure.
|
|
521
|
-
return
|
|
265
|
+
return;
|
|
522
266
|
}
|
|
523
267
|
finally {
|
|
524
268
|
api.destroy();
|
|
@@ -533,46 +277,14 @@ function scrubMessageForUser(message) {
|
|
|
533
277
|
}
|
|
534
278
|
}
|
|
535
279
|
function normalizeCliError(error) {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
const responseMessage = typeof extended.response?.data?.error === 'string'
|
|
539
|
-
? extended.response.data.error
|
|
540
|
-
: typeof extended.response?.data?.message === 'string'
|
|
541
|
-
? extended.response.data.message
|
|
542
|
-
: undefined;
|
|
543
|
-
const rawMessage = responseMessage || extended.message || 'An unexpected CLI error occurred.';
|
|
544
|
-
// Purely local, client-side errors (e.g. "this config path doesn't exist
|
|
545
|
-
// on YOUR machine") can legitimately mention local paths that happen to
|
|
546
|
-
// look like internal server paths (e.g. `/var/www/...`-style directories
|
|
547
|
-
// the user copied/typed themselves). Scrubbing those makes an otherwise
|
|
548
|
-
// actionable message unreadable, so commands that construct their own
|
|
549
|
-
// local filesystem errors can opt out via `skipPathScrub`.
|
|
550
|
-
return {
|
|
551
|
-
message: extended.skipPathScrub ? rawMessage : scrubMessageForUser(rawMessage),
|
|
552
|
-
code: extended.code,
|
|
553
|
-
status: extended.status || extended.statusCode || extended.response?.status,
|
|
554
|
-
details: extended.details || extended.response?.data,
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
if (error && typeof error === 'object') {
|
|
558
|
-
const value = error;
|
|
559
|
-
const rawMessage = typeof value.message === 'string' && value.message.trim() ? value.message : 'An unexpected CLI error occurred.';
|
|
560
|
-
return {
|
|
561
|
-
message: scrubMessageForUser(rawMessage),
|
|
562
|
-
code: typeof value.code === 'string' || typeof value.code === 'number' ? value.code : undefined,
|
|
563
|
-
status: typeof value.status === 'number' ? value.status : undefined,
|
|
564
|
-
details: value.details,
|
|
565
|
-
};
|
|
566
|
-
}
|
|
567
|
-
const rawMessage = typeof error === 'string' && error.trim() ? error : 'An unexpected CLI error occurred.';
|
|
568
|
-
return {
|
|
569
|
-
message: scrubMessageForUser(rawMessage),
|
|
570
|
-
};
|
|
280
|
+
const skipPathScrub = Boolean(error && typeof error === 'object' && error.skipPathScrub === true);
|
|
281
|
+
return normalizeCommandError(error, skipPathScrub ? String : scrubMessageForUser);
|
|
571
282
|
}
|
|
283
|
+
let activeCommandPath = '';
|
|
572
284
|
function formatCliError(error, jsonOutputRequested = false) {
|
|
573
285
|
const normalized = normalizeCliError(error);
|
|
574
286
|
if (jsonOutputRequested) {
|
|
575
|
-
return JSON.stringify(
|
|
287
|
+
return JSON.stringify(failureEnvelope(activeCommandPath || commandNameFromArgv(process.argv), normalized), null, 2);
|
|
576
288
|
}
|
|
577
289
|
const parts = [chalk.red('Error:'), normalized.message];
|
|
578
290
|
if (normalized.code)
|
|
@@ -582,6 +294,7 @@ function formatCliError(error, jsonOutputRequested = false) {
|
|
|
582
294
|
return parts.join(' ');
|
|
583
295
|
}
|
|
584
296
|
function reportCliError(error, jsonOutputRequested = false) {
|
|
297
|
+
const normalized = normalizeCliError(error);
|
|
585
298
|
const output = formatCliError(error, jsonOutputRequested);
|
|
586
299
|
if (jsonOutputRequested) {
|
|
587
300
|
console.log(output);
|
|
@@ -589,10 +302,10 @@ function reportCliError(error, jsonOutputRequested = false) {
|
|
|
589
302
|
else {
|
|
590
303
|
console.error(output);
|
|
591
304
|
}
|
|
305
|
+
return normalized.exitCode;
|
|
592
306
|
}
|
|
593
307
|
function handleFatalCliError(error, jsonOutputRequested = false) {
|
|
594
|
-
reportCliError(error, jsonOutputRequested);
|
|
595
|
-
process.exitCode = 1;
|
|
308
|
+
process.exitCode = reportCliError(error, jsonOutputRequested);
|
|
596
309
|
}
|
|
597
310
|
let errorHandlersInstalled = false;
|
|
598
311
|
export function setupErrorHandlers() {
|
|
@@ -603,7 +316,7 @@ export function setupErrorHandlers() {
|
|
|
603
316
|
process.on('unhandledRejection', (reason) => {
|
|
604
317
|
const rejection = reason instanceof Error ? reason : new Error(String(reason || 'Unhandled promise rejection'));
|
|
605
318
|
handleFatalCliError(rejection, process.argv.includes('--json'));
|
|
606
|
-
process.exit(1);
|
|
319
|
+
process.exit(process.exitCode || 1);
|
|
607
320
|
});
|
|
608
321
|
process.on('uncaughtException', (error) => {
|
|
609
322
|
handleFatalCliError(error, process.argv.includes('--json'));
|
|
@@ -615,17 +328,31 @@ export function setupErrorHandlers() {
|
|
|
615
328
|
});
|
|
616
329
|
}
|
|
617
330
|
export async function main(args) {
|
|
331
|
+
// Metadata inspection must remain side-effect free. In particular, package
|
|
332
|
+
// managers and release probes routinely invoke --version with a read-only or
|
|
333
|
+
// nonexistent HOME, so do not construct Config (which owns durable state)
|
|
334
|
+
// before satisfying this top-level contract.
|
|
335
|
+
if (process.env.VIGTHORIA_CAPTURE_RUNTIME_MODEL !== '1' && (args[2] === '--version' || args[2] === '-V')) {
|
|
336
|
+
console.log(VERSION);
|
|
337
|
+
process.exitCode = 0;
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
const jsonOutputRequested = args.includes('--json');
|
|
618
341
|
const program = new Command();
|
|
342
|
+
program.exitOverride();
|
|
343
|
+
program.configureOutput({
|
|
344
|
+
// Commander writes parse failures before throwing. Suppress that legacy
|
|
345
|
+
// side channel and let the single renderer below own stderr/stdout.
|
|
346
|
+
writeErr: () => undefined,
|
|
347
|
+
});
|
|
619
348
|
const config = new Config();
|
|
620
349
|
const logger = new Logger();
|
|
621
350
|
const invokedBinaryName = getInvokedBinaryName();
|
|
622
351
|
const argv = [...args];
|
|
623
352
|
const firstArg = argv[2];
|
|
624
|
-
const jsonOutputRequested = argv.includes('--json');
|
|
625
353
|
const directPromptRequested = argv.includes('--prompt') || argv.includes('-P');
|
|
626
354
|
const helpOrVersionRequested = argv.some((token) => token === '--help' || token === '-h' || token === '--version' || token === '-V' ||
|
|
627
355
|
token === 'help' || token === 'version');
|
|
628
|
-
const isLegionCortexRequest = invokedBinaryName === 'vigthoria' && argv[2] === 'legion' && argv.includes('--cortex');
|
|
629
356
|
if (invokedBinaryName === 'vigthoria-chat') {
|
|
630
357
|
const knownCommands = new Set([
|
|
631
358
|
'chat', 'chat-resume', 'agent', 'edit', 'generate', 'explain', 'fix', 'review', 'cancel', 'background', 'bg',
|
|
@@ -636,18 +363,6 @@ export async function main(args) {
|
|
|
636
363
|
argv.splice(2, 0, 'chat');
|
|
637
364
|
}
|
|
638
365
|
}
|
|
639
|
-
const requestedCommand = resolveRequestedCommand(argv);
|
|
640
|
-
// Skip gateway JWT auth when running on-server with a service key (e.g., Cortex on-box).
|
|
641
|
-
// The service key is checked by Hyper Loop directly — no user session needed.
|
|
642
|
-
const hasServiceKey = !!(process.env.HYPERLOOP_SERVICE_KEY ||
|
|
643
|
-
process.env.V3_SERVICE_KEY);
|
|
644
|
-
if (!hasServiceKey && !isLegionCortexRequest && requestedCommand && isAuthProtectedCommand(requestedCommand)) {
|
|
645
|
-
const authOk = await enforceGatewayAuthSession(config, logger, jsonOutputRequested);
|
|
646
|
-
if (!authOk) {
|
|
647
|
-
process.exitCode = 1;
|
|
648
|
-
return;
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
366
|
if (process.env.VIGTHORIA_NO_BANNER !== '1' &&
|
|
652
367
|
!jsonOutputRequested &&
|
|
653
368
|
!directPromptRequested &&
|
|
@@ -690,879 +405,18 @@ export async function main(args) {
|
|
|
690
405
|
!jsonOutputRequested &&
|
|
691
406
|
!directPromptRequested &&
|
|
692
407
|
!helpOrVersionRequested) {
|
|
693
|
-
void checkForUpdatesQuietly();
|
|
408
|
+
void checkForUpdatesQuietly(VERSION);
|
|
694
409
|
}
|
|
695
410
|
program
|
|
696
411
|
.name(invokedBinaryName === 'vigthoria-chat' ? 'vigthoria-chat' : 'vigthoria')
|
|
697
412
|
.description('AI-powered terminal coding assistant for Vigthoria Coder subscribers')
|
|
698
413
|
.version(VERSION);
|
|
699
|
-
|
|
700
|
-
program
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
.option('-p, --project <path>', 'Set project context path')
|
|
706
|
-
.option('--new-project [name]', 'Create or use a managed local workspace folder when no --project path is given')
|
|
707
|
-
.option('-a, --agent', 'Enable agentic mode (default: true for best quality)', true)
|
|
708
|
-
.option('--no-agent', 'Disable agentic mode (simple chat only)')
|
|
709
|
-
.option('-r, --resume', 'Resume last session for this project', false)
|
|
710
|
-
.option('--prompt <text>', 'Run a single prompt directly and exit')
|
|
711
|
-
.option('-w, --workflow <selector>', 'Route prompts through a named or explicit VigFlow workflow target')
|
|
712
|
-
.option('--json', 'Emit machine-readable JSON output for direct prompt runs', false)
|
|
713
|
-
.option('--auto-approve', 'Auto-approve agent actions (dangerous!)', false)
|
|
714
|
-
.option('--bridge <url>', 'Connect to Vigthoria Commando Bridge for remote admin observability')
|
|
715
|
-
.action(async (options) => {
|
|
716
|
-
const chat = new ChatCommand(config, logger, program);
|
|
717
|
-
await chat.run({
|
|
718
|
-
model: options.model,
|
|
719
|
-
project: options.project,
|
|
720
|
-
projectProvided: typeof options.project === 'string' && options.project.trim().length > 0,
|
|
721
|
-
newProject: options.newProject,
|
|
722
|
-
agent: options.agent,
|
|
723
|
-
workflow: options.workflow,
|
|
724
|
-
json: options.json,
|
|
725
|
-
autoApprove: options.autoApprove,
|
|
726
|
-
resume: options.resume,
|
|
727
|
-
prompt: options.prompt,
|
|
728
|
-
bridge: options.bridge,
|
|
729
|
-
});
|
|
730
|
-
});
|
|
731
|
-
program
|
|
732
|
-
.command('chat-resume')
|
|
733
|
-
.description('Resume the latest chat session for the current or specified project')
|
|
734
|
-
.option('-m, --model <model>', 'Select AI model (agent, code, code-35b, code-9b, balanced, balanced-4b, cloud, ultra)')
|
|
735
|
-
.option('-p, --project <path>', 'Set project context path')
|
|
736
|
-
.option('--new-project [name]', 'Create or use a managed local workspace folder when no --project path is given')
|
|
737
|
-
.option('-a, --agent', 'Enable agentic mode (default: true for best quality)', true)
|
|
738
|
-
.option('--no-agent', 'Disable agentic mode (simple chat only)')
|
|
739
|
-
.option('--prompt <text>', 'Run a single prompt directly and exit after resuming context')
|
|
740
|
-
.option('-w, --workflow <selector>', 'Route prompts through a named or explicit VigFlow workflow target')
|
|
741
|
-
.option('--json', 'Emit machine-readable JSON output for direct prompt runs', false)
|
|
742
|
-
.option('--auto-approve', 'Auto-approve agent actions (dangerous!)', false)
|
|
743
|
-
.option('--bridge <url>', 'Connect to Vigthoria Commando Bridge for remote admin observability')
|
|
744
|
-
.action(async (options) => {
|
|
745
|
-
const chat = new ChatCommand(config, logger, program);
|
|
746
|
-
await chat.run({
|
|
747
|
-
model: options.model,
|
|
748
|
-
project: options.project,
|
|
749
|
-
projectProvided: typeof options.project === 'string' && options.project.trim().length > 0,
|
|
750
|
-
newProject: options.newProject,
|
|
751
|
-
agent: options.agent,
|
|
752
|
-
workflow: options.workflow,
|
|
753
|
-
json: options.json,
|
|
754
|
-
autoApprove: options.autoApprove,
|
|
755
|
-
resume: true,
|
|
756
|
-
prompt: options.prompt,
|
|
757
|
-
bridge: options.bridge,
|
|
758
|
-
});
|
|
759
|
-
});
|
|
760
|
-
// Agent command - Agentic mode (Vigthoria Autonomous)
|
|
761
|
-
// Uses Vigthoria v3 Code 35B or Vigthoria Cloud for complex tasks
|
|
762
|
-
program
|
|
763
|
-
.command('agent')
|
|
764
|
-
.alias('a')
|
|
765
|
-
.description('Start agentic mode - AI can read/write files, run commands')
|
|
766
|
-
.option('-m, --model <model>', 'Select AI model (agent, code, cloud, ultra)')
|
|
767
|
-
.option('-p, --project <path>', 'Set project context path')
|
|
768
|
-
.option('--new-project [name]', 'Create or use a managed local workspace folder when no --project path is given')
|
|
769
|
-
.option('--prompt <text>', 'Run a single agent prompt directly and exit')
|
|
770
|
-
.option('-w, --workflow <selector>', 'Run the prompt through a named or explicit VigFlow workflow target')
|
|
771
|
-
.option('--json', 'Emit machine-readable JSON output for direct prompt runs', false)
|
|
772
|
-
.option('--retry', 'Retry failed tasks from the last agent run in this workspace session', false)
|
|
773
|
-
.option('--continue', 'Continue unfinished tasks from the last agent run in this workspace session', false)
|
|
774
|
-
.option('--auto-approve', 'Auto-approve all actions (dangerous!)', false)
|
|
775
|
-
.option('--bridge <url>', 'Connect to Vigthoria Commando Bridge for remote admin observability')
|
|
776
|
-
.action(async (options) => {
|
|
777
|
-
const chat = new ChatCommand(config, logger, program);
|
|
778
|
-
await chat.run({
|
|
779
|
-
model: options.model,
|
|
780
|
-
project: options.project,
|
|
781
|
-
projectProvided: typeof options.project === 'string' && options.project.trim().length > 0,
|
|
782
|
-
newProject: options.newProject,
|
|
783
|
-
agent: true,
|
|
784
|
-
operator: false,
|
|
785
|
-
workflow: options.workflow,
|
|
786
|
-
json: options.json,
|
|
787
|
-
autoApprove: options.autoApprove,
|
|
788
|
-
prompt: options.prompt,
|
|
789
|
-
bridge: options.bridge,
|
|
790
|
-
retry: options.retry,
|
|
791
|
-
continue: options.continue,
|
|
792
|
-
});
|
|
793
|
-
});
|
|
794
|
-
program
|
|
795
|
-
.command('operator')
|
|
796
|
-
.alias('op')
|
|
797
|
-
.description('Start BMAD operator mode for infrastructure and system workflows')
|
|
798
|
-
.option('-m, --model <model>', 'Select operator model (code, agent, cloud)')
|
|
799
|
-
.option('-p, --project <path>', 'Set project context path')
|
|
800
|
-
.option('--new-project [name]', 'Create or use a managed local workspace folder when no --project path is given')
|
|
801
|
-
.option('--prompt <text>', 'Run a single operator prompt directly and exit')
|
|
802
|
-
.option('-w, --workflow <selector>', 'Run the prompt through a named or explicit VigFlow workflow target')
|
|
803
|
-
.option('--save-plan', 'Save the completed BMAD plan into VigFlow for rerun and audit', false)
|
|
804
|
-
.option('--json', 'Emit machine-readable JSON output for direct prompt runs', false)
|
|
805
|
-
.option('--bridge <url>', 'Connect to Vigthoria Commando Bridge for remote admin observability')
|
|
806
|
-
.action(async (options) => {
|
|
807
|
-
const chat = new ChatCommand(config, logger, program);
|
|
808
|
-
await chat.run({
|
|
809
|
-
model: options.model,
|
|
810
|
-
project: options.project,
|
|
811
|
-
projectProvided: typeof options.project === 'string' && options.project.trim().length > 0,
|
|
812
|
-
newProject: options.newProject,
|
|
813
|
-
agent: false,
|
|
814
|
-
operator: true,
|
|
815
|
-
workflow: options.workflow,
|
|
816
|
-
savePlan: options.savePlan,
|
|
817
|
-
json: options.json,
|
|
818
|
-
prompt: options.prompt,
|
|
819
|
-
bridge: options.bridge,
|
|
820
|
-
});
|
|
821
|
-
});
|
|
822
|
-
new V4Command(config, logger).register(program);
|
|
823
|
-
program
|
|
824
|
-
.command('v4-menu')
|
|
825
|
-
.description('Internal: interactive V3/V4 agent + provider picker used by the V4 Operating Agent launcher')
|
|
826
|
-
.option('--default-agent <agent>', 'v3 | v4', 'v3')
|
|
827
|
-
.option('--default-provider <provider>', 'cloud | v3_local | byok', 'cloud')
|
|
828
|
-
.option('--byok-api-key <key>', 'Existing BYOK api key', '')
|
|
829
|
-
.option('--byok-base-url <url>', 'Existing BYOK base url', '')
|
|
830
|
-
.option('--byok-model <name>', 'Existing BYOK model', '')
|
|
831
|
-
.requiredOption('--out-file <path>', 'Write JSON selection result to this file')
|
|
832
|
-
.action(async (options) => {
|
|
833
|
-
await runV4Menu({
|
|
834
|
-
defaultAgent: options.defaultAgent,
|
|
835
|
-
defaultProvider: options.defaultProvider,
|
|
836
|
-
byokApiKey: options.byokApiKey,
|
|
837
|
-
byokBaseUrl: options.byokBaseUrl,
|
|
838
|
-
byokModel: options.byokModel,
|
|
839
|
-
outFile: options.outFile,
|
|
840
|
-
});
|
|
841
|
-
});
|
|
842
|
-
program
|
|
843
|
-
.command('bridge')
|
|
844
|
-
.description('Inspect local DevTools Bridge availability for browser debugging tasks')
|
|
845
|
-
.command('status')
|
|
846
|
-
.description('Show live DevTools Bridge status')
|
|
847
|
-
.action(async () => {
|
|
848
|
-
const bridge = new BridgeCommand(config, logger);
|
|
849
|
-
await bridge.status();
|
|
850
|
-
});
|
|
851
|
-
const deviceCommand = program
|
|
852
|
-
.command('device')
|
|
853
|
-
.alias('adb')
|
|
854
|
-
.description('Android Developer Bridge commands via local ADB');
|
|
855
|
-
deviceCommand
|
|
856
|
-
.command('status')
|
|
857
|
-
.description('Show ADB availability and connected Android devices')
|
|
858
|
-
.option('--json', 'Emit JSON output', false)
|
|
859
|
-
.action(async (options) => {
|
|
860
|
-
const device = new DeviceCommand(config, logger);
|
|
861
|
-
await device.status(options);
|
|
862
|
-
});
|
|
863
|
-
deviceCommand
|
|
864
|
-
.command('list')
|
|
865
|
-
.description('List connected Android devices')
|
|
866
|
-
.option('--json', 'Emit JSON output', false)
|
|
867
|
-
.action(async (options) => {
|
|
868
|
-
const device = new DeviceCommand(config, logger);
|
|
869
|
-
await device.list(options);
|
|
870
|
-
});
|
|
871
|
-
deviceCommand
|
|
872
|
-
.command('screenshot')
|
|
873
|
-
.description('Capture a screenshot from an Android device')
|
|
874
|
-
.option('-d, --device <id>', 'ADB device id')
|
|
875
|
-
.option('-o, --output <path>', 'Output PNG path')
|
|
876
|
-
.action(async (options) => {
|
|
877
|
-
const device = new DeviceCommand(config, logger);
|
|
878
|
-
await device.screenshot(options);
|
|
879
|
-
});
|
|
880
|
-
deviceCommand
|
|
881
|
-
.command('install <apk>')
|
|
882
|
-
.description('Install or update an APK on an Android device')
|
|
883
|
-
.option('-d, --device <id>', 'ADB device id')
|
|
884
|
-
.option('--json', 'Emit JSON output', false)
|
|
885
|
-
.action(async (apk, options) => {
|
|
886
|
-
const device = new DeviceCommand(config, logger);
|
|
887
|
-
await device.install(apk, options);
|
|
888
|
-
});
|
|
889
|
-
deviceCommand
|
|
890
|
-
.command('launch <package>')
|
|
891
|
-
.description('Launch an Android app by package name')
|
|
892
|
-
.option('-d, --device <id>', 'ADB device id')
|
|
893
|
-
.option('-a, --activity <activity>', 'Activity class, for example .MainActivity')
|
|
894
|
-
.option('--json', 'Emit JSON output', false)
|
|
895
|
-
.action(async (packageName, options) => {
|
|
896
|
-
const device = new DeviceCommand(config, logger);
|
|
897
|
-
await device.launch(packageName, options);
|
|
898
|
-
});
|
|
899
|
-
deviceCommand
|
|
900
|
-
.command('logs')
|
|
901
|
-
.description('Read Android logcat output')
|
|
902
|
-
.option('-d, --device <id>', 'ADB device id')
|
|
903
|
-
.option('-n, --lines <count>', 'Number of log lines for snapshot mode', '250')
|
|
904
|
-
.option('-f, --follow', 'Follow logcat until interrupted', false)
|
|
905
|
-
.option('--json', 'Emit JSON output for snapshot mode', false)
|
|
906
|
-
.action(async (options) => {
|
|
907
|
-
const device = new DeviceCommand(config, logger);
|
|
908
|
-
await device.logs(options);
|
|
909
|
-
});
|
|
910
|
-
deviceCommand
|
|
911
|
-
.command('tcpip')
|
|
912
|
-
.description('Enable wireless ADB tcpip mode on the selected USB-connected device')
|
|
913
|
-
.option('-d, --device <id>', 'ADB device id')
|
|
914
|
-
.option('-p, --port <port>', 'Wireless ADB port', '5555')
|
|
915
|
-
.option('--json', 'Emit JSON output', false)
|
|
916
|
-
.action(async (options) => {
|
|
917
|
-
const device = new DeviceCommand(config, logger);
|
|
918
|
-
await device.tcpip(options);
|
|
919
|
-
});
|
|
920
|
-
deviceCommand
|
|
921
|
-
.command('connect <address>')
|
|
922
|
-
.description('Connect to a wireless ADB device, for example 192.168.1.30:5555')
|
|
923
|
-
.option('--json', 'Emit JSON output', false)
|
|
924
|
-
.action(async (address, options) => {
|
|
925
|
-
const device = new DeviceCommand(config, logger);
|
|
926
|
-
await device.connect(address, options);
|
|
927
|
-
});
|
|
928
|
-
deviceCommand
|
|
929
|
-
.command('disconnect [address]')
|
|
930
|
-
.description('Disconnect a wireless ADB device')
|
|
931
|
-
.option('--json', 'Emit JSON output', false)
|
|
932
|
-
.action(async (address, options) => {
|
|
933
|
-
const device = new DeviceCommand(config, logger);
|
|
934
|
-
await device.disconnect(address, options);
|
|
935
|
-
});
|
|
936
|
-
deviceCommand.action(async () => {
|
|
937
|
-
const device = new DeviceCommand(config, logger);
|
|
938
|
-
await device.status({});
|
|
939
|
-
});
|
|
940
|
-
// Security command group - Security DevOps scans and fix plans
|
|
941
|
-
const securityCommand = program
|
|
942
|
-
.command('security')
|
|
943
|
-
.alias('vsec')
|
|
944
|
-
.description('Run security scans, scores, and fix plans via Vigthoria MCP security tools');
|
|
945
|
-
securityCommand
|
|
946
|
-
.command('scan')
|
|
947
|
-
.description('Scan project for security issues')
|
|
948
|
-
.option('-d, --dir <path>', 'Directory to scan (default: current directory)')
|
|
949
|
-
.option('--json', 'Emit JSON output', false)
|
|
950
|
-
.action(async (options) => {
|
|
951
|
-
const security = new SecurityCommand(config, logger);
|
|
952
|
-
await security.scan({ dir: options.dir, json: options.json });
|
|
953
|
-
});
|
|
954
|
-
securityCommand
|
|
955
|
-
.command('score')
|
|
956
|
-
.description('Calculate project security score')
|
|
957
|
-
.option('-d, --dir <path>', 'Directory to score (default: current directory)')
|
|
958
|
-
.option('--json', 'Emit JSON output', false)
|
|
959
|
-
.action(async (options) => {
|
|
960
|
-
const security = new SecurityCommand(config, logger);
|
|
961
|
-
await security.score({ dir: options.dir, json: options.json });
|
|
962
|
-
});
|
|
963
|
-
securityCommand
|
|
964
|
-
.command('fix')
|
|
965
|
-
.description('Generate security fix plan')
|
|
966
|
-
.option('-d, --dir <path>', 'Directory to inspect (default: current directory)')
|
|
967
|
-
.option('-i, --issue-id <id>', 'Single issue id to target')
|
|
968
|
-
.option('--apply', 'Request auto-apply mode (safe mode still requires explicit patching)', false)
|
|
969
|
-
.option('--json', 'Emit JSON output', false)
|
|
970
|
-
.action(async (options) => {
|
|
971
|
-
const security = new SecurityCommand(config, logger);
|
|
972
|
-
await security.fix({ dir: options.dir, issueId: options.issueId, apply: options.apply, json: options.json });
|
|
973
|
-
});
|
|
974
|
-
// Edit command - Edit files with AI
|
|
975
|
-
program
|
|
976
|
-
.command('edit <file>')
|
|
977
|
-
.alias('e')
|
|
978
|
-
.description('Edit a file with AI assistance')
|
|
979
|
-
.option('-i, --instruction <text>', 'Editing instruction')
|
|
980
|
-
.option('-m, --model <model>', 'Select AI model', 'code')
|
|
981
|
-
.option('--apply', 'Automatically apply changes without confirmation', false)
|
|
982
|
-
.action(async (file, options) => {
|
|
983
|
-
const edit = new EditCommand(config, logger);
|
|
984
|
-
await edit.run(file, options);
|
|
985
|
-
});
|
|
986
|
-
// Generate command - Generate code
|
|
987
|
-
program
|
|
988
|
-
.command('generate <description>')
|
|
989
|
-
.alias('g')
|
|
990
|
-
.description('Generate code from description')
|
|
991
|
-
.option('-l, --language <lang>', 'Target language (auto-detected from description, or specify: javascript, typescript, python, html, etc.)')
|
|
992
|
-
.option('-o, --output <file>', 'Output file path')
|
|
993
|
-
.option('-m, --model <model>', 'Select AI model', 'code')
|
|
994
|
-
.option('-p, --pro', 'Senior Developer Mode: plan, generate, quality check (recommended)', false)
|
|
995
|
-
.action(async (description, options) => {
|
|
996
|
-
const generate = new GenerateCommand(config, logger);
|
|
997
|
-
await generate.run(description, options);
|
|
998
|
-
});
|
|
999
|
-
// Explain command - Explain code
|
|
1000
|
-
program
|
|
1001
|
-
.command('explain <file>')
|
|
1002
|
-
.alias('x')
|
|
1003
|
-
.description('Explain code in a file')
|
|
1004
|
-
.option('-l, --lines <range>', 'Line range (e.g., 1-50)')
|
|
1005
|
-
.option('-d, --detail <level>', 'Detail level (brief, normal, detailed)', 'normal')
|
|
1006
|
-
.action(async (file, options) => {
|
|
1007
|
-
const explain = new ExplainCommand(config, logger);
|
|
1008
|
-
await explain.run(file, options);
|
|
1009
|
-
});
|
|
1010
|
-
// Fix command - Fix code issues
|
|
1011
|
-
program
|
|
1012
|
-
.command('fix [file]')
|
|
1013
|
-
.alias('f')
|
|
1014
|
-
.description('Fix issues in a file')
|
|
1015
|
-
.option('-t, --type <type>', 'Fix type (bugs, style, security, performance)', 'bugs')
|
|
1016
|
-
.option('--apply', 'Automatically apply fixes', false)
|
|
1017
|
-
.action(async (file, options) => {
|
|
1018
|
-
if (!file) {
|
|
1019
|
-
logger.error('Usage: vigthoria fix <file> [--type bugs|style|security|performance] [--apply]');
|
|
1020
|
-
process.exitCode = 1;
|
|
1021
|
-
return;
|
|
1022
|
-
}
|
|
1023
|
-
const edit = new EditCommand(config, logger);
|
|
1024
|
-
await edit.fix(file, options);
|
|
1025
|
-
});
|
|
1026
|
-
// Review command - Code review
|
|
1027
|
-
program
|
|
1028
|
-
.command('review <file>')
|
|
1029
|
-
.alias('r')
|
|
1030
|
-
.description('Review code quality')
|
|
1031
|
-
.option('-f, --format <format>', 'Output format (text, json, markdown)', 'text')
|
|
1032
|
-
.action(async (file, options) => {
|
|
1033
|
-
const review = new ReviewCommand(config, logger);
|
|
1034
|
-
await review.run(file, options);
|
|
1035
|
-
});
|
|
1036
|
-
const workflowCommand = program
|
|
1037
|
-
.command('workflow')
|
|
1038
|
-
.alias('flow')
|
|
1039
|
-
.description('List, instantiate, and run repeatable VigFlow workflows');
|
|
1040
|
-
workflowCommand
|
|
1041
|
-
.command('templates')
|
|
1042
|
-
.alias('catalog')
|
|
1043
|
-
.description('List available VigFlow templates')
|
|
1044
|
-
.option('-c, --category <category>', 'Filter templates by category')
|
|
1045
|
-
.option('-s, --search <query>', 'Search template names, descriptions, and tags')
|
|
1046
|
-
.option('--json', 'Emit machine-readable JSON output', false)
|
|
1047
|
-
.action(async (options) => {
|
|
1048
|
-
const workflow = new WorkflowCommand(config, logger);
|
|
1049
|
-
await workflow.templates(options);
|
|
1050
|
-
});
|
|
1051
|
-
workflowCommand
|
|
1052
|
-
.command('list')
|
|
1053
|
-
.alias('ls')
|
|
1054
|
-
.description('List workflows created for the current account')
|
|
1055
|
-
.option('--json', 'Emit machine-readable JSON output', false)
|
|
1056
|
-
.action(async (options) => {
|
|
1057
|
-
const workflow = new WorkflowCommand(config, logger);
|
|
1058
|
-
await workflow.list(options);
|
|
1059
|
-
});
|
|
1060
|
-
workflowCommand
|
|
1061
|
-
.command('use-template <templateId>')
|
|
1062
|
-
.description('Create a workflow from a built-in or saved template')
|
|
1063
|
-
.option('-n, --name <name>', 'Override the workflow name')
|
|
1064
|
-
.option('-v, --variables <json>', 'Template variables as a JSON object')
|
|
1065
|
-
.option('--json', 'Emit machine-readable JSON output', false)
|
|
1066
|
-
.action(async (templateId, options) => {
|
|
1067
|
-
const workflow = new WorkflowCommand(config, logger);
|
|
1068
|
-
await workflow.useTemplate(templateId, options);
|
|
1069
|
-
});
|
|
1070
|
-
workflowCommand
|
|
1071
|
-
.command('run <workflowId>')
|
|
1072
|
-
.description('Run a workflow immediately')
|
|
1073
|
-
.option('-d, --data <json>', 'Execution input data as a JSON object')
|
|
1074
|
-
.option('--no-brain', 'Do not attach local Project Brain context to this workflow run')
|
|
1075
|
-
.option('--json', 'Emit machine-readable JSON output', false)
|
|
1076
|
-
.action(async (workflowId, options) => {
|
|
1077
|
-
const workflow = new WorkflowCommand(config, logger);
|
|
1078
|
-
await workflow.run(workflowId, options);
|
|
1079
|
-
});
|
|
1080
|
-
workflowCommand
|
|
1081
|
-
.command('status <executionId>')
|
|
1082
|
-
.description('Get the current or final status of a workflow execution')
|
|
1083
|
-
.option('--no-brain', 'Do not remember this workflow status in local Project Brain')
|
|
1084
|
-
.option('--json', 'Emit machine-readable JSON output', false)
|
|
1085
|
-
.action(async (executionId, options) => {
|
|
1086
|
-
const workflow = new WorkflowCommand(config, logger);
|
|
1087
|
-
await workflow.status(executionId, options);
|
|
1088
|
-
});
|
|
1089
|
-
workflowCommand.action(async () => {
|
|
1090
|
-
const workflow = new WorkflowCommand(config, logger);
|
|
1091
|
-
await workflow.templates({});
|
|
1092
|
-
});
|
|
1093
|
-
// ==================== HUB / MARKETPLACE COMMANDS ====================
|
|
1094
|
-
// Hub command - Discover and activate API modules
|
|
1095
|
-
const hubCommand = program
|
|
1096
|
-
.command('hub')
|
|
1097
|
-
.alias('marketplace')
|
|
1098
|
-
.description('Discover, search, and activate Vigthoria API modules');
|
|
1099
|
-
hubCommand
|
|
1100
|
-
.command('discover')
|
|
1101
|
-
.alias('d')
|
|
1102
|
-
.description('Interactive module discovery - find the right APIs for your project')
|
|
1103
|
-
.action(async () => {
|
|
1104
|
-
const hub = new HubCommand(config, logger);
|
|
1105
|
-
await hub.discover();
|
|
1106
|
-
});
|
|
1107
|
-
hubCommand
|
|
1108
|
-
.command('list')
|
|
1109
|
-
.alias('ls')
|
|
1110
|
-
.description('List all available API modules')
|
|
1111
|
-
.option('-c, --category <category>', 'Filter by category (payments, communication, ai, creative, media)')
|
|
1112
|
-
.action(async (options) => {
|
|
1113
|
-
const hub = new HubCommand(config, logger);
|
|
1114
|
-
await hub.list(options);
|
|
1115
|
-
});
|
|
1116
|
-
hubCommand
|
|
1117
|
-
.command('search <query>')
|
|
1118
|
-
.alias('find')
|
|
1119
|
-
.description('Semantic search for modules (e.g., "generate background music for my app")')
|
|
1120
|
-
.action(async (query) => {
|
|
1121
|
-
const hub = new HubCommand(config, logger);
|
|
1122
|
-
await hub.search(query);
|
|
1123
|
-
});
|
|
1124
|
-
hubCommand
|
|
1125
|
-
.command('activate <module>')
|
|
1126
|
-
.alias('enable')
|
|
1127
|
-
.description('Activate a module for your API key (enables pay-as-you-go)')
|
|
1128
|
-
.action(async (module) => {
|
|
1129
|
-
const hub = new HubCommand(config, logger);
|
|
1130
|
-
await hub.activate(module);
|
|
1131
|
-
});
|
|
1132
|
-
hubCommand
|
|
1133
|
-
.command('active')
|
|
1134
|
-
.description('Show your currently active modules')
|
|
1135
|
-
.action(async () => {
|
|
1136
|
-
const hub = new HubCommand(config, logger);
|
|
1137
|
-
await hub.active();
|
|
1138
|
-
});
|
|
1139
|
-
hubCommand
|
|
1140
|
-
.command('info <module>')
|
|
1141
|
-
.alias('details')
|
|
1142
|
-
.description('Get detailed information about a module')
|
|
1143
|
-
.action(async (module) => {
|
|
1144
|
-
const hub = new HubCommand(config, logger);
|
|
1145
|
-
await hub.info(module);
|
|
1146
|
-
});
|
|
1147
|
-
// Default hub action shows discover
|
|
1148
|
-
hubCommand.action(async () => {
|
|
1149
|
-
const hub = new HubCommand(config, logger);
|
|
1150
|
-
await hub.discover();
|
|
1151
|
-
});
|
|
1152
|
-
const musicCommand = program
|
|
1153
|
-
.command('music')
|
|
1154
|
-
.alias('audio')
|
|
1155
|
-
.description('Generate songs with Vigthoria Music AI / ACE-Step');
|
|
1156
|
-
musicCommand
|
|
1157
|
-
.command('generate [prompt]')
|
|
1158
|
-
.alias('g')
|
|
1159
|
-
.description('Queue full-song generation and return a task id')
|
|
1160
|
-
.option('--lyrics <text>', 'Provide fixed lyrics instead of auto-writing lyrics')
|
|
1161
|
-
.option('--duration <seconds>', 'Song duration in seconds', '120')
|
|
1162
|
-
.option('--genre <genre>', 'Music genre', 'pop')
|
|
1163
|
-
.option('--language <code>', 'Vocal language', 'en')
|
|
1164
|
-
.option('--voice-type <type>', 'Voice type (female, male, mixed)', 'female')
|
|
1165
|
-
.option('--style-tags <tags>', 'Additional style tags')
|
|
1166
|
-
.option('--voice <path>', 'Upload a local voice reference for cloning')
|
|
1167
|
-
.option('--wait', 'Poll until the task reaches a terminal state', false)
|
|
1168
|
-
.option('--poll-interval <seconds>', 'Polling interval when --wait is used', '5')
|
|
1169
|
-
.option('--json', 'Emit machine-readable JSON output', false)
|
|
1170
|
-
.action(async (prompt, options) => {
|
|
1171
|
-
const music = new MusicCommand(config, logger);
|
|
1172
|
-
await music.generate(prompt, options);
|
|
1173
|
-
});
|
|
1174
|
-
musicCommand
|
|
1175
|
-
.command('status <taskId>')
|
|
1176
|
-
.description('Check a queued music generation task')
|
|
1177
|
-
.option('--json', 'Emit machine-readable JSON output', false)
|
|
1178
|
-
.action(async (taskId, options) => {
|
|
1179
|
-
const music = new MusicCommand(config, logger);
|
|
1180
|
-
await music.status(taskId, options);
|
|
1181
|
-
});
|
|
1182
|
-
// ==================== REPO COMMANDS ====================
|
|
1183
|
-
// Repo command - Push/Pull projects to/from Vigthoria Community Repository
|
|
1184
|
-
const repoCommand = program
|
|
1185
|
-
.command('repo')
|
|
1186
|
-
.alias('repository')
|
|
1187
|
-
.description('Push and pull projects to/from your Vigthoria Community Repository');
|
|
1188
|
-
repoCommand
|
|
1189
|
-
.command('push [path]')
|
|
1190
|
-
.alias('upload')
|
|
1191
|
-
.description('Push current or specified project to Vigthoria Community Repository')
|
|
1192
|
-
.option('-n, --name <projectName>', 'Project name override for the remote repo')
|
|
1193
|
-
.option('-v, --visibility <type>', 'Set visibility (private, restricted, public)', 'private')
|
|
1194
|
-
.option('-d, --description <text>', 'Project description')
|
|
1195
|
-
.option('-f, --force', 'Overwrite existing project', false)
|
|
1196
|
-
.option('-y, --yes', 'Run non-interactively with provided/default values', false)
|
|
1197
|
-
.option('--retry <reviewId>', 'Link this corrected push to a repository security review')
|
|
1198
|
-
.option('--open-in <engine>', 'After push, open project in engine: shop, visual, game')
|
|
1199
|
-
.option('--browser', 'Open result URL in default browser', false)
|
|
1200
|
-
.action(async (pathArg, options) => {
|
|
1201
|
-
const repo = new RepoCommand(config, logger);
|
|
1202
|
-
await repo.push({
|
|
1203
|
-
path: pathArg,
|
|
1204
|
-
name: options.name,
|
|
1205
|
-
visibility: options.visibility,
|
|
1206
|
-
description: options.description,
|
|
1207
|
-
force: options.force,
|
|
1208
|
-
yes: options.yes,
|
|
1209
|
-
retry: options.retry
|
|
1210
|
-
});
|
|
1211
|
-
if (options.openIn) {
|
|
1212
|
-
const engine = options.openIn;
|
|
1213
|
-
if (!['shop', 'visual', 'game'].includes(engine)) {
|
|
1214
|
-
logger.warn(`Unknown engine "${engine}". Use: shop, visual, game`);
|
|
1215
|
-
}
|
|
1216
|
-
else {
|
|
1217
|
-
await repo.openIn(engine, options.name || undefined, { browser: options.browser });
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
});
|
|
1221
|
-
repoCommand
|
|
1222
|
-
.command('review [reviewId]')
|
|
1223
|
-
.description('Show repository security review status, findings, and retry guidance')
|
|
1224
|
-
.option('--json', 'Emit machine-readable JSON output', false)
|
|
1225
|
-
.action(async (reviewId, options) => {
|
|
1226
|
-
const repo = new RepoCommand(config, logger);
|
|
1227
|
-
await repo.review(reviewId, { json: options.json });
|
|
1228
|
-
});
|
|
1229
|
-
repoCommand
|
|
1230
|
-
.command('pull <name>')
|
|
1231
|
-
.alias('download')
|
|
1232
|
-
.description('Pull a project from your Vigthoria Community Repository')
|
|
1233
|
-
.option('-o, --output <path>', 'Output directory path')
|
|
1234
|
-
.option('-f, --force', 'Overwrite existing directory', false)
|
|
1235
|
-
.action(async (name, options) => {
|
|
1236
|
-
const repo = new RepoCommand(config, logger);
|
|
1237
|
-
await repo.pull(name, {
|
|
1238
|
-
output: options.output,
|
|
1239
|
-
force: options.force
|
|
1240
|
-
});
|
|
1241
|
-
});
|
|
1242
|
-
repoCommand
|
|
1243
|
-
.command('list')
|
|
1244
|
-
.alias('ls')
|
|
1245
|
-
.description('List all your projects in Vigthoria Community Repository')
|
|
1246
|
-
.option('-v, --visibility <type>', 'Filter by visibility (private, restricted, public)')
|
|
1247
|
-
.action(async (options) => {
|
|
1248
|
-
const repo = new RepoCommand(config, logger);
|
|
1249
|
-
await repo.list({ visibility: options.visibility });
|
|
1250
|
-
});
|
|
1251
|
-
repoCommand
|
|
1252
|
-
.command('status')
|
|
1253
|
-
.description('Show sync status of current project')
|
|
1254
|
-
.action(async () => {
|
|
1255
|
-
const repo = new RepoCommand(config, logger);
|
|
1256
|
-
await repo.status();
|
|
1257
|
-
});
|
|
1258
|
-
repoCommand
|
|
1259
|
-
.command('share <name>')
|
|
1260
|
-
.description('Generate a shareable link for a project')
|
|
1261
|
-
.option('-e, --expires <duration>', 'Link expiration (e.g., 7d, 24h, 30m)', '7d')
|
|
1262
|
-
.action(async (name, options) => {
|
|
1263
|
-
const repo = new RepoCommand(config, logger);
|
|
1264
|
-
await repo.share(name, { expires: options.expires });
|
|
1265
|
-
});
|
|
1266
|
-
repoCommand
|
|
1267
|
-
.command('delete <name>')
|
|
1268
|
-
.alias('rm')
|
|
1269
|
-
.description('Remove a project from your Vigthoria Community Repository')
|
|
1270
|
-
.action(async (name) => {
|
|
1271
|
-
const repo = new RepoCommand(config, logger);
|
|
1272
|
-
await repo.delete(name);
|
|
1273
|
-
});
|
|
1274
|
-
repoCommand
|
|
1275
|
-
.command('clone <url>')
|
|
1276
|
-
.description('Clone a public project from Vigthoria Community')
|
|
1277
|
-
.option('-o, --output <path>', 'Output directory path')
|
|
1278
|
-
.option('-f, --force', 'Overwrite existing directory', false)
|
|
1279
|
-
.action(async (url, options) => {
|
|
1280
|
-
const repo = new RepoCommand(config, logger);
|
|
1281
|
-
await repo.clone(url, {
|
|
1282
|
-
output: options.output,
|
|
1283
|
-
force: options.force
|
|
1284
|
-
});
|
|
1285
|
-
});
|
|
1286
|
-
repoCommand
|
|
1287
|
-
.command('open-in <engine> [projectName]')
|
|
1288
|
-
.description('Open a Vigthoria Community Repository project in the Shop Engine, Visual Editor, or Gaming Engine')
|
|
1289
|
-
.option('--browser', 'Open result URL in default browser', false)
|
|
1290
|
-
.option('--shop-id <id>', 'Target shop ID (for shop engine)', 'default')
|
|
1291
|
-
.addHelpText('after', `
|
|
1292
|
-
Examples:
|
|
1293
|
-
vigthoria repo open-in shop my-store
|
|
1294
|
-
vigthoria repo open-in visual my-website
|
|
1295
|
-
vigthoria repo open-in game my-game --browser`)
|
|
1296
|
-
.action(async (engine, projectName, options) => {
|
|
1297
|
-
if (!['shop', 'visual', 'game'].includes(engine)) {
|
|
1298
|
-
logger.error(`Unknown engine "${engine}". Valid options: shop, visual, game`);
|
|
1299
|
-
process.exit(1);
|
|
1300
|
-
}
|
|
1301
|
-
const repo = new RepoCommand(config, logger);
|
|
1302
|
-
await repo.openIn(engine, projectName, {
|
|
1303
|
-
browser: options.browser,
|
|
1304
|
-
shopId: options.shopId
|
|
1305
|
-
});
|
|
1306
|
-
});
|
|
1307
|
-
// Default repo action shows help with available subcommands
|
|
1308
|
-
repoCommand.action(() => {
|
|
1309
|
-
repoCommand.outputHelp();
|
|
1310
|
-
});
|
|
1311
|
-
// ==================== BACKGROUND AGENT JOBS ====================
|
|
1312
|
-
const backgroundCommand = program
|
|
1313
|
-
.command('background')
|
|
1314
|
-
.alias('bg')
|
|
1315
|
-
.description('Run and manage detached Vigthoria Agent jobs');
|
|
1316
|
-
backgroundCommand
|
|
1317
|
-
.command('start <prompt...>')
|
|
1318
|
-
.description('Start an Agent job in the background and return immediately')
|
|
1319
|
-
.option('--workspace <path>', 'Local workspace path', process.cwd())
|
|
1320
|
-
.option('--model <model>', 'Execution lane: agent, cloud, cloud-reason, or ultra', 'agent')
|
|
1321
|
-
.option('--json', 'Emit JSON output', false)
|
|
1322
|
-
.action(async (prompt, options) => {
|
|
1323
|
-
const bg = new BackgroundCommand(config, logger);
|
|
1324
|
-
await bg.start(prompt, options);
|
|
1325
|
-
});
|
|
1326
|
-
backgroundCommand
|
|
1327
|
-
.command('list')
|
|
1328
|
-
.alias('ls')
|
|
1329
|
-
.description('List recent background jobs')
|
|
1330
|
-
.option('--limit <n>', 'Maximum jobs to show', '20')
|
|
1331
|
-
.option('--json', 'Emit JSON output', false)
|
|
1332
|
-
.action(async (options) => {
|
|
1333
|
-
const bg = new BackgroundCommand(config, logger);
|
|
1334
|
-
await bg.list({ ...options, limit: Number(options.limit) || 20 });
|
|
1335
|
-
});
|
|
1336
|
-
backgroundCommand
|
|
1337
|
-
.command('status <jobId>')
|
|
1338
|
-
.description('Show background job status')
|
|
1339
|
-
.option('--json', 'Emit JSON output', false)
|
|
1340
|
-
.action(async (jobId, options) => {
|
|
1341
|
-
const bg = new BackgroundCommand(config, logger);
|
|
1342
|
-
await bg.status(jobId, options);
|
|
1343
|
-
});
|
|
1344
|
-
backgroundCommand
|
|
1345
|
-
.command('apply <jobId>')
|
|
1346
|
-
.description('Apply completed background job file changes to the local workspace')
|
|
1347
|
-
.option('--workspace <path>', 'Local workspace path', process.cwd())
|
|
1348
|
-
.option('--json', 'Emit JSON output', false)
|
|
1349
|
-
.action(async (jobId, options) => {
|
|
1350
|
-
const bg = new BackgroundCommand(config, logger);
|
|
1351
|
-
await bg.apply(jobId, options);
|
|
1352
|
-
});
|
|
1353
|
-
backgroundCommand
|
|
1354
|
-
.command('cancel <jobId>')
|
|
1355
|
-
.description('Cancel a running background job')
|
|
1356
|
-
.option('--json', 'Emit JSON output', false)
|
|
1357
|
-
.action(async (jobId, options) => {
|
|
1358
|
-
const bg = new BackgroundCommand(config, logger);
|
|
1359
|
-
await bg.cancel(jobId, options);
|
|
1360
|
-
});
|
|
1361
|
-
backgroundCommand
|
|
1362
|
-
.command('approve <jobId> <approvalId>')
|
|
1363
|
-
.description('Resolve a pending two-stage command gate for a background job')
|
|
1364
|
-
.option('--deny', 'Deny the command instead of approving it', false)
|
|
1365
|
-
.option('--json', 'Emit JSON output', false)
|
|
1366
|
-
.action(async (jobId, approvalId, options) => {
|
|
1367
|
-
const bg = new BackgroundCommand(config, logger);
|
|
1368
|
-
await bg.approve(jobId, approvalId, options);
|
|
1369
|
-
});
|
|
1370
|
-
backgroundCommand.action(() => {
|
|
1371
|
-
backgroundCommand.outputHelp();
|
|
1372
|
-
});
|
|
1373
|
-
// ==================== DEPLOY COMMANDS ====================
|
|
1374
|
-
// Deploy command - Host projects on Vigthoria
|
|
1375
|
-
const deployCommand = program
|
|
1376
|
-
.command('deploy')
|
|
1377
|
-
.alias('host')
|
|
1378
|
-
.description('Deploy and host your project on Vigthoria infrastructure');
|
|
1379
|
-
deployCommand
|
|
1380
|
-
.command('preview')
|
|
1381
|
-
.description('Deploy to free preview URL')
|
|
1382
|
-
.option('-p, --project <path>', 'Project directory path', process.cwd())
|
|
1383
|
-
.action(async (options) => {
|
|
1384
|
-
const deploy = new DeployCommand(config, logger);
|
|
1385
|
-
await deploy.deployToPreview(options.project);
|
|
1386
|
-
});
|
|
1387
|
-
deployCommand
|
|
1388
|
-
.command('subdomain <name>')
|
|
1389
|
-
.description('Deploy to yourname.vigthoria.io')
|
|
1390
|
-
.option('-p, --project <path>', 'Project directory path', process.cwd())
|
|
1391
|
-
.action(async (name, options) => {
|
|
1392
|
-
const deploy = new DeployCommand(config, logger);
|
|
1393
|
-
await deploy.deployToSubdomain(name, options.project);
|
|
1394
|
-
});
|
|
1395
|
-
deployCommand
|
|
1396
|
-
.command('custom <domain>')
|
|
1397
|
-
.description('Deploy to your custom domain')
|
|
1398
|
-
.option('-p, --project <path>', 'Project directory path', process.cwd())
|
|
1399
|
-
.action(async (domain, options) => {
|
|
1400
|
-
const deploy = new DeployCommand(config, logger);
|
|
1401
|
-
await deploy.deployToCustomDomain(domain, options.project);
|
|
1402
|
-
});
|
|
1403
|
-
deployCommand
|
|
1404
|
-
.command('list')
|
|
1405
|
-
.alias('ls')
|
|
1406
|
-
.description('List all your deployments')
|
|
1407
|
-
.action(async () => {
|
|
1408
|
-
const deploy = new DeployCommand(config, logger);
|
|
1409
|
-
await deploy.list();
|
|
1410
|
-
});
|
|
1411
|
-
deployCommand
|
|
1412
|
-
.command('plans')
|
|
1413
|
-
.description('Show hosting plans and pricing')
|
|
1414
|
-
.action(async () => {
|
|
1415
|
-
const deploy = new DeployCommand(config, logger);
|
|
1416
|
-
await deploy.showPlans();
|
|
1417
|
-
});
|
|
1418
|
-
deployCommand
|
|
1419
|
-
.command('status [domain]')
|
|
1420
|
-
.description('Check deployment status')
|
|
1421
|
-
.action(async (domain) => {
|
|
1422
|
-
const deploy = new DeployCommand(config, logger);
|
|
1423
|
-
await deploy.status(domain);
|
|
1424
|
-
});
|
|
1425
|
-
deployCommand
|
|
1426
|
-
.command('verify <domain>')
|
|
1427
|
-
.description('Verify DNS configuration for custom domain')
|
|
1428
|
-
.action(async (domain) => {
|
|
1429
|
-
const deploy = new DeployCommand(config, logger);
|
|
1430
|
-
await deploy.verify(domain);
|
|
1431
|
-
});
|
|
1432
|
-
deployCommand
|
|
1433
|
-
.command('remove <domain>')
|
|
1434
|
-
.alias('rm')
|
|
1435
|
-
.description('Remove a deployment')
|
|
1436
|
-
.action(async (domain) => {
|
|
1437
|
-
const deploy = new DeployCommand(config, logger);
|
|
1438
|
-
await deploy.remove(domain);
|
|
1439
|
-
});
|
|
1440
|
-
// Default deploy action shows interactive wizard
|
|
1441
|
-
deployCommand
|
|
1442
|
-
.option('-s, --subdomain <name>', 'Deploy to subdomain')
|
|
1443
|
-
.option('-d, --domain <domain>', 'Deploy to custom domain')
|
|
1444
|
-
.option('-p, --project <path>', 'Project directory path', process.cwd())
|
|
1445
|
-
.action(async (options) => {
|
|
1446
|
-
const deploy = new DeployCommand(config, logger);
|
|
1447
|
-
await deploy.deploy({
|
|
1448
|
-
subdomain: options.subdomain,
|
|
1449
|
-
domain: options.domain,
|
|
1450
|
-
project: options.project
|
|
1451
|
-
});
|
|
1452
|
-
});
|
|
1453
|
-
// ==================== PREVIEW COMMAND ====================
|
|
1454
|
-
program
|
|
1455
|
-
.command('preview')
|
|
1456
|
-
.description('Preview project locally with visual diffs and proof validation')
|
|
1457
|
-
.option('-p, --project <path>', 'Project directory path', process.cwd())
|
|
1458
|
-
.option('-e, --entry <file>', 'Entry HTML file (auto-detected if omitted)')
|
|
1459
|
-
.option('--port <number>', 'Local server port', parseInt)
|
|
1460
|
-
.option('--no-open', 'Do not auto-open browser')
|
|
1461
|
-
.option('--diff', 'Show consolidated diff of recent agent changes')
|
|
1462
|
-
.option('--proof', 'Run Template Service preview gate and persist proof bundle')
|
|
1463
|
-
.option('--screenshot', 'Capture screenshot via Puppeteer')
|
|
1464
|
-
.action(async (options) => {
|
|
1465
|
-
const preview = new PreviewCommand(config, logger);
|
|
1466
|
-
await preview.run({
|
|
1467
|
-
project: options.project,
|
|
1468
|
-
entry: options.entry,
|
|
1469
|
-
port: options.port,
|
|
1470
|
-
open: options.open,
|
|
1471
|
-
diff: options.diff,
|
|
1472
|
-
proof: options.proof,
|
|
1473
|
-
screenshot: options.screenshot,
|
|
1474
|
-
});
|
|
1475
|
-
});
|
|
1476
|
-
// ==================== GAME COMMAND ====================
|
|
1477
|
-
const gameCommand = program.command('game').description('Create, run, and validate Babylon/VGE game projects');
|
|
1478
|
-
gameCommand.command('init [name]').description('Create a production-ready client-rendered Babylon/VGE game').option('--engine <engine>', 'Game engine', 'babylon').option('--no-install', 'Create files without installing dependencies').option('--package-manager <manager>', 'npm, pnpm, yarn, or bun').action(async (name, options) => { await new GameCommand(logger).init(name, options); });
|
|
1479
|
-
gameCommand.command('run').description('Run the local game development server').option('-p, --project <path>', 'Game project directory', process.cwd()).option('--port <number>', 'Development server port', parseInt).option('--no-open', 'Do not open a browser').option('--package-manager <manager>', 'npm, pnpm, yarn, or bun').action(async (options) => { await new GameCommand(logger).run(options); });
|
|
1480
|
-
gameCommand.command('validate').description('Build and validate a Babylon/VGE game project').option('-p, --project <path>', 'Game project directory', process.cwd()).option('--json', 'Print machine-readable validation results').option('--package-manager <manager>', 'npm, pnpm, yarn, or bun').action(async (options) => { await new GameCommand(logger).validate(options); });
|
|
1481
|
-
gameCommand.action(() => gameCommand.outputHelp());
|
|
1482
|
-
// ==================== LEGION COMMAND ====================
|
|
1483
|
-
program
|
|
1484
|
-
.command('legion [request]')
|
|
1485
|
-
.description('Run parallel tasks via Hyper Loop Legion orchestrator')
|
|
1486
|
-
.option('--workers', 'List available Legion workers')
|
|
1487
|
-
.option('--status', 'Show Legion infrastructure status')
|
|
1488
|
-
.option('--cortex', 'Vigthoria Cortex: maximum intelligence execution')
|
|
1489
|
-
.option('--approve', 'Auto-approve Cortex execution prompt')
|
|
1490
|
-
.option('--no-approve', 'Require interactive approval before execution')
|
|
1491
|
-
.option('--auto-charge', 'Compatibility flag; low balances still require a verified User Hub top-up')
|
|
1492
|
-
.option('--plan-only', 'Run Cortex estimator only; do not execute Legion job')
|
|
1493
|
-
.option('--force-budget', 'Allow execution when estimated budget exceeds the hard safe-stop ceiling')
|
|
1494
|
-
.option('--ignore-preflight', 'Bypass mandatory local preflight checks (no warranty)')
|
|
1495
|
-
.option('--speed', 'Enable speed mode (allows optional role skips when convergence is detected)')
|
|
1496
|
-
.option('--repro-cmd <command>', 'Local reproduction/preflight command to validate before cloud spend')
|
|
1497
|
-
.option('--expect-repro-fail', 'Require repro command to fail (non-zero) before proceeding')
|
|
1498
|
-
.option('--models <csv>', 'Comma-separated model IDs to constrain Cortex selection')
|
|
1499
|
-
.option('-t, --timeout <seconds>', 'Override Legion execution timeout in seconds (defaults to server policy)')
|
|
1500
|
-
.option('-w, --worker <name>', 'Execute a specific worker')
|
|
1501
|
-
.option('-p, --project <path>', 'Project directory', process.cwd())
|
|
1502
|
-
.action(async (request, options) => {
|
|
1503
|
-
const legion = new LegionCommand(config, logger);
|
|
1504
|
-
const parsedTimeout = Number.parseInt(String(options.timeout || ''), 10);
|
|
1505
|
-
await legion.run(request, {
|
|
1506
|
-
workers: options.workers,
|
|
1507
|
-
status: options.status,
|
|
1508
|
-
cortex: Boolean(options.cortex),
|
|
1509
|
-
approve: options.approve,
|
|
1510
|
-
noApprove: options.approve === false,
|
|
1511
|
-
autoCharge: options.autoCharge,
|
|
1512
|
-
planOnly: options.planOnly,
|
|
1513
|
-
forceBudget: options.forceBudget,
|
|
1514
|
-
ignorePreflight: options.ignorePreflight,
|
|
1515
|
-
speed: options.speed,
|
|
1516
|
-
reproCmd: options.reproCmd,
|
|
1517
|
-
expectReproFail: options.expectReproFail,
|
|
1518
|
-
models: options.models,
|
|
1519
|
-
timeoutSec: Number.isFinite(parsedTimeout) && parsedTimeout > 0 ? parsedTimeout : undefined,
|
|
1520
|
-
worker: options.worker,
|
|
1521
|
-
project: options.project,
|
|
1522
|
-
});
|
|
1523
|
-
});
|
|
1524
|
-
// ==================== REPLAY & FORK COMMANDS ====================
|
|
1525
|
-
program
|
|
1526
|
-
.command('history')
|
|
1527
|
-
.alias('runs')
|
|
1528
|
-
.description('List recent V3 agent runs')
|
|
1529
|
-
.option('-n, --limit <count>', 'Number of runs to show', '20')
|
|
1530
|
-
.option('-p, --project <path>', 'Project directory', process.cwd())
|
|
1531
|
-
.option('--json', 'Machine-readable JSON output', false)
|
|
1532
|
-
.action(async (options) => {
|
|
1533
|
-
const history = new HistoryCommand(config, logger);
|
|
1534
|
-
await history.run({ limit: parseInt(options.limit, 10) || 20, json: options.json, project: options.project });
|
|
1535
|
-
});
|
|
1536
|
-
program
|
|
1537
|
-
.command('replay <runId>')
|
|
1538
|
-
.description('Replay events from a V3 agent run step-by-step')
|
|
1539
|
-
.option('-s, --speed <ms>', 'Delay between events in ms', '200')
|
|
1540
|
-
.option('-p, --project <path>', 'Project directory', process.cwd())
|
|
1541
|
-
.option('--json', 'Machine-readable JSON output', false)
|
|
1542
|
-
.action(async (runId, options) => {
|
|
1543
|
-
const replay = new ReplayCommand(config, logger);
|
|
1544
|
-
await replay.run(runId, { speed: parseInt(options.speed, 10) || 200, json: options.json, project: options.project });
|
|
1545
|
-
});
|
|
1546
|
-
program
|
|
1547
|
-
.command('fork <runId> [message]')
|
|
1548
|
-
.description('Fork from an existing V3 agent run with new instructions')
|
|
1549
|
-
.option('-e, --event-index <index>', 'Fork from specific event index', '0')
|
|
1550
|
-
.option('-p, --project <path>', 'Project directory', process.cwd())
|
|
1551
|
-
.option('--json', 'Machine-readable JSON output', false)
|
|
1552
|
-
.action(async (runId, message, options) => {
|
|
1553
|
-
const fork = new ForkCommand(config, logger);
|
|
1554
|
-
await fork.run(runId, message || '', { eventIndex: parseInt(options.eventIndex, 10) || 0, project: options.project, json: options.json });
|
|
1555
|
-
});
|
|
1556
|
-
program
|
|
1557
|
-
.command('cancel [contextId]')
|
|
1558
|
-
.description('Cancel an in-flight V3 agent run (by context_id), or use --all to cancel every active run')
|
|
1559
|
-
.option('-a, --all', 'Cancel all currently-active runs', false)
|
|
1560
|
-
.option('-l, --list', 'List active runs without cancelling', false)
|
|
1561
|
-
.option('--json', 'Machine-readable JSON output', false)
|
|
1562
|
-
.action(async (contextId, options) => {
|
|
1563
|
-
const cancel = new CancelCommand(config, logger);
|
|
1564
|
-
await cancel.run(contextId, { all: options.all, list: options.list, json: options.json });
|
|
1565
|
-
});
|
|
414
|
+
registerConversationCommands(program, config, logger);
|
|
415
|
+
registerV4Commands(program, config, logger);
|
|
416
|
+
registerPlatformCommands(program, config, logger);
|
|
417
|
+
registerCodingCommands(program, config, logger);
|
|
418
|
+
registerWorkflowCommands(program, config, logger);
|
|
419
|
+
registerProductAndRunCommands(program, config, logger);
|
|
1566
420
|
// ==================== AUTH COMMANDS ====================
|
|
1567
421
|
// Auth commands
|
|
1568
422
|
program
|
|
@@ -1589,92 +443,7 @@ Examples:
|
|
|
1589
443
|
});
|
|
1590
444
|
registerAuthCommands(program);
|
|
1591
445
|
new WalletCommand().register(program);
|
|
1592
|
-
program
|
|
1593
|
-
.command('doctor')
|
|
1594
|
-
.description('Run local Vigthoria CLI diagnostics (no network calls unless --check-api)')
|
|
1595
|
-
.option('--check-api', 'Also probe Vigthoria API reachability', false)
|
|
1596
|
-
.option('--json', 'Emit machine-readable JSON output', false)
|
|
1597
|
-
.action(async (options) => {
|
|
1598
|
-
const apiUrl = String(config.get('apiUrl') || 'https://coder.vigthoria.io').replace(/\/$/, '');
|
|
1599
|
-
const modelsApiUrl = String(config.get('modelsApiUrl') || 'https://api.vigthoria.io').replace(/\/$/, '');
|
|
1600
|
-
const offline = isOfflineMode();
|
|
1601
|
-
const updateSuppressed = isUpdateCheckSuppressed();
|
|
1602
|
-
const subscription = config.get('subscription') || { plan: null, status: null, expiresAt: null };
|
|
1603
|
-
const iosSandbox = isIOSEnvironment();
|
|
1604
|
-
const platformSupport = iosSandbox
|
|
1605
|
-
? 'experimental-mobile-terminal-sandbox'
|
|
1606
|
-
: process.platform === 'darwin'
|
|
1607
|
-
? 'supported-macos-desktop'
|
|
1608
|
-
: process.platform === 'win32' || process.platform === 'linux'
|
|
1609
|
-
? 'supported-desktop'
|
|
1610
|
-
: 'unsupported';
|
|
1611
|
-
const report = {
|
|
1612
|
-
cliVersion: VERSION,
|
|
1613
|
-
nodeVersion: process.version,
|
|
1614
|
-
platform: `${process.platform} ${process.arch}`,
|
|
1615
|
-
clientOs: resolveClientOsSlug(),
|
|
1616
|
-
platformSupport,
|
|
1617
|
-
platformLimitations: iosSandbox
|
|
1618
|
-
? 'Not a native iOS app. Requires an iSH-like Linux terminal with Node.js >=20.19, npm and filesystem access; Workbench and device tooling are unavailable.'
|
|
1619
|
-
: null,
|
|
1620
|
-
cwd: process.cwd(),
|
|
1621
|
-
homeDir: os.homedir(),
|
|
1622
|
-
configPath: config.getConfigPath(),
|
|
1623
|
-
stateFile: getCliStateFile(),
|
|
1624
|
-
apiUrl,
|
|
1625
|
-
modelsApiUrl,
|
|
1626
|
-
loggedIn: config.isAuthenticated(),
|
|
1627
|
-
subscriptionPlan: subscription.plan || null,
|
|
1628
|
-
subscriptionStatus: subscription.status || null,
|
|
1629
|
-
offlineMode: offline,
|
|
1630
|
-
updateCheckSuppressed: updateSuppressed,
|
|
1631
|
-
envOverrides: {
|
|
1632
|
-
VIGTHORIA_API_URL: process.env.VIGTHORIA_API_URL || null,
|
|
1633
|
-
VIGTHORIA_V3_AGENT_URL: process.env.VIGTHORIA_V3_AGENT_URL || null,
|
|
1634
|
-
VIGTHORIA_OFFLINE: process.env.VIGTHORIA_OFFLINE || null,
|
|
1635
|
-
VIGTHORIA_TOKEN: process.env.VIGTHORIA_TOKEN ? '<set>' : null,
|
|
1636
|
-
HYPERLOOP_SERVICE_KEY: process.env.HYPERLOOP_SERVICE_KEY ? '<set>' : null,
|
|
1637
|
-
V3_SERVICE_KEY: process.env.V3_SERVICE_KEY ? '<set>' : null,
|
|
1638
|
-
},
|
|
1639
|
-
};
|
|
1640
|
-
if (options.checkApi && !offline) {
|
|
1641
|
-
try {
|
|
1642
|
-
const probe = await axios.get(`${apiUrl}/api/health`, { timeout: 4000, validateStatus: () => true });
|
|
1643
|
-
report.apiHealth = probe.status >= 200 && probe.status < 400 ? 'online' : `status ${probe.status}`;
|
|
1644
|
-
}
|
|
1645
|
-
catch (error) {
|
|
1646
|
-
report.apiHealth = `unreachable (${error.message})`;
|
|
1647
|
-
}
|
|
1648
|
-
try {
|
|
1649
|
-
const probe = await axios.get(`${modelsApiUrl}/health`, { timeout: 4000, validateStatus: () => true });
|
|
1650
|
-
report.modelsApiHealth = probe.status >= 200 && probe.status < 400 ? 'online' : `status ${probe.status}`;
|
|
1651
|
-
}
|
|
1652
|
-
catch (error) {
|
|
1653
|
-
report.modelsApiHealth = `unreachable (${error.message})`;
|
|
1654
|
-
}
|
|
1655
|
-
}
|
|
1656
|
-
if (options.json) {
|
|
1657
|
-
console.log(JSON.stringify(report, null, 2));
|
|
1658
|
-
}
|
|
1659
|
-
else {
|
|
1660
|
-
console.log(chalk.bold('Vigthoria CLI diagnostics'));
|
|
1661
|
-
for (const [key, value] of Object.entries(report)) {
|
|
1662
|
-
if (value && typeof value === 'object') {
|
|
1663
|
-
console.log(chalk.gray(`- ${key}:`));
|
|
1664
|
-
for (const [subKey, subVal] of Object.entries(value)) {
|
|
1665
|
-
console.log(chalk.gray(` - ${subKey}: ${subVal ?? '(none)'}`));
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
else {
|
|
1669
|
-
console.log(chalk.gray(`- ${key}: ${value ?? '(none)'}`));
|
|
1670
|
-
}
|
|
1671
|
-
}
|
|
1672
|
-
if (!options.checkApi) {
|
|
1673
|
-
console.log(chalk.gray('\nTip: pass --check-api to verify API reachability.'));
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
process.exitCode = 0;
|
|
1677
|
-
});
|
|
446
|
+
registerDoctorCommand(program, config, logger, VERSION);
|
|
1678
447
|
// Config command
|
|
1679
448
|
program
|
|
1680
449
|
.command('config')
|
|
@@ -1687,178 +456,7 @@ Examples:
|
|
|
1687
456
|
const configCmd = new ConfigCommand(config, logger);
|
|
1688
457
|
await configCmd.run(options);
|
|
1689
458
|
});
|
|
1690
|
-
|
|
1691
|
-
program
|
|
1692
|
-
.command('update')
|
|
1693
|
-
.alias('upgrade')
|
|
1694
|
-
.description('Check for updates and upgrade Vigthoria CLI. Default manifest: https://extension.vigthoria.io/downloads/manifest.json')
|
|
1695
|
-
.option('-c, --check', 'Only check for updates, don\'t install')
|
|
1696
|
-
.option('-f, --from <target>', 'Install update from npm spec, local .tgz path, or URL')
|
|
1697
|
-
.option('-m, --manifest <url>', 'Update manifest URL for server-driven releases')
|
|
1698
|
-
.option('--channel <name>', 'Release channel to use from manifest (default: stable)', 'stable')
|
|
1699
|
-
.option('--allow-downgrade', 'Allow installing an older version from custom update source')
|
|
1700
|
-
.action(async (options) => {
|
|
1701
|
-
const updateTarget = typeof options.from === 'string' ? options.from.trim() : '';
|
|
1702
|
-
const manifestUrl = typeof options.manifest === 'string' ? options.manifest.trim() : VIGTHORIA_DEFAULT_MANIFEST_URL.trim();
|
|
1703
|
-
const channel = typeof options.channel === 'string' ? options.channel.trim() : 'stable';
|
|
1704
|
-
const allowDowngrade = !!options.allowDowngrade;
|
|
1705
|
-
const gitPackageSpec = 'git+https://market.vigthoria.io/vigthoria/vigthoria-cli.git';
|
|
1706
|
-
if (updateTarget) {
|
|
1707
|
-
if (!isSafeNpmPackageSpec(updateTarget)) {
|
|
1708
|
-
console.error(chalk.red('Refusing to run installer with unsafe package spec.'));
|
|
1709
|
-
console.error(chalk.gray('Allowed characters: A-Z a-z 0-9 . _ - / @ : + \\ ='));
|
|
1710
|
-
process.exitCode = 1;
|
|
1711
|
-
return;
|
|
1712
|
-
}
|
|
1713
|
-
try {
|
|
1714
|
-
if (options.check) {
|
|
1715
|
-
console.log(chalk.cyan(`Update source configured: ${updateTarget}`));
|
|
1716
|
-
console.log(chalk.gray('Run `vigthoria update --from <target>` to install from this source'));
|
|
1717
|
-
return;
|
|
1718
|
-
}
|
|
1719
|
-
console.log(chalk.cyan(`Installing update from ${updateTarget}...`));
|
|
1720
|
-
await installGlobalPackageWithNpm(updateTarget);
|
|
1721
|
-
console.log(chalk.green('Update installed successfully'));
|
|
1722
|
-
console.log(chalk.gray('Please restart the CLI to use the new version'));
|
|
1723
|
-
return;
|
|
1724
|
-
}
|
|
1725
|
-
catch (error) {
|
|
1726
|
-
console.error(chalk.red('Failed to install update from target:'), error.message);
|
|
1727
|
-
console.log(chalk.gray(`Try manually: npm install -g ${updateTarget}`));
|
|
1728
|
-
process.exitCode = 1;
|
|
1729
|
-
return;
|
|
1730
|
-
}
|
|
1731
|
-
}
|
|
1732
|
-
if (isOfflineMode()) {
|
|
1733
|
-
console.log(chalk.yellow('Offline mode (VIGTHORIA_OFFLINE=1): skipping update check.'));
|
|
1734
|
-
return;
|
|
1735
|
-
}
|
|
1736
|
-
const currentVersion = VERSION;
|
|
1737
|
-
let manifestEntry = null;
|
|
1738
|
-
if (manifestUrl) {
|
|
1739
|
-
try {
|
|
1740
|
-
const explicitLocalManifest = Boolean(options.manifest)
|
|
1741
|
-
&& ['localhost', '127.0.0.1', '::1'].includes(new URL(manifestUrl).hostname);
|
|
1742
|
-
validateReleaseUrl(manifestUrl, explicitLocalManifest);
|
|
1743
|
-
console.log(chalk.cyan(`Checking manifest channel ${channel}...`));
|
|
1744
|
-
const response = await axios.get(manifestUrl, {
|
|
1745
|
-
timeout: 10000,
|
|
1746
|
-
maxRedirects: 5,
|
|
1747
|
-
validateStatus: (status) => status >= 200 && status < 300,
|
|
1748
|
-
});
|
|
1749
|
-
manifestEntry = resolveManifestEntry(response.data || {}, channel);
|
|
1750
|
-
if (!manifestEntry?.version || !manifestEntry?.url) {
|
|
1751
|
-
console.log(chalk.yellow(`Manifest has no installable entry for channel ${channel}; will check npm.`));
|
|
1752
|
-
manifestEntry = null;
|
|
1753
|
-
}
|
|
1754
|
-
else {
|
|
1755
|
-
validateReleaseUrl(manifestEntry.url, explicitLocalManifest);
|
|
1756
|
-
if (!/^[a-f0-9]{64}$/i.test(String(manifestEntry.sha256 || ''))) {
|
|
1757
|
-
console.log(chalk.yellow('Manifest entry has no valid SHA-256 checksum; refusing it and checking npm.'));
|
|
1758
|
-
manifestEntry = null;
|
|
1759
|
-
}
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
catch (error) {
|
|
1763
|
-
console.log(chalk.yellow(`Manifest check failed: ${error.message}`));
|
|
1764
|
-
console.log(chalk.gray('Continuing with npm registry check...'));
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
// The release manifest (server-curated, sha256-verified) is the
|
|
1768
|
-
// authoritative source of truth for this private CLI. Only fall back
|
|
1769
|
-
// to probing the public npm registry when the manifest itself has no
|
|
1770
|
-
// usable entry - never let an npm version number override a valid,
|
|
1771
|
-
// verified manifest entry (npm install -g against the public registry
|
|
1772
|
-
// is slower, unverified, and has previously caused the Workbench's
|
|
1773
|
-
// update button to hang for minutes).
|
|
1774
|
-
let npmVersion = null;
|
|
1775
|
-
if (manifestEntry?.version && manifestEntry?.url) {
|
|
1776
|
-
console.log(chalk.gray('Release manifest has a valid entry; skipping public npm registry lookup.'));
|
|
1777
|
-
}
|
|
1778
|
-
else {
|
|
1779
|
-
console.log(chalk.cyan('Checking npm registry...'));
|
|
1780
|
-
npmVersion = await fetchNpmLatestVersion();
|
|
1781
|
-
if (!npmVersion) {
|
|
1782
|
-
console.log(chalk.yellow('Could not read latest version from npm registry.'));
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
const effectiveLatest = maxVersion(manifestEntry?.version, npmVersion);
|
|
1786
|
-
if (!effectiveLatest) {
|
|
1787
|
-
console.error(chalk.red('Unable to determine the latest CLI version from manifest or npm.'));
|
|
1788
|
-
process.exitCode = 1;
|
|
1789
|
-
return;
|
|
1790
|
-
}
|
|
1791
|
-
if (!allowDowngrade && compareVersions(effectiveLatest, currentVersion) <= 0) {
|
|
1792
|
-
console.log(chalk.green(`You are running the latest version (${currentVersion})`));
|
|
1793
|
-
return;
|
|
1794
|
-
}
|
|
1795
|
-
console.log(chalk.yellow(`Update available: ${currentVersion} -> ${effectiveLatest}`));
|
|
1796
|
-
if (manifestEntry?.notes && compareVersions(manifestEntry.version, effectiveLatest) >= 0) {
|
|
1797
|
-
console.log(chalk.gray(` ${manifestEntry.notes}`));
|
|
1798
|
-
}
|
|
1799
|
-
if (options.check) {
|
|
1800
|
-
console.log(chalk.gray('Run `vigthoria update` to install the update'));
|
|
1801
|
-
return;
|
|
1802
|
-
}
|
|
1803
|
-
const manifestIsAuthoritative = Boolean(manifestEntry
|
|
1804
|
-
&& manifestEntry.url
|
|
1805
|
-
&& compareVersions(manifestEntry.version, effectiveLatest) >= 0
|
|
1806
|
-
&& compareVersions(manifestEntry.version, currentVersion) > 0);
|
|
1807
|
-
if (manifestIsAuthoritative && manifestEntry) {
|
|
1808
|
-
const tmpFile = path.join(os.tmpdir(), `vigthoria-update-${Date.now()}.tgz`);
|
|
1809
|
-
try {
|
|
1810
|
-
console.log(chalk.cyan(`Downloading release package (${manifestEntry.version})...`));
|
|
1811
|
-
await downloadFile(manifestEntry.url, tmpFile);
|
|
1812
|
-
const expected = String(manifestEntry.sha256).toLowerCase();
|
|
1813
|
-
const actual = sha256File(tmpFile).toLowerCase();
|
|
1814
|
-
if (actual !== expected) {
|
|
1815
|
-
console.error(chalk.red('Release checksum verification failed'));
|
|
1816
|
-
console.error(chalk.red(`Expected: ${expected}`));
|
|
1817
|
-
console.error(chalk.red(`Actual: ${actual}`));
|
|
1818
|
-
process.exitCode = 1;
|
|
1819
|
-
return;
|
|
1820
|
-
}
|
|
1821
|
-
console.log(chalk.green('Checksum verification passed'));
|
|
1822
|
-
console.log(chalk.cyan('Installing update...'));
|
|
1823
|
-
await installGlobalPackageWithNpm(tmpFile);
|
|
1824
|
-
console.log(chalk.green(`Updated to version ${manifestEntry.version}`));
|
|
1825
|
-
console.log(chalk.gray('Please restart the CLI to use the new version'));
|
|
1826
|
-
return;
|
|
1827
|
-
}
|
|
1828
|
-
finally {
|
|
1829
|
-
if (fs.existsSync(tmpFile)) {
|
|
1830
|
-
try {
|
|
1831
|
-
fs.unlinkSync(tmpFile);
|
|
1832
|
-
}
|
|
1833
|
-
catch { }
|
|
1834
|
-
}
|
|
1835
|
-
}
|
|
1836
|
-
}
|
|
1837
|
-
const npmSpec = npmVersion && compareVersions(npmVersion, currentVersion) > 0
|
|
1838
|
-
? `vigthoria-cli@${npmVersion}`
|
|
1839
|
-
: 'vigthoria-cli@latest';
|
|
1840
|
-
try {
|
|
1841
|
-
console.log(chalk.cyan(`Installing update from npm registry (${npmSpec})...`));
|
|
1842
|
-
await installGlobalPackageWithNpm(npmSpec);
|
|
1843
|
-
console.log(chalk.green(`Updated to version ${effectiveLatest}`));
|
|
1844
|
-
console.log(chalk.gray('Please restart the CLI to use the new version'));
|
|
1845
|
-
}
|
|
1846
|
-
catch (error) {
|
|
1847
|
-
console.error(chalk.red('Failed to install via npm registry:'), error.message);
|
|
1848
|
-
try {
|
|
1849
|
-
console.log(chalk.cyan('Attempting git package fallback...'));
|
|
1850
|
-
await installGlobalPackageWithNpm(gitPackageSpec);
|
|
1851
|
-
console.log(chalk.green('Updated via git package fallback'));
|
|
1852
|
-
console.log(chalk.gray('Please restart the CLI to use the new version'));
|
|
1853
|
-
}
|
|
1854
|
-
catch (fallbackError) {
|
|
1855
|
-
console.error(chalk.red('Fallback update also failed:'), fallbackError.message);
|
|
1856
|
-
console.log(chalk.gray(`Try manually: npm install -g ${npmSpec}`));
|
|
1857
|
-
console.log(chalk.gray(`Or: npm install -g ${gitPackageSpec}`));
|
|
1858
|
-
process.exitCode = 1;
|
|
1859
|
-
}
|
|
1860
|
-
}
|
|
1861
|
-
});
|
|
459
|
+
registerUpdateCommand(program, VERSION);
|
|
1862
460
|
// Hyper Loop command alias (maps to legion --status for checklist gate 6.9)
|
|
1863
461
|
program
|
|
1864
462
|
.command('hyper-loop')
|
|
@@ -1879,12 +477,14 @@ Examples:
|
|
|
1879
477
|
project: process.cwd(),
|
|
1880
478
|
});
|
|
1881
479
|
});
|
|
1882
|
-
// DevTools
|
|
480
|
+
// DevTools status surface. Keep `connect` as a compatibility alias while
|
|
481
|
+
// making the canonical command accurately describe its read-only behavior.
|
|
1883
482
|
program
|
|
1884
483
|
.command('devtools')
|
|
1885
484
|
.description('DevTools Bridge commands for browser debugging')
|
|
1886
|
-
.command('
|
|
1887
|
-
.
|
|
485
|
+
.command('status')
|
|
486
|
+
.alias('connect')
|
|
487
|
+
.description('Show live DevTools Bridge status')
|
|
1888
488
|
.action(async () => {
|
|
1889
489
|
const bridge = new BridgeCommand(config, logger);
|
|
1890
490
|
await bridge.status();
|
|
@@ -1912,6 +512,27 @@ Examples:
|
|
|
1912
512
|
.action(() => {
|
|
1913
513
|
console.log(renderDynamicHelp(program));
|
|
1914
514
|
});
|
|
515
|
+
program.hook('preAction', async (_rootCommand, actionCommand) => {
|
|
516
|
+
const commandPath = commanderCommandPath(actionCommand);
|
|
517
|
+
activeCommandPath = commandPath;
|
|
518
|
+
const authRequirement = commandAuthRequirement(commandPath);
|
|
519
|
+
if (authRequirement === 'none')
|
|
520
|
+
return;
|
|
521
|
+
// On-box service identities are authenticated by their destination
|
|
522
|
+
// service and must not be confused with a user gateway session.
|
|
523
|
+
const hasServiceKey = Boolean(process.env.HYPERLOOP_SERVICE_KEY || process.env.V3_SERVICE_KEY);
|
|
524
|
+
const legionCortex = commandPath === 'legion' && actionCommand.opts().cortex === true;
|
|
525
|
+
if (hasServiceKey || legionCortex)
|
|
526
|
+
return;
|
|
527
|
+
const explicitEnvToken = Boolean(process.env.VIGTHORIA_TOKEN || process.env.VIGTHORIA_AUTH_TOKEN);
|
|
528
|
+
if (authRequirement === 'required-session' && !config.isAuthenticated() && !explicitEnvToken) {
|
|
529
|
+
throw new CliCommandError('Authentication required. Run `vigthoria login` first.', {
|
|
530
|
+
code: 'AUTH_REQUIRED',
|
|
531
|
+
category: 'authentication',
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
await enforceGatewayAuthSession(config, logger);
|
|
535
|
+
});
|
|
1915
536
|
try {
|
|
1916
537
|
// Default to chat if no command
|
|
1917
538
|
if (args.length === 2) {
|
|
@@ -1928,8 +549,11 @@ Examples:
|
|
|
1928
549
|
}
|
|
1929
550
|
}
|
|
1930
551
|
catch (error) {
|
|
1931
|
-
|
|
1932
|
-
|
|
552
|
+
if (error && typeof error === 'object' && error.exitCode === 0) {
|
|
553
|
+
process.exitCode = 0;
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
process.exitCode = reportCliError(error, jsonOutputRequested);
|
|
1933
557
|
}
|
|
1934
558
|
}
|
|
1935
559
|
setupErrorHandlers();
|
|
@@ -1939,7 +563,7 @@ async function bootstrapCli() {
|
|
|
1939
563
|
}
|
|
1940
564
|
catch (err) {
|
|
1941
565
|
handleFatalCliError(err, process.argv.includes('--json'));
|
|
1942
|
-
process.exit(1);
|
|
566
|
+
process.exit(process.exitCode || 1);
|
|
1943
567
|
}
|
|
1944
568
|
}
|
|
1945
569
|
void (async () => {
|
|
@@ -1948,7 +572,7 @@ void (async () => {
|
|
|
1948
572
|
}
|
|
1949
573
|
catch (err) {
|
|
1950
574
|
handleFatalCliError(err, process.argv.includes('--json'));
|
|
1951
|
-
process.exit(1);
|
|
575
|
+
process.exit(process.exitCode || 1);
|
|
1952
576
|
}
|
|
1953
577
|
})();
|
|
1954
578
|
export const __cliErrorHandlingReady = true;
|