vigthoria-cli 1.6.1 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -1
- package/dist/commands/chat.d.ts +31 -45
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +374 -855
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/repo.d.ts +10 -0
- package/dist/commands/repo.d.ts.map +1 -1
- package/dist/commands/repo.js +215 -97
- package/dist/commands/repo.js.map +1 -1
- package/dist/index.js +32 -4
- package/dist/index.js.map +1 -1
- package/dist/utils/api.d.ts +8 -0
- package/dist/utils/api.d.ts.map +1 -1
- package/dist/utils/api.js +183 -42
- package/dist/utils/api.js.map +1 -1
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +2 -1
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/tools.d.ts +3 -0
- package/dist/utils/tools.d.ts.map +1 -1
- package/dist/utils/tools.js +252 -14
- package/dist/utils/tools.js.map +1 -1
- package/package.json +13 -2
- package/install.ps1 +0 -290
- package/install.sh +0 -307
- package/src/commands/auth.ts +0 -226
- package/src/commands/chat.ts +0 -1101
- package/src/commands/config.ts +0 -306
- package/src/commands/deploy.ts +0 -609
- package/src/commands/edit.ts +0 -310
- package/src/commands/explain.ts +0 -115
- package/src/commands/generate.ts +0 -222
- package/src/commands/hub.ts +0 -382
- package/src/commands/repo.ts +0 -742
- package/src/commands/review.ts +0 -186
- package/src/index.ts +0 -601
- package/src/types/marked-terminal.d.ts +0 -31
- package/src/utils/api.ts +0 -526
- package/src/utils/config.ts +0 -241
- package/src/utils/files.ts +0 -273
- package/src/utils/logger.ts +0 -130
- package/src/utils/session.ts +0 -179
- package/src/utils/tools.ts +0 -1964
- package/test-parse.js +0 -105
- package/test-parse2.js +0 -35
- package/tsconfig.json +0 -20
package/src/index.ts
DELETED
|
@@ -1,601 +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
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { Command } from 'commander';
|
|
18
|
-
import { ChatCommand } from './commands/chat.js';
|
|
19
|
-
import { EditCommand } from './commands/edit.js';
|
|
20
|
-
import { GenerateCommand } from './commands/generate.js';
|
|
21
|
-
import { ExplainCommand } from './commands/explain.js';
|
|
22
|
-
import { AuthCommand } from './commands/auth.js';
|
|
23
|
-
import { ConfigCommand } from './commands/config.js';
|
|
24
|
-
import { ReviewCommand } from './commands/review.js';
|
|
25
|
-
import { HubCommand } from './commands/hub.js';
|
|
26
|
-
import { RepoCommand } from './commands/repo.js';
|
|
27
|
-
import { DeployCommand } from './commands/deploy.js';
|
|
28
|
-
import { Config } from './utils/config.js';
|
|
29
|
-
import { Logger } from './utils/logger.js';
|
|
30
|
-
import chalk from 'chalk';
|
|
31
|
-
import * as fs from 'fs';
|
|
32
|
-
import * as path from 'path';
|
|
33
|
-
|
|
34
|
-
// Get version from package.json dynamically
|
|
35
|
-
function getVersion(): string {
|
|
36
|
-
try {
|
|
37
|
-
// Try multiple paths to find package.json
|
|
38
|
-
const possiblePaths = [
|
|
39
|
-
path.join(__dirname, '..', 'package.json'),
|
|
40
|
-
path.join(__dirname, '..', '..', 'package.json'),
|
|
41
|
-
path.join(process.cwd(), 'node_modules', 'vigthoria-cli', 'package.json'),
|
|
42
|
-
// Also check global npm paths on Windows
|
|
43
|
-
path.join(process.env.APPDATA || '', 'npm', 'node_modules', 'vigthoria-cli', 'package.json'),
|
|
44
|
-
];
|
|
45
|
-
for (const p of possiblePaths) {
|
|
46
|
-
if (fs.existsSync(p)) {
|
|
47
|
-
const pkg = JSON.parse(fs.readFileSync(p, 'utf8'));
|
|
48
|
-
if (pkg.name === 'vigthoria-cli') {
|
|
49
|
-
return pkg.version;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
} catch (e) {
|
|
54
|
-
// Fallback to hardcoded version
|
|
55
|
-
}
|
|
56
|
-
return '1.5.0';
|
|
57
|
-
}
|
|
58
|
-
const VERSION = getVersion();
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Compare semantic versions properly
|
|
62
|
-
* Returns: -1 if v1 < v2, 0 if equal, 1 if v1 > v2
|
|
63
|
-
*/
|
|
64
|
-
function compareVersions(v1: string, v2: string): number {
|
|
65
|
-
const parts1 = v1.split('.').map(Number);
|
|
66
|
-
const parts2 = v2.split('.').map(Number);
|
|
67
|
-
|
|
68
|
-
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
|
69
|
-
const p1 = parts1[i] || 0;
|
|
70
|
-
const p2 = parts2[i] || 0;
|
|
71
|
-
if (p1 < p2) return -1;
|
|
72
|
-
if (p1 > p2) return 1;
|
|
73
|
-
}
|
|
74
|
-
return 0;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Check for updates silently on startup (non-blocking)
|
|
78
|
-
async function checkForUpdatesQuietly(): Promise<void> {
|
|
79
|
-
try {
|
|
80
|
-
const { execSync } = await import('child_process');
|
|
81
|
-
// Cross-platform: use stdio: 'pipe' to suppress output on Windows
|
|
82
|
-
const npmVersion = execSync('npm view vigthoria-cli version', {
|
|
83
|
-
encoding: 'utf8',
|
|
84
|
-
timeout: 5000,
|
|
85
|
-
stdio: ['pipe', 'pipe', 'pipe'], // Suppress stderr on all platforms
|
|
86
|
-
windowsHide: true,
|
|
87
|
-
}).trim();
|
|
88
|
-
|
|
89
|
-
// Only show update message if npm version is NEWER than current (not older)
|
|
90
|
-
if (npmVersion && compareVersions(npmVersion, VERSION) > 0) {
|
|
91
|
-
// Check if this is a security update (1.4.0+)
|
|
92
|
-
if (compareVersions(npmVersion, '1.4.0') >= 0 && compareVersions(VERSION, '1.4.0') < 0) {
|
|
93
|
-
console.log(chalk.red.bold('\n⚠️ SECURITY UPDATE AVAILABLE'));
|
|
94
|
-
console.log(chalk.red(` Version ${VERSION} has security vulnerabilities.`));
|
|
95
|
-
console.log(chalk.yellow(` Please update to ${npmVersion} immediately:`));
|
|
96
|
-
console.log(chalk.white.bold(' npm install -g vigthoria-cli@latest\n'));
|
|
97
|
-
} else {
|
|
98
|
-
console.log(chalk.yellow(`\n📦 Update available: ${VERSION} → ${npmVersion}`));
|
|
99
|
-
console.log(chalk.gray(' Run `vigthoria update` to install\n'));
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
} catch {
|
|
103
|
-
// Silently ignore - network issues shouldn't block CLI
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
async function main() {
|
|
108
|
-
const program = new Command();
|
|
109
|
-
const config = new Config();
|
|
110
|
-
const logger = new Logger();
|
|
111
|
-
|
|
112
|
-
// Banner - Fixed alignment with proper padding
|
|
113
|
-
const boxWidth = 61; // Inner content width
|
|
114
|
-
const titleText = 'VIGTHORIA CLI - AI-Powered Coding Assistant';
|
|
115
|
-
const versionText = `Version ${VERSION}`;
|
|
116
|
-
|
|
117
|
-
// Calculate padding for centering
|
|
118
|
-
const titlePad = Math.floor((boxWidth - 4 - titleText.length) / 2);
|
|
119
|
-
const versionPad = Math.floor((boxWidth - 4 - versionText.length) / 2);
|
|
120
|
-
|
|
121
|
-
console.log(chalk.cyan('╔' + '═'.repeat(boxWidth) + '╗'));
|
|
122
|
-
console.log(chalk.cyan('║' + ' '.repeat(boxWidth) + '║'));
|
|
123
|
-
console.log(chalk.cyan('║') + ' '.repeat(titlePad) + chalk.bold.white('VIGTHORIA CLI') + chalk.cyan(' - AI-Powered Coding Assistant') + ' '.repeat(boxWidth - titlePad - titleText.length) + chalk.cyan('║'));
|
|
124
|
-
console.log(chalk.cyan('║') + ' '.repeat(versionPad) + chalk.gray(versionText) + ' '.repeat(boxWidth - versionPad - versionText.length) + chalk.cyan('║'));
|
|
125
|
-
console.log(chalk.cyan('║' + ' '.repeat(boxWidth) + '║'));
|
|
126
|
-
console.log(chalk.cyan('╚' + '═'.repeat(boxWidth) + '╝'));
|
|
127
|
-
console.log();
|
|
128
|
-
|
|
129
|
-
// Check for updates in background (don't wait)
|
|
130
|
-
checkForUpdatesQuietly();
|
|
131
|
-
|
|
132
|
-
program
|
|
133
|
-
.name('vigthoria')
|
|
134
|
-
.description('AI-powered terminal coding assistant for Vigthoria Coder subscribers')
|
|
135
|
-
.version(VERSION);
|
|
136
|
-
|
|
137
|
-
// Chat command - Interactive mode (Agent mode is default for best results)
|
|
138
|
-
program
|
|
139
|
-
.command('chat')
|
|
140
|
-
.alias('c')
|
|
141
|
-
.description('Start interactive chat with Vigthoria AI')
|
|
142
|
-
.option('-m, --model <model>', 'Select AI model (fast, balanced, code, creative)', 'code')
|
|
143
|
-
.option('-p, --project <path>', 'Set project context path', process.cwd())
|
|
144
|
-
.option('-a, --agent', 'Enable agentic mode (default: true for best quality)', true)
|
|
145
|
-
.option('--no-agent', 'Disable agentic mode (simple chat only)')
|
|
146
|
-
.option('-r, --resume', 'Resume last session for this project', false)
|
|
147
|
-
.option('--auto-approve', 'Auto-approve agent actions (dangerous!)', false)
|
|
148
|
-
.action(async (options) => {
|
|
149
|
-
const chat = new ChatCommand(config, logger);
|
|
150
|
-
await chat.run({
|
|
151
|
-
model: options.model,
|
|
152
|
-
project: options.project,
|
|
153
|
-
agent: options.agent,
|
|
154
|
-
autoApprove: options.autoApprove,
|
|
155
|
-
resume: options.resume,
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
// Agent command - Agentic mode (Vigthoria Autonomous)
|
|
160
|
-
// Uses Vigthoria v3 Code 30B or Vigthoria Cloud for complex tasks
|
|
161
|
-
program
|
|
162
|
-
.command('agent')
|
|
163
|
-
.alias('a')
|
|
164
|
-
.description('Start agentic mode - AI can read/write files, run commands')
|
|
165
|
-
.option('-m, --model <model>', 'Select AI model (code, cloud, ultra)', 'code')
|
|
166
|
-
.option('-p, --project <path>', 'Set project context path', process.cwd())
|
|
167
|
-
.option('--auto-approve', 'Auto-approve all actions (dangerous!)', false)
|
|
168
|
-
.action(async (options) => {
|
|
169
|
-
const chat = new ChatCommand(config, logger);
|
|
170
|
-
await chat.run({
|
|
171
|
-
model: options.model,
|
|
172
|
-
project: options.project,
|
|
173
|
-
agent: true,
|
|
174
|
-
autoApprove: options.autoApprove,
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
// Edit command - Edit files with AI
|
|
179
|
-
program
|
|
180
|
-
.command('edit <file>')
|
|
181
|
-
.alias('e')
|
|
182
|
-
.description('Edit a file with AI assistance')
|
|
183
|
-
.option('-i, --instruction <text>', 'Editing instruction')
|
|
184
|
-
.option('-m, --model <model>', 'Select AI model', 'code')
|
|
185
|
-
.action(async (file, options) => {
|
|
186
|
-
const edit = new EditCommand(config, logger);
|
|
187
|
-
await edit.run(file, options);
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
// Generate command - Generate code
|
|
191
|
-
program
|
|
192
|
-
.command('generate <description>')
|
|
193
|
-
.alias('g')
|
|
194
|
-
.description('Generate code from description')
|
|
195
|
-
.option('-l, --language <lang>', 'Target language (html, typescript, python, etc.)', 'html')
|
|
196
|
-
.option('-o, --output <file>', 'Output file path')
|
|
197
|
-
.option('-m, --model <model>', 'Select AI model', 'code')
|
|
198
|
-
.option('-p, --pro', 'Senior Developer Mode: plan, generate, quality check (recommended)', false)
|
|
199
|
-
.action(async (description, options) => {
|
|
200
|
-
const generate = new GenerateCommand(config, logger);
|
|
201
|
-
await generate.run(description, options);
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
// Explain command - Explain code
|
|
205
|
-
program
|
|
206
|
-
.command('explain <file>')
|
|
207
|
-
.alias('x')
|
|
208
|
-
.description('Explain code in a file')
|
|
209
|
-
.option('-l, --lines <range>', 'Line range (e.g., 1-50)')
|
|
210
|
-
.option('-d, --detail <level>', 'Detail level (brief, normal, detailed)', 'normal')
|
|
211
|
-
.action(async (file, options) => {
|
|
212
|
-
const explain = new ExplainCommand(config, logger);
|
|
213
|
-
await explain.run(file, options);
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
// Fix command - Fix code issues
|
|
217
|
-
program
|
|
218
|
-
.command('fix <file>')
|
|
219
|
-
.alias('f')
|
|
220
|
-
.description('Fix issues in a file')
|
|
221
|
-
.option('-t, --type <type>', 'Fix type (bugs, style, security, performance)', 'bugs')
|
|
222
|
-
.option('--apply', 'Automatically apply fixes', false)
|
|
223
|
-
.action(async (file, options) => {
|
|
224
|
-
const edit = new EditCommand(config, logger);
|
|
225
|
-
await edit.fix(file, options);
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
// Review command - Code review
|
|
229
|
-
program
|
|
230
|
-
.command('review <file>')
|
|
231
|
-
.alias('r')
|
|
232
|
-
.description('Review code quality')
|
|
233
|
-
.option('-f, --format <format>', 'Output format (text, json, markdown)', 'text')
|
|
234
|
-
.action(async (file, options) => {
|
|
235
|
-
const review = new ReviewCommand(config, logger);
|
|
236
|
-
await review.run(file, options);
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
// ==================== HUB / MARKETPLACE COMMANDS ====================
|
|
240
|
-
|
|
241
|
-
// Hub command - Discover and activate API modules
|
|
242
|
-
const hubCommand = program
|
|
243
|
-
.command('hub')
|
|
244
|
-
.alias('marketplace')
|
|
245
|
-
.description('Discover, search, and activate Vigthoria API modules');
|
|
246
|
-
|
|
247
|
-
hubCommand
|
|
248
|
-
.command('discover')
|
|
249
|
-
.alias('d')
|
|
250
|
-
.description('Interactive module discovery - find the right APIs for your project')
|
|
251
|
-
.action(async () => {
|
|
252
|
-
const hub = new HubCommand(config, logger);
|
|
253
|
-
await hub.discover();
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
hubCommand
|
|
257
|
-
.command('list')
|
|
258
|
-
.alias('ls')
|
|
259
|
-
.description('List all available API modules')
|
|
260
|
-
.option('-c, --category <category>', 'Filter by category (payments, communication, ai, creative, media)')
|
|
261
|
-
.action(async (options) => {
|
|
262
|
-
const hub = new HubCommand(config, logger);
|
|
263
|
-
await hub.list(options);
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
hubCommand
|
|
267
|
-
.command('search <query>')
|
|
268
|
-
.alias('find')
|
|
269
|
-
.description('Semantic search for modules (e.g., "generate background music for my app")')
|
|
270
|
-
.action(async (query) => {
|
|
271
|
-
const hub = new HubCommand(config, logger);
|
|
272
|
-
await hub.search(query);
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
hubCommand
|
|
276
|
-
.command('activate <module>')
|
|
277
|
-
.alias('enable')
|
|
278
|
-
.description('Activate a module for your API key (enables pay-as-you-go)')
|
|
279
|
-
.action(async (module) => {
|
|
280
|
-
const hub = new HubCommand(config, logger);
|
|
281
|
-
await hub.activate(module);
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
hubCommand
|
|
285
|
-
.command('active')
|
|
286
|
-
.description('Show your currently active modules')
|
|
287
|
-
.action(async () => {
|
|
288
|
-
const hub = new HubCommand(config, logger);
|
|
289
|
-
await hub.active();
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
hubCommand
|
|
293
|
-
.command('info <module>')
|
|
294
|
-
.alias('details')
|
|
295
|
-
.description('Get detailed information about a module')
|
|
296
|
-
.action(async (module) => {
|
|
297
|
-
const hub = new HubCommand(config, logger);
|
|
298
|
-
await hub.info(module);
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
// Default hub action shows discover
|
|
302
|
-
hubCommand.action(async () => {
|
|
303
|
-
const hub = new HubCommand(config, logger);
|
|
304
|
-
await hub.discover();
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
// ==================== REPO COMMANDS ====================
|
|
308
|
-
|
|
309
|
-
// Repo command - Push/Pull projects to/from Vigthoria Repository
|
|
310
|
-
const repoCommand = program
|
|
311
|
-
.command('repo')
|
|
312
|
-
.alias('repository')
|
|
313
|
-
.description('Push and pull projects to/from your Vigthoria Repository');
|
|
314
|
-
|
|
315
|
-
repoCommand
|
|
316
|
-
.command('push [path]')
|
|
317
|
-
.alias('upload')
|
|
318
|
-
.description('Push current or specified project to Vigthoria Repo')
|
|
319
|
-
.option('-v, --visibility <type>', 'Set visibility (private, restricted, public)', 'private')
|
|
320
|
-
.option('-d, --description <text>', 'Project description')
|
|
321
|
-
.option('-f, --force', 'Overwrite existing project', false)
|
|
322
|
-
.action(async (pathArg, options) => {
|
|
323
|
-
const repo = new RepoCommand(config, logger);
|
|
324
|
-
await repo.push({
|
|
325
|
-
path: pathArg,
|
|
326
|
-
visibility: options.visibility,
|
|
327
|
-
description: options.description,
|
|
328
|
-
force: options.force
|
|
329
|
-
});
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
repoCommand
|
|
333
|
-
.command('pull <name>')
|
|
334
|
-
.alias('download')
|
|
335
|
-
.description('Pull a project from your Vigthoria Repo')
|
|
336
|
-
.option('-o, --output <path>', 'Output directory path')
|
|
337
|
-
.option('-f, --force', 'Overwrite existing directory', false)
|
|
338
|
-
.action(async (name, options) => {
|
|
339
|
-
const repo = new RepoCommand(config, logger);
|
|
340
|
-
await repo.pull(name, {
|
|
341
|
-
output: options.output,
|
|
342
|
-
force: options.force
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
repoCommand
|
|
347
|
-
.command('list')
|
|
348
|
-
.alias('ls')
|
|
349
|
-
.description('List all your projects in Vigthoria Repo')
|
|
350
|
-
.option('-v, --visibility <type>', 'Filter by visibility (private, restricted, public)')
|
|
351
|
-
.action(async (options) => {
|
|
352
|
-
const repo = new RepoCommand(config, logger);
|
|
353
|
-
await repo.list({ visibility: options.visibility });
|
|
354
|
-
});
|
|
355
|
-
|
|
356
|
-
repoCommand
|
|
357
|
-
.command('status')
|
|
358
|
-
.description('Show sync status of current project')
|
|
359
|
-
.action(async () => {
|
|
360
|
-
const repo = new RepoCommand(config, logger);
|
|
361
|
-
await repo.status();
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
repoCommand
|
|
365
|
-
.command('share <name>')
|
|
366
|
-
.description('Generate a shareable link for a project')
|
|
367
|
-
.option('-e, --expires <duration>', 'Link expiration (e.g., 7d, 24h, 30m)', '7d')
|
|
368
|
-
.action(async (name, options) => {
|
|
369
|
-
const repo = new RepoCommand(config, logger);
|
|
370
|
-
await repo.share(name, { expires: options.expires });
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
repoCommand
|
|
374
|
-
.command('delete <name>')
|
|
375
|
-
.alias('rm')
|
|
376
|
-
.description('Remove a project from your Vigthoria Repo')
|
|
377
|
-
.action(async (name) => {
|
|
378
|
-
const repo = new RepoCommand(config, logger);
|
|
379
|
-
await repo.delete(name);
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
repoCommand
|
|
383
|
-
.command('clone <url>')
|
|
384
|
-
.description('Clone a public project from Vigthoria Repo')
|
|
385
|
-
.option('-o, --output <path>', 'Output directory path')
|
|
386
|
-
.option('-f, --force', 'Overwrite existing directory', false)
|
|
387
|
-
.action(async (url, options) => {
|
|
388
|
-
const repo = new RepoCommand(config, logger);
|
|
389
|
-
await repo.clone(url, {
|
|
390
|
-
output: options.output,
|
|
391
|
-
force: options.force
|
|
392
|
-
});
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
// Default repo action shows list
|
|
396
|
-
repoCommand.action(async () => {
|
|
397
|
-
const repo = new RepoCommand(config, logger);
|
|
398
|
-
await repo.list({});
|
|
399
|
-
});
|
|
400
|
-
|
|
401
|
-
// ==================== DEPLOY COMMANDS ====================
|
|
402
|
-
|
|
403
|
-
// Deploy command - Host projects on Vigthoria
|
|
404
|
-
const deployCommand = program
|
|
405
|
-
.command('deploy')
|
|
406
|
-
.alias('host')
|
|
407
|
-
.description('Deploy and host your project on Vigthoria infrastructure');
|
|
408
|
-
|
|
409
|
-
deployCommand
|
|
410
|
-
.command('preview')
|
|
411
|
-
.description('Deploy to free preview URL')
|
|
412
|
-
.option('-p, --project <path>', 'Project directory path', process.cwd())
|
|
413
|
-
.action(async (options) => {
|
|
414
|
-
const deploy = new DeployCommand(config, logger);
|
|
415
|
-
await deploy.deployToPreview(options.project);
|
|
416
|
-
});
|
|
417
|
-
|
|
418
|
-
deployCommand
|
|
419
|
-
.command('subdomain <name>')
|
|
420
|
-
.description('Deploy to yourname.vigthoria.io')
|
|
421
|
-
.option('-p, --project <path>', 'Project directory path', process.cwd())
|
|
422
|
-
.action(async (name, options) => {
|
|
423
|
-
const deploy = new DeployCommand(config, logger);
|
|
424
|
-
await deploy.deployToSubdomain(name, options.project);
|
|
425
|
-
});
|
|
426
|
-
|
|
427
|
-
deployCommand
|
|
428
|
-
.command('custom <domain>')
|
|
429
|
-
.description('Deploy to your custom domain')
|
|
430
|
-
.option('-p, --project <path>', 'Project directory path', process.cwd())
|
|
431
|
-
.action(async (domain, options) => {
|
|
432
|
-
const deploy = new DeployCommand(config, logger);
|
|
433
|
-
await deploy.deployToCustomDomain(domain, options.project);
|
|
434
|
-
});
|
|
435
|
-
|
|
436
|
-
deployCommand
|
|
437
|
-
.command('list')
|
|
438
|
-
.alias('ls')
|
|
439
|
-
.description('List all your deployments')
|
|
440
|
-
.action(async () => {
|
|
441
|
-
const deploy = new DeployCommand(config, logger);
|
|
442
|
-
await deploy.list();
|
|
443
|
-
});
|
|
444
|
-
|
|
445
|
-
deployCommand
|
|
446
|
-
.command('plans')
|
|
447
|
-
.description('Show hosting plans and pricing')
|
|
448
|
-
.action(async () => {
|
|
449
|
-
const deploy = new DeployCommand(config, logger);
|
|
450
|
-
await deploy.showPlans();
|
|
451
|
-
});
|
|
452
|
-
|
|
453
|
-
deployCommand
|
|
454
|
-
.command('status [domain]')
|
|
455
|
-
.description('Check deployment status')
|
|
456
|
-
.action(async (domain) => {
|
|
457
|
-
const deploy = new DeployCommand(config, logger);
|
|
458
|
-
await deploy.status(domain);
|
|
459
|
-
});
|
|
460
|
-
|
|
461
|
-
deployCommand
|
|
462
|
-
.command('verify <domain>')
|
|
463
|
-
.description('Verify DNS configuration for custom domain')
|
|
464
|
-
.action(async (domain) => {
|
|
465
|
-
const deploy = new DeployCommand(config, logger);
|
|
466
|
-
await deploy.verify(domain);
|
|
467
|
-
});
|
|
468
|
-
|
|
469
|
-
deployCommand
|
|
470
|
-
.command('remove <domain>')
|
|
471
|
-
.alias('rm')
|
|
472
|
-
.description('Remove a deployment')
|
|
473
|
-
.action(async (domain) => {
|
|
474
|
-
const deploy = new DeployCommand(config, logger);
|
|
475
|
-
await deploy.remove(domain);
|
|
476
|
-
});
|
|
477
|
-
|
|
478
|
-
// Default deploy action shows interactive wizard
|
|
479
|
-
deployCommand
|
|
480
|
-
.option('-s, --subdomain <name>', 'Deploy to subdomain')
|
|
481
|
-
.option('-d, --domain <domain>', 'Deploy to custom domain')
|
|
482
|
-
.option('-p, --project <path>', 'Project directory path', process.cwd())
|
|
483
|
-
.action(async (options) => {
|
|
484
|
-
const deploy = new DeployCommand(config, logger);
|
|
485
|
-
await deploy.deploy({
|
|
486
|
-
subdomain: options.subdomain,
|
|
487
|
-
domain: options.domain,
|
|
488
|
-
project: options.project
|
|
489
|
-
});
|
|
490
|
-
});
|
|
491
|
-
|
|
492
|
-
// ==================== AUTH COMMANDS ====================
|
|
493
|
-
|
|
494
|
-
// Auth commands
|
|
495
|
-
program
|
|
496
|
-
.command('login')
|
|
497
|
-
.description('Login to Vigthoria Coder')
|
|
498
|
-
.option('-t, --token <token>', 'API token')
|
|
499
|
-
.action(async (options) => {
|
|
500
|
-
const auth = new AuthCommand(config, logger);
|
|
501
|
-
await auth.login(options);
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
program
|
|
505
|
-
.command('logout')
|
|
506
|
-
.description('Logout from Vigthoria Coder')
|
|
507
|
-
.action(async () => {
|
|
508
|
-
const auth = new AuthCommand(config, logger);
|
|
509
|
-
await auth.logout();
|
|
510
|
-
});
|
|
511
|
-
|
|
512
|
-
program
|
|
513
|
-
.command('status')
|
|
514
|
-
.description('Show authentication and subscription status')
|
|
515
|
-
.action(async () => {
|
|
516
|
-
const auth = new AuthCommand(config, logger);
|
|
517
|
-
await auth.status();
|
|
518
|
-
});
|
|
519
|
-
|
|
520
|
-
// Config command
|
|
521
|
-
program
|
|
522
|
-
.command('config')
|
|
523
|
-
.description('Configure Vigthoria CLI settings')
|
|
524
|
-
.option('-s, --set <key=value>', 'Set a configuration value')
|
|
525
|
-
.option('-g, --get <key>', 'Get a configuration value')
|
|
526
|
-
.option('-l, --list', 'List all settings')
|
|
527
|
-
.option('-r, --reset', 'Reset to defaults')
|
|
528
|
-
.action(async (options) => {
|
|
529
|
-
const configCmd = new ConfigCommand(config, logger);
|
|
530
|
-
await configCmd.run(options);
|
|
531
|
-
});
|
|
532
|
-
|
|
533
|
-
// Update command - Check for and install updates
|
|
534
|
-
program
|
|
535
|
-
.command('update')
|
|
536
|
-
.alias('upgrade')
|
|
537
|
-
.description('Check for updates and upgrade Vigthoria CLI')
|
|
538
|
-
.option('-c, --check', 'Only check for updates, don\'t install')
|
|
539
|
-
.action(async (options) => {
|
|
540
|
-
const { execSync } = await import('child_process');
|
|
541
|
-
|
|
542
|
-
console.log(chalk.cyan('🔍 Checking for updates...'));
|
|
543
|
-
|
|
544
|
-
try {
|
|
545
|
-
// Get latest version from npm - cross-platform
|
|
546
|
-
const latestVersion = execSync('npm view vigthoria-cli version', {
|
|
547
|
-
encoding: 'utf8',
|
|
548
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
549
|
-
windowsHide: true,
|
|
550
|
-
}).trim();
|
|
551
|
-
const currentVersion = VERSION;
|
|
552
|
-
|
|
553
|
-
// Use semantic version comparison (1.6.0 > 1.5.9)
|
|
554
|
-
const comparison = compareVersions(latestVersion, currentVersion);
|
|
555
|
-
if (comparison <= 0) {
|
|
556
|
-
console.log(chalk.green(`✅ You are running the latest version (${currentVersion})`));
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
console.log(chalk.yellow(`📦 Update available: ${currentVersion} → ${latestVersion}`));
|
|
561
|
-
|
|
562
|
-
if (options.check) {
|
|
563
|
-
console.log(chalk.gray('Run `vigthoria update` to install the update'));
|
|
564
|
-
return;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
console.log(chalk.cyan('📥 Installing update...'));
|
|
568
|
-
execSync('npm install -g vigthoria-cli@latest', { stdio: 'inherit' });
|
|
569
|
-
|
|
570
|
-
console.log(chalk.green(`✅ Updated to version ${latestVersion}`));
|
|
571
|
-
console.log(chalk.gray('Please restart the CLI to use the new version'));
|
|
572
|
-
|
|
573
|
-
} catch (error: any) {
|
|
574
|
-
console.error(chalk.red('❌ Failed to check for updates:'), error.message);
|
|
575
|
-
console.log(chalk.gray('Try manually: npm install -g vigthoria-cli@latest'));
|
|
576
|
-
}
|
|
577
|
-
});
|
|
578
|
-
|
|
579
|
-
// Init command - Initialize project
|
|
580
|
-
program
|
|
581
|
-
.command('init')
|
|
582
|
-
.description('Initialize Vigthoria in current project')
|
|
583
|
-
.action(async () => {
|
|
584
|
-
const configCmd = new ConfigCommand(config, logger);
|
|
585
|
-
await configCmd.init();
|
|
586
|
-
});
|
|
587
|
-
|
|
588
|
-
// Default to chat if no command
|
|
589
|
-
if (process.argv.length === 2) {
|
|
590
|
-
const chat = new ChatCommand(config, logger);
|
|
591
|
-
await chat.run({ model: 'code', project: process.cwd() });
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
await program.parseAsync(process.argv);
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
main().catch((err) => {
|
|
599
|
-
console.error(chalk.red('Error:'), err.message);
|
|
600
|
-
process.exit(1);
|
|
601
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
declare module 'marked-terminal' {
|
|
2
|
-
import { MarkedExtension } from 'marked';
|
|
3
|
-
|
|
4
|
-
interface MarkedTerminalOptions {
|
|
5
|
-
code?: (code: string) => string;
|
|
6
|
-
blockquote?: (text: string) => string;
|
|
7
|
-
html?: (html: string) => string;
|
|
8
|
-
heading?: (text: string, level: number) => string;
|
|
9
|
-
firstHeading?: (text: string) => string;
|
|
10
|
-
hr?: () => string;
|
|
11
|
-
listitem?: (text: string) => string;
|
|
12
|
-
list?: (body: string, ordered: boolean) => string;
|
|
13
|
-
paragraph?: (text: string) => string;
|
|
14
|
-
table?: (header: string, body: string) => string;
|
|
15
|
-
tablerow?: (content: string) => string;
|
|
16
|
-
tablecell?: (content: string, flags: { header: boolean; align: string }) => string;
|
|
17
|
-
strong?: (text: string) => string;
|
|
18
|
-
em?: (text: string) => string;
|
|
19
|
-
codespan?: (text: string) => string;
|
|
20
|
-
br?: () => string;
|
|
21
|
-
del?: (text: string) => string;
|
|
22
|
-
link?: (href: string, title: string, text: string) => string;
|
|
23
|
-
image?: (href: string, title: string, text: string) => string;
|
|
24
|
-
reflowText?: boolean;
|
|
25
|
-
width?: number;
|
|
26
|
-
showSectionPrefix?: boolean;
|
|
27
|
-
tab?: number;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function markedTerminal(options?: MarkedTerminalOptions): MarkedExtension;
|
|
31
|
-
}
|