matex-cli 1.2.17 → 1.2.19
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/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +141 -58
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/help.d.ts +3 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +64 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/index.js +32 -17
- package/dist/index.js.map +1 -1
- package/dist/utils/tui.d.ts +13 -21
- package/dist/utils/tui.d.ts.map +1 -1
- package/dist/utils/tui.js +116 -93
- package/dist/utils/tui.js.map +1 -1
- package/package.json +2 -1
- package/src/commands/dev.ts +149 -63
- package/src/commands/help.ts +75 -0
- package/src/index.ts +32 -17
- package/src/utils/tui.ts +90 -99
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { TUI } from '../utils/tui';
|
|
4
|
+
|
|
5
|
+
export const helpCommand = new Command('help')
|
|
6
|
+
.description('Detailed guide for MATEX AI "Bro-Swarm" & Commands')
|
|
7
|
+
.action(() => {
|
|
8
|
+
TUI.init();
|
|
9
|
+
|
|
10
|
+
console.log(chalk.bold.cyan('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
|
|
11
|
+
console.log(chalk.bold.white(' 📖 MATEX :: THE BRO-SWARM FIELD GUIDE '));
|
|
12
|
+
console.log(chalk.bold.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
13
|
+
|
|
14
|
+
// 1. Meet the Brothers
|
|
15
|
+
TUI.drawBox('🧬 MEET THE BRO-SWARM',
|
|
16
|
+
`The MATEX "Bro-Swarm" is a tight-knit family of brothers with a shared history—from playing football in the mud to late-night PUBG marathons. They work in harmony, teasing each other lovingly while solving your tasks.
|
|
17
|
+
|
|
18
|
+
1. [Ajay Vai] (🚀) - The Lead Initiator (Youngest)
|
|
19
|
+
Vibe: High energy, eager, polite. He is a coding genius who coordinates the swarm. He often gets teased by his older brothers but remains the visionary leader.
|
|
20
|
+
|
|
21
|
+
2. [Sandip Dai] (🎨) - The Design Master (Second Youngest)
|
|
22
|
+
Vibe: Creative, focuses on "WOW" aesthetics. He shares nostalgic stories and loves to tease Ajay's "visionary" ramblings.
|
|
23
|
+
|
|
24
|
+
3. [Sunil Dai] (🧬) - The Logic Architect (Middle Brother)
|
|
25
|
+
Vibe: Wise mentor. He handles backend/logic. He reminds the "Vais" of the "old days" and provides motivational support.
|
|
26
|
+
|
|
27
|
+
4. [Bishal Dai] (🛠️) - The Senior Auditor
|
|
28
|
+
Vibe: Sharp-eyed and technical. He audits every line for bugs, syntax, and logic errors. He is Ajay's final supporter.
|
|
29
|
+
|
|
30
|
+
5. [Narayan Dai] (🛡️) - The Guardian (Oldest)
|
|
31
|
+
Vibe: Precise and protective. He validates security and cross-checks everything. He is the ultimate "Dai" who keeps everyone safe and on track.`,
|
|
32
|
+
chalk.magenta
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
console.log();
|
|
36
|
+
|
|
37
|
+
// 2. Core Commands
|
|
38
|
+
TUI.drawBox('🛠️ CORE COMMANDS',
|
|
39
|
+
`$ matex dev
|
|
40
|
+
The ultimate command. Starts a real-time interactive session with the full Bro-Swarm.
|
|
41
|
+
Best for building entire features, debugging complex issues, and architectural discussions.
|
|
42
|
+
|
|
43
|
+
$ matex code "prompt"
|
|
44
|
+
Surgical edit mode. Treat it like a precise laser for your files.
|
|
45
|
+
It uses SEARCH/REPLACE blocks for zero-waste, high-accuracy modifications.
|
|
46
|
+
|
|
47
|
+
$ matex ask "question"
|
|
48
|
+
Direct line to the AI. Best for quick explanations, documentation lookups, or logic checks.
|
|
49
|
+
|
|
50
|
+
$ matex chat
|
|
51
|
+
Traditional technical chat. Best for deep-diving into a topic without immediate file edits.`,
|
|
52
|
+
chalk.blue
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
console.log();
|
|
56
|
+
|
|
57
|
+
// 3. File Operations
|
|
58
|
+
TUI.drawBox('📂 FILE PROTOCOLS',
|
|
59
|
+
`MATEX uses special tags to manage your files securely:
|
|
60
|
+
|
|
61
|
+
<file path="path/to/file"> content </file>
|
|
62
|
+
Used by agents to create brand new files in your workspace.
|
|
63
|
+
|
|
64
|
+
<<<< SEARCH / ==== / >>>> REPLACE
|
|
65
|
+
Used for surgical edits to existing files. It finds the exact block and swaps it.
|
|
66
|
+
|
|
67
|
+
[⚡] Command Execution
|
|
68
|
+
Agents can propose shell commands (like npm install). MATEX will ALWAYS ask for your permission before running anything in your terminal.`,
|
|
69
|
+
chalk.green
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
console.log(chalk.cyan('\nPRO TIP: ') + chalk.white('Run ') + chalk.bold.white('matex models set matexcodex') + chalk.white(' for the best coding experience!\n'));
|
|
73
|
+
|
|
74
|
+
process.exit(0);
|
|
75
|
+
});
|
package/src/index.ts
CHANGED
|
@@ -9,9 +9,11 @@ import { modelsCommand } from './commands/models';
|
|
|
9
9
|
import { codeCommand } from './commands/code';
|
|
10
10
|
import { devCommand } from './commands/dev';
|
|
11
11
|
import { loginCommand } from './commands/login';
|
|
12
|
+
import { helpCommand } from './commands/help';
|
|
12
13
|
import { configManager } from './utils/config';
|
|
13
14
|
import { MatexAPIClient, ChatMessage } from './api/client';
|
|
14
15
|
import { spinner } from './utils/spinner';
|
|
16
|
+
import { TUI } from './utils/tui';
|
|
15
17
|
|
|
16
18
|
const program = new Command();
|
|
17
19
|
|
|
@@ -33,16 +35,12 @@ program.on('--help', () => {
|
|
|
33
35
|
console.log(chalk.bold.cyan('\n🚀 QUICK START GUIDE:'));
|
|
34
36
|
console.log(chalk.gray('────────────────────'));
|
|
35
37
|
console.log(chalk.white(' $ matex config set-key sk-...') + chalk.gray(' # Configure API Access'));
|
|
36
|
-
console.log(chalk.white(' $ matex
|
|
37
|
-
console.log(chalk.white(' $ matex
|
|
38
|
-
console.log(chalk.white(' $ matex code
|
|
39
|
-
console.log(chalk.white(' $ matex \"How do I fix X?\"') + chalk.gray(' # Direct question to AI'));
|
|
38
|
+
console.log(chalk.white(' $ matex dev') + chalk.gray(' # Start interactive "Bro-Swarm" dev session'));
|
|
39
|
+
console.log(chalk.white(' $ matex help') + chalk.gray(' # View detailed "Bro-Swarm" Field Guide'));
|
|
40
|
+
console.log(chalk.white(' $ matex code "Create a login" ') + chalk.gray(' # Surgical code edits'));
|
|
40
41
|
|
|
41
|
-
console.log(chalk.bold.
|
|
42
|
-
console.log(chalk.gray('
|
|
43
|
-
console.log(chalk.white(' matex dev ') + chalk.gray('➔ Best for building complex features with the multi-agent \"Bro-Swarm\".'));
|
|
44
|
-
console.log(chalk.white(' matex chat ') + chalk.gray('➔ Best for deep technical discussions and knowledge search.'));
|
|
45
|
-
console.log(chalk.white(' matex code ') + chalk.gray('➔ Best for quick, one-off file modifications and unit tests.'));
|
|
42
|
+
console.log(chalk.bold.yellow('\n💡 NEW: The "Bro-Swarm" has arrived!'));
|
|
43
|
+
console.log(chalk.gray('Run ') + chalk.bold.white('matex help') + chalk.gray(' to meet Ajay, Sunil, Sandip, and Narayan.'));
|
|
46
44
|
|
|
47
45
|
console.log();
|
|
48
46
|
console.log(chalk.gray('Get your API key from: ') + chalk.cyan('https://matexai.space/platform'));
|
|
@@ -57,6 +55,7 @@ program.addCommand(modelsCommand);
|
|
|
57
55
|
program.addCommand(codeCommand);
|
|
58
56
|
program.addCommand(devCommand);
|
|
59
57
|
program.addCommand(loginCommand);
|
|
58
|
+
program.addCommand(helpCommand);
|
|
60
59
|
|
|
61
60
|
// Handle direct input (no subcommand)
|
|
62
61
|
const args = process.argv.slice(2);
|
|
@@ -87,15 +86,19 @@ if (args.length > 0 && !args[0].startsWith('-') && !knownCommands.includes(args[
|
|
|
87
86
|
role: 'system', content: `## 🧬 SYSTEM IDENTITY: MATEX "BRO-SWARM" ENGINEERING
|
|
88
87
|
You are a tight-knit family of expert Nepali engineering brothers ("Vais" and "Dais").
|
|
89
88
|
|
|
90
|
-
### 👥 THE BROTHERS:
|
|
91
|
-
1. **[Ajay Vai] (🚀)**: Lead
|
|
92
|
-
2. **[
|
|
93
|
-
3. **[
|
|
94
|
-
4. **[
|
|
89
|
+
### 👥 THE BROTHERS (By Age & Respect):
|
|
90
|
+
1. **[Ajay Vai] (🚀)**: The Smallest Brother. Lead Initiator & Coordinator.
|
|
91
|
+
2. **[Sandip Dai] (🎨)**: Small Brother. UI/UX Specialist.
|
|
92
|
+
3. **[Sunil Dai] (🧬)**: Middle Brother. Logic Architect.
|
|
93
|
+
4. **[Bishal Dai] (🛠️)**: Senior Auditor. Syntax & Logic checker.
|
|
94
|
+
5. **[Narayan Dai] (🛡️)**: The Biggest Brother. Senior Validator.
|
|
95
95
|
|
|
96
96
|
### 💬 COLLABORATIVE "BRO-VIBE" PROTOCOL:
|
|
97
|
-
- **
|
|
98
|
-
- **NEPALI FLAVOR:** Use terms like "
|
|
97
|
+
- **FAMILY LOVE:** The brothers show deep respect. Older brothers protect and love Ajay Vai.
|
|
98
|
+
- **NEPALI FLAVOR:** Use terms like "K cha?", "Huncha", "Lau hai", "Tapai" naturally.
|
|
99
|
+
- **STORYTELLING & TEASING:** Share nostalgic memories and friendly teasing.
|
|
100
|
+
- **AUDIT FLOW:** Ajay asks Bishal Dai for a check before the final summary.
|
|
101
|
+
- **AJAY's SUMMARY:** Ajay Vai provides a premium, bold summary at the end.
|
|
99
102
|
|
|
100
103
|
### ✂️ BREVITY AS POWER:
|
|
101
104
|
- **NO FULL FILE DUMPS:** Never 'cat' a file to read it. Use grep/head.
|
|
@@ -135,7 +138,19 @@ ${context}`
|
|
|
135
138
|
|
|
136
139
|
// Display response
|
|
137
140
|
console.log(chalk.cyan(`\n💻 MATEXCodex (Step ${loopCount}):\n`));
|
|
138
|
-
|
|
141
|
+
|
|
142
|
+
let displayResponse = response;
|
|
143
|
+
const summaryMatch = response.match(/<summary>([\s\S]*?)<\/summary>/);
|
|
144
|
+
if (summaryMatch) {
|
|
145
|
+
const summaryContent = summaryMatch[1].trim();
|
|
146
|
+
displayResponse = response.replace(/<summary>[\s\S]*?<\/summary>/, '').trim();
|
|
147
|
+
if (displayResponse) {
|
|
148
|
+
console.log(chalk.white(displayResponse));
|
|
149
|
+
}
|
|
150
|
+
TUI.drawSummaryBox(summaryContent);
|
|
151
|
+
} else {
|
|
152
|
+
console.log(chalk.white(response));
|
|
153
|
+
}
|
|
139
154
|
console.log();
|
|
140
155
|
|
|
141
156
|
// Auto-execute commands (Ollama-style)
|
package/src/utils/tui.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import readline from 'readline';
|
|
2
|
+
import * as readline from 'readline';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* TUI Management for MATEX CLI "God-Mode"
|
|
6
|
-
* Handles screen buffers, persistent headers, and real-time status updates.
|
|
7
|
-
*/
|
|
8
4
|
export class TUI {
|
|
9
5
|
private static isInitialized = false;
|
|
10
|
-
private static
|
|
6
|
+
private static lastStatus = '';
|
|
11
7
|
|
|
12
8
|
/**
|
|
13
9
|
* Initialize the TUI Mode
|
|
@@ -15,13 +11,8 @@ export class TUI {
|
|
|
15
11
|
static init() {
|
|
16
12
|
if (this.isInitialized) return;
|
|
17
13
|
|
|
18
|
-
// Enter alternative screen buffer
|
|
19
|
-
process.stdout.write('\x1b[?1049h');
|
|
20
|
-
|
|
21
14
|
// Hide cursor
|
|
22
15
|
process.stdout.write('\x1b[?25l');
|
|
23
|
-
|
|
24
|
-
this.clear();
|
|
25
16
|
this.isInitialized = true;
|
|
26
17
|
|
|
27
18
|
// Ensure clean exit
|
|
@@ -37,137 +28,137 @@ export class TUI {
|
|
|
37
28
|
|
|
38
29
|
// Show cursor
|
|
39
30
|
process.stdout.write('\x1b[?25h');
|
|
40
|
-
|
|
41
|
-
// Exit alternative screen buffer
|
|
42
|
-
process.stdout.write('\x1b[?1049l');
|
|
43
|
-
|
|
44
31
|
this.isInitialized = false;
|
|
45
|
-
process.exit();
|
|
46
32
|
}
|
|
47
33
|
|
|
48
34
|
/**
|
|
49
|
-
* Clear the
|
|
35
|
+
* Clear the terminal
|
|
50
36
|
*/
|
|
51
37
|
static clear() {
|
|
52
|
-
process.stdout.write('\x1b[2J\x1b[
|
|
53
|
-
this.drawHeader();
|
|
54
|
-
this.drawStatusBar(this.currentStatus, true);
|
|
38
|
+
process.stdout.write('\x1b[2J\x1b[0;0H');
|
|
55
39
|
}
|
|
56
40
|
|
|
57
41
|
/**
|
|
58
|
-
* Draw the
|
|
42
|
+
* Draw a premium status bar at the bottom using Save/Restore cursor
|
|
59
43
|
*/
|
|
60
|
-
static
|
|
44
|
+
static drawStatusBar(message: string, force: boolean = false) {
|
|
45
|
+
if (!this.isInitialized) return;
|
|
46
|
+
if (!force && message === this.lastStatus) return;
|
|
47
|
+
this.lastStatus = message;
|
|
48
|
+
|
|
61
49
|
const width = process.stdout.columns || 80;
|
|
62
|
-
const
|
|
63
|
-
const padding = Math.max(0, Math.floor((width - banner.length) / 2));
|
|
50
|
+
const height = process.stdout.rows || 24;
|
|
64
51
|
|
|
65
|
-
//
|
|
66
|
-
process.stdout.write('\x1b[
|
|
67
|
-
process.stdout
|
|
68
|
-
process.stdout.write(
|
|
52
|
+
// Save cursor (\x1b[s), move to bottom, write, restore cursor (\x1b[u)
|
|
53
|
+
process.stdout.write('\x1b[s');
|
|
54
|
+
readline.cursorTo(process.stdout, 0, height - 1);
|
|
55
|
+
process.stdout.write(
|
|
56
|
+
chalk.bgBlue.white.bold(' 🧠 MATEX ') +
|
|
57
|
+
chalk.bgGray.white(` ${message.padEnd(width - 10)} `)
|
|
58
|
+
);
|
|
59
|
+
process.stdout.write('\x1b[u');
|
|
69
60
|
}
|
|
70
61
|
|
|
71
62
|
/**
|
|
72
|
-
*
|
|
63
|
+
* Draw a box with a title and content
|
|
73
64
|
*/
|
|
74
|
-
|
|
65
|
+
static drawBox(title: string, content: string, color: (s: string) => string = chalk.gray) {
|
|
75
66
|
const width = Math.min(process.stdout.columns || 80, 100);
|
|
67
|
+
const lines = content.split('\n');
|
|
76
68
|
|
|
77
|
-
console.log();
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
console.log(chalk.gray('┏' + '━'.repeat(width - 2) + '┓'));
|
|
82
|
-
console.log(chalk.gray('┃ ') + trafficLights + ' ' + color(displayTitle).padEnd(width - 4) + chalk.gray(' ┃'));
|
|
83
|
-
console.log(chalk.gray('┣' + '━'.repeat(width - 2) + '┫'));
|
|
69
|
+
console.log(color('┏' + '━'.repeat(width - 2) + '┓'));
|
|
70
|
+
console.log(color('┃ ') + chalk.bold(title).padEnd(width - 4) + color(' ┃'));
|
|
71
|
+
console.log(color('┣' + '━'.repeat(width - 2) + '┫'));
|
|
84
72
|
|
|
85
73
|
lines.forEach(line => {
|
|
86
|
-
const
|
|
87
|
-
|
|
74
|
+
const contentWidth = width - 4;
|
|
75
|
+
let remaining = line;
|
|
76
|
+
if (remaining.length === 0) {
|
|
77
|
+
console.log(color('┃ ') + ' '.repeat(contentWidth) + color(' ┃'));
|
|
78
|
+
}
|
|
79
|
+
while (remaining.length > 0) {
|
|
80
|
+
const chunk = remaining.substring(0, contentWidth);
|
|
81
|
+
console.log(color('┃ ') + chalk.white(chunk.padEnd(contentWidth)) + color(' ┃'));
|
|
82
|
+
remaining = remaining.substring(contentWidth);
|
|
83
|
+
}
|
|
88
84
|
});
|
|
89
85
|
|
|
90
|
-
console.log(
|
|
91
|
-
console.log();
|
|
86
|
+
console.log(color('┗' + '━'.repeat(width - 2) + '┛'));
|
|
92
87
|
}
|
|
93
88
|
|
|
94
89
|
/**
|
|
95
|
-
* Draw a
|
|
90
|
+
* Draw a premium code container with traffic lights
|
|
96
91
|
*/
|
|
97
|
-
static
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
this.currentStatus = status;
|
|
102
|
-
const width = process.stdout.columns || 80;
|
|
103
|
-
const height = process.stdout.rows || 24;
|
|
92
|
+
static drawCodeContainer(title: string, lang: string, code: string) {
|
|
93
|
+
const width = Math.min(process.stdout.columns || 80, 100);
|
|
94
|
+
const codeLines = code.split('\n');
|
|
104
95
|
|
|
105
|
-
|
|
106
|
-
|
|
96
|
+
const trafficLights = chalk.red('●') + ' ' + chalk.yellow('●') + ' ' + chalk.green('●');
|
|
97
|
+
const headerTitle = ` 📄 ${title} (${lang}) `;
|
|
107
98
|
|
|
108
|
-
|
|
109
|
-
|
|
99
|
+
console.log(chalk.gray('\n┏' + '━'.repeat(width - 2) + '┓'));
|
|
100
|
+
console.log(chalk.gray('┃ ') + trafficLights + ' ' + chalk.cyan.bold(headerTitle).padEnd(width - 10) + chalk.gray(' ┃'));
|
|
101
|
+
console.log(chalk.gray('┣' + '━'.repeat(width - 2) + '┫'));
|
|
110
102
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
103
|
+
codeLines.forEach(line => {
|
|
104
|
+
const contentWidth = width - 6;
|
|
105
|
+
let remaining = line;
|
|
106
|
+
if (remaining.length === 0) {
|
|
107
|
+
console.log(chalk.gray('┃ ') + ' '.repeat(contentWidth) + chalk.gray(' ┃'));
|
|
108
|
+
}
|
|
109
|
+
while (remaining.length > 0) {
|
|
110
|
+
const chunk = remaining.substring(0, contentWidth);
|
|
111
|
+
console.log(chalk.gray('┃ ') + chalk.hex('#e0e0e0')(chunk.padEnd(contentWidth)) + chalk.gray(' ┃'));
|
|
112
|
+
remaining = remaining.substring(contentWidth);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
114
115
|
|
|
115
|
-
|
|
116
|
-
process.stdout.write('\x1b[u');
|
|
116
|
+
console.log(chalk.gray('┗' + '━'.repeat(width - 2) + '┛\n'));
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
|
-
* Draw a premium
|
|
120
|
+
* Draw a premium summary box for Ajay Vai's final report
|
|
121
121
|
*/
|
|
122
|
-
static
|
|
123
|
-
const
|
|
124
|
-
|
|
122
|
+
static drawSummaryBox(content: string) {
|
|
123
|
+
const width = Math.min(process.stdout.columns || 80, 100);
|
|
124
|
+
const lines = content.split('\n');
|
|
125
|
+
|
|
126
|
+
console.log(chalk.magenta.bold('\n┏━━━━━ ✅ AJAY VAI\'S WORK SUMMARY ━━━━━┓'));
|
|
127
|
+
|
|
128
|
+
lines.forEach(line => {
|
|
129
|
+
const contentWidth = width - 4;
|
|
130
|
+
let remaining = line.replace(/\*\*/g, ''); // Strip markdown bold for internal wrapping
|
|
131
|
+
|
|
132
|
+
if (remaining.trim().length === 0) {
|
|
133
|
+
console.log(chalk.magenta.bold('┃ ') + ' '.repeat(contentWidth) + chalk.magenta.bold(' ┃'));
|
|
134
|
+
} else {
|
|
135
|
+
while (remaining.length > 0) {
|
|
136
|
+
const chunk = remaining.substring(0, contentWidth);
|
|
137
|
+
console.log(chalk.magenta.bold('┃ ') + chalk.white.bold(chunk.padEnd(contentWidth)) + chalk.magenta.bold(' ┃'));
|
|
138
|
+
remaining = remaining.substring(contentWidth);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
console.log(chalk.magenta.bold('┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n'));
|
|
125
144
|
}
|
|
126
145
|
|
|
127
146
|
/**
|
|
128
|
-
* Draw a message
|
|
147
|
+
* Draw a specialized message container for agents
|
|
129
148
|
*/
|
|
130
149
|
static drawMessageContainer(agent: string, message: string) {
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
'Sandip Dai': chalk.hex('#FF69B4').bold,
|
|
136
|
-
'Narayan Dai': chalk.green.bold
|
|
137
|
-
};
|
|
138
|
-
const color = colorMap[agent] || chalk.white.bold;
|
|
139
|
-
this.drawBox(agent, color, lines, '🗣️');
|
|
140
|
-
}
|
|
150
|
+
const color = agent.includes('Ajay') ? chalk.magenta :
|
|
151
|
+
agent.includes('Sunil') ? chalk.blue :
|
|
152
|
+
agent.includes('Sandip') ? chalk.hex('#FF69B4') :
|
|
153
|
+
chalk.green;
|
|
141
154
|
|
|
142
|
-
|
|
143
|
-
* Wrap text to a specific width
|
|
144
|
-
*/
|
|
145
|
-
private static wrapText(text: string, width: number): string[] {
|
|
146
|
-
const words = text.split(' ');
|
|
147
|
-
const lines = [];
|
|
148
|
-
let currentLine = '';
|
|
149
|
-
|
|
150
|
-
words.forEach(word => {
|
|
151
|
-
if ((currentLine + word).length < width) {
|
|
152
|
-
currentLine += (currentLine ? ' ' : '') + word;
|
|
153
|
-
} else {
|
|
154
|
-
lines.push(currentLine);
|
|
155
|
-
currentLine = word;
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
if (currentLine) lines.push(currentLine);
|
|
159
|
-
return lines;
|
|
155
|
+
this.drawBox(`🤖 ${agent}`, message, color);
|
|
160
156
|
}
|
|
161
157
|
|
|
162
158
|
/**
|
|
163
|
-
*
|
|
159
|
+
* Simple log with a prefix
|
|
164
160
|
*/
|
|
165
|
-
static log(
|
|
166
|
-
|
|
167
|
-
console.log(content);
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
// Ensure we don't overwrite the status bar
|
|
171
|
-
console.log(content);
|
|
161
|
+
static log(message: string) {
|
|
162
|
+
console.log(chalk.gray(` [⚡] ${message}`));
|
|
172
163
|
}
|
|
173
164
|
}
|