vigthoria-cli 1.10.37 → 1.10.47

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.
Files changed (58) hide show
  1. package/dist/commands/agent-session-menu.d.ts +19 -0
  2. package/dist/commands/agent-session-menu.js +155 -0
  3. package/dist/commands/auth.js +68 -51
  4. package/dist/commands/bridge.js +19 -12
  5. package/dist/commands/cancel.js +22 -15
  6. package/dist/commands/chat.d.ts +0 -28
  7. package/dist/commands/chat.js +407 -1254
  8. package/dist/commands/config.js +73 -33
  9. package/dist/commands/deploy.js +123 -83
  10. package/dist/commands/device.js +61 -21
  11. package/dist/commands/edit.js +39 -32
  12. package/dist/commands/explain.js +25 -18
  13. package/dist/commands/generate.js +44 -37
  14. package/dist/commands/hub.js +102 -95
  15. package/dist/commands/index.js +46 -41
  16. package/dist/commands/legion.js +186 -146
  17. package/dist/commands/review.js +36 -29
  18. package/dist/commands/security.js +12 -5
  19. package/dist/commands/wallet.js +35 -28
  20. package/dist/commands/workflow.js +20 -13
  21. package/dist/utils/brain-hub-client.js +5 -1
  22. package/dist/utils/bridge-client.js +52 -11
  23. package/dist/utils/codebase-indexer.js +41 -4
  24. package/dist/utils/context-ranker.js +21 -15
  25. package/dist/utils/files.js +42 -5
  26. package/dist/utils/logger.js +50 -42
  27. package/dist/utils/persona.js +8 -3
  28. package/dist/utils/post-write-validator.js +29 -22
  29. package/dist/utils/project-memory.js +23 -16
  30. package/dist/utils/task-display.js +20 -13
  31. package/dist/utils/workspace-brain-service.js +45 -8
  32. package/dist/utils/workspace-cache.js +26 -18
  33. package/dist/utils/workspace-stream.js +63 -21
  34. package/package.json +3 -6
  35. package/dist/commands/fork.d.ts +0 -17
  36. package/dist/commands/fork.js +0 -164
  37. package/dist/commands/history.d.ts +0 -17
  38. package/dist/commands/history.js +0 -113
  39. package/dist/commands/preview.d.ts +0 -55
  40. package/dist/commands/preview.js +0 -467
  41. package/dist/commands/replay.d.ts +0 -18
  42. package/dist/commands/replay.js +0 -156
  43. package/dist/commands/repo.d.ts +0 -97
  44. package/dist/commands/repo.js +0 -773
  45. package/dist/commands/update.d.ts +0 -9
  46. package/dist/commands/update.js +0 -201
  47. package/dist/index.d.ts +0 -21
  48. package/dist/index.js +0 -1823
  49. package/dist/utils/api.d.ts +0 -572
  50. package/dist/utils/api.js +0 -6548
  51. package/dist/utils/cli-state.d.ts +0 -54
  52. package/dist/utils/cli-state.js +0 -185
  53. package/dist/utils/config.d.ts +0 -85
  54. package/dist/utils/config.js +0 -267
  55. package/dist/utils/session.d.ts +0 -118
  56. package/dist/utils/session.js +0 -423
  57. package/dist/utils/tools.d.ts +0 -276
  58. package/dist/utils/tools.js +0 -3516
@@ -1,9 +0,0 @@
1
- type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
2
- interface UpdateOptions {
3
- check?: boolean;
4
- packageManager?: PackageManager;
5
- global?: boolean;
6
- }
7
- export declare function updateCommand(options?: UpdateOptions): Promise<void>;
8
- export declare function update(): Promise<void>;
9
- export default updateCommand;
@@ -1,201 +0,0 @@
1
- import { execFile } from 'node:child_process';
2
- import { existsSync, readFileSync } from 'node:fs';
3
- import * as path from 'node:path';
4
- import { fileURLToPath } from 'node:url';
5
- import { promisify } from 'node:util';
6
- import { installUpdateWindows } from '../utils/tools.js';
7
- // ESM shim — __filename is unavailable under "type": "module".
8
- const __filename = fileURLToPath(import.meta.url);
9
- const execFileAsync = promisify(execFile);
10
- function markSuccessExit() {
11
- process.exitCode = 0;
12
- }
13
- function markErrorExit() {
14
- process.exitCode = 1;
15
- }
16
- function findPackageJson(startDir) {
17
- let currentDir = startDir;
18
- for (let depth = 0; depth < 8; depth += 1) {
19
- const candidate = path.join(currentDir, 'package.json');
20
- if (existsSync(candidate)) {
21
- return candidate;
22
- }
23
- const parentDir = path.join(currentDir, '..');
24
- if (parentDir === currentDir) {
25
- break;
26
- }
27
- currentDir = parentDir;
28
- }
29
- return null;
30
- }
31
- function readOwnPackageJson() {
32
- const currentFile = __filename;
33
- const packagePath = findPackageJson(path.join(currentFile, '..'));
34
- if (!packagePath) {
35
- throw new Error('Unable to locate package.json for the Vigthoria CLI.');
36
- }
37
- try {
38
- return JSON.parse(readFileSync(packagePath, 'utf8'));
39
- }
40
- catch (error) {
41
- const message = error instanceof Error ? error.message : String(error);
42
- throw new Error(`Unable to read package metadata: ${message}`);
43
- }
44
- }
45
- function compareVersions(a, b) {
46
- const parse = (version) => version.replace(/^v/, '').split(/[.-]/).map((part) => {
47
- const value = Number.parseInt(part, 10);
48
- return Number.isNaN(value) ? 0 : value;
49
- });
50
- const left = parse(a);
51
- const right = parse(b);
52
- const length = Math.max(left.length, right.length);
53
- for (let index = 0; index < length; index += 1) {
54
- const leftValue = left[index] ?? 0;
55
- const rightValue = right[index] ?? 0;
56
- if (leftValue > rightValue)
57
- return 1;
58
- if (leftValue < rightValue)
59
- return -1;
60
- }
61
- return 0;
62
- }
63
- function quoteCmdArg(value) {
64
- if (!/[\s"&()<>^|]/.test(value)) {
65
- return value;
66
- }
67
- return `"${value.replace(/(\\*)"/g, '$1$1\\"')}"`;
68
- }
69
- function toPlatformCommand(command, args) {
70
- if (process.platform !== 'win32') {
71
- return { command, args };
72
- }
73
- const cmdPath = process.env.ComSpec || path.join(process.env.SystemRoot || 'C:\\Windows', 'System32', 'cmd.exe');
74
- return {
75
- command: cmdPath,
76
- args: ['/d', '/s', '/c', [command, ...args].map(quoteCmdArg).join(' ')],
77
- };
78
- }
79
- async function execPackageManager(command, args, timeout) {
80
- const platformCommand = toPlatformCommand(command, args);
81
- const { stdout } = await execFileAsync(platformCommand.command, platformCommand.args, {
82
- timeout,
83
- maxBuffer: 1024 * 1024,
84
- windowsHide: true,
85
- });
86
- return stdout;
87
- }
88
- async function getLatestVersion(packageName) {
89
- try {
90
- const stdout = await execPackageManager('npm', ['view', packageName, 'version'], 30_000);
91
- const latest = stdout.trim();
92
- if (!latest) {
93
- throw new Error('npm returned an empty version response');
94
- }
95
- return latest;
96
- }
97
- catch (error) {
98
- const message = error instanceof Error ? error.message : String(error);
99
- throw new Error(`Unable to check the latest published version: ${message}`);
100
- }
101
- }
102
- async function getVersionInfo() {
103
- const packageJson = readOwnPackageJson();
104
- const packageName = packageJson.name;
105
- const current = packageJson.version;
106
- if (!packageName || !current) {
107
- throw new Error('The CLI package metadata must include both name and version.');
108
- }
109
- const latest = await getLatestVersion(packageName);
110
- return {
111
- current,
112
- latest,
113
- packageName,
114
- updateAvailable: compareVersions(current, latest) < 0,
115
- };
116
- }
117
- function resolveInstallCommand(packageManager, packageName, installGlobal) {
118
- const target = `${packageName}@latest`;
119
- switch (packageManager) {
120
- case 'pnpm':
121
- return { command: 'pnpm', args: installGlobal ? ['add', '--global', target] : ['add', '-D', target] };
122
- case 'yarn':
123
- return { command: 'yarn', args: installGlobal ? ['global', 'add', target] : ['add', '--dev', target] };
124
- case 'bun':
125
- return { command: 'bun', args: installGlobal ? ['add', '--global', target] : ['add', '--dev', target] };
126
- case 'npm':
127
- default:
128
- return { command: 'npm', args: installGlobal ? ['install', '--global', target] : ['install', '--save-dev', target] };
129
- }
130
- }
131
- function formatCommand(command) {
132
- return [command.command, ...command.args].map(quoteCmdArg).join(' ');
133
- }
134
- async function runInstall(packageManager, packageName, installGlobal) {
135
- const installCommand = resolveInstallCommand(packageManager, packageName, installGlobal);
136
- await execPackageManager(installCommand.command, installCommand.args, 120_000);
137
- }
138
- export async function updateCommand(options = {}) {
139
- try {
140
- const info = await getVersionInfo();
141
- console.log(`Vigthoria CLI current version: ${info.current}`);
142
- console.log(`Vigthoria CLI latest version: ${info.latest}`);
143
- if (!info.updateAvailable) {
144
- console.log('You are already running the latest Vigthoria CLI.');
145
- markSuccessExit();
146
- return;
147
- }
148
- console.log(`Update available for ${info.packageName}: ${info.current} → ${info.latest}`);
149
- if (options.check) {
150
- markSuccessExit();
151
- return;
152
- }
153
- const packageManager = options.packageManager ?? 'npm';
154
- const installGlobal = options.global ?? true;
155
- console.log(`Installing ${info.packageName}@latest with ${packageManager}...`);
156
- if (process.platform === 'win32') {
157
- const installerResult = await installUpdateWindows();
158
- if (!installerResult.success && installerResult.error === 'ENOENT') {
159
- const fallbackCommand = resolveInstallCommand(packageManager, info.packageName, installGlobal);
160
- console.warn('Windows update installer was not found (ENOENT).');
161
- console.warn('The bundled Windows installer may be missing from this installation.');
162
- console.warn(`Manual installation command: ${formatCommand(fallbackCommand)}`);
163
- console.warn('If automatic fallback fails, run the command above manually or download the latest Windows installer from the Vigthoria release page.');
164
- await execPackageManager(fallbackCommand.command, fallbackCommand.args, 120_000);
165
- console.log('Package manager installation finished successfully.');
166
- }
167
- else if (!installerResult.success) {
168
- throw new Error(installerResult.error || 'Windows installer failed to start.');
169
- }
170
- else {
171
- console.log('Windows installer started successfully. Complete the installer prompts to finish updating.');
172
- }
173
- }
174
- else {
175
- await runInstall(packageManager, info.packageName, installGlobal);
176
- console.log('Package manager installation finished successfully.');
177
- }
178
- console.log('Vigthoria CLI update complete.');
179
- markSuccessExit();
180
- }
181
- catch (error) {
182
- const message = error instanceof Error ? error.message : String(error);
183
- console.error(`Update failed: ${message}`);
184
- markErrorExit();
185
- }
186
- }
187
- export async function update() {
188
- try {
189
- await updateCommand();
190
- if (process.exitCode === 1) {
191
- return;
192
- }
193
- markSuccessExit();
194
- }
195
- catch (error) {
196
- const message = error instanceof Error ? error.message : String(error);
197
- console.error(`Update failed: ${message}`);
198
- markErrorExit();
199
- }
200
- }
201
- export default updateCommand;
package/dist/index.d.ts DELETED
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Vigthoria CLI - AI-Powered Terminal Coding Assistant
4
- *
5
- * Usage:
6
- * vigthoria chat - Start interactive chat
7
- * vigthoria edit <file> - Edit a file with AI assistance
8
- * vigthoria generate <desc> - Generate code from description
9
- * vigthoria explain <file> - Explain code in a file
10
- * vigthoria fix <file> - Fix issues in a file
11
- * vigthoria review <file> - Review code quality
12
- * vigthoria login - Authenticate with Vigthoria
13
- * vigthoria config - Configure settings
14
- * vigthoria hub - Discover & activate API modules
15
- * vigthoria workflow - Manage repeatable VigFlow workflows
16
- * vigthoria operator - Start BMAD operator mode
17
- */
18
- export declare function validateReleaseMetadata(): boolean;
19
- export declare function setupErrorHandlers(): void;
20
- export declare function main(args: string[]): Promise<void>;
21
- export declare const __cliErrorHandlingReady = true;