trace.ai-cli 1.1.9 ā 1.2.1
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/cli/traceAI.js +40 -40
- package/package.json +4 -4
- package/services/aiService.js +188 -213
- package/services/fileAnalyzer.js +135 -60
- package/utils/fileUtils.js +105 -100
package/cli/traceAI.js
CHANGED
|
@@ -26,16 +26,16 @@ class TraceAI {
|
|
|
26
26
|
async start() {
|
|
27
27
|
// Clear screen for clean start
|
|
28
28
|
console.clear();
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
// Animated startup sequence
|
|
31
31
|
await this.showLoadingAnimation();
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
// Main header with enhanced ASCII art
|
|
34
34
|
await this.displayHeader();
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
// Show welcome message and commands
|
|
37
37
|
this.displayWelcomeMessage();
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
// Start the interactive session
|
|
40
40
|
this.promptUser();
|
|
41
41
|
}
|
|
@@ -48,7 +48,7 @@ class TraceAI {
|
|
|
48
48
|
'Preparing analysis engines...',
|
|
49
49
|
'Ready to trace!'
|
|
50
50
|
];
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
for (let i = 0; i < messages.length; i++) {
|
|
53
53
|
for (let j = 0; j < 10; j++) {
|
|
54
54
|
process.stdout.write(`\r${chalk.blueBright(frames[j % frames.length])} ${chalk.white(messages[i])}`);
|
|
@@ -66,14 +66,14 @@ class TraceAI {
|
|
|
66
66
|
horizontalLayout: 'fitted',
|
|
67
67
|
verticalLayout: 'default'
|
|
68
68
|
});
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
// Enhanced header with gradient effect
|
|
71
71
|
console.log(chalk.bold.blueBright(asciiArt));
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
// Subtitle and version info
|
|
74
74
|
console.log(chalk.gray.bold(' ') + chalk.white.bold('AI powered CLI Platform'));
|
|
75
|
-
console.log(chalk.gray(' ') + chalk.gray('v1.
|
|
76
|
-
|
|
75
|
+
console.log(chalk.gray(' ') + chalk.gray('v1.2.0 | Powered by Mixkey'));
|
|
76
|
+
|
|
77
77
|
// Dynamic separator
|
|
78
78
|
const width = process.stdout.columns || 80;
|
|
79
79
|
console.log(chalk.blueBright('ā'.repeat(Math.min(width, 80))));
|
|
@@ -82,11 +82,11 @@ class TraceAI {
|
|
|
82
82
|
displayWelcomeMessage() {
|
|
83
83
|
// Welcome section with better formatting
|
|
84
84
|
console.log(chalk.bold.green('\nWelcome to Trace.AI CLI'));
|
|
85
|
-
console.log();
|
|
85
|
+
console.log();
|
|
86
86
|
// Enhanced command documentation
|
|
87
87
|
console.log(chalk.bold.cyan('š AVAILABLE COMMANDS'));
|
|
88
88
|
console.log(chalk.gray('ā'.repeat(50)));
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
const commands = [
|
|
91
91
|
{
|
|
92
92
|
cmd: '/file <path> [question]',
|
|
@@ -174,10 +174,10 @@ class TraceAI {
|
|
|
174
174
|
console.log(chalk.white('⢠Use ') + chalk.cyan('Tab') + chalk.white(' for auto-completion (when available)'));
|
|
175
175
|
console.log(chalk.white('⢠Start with ') + chalk.cyan('/file "your-file.js"') + chalk.white(' to analyze code'));
|
|
176
176
|
console.log(chalk.white('⢠Or just ask any question directly!'));
|
|
177
|
-
|
|
177
|
+
|
|
178
178
|
// Status bar
|
|
179
179
|
this.displayStatusBar();
|
|
180
|
-
|
|
180
|
+
|
|
181
181
|
console.log(chalk.gray('\n' + 'ā'.repeat(60)));
|
|
182
182
|
|
|
183
183
|
}
|
|
@@ -186,12 +186,12 @@ class TraceAI {
|
|
|
186
186
|
const uptime = Math.floor((new Date() - this.sessionStartTime) / 1000);
|
|
187
187
|
const contextCount = this.contexts.length;
|
|
188
188
|
const modeLabel = this.mode === 1 ? 'Fast' : this.mode === 2 ? 'Balanced' : 'Think';
|
|
189
|
-
|
|
189
|
+
|
|
190
190
|
console.log(chalk.gray('\nāā SESSION INFO ') + chalk.gray('ā'.repeat(34)));
|
|
191
|
-
console.log(chalk.gray('ā ') + chalk.white('Uptime: ') + chalk.green(`${uptime}s`) +
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
console.log(chalk.gray('ā ') + chalk.white('Uptime: ') + chalk.green(`${uptime}s`) +
|
|
192
|
+
chalk.gray(' ā ') + chalk.white('Contexts: ') + chalk.cyan(contextCount) +
|
|
193
|
+
chalk.gray(' ā ') + chalk.white('Queries: ') + chalk.blueBright(this.queryCount) +
|
|
194
|
+
chalk.gray(' ā ') + chalk.white('Mode: ') + chalk.magenta(modeLabel));
|
|
195
195
|
console.log(chalk.gray('āā') + chalk.gray('ā'.repeat(48)));
|
|
196
196
|
}
|
|
197
197
|
|
|
@@ -199,7 +199,7 @@ class TraceAI {
|
|
|
199
199
|
// Enhanced prompt with status indicators
|
|
200
200
|
const contextIndicator = this.contexts.length > 0 ? chalk.cyan(`[${this.contexts.length}]`) : '';
|
|
201
201
|
const prompt = `${chalk.bold.blueBright('Trace.Ai')} ${contextIndicator}${chalk.gray('>')} `;
|
|
202
|
-
|
|
202
|
+
|
|
203
203
|
this.rl.question(prompt, async (input) => {
|
|
204
204
|
try {
|
|
205
205
|
if (input.trim()) {
|
|
@@ -215,7 +215,7 @@ class TraceAI {
|
|
|
215
215
|
|
|
216
216
|
async handleInput(input) {
|
|
217
217
|
const trimmedInput = input.trim();
|
|
218
|
-
|
|
218
|
+
|
|
219
219
|
if (!trimmedInput) return;
|
|
220
220
|
|
|
221
221
|
// Command routing with enhanced feedback
|
|
@@ -236,7 +236,7 @@ class TraceAI {
|
|
|
236
236
|
|
|
237
237
|
// Find and execute command
|
|
238
238
|
const commandKey = Object.keys(commands).find(cmd => trimmedInput.startsWith(cmd));
|
|
239
|
-
|
|
239
|
+
|
|
240
240
|
if (commandKey) {
|
|
241
241
|
await commands[commandKey]();
|
|
242
242
|
} else {
|
|
@@ -254,7 +254,7 @@ class TraceAI {
|
|
|
254
254
|
await this.executeWithSpinner(
|
|
255
255
|
`Analyzing file: ${path.basename(filePath)}`,
|
|
256
256
|
async () => {
|
|
257
|
-
const result = await analyzeFile(path.resolve(filePath), query);
|
|
257
|
+
const result = await analyzeFile(path.resolve(filePath), query, this.mode);
|
|
258
258
|
this.displayResult('File Analysis', result.text, filePath);
|
|
259
259
|
}
|
|
260
260
|
);
|
|
@@ -336,12 +336,12 @@ class TraceAI {
|
|
|
336
336
|
|
|
337
337
|
console.log(chalk.bold.green('\nš ACTIVE CONTEXTS'));
|
|
338
338
|
console.log(chalk.gray('ā'.repeat(50)));
|
|
339
|
-
|
|
339
|
+
|
|
340
340
|
this.contexts.forEach((ctx, index) => {
|
|
341
341
|
const icon = ctx.type === 'file' ? 'š' : 'š';
|
|
342
342
|
const preview = ctx.content.substring(0, 80).replace(/\n/g, ' ');
|
|
343
343
|
const truncated = ctx.content.length > 80 ? '...' : '';
|
|
344
|
-
|
|
344
|
+
|
|
345
345
|
console.log(`${chalk.blueBright(icon)} ${chalk.bold(`[${index + 1}]`)} ${chalk.gray(ctx.timestamp)}`);
|
|
346
346
|
console.log(` ${chalk.white(preview)}${chalk.gray(truncated)}`);
|
|
347
347
|
if (index < this.contexts.length - 1) console.log();
|
|
@@ -365,26 +365,26 @@ class TraceAI {
|
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
displayHelp() {
|
|
368
|
-
|
|
368
|
+
|
|
369
369
|
console.log(chalk.bold.green('\nš DETAILED HELP GUIDE'));
|
|
370
370
|
console.log(chalk.gray('ā'.repeat(60)));
|
|
371
|
-
|
|
371
|
+
|
|
372
372
|
console.log(chalk.bold.cyan('\nšÆ GETTING STARTED'));
|
|
373
373
|
console.log('Trace.AI is an intelligent CLI tool that helps you understand and analyze files,');
|
|
374
374
|
console.log('folder structures, and images using advanced AI capabilities.\n');
|
|
375
|
-
|
|
375
|
+
|
|
376
376
|
console.log(chalk.bold.cyan('š” TIPS FOR BETTER RESULTS'));
|
|
377
377
|
console.log('⢠Be specific in your questions');
|
|
378
378
|
console.log('⢠Use context to provide background information');
|
|
379
379
|
console.log('⢠Combine multiple commands for comprehensive analysis');
|
|
380
380
|
console.log('⢠File paths with spaces should be quoted\n');
|
|
381
|
-
|
|
381
|
+
|
|
382
382
|
console.log(chalk.bold.cyan('š§ TROUBLESHOOTING'));
|
|
383
383
|
console.log('⢠Ensure file paths are correct and accessible');
|
|
384
384
|
console.log('⢠Check file permissions for read access');
|
|
385
385
|
console.log('⢠Use /stats to monitor your session');
|
|
386
386
|
console.log('⢠Use /clear screen to refresh the interface\n');
|
|
387
|
-
|
|
387
|
+
|
|
388
388
|
console.log(chalk.gray('Press any key to continue...'));
|
|
389
389
|
|
|
390
390
|
}
|
|
@@ -393,7 +393,7 @@ class TraceAI {
|
|
|
393
393
|
const uptime = Math.floor((new Date() - this.sessionStartTime) / 1000);
|
|
394
394
|
const minutes = Math.floor(uptime / 60);
|
|
395
395
|
const seconds = uptime % 60;
|
|
396
|
-
|
|
396
|
+
|
|
397
397
|
console.log(chalk.bold.green('\nš SESSION STATISTICS'));
|
|
398
398
|
console.log(chalk.gray('ā'.repeat(40)));
|
|
399
399
|
console.log(`${chalk.blueBright('š')} Session Duration: ${chalk.white(`${minutes}m ${seconds}s`)}`);
|
|
@@ -403,10 +403,10 @@ class TraceAI {
|
|
|
403
403
|
console.log(`${chalk.blueBright('š
')} Started: ${chalk.white(this.sessionStartTime.toLocaleString())}`);
|
|
404
404
|
console.log(chalk.gray('ā'.repeat(40)));
|
|
405
405
|
}
|
|
406
|
-
|
|
406
|
+
|
|
407
407
|
async handleSystemCommand(input) {
|
|
408
408
|
const query = input.substring('/system'.length).trim();
|
|
409
|
-
|
|
409
|
+
|
|
410
410
|
await this.executeWithSpinner(
|
|
411
411
|
'Retrieving system information',
|
|
412
412
|
async () => {
|
|
@@ -464,12 +464,12 @@ class TraceAI {
|
|
|
464
464
|
async executeWithSpinner(message, task) {
|
|
465
465
|
const frames = ['ā ', 'ā ', 'ā ¹', 'ā ø', 'ā ¼', 'ā “', 'ā ¦', 'ā §', 'ā ', 'ā '];
|
|
466
466
|
let frameIndex = 0;
|
|
467
|
-
|
|
467
|
+
|
|
468
468
|
const spinner = setInterval(() => {
|
|
469
469
|
process.stdout.write(`\r${chalk.blueBright(frames[frameIndex])} ${chalk.white(message)}`);
|
|
470
470
|
frameIndex = (frameIndex + 1) % frames.length;
|
|
471
471
|
}, 100);
|
|
472
|
-
|
|
472
|
+
|
|
473
473
|
try {
|
|
474
474
|
await task();
|
|
475
475
|
clearInterval(spinner);
|
|
@@ -498,30 +498,30 @@ class TraceAI {
|
|
|
498
498
|
}
|
|
499
499
|
|
|
500
500
|
close() {
|
|
501
|
-
|
|
501
|
+
|
|
502
502
|
// Farewell message
|
|
503
503
|
const farewell = figlet.textSync('Goodbye!', {
|
|
504
504
|
font: 'Small',
|
|
505
505
|
horizontalLayout: 'fitted'
|
|
506
506
|
});
|
|
507
|
-
|
|
507
|
+
|
|
508
508
|
console.log(chalk.blueBright(farewell));
|
|
509
509
|
console.log(chalk.gray('ā'.repeat(50)));
|
|
510
510
|
console.log(chalk.bold.green('Thank you for using Trace.AI!'));
|
|
511
|
-
|
|
511
|
+
|
|
512
512
|
// Session summary
|
|
513
513
|
const uptime = Math.floor((new Date() - this.sessionStartTime) / 1000);
|
|
514
514
|
const minutes = Math.floor(uptime / 60);
|
|
515
515
|
const seconds = uptime % 60;
|
|
516
|
-
|
|
516
|
+
|
|
517
517
|
console.log(chalk.gray(`Session Duration: ${minutes}m ${seconds}s`));
|
|
518
518
|
console.log(chalk.gray(`Total Queries: ${this.queryCount}`));
|
|
519
519
|
console.log(chalk.gray(`Contexts Used: ${this.contexts.length}`));
|
|
520
|
-
|
|
520
|
+
|
|
521
521
|
console.log(chalk.gray('ā'.repeat(50)));
|
|
522
522
|
console.log(chalk.cyan('Visit us at: https://traceai.netlify.app'));
|
|
523
523
|
console.log(chalk.gray('Have a great day! š\n'));
|
|
524
|
-
|
|
524
|
+
|
|
525
525
|
this.rl.close();
|
|
526
526
|
process.exit(0);
|
|
527
527
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trace.ai-cli",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "A powerful AI-powered CLI tool",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"node-fetch": "^2.6.7",
|
|
37
37
|
"ora": "^5.4.1",
|
|
38
38
|
"os-utils": "^0.0.14",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
39
|
+
"pdf-parse": "^1.1.1",
|
|
40
|
+
"systeminformation": "^5.27.1"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=14.0.0"
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
}
|