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/commands/config.ts
DELETED
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Config Command - CLI configuration management
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import chalk from 'chalk';
|
|
6
|
-
import inquirer from 'inquirer';
|
|
7
|
-
import * as fs from 'fs';
|
|
8
|
-
import * as path from 'path';
|
|
9
|
-
import { Config, VigthoriaCLIConfig } from '../utils/config.js';
|
|
10
|
-
import { Logger } from '../utils/logger.js';
|
|
11
|
-
|
|
12
|
-
interface ConfigOptions {
|
|
13
|
-
set?: string;
|
|
14
|
-
get?: string;
|
|
15
|
-
list?: boolean;
|
|
16
|
-
reset?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export class ConfigCommand {
|
|
20
|
-
private config: Config;
|
|
21
|
-
private logger: Logger;
|
|
22
|
-
|
|
23
|
-
constructor(config: Config, logger: Logger) {
|
|
24
|
-
this.config = config;
|
|
25
|
-
this.logger = logger;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async run(options: ConfigOptions): Promise<void> {
|
|
29
|
-
if (options.reset) {
|
|
30
|
-
await this.resetConfig();
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (options.set) {
|
|
35
|
-
this.setConfig(options.set);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (options.get) {
|
|
40
|
-
this.getConfig(options.get);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (options.list) {
|
|
45
|
-
this.listConfig();
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Interactive mode
|
|
50
|
-
await this.interactiveConfig();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async init(): Promise<void> {
|
|
54
|
-
console.log();
|
|
55
|
-
console.log(chalk.cyan('═══ Initialize Vigthoria in Project ═══'));
|
|
56
|
-
console.log();
|
|
57
|
-
|
|
58
|
-
const cwd = process.cwd();
|
|
59
|
-
const configFile = path.join(cwd, '.vigthoria.json');
|
|
60
|
-
|
|
61
|
-
if (fs.existsSync(configFile)) {
|
|
62
|
-
const { overwrite } = await inquirer.prompt([
|
|
63
|
-
{
|
|
64
|
-
type: 'confirm',
|
|
65
|
-
name: 'overwrite',
|
|
66
|
-
message: '.vigthoria.json already exists. Overwrite?',
|
|
67
|
-
default: false,
|
|
68
|
-
},
|
|
69
|
-
]);
|
|
70
|
-
|
|
71
|
-
if (!overwrite) {
|
|
72
|
-
this.logger.info('Initialization cancelled');
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Gather project settings
|
|
78
|
-
const settings = await inquirer.prompt([
|
|
79
|
-
{
|
|
80
|
-
type: 'list',
|
|
81
|
-
name: 'defaultModel',
|
|
82
|
-
message: 'Default AI model:',
|
|
83
|
-
choices: [
|
|
84
|
-
{ name: '═══ Code Models ═══', disabled: true },
|
|
85
|
-
{ name: 'Vigthoria Code V2 (8B) - Best for coding', value: 'code-v2-8b' },
|
|
86
|
-
{ name: 'Vigthoria Code V3 (8B) - Next gen coding', value: 'code-v3-8b' },
|
|
87
|
-
{ name: 'Vigthoria Code V3 (32B) - Large scale coding', value: 'code-v3-32b' },
|
|
88
|
-
{ name: '═══ General Models ═══', disabled: true },
|
|
89
|
-
{ name: 'Vigthoria Fast (1.7B) - Quick responses', value: 'fast' },
|
|
90
|
-
{ name: 'Vigthoria Mini (0.6B) - Ultra lightweight', value: 'mini' },
|
|
91
|
-
{ name: 'Vigthoria Balanced (4B) - All-purpose', value: 'balanced' },
|
|
92
|
-
{ name: '═══ Creative Models ═══', disabled: true },
|
|
93
|
-
{ name: 'Vigthoria Creative V4 (9B) - Creative tasks', value: 'creative-v4' },
|
|
94
|
-
{ name: 'Vigthoria Creative V3 (9B) - Legacy creative', value: 'creative-v3' },
|
|
95
|
-
{ name: '═══ Specialized Models ═══', disabled: true },
|
|
96
|
-
{ name: 'Vigthoria Music Master (4B) - Music AI', value: 'music' },
|
|
97
|
-
],
|
|
98
|
-
default: 'code-v2-8b',
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
type: 'input',
|
|
102
|
-
name: 'ignorePatterns',
|
|
103
|
-
message: 'Additional ignore patterns (comma-separated):',
|
|
104
|
-
default: '',
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
type: 'confirm',
|
|
108
|
-
name: 'autoApplyFixes',
|
|
109
|
-
message: 'Auto-apply fixes without confirmation?',
|
|
110
|
-
default: false,
|
|
111
|
-
},
|
|
112
|
-
]);
|
|
113
|
-
|
|
114
|
-
// Create project config
|
|
115
|
-
const projectConfig = {
|
|
116
|
-
defaultModel: settings.defaultModel,
|
|
117
|
-
ignorePatterns: settings.ignorePatterns
|
|
118
|
-
? settings.ignorePatterns.split(',').map((p: string) => p.trim())
|
|
119
|
-
: [],
|
|
120
|
-
autoApplyFixes: settings.autoApplyFixes,
|
|
121
|
-
createdAt: new Date().toISOString(),
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
fs.writeFileSync(configFile, JSON.stringify(projectConfig, null, 2));
|
|
125
|
-
this.logger.success(`Created ${configFile}`);
|
|
126
|
-
|
|
127
|
-
// Add to .gitignore if exists
|
|
128
|
-
const gitignorePath = path.join(cwd, '.gitignore');
|
|
129
|
-
if (fs.existsSync(gitignorePath)) {
|
|
130
|
-
const gitignore = fs.readFileSync(gitignorePath, 'utf-8');
|
|
131
|
-
if (!gitignore.includes('.vigthoria.json')) {
|
|
132
|
-
fs.appendFileSync(gitignorePath, '\n# Vigthoria CLI\n.vigthoria.json\n');
|
|
133
|
-
this.logger.info('Added .vigthoria.json to .gitignore');
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
console.log();
|
|
138
|
-
console.log(chalk.gray('Project initialized! Run `vigthoria chat` to start.'));
|
|
139
|
-
console.log();
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
private setConfig(keyValue: string): void {
|
|
143
|
-
const [key, ...valueParts] = keyValue.split('=');
|
|
144
|
-
const value = valueParts.join('=');
|
|
145
|
-
|
|
146
|
-
if (!key || value === undefined) {
|
|
147
|
-
this.logger.error('Invalid format. Use: vigthoria config --set key=value');
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const configMap: Record<string, (v: string) => void> = {
|
|
152
|
-
'model': (v) => this.config.set('preferences', { ...this.config.get('preferences'), defaultModel: v }),
|
|
153
|
-
'theme': (v) => this.config.set('preferences', { ...this.config.get('preferences'), theme: v as 'dark' | 'light' }),
|
|
154
|
-
'autoApply': (v) => this.config.set('preferences', { ...this.config.get('preferences'), autoApplyFixes: v === 'true' }),
|
|
155
|
-
'showDiffs': (v) => this.config.set('preferences', { ...this.config.get('preferences'), showDiffs: v === 'true' }),
|
|
156
|
-
'maxTokens': (v) => this.config.set('preferences', { ...this.config.get('preferences'), maxTokens: parseInt(v, 10) }),
|
|
157
|
-
'apiUrl': (v) => this.config.set('apiUrl', v),
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
if (configMap[key]) {
|
|
161
|
-
configMap[key](value);
|
|
162
|
-
this.logger.success(`Set ${key} = ${value}`);
|
|
163
|
-
} else {
|
|
164
|
-
this.logger.error(`Unknown config key: ${key}`);
|
|
165
|
-
console.log(chalk.gray('Available keys: model, theme, autoApply, showDiffs, maxTokens, apiUrl'));
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
private getConfig(key: string): void {
|
|
170
|
-
const all = this.config.getAll();
|
|
171
|
-
|
|
172
|
-
const flatConfig: Record<string, unknown> = {
|
|
173
|
-
apiUrl: all.apiUrl,
|
|
174
|
-
model: all.preferences.defaultModel,
|
|
175
|
-
theme: all.preferences.theme,
|
|
176
|
-
autoApply: all.preferences.autoApplyFixes,
|
|
177
|
-
showDiffs: all.preferences.showDiffs,
|
|
178
|
-
maxTokens: all.preferences.maxTokens,
|
|
179
|
-
email: all.email,
|
|
180
|
-
plan: all.subscription.plan,
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
if (key in flatConfig) {
|
|
184
|
-
console.log(flatConfig[key]);
|
|
185
|
-
} else {
|
|
186
|
-
this.logger.error(`Unknown config key: ${key}`);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
private listConfig(): void {
|
|
191
|
-
const all = this.config.getAll();
|
|
192
|
-
|
|
193
|
-
console.log();
|
|
194
|
-
console.log(chalk.cyan('═══ Vigthoria CLI Configuration ═══'));
|
|
195
|
-
console.log();
|
|
196
|
-
|
|
197
|
-
console.log(chalk.white('API:'));
|
|
198
|
-
console.log(chalk.gray(' URL: ') + chalk.cyan(all.apiUrl));
|
|
199
|
-
console.log(chalk.gray(' WebSocket: ') + chalk.cyan(all.wsUrl));
|
|
200
|
-
console.log();
|
|
201
|
-
|
|
202
|
-
console.log(chalk.white('Preferences:'));
|
|
203
|
-
console.log(chalk.gray(' Default Model: ') + chalk.cyan(all.preferences.defaultModel));
|
|
204
|
-
console.log(chalk.gray(' Theme: ') + chalk.cyan(all.preferences.theme));
|
|
205
|
-
console.log(chalk.gray(' Auto Apply Fixes: ') + chalk.cyan(all.preferences.autoApplyFixes));
|
|
206
|
-
console.log(chalk.gray(' Show Diffs: ') + chalk.cyan(all.preferences.showDiffs));
|
|
207
|
-
console.log(chalk.gray(' Max Tokens: ') + chalk.cyan(all.preferences.maxTokens));
|
|
208
|
-
console.log();
|
|
209
|
-
|
|
210
|
-
console.log(chalk.white('Project:'));
|
|
211
|
-
console.log(chalk.gray(' Ignore Patterns: ') + chalk.gray(all.project.ignorePatterns.join(', ')));
|
|
212
|
-
console.log();
|
|
213
|
-
|
|
214
|
-
console.log(chalk.gray(`Config file: ${this.config.getConfigPath()}`));
|
|
215
|
-
console.log();
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
private async resetConfig(): Promise<void> {
|
|
219
|
-
const { confirm } = await inquirer.prompt([
|
|
220
|
-
{
|
|
221
|
-
type: 'confirm',
|
|
222
|
-
name: 'confirm',
|
|
223
|
-
message: 'Reset all settings to defaults? (This will not log you out)',
|
|
224
|
-
default: false,
|
|
225
|
-
},
|
|
226
|
-
]);
|
|
227
|
-
|
|
228
|
-
if (confirm) {
|
|
229
|
-
// Save auth before reset
|
|
230
|
-
const authToken = this.config.get('authToken');
|
|
231
|
-
const refreshToken = this.config.get('refreshToken');
|
|
232
|
-
const userId = this.config.get('userId');
|
|
233
|
-
const email = this.config.get('email');
|
|
234
|
-
const subscription = this.config.get('subscription');
|
|
235
|
-
|
|
236
|
-
this.config.reset();
|
|
237
|
-
|
|
238
|
-
// Restore auth
|
|
239
|
-
if (authToken) {
|
|
240
|
-
this.config.set('authToken', authToken);
|
|
241
|
-
this.config.set('refreshToken', refreshToken);
|
|
242
|
-
this.config.set('userId', userId);
|
|
243
|
-
this.config.set('email', email);
|
|
244
|
-
this.config.set('subscription', subscription);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
this.logger.success('Configuration reset to defaults');
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
private async interactiveConfig(): Promise<void> {
|
|
252
|
-
const current = this.config.getAll();
|
|
253
|
-
|
|
254
|
-
console.log();
|
|
255
|
-
console.log(chalk.cyan('═══ Configure Vigthoria CLI ═══'));
|
|
256
|
-
console.log();
|
|
257
|
-
|
|
258
|
-
const settings = await inquirer.prompt([
|
|
259
|
-
{
|
|
260
|
-
type: 'list',
|
|
261
|
-
name: 'defaultModel',
|
|
262
|
-
message: 'Default AI model:',
|
|
263
|
-
choices: [
|
|
264
|
-
{ name: 'Vigthoria Code (8B)', value: 'vigthoria-code' },
|
|
265
|
-
{ name: 'Vigthoria Fast (1.1B)', value: 'vigthoria-fast' },
|
|
266
|
-
{ name: 'Vigthoria Mini (3.8B)', value: 'vigthoria-mini' },
|
|
267
|
-
{ name: 'Vigthoria Creative (9B)', value: 'vigthoria-creative' },
|
|
268
|
-
],
|
|
269
|
-
default: current.preferences.defaultModel,
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
type: 'list',
|
|
273
|
-
name: 'theme',
|
|
274
|
-
message: 'Color theme:',
|
|
275
|
-
choices: ['dark', 'light'],
|
|
276
|
-
default: current.preferences.theme,
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
type: 'confirm',
|
|
280
|
-
name: 'autoApplyFixes',
|
|
281
|
-
message: 'Auto-apply fixes without confirmation?',
|
|
282
|
-
default: current.preferences.autoApplyFixes,
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
type: 'confirm',
|
|
286
|
-
name: 'showDiffs',
|
|
287
|
-
message: 'Show diffs before applying changes?',
|
|
288
|
-
default: current.preferences.showDiffs,
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
type: 'number',
|
|
292
|
-
name: 'maxTokens',
|
|
293
|
-
message: 'Maximum tokens per response:',
|
|
294
|
-
default: current.preferences.maxTokens,
|
|
295
|
-
},
|
|
296
|
-
]);
|
|
297
|
-
|
|
298
|
-
this.config.set('preferences', {
|
|
299
|
-
...current.preferences,
|
|
300
|
-
...settings,
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
this.logger.success('Configuration saved');
|
|
304
|
-
console.log();
|
|
305
|
-
}
|
|
306
|
-
}
|