matex-cli 1.2.50 → 1.2.51
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/.agents/skills/mcp-server-dev/SKILL.md +60 -0
- package/.agents/skills/mcp-server-dev/examples/basic-ts-server/package.json +20 -0
- package/.agents/skills/mcp-server-dev/examples/basic-ts-server/src/index.ts +66 -0
- package/.agents/skills/mcp-server-dev/resources/best_practices.md +20 -0
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +19 -8
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +2 -1
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/student.d.ts.map +1 -1
- package/dist/commands/student.js +2 -0
- package/dist/commands/student.js.map +1 -1
- package/dist/commands/study.d.ts.map +1 -1
- package/dist/commands/study.js +4 -1
- package/dist/commands/study.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/utils/agent-orchestrator.d.ts +3 -0
- package/dist/utils/agent-orchestrator.d.ts.map +1 -1
- package/dist/utils/agent-orchestrator.js +14 -12
- package/dist/utils/agent-orchestrator.js.map +1 -1
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +5 -1
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/patcher.d.ts.map +1 -1
- package/dist/utils/patcher.js +2 -5
- package/dist/utils/patcher.js.map +1 -1
- package/dist/utils/tui.d.ts +17 -2
- package/dist/utils/tui.d.ts.map +1 -1
- package/dist/utils/tui.js +82 -17
- package/dist/utils/tui.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/chat.ts +18 -7
- package/src/commands/dev.ts +2 -1
- package/src/commands/student.ts +2 -0
- package/src/commands/study.ts +4 -1
- package/src/index.ts +14 -11
- package/src/utils/agent-orchestrator.ts +16 -13
- package/src/utils/config.ts +5 -1
- package/src/utils/patcher.ts +2 -5
- package/src/utils/tui.ts +97 -17
package/src/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { broCommand } from './commands/bro';
|
|
|
10
10
|
import { studyCommand } from './commands/study';
|
|
11
11
|
import { studentCommand } from './commands/student';
|
|
12
12
|
import { TUI } from './utils/tui';
|
|
13
|
+
import { AgentOrchestrator } from './utils/agent-orchestrator';
|
|
13
14
|
|
|
14
15
|
const packageJson = require('../package.json');
|
|
15
16
|
|
|
@@ -44,7 +45,8 @@ config
|
|
|
44
45
|
.description('Set default AI model')
|
|
45
46
|
.action((model: string) => {
|
|
46
47
|
configManager.setDefaultModel(model);
|
|
47
|
-
|
|
48
|
+
const savedModel = configManager.getDefaultModel();
|
|
49
|
+
console.log(chalk.green(`✅ Default model set to: ${savedModel}`));
|
|
48
50
|
});
|
|
49
51
|
|
|
50
52
|
config
|
|
@@ -83,6 +85,9 @@ program
|
|
|
83
85
|
|
|
84
86
|
const client = new MatexAPIClient(apiKey, configManager.getBaseURL());
|
|
85
87
|
|
|
88
|
+
TUI.init();
|
|
89
|
+
AgentOrchestrator.setMode('dev');
|
|
90
|
+
|
|
86
91
|
// Observation Phase
|
|
87
92
|
const fs = require('fs');
|
|
88
93
|
const files = fs.readdirSync(process.cwd()).slice(0, 20).join(', '); // fast list
|
|
@@ -187,14 +192,14 @@ ${context}`
|
|
|
187
192
|
if (!technicalType && (codeBlockMatch || fileStartMatch || patchStartMatch || summaryStartMatch)) {
|
|
188
193
|
if (codeBlockMatch) {
|
|
189
194
|
technicalType = 'code';
|
|
190
|
-
codeLang = codeBlockMatch[1] || 'bash';
|
|
191
|
-
|
|
195
|
+
codeLang = (codeBlockMatch[1] || 'bash').toUpperCase();
|
|
196
|
+
TUI.drawStreamingStart('TECHNICAL BLOCK', codeLang);
|
|
192
197
|
} else if (fileStartMatch) {
|
|
193
198
|
technicalType = 'file';
|
|
194
|
-
|
|
199
|
+
TUI.drawStreamingStart('NEW FILE', fileStartMatch[1]);
|
|
195
200
|
} else if (patchStartMatch) {
|
|
196
201
|
technicalType = 'patch';
|
|
197
|
-
|
|
202
|
+
TUI.drawStreamingStart('PATCH', 'SURGICAL EDIT');
|
|
198
203
|
} else if (summaryStartMatch) {
|
|
199
204
|
technicalType = 'summary';
|
|
200
205
|
process.stdout.write(chalk.magenta('\n [📝] Generating Ajay\'s Work Summary...\n'));
|
|
@@ -213,12 +218,7 @@ ${context}`
|
|
|
213
218
|
if (technicalType === 'summary') {
|
|
214
219
|
TUI.drawSummaryBox(displayContent);
|
|
215
220
|
} else {
|
|
216
|
-
TUI.
|
|
217
|
-
technicalType === 'file' ? 'New File' :
|
|
218
|
-
technicalType === 'patch' ? 'Patch' : 'Code Block',
|
|
219
|
-
technicalType === 'code' ? codeLang : 'text',
|
|
220
|
-
displayContent
|
|
221
|
-
);
|
|
221
|
+
TUI.drawStreamingEnd();
|
|
222
222
|
}
|
|
223
223
|
technicalBuffer = '';
|
|
224
224
|
technicalType = null;
|
|
@@ -229,6 +229,9 @@ ${context}`
|
|
|
229
229
|
// 3. Content Handling
|
|
230
230
|
if (technicalType) {
|
|
231
231
|
technicalBuffer += line + '\n';
|
|
232
|
+
if (technicalType !== 'summary') {
|
|
233
|
+
TUI.drawStreamingLine(line);
|
|
234
|
+
}
|
|
232
235
|
continue;
|
|
233
236
|
}
|
|
234
237
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { TUI } from './tui';
|
|
2
|
+
import { TUI, TUIMode } from './tui';
|
|
3
3
|
|
|
4
4
|
export type AgentRole = 'Architect' | 'Syntax' | 'Frontend' | 'Backend' | 'System' | 'Commander' | 'Researcher' | 'Ajay Vai' | 'Sunil Dai' | 'Sandip Dai' | 'Narayan Dai' | 'Bishal Dai' | 'Big Bro';
|
|
5
5
|
|
|
@@ -78,6 +78,12 @@ const AGENT_CONFIGS: Record<AgentRole, AgentConfig> = {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
export class AgentOrchestrator {
|
|
81
|
+
private static currentMode: TUIMode = 'dev';
|
|
82
|
+
|
|
83
|
+
static setMode(mode: TUIMode) {
|
|
84
|
+
this.currentMode = mode;
|
|
85
|
+
TUI.setTheme(mode);
|
|
86
|
+
}
|
|
81
87
|
/**
|
|
82
88
|
* Clean text of unwanted AI artifacts like $$**, \(, \), ***%%, **:**, etc.
|
|
83
89
|
*/
|
|
@@ -108,13 +114,8 @@ export class AgentOrchestrator {
|
|
|
108
114
|
const width = Math.min(process.stdout.columns || 80, 100);
|
|
109
115
|
TUI.drawStatusBar(`${config.name} is speaking...`);
|
|
110
116
|
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
const nameText = `${config.icon} ${config.name}`;
|
|
114
|
-
const namePad = Math.max(0, width - 4 - nameText.length);
|
|
115
|
-
const nameStyled = config.color(config.name);
|
|
116
|
-
console.log(chalk.gray('┃ ') + config.icon + ' ' + nameStyled + ' '.repeat(namePad) + chalk.gray(' ┃'));
|
|
117
|
-
console.log(chalk.gray('┣' + '━'.repeat(width - 2) + '┫'));
|
|
117
|
+
// Premium Header
|
|
118
|
+
TUI.drawPremiumHeader(config.name, config.icon, config.color);
|
|
118
119
|
|
|
119
120
|
// Box Content (Word-based Wrap)
|
|
120
121
|
const contentWidth = width - 8;
|
|
@@ -136,7 +137,8 @@ export class AgentOrchestrator {
|
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
// Box Footer
|
|
139
|
-
|
|
140
|
+
const theme = TUI.getModeTheme(this.currentMode);
|
|
141
|
+
console.log(theme.shadow(`${theme.border.repeat(width / theme.border.length)}`));
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
/**
|
|
@@ -180,13 +182,14 @@ export class AgentOrchestrator {
|
|
|
180
182
|
console.log(chalk.gray(`├${'─'.repeat(width)}┤`));
|
|
181
183
|
|
|
182
184
|
if (output) {
|
|
183
|
-
const outLines = output.split('\n').filter(l => l.trim())
|
|
184
|
-
outLines.
|
|
185
|
+
const outLines = output.split('\n').filter(l => l.trim());
|
|
186
|
+
const displayLines = outLines.slice(0, 8);
|
|
187
|
+
displayLines.forEach(l => {
|
|
185
188
|
const truncated = l.length > width - 4 ? l.substring(0, width - 7) + '...' : l;
|
|
186
189
|
console.log(chalk.gray('│ ') + chalk.white(truncated.padEnd(width - 2)) + chalk.gray(' │'));
|
|
187
190
|
});
|
|
188
|
-
if (
|
|
189
|
-
console.log(chalk.gray('│ ') + chalk.
|
|
191
|
+
if (outLines.length > 8) {
|
|
192
|
+
console.log(chalk.gray('│ ') + chalk.hex('#06b6d4').bold(` ^ [ ${outLines.length - 8} MORE LINES • USE ^ TO SEE ALL ] ^`).padEnd(width - 2) + chalk.gray(' │'));
|
|
190
193
|
}
|
|
191
194
|
}
|
|
192
195
|
|
package/src/utils/config.ts
CHANGED
|
@@ -66,7 +66,11 @@ export class ConfigManager {
|
|
|
66
66
|
*/
|
|
67
67
|
setDefaultModel(model: string): void {
|
|
68
68
|
const config = this.loadConfig();
|
|
69
|
-
|
|
69
|
+
let normalizedModel = model.toLowerCase().trim().replace(/\s+/g, '');
|
|
70
|
+
if (normalizedModel === 'matexfree') {
|
|
71
|
+
normalizedModel = 'matex-free';
|
|
72
|
+
}
|
|
73
|
+
config.defaultModel = normalizedModel;
|
|
70
74
|
this.saveConfig(config);
|
|
71
75
|
}
|
|
72
76
|
|
package/src/utils/patcher.ts
CHANGED
|
@@ -217,14 +217,11 @@ export class Patcher {
|
|
|
217
217
|
console.log(greenGlow(' │ ') + chalk.bgGreen.black(' + ') + ' ' + greenGlow(displayLine.padEnd(width - 10)) + greenGlow(' │'));
|
|
218
218
|
});
|
|
219
219
|
|
|
220
|
-
if (
|
|
221
|
-
console.log(greenGlow(' │ ') + chalk.
|
|
220
|
+
if (replaceLines.length > 8) {
|
|
221
|
+
console.log(greenGlow(' │ ') + chalk.hex('#06b6d4').bold(` ^ [ ${replaceLines.length - 8} MORE LINES • USE ^ TO SEE ALL ] ^`).padEnd(width - 6) + greenGlow(' │'));
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
console.log(border(` └${'─'.repeat(width - 4)}┘`));
|
|
225
|
-
if (shouldTruncate) {
|
|
226
|
-
console.log(chalk.gray(' (Minimized view. Use full response or "v" to see all changes.)'));
|
|
227
|
-
}
|
|
228
225
|
console.log();
|
|
229
226
|
|
|
230
227
|
return shouldTruncate;
|
package/src/utils/tui.ts
CHANGED
|
@@ -2,9 +2,74 @@ import chalk from 'chalk';
|
|
|
2
2
|
import * as readline from 'readline';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
|
|
5
|
+
export type TUIMode = 'dev' | 'study' | 'chat' | 'student';
|
|
6
|
+
|
|
7
|
+
export interface ModeTheme {
|
|
8
|
+
primary: (s: string) => string;
|
|
9
|
+
secondary: (s: string) => string;
|
|
10
|
+
border: string;
|
|
11
|
+
glow: (s: string) => string;
|
|
12
|
+
shadow: (s: string) => string;
|
|
13
|
+
bg: string;
|
|
14
|
+
icon: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
5
17
|
export class TUI {
|
|
6
18
|
private static isInitialized = false;
|
|
7
19
|
private static lastStatus = '';
|
|
20
|
+
private static streamingLineCount = 0;
|
|
21
|
+
private static isStreamingTruncated = false;
|
|
22
|
+
private static currentTheme: TUIMode = 'dev';
|
|
23
|
+
|
|
24
|
+
static getModeTheme(mode: TUIMode): ModeTheme {
|
|
25
|
+
switch (mode) {
|
|
26
|
+
case 'study':
|
|
27
|
+
return {
|
|
28
|
+
primary: chalk.hex('#10b981'), // Emerald
|
|
29
|
+
secondary: chalk.hex('#064e3b'),
|
|
30
|
+
border: '▞',
|
|
31
|
+
glow: chalk.hex('#34d399'),
|
|
32
|
+
shadow: chalk.hex('#064e3b'),
|
|
33
|
+
bg: '#064e3b',
|
|
34
|
+
icon: '🎓'
|
|
35
|
+
};
|
|
36
|
+
case 'chat':
|
|
37
|
+
return {
|
|
38
|
+
primary: chalk.hex('#a855f7'), // Purple
|
|
39
|
+
secondary: chalk.hex('#3b0764'),
|
|
40
|
+
border: '✧',
|
|
41
|
+
glow: chalk.hex('#c084fc'),
|
|
42
|
+
shadow: chalk.hex('#3b0764'),
|
|
43
|
+
bg: '#3b0764',
|
|
44
|
+
icon: '💬'
|
|
45
|
+
};
|
|
46
|
+
case 'student':
|
|
47
|
+
return {
|
|
48
|
+
primary: chalk.hex('#f59e0b'), // Amber
|
|
49
|
+
secondary: chalk.hex('#451a03'),
|
|
50
|
+
border: '▓',
|
|
51
|
+
glow: chalk.hex('#fbbf24'),
|
|
52
|
+
shadow: chalk.hex('#451a03'),
|
|
53
|
+
bg: '#451a03',
|
|
54
|
+
icon: '🛡️'
|
|
55
|
+
};
|
|
56
|
+
case 'dev':
|
|
57
|
+
default:
|
|
58
|
+
return {
|
|
59
|
+
primary: chalk.hex('#06b6d4'), // Cyan
|
|
60
|
+
secondary: chalk.hex('#164e63'),
|
|
61
|
+
border: '░',
|
|
62
|
+
glow: chalk.hex('#22d3ee'),
|
|
63
|
+
shadow: chalk.hex('#083344'),
|
|
64
|
+
bg: '#164e63',
|
|
65
|
+
icon: '⚡'
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static setTheme(mode: TUIMode) {
|
|
71
|
+
this.currentTheme = mode;
|
|
72
|
+
}
|
|
8
73
|
|
|
9
74
|
/**
|
|
10
75
|
* Initialize the TUI Mode
|
|
@@ -70,7 +135,8 @@ export class TUI {
|
|
|
70
135
|
|
|
71
136
|
if (width <= 0 || height <= 0) return;
|
|
72
137
|
|
|
73
|
-
const
|
|
138
|
+
const theme = this.getModeTheme(this.currentTheme);
|
|
139
|
+
const leftTag = chalk.bgHex('#1E1E1E').hex(theme.bg).bold(` ${theme.icon} MATEX `);
|
|
74
140
|
const mainMessage = chalk.bgHex('#1E1E1E').white(` ${message} `);
|
|
75
141
|
const remainingWidth = width - (leftTag.length + mainMessage.length);
|
|
76
142
|
const spacer = chalk.bgHex('#1E1E1E')(' '.repeat(Math.max(0, remainingWidth)));
|
|
@@ -109,7 +175,7 @@ export class TUI {
|
|
|
109
175
|
console.log(glow(' │ ') + chalk.bgHex('#164e63').white.bold(header) + border('─'.repeat(hPad)) + glow(' │'));
|
|
110
176
|
|
|
111
177
|
const lines = content.split('\n');
|
|
112
|
-
const displayLines = lines.
|
|
178
|
+
const displayLines = lines.slice(0, 10);
|
|
113
179
|
|
|
114
180
|
displayLines.forEach(line => {
|
|
115
181
|
const displayLine = line.length > innerWidth ? line.substring(0, innerWidth - 3) + '...' : line;
|
|
@@ -117,8 +183,8 @@ export class TUI {
|
|
|
117
183
|
console.log(border(' │ ') + chalk.white(displayLine) + ' '.repeat(pad) + border(' │'));
|
|
118
184
|
});
|
|
119
185
|
|
|
120
|
-
if (lines.length >
|
|
121
|
-
console.log(border(' │ ') + chalk.
|
|
186
|
+
if (lines.length > 10) {
|
|
187
|
+
console.log(border(' │ ') + chalk.hex('#06b6d4').bold(` ^ [ ${lines.length - 10} MORE LINES • USE ^ TO SEE ALL ] ^`).padEnd(innerWidth) + border(' │'));
|
|
122
188
|
}
|
|
123
189
|
|
|
124
190
|
console.log(shadow(` └${'─'.repeat(width - 4)}┘\n`));
|
|
@@ -158,6 +224,8 @@ export class TUI {
|
|
|
158
224
|
* Live Streaming: Start a technical block container
|
|
159
225
|
*/
|
|
160
226
|
static drawStreamingStart(title: string, language: string) {
|
|
227
|
+
this.streamingLineCount = 0;
|
|
228
|
+
this.isStreamingTruncated = false;
|
|
161
229
|
const width = 76;
|
|
162
230
|
const glow = chalk.hex('#06b6d4');
|
|
163
231
|
const border = chalk.hex('#164e63');
|
|
@@ -173,17 +241,26 @@ export class TUI {
|
|
|
173
241
|
* Live Streaming: Add a line to the active container
|
|
174
242
|
*/
|
|
175
243
|
static drawStreamingLine(content: string) {
|
|
244
|
+
if (this.isStreamingTruncated) return;
|
|
245
|
+
|
|
176
246
|
const width = 76;
|
|
177
247
|
const innerWidth = width - 8;
|
|
178
248
|
const border = chalk.hex('#164e63');
|
|
179
249
|
|
|
180
250
|
// Handle multi-line content if passed
|
|
181
251
|
const lines = content.split('\n');
|
|
182
|
-
|
|
252
|
+
for (const line of lines) {
|
|
253
|
+
if (this.streamingLineCount >= 10) {
|
|
254
|
+
this.isStreamingTruncated = true;
|
|
255
|
+
console.log(border(' │ ') + chalk.hex('#06b6d4').bold(` ^ [ MAX STABLE VIEW REACHED • STREAMING TRUNCATED ] ^`).padEnd(innerWidth) + border(' │'));
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
|
|
183
259
|
const displayLine = line.length > innerWidth ? line.substring(0, innerWidth - 3) + '...' : line;
|
|
184
260
|
const pad = Math.max(0, innerWidth - displayLine.length);
|
|
185
261
|
console.log(border(' │ ') + chalk.white(displayLine) + ' '.repeat(pad) + border(' │'));
|
|
186
|
-
|
|
262
|
+
this.streamingLineCount++;
|
|
263
|
+
}
|
|
187
264
|
}
|
|
188
265
|
|
|
189
266
|
/**
|
|
@@ -257,15 +334,17 @@ export class TUI {
|
|
|
257
334
|
}
|
|
258
335
|
|
|
259
336
|
/**
|
|
260
|
-
* Draw a
|
|
337
|
+
* Draw a premium header for orchestrator messages
|
|
261
338
|
*/
|
|
262
|
-
static
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
agent.includes('Sandip') ? chalk.hex('#FF69B4') :
|
|
266
|
-
chalk.green;
|
|
339
|
+
static drawPremiumHeader(agent: string, icon: string, color: (s: string) => string) {
|
|
340
|
+
const theme = this.getModeTheme(this.currentTheme);
|
|
341
|
+
const width = 76;
|
|
267
342
|
|
|
268
|
-
|
|
343
|
+
console.log('\n' + theme.shadow(`${theme.border.repeat(width / theme.border.length)}`));
|
|
344
|
+
const header = ` ${icon} ${agent.toUpperCase()} `;
|
|
345
|
+
const hPad = Math.max(0, width - 8 - header.length);
|
|
346
|
+
console.log(theme.primary(` ${theme.border} `) + chalk.bgHex(theme.bg).white.bold(header) + theme.secondary(' '.repeat(hPad)) + theme.primary(` ${theme.border}`));
|
|
347
|
+
console.log(theme.shadow(`${theme.border.repeat(width / theme.border.length)}`));
|
|
269
348
|
}
|
|
270
349
|
|
|
271
350
|
/**
|
|
@@ -290,13 +369,14 @@ export class TUI {
|
|
|
290
369
|
|
|
291
370
|
const width = 76;
|
|
292
371
|
const innerWidth = width - 10;
|
|
372
|
+
const theme = this.getModeTheme(this.currentTheme);
|
|
293
373
|
|
|
294
374
|
// Robust Elite Header
|
|
295
|
-
console.log('\n' +
|
|
375
|
+
console.log('\n' + theme.primary(` ${theme.border.repeat(width - 4)}`));
|
|
296
376
|
const header = ` ${icon} ${agent.toUpperCase()} `;
|
|
297
377
|
const hPad = Math.max(0, width - 8 - header.length);
|
|
298
|
-
console.log(
|
|
299
|
-
console.log(
|
|
378
|
+
console.log(theme.primary(` ${theme.border} `) + chalk.bgHex(theme.bg).white.bold(header) + theme.secondary(theme.border.repeat(hPad)) + theme.primary(` ${theme.border}`));
|
|
379
|
+
console.log(theme.primary(` ${theme.border} `) + glowColor('─'.repeat(width - 8)) + theme.primary(` ${theme.border}`));
|
|
300
380
|
|
|
301
381
|
// Wrapped Content
|
|
302
382
|
const words = message.split(' ');
|
|
@@ -311,7 +391,7 @@ export class TUI {
|
|
|
311
391
|
});
|
|
312
392
|
if (currentLine) console.log(color(' │ ') + chalk.white(currentLine.padEnd(innerWidth)) + color(' │'));
|
|
313
393
|
|
|
314
|
-
console.log(
|
|
394
|
+
console.log(theme.primary(` ${theme.border.repeat(width - 4)}`));
|
|
315
395
|
}
|
|
316
396
|
|
|
317
397
|
/**
|