vigthoria-cli 1.6.2 → 1.6.5

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 (46) hide show
  1. package/README.md +52 -1
  2. package/dist/commands/chat.d.ts +31 -45
  3. package/dist/commands/chat.d.ts.map +1 -1
  4. package/dist/commands/chat.js +379 -855
  5. package/dist/commands/chat.js.map +1 -1
  6. package/dist/commands/repo.d.ts +10 -0
  7. package/dist/commands/repo.d.ts.map +1 -1
  8. package/dist/commands/repo.js +215 -97
  9. package/dist/commands/repo.js.map +1 -1
  10. package/dist/index.js +32 -4
  11. package/dist/index.js.map +1 -1
  12. package/dist/utils/api.d.ts +8 -0
  13. package/dist/utils/api.d.ts.map +1 -1
  14. package/dist/utils/api.js +183 -42
  15. package/dist/utils/api.js.map +1 -1
  16. package/dist/utils/config.d.ts.map +1 -1
  17. package/dist/utils/config.js +2 -1
  18. package/dist/utils/config.js.map +1 -1
  19. package/dist/utils/tools.d.ts +4 -0
  20. package/dist/utils/tools.d.ts.map +1 -1
  21. package/dist/utils/tools.js +210 -6
  22. package/dist/utils/tools.js.map +1 -1
  23. package/package.json +13 -2
  24. package/install.ps1 +0 -290
  25. package/install.sh +0 -307
  26. package/src/commands/auth.ts +0 -226
  27. package/src/commands/chat.ts +0 -1101
  28. package/src/commands/config.ts +0 -306
  29. package/src/commands/deploy.ts +0 -609
  30. package/src/commands/edit.ts +0 -310
  31. package/src/commands/explain.ts +0 -115
  32. package/src/commands/generate.ts +0 -222
  33. package/src/commands/hub.ts +0 -382
  34. package/src/commands/repo.ts +0 -742
  35. package/src/commands/review.ts +0 -186
  36. package/src/index.ts +0 -601
  37. package/src/types/marked-terminal.d.ts +0 -31
  38. package/src/utils/api.ts +0 -526
  39. package/src/utils/config.ts +0 -241
  40. package/src/utils/files.ts +0 -273
  41. package/src/utils/logger.ts +0 -130
  42. package/src/utils/session.ts +0 -179
  43. package/src/utils/tools.ts +0 -2086
  44. package/test-parse.js +0 -105
  45. package/test-parse2.js +0 -35
  46. package/tsconfig.json +0 -20
@@ -1,186 +0,0 @@
1
- /**
2
- * Review Command - Code review with AI
3
- */
4
-
5
- import chalk from 'chalk';
6
- import ora from 'ora';
7
- import { Marked } from 'marked';
8
- import { markedTerminal } from 'marked-terminal';
9
- import { Config } from '../utils/config.js';
10
- import { Logger } from '../utils/logger.js';
11
- import { APIClient } from '../utils/api.js';
12
- import { FileUtils } from '../utils/files.js';
13
-
14
- interface ReviewOptions {
15
- format: 'text' | 'json' | 'markdown';
16
- }
17
-
18
- export class ReviewCommand {
19
- private config: Config;
20
- private logger: Logger;
21
- private api: APIClient;
22
- private fileUtils: FileUtils;
23
- private marked: Marked;
24
-
25
- constructor(config: Config, logger: Logger) {
26
- this.config = config;
27
- this.logger = logger;
28
- this.api = new APIClient(config, logger);
29
- this.fileUtils = new FileUtils(process.cwd(), config.get('project').ignorePatterns);
30
-
31
- this.marked = new Marked();
32
- this.marked.use(markedTerminal() as any);
33
- }
34
-
35
- async run(filePath: string, options: ReviewOptions): Promise<void> {
36
- // Check auth
37
- if (!this.config.isAuthenticated()) {
38
- this.logger.error('Not authenticated. Run: vigthoria login');
39
- return;
40
- }
41
-
42
- // Read file
43
- const file = this.fileUtils.readFile(filePath);
44
- if (!file) {
45
- this.logger.error(`File not found: ${filePath}`);
46
- return;
47
- }
48
-
49
- this.logger.section(`Reviewing: ${file.relativePath}`);
50
- console.log(chalk.gray(`Language: ${file.language} | Lines: ${file.lines}`));
51
- console.log();
52
-
53
- const spinner = ora({
54
- text: 'Analyzing code quality...',
55
- spinner: 'dots',
56
- }).start();
57
-
58
- try {
59
- const review = await this.api.reviewCode(file.content, file.language);
60
-
61
- spinner.stop();
62
-
63
- // Format output
64
- switch (options.format) {
65
- case 'json':
66
- console.log(JSON.stringify(review, null, 2));
67
- break;
68
- case 'markdown':
69
- this.printMarkdownReview(review, file.relativePath);
70
- break;
71
- case 'text':
72
- default:
73
- this.printTextReview(review);
74
- break;
75
- }
76
-
77
- } catch (error) {
78
- spinner.stop();
79
- this.logger.error('Review failed:', (error as Error).message);
80
- }
81
- }
82
-
83
- private printTextReview(review: {
84
- score: number;
85
- issues: { type: string; line: number; message: string; severity: string }[];
86
- suggestions: string[];
87
- }): void {
88
- // Score
89
- const scoreColor = review.score >= 80 ? chalk.green : review.score >= 60 ? chalk.yellow : chalk.red;
90
- console.log();
91
- console.log(chalk.bold('Quality Score: ') + scoreColor(`${review.score}/100`));
92
- console.log(this.renderScoreBar(review.score));
93
- console.log();
94
-
95
- // Issues
96
- if (review.issues.length > 0) {
97
- this.logger.section(`Issues (${review.issues.length})`);
98
-
99
- review.issues.forEach((issue, i) => {
100
- const severityIcon = this.getSeverityIcon(issue.severity);
101
- const severityColor = this.getSeverityColor(issue.severity);
102
-
103
- console.log(
104
- severityColor(`${severityIcon} [${issue.type}]`) +
105
- chalk.gray(` Line ${issue.line}:`) +
106
- ` ${issue.message}`
107
- );
108
- });
109
- console.log();
110
- } else {
111
- this.logger.success('No issues found!');
112
- }
113
-
114
- // Suggestions
115
- if (review.suggestions.length > 0) {
116
- this.logger.section('Suggestions');
117
-
118
- review.suggestions.forEach((suggestion, i) => {
119
- console.log(chalk.cyan(`${i + 1}.`) + ` ${suggestion}`);
120
- });
121
- console.log();
122
- }
123
- }
124
-
125
- private printMarkdownReview(review: {
126
- score: number;
127
- issues: { type: string; line: number; message: string; severity: string }[];
128
- suggestions: string[];
129
- }, filePath: string): void {
130
- let markdown = `# Code Review: ${filePath}\n\n`;
131
- markdown += `## Score: ${review.score}/100\n\n`;
132
-
133
- if (review.issues.length > 0) {
134
- markdown += `## Issues\n\n`;
135
- review.issues.forEach(issue => {
136
- markdown += `- **[${issue.severity.toUpperCase()}]** Line ${issue.line}: ${issue.message} (${issue.type})\n`;
137
- });
138
- markdown += '\n';
139
- }
140
-
141
- if (review.suggestions.length > 0) {
142
- markdown += `## Suggestions\n\n`;
143
- review.suggestions.forEach((s, i) => {
144
- markdown += `${i + 1}. ${s}\n`;
145
- });
146
- }
147
-
148
- console.log(this.marked.parse(markdown));
149
- }
150
-
151
- private renderScoreBar(score: number): string {
152
- const width = 30;
153
- const filled = Math.round((score / 100) * width);
154
- const empty = width - filled;
155
-
156
- const color = score >= 80 ? chalk.green : score >= 60 ? chalk.yellow : chalk.red;
157
-
158
- return color('█'.repeat(filled)) + chalk.gray('░'.repeat(empty));
159
- }
160
-
161
- private getSeverityIcon(severity: string): string {
162
- switch (severity.toLowerCase()) {
163
- case 'error':
164
- return '✗';
165
- case 'warning':
166
- return '⚠';
167
- case 'info':
168
- return 'ℹ';
169
- default:
170
- return '•';
171
- }
172
- }
173
-
174
- private getSeverityColor(severity: string): typeof chalk {
175
- switch (severity.toLowerCase()) {
176
- case 'error':
177
- return chalk.red;
178
- case 'warning':
179
- return chalk.yellow;
180
- case 'info':
181
- return chalk.blue;
182
- default:
183
- return chalk.white;
184
- }
185
- }
186
- }