vigthoria-cli 1.10.47 ā 1.10.48
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/auth.js +51 -68
- package/dist/commands/bridge.js +12 -19
- package/dist/commands/cancel.js +15 -22
- package/dist/commands/chat.d.ts +28 -0
- package/dist/commands/config.js +33 -73
- package/dist/commands/deploy.js +83 -123
- package/dist/commands/device.js +21 -61
- package/dist/commands/edit.js +32 -39
- package/dist/commands/explain.js +18 -25
- package/dist/commands/fork.d.ts +17 -0
- package/dist/commands/fork.js +164 -0
- package/dist/commands/generate.js +37 -44
- package/dist/commands/history.d.ts +17 -0
- package/dist/commands/history.js +113 -0
- package/dist/commands/hub.js +95 -102
- package/dist/commands/index.js +41 -46
- package/dist/commands/legion.js +146 -186
- package/dist/commands/preview.d.ts +55 -0
- package/dist/commands/preview.js +467 -0
- package/dist/commands/replay.d.ts +18 -0
- package/dist/commands/replay.js +156 -0
- package/dist/commands/repo.d.ts +97 -0
- package/dist/commands/repo.js +773 -0
- package/dist/commands/review.js +29 -36
- package/dist/commands/security.js +5 -12
- package/dist/commands/update.d.ts +9 -0
- package/dist/commands/update.js +201 -0
- package/dist/commands/wallet.js +28 -35
- package/dist/commands/workflow.js +13 -20
- package/dist/index.d.ts +21 -0
- package/dist/index.js +1826 -0
- package/dist/utils/api.d.ts +572 -0
- package/dist/utils/api.js +6629 -0
- package/dist/utils/brain-hub-client.js +1 -5
- package/dist/utils/bridge-client.js +11 -52
- package/dist/utils/cli-state.d.ts +54 -0
- package/dist/utils/cli-state.js +185 -0
- package/dist/utils/codebase-indexer.js +4 -41
- package/dist/utils/config.d.ts +85 -0
- package/dist/utils/config.js +267 -0
- package/dist/utils/context-ranker.js +15 -21
- package/dist/utils/files.js +5 -42
- package/dist/utils/logger.js +42 -50
- package/dist/utils/persona.js +3 -8
- package/dist/utils/post-write-validator.js +22 -29
- package/dist/utils/project-memory.js +16 -23
- package/dist/utils/session.d.ts +118 -0
- package/dist/utils/session.js +423 -0
- package/dist/utils/task-display.js +13 -20
- package/dist/utils/tools.d.ts +276 -0
- package/dist/utils/tools.js +3522 -0
- package/dist/utils/workspace-brain-service.js +8 -45
- package/dist/utils/workspace-cache.js +18 -26
- package/dist/utils/workspace-stream.js +21 -63
- package/package.json +1 -1
package/dist/commands/config.js
CHANGED
|
@@ -1,52 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Config Command - CLI configuration management
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
-
var ownKeys = function(o) {
|
|
23
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
-
var ar = [];
|
|
25
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.ConfigCommand = void 0;
|
|
43
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
44
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
45
|
-
const fs = __importStar(require("fs"));
|
|
46
|
-
const path = __importStar(require("path"));
|
|
47
|
-
const persona_js_1 = require("../utils/persona.js");
|
|
48
|
-
const logger_js_1 = require("../utils/logger.js");
|
|
49
|
-
class ConfigCommand {
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import inquirer from 'inquirer';
|
|
6
|
+
import * as fs from 'fs';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
import { normalizePersonaMode } from '../utils/persona.js';
|
|
9
|
+
import { CH } from '../utils/logger.js';
|
|
10
|
+
export class ConfigCommand {
|
|
50
11
|
config;
|
|
51
12
|
logger;
|
|
52
13
|
constructor(config, logger) {
|
|
@@ -75,7 +36,7 @@ class ConfigCommand {
|
|
|
75
36
|
}
|
|
76
37
|
async init(options = {}) {
|
|
77
38
|
console.log();
|
|
78
|
-
console.log(
|
|
39
|
+
console.log(chalk.cyan(`${CH.hDouble.repeat(3)} Initialize Vigthoria in Project ${CH.hDouble.repeat(3)}`));
|
|
79
40
|
console.log();
|
|
80
41
|
const cwd = process.cwd();
|
|
81
42
|
const configFile = path.join(cwd, '.vigthoria.json');
|
|
@@ -93,7 +54,7 @@ class ConfigCommand {
|
|
|
93
54
|
}
|
|
94
55
|
}
|
|
95
56
|
else {
|
|
96
|
-
const { overwrite } = await
|
|
57
|
+
const { overwrite } = await inquirer.prompt([
|
|
97
58
|
{
|
|
98
59
|
type: 'confirm',
|
|
99
60
|
name: 'overwrite',
|
|
@@ -130,7 +91,7 @@ class ConfigCommand {
|
|
|
130
91
|
}
|
|
131
92
|
else {
|
|
132
93
|
// Gather project settings interactively
|
|
133
|
-
settings = await
|
|
94
|
+
settings = await inquirer.prompt([
|
|
134
95
|
{
|
|
135
96
|
type: 'list',
|
|
136
97
|
name: 'defaultModel',
|
|
@@ -182,9 +143,9 @@ class ConfigCommand {
|
|
|
182
143
|
}
|
|
183
144
|
console.log();
|
|
184
145
|
if (nonInteractive) {
|
|
185
|
-
console.log(
|
|
146
|
+
console.log(chalk.gray('Project initialized in non-interactive mode.'));
|
|
186
147
|
}
|
|
187
|
-
console.log(
|
|
148
|
+
console.log(chalk.gray('Project initialized! Run vigthoria start for a beginner guide or vigthoria chat to begin.'));
|
|
188
149
|
console.log();
|
|
189
150
|
}
|
|
190
151
|
setConfig(keyValue) {
|
|
@@ -205,7 +166,7 @@ class ConfigCommand {
|
|
|
205
166
|
'wsUrl': (v) => this.config.set('wsUrl', v),
|
|
206
167
|
'selfHostedModelsApiUrl': (v) => this.config.set('selfHostedModelsApiUrl', v === 'null' || v === 'off' ? null : v),
|
|
207
168
|
'persona': (v) => {
|
|
208
|
-
const mode =
|
|
169
|
+
const mode = normalizePersonaMode(v);
|
|
209
170
|
if (!mode)
|
|
210
171
|
throw new Error('Invalid persona. Use: default or wiener_grant');
|
|
211
172
|
this.config.set('persona', mode);
|
|
@@ -217,7 +178,7 @@ class ConfigCommand {
|
|
|
217
178
|
}
|
|
218
179
|
else {
|
|
219
180
|
this.logger.error(`Unknown config key: ${key}`);
|
|
220
|
-
console.log(
|
|
181
|
+
console.log(chalk.gray('Available keys: model, theme, autoApply, showDiffs, maxTokens, persona, apiUrl, modelsApiUrl, wsUrl, selfHostedModelsApiUrl'));
|
|
221
182
|
}
|
|
222
183
|
}
|
|
223
184
|
formatConfigValueForDisplay(key, value) {
|
|
@@ -272,30 +233,30 @@ class ConfigCommand {
|
|
|
272
233
|
listConfig() {
|
|
273
234
|
const all = this.config.getAll();
|
|
274
235
|
console.log();
|
|
275
|
-
console.log(
|
|
236
|
+
console.log(chalk.cyan('āāā Vigthoria CLI Configuration āāā'));
|
|
276
237
|
console.log();
|
|
277
|
-
console.log(
|
|
278
|
-
console.log(
|
|
279
|
-
console.log(
|
|
280
|
-
console.log(
|
|
281
|
-
console.log(
|
|
238
|
+
console.log(chalk.white('API:'));
|
|
239
|
+
console.log(chalk.gray(' URL: ') + chalk.cyan(this.redactConfigUrl(all.apiUrl)));
|
|
240
|
+
console.log(chalk.gray(' Models API: ') + chalk.cyan(this.redactConfigUrl(all.modelsApiUrl)));
|
|
241
|
+
console.log(chalk.gray(' WebSocket: ') + chalk.cyan(this.redactConfigUrl(all.wsUrl)));
|
|
242
|
+
console.log(chalk.gray(' Vigthoria Model Endpoint: ') + chalk.cyan(all.selfHostedModelsApiUrl || 'default'));
|
|
282
243
|
console.log();
|
|
283
|
-
console.log(
|
|
284
|
-
console.log(
|
|
285
|
-
console.log(
|
|
286
|
-
console.log(
|
|
287
|
-
console.log(
|
|
288
|
-
console.log(
|
|
289
|
-
console.log(
|
|
244
|
+
console.log(chalk.white('Preferences:'));
|
|
245
|
+
console.log(chalk.gray(' Default Model: ') + chalk.cyan(all.preferences.defaultModel));
|
|
246
|
+
console.log(chalk.gray(' Theme: ') + chalk.cyan(all.preferences.theme));
|
|
247
|
+
console.log(chalk.gray(' Auto Apply Fixes: ') + chalk.cyan(all.preferences.autoApplyFixes));
|
|
248
|
+
console.log(chalk.gray(' Show Diffs: ') + chalk.cyan(all.preferences.showDiffs));
|
|
249
|
+
console.log(chalk.gray(' Max Tokens: ') + chalk.cyan(all.preferences.maxTokens));
|
|
250
|
+
console.log(chalk.gray(' Persona: ') + chalk.cyan(all.persona));
|
|
290
251
|
console.log();
|
|
291
|
-
console.log(
|
|
292
|
-
console.log(
|
|
252
|
+
console.log(chalk.white('Project:'));
|
|
253
|
+
console.log(chalk.gray(' Ignore Patterns: ') + chalk.gray(all.project.ignorePatterns.join(', ')));
|
|
293
254
|
console.log();
|
|
294
|
-
console.log(
|
|
255
|
+
console.log(chalk.gray(`Config file: ${this.config.getConfigPath()}`));
|
|
295
256
|
console.log();
|
|
296
257
|
}
|
|
297
258
|
async resetConfig() {
|
|
298
|
-
const { confirm } = await
|
|
259
|
+
const { confirm } = await inquirer.prompt([
|
|
299
260
|
{
|
|
300
261
|
type: 'confirm',
|
|
301
262
|
name: 'confirm',
|
|
@@ -325,9 +286,9 @@ class ConfigCommand {
|
|
|
325
286
|
async interactiveConfig() {
|
|
326
287
|
const current = this.config.getAll();
|
|
327
288
|
console.log();
|
|
328
|
-
console.log(
|
|
289
|
+
console.log(chalk.cyan('āāā Configure Vigthoria CLI āāā'));
|
|
329
290
|
console.log();
|
|
330
|
-
const settings = await
|
|
291
|
+
const settings = await inquirer.prompt([
|
|
331
292
|
{
|
|
332
293
|
type: 'list',
|
|
333
294
|
name: 'defaultModel',
|
|
@@ -374,4 +335,3 @@ class ConfigCommand {
|
|
|
374
335
|
console.log();
|
|
375
336
|
}
|
|
376
337
|
}
|
|
377
|
-
exports.ConfigCommand = ConfigCommand;
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Vigthoria CLI - Deploy Commands
|
|
4
3
|
*
|
|
@@ -12,50 +11,12 @@
|
|
|
12
11
|
* vig deploy list - List all deployments
|
|
13
12
|
* vig deploy remove <domain> - Remove a deployment
|
|
14
13
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Object.defineProperty(o, k2, desc);
|
|
22
|
-
}) : (function(o, m, k, k2) {
|
|
23
|
-
if (k2 === undefined) k2 = k;
|
|
24
|
-
o[k2] = m[k];
|
|
25
|
-
}));
|
|
26
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
27
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
28
|
-
}) : function(o, v) {
|
|
29
|
-
o["default"] = v;
|
|
30
|
-
});
|
|
31
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
32
|
-
var ownKeys = function(o) {
|
|
33
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
34
|
-
var ar = [];
|
|
35
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
36
|
-
return ar;
|
|
37
|
-
};
|
|
38
|
-
return ownKeys(o);
|
|
39
|
-
};
|
|
40
|
-
return function (mod) {
|
|
41
|
-
if (mod && mod.__esModule) return mod;
|
|
42
|
-
var result = {};
|
|
43
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
44
|
-
__setModuleDefault(result, mod);
|
|
45
|
-
return result;
|
|
46
|
-
};
|
|
47
|
-
})();
|
|
48
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
49
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
50
|
-
};
|
|
51
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
|
-
exports.DeployCommand = void 0;
|
|
53
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
54
|
-
const fs = __importStar(require("fs"));
|
|
55
|
-
const path = __importStar(require("path"));
|
|
56
|
-
const logger_js_1 = require("../utils/logger.js");
|
|
57
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
58
|
-
class DeployCommand {
|
|
14
|
+
import chalk from 'chalk';
|
|
15
|
+
import * as fs from 'fs';
|
|
16
|
+
import * as path from 'path';
|
|
17
|
+
import { createSpinner, CH } from '../utils/logger.js';
|
|
18
|
+
import inquirer from 'inquirer';
|
|
19
|
+
export class DeployCommand {
|
|
59
20
|
config;
|
|
60
21
|
logger;
|
|
61
22
|
apiBase;
|
|
@@ -76,8 +37,8 @@ class DeployCommand {
|
|
|
76
37
|
}
|
|
77
38
|
requireAuth() {
|
|
78
39
|
if (!this.isAuthenticated()) {
|
|
79
|
-
console.log(
|
|
80
|
-
console.log(
|
|
40
|
+
console.log(chalk.red('\nā Authentication required'));
|
|
41
|
+
console.log(chalk.gray(' Run `vig login` to authenticate first.\n'));
|
|
81
42
|
process.exit(1);
|
|
82
43
|
}
|
|
83
44
|
}
|
|
@@ -86,7 +47,7 @@ class DeployCommand {
|
|
|
86
47
|
*/
|
|
87
48
|
async deploy(options = {}) {
|
|
88
49
|
this.requireAuth();
|
|
89
|
-
console.log(
|
|
50
|
+
console.log(chalk.cyan('\nš Vigthoria Deploy - Host Your Project\n'));
|
|
90
51
|
// If subdomain or domain specified, deploy directly
|
|
91
52
|
if (options.subdomain) {
|
|
92
53
|
await this.deployToSubdomain(options.subdomain, options.project);
|
|
@@ -97,7 +58,7 @@ class DeployCommand {
|
|
|
97
58
|
return;
|
|
98
59
|
}
|
|
99
60
|
// Interactive wizard
|
|
100
|
-
const { deployType } = await
|
|
61
|
+
const { deployType } = await inquirer.prompt([{
|
|
101
62
|
type: 'list',
|
|
102
63
|
name: 'deployType',
|
|
103
64
|
message: 'How would you like to deploy?',
|
|
@@ -128,7 +89,7 @@ class DeployCommand {
|
|
|
128
89
|
*/
|
|
129
90
|
async deployToPreview(projectPath) {
|
|
130
91
|
this.requireAuth();
|
|
131
|
-
const spinner =
|
|
92
|
+
const spinner = createSpinner('Deploying to preview...').start();
|
|
132
93
|
try {
|
|
133
94
|
const projectDir = projectPath || process.cwd();
|
|
134
95
|
const projectInfo = this.detectProjectInfo(projectDir);
|
|
@@ -145,17 +106,17 @@ class DeployCommand {
|
|
|
145
106
|
throw new Error(error.error || 'Failed to deploy');
|
|
146
107
|
}
|
|
147
108
|
const data = await response.json();
|
|
148
|
-
spinner.succeed(
|
|
149
|
-
console.log(
|
|
150
|
-
console.log(
|
|
151
|
-
console.log(
|
|
152
|
-
console.log(
|
|
109
|
+
spinner.succeed(chalk.green('Deployed to preview!'));
|
|
110
|
+
console.log(chalk.cyan('\nš Preview URL:'));
|
|
111
|
+
console.log(chalk.white(` ${data.url}`));
|
|
112
|
+
console.log(chalk.gray('\n Note: Preview URLs may expire after 7 days of inactivity.'));
|
|
113
|
+
console.log(chalk.gray(' Upgrade to a subdomain for permanent hosting.\n'));
|
|
153
114
|
}
|
|
154
115
|
catch (error) {
|
|
155
116
|
spinner.stop();
|
|
156
117
|
this.logger.error('Deploy failed');
|
|
157
118
|
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
158
|
-
console.log(
|
|
119
|
+
console.log(chalk.red(`\nā Error: ${errMsg}\n`));
|
|
159
120
|
process.exitCode = 1;
|
|
160
121
|
}
|
|
161
122
|
}
|
|
@@ -163,7 +124,7 @@ class DeployCommand {
|
|
|
163
124
|
* Deploy to Vigthoria subdomain
|
|
164
125
|
*/
|
|
165
126
|
async deployToSubdomain(subdomain, projectPath) {
|
|
166
|
-
const spinner =
|
|
127
|
+
const spinner = createSpinner(`Deploying to ${subdomain}.vigthoria.io...`).start();
|
|
167
128
|
try {
|
|
168
129
|
// Validate subdomain format
|
|
169
130
|
if (!/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(subdomain) || subdomain.length < 3) {
|
|
@@ -184,40 +145,40 @@ class DeployCommand {
|
|
|
184
145
|
if (!response.ok || !data.success) {
|
|
185
146
|
if (data.requiresSubscription) {
|
|
186
147
|
spinner.stop();
|
|
187
|
-
console.log(
|
|
188
|
-
const { proceed } = await
|
|
148
|
+
console.log(chalk.yellow(`\n${CH.warnEmoji} Subdomain hosting requires a subscription (ā¬4.99/mo)`));
|
|
149
|
+
const { proceed } = await inquirer.prompt([{
|
|
189
150
|
type: 'confirm',
|
|
190
151
|
name: 'proceed',
|
|
191
152
|
message: 'Would you like to subscribe now?',
|
|
192
153
|
default: true
|
|
193
154
|
}]);
|
|
194
155
|
if (proceed && data.checkoutUrl) {
|
|
195
|
-
console.log(
|
|
196
|
-
console.log(
|
|
156
|
+
console.log(chalk.cyan(`\nš Opening checkout: ${data.checkoutUrl}`));
|
|
157
|
+
console.log(chalk.gray('Please open this URL in your browser to subscribe.\n'));
|
|
197
158
|
}
|
|
198
159
|
return;
|
|
199
160
|
}
|
|
200
161
|
throw new Error(data.error || 'Failed to deploy');
|
|
201
162
|
}
|
|
202
|
-
spinner.succeed(
|
|
203
|
-
console.log(
|
|
204
|
-
console.log(
|
|
205
|
-
console.log(
|
|
206
|
-
console.log(
|
|
207
|
-
console.log(
|
|
163
|
+
spinner.succeed(chalk.green(`Deployed to ${subdomain}.vigthoria.io!`));
|
|
164
|
+
console.log(chalk.cyan('\nš Your Site is Live:'));
|
|
165
|
+
console.log(chalk.bold.white(` https://${subdomain}.vigthoria.io`));
|
|
166
|
+
console.log(chalk.gray('\n ā SSL certificate auto-configured'));
|
|
167
|
+
console.log(chalk.gray(' ā Global CDN enabled'));
|
|
168
|
+
console.log(chalk.gray(' ā Unlimited traffic included\n'));
|
|
208
169
|
}
|
|
209
170
|
catch (error) {
|
|
210
171
|
spinner.stop();
|
|
211
172
|
this.logger.error('Deploy failed');
|
|
212
173
|
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
213
|
-
console.log(
|
|
174
|
+
console.log(chalk.red(`\nā Error: ${errMsg}\n`));
|
|
214
175
|
}
|
|
215
176
|
}
|
|
216
177
|
/**
|
|
217
178
|
* Deploy to custom domain
|
|
218
179
|
*/
|
|
219
180
|
async deployToCustomDomain(domain, projectPath) {
|
|
220
|
-
const spinner =
|
|
181
|
+
const spinner = createSpinner(`Setting up ${domain}...`).start();
|
|
221
182
|
try {
|
|
222
183
|
const projectDir = projectPath || process.cwd();
|
|
223
184
|
const projectInfo = this.detectProjectInfo(projectDir);
|
|
@@ -234,49 +195,49 @@ class DeployCommand {
|
|
|
234
195
|
if (!response.ok || !data.success) {
|
|
235
196
|
if (data.requiresSubscription) {
|
|
236
197
|
spinner.stop();
|
|
237
|
-
console.log(
|
|
238
|
-
const { proceed } = await
|
|
198
|
+
console.log(chalk.yellow(`\n${CH.warnEmoji} Custom domain hosting requires a subscription (ā¬9.99/mo)`));
|
|
199
|
+
const { proceed } = await inquirer.prompt([{
|
|
239
200
|
type: 'confirm',
|
|
240
201
|
name: 'proceed',
|
|
241
202
|
message: 'Would you like to subscribe now?',
|
|
242
203
|
default: true
|
|
243
204
|
}]);
|
|
244
205
|
if (proceed && data.checkoutUrl) {
|
|
245
|
-
console.log(
|
|
246
|
-
console.log(
|
|
206
|
+
console.log(chalk.cyan(`\nš Checkout URL: ${data.checkoutUrl}`));
|
|
207
|
+
console.log(chalk.gray('Please open this URL in your browser to subscribe.\n'));
|
|
247
208
|
}
|
|
248
209
|
return;
|
|
249
210
|
}
|
|
250
211
|
throw new Error(data.error || 'Failed to deploy');
|
|
251
212
|
}
|
|
252
|
-
spinner.succeed(
|
|
213
|
+
spinner.succeed(chalk.green('Domain registered!'));
|
|
253
214
|
if (data.dnsRecords) {
|
|
254
|
-
console.log(
|
|
255
|
-
console.log(
|
|
215
|
+
console.log(chalk.cyan('\nš Configure your DNS records:'));
|
|
216
|
+
console.log(chalk.gray('ā'.repeat(60)));
|
|
256
217
|
for (const record of data.dnsRecords) {
|
|
257
|
-
console.log(
|
|
218
|
+
console.log(chalk.white(` Type: ${record.type.padEnd(6)} Name: ${record.name.padEnd(20)} Value: ${record.value}`));
|
|
258
219
|
}
|
|
259
|
-
console.log(
|
|
260
|
-
console.log(
|
|
261
|
-
console.log(
|
|
220
|
+
console.log(chalk.gray('ā'.repeat(60)));
|
|
221
|
+
console.log(chalk.yellow('\nā³ After adding DNS records, run:'));
|
|
222
|
+
console.log(chalk.white(` vig deploy verify ${domain}\n`));
|
|
262
223
|
}
|
|
263
224
|
}
|
|
264
225
|
catch (error) {
|
|
265
226
|
spinner.stop();
|
|
266
227
|
this.logger.error('Deploy failed');
|
|
267
228
|
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
268
|
-
console.log(
|
|
229
|
+
console.log(chalk.red(`\nā Error: ${errMsg}\n`));
|
|
269
230
|
}
|
|
270
231
|
}
|
|
271
232
|
/**
|
|
272
233
|
* Interactive subdomain prompt
|
|
273
234
|
*/
|
|
274
235
|
async promptSubdomainDeploy(projectPath) {
|
|
275
|
-
const { subdomain } = await
|
|
236
|
+
const { subdomain } = await inquirer.prompt([{
|
|
276
237
|
type: 'input',
|
|
277
238
|
name: 'subdomain',
|
|
278
239
|
message: 'Enter your desired subdomain:',
|
|
279
|
-
suffix:
|
|
240
|
+
suffix: chalk.gray('.vigthoria.io'),
|
|
280
241
|
validate: (input) => {
|
|
281
242
|
if (!/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(input) || input.length < 3) {
|
|
282
243
|
return 'Subdomain must be 3+ chars, lowercase alphanumeric with hyphens';
|
|
@@ -290,11 +251,11 @@ class DeployCommand {
|
|
|
290
251
|
* Interactive custom domain prompt
|
|
291
252
|
*/
|
|
292
253
|
async promptCustomDomainDeploy(projectPath) {
|
|
293
|
-
const { domain } = await
|
|
254
|
+
const { domain } = await inquirer.prompt([{
|
|
294
255
|
type: 'input',
|
|
295
256
|
name: 'domain',
|
|
296
257
|
message: 'Enter your domain:',
|
|
297
|
-
suffix:
|
|
258
|
+
suffix: chalk.gray(' (e.g., myapp.com)'),
|
|
298
259
|
validate: (input) => {
|
|
299
260
|
if (!/^[a-z0-9][a-z0-9.-]+\.[a-z]{2,}$/i.test(input)) {
|
|
300
261
|
return 'Please enter a valid domain name';
|
|
@@ -308,7 +269,7 @@ class DeployCommand {
|
|
|
308
269
|
* Show hosting plans
|
|
309
270
|
*/
|
|
310
271
|
async showPlans() {
|
|
311
|
-
const spinner =
|
|
272
|
+
const spinner = createSpinner('Fetching hosting plans...').start();
|
|
312
273
|
try {
|
|
313
274
|
const response = await fetch(`${this.apiBase}/api/hosting/plans`, {
|
|
314
275
|
headers: this.getAuthHeaders()
|
|
@@ -318,14 +279,14 @@ class DeployCommand {
|
|
|
318
279
|
}
|
|
319
280
|
const data = await response.json();
|
|
320
281
|
spinner.stop();
|
|
321
|
-
console.log(
|
|
322
|
-
console.log(
|
|
282
|
+
console.log(chalk.cyan('\nš Vigthoria Hosting Plans\n'));
|
|
283
|
+
console.log(chalk.gray('ā'.repeat(70)));
|
|
323
284
|
for (const plan of data.plans) {
|
|
324
285
|
const price = plan.price_monthly === 0
|
|
325
|
-
?
|
|
326
|
-
:
|
|
327
|
-
console.log(
|
|
328
|
-
console.log(
|
|
286
|
+
? chalk.green('FREE')
|
|
287
|
+
: chalk.yellow(`ā¬${plan.price_monthly.toFixed(2)}/mo`);
|
|
288
|
+
console.log(chalk.bold.white(`\n ${plan.display_name} - ${price}`));
|
|
289
|
+
console.log(chalk.gray(' ' + 'ā'.repeat(50)));
|
|
329
290
|
const features = [];
|
|
330
291
|
if (plan.subdomain_allowed)
|
|
331
292
|
features.push('ā Vigthoria subdomain');
|
|
@@ -333,16 +294,16 @@ class DeployCommand {
|
|
|
333
294
|
features.push('ā Custom domain');
|
|
334
295
|
features.push(`ā ${plan.max_projects === -1 ? 'Unlimited' : plan.max_projects} project(s)`);
|
|
335
296
|
features.push(`ā ${plan.storage_mb >= 1024 ? (plan.storage_mb / 1024) + 'GB' : plan.storage_mb + 'MB'} storage`);
|
|
336
|
-
features.forEach(f => console.log(
|
|
297
|
+
features.forEach(f => console.log(chalk.gray(` ${f}`)));
|
|
337
298
|
}
|
|
338
|
-
console.log(
|
|
339
|
-
console.log(
|
|
299
|
+
console.log(chalk.gray('\n' + 'ā'.repeat(70)));
|
|
300
|
+
console.log(chalk.cyan('\n Subscribe: vig deploy --subdomain myapp\n'));
|
|
340
301
|
}
|
|
341
302
|
catch (error) {
|
|
342
303
|
spinner.stop();
|
|
343
304
|
this.logger.error('Failed to fetch plans');
|
|
344
305
|
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
345
|
-
console.log(
|
|
306
|
+
console.log(chalk.red(`\nā Error: ${errMsg}\n`));
|
|
346
307
|
}
|
|
347
308
|
}
|
|
348
309
|
/**
|
|
@@ -350,7 +311,7 @@ class DeployCommand {
|
|
|
350
311
|
*/
|
|
351
312
|
async list() {
|
|
352
313
|
this.requireAuth();
|
|
353
|
-
const spinner =
|
|
314
|
+
const spinner = createSpinner('Fetching deployments...').start();
|
|
354
315
|
try {
|
|
355
316
|
const response = await fetch(`${this.apiBase}/api/hosting/domains`, {
|
|
356
317
|
headers: this.getAuthHeaders()
|
|
@@ -361,21 +322,21 @@ class DeployCommand {
|
|
|
361
322
|
const data = await response.json();
|
|
362
323
|
spinner.stop();
|
|
363
324
|
if (data.domains.length === 0) {
|
|
364
|
-
console.log(
|
|
365
|
-
console.log(
|
|
325
|
+
console.log(chalk.yellow('\nš¦ No deployments yet.\n'));
|
|
326
|
+
console.log(chalk.gray(' Run `vig deploy` to deploy your first project.\n'));
|
|
366
327
|
return;
|
|
367
328
|
}
|
|
368
|
-
console.log(
|
|
329
|
+
console.log(chalk.cyan(`\nš Your Deployments (${data.domains.length})\n`));
|
|
369
330
|
for (const domain of data.domains) {
|
|
370
331
|
const statusIcon = domain.is_active ? 'š¢' : 'š“';
|
|
371
|
-
const sslIcon = domain.ssl_status === 'active' ?
|
|
332
|
+
const sslIcon = domain.ssl_status === 'active' ? CH.lock : CH.warnEmoji;
|
|
372
333
|
const url = domain.domain_type === 'subdomain'
|
|
373
334
|
? `${domain.subdomain}.vigthoria.io`
|
|
374
335
|
: domain.domain_type === 'custom'
|
|
375
336
|
? domain.custom_domain
|
|
376
337
|
: domain.url;
|
|
377
|
-
console.log(
|
|
378
|
-
console.log(
|
|
338
|
+
console.log(chalk.white(` ${statusIcon} ${url}`));
|
|
339
|
+
console.log(chalk.gray(` Project: ${domain.project_name} | SSL: ${sslIcon} ${domain.ssl_status} | Tier: ${domain.hosting_tier}`));
|
|
379
340
|
console.log();
|
|
380
341
|
}
|
|
381
342
|
}
|
|
@@ -383,7 +344,7 @@ class DeployCommand {
|
|
|
383
344
|
spinner.stop();
|
|
384
345
|
this.logger.error('List failed');
|
|
385
346
|
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
386
|
-
console.log(
|
|
347
|
+
console.log(chalk.red(`\nā Error: ${errMsg}\n`));
|
|
387
348
|
}
|
|
388
349
|
}
|
|
389
350
|
/**
|
|
@@ -391,7 +352,7 @@ class DeployCommand {
|
|
|
391
352
|
*/
|
|
392
353
|
async status(domain) {
|
|
393
354
|
this.requireAuth();
|
|
394
|
-
const spinner =
|
|
355
|
+
const spinner = createSpinner('Checking status...').start();
|
|
395
356
|
try {
|
|
396
357
|
const endpoint = domain
|
|
397
358
|
? `${this.apiBase}/api/hosting/domain/${encodeURIComponent(domain)}/status`
|
|
@@ -404,14 +365,14 @@ class DeployCommand {
|
|
|
404
365
|
}
|
|
405
366
|
const data = await response.json();
|
|
406
367
|
spinner.stop();
|
|
407
|
-
console.log(
|
|
368
|
+
console.log(chalk.cyan('\nš Deployment Status\n'));
|
|
408
369
|
console.log(JSON.stringify(data, null, 2));
|
|
409
370
|
}
|
|
410
371
|
catch (error) {
|
|
411
372
|
spinner.stop();
|
|
412
373
|
this.logger.error('Status check failed');
|
|
413
374
|
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
414
|
-
console.log(
|
|
375
|
+
console.log(chalk.red(`\nā Error: ${errMsg}\n`));
|
|
415
376
|
}
|
|
416
377
|
}
|
|
417
378
|
/**
|
|
@@ -419,7 +380,7 @@ class DeployCommand {
|
|
|
419
380
|
*/
|
|
420
381
|
async verify(domain) {
|
|
421
382
|
this.requireAuth();
|
|
422
|
-
const spinner =
|
|
383
|
+
const spinner = createSpinner(`Verifying DNS for ${domain}...`).start();
|
|
423
384
|
try {
|
|
424
385
|
const response = await fetch(`${this.apiBase}/api/hosting/domain/verify`, {
|
|
425
386
|
method: 'POST',
|
|
@@ -431,21 +392,21 @@ class DeployCommand {
|
|
|
431
392
|
throw new Error(data.error || 'Verification failed');
|
|
432
393
|
}
|
|
433
394
|
if (data.verified) {
|
|
434
|
-
spinner.succeed(
|
|
435
|
-
console.log(
|
|
436
|
-
console.log(
|
|
395
|
+
spinner.succeed(chalk.green('Domain verified!'));
|
|
396
|
+
console.log(chalk.cyan(`\nš Your site is now live at: https://${domain}`));
|
|
397
|
+
console.log(chalk.gray(` SSL Status: ${data.sslStatus || 'Provisioning...'}\n`));
|
|
437
398
|
}
|
|
438
399
|
else {
|
|
439
|
-
spinner.warn(
|
|
440
|
-
console.log(
|
|
441
|
-
console.log(
|
|
400
|
+
spinner.warn(chalk.yellow('DNS not propagated yet'));
|
|
401
|
+
console.log(chalk.gray('\n DNS changes can take up to 48 hours to propagate.'));
|
|
402
|
+
console.log(chalk.gray(' Try again later with: vig deploy verify ' + domain + '\n'));
|
|
442
403
|
}
|
|
443
404
|
}
|
|
444
405
|
catch (error) {
|
|
445
406
|
spinner.stop();
|
|
446
407
|
this.logger.error('Verification failed');
|
|
447
408
|
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
448
|
-
console.log(
|
|
409
|
+
console.log(chalk.red(`\nā Error: ${errMsg}\n`));
|
|
449
410
|
}
|
|
450
411
|
}
|
|
451
412
|
/**
|
|
@@ -453,17 +414,17 @@ class DeployCommand {
|
|
|
453
414
|
*/
|
|
454
415
|
async remove(domain) {
|
|
455
416
|
this.requireAuth();
|
|
456
|
-
const { confirm } = await
|
|
417
|
+
const { confirm } = await inquirer.prompt([{
|
|
457
418
|
type: 'confirm',
|
|
458
419
|
name: 'confirm',
|
|
459
|
-
message:
|
|
420
|
+
message: chalk.red(`Are you sure you want to remove ${domain}?`),
|
|
460
421
|
default: false
|
|
461
422
|
}]);
|
|
462
423
|
if (!confirm) {
|
|
463
|
-
console.log(
|
|
424
|
+
console.log(chalk.yellow(`\n${CH.warnEmoji} Removal cancelled.\n`));
|
|
464
425
|
return;
|
|
465
426
|
}
|
|
466
|
-
const spinner =
|
|
427
|
+
const spinner = createSpinner(`Removing ${domain}...`).start();
|
|
467
428
|
try {
|
|
468
429
|
const response = await fetch(`${this.apiBase}/api/hosting/domain/${encodeURIComponent(domain)}`, {
|
|
469
430
|
method: 'DELETE',
|
|
@@ -473,14 +434,14 @@ class DeployCommand {
|
|
|
473
434
|
const error = await response.json();
|
|
474
435
|
throw new Error(error.error || 'Failed to remove');
|
|
475
436
|
}
|
|
476
|
-
spinner.succeed(
|
|
477
|
-
console.log(
|
|
437
|
+
spinner.succeed(chalk.green('Domain removed'));
|
|
438
|
+
console.log(chalk.gray('\n Your project files are still in your repository.\n'));
|
|
478
439
|
}
|
|
479
440
|
catch (error) {
|
|
480
441
|
spinner.stop();
|
|
481
442
|
this.logger.error('Remove failed');
|
|
482
443
|
const errMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
483
|
-
console.log(
|
|
444
|
+
console.log(chalk.red(`\nā Error: ${errMsg}\n`));
|
|
484
445
|
}
|
|
485
446
|
}
|
|
486
447
|
/**
|
|
@@ -520,4 +481,3 @@ class DeployCommand {
|
|
|
520
481
|
return { name, techStack };
|
|
521
482
|
}
|
|
522
483
|
}
|
|
523
|
-
exports.DeployCommand = DeployCommand;
|