vigthoria-cli 1.10.48 → 1.10.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/agent-session-menu.js +2 -8
- package/dist/commands/bridge.js +36 -9
- package/dist/commands/chat.d.ts +3 -28
- package/dist/commands/chat.js +326 -295
- package/dist/commands/fork.js +1 -1
- package/dist/commands/history.js +1 -1
- package/dist/commands/replay.js +1 -1
- package/dist/index.js +40 -214
- package/dist/utils/api.d.ts +25 -53
- package/dist/utils/api.js +300 -1443
- package/dist/utils/config.d.ts +0 -3
- package/dist/utils/config.js +2 -0
- package/dist/utils/desktop-bridge-client.d.ts +12 -0
- package/dist/utils/desktop-bridge-client.js +30 -0
- package/dist/utils/post-write-validator.js +5 -5
- package/dist/utils/tools.d.ts +0 -7
- package/dist/utils/tools.js +15 -87
- package/package.json +2 -1
- package/scripts/release/validate-no-go-gates.sh +7 -4
package/dist/commands/fork.js
CHANGED
|
@@ -29,7 +29,7 @@ export class ForkCommand {
|
|
|
29
29
|
}
|
|
30
30
|
getBaseUrl() {
|
|
31
31
|
const configuredApiUrl = String(this.config.get('apiUrl') || 'https://coder.vigthoria.io').replace(/\/$/, '');
|
|
32
|
-
const allowLocal =
|
|
32
|
+
const allowLocal = isServerRuntime() && process.env.VIGTHORIA_ALLOW_LOCAL_V3_AGENT === '1';
|
|
33
33
|
return (process.env.VIGTHORIA_V3_AGENT_URL ||
|
|
34
34
|
process.env.V3_AGENT_URL ||
|
|
35
35
|
(allowLocal ? 'http://127.0.0.1:8030' : null) ||
|
package/dist/commands/history.js
CHANGED
|
@@ -29,7 +29,7 @@ export class HistoryCommand {
|
|
|
29
29
|
}
|
|
30
30
|
getBaseUrl() {
|
|
31
31
|
const configuredApiUrl = String(this.config.get('apiUrl') || 'https://coder.vigthoria.io').replace(/\/$/, '');
|
|
32
|
-
const allowLocal =
|
|
32
|
+
const allowLocal = isServerRuntime() && process.env.VIGTHORIA_ALLOW_LOCAL_V3_AGENT === '1';
|
|
33
33
|
return (process.env.VIGTHORIA_V3_AGENT_URL ||
|
|
34
34
|
process.env.V3_AGENT_URL ||
|
|
35
35
|
(allowLocal ? 'http://127.0.0.1:8030' : null) ||
|
package/dist/commands/replay.js
CHANGED
|
@@ -29,7 +29,7 @@ export class ReplayCommand {
|
|
|
29
29
|
}
|
|
30
30
|
getBaseUrl() {
|
|
31
31
|
const configuredApiUrl = String(this.config.get('apiUrl') || 'https://coder.vigthoria.io').replace(/\/$/, '');
|
|
32
|
-
const allowLocal =
|
|
32
|
+
const allowLocal = isServerRuntime() && process.env.VIGTHORIA_ALLOW_LOCAL_V3_AGENT === '1';
|
|
33
33
|
return (process.env.VIGTHORIA_V3_AGENT_URL ||
|
|
34
34
|
process.env.V3_AGENT_URL ||
|
|
35
35
|
(allowLocal ? 'http://127.0.0.1:8030' : null) ||
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* vigthoria workflow - Manage repeatable VigFlow workflows
|
|
16
16
|
* vigthoria operator - Start BMAD operator mode
|
|
17
17
|
*/
|
|
18
|
-
import { Command
|
|
18
|
+
import { Command } from 'commander';
|
|
19
19
|
import { ChatCommand } from './commands/chat.js';
|
|
20
20
|
import { EditCommand } from './commands/edit.js';
|
|
21
21
|
import { GenerateCommand } from './commands/generate.js';
|
|
@@ -36,7 +36,6 @@ import { ReplayCommand } from './commands/replay.js';
|
|
|
36
36
|
import { ForkCommand } from './commands/fork.js';
|
|
37
37
|
import { CancelCommand } from './commands/cancel.js';
|
|
38
38
|
import { SecurityCommand } from './commands/security.js';
|
|
39
|
-
import { WalletCommand } from './commands/wallet.js';
|
|
40
39
|
import { Config } from './utils/config.js';
|
|
41
40
|
import { Logger, CH } from './utils/logger.js';
|
|
42
41
|
import chalk from 'chalk';
|
|
@@ -64,56 +63,6 @@ function getInvokedBinaryName() {
|
|
|
64
63
|
const executable = process.argv[1] || 'vigthoria';
|
|
65
64
|
return path.basename(executable, path.extname(executable)).toLowerCase();
|
|
66
65
|
}
|
|
67
|
-
function detectRuntimeEnvironment(cwd) {
|
|
68
|
-
const osPlatform = process.platform;
|
|
69
|
-
const normalizedPlatform = osPlatform === 'win32'
|
|
70
|
-
? 'windows'
|
|
71
|
-
: osPlatform === 'darwin'
|
|
72
|
-
? 'macos'
|
|
73
|
-
: osPlatform === 'linux'
|
|
74
|
-
? 'linux'
|
|
75
|
-
: 'unknown';
|
|
76
|
-
const release = os.release();
|
|
77
|
-
const isWSL = normalizedPlatform === 'linux' && (/microsoft/i.test(release)
|
|
78
|
-
|| Boolean(process.env.WSL_DISTRO_NAME)
|
|
79
|
-
|| Boolean(process.env.WSL_INTEROP));
|
|
80
|
-
let isContainer = false;
|
|
81
|
-
try {
|
|
82
|
-
if (fs.existsSync('/.dockerenv')) {
|
|
83
|
-
isContainer = true;
|
|
84
|
-
}
|
|
85
|
-
else if (fs.existsSync('/proc/1/cgroup')) {
|
|
86
|
-
const cgroup = fs.readFileSync('/proc/1/cgroup', 'utf8');
|
|
87
|
-
isContainer = /(docker|containerd|kubepods|podman)/i.test(cgroup);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
catch {
|
|
91
|
-
isContainer = false;
|
|
92
|
-
}
|
|
93
|
-
const isCodespaces = String(process.env.CODESPACES || '').toLowerCase() === 'true';
|
|
94
|
-
const isCI = String(process.env.CI || '').toLowerCase() === 'true';
|
|
95
|
-
const isMobileLikeRuntime = Boolean(process.env.TERMUX_VERSION
|
|
96
|
-
|| process.env.ANDROID_ROOT
|
|
97
|
-
|| process.env.IOS_SIMULATOR_DEVICE_NAME
|
|
98
|
-
|| /\/var\/mobile\//.test(cwd));
|
|
99
|
-
const workspaceKind = cwd.startsWith('/var/www/') || cwd.startsWith('/opt/vigthoria')
|
|
100
|
-
? 'server-workspace'
|
|
101
|
-
: 'local-machine';
|
|
102
|
-
return {
|
|
103
|
-
osPlatform,
|
|
104
|
-
normalizedPlatform,
|
|
105
|
-
arch: process.arch,
|
|
106
|
-
release,
|
|
107
|
-
isWSL,
|
|
108
|
-
isContainer,
|
|
109
|
-
isCodespaces,
|
|
110
|
-
isCI,
|
|
111
|
-
isMobileLikeRuntime,
|
|
112
|
-
workspaceKind,
|
|
113
|
-
cwd,
|
|
114
|
-
shell: process.env.SHELL || process.env.ComSpec || null,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
66
|
// Get version from package.json dynamically
|
|
118
67
|
function getPackageMetadataPaths() {
|
|
119
68
|
return [
|
|
@@ -200,21 +149,7 @@ function compareVersions(v1, v2) {
|
|
|
200
149
|
return 0;
|
|
201
150
|
}
|
|
202
151
|
const VERSION = getVersion();
|
|
203
|
-
function hiddenGrantOption() {
|
|
204
|
-
return new Option('--grant', 'Use optional Wiener Grantler persona for this invocation').hideHelp();
|
|
205
|
-
}
|
|
206
|
-
function allowInsecureCliVersionInstall() {
|
|
207
|
-
return /^(1|true|yes)$/i.test(String(process.env.VIGTHORIA_ALLOW_INSECURE_CLI_VERSION || ''));
|
|
208
|
-
}
|
|
209
|
-
function extractVersionFromUpdateTarget(target) {
|
|
210
|
-
const match = target.match(/(?:@|[-_])([0-9]+\.[0-9]+\.[0-9]+)(?:\.tgz)?(?:$|[^0-9])/);
|
|
211
|
-
return match ? match[1] : null;
|
|
212
|
-
}
|
|
213
|
-
function isBelowSecureCliBaseline(version) {
|
|
214
|
-
return compareVersions(version, VIGTHORIA_MIN_SECURE_CLI_VERSION) < 0;
|
|
215
|
-
}
|
|
216
152
|
const VIGTHORIA_DEFAULT_MANIFEST_URL = process.env.VIGTHORIA_UPDATE_MANIFEST_URL || "https://coder.vigthoria.io/releases/manifest.json";
|
|
217
|
-
const VIGTHORIA_MIN_SECURE_CLI_VERSION = '1.10.22';
|
|
218
153
|
function resolveManifestEntry(manifest, channel) {
|
|
219
154
|
const normalized = String(channel || 'stable').trim() || 'stable';
|
|
220
155
|
if (manifest.channels && manifest.channels[normalized]) {
|
|
@@ -407,14 +342,18 @@ async function enforceGatewayAuthSession(config, logger, jsonOutputRequested) {
|
|
|
407
342
|
if (!config.isAuthenticated()) {
|
|
408
343
|
return true;
|
|
409
344
|
}
|
|
345
|
+
const explicitEnvToken = Boolean(process.env.VIGTHORIA_TOKEN || process.env.VIGTHORIA_AUTH_TOKEN);
|
|
410
346
|
// Offline mode disables every outbound preflight call.
|
|
411
347
|
if (isOfflineMode()) {
|
|
412
348
|
return true;
|
|
413
349
|
}
|
|
414
|
-
// Short-lived cache so back-to-back CLI invocations don't re-probe.
|
|
415
|
-
|
|
416
|
-
if (
|
|
417
|
-
|
|
350
|
+
// Short-lived cache so back-to-back CLI invocations don't re-probe. Never use
|
|
351
|
+
// a cached success when an explicit env token overrides the stored session.
|
|
352
|
+
if (!explicitEnvToken) {
|
|
353
|
+
const cached = readGatewayPreflightCache();
|
|
354
|
+
if (cached === true) {
|
|
355
|
+
return true;
|
|
356
|
+
}
|
|
418
357
|
}
|
|
419
358
|
const api = new APIClient(config, logger);
|
|
420
359
|
try {
|
|
@@ -434,6 +373,17 @@ async function enforceGatewayAuthSession(config, logger, jsonOutputRequested) {
|
|
|
434
373
|
return true;
|
|
435
374
|
}
|
|
436
375
|
catch {
|
|
376
|
+
if (explicitEnvToken) {
|
|
377
|
+
writeGatewayPreflightCache(false);
|
|
378
|
+
if (jsonOutputRequested) {
|
|
379
|
+
process.exitCode = 1;
|
|
380
|
+
console.log(JSON.stringify({ success: false, error: VIGTHORIA_GATEWAY_AUTH_FAILURE_MESSAGE }, null, 2));
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
console.log(chalk.red(VIGTHORIA_GATEWAY_AUTH_FAILURE_MESSAGE));
|
|
384
|
+
}
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
437
387
|
// Network or transient backend outages should not be misclassified as auth failure.
|
|
438
388
|
return true;
|
|
439
389
|
}
|
|
@@ -589,13 +539,12 @@ export async function main(args) {
|
|
|
589
539
|
program
|
|
590
540
|
.name(invokedBinaryName === 'vigthoria-chat' ? 'vigthoria-chat' : 'vigthoria')
|
|
591
541
|
.description('AI-powered terminal coding assistant for Vigthoria Coder subscribers')
|
|
592
|
-
.version(VERSION)
|
|
593
|
-
.addOption(hiddenGrantOption());
|
|
542
|
+
.version(VERSION);
|
|
594
543
|
// Chat command - Interactive mode (Agent mode is default for best results)
|
|
595
544
|
program
|
|
596
545
|
.command('chat')
|
|
597
546
|
.alias('c')
|
|
598
|
-
.description('Start interactive chat
|
|
547
|
+
.description('Start interactive chat with Vigthoria AI')
|
|
599
548
|
.option('-m, --model <model>', 'Select AI model (agent, code, code-35b, code-9b, balanced, balanced-4b, cloud, ultra)')
|
|
600
549
|
.option('-p, --project <path>', 'Set project context path')
|
|
601
550
|
.option('--new-project [name]', 'Create or use a managed local workspace folder when no --project path is given')
|
|
@@ -607,7 +556,6 @@ export async function main(args) {
|
|
|
607
556
|
.option('--json', 'Emit machine-readable JSON output for direct prompt runs', false)
|
|
608
557
|
.option('--auto-approve', 'Auto-approve agent actions (dangerous!)', false)
|
|
609
558
|
.option('--bridge <url>', 'Connect to Vigthoria Commando Bridge for remote admin observability')
|
|
610
|
-
.addOption(hiddenGrantOption())
|
|
611
559
|
.action(async (options) => {
|
|
612
560
|
const chat = new ChatCommand(config, logger);
|
|
613
561
|
await chat.run({
|
|
@@ -616,14 +564,12 @@ export async function main(args) {
|
|
|
616
564
|
projectProvided: typeof options.project === 'string' && options.project.trim().length > 0,
|
|
617
565
|
newProject: options.newProject,
|
|
618
566
|
agent: options.agent,
|
|
619
|
-
agentEntry: options.agent === false ? 'chat-plain' : 'chat-default',
|
|
620
567
|
workflow: options.workflow,
|
|
621
568
|
json: options.json,
|
|
622
569
|
autoApprove: options.autoApprove,
|
|
623
570
|
resume: options.resume,
|
|
624
571
|
prompt: options.prompt,
|
|
625
572
|
bridge: options.bridge,
|
|
626
|
-
grant: options.grant || program.opts().grant === true,
|
|
627
573
|
});
|
|
628
574
|
});
|
|
629
575
|
program
|
|
@@ -639,7 +585,6 @@ export async function main(args) {
|
|
|
639
585
|
.option('--json', 'Emit machine-readable JSON output for direct prompt runs', false)
|
|
640
586
|
.option('--auto-approve', 'Auto-approve agent actions (dangerous!)', false)
|
|
641
587
|
.option('--bridge <url>', 'Connect to Vigthoria Commando Bridge for remote admin observability')
|
|
642
|
-
.addOption(hiddenGrantOption())
|
|
643
588
|
.action(async (options) => {
|
|
644
589
|
const chat = new ChatCommand(config, logger);
|
|
645
590
|
await chat.run({
|
|
@@ -648,14 +593,12 @@ export async function main(args) {
|
|
|
648
593
|
projectProvided: typeof options.project === 'string' && options.project.trim().length > 0,
|
|
649
594
|
newProject: options.newProject,
|
|
650
595
|
agent: options.agent,
|
|
651
|
-
agentEntry: options.agent === false ? 'chat-plain' : 'chat-default',
|
|
652
596
|
workflow: options.workflow,
|
|
653
597
|
json: options.json,
|
|
654
598
|
autoApprove: options.autoApprove,
|
|
655
599
|
resume: true,
|
|
656
600
|
prompt: options.prompt,
|
|
657
601
|
bridge: options.bridge,
|
|
658
|
-
grant: options.grant || program.opts().grant === true,
|
|
659
602
|
});
|
|
660
603
|
});
|
|
661
604
|
// Agent command - Agentic mode (Vigthoria Autonomous)
|
|
@@ -663,7 +606,7 @@ export async function main(args) {
|
|
|
663
606
|
program
|
|
664
607
|
.command('agent')
|
|
665
608
|
.alias('a')
|
|
666
|
-
.description('Start
|
|
609
|
+
.description('Start agentic mode - AI can read/write files, run commands')
|
|
667
610
|
.option('-m, --model <model>', 'Select AI model (agent, code, cloud, ultra)')
|
|
668
611
|
.option('-p, --project <path>', 'Set project context path')
|
|
669
612
|
.option('--new-project [name]', 'Create or use a managed local workspace folder when no --project path is given')
|
|
@@ -672,7 +615,6 @@ export async function main(args) {
|
|
|
672
615
|
.option('--json', 'Emit machine-readable JSON output for direct prompt runs', false)
|
|
673
616
|
.option('--auto-approve', 'Auto-approve all actions (dangerous!)', false)
|
|
674
617
|
.option('--bridge <url>', 'Connect to Vigthoria Commando Bridge for remote admin observability')
|
|
675
|
-
.addOption(hiddenGrantOption())
|
|
676
618
|
.action(async (options) => {
|
|
677
619
|
const chat = new ChatCommand(config, logger);
|
|
678
620
|
await chat.run({
|
|
@@ -681,14 +623,12 @@ export async function main(args) {
|
|
|
681
623
|
projectProvided: typeof options.project === 'string' && options.project.trim().length > 0,
|
|
682
624
|
newProject: options.newProject,
|
|
683
625
|
agent: true,
|
|
684
|
-
agentEntry: 'command',
|
|
685
626
|
operator: false,
|
|
686
627
|
workflow: options.workflow,
|
|
687
628
|
json: options.json,
|
|
688
629
|
autoApprove: options.autoApprove,
|
|
689
630
|
prompt: options.prompt,
|
|
690
631
|
bridge: options.bridge,
|
|
691
|
-
grant: options.grant || program.opts().grant === true,
|
|
692
632
|
});
|
|
693
633
|
});
|
|
694
634
|
program
|
|
@@ -703,7 +643,6 @@ export async function main(args) {
|
|
|
703
643
|
.option('--save-plan', 'Save the completed BMAD plan into VigFlow for rerun and audit', false)
|
|
704
644
|
.option('--json', 'Emit machine-readable JSON output for direct prompt runs', false)
|
|
705
645
|
.option('--bridge <url>', 'Connect to Vigthoria Commando Bridge for remote admin observability')
|
|
706
|
-
.addOption(hiddenGrantOption())
|
|
707
646
|
.action(async (options) => {
|
|
708
647
|
const chat = new ChatCommand(config, logger);
|
|
709
648
|
await chat.run({
|
|
@@ -718,7 +657,6 @@ export async function main(args) {
|
|
|
718
657
|
json: options.json,
|
|
719
658
|
prompt: options.prompt,
|
|
720
659
|
bridge: options.bridge,
|
|
721
|
-
grant: options.grant || program.opts().grant === true,
|
|
722
660
|
});
|
|
723
661
|
});
|
|
724
662
|
program
|
|
@@ -1372,25 +1310,10 @@ Examples:
|
|
|
1372
1310
|
const offline = isOfflineMode();
|
|
1373
1311
|
const updateSuppressed = isUpdateCheckSuppressed();
|
|
1374
1312
|
const subscription = config.get('subscription') || { plan: null, status: null, expiresAt: null };
|
|
1375
|
-
const runtime = detectRuntimeEnvironment(process.cwd());
|
|
1376
|
-
const warnings = [];
|
|
1377
|
-
if (runtime.normalizedPlatform === 'unknown') {
|
|
1378
|
-
warnings.push('Unknown OS platform detected. Run `vigthoria doctor --check-api` before agent tasks.');
|
|
1379
|
-
}
|
|
1380
|
-
if (runtime.isMobileLikeRuntime) {
|
|
1381
|
-
warnings.push('Mobile-like runtime detected (Termux/iOS-style path). Vigthoria CLI agent tooling is optimized for desktop/server shells.');
|
|
1382
|
-
}
|
|
1383
|
-
if (runtime.isWSL) {
|
|
1384
|
-
warnings.push('WSL detected. Prefer Linux-style paths and keep projects inside the WSL filesystem for stable tool execution.');
|
|
1385
|
-
}
|
|
1386
|
-
if (/127\.0\.0\.1:1/.test(modelsApiUrl)) {
|
|
1387
|
-
warnings.push('modelsApiUrl is set to 127.0.0.1:1 (unreachable). Set modelsApiUrl to https://api.vigthoria.io or your local model router.');
|
|
1388
|
-
}
|
|
1389
1313
|
const report = {
|
|
1390
1314
|
cliVersion: VERSION,
|
|
1391
1315
|
nodeVersion: process.version,
|
|
1392
1316
|
platform: `${process.platform} ${process.arch}`,
|
|
1393
|
-
runtimeEnvironment: runtime,
|
|
1394
1317
|
cwd: process.cwd(),
|
|
1395
1318
|
homeDir: os.homedir(),
|
|
1396
1319
|
configPath: config.getConfigPath(),
|
|
@@ -1402,7 +1325,6 @@ Examples:
|
|
|
1402
1325
|
subscriptionStatus: subscription.status || null,
|
|
1403
1326
|
offlineMode: offline,
|
|
1404
1327
|
updateCheckSuppressed: updateSuppressed,
|
|
1405
|
-
warnings,
|
|
1406
1328
|
envOverrides: {
|
|
1407
1329
|
VIGTHORIA_API_URL: process.env.VIGTHORIA_API_URL || null,
|
|
1408
1330
|
VIGTHORIA_V3_AGENT_URL: process.env.VIGTHORIA_V3_AGENT_URL || null,
|
|
@@ -1447,47 +1369,6 @@ Examples:
|
|
|
1447
1369
|
if (!options.checkApi) {
|
|
1448
1370
|
console.log(chalk.gray('\nTip: pass --check-api to verify API reachability.'));
|
|
1449
1371
|
}
|
|
1450
|
-
if (warnings.length > 0) {
|
|
1451
|
-
console.log(chalk.yellow('\nEnvironment warnings:'));
|
|
1452
|
-
for (const warning of warnings) {
|
|
1453
|
-
console.log(chalk.yellow(`- ${warning}`));
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
process.exitCode = 0;
|
|
1458
|
-
});
|
|
1459
|
-
// Start command - beginner quick guide
|
|
1460
|
-
program
|
|
1461
|
-
.command('start')
|
|
1462
|
-
.alias('guide')
|
|
1463
|
-
.description('Show beginner quick-start steps and recommended first commands')
|
|
1464
|
-
.option('--json', 'Emit machine-readable guide output', false)
|
|
1465
|
-
.action(async (options) => {
|
|
1466
|
-
const steps = [
|
|
1467
|
-
'1. Authenticate: vigthoria login',
|
|
1468
|
-
'2. Verify account: vigthoria status',
|
|
1469
|
-
'3. Initialize project: vigthoria init',
|
|
1470
|
-
'4. Start coding: vigthoria chat --agent',
|
|
1471
|
-
'5. Check for updates: vigthoria update --check',
|
|
1472
|
-
];
|
|
1473
|
-
if (options.json) {
|
|
1474
|
-
console.log(JSON.stringify({
|
|
1475
|
-
command: 'start',
|
|
1476
|
-
steps,
|
|
1477
|
-
tips: [
|
|
1478
|
-
'Use vigthoria init --non-interactive for CI/bootstrap scripts.',
|
|
1479
|
-
'Run vigthoria doctor when environment checks fail.',
|
|
1480
|
-
],
|
|
1481
|
-
}, null, 2));
|
|
1482
|
-
}
|
|
1483
|
-
else {
|
|
1484
|
-
console.log();
|
|
1485
|
-
console.log(chalk.bold('Vigthoria quick start'));
|
|
1486
|
-
for (const step of steps) {
|
|
1487
|
-
console.log(chalk.gray('- ' + step));
|
|
1488
|
-
}
|
|
1489
|
-
console.log();
|
|
1490
|
-
console.log(chalk.gray('Tip: use vigthoria init --profile safe --non-interactive for conservative defaults.'));
|
|
1491
1372
|
}
|
|
1492
1373
|
process.exitCode = 0;
|
|
1493
1374
|
});
|
|
@@ -1519,6 +1400,7 @@ Examples:
|
|
|
1519
1400
|
const manifestUrl = typeof options.manifest === 'string' ? options.manifest.trim() : VIGTHORIA_DEFAULT_MANIFEST_URL.trim();
|
|
1520
1401
|
const channel = typeof options.channel === 'string' ? options.channel.trim() : 'stable';
|
|
1521
1402
|
const allowDowngrade = !!options.allowDowngrade;
|
|
1403
|
+
const gitPackageSpec = 'git+https://market.vigthoria.io/vigthoria/vigthoria-cli.git';
|
|
1522
1404
|
if (updateTarget) {
|
|
1523
1405
|
if (!isSafeNpmPackageSpec(updateTarget)) {
|
|
1524
1406
|
console.error(chalk.red('Refusing to run installer with unsafe package spec.'));
|
|
@@ -1527,21 +1409,6 @@ Examples:
|
|
|
1527
1409
|
return;
|
|
1528
1410
|
}
|
|
1529
1411
|
try {
|
|
1530
|
-
if (!allowInsecureCliVersionInstall()) {
|
|
1531
|
-
const detectedVersion = extractVersionFromUpdateTarget(updateTarget);
|
|
1532
|
-
if (!detectedVersion) {
|
|
1533
|
-
console.error(chalk.red('Refusing custom update source: unable to verify CLI version in update target.'));
|
|
1534
|
-
console.error(chalk.gray(`Allowed floor: ${VIGTHORIA_MIN_SECURE_CLI_VERSION}. Set VIGTHORIA_ALLOW_INSECURE_CLI_VERSION=1 only for trusted admin recovery.`));
|
|
1535
|
-
process.exitCode = 1;
|
|
1536
|
-
return;
|
|
1537
|
-
}
|
|
1538
|
-
if (isBelowSecureCliBaseline(detectedVersion)) {
|
|
1539
|
-
console.error(chalk.red(`Refusing insecure CLI version ${detectedVersion}.`));
|
|
1540
|
-
console.error(chalk.gray(`Minimum secure CLI version is ${VIGTHORIA_MIN_SECURE_CLI_VERSION}.`));
|
|
1541
|
-
process.exitCode = 1;
|
|
1542
|
-
return;
|
|
1543
|
-
}
|
|
1544
|
-
}
|
|
1545
1412
|
if (options.check) {
|
|
1546
1413
|
console.log(chalk.cyan(`Update source configured: ${updateTarget}`));
|
|
1547
1414
|
console.log(chalk.gray('Run `vigthoria update --from <target>` to install from this source'));
|
|
@@ -1579,12 +1446,6 @@ Examples:
|
|
|
1579
1446
|
process.exitCode = 1;
|
|
1580
1447
|
return;
|
|
1581
1448
|
}
|
|
1582
|
-
if (!allowInsecureCliVersionInstall() && isBelowSecureCliBaseline(entry.version)) {
|
|
1583
|
-
console.error(chalk.red(`Refusing insecure manifest CLI version ${entry.version} for channel ${channel}.`));
|
|
1584
|
-
console.error(chalk.gray(`Minimum secure CLI version is ${VIGTHORIA_MIN_SECURE_CLI_VERSION}.`));
|
|
1585
|
-
process.exitCode = 1;
|
|
1586
|
-
return;
|
|
1587
|
-
}
|
|
1588
1449
|
const currentVersion = VERSION;
|
|
1589
1450
|
const comparison = compareVersions(entry.version, currentVersion);
|
|
1590
1451
|
if (!allowDowngrade && comparison <= 0) {
|
|
@@ -1637,7 +1498,7 @@ Examples:
|
|
|
1637
1498
|
}
|
|
1638
1499
|
catch (error) {
|
|
1639
1500
|
console.error(chalk.red('Failed to process manifest update:'), error.message);
|
|
1640
|
-
console.log(chalk.gray('Falling back to npm
|
|
1501
|
+
console.log(chalk.gray('Falling back to npm/git update channels...'));
|
|
1641
1502
|
}
|
|
1642
1503
|
}
|
|
1643
1504
|
if (isOfflineMode()) {
|
|
@@ -1653,12 +1514,6 @@ Examples:
|
|
|
1653
1514
|
windowsHide: true,
|
|
1654
1515
|
}).trim();
|
|
1655
1516
|
const currentVersion = VERSION;
|
|
1656
|
-
if (!allowInsecureCliVersionInstall() && isBelowSecureCliBaseline(latestVersion)) {
|
|
1657
|
-
console.error(chalk.red(`Refusing insecure npm latest CLI version ${latestVersion}.`));
|
|
1658
|
-
console.error(chalk.gray(`Minimum secure CLI version is ${VIGTHORIA_MIN_SECURE_CLI_VERSION}.`));
|
|
1659
|
-
process.exitCode = 1;
|
|
1660
|
-
return;
|
|
1661
|
-
}
|
|
1662
1517
|
// Use semantic version comparison (1.6.0 > 1.5.9)
|
|
1663
1518
|
const comparison = compareVersions(latestVersion, currentVersion);
|
|
1664
1519
|
if (comparison <= 0) {
|
|
@@ -1678,11 +1533,21 @@ Examples:
|
|
|
1678
1533
|
catch (error) {
|
|
1679
1534
|
console.error(chalk.red('Failed to check/install via npm registry:'), error.message);
|
|
1680
1535
|
if (options.check) {
|
|
1681
|
-
console.log(chalk.gray(
|
|
1536
|
+
console.log(chalk.gray(`npm registry check failed; fallback install target is ${gitPackageSpec}`));
|
|
1682
1537
|
return;
|
|
1683
1538
|
}
|
|
1684
|
-
|
|
1685
|
-
|
|
1539
|
+
try {
|
|
1540
|
+
console.log(chalk.cyan('Attempting git package fallback...'));
|
|
1541
|
+
await installGlobalPackageWithNpm(gitPackageSpec);
|
|
1542
|
+
console.log(chalk.green('Updated via git package fallback'));
|
|
1543
|
+
console.log(chalk.gray('Please restart the CLI to use the new version'));
|
|
1544
|
+
}
|
|
1545
|
+
catch (fallbackError) {
|
|
1546
|
+
console.error(chalk.red('Fallback update also failed:'), fallbackError.message);
|
|
1547
|
+
console.log(chalk.gray('Try manually: npm install -g vigthoria-cli@latest'));
|
|
1548
|
+
console.log(chalk.gray(`Or: npm install -g ${gitPackageSpec}`));
|
|
1549
|
+
process.exitCode = 1;
|
|
1550
|
+
}
|
|
1686
1551
|
}
|
|
1687
1552
|
});
|
|
1688
1553
|
// Hyper Loop command alias (maps to legion --status for checklist gate 6.9)
|
|
@@ -1719,15 +1584,9 @@ Examples:
|
|
|
1719
1584
|
program
|
|
1720
1585
|
.command('init')
|
|
1721
1586
|
.description('Initialize Vigthoria in current project')
|
|
1722
|
-
.
|
|
1723
|
-
.option('--ignore-patterns <patterns>', 'Comma-separated ignore patterns for this project')
|
|
1724
|
-
.option('--auto-apply-fixes', 'Enable auto-apply fixes for this project profile')
|
|
1725
|
-
.option('--profile <preset>', 'Quick preset: safe, balanced, fast')
|
|
1726
|
-
.option('-y, --yes', 'Overwrite existing .vigthoria.json without prompting')
|
|
1727
|
-
.option('--non-interactive', 'Do not prompt; use provided flags/defaults')
|
|
1728
|
-
.action(async (options) => {
|
|
1587
|
+
.action(async () => {
|
|
1729
1588
|
const configCmd = new ConfigCommand(config, logger);
|
|
1730
|
-
await configCmd.init(
|
|
1589
|
+
await configCmd.init();
|
|
1731
1590
|
});
|
|
1732
1591
|
const codingCommandDefinitions = [
|
|
1733
1592
|
{ name: 'edit', description: 'Edit code by describing the desired change', instruction: 'Edit the project according to this request' },
|
|
@@ -1753,39 +1612,6 @@ Examples:
|
|
|
1753
1612
|
});
|
|
1754
1613
|
});
|
|
1755
1614
|
}
|
|
1756
|
-
// Wallet command — balance, transaction history, cloud access status
|
|
1757
|
-
const walletCommand = program
|
|
1758
|
-
.command('wallet')
|
|
1759
|
-
.alias('w')
|
|
1760
|
-
.description('Manage your VigCoin wallet and cloud access');
|
|
1761
|
-
walletCommand
|
|
1762
|
-
.command('balance')
|
|
1763
|
-
.alias('bal')
|
|
1764
|
-
.description('Show current VigCoin balance')
|
|
1765
|
-
.option('--json', 'Emit JSON output', false)
|
|
1766
|
-
.action(async (options) => {
|
|
1767
|
-
const wallet = new WalletCommand();
|
|
1768
|
-
await wallet.showBalance({ json: options.json });
|
|
1769
|
-
});
|
|
1770
|
-
walletCommand
|
|
1771
|
-
.command('history')
|
|
1772
|
-
.alias('hist')
|
|
1773
|
-
.description('Show recent VigCoin transactions')
|
|
1774
|
-
.option('-n, --n <number>', 'Number of transactions to show (default: 20)', parseInt)
|
|
1775
|
-
.option('--json', 'Emit JSON output', false)
|
|
1776
|
-
.action(async (options) => {
|
|
1777
|
-
const wallet = new WalletCommand();
|
|
1778
|
-
await wallet.showHistory({ n: options.n, json: options.json });
|
|
1779
|
-
});
|
|
1780
|
-
walletCommand
|
|
1781
|
-
.command('cloud-status')
|
|
1782
|
-
.alias('cs')
|
|
1783
|
-
.description('Show cloud model access status and pricing')
|
|
1784
|
-
.option('--json', 'Emit JSON output', false)
|
|
1785
|
-
.action(async (options) => {
|
|
1786
|
-
const wallet = new WalletCommand();
|
|
1787
|
-
await wallet.showCloudStatus({ json: options.json });
|
|
1788
|
-
});
|
|
1789
1615
|
try {
|
|
1790
1616
|
// Default to chat if no command
|
|
1791
1617
|
if (args.length === 2) {
|
package/dist/utils/api.d.ts
CHANGED
|
@@ -283,33 +283,11 @@ export declare class APIClient {
|
|
|
283
283
|
* using the current user's auth token and caches it for this session and beyond.
|
|
284
284
|
*/
|
|
285
285
|
ensureV3ServiceKey(): Promise<void>;
|
|
286
|
-
|
|
287
|
-
* Fast preflight for local agent loop — probes model backends in parallel
|
|
288
|
-
* so users see a clear pass/fail before "Planning..." hangs on slow routes.
|
|
289
|
-
*/
|
|
290
|
-
runChatModelPreflight(requestedModel?: string): Promise<{
|
|
291
|
-
healthy: boolean;
|
|
292
|
-
endpoint: string;
|
|
293
|
-
error?: string;
|
|
294
|
-
routes: Array<{
|
|
295
|
-
name: string;
|
|
296
|
-
ok: boolean;
|
|
297
|
-
error?: string;
|
|
298
|
-
}>;
|
|
299
|
-
}>;
|
|
300
|
-
runV3HealthCheck(options?: {
|
|
301
|
-
soft?: boolean;
|
|
302
|
-
}): Promise<{
|
|
286
|
+
runV3HealthCheck(): Promise<{
|
|
303
287
|
healthy: boolean;
|
|
304
288
|
endpoint: string;
|
|
305
289
|
error?: string;
|
|
306
290
|
}>;
|
|
307
|
-
private resolveChatConnectTimeoutMs;
|
|
308
|
-
private resolveChatIdleTimeoutMs;
|
|
309
|
-
mapPreflightEndpointToRoute(endpoint: string): ChatRoutePreference | null;
|
|
310
|
-
private isCanonicalCoderDuplicate;
|
|
311
|
-
private consumeOpenAIStreamResponse;
|
|
312
|
-
private tryStreamingModelRouterChat;
|
|
313
291
|
private runV3AgentAuthPreflight;
|
|
314
292
|
private executeV3AgentRunRequest;
|
|
315
293
|
private getVigFlowAccessToken;
|
|
@@ -358,21 +336,10 @@ export declare class APIClient {
|
|
|
358
336
|
private resolveAgentTargetPath;
|
|
359
337
|
private isLikelyWindowsPath;
|
|
360
338
|
private resolveServerBindableWorkspacePath;
|
|
339
|
+
private getDisplayWorkspaceName;
|
|
361
340
|
private buildPublicWorkspaceDescriptor;
|
|
362
341
|
private buildPublicRuntimeEnvironment;
|
|
363
|
-
private extractPromptFocusTerms;
|
|
364
|
-
private buildTopLevelWorkspaceLayout;
|
|
365
|
-
private normalizeFocusPathKey;
|
|
366
|
-
private resolvePromptFocusDirectories;
|
|
367
|
-
private buildMandatoryFocusReadPaths;
|
|
368
|
-
private buildAnalysisGuidance;
|
|
369
|
-
private collectFocusDirectoryFilePaths;
|
|
370
|
-
private mergeWorkspacePathCandidates;
|
|
371
|
-
private scoreWorkspacePathForHydration;
|
|
372
|
-
private sortWorkspacePathsForHydration;
|
|
373
|
-
private trimVigthoriaBrainForTransport;
|
|
374
342
|
private buildLocalWorkspaceSummary;
|
|
375
|
-
private buildWorkspaceIndexFile;
|
|
376
343
|
/**
|
|
377
344
|
* Collect text file contents from the workspace for V3 agent hydration.
|
|
378
345
|
* Budget: up to ~2 MB total, per-file cap 200 KB, skip binary extensions.
|
|
@@ -400,16 +367,7 @@ export declare class APIClient {
|
|
|
400
367
|
private buildFallbackFrontendJs;
|
|
401
368
|
private replaceMissingLocalAssetReferences;
|
|
402
369
|
formatV3AgentResponse(data: any): string;
|
|
403
|
-
private
|
|
404
|
-
private isV3StreamStatusMessage;
|
|
405
|
-
private scoreEvidenceFilePath;
|
|
406
|
-
private isLowTrustDocPath;
|
|
407
|
-
private extractCodeSignalsFromEvidence;
|
|
408
|
-
private classifyGameGenreFromText;
|
|
409
|
-
private extractReadmeGenreClaims;
|
|
410
|
-
private extractCodeGenreClaims;
|
|
411
|
-
private buildReadmeCodeConsistencySection;
|
|
412
|
-
private detectDocReliabilityWarnings;
|
|
370
|
+
private sanitizeV3AgentResponseText;
|
|
413
371
|
/**
|
|
414
372
|
* Build a human-readable answer from the tool results in a V3 event
|
|
415
373
|
* stream when the server didn't emit a proper complete/message event.
|
|
@@ -417,11 +375,6 @@ export declare class APIClient {
|
|
|
417
375
|
private synthesizeAnswerFromV3Events;
|
|
418
376
|
private sanitizeV3AgentEventForUser;
|
|
419
377
|
collectV3AgentStream(response: Response, context?: Record<string, any>): Promise<any>;
|
|
420
|
-
submitClientToolResult(contextId: string, callId: string, result: {
|
|
421
|
-
success: boolean;
|
|
422
|
-
output: string;
|
|
423
|
-
error?: string;
|
|
424
|
-
}, backendUrl?: string | null): Promise<void>;
|
|
425
378
|
runV3AgentWorkflow(message: string, context?: Record<string, any>): Promise<V3AgentWorkflowResponse>;
|
|
426
379
|
private formatOperatorResponse;
|
|
427
380
|
runOperatorWorkflow(message: string, context?: Record<string, any>): Promise<OperatorWorkflowResponse>;
|
|
@@ -436,14 +389,12 @@ export declare class APIClient {
|
|
|
436
389
|
*
|
|
437
390
|
* NO localhost fallbacks - CLI is for external users, not server-side!
|
|
438
391
|
*/
|
|
439
|
-
chat(messages: ChatMessage[], model: string, useLocal?: boolean
|
|
440
|
-
getLastChatTransportErrors(): string[];
|
|
392
|
+
chat(messages: ChatMessage[], model: string, useLocal?: boolean): Promise<ChatResponse>;
|
|
441
393
|
private shouldSkipCloudRoutes;
|
|
442
394
|
private tryChatWithModel;
|
|
443
395
|
private trySelfHostedChatWithModel;
|
|
444
396
|
private getFallbackModelId;
|
|
445
397
|
private isCloudModelId;
|
|
446
|
-
private buildDirectChatHeaders;
|
|
447
398
|
private canUseCloudModel;
|
|
448
399
|
private resolvePermittedModelId;
|
|
449
400
|
private shouldSimulateCloudFailure;
|
|
@@ -548,6 +499,27 @@ export declare class APIClient {
|
|
|
548
499
|
private repairBracketBalance;
|
|
549
500
|
private resolveModelId;
|
|
550
501
|
private getCoderHealth;
|
|
502
|
+
/**
|
|
503
|
+
* Fast preflight for local agent loop — probes model backends in parallel
|
|
504
|
+
* so users see a clear pass/fail before "Planning..." hangs on slow routes.
|
|
505
|
+
*/
|
|
506
|
+
runChatModelPreflight(requestedModel?: string): Promise<{
|
|
507
|
+
healthy: boolean;
|
|
508
|
+
endpoint: string;
|
|
509
|
+
error?: string;
|
|
510
|
+
routes: Array<{
|
|
511
|
+
name: string;
|
|
512
|
+
ok: boolean;
|
|
513
|
+
error?: string;
|
|
514
|
+
}>;
|
|
515
|
+
}>;
|
|
516
|
+
mapPreflightEndpointToRoute(endpoint: string): ChatRoutePreference | null;
|
|
517
|
+
getLastChatTransportErrors(): string[];
|
|
518
|
+
submitClientToolResult(contextId: string, callId: string, result: {
|
|
519
|
+
success: boolean;
|
|
520
|
+
output: string;
|
|
521
|
+
error?: string;
|
|
522
|
+
}, backendUrl?: string | null): Promise<void>;
|
|
551
523
|
private isHealthyServicePayload;
|
|
552
524
|
private extractModelCount;
|
|
553
525
|
private probeModelList;
|