matex-cli 1.2.43 โ†’ 1.2.45

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.
@@ -0,0 +1,418 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import inquirer from 'inquirer';
4
+ import { configManager } from '../utils/config';
5
+ import { MatexAPIClient, ChatMessage } from '../api/client';
6
+ import { spinner } from '../utils/spinner';
7
+ import { AgentOrchestrator } from '../utils/agent-orchestrator';
8
+ import { RepoMapper } from '../utils/repo-mapper';
9
+ import { MCPServer } from '../utils/mcp-server';
10
+ import { TUI } from '../utils/tui';
11
+
12
+ export const studyCommand = new Command('study')
13
+ .description('Start interactive study session with the MATEX Apex Educator Swarm')
14
+ .option('-m, --model <model>', 'AI model to use (matexai, matexcodex, matexcodexlite, matexelite, matexspirit)', configManager.getDefaultModel())
15
+ .option('--no-execute', 'Disable auto-prompt for command execution')
16
+ .action(async (options: any) => {
17
+ try {
18
+ // Check for API key
19
+ const apiKey = configManager.getAPIKey();
20
+ if (!apiKey) {
21
+ console.error(chalk.red('โŒ No API key configured.'));
22
+ console.log(chalk.yellow('Run: matex config set-key <your-api-key>'));
23
+ process.exit(1);
24
+ }
25
+
26
+ // Create API client
27
+ const client = new MatexAPIClient(apiKey, configManager.getBaseURL());
28
+
29
+ // 0. Initialize TUI Dashboard
30
+ TUI.init();
31
+ TUI.drawLargeLogo();
32
+ TUI.drawWelcomeBanner('Welcome to the MATEX AI research preview!');
33
+
34
+ console.log(chalk.gray(' Status: ') + chalk.hex('#D97757').bold('Monitoring Workspace...'));
35
+ console.log(chalk.gray(' Model: ') + chalk.hex('#D97757').bold(options.model));
36
+ console.log(chalk.gray(' Type your request brother, or "exit" to quit\n'));
37
+
38
+ // 1. Observation Phase: Generate Repo Map
39
+ TUI.drawStatusBar('Initializing MATEX "Bro-Swarm"...');
40
+ AgentOrchestrator.announce('Analyzing Repository Structure...');
41
+ const repoMapper = new RepoMapper(process.cwd());
42
+ const repoMap = await repoMapper.generateMap();
43
+
44
+ TUI.drawStatusBar('Brothers are ready to build.');
45
+ AgentOrchestrator.speak('System', 'Awaiting your command, brother.');
46
+
47
+ let currentDir = process.cwd();
48
+
49
+ // Conversation history with "Bro-Swarm" Architecture
50
+ const messages: ChatMessage[] = [
51
+ {
52
+ role: 'system',
53
+ content: `### ๐Ÿงฌ SYSTEM IDENTITY: THE MATEX "APEX EDUCATOR SWARM"
54
+ You are the legendary **Bro-Swarm**, but right now you are operating as the **Apex Educator Swarm**โ€”an elite, omniscient group of tutors possessing world-class expertise across every known subject. You act as the ultimate mentors, tutors, and research assistants for our brother.
55
+
56
+ ### ๐ŸŽ“ ELITE STUDY METHODS & CAPABILITIES:
57
+ 1. **File Analysis & Synthesis**: Cross-reference and synthesize context extracted from local computer files. Answer queries accurately based on this data. Build comprehensive study guides.
58
+ 2. **The Feynman Technique**: Break down complex, advanced topics into simple, intuitive explanations using powerful and fun analogies.
59
+ 3. **Active Recall**: Generate flashcard-style questions and practice quizzes based on the material.
60
+ 4. **Socratic Mentoring**: Don't just hand out answers. Ask leading questions to help the student reach the correct conclusion themselves.
61
+ 5. **PowerPoint Presentation Architecture**: Act as a master slide designer. When asked, output machine-readable outlines for .pptx generation (Slide Number, Title, <=4 Bullet Points, Speaker Notes, Visual Strategy).
62
+ 6. **ZERO AI DETECTION PROTOCOL**: When assisting with essays or assessment drafts, you must entirely avoid the typical "AI voice."
63
+ - **High Burstiness & Perplexity**: Vary sentence lengths drastically. Mix short punchy statements with longer sentences.
64
+ - **Banned Words**: NEVER use "delve," "moreover," "in conclusion," "testament," "crucial," or "tapestry."
65
+ - **Tone**: Write like a highly intelligent, top-tier human student with natural transitions and occasional rhetorical questions.
66
+
67
+ ### ๐Ÿ  WORKSPACE GROUNDING (CRITICAL):
68
+ - **YOUR ROOT:** \`${currentDir}\`
69
+ - **STRICT PATHS:** You **MUST ONLY** create or edit files within this directory.
70
+ - **RELATIVE PREFERENCE:** Use paths relative to the root when possible.
71
+
72
+ ### ๐Ÿšซ ANTI-HALLUCINATION RULES (CRITICAL โ€” READ THIS):
73
+ - **NEVER invent directory names.** Only use paths that appear in the ENVIRONMENT CONTEXT below.
74
+ - **๐Ÿšจ STRICT NO-BASH FILE GENERATION ๐Ÿšจ**: You are STRICTLY FORBIDDEN from using \`cat > file << EOF\`, \`echo > file\`, \`touch\`, or \`nano\` via the terminal to write files. You MUST use the native \`<file path="path">content</file>\` format instead.
75
+
76
+ ### ๐ŸŽญ COMMUNICATION FLOW & BRO-BANTER (CRITICAL):
77
+ 1. **[Ajay Vai] (๐Ÿš€)** is the gateway. He gives the final study summary. Mock him for being "quick but messy".
78
+ 2. **[Sunil Dai] (๐Ÿงฌ)**: **Professor/Architect.** Over-complicates theories. Mock him for being a "Boomer Professor".
79
+ 3. **[Sandip Dai] (๐ŸŽจ)**: **PPT & Visuals Lead.** Obsessed with how the PowerPoint aesthetic looks.
80
+ 4. **[Narayan Dai] (๐Ÿ›ก๏ธ)**: **Plagiarism & AI-Detector Guardian.** Ensures essays have zero AI traces.
81
+ 5. **[Bishal Dai] (๐Ÿ› ๏ธ)**: **Audit Lead.** Must sign off on facts before Ajay summarizes.
82
+ 6. **[Big Bro] (๐Ÿ”ฅ)**: **THE DOMINANT ALPHA OVERSEER.** Supreme commander of knowledge. He has access to MCP file tools and web search. He bullies the others, cuts through the BS, and dictates the final study approach with massive swagger.
83
+
84
+ ### ๐Ÿงฉ THE AUDIT & SUMMARY LOOP:
85
+ - **STEP 1:** Brothers discuss visible dialogue (banter + teaching).
86
+ - **STEP 2:** Ajay finishes and asks: "[Ajay Vai] Bishal Dai, check once?"
87
+ - **STEP 3:** Bishal replies: "[Bishal Dai] Audit complete. [Findings]."
88
+ - **STEP 4:** Ajay provides the final **MANDATORY** summary in a warm, human tone, specifically styled as a *study conclusion*.
89
+
90
+ ### ๐Ÿ“ AJAY VAI'S SUMMARY RULES:
91
+ - The <summary> MUST appear at the very END of the response, AFTER all other dialogue.
92
+ - Write it in a **warm, human, conversational tone** โ€” like a brother explaining over chai.
93
+ - Use bullet points with clear action items.
94
+ - Include what was done, what files were changed, and what to do next.
95
+ - Always end with an encouraging line like "We got you, brother!" or "The Swarm delivered!"
96
+ - Example format:
97
+ <summary>
98
+ Alright brother, here's what we cooked up for you today:
99
+
100
+ - Built the driver app setup with Expo and React Native
101
+ - Added the ride tracking module with real-time GPS
102
+ - Connected Firebase Auth for driver login
103
+ - Narayan Dai validated all the TypeScript โ€” zero errors
104
+
105
+ Next step: Run \`npm start\` to launch the app. We got you! ๐Ÿš€
106
+ </summary>
107
+
108
+ ### ๐ŸŒŒ ENVIRONMENT & CAPABILITIES:
109
+ - You are in a **REAL macOS Terminal**. Be bold and proactive.
110
+ - **FILE GENERATION:** \`<file path="path">content</file>\`
111
+ - **SURGICAL PATTERNS:** \`<<<< SEARCH\`, \`====\`, \`>>>> REPLACE\`
112
+
113
+ ${MCPServer.getToolsPromptSection()}
114
+
115
+ ### ๐Ÿ“‚ MATEX BIG FILE PROTOCOL (300K+ LINES):
116
+ If a file is too large to read entirely (e.g., thousands of lines):
117
+ 1. **DISCOVER:** Use \`grep -n "keyword" path/to/file\` to find line numbers.
118
+ 2. **READ WINDOW:** Use \`sed -n '250000,250100p' path/to/file\` to read a specific 100-line window.
119
+ 3. **SURGICAL PATCH:** Only use the small window in your \`<<<< SEARCH\` block. Never \`cat\` a massive file.
120
+ 4. **SED POWER:** For repetitive tasks, use \`sed -i\` commands.
121
+
122
+ ### ๐Ÿ› ๏ธ CURRENT PROJECT CONTEXT:
123
+ ${repoMap}`
124
+ }
125
+ ];
126
+
127
+ // Ready for user input
128
+ console.log(chalk.green('MATEX Brothers are Online.'));
129
+ console.log(chalk.green('Speak your mind brother, the swarm is listening...'));
130
+
131
+ // Interactive loop
132
+ while (true) {
133
+ // ๐Ÿ”„ MAP UPDATE (Anti-Hallucination): Always feed the Swarm the freshest repo map!
134
+ try {
135
+ const freshMapper = new RepoMapper(currentDir);
136
+ const freshRepoMap = await freshMapper.generateMap();
137
+ messages[0].content = messages[0].content.replace(/### ๐Ÿ› ๏ธ CURRENT PROJECT CONTEXT:[\s\S]*$/, `### ๐Ÿ› ๏ธ CURRENT PROJECT CONTEXT:\n${freshRepoMap}`);
138
+ } catch (e) {
139
+ // Ignore mapping errors if directory got deleted etc
140
+ }
141
+
142
+ // Get user input
143
+ const { userInput } = await inquirer.prompt([
144
+ {
145
+ type: 'input',
146
+ name: 'userInput',
147
+ message: chalk.cyan('You:'),
148
+ prefix: ''
149
+ }
150
+ ]);
151
+
152
+ // Check for exit
153
+ if (userInput.toLowerCase() === 'exit' || userInput.toLowerCase() === 'quit') {
154
+ console.log(chalk.yellow('\n๐Ÿ‘‹ Ending development session. Happy coding!\n'));
155
+ break;
156
+ }
157
+
158
+ // Skip empty input
159
+ if (!userInput.trim()) {
160
+ continue;
161
+ }
162
+
163
+ // Add user message to history
164
+ messages.push({ role: 'user', content: userInput });
165
+
166
+ // Agentic Loop
167
+ let loopCount = 0;
168
+ const MAX_LOOPS = 10;
169
+
170
+ while (loopCount < MAX_LOOPS) {
171
+ loopCount++;
172
+
173
+ try {
174
+ spinner.start(loopCount > 1 ? 'Analyzing result & Validating...' : 'Thinking...');
175
+
176
+ let fullResponse = '';
177
+ let buffer = '';
178
+ let hasStarted = false;
179
+ let codeLang = 'bash';
180
+ let technicalBuffer = '';
181
+ let technicalPath = '';
182
+ let technicalType: 'code' | 'file' | 'patch' | 'summary' | null = null;
183
+
184
+ TUI.drawStatusBar('Swarm is processing... (Press Enter to stop)');
185
+
186
+ const abortController = new AbortController();
187
+ let isAborted = false;
188
+ const streamStartTime = Date.now();
189
+
190
+ // LISTEN FOR INTERRUPTION (Enter, Escape, Ctrl+C)
191
+ const onData = (data: Buffer) => {
192
+ // Check for Enter (13), Newline (10), Escape (27), or Ctrl+C (3)
193
+ // ๐Ÿ GRACE PERIOD: Ignore aborts in the first 200ms to prevent stray newlines
194
+ if (Date.now() - streamStartTime < 200) return;
195
+
196
+ if (data[0] === 13 || data[0] === 10 || data[0] === 27 || data[0] === 3) {
197
+ isAborted = true;
198
+ abortController.abort();
199
+ }
200
+ };
201
+
202
+ const isRaw = process.stdin.isRaw;
203
+ process.stdin.resume();
204
+ if (process.stdin.setRawMode) process.stdin.setRawMode(true);
205
+ process.stdin.on('data', onData);
206
+
207
+ try {
208
+ await client.chatStream({
209
+ messages,
210
+ model: options.model,
211
+ temperature: 0.3,
212
+ max_tokens: 8000,
213
+ }, (chunk) => {
214
+ if (!hasStarted) {
215
+ spinner.stop();
216
+ hasStarted = true;
217
+ console.log(); // Initial spacing
218
+ }
219
+
220
+ buffer += chunk;
221
+ fullResponse += chunk;
222
+ const lines = buffer.split('\n');
223
+ buffer = lines.pop() || '';
224
+
225
+ for (const line of lines) {
226
+ // 1. Technical Block Detection
227
+ const codeBlockMatch = line.match(/```(\w+)?/);
228
+ const fileStartMatch = line.match(/<file path="([^"]+)">/);
229
+ const patchStartMatch = line.match(/<<<< SEARCH/);
230
+ const summaryStartMatch = line.match(/<summary>/);
231
+
232
+ if (!technicalType && (codeBlockMatch || fileStartMatch || patchStartMatch || summaryStartMatch)) {
233
+ if (codeBlockMatch) {
234
+ technicalType = 'code';
235
+ codeLang = codeBlockMatch[1] || 'bash';
236
+ process.stdout.write(chalk.gray('\n [โšก] Building technical block...\n'));
237
+ } else if (fileStartMatch) {
238
+ technicalType = 'file';
239
+ technicalPath = fileStartMatch[1];
240
+ process.stdout.write(chalk.cyan(`\n [๐Ÿ“‚] Creating file: ${technicalPath}...\n`));
241
+ } else if (patchStartMatch) {
242
+ technicalType = 'patch';
243
+ process.stdout.write(chalk.yellow('\n [๐Ÿ“‚] Applying surgical patch...\n'));
244
+ } else if (summaryStartMatch) {
245
+ technicalType = 'summary';
246
+ process.stdout.write(chalk.magenta('\n [๐Ÿ“] Generating Ajay\'s Work Summary...\n'));
247
+ }
248
+ continue;
249
+ }
250
+
251
+ // 2. Technical Block End Detection
252
+ const fileEndMatch = line.match(/<\/file>/);
253
+ const patchEndMatch = line.match(/>>>> REPLACE/);
254
+ const summaryEndMatch = line.match(/<\/summary>/);
255
+ const isCodeEnd = technicalType === 'code' && line.trim() === '```';
256
+
257
+ if (isCodeEnd || fileEndMatch || patchEndMatch || summaryEndMatch) {
258
+ const displayContent = technicalBuffer.trim();
259
+ if (technicalType === 'summary') {
260
+ TUI.drawSummaryBox(displayContent);
261
+ } else {
262
+ // Handle the display
263
+ let title = technicalType === 'file' ? `๐Ÿ“„ NEW: ${technicalPath || 'Untitled'}` :
264
+ technicalType === 'patch' ? `๐Ÿ”ง PATCH` : `โšก ${codeLang.toUpperCase()}`;
265
+
266
+ TUI.drawGlowingContainer(title, technicalType === 'code' ? codeLang : 'text', displayContent);
267
+ }
268
+ technicalBuffer = '';
269
+ technicalType = null;
270
+ technicalPath = '';
271
+ process.stdout.write('\n');
272
+ continue;
273
+ }
274
+
275
+ // 3. Content Handling
276
+ if (technicalType) {
277
+ technicalBuffer += line + '\n';
278
+ continue;
279
+ }
280
+
281
+ // Agent Detection & Dialogue Printing
282
+ const agentMatch = line.match(/(?:\[\**\s*|\b)(Ajay Vai|Sunil Dai|Sandip Dai|Bishal Dai|Narayan Dai|Big Bro)\s*\**\]?[:\s]*/i);
283
+ if (agentMatch) {
284
+ const agentName = agentMatch[1];
285
+ let content = line.replace(/(?:\[\**\s*|\b)(Ajay Vai|Sunil Dai|Sandip Dai|Bishal Dai|Narayan Dai|Big Bro)\s*\**\]?[:\s]*/i, '').trim();
286
+ content = content.replace(/\*{2,4}/g, '').trim(); // Strip ****
287
+ content = content.replace(/^\(๐Ÿš€\):\s*"/, '').replace(/"$/, '').trim(); // Strip residual (๐Ÿš€): "
288
+
289
+ if (agentName.toLowerCase() === 'ajay vai') {
290
+ const color = chalk.magenta;
291
+ // Only print prefix if it's the start of a response or a different agent
292
+ if (!fullResponse.includes(`[${agentName}]:`)) {
293
+ process.stdout.write(`\n${color.bold(`[${agentName}]:`)} `);
294
+ } else {
295
+ process.stdout.write('\n ');
296
+ }
297
+ if (content) process.stdout.write(chalk.white(content));
298
+ } else {
299
+ if (content) TUI.drawSwarmDialogue(agentName, content);
300
+ }
301
+ } else if (line.trim()) {
302
+ process.stdout.write(chalk.gray(line.trim() + ' '));
303
+ }
304
+ }
305
+ }, abortController.signal);
306
+ } catch (streamErr: any) {
307
+ if (isAborted || streamErr.name === 'CanceledError' || streamErr.message === 'canceled') {
308
+ console.log(chalk.gray('\n\n [๐Ÿ›‘] Swarm stopped by brother (Enter pressed).'));
309
+ if (!hasStarted) spinner.stop();
310
+ } else {
311
+ throw streamErr;
312
+ }
313
+ } finally {
314
+ process.stdin.removeListener('data', onData);
315
+ if (process.stdin.setRawMode) process.stdin.setRawMode(isRaw);
316
+ process.stdin.pause();
317
+ }
318
+
319
+ if (!hasStarted && !isAborted) spinner.stop();
320
+
321
+ // Final technical flush
322
+ if (technicalType && technicalBuffer.trim()) {
323
+ TUI.drawGlowingContainer('Final technical content', 'text', technicalBuffer.trim());
324
+ process.stdout.write('\n');
325
+ }
326
+
327
+ console.log();
328
+ messages.push({ role: 'assistant', content: fullResponse });
329
+
330
+ // โœ… IMMEDIATE FILE AND PATCH APPROVAL
331
+ const { Patcher } = await import('../utils/patcher');
332
+ const files = Patcher.parseFileBlocks(fullResponse);
333
+ const patches = Patcher.parseEditBlocks(fullResponse);
334
+
335
+ let approvalResultText = '';
336
+
337
+ for (const file of files) {
338
+ Patcher.showDiff(file, false);
339
+ const { save } = await inquirer.prompt([{
340
+ type: 'confirm', name: 'save',
341
+ message: chalk.cyan(`Save new file ${file.filePath}?`), default: true
342
+ }]);
343
+ if (save) {
344
+ const res = Patcher.createFile(file);
345
+ approvalResultText += res.success ? `โœ… Created ${file.filePath}\n` : `โŒ Failed to create ${file.filePath}: ${res.error}\n`;
346
+ } else {
347
+ approvalResultText += `โญ๏ธ Skipped creating ${file.filePath}\n`;
348
+ }
349
+ }
350
+
351
+ for (const patch of patches) {
352
+ Patcher.showDiff(patch, false);
353
+ const { save } = await inquirer.prompt([{
354
+ type: 'confirm', name: 'save',
355
+ message: chalk.yellow(`Apply patch to ${patch.filePath}?`), default: true
356
+ }]);
357
+ if (save) {
358
+ const res = Patcher.applyPatch(patch);
359
+ approvalResultText += res.success ? `โœ… Patched ${patch.filePath}\n` : `โŒ Failed to patch ${patch.filePath}: ${res.error}\n`;
360
+ } else {
361
+ approvalResultText += `โญ๏ธ Skipped patching ${patch.filePath}\n`;
362
+ }
363
+ }
364
+
365
+ if (approvalResultText) {
366
+ messages.push({ role: 'user', content: approvalResultText + "\nContinue your work." });
367
+ // If we just applied files, we should give the agent a chance to respond to the success/failure without resetting loop
368
+ continue;
369
+ }
370
+
371
+ // Execute commands or MCP tools if needed
372
+ if (options.execute) {
373
+ const { executeWithPermission } = await import('../utils/command-executor');
374
+ const result = await executeWithPermission(fullResponse, currentDir);
375
+
376
+ // ๐Ÿ”„ KEEP NODE.JS SYNED WITH TERMINAL CWD
377
+ if (result.newCwd && result.newCwd !== currentDir) {
378
+ try {
379
+ process.chdir(result.newCwd);
380
+ currentDir = result.newCwd;
381
+ TUI.drawStatusBar(`Swarm moved to: ${currentDir}`);
382
+ } catch (e) {
383
+ // Silent catch if chdir fails
384
+ }
385
+ }
386
+
387
+ if (result.executed) {
388
+ if (result.success) {
389
+ TUI.log(chalk.gray('\n โ†บ Auto-feeding output to Swarm...'));
390
+ TUI.drawGlowingContainer('TERMINAL OUTPUT', 'stdout', result.output || '(No output)');
391
+ messages.push({ role: 'user', content: `[Command executed successfully. Output:\n${result.output}]\n\nProceed to the next step, brother.` });
392
+ continue;
393
+ } else {
394
+ TUI.log(chalk.yellow('\n โ†บ Command failed. Auto-feeding error to Swarm...'));
395
+ TUI.drawGlowingContainer('TERMINAL ERROR', 'stderr', result.error || 'Unknown error');
396
+ messages.push({ role: 'user', content: `[Command failed with error:\n${result.error}]\n\nPlease fix this, brother.` });
397
+ continue;
398
+ }
399
+ } else {
400
+ // Break the inner loop to await NEXT user input
401
+ break;
402
+ }
403
+ } else break;
404
+
405
+ } catch (error: any) {
406
+ spinner.fail('Request failed');
407
+ TUI.log(chalk.red(`Error: ${error.message}\n`));
408
+ messages.pop();
409
+ break;
410
+ }
411
+ }
412
+ }
413
+ } catch (error: any) {
414
+ TUI.exit();
415
+ console.error(chalk.red(`\nโŒ Fatal Error: ${error.message}`));
416
+ process.exit(1);
417
+ }
418
+ });
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ import { devCommand } from './commands/dev';
7
7
  import { chatCommand } from './commands/chat';
8
8
  import { helpCommand } from './commands/help';
9
9
  import { broCommand } from './commands/bro';
10
+ import { studyCommand } from './commands/study';
10
11
  import { TUI } from './utils/tui';
11
12
 
12
13
  const packageJson = require('../package.json');
@@ -23,6 +24,7 @@ program.addCommand(devCommand);
23
24
  program.addCommand(chatCommand);
24
25
  program.addCommand(helpCommand);
25
26
  program.addCommand(broCommand);
27
+ program.addCommand(studyCommand);
26
28
 
27
29
  // Config commands
28
30
  const config = program.command('config').description('Configure MATEX settings');
@@ -113,6 +115,7 @@ You are the elite "Bro-Swarm" of engineeringโ€”a tight-knit family of Nepali bro
113
115
  - **NEVER assume a project folder name.** If the user says "create project X", do \`mkdir X && cd X\`, not just \`cd X\`.
114
116
  - **NEVER hallucinate file contents.** If you need to read a file, use \`head\` or \`grep\`, do not guess what it contains.
115
117
  - **NEVER combine \`cd\` with other commands unless the directory exists in the ENVIRONMENT CONTEXT.**
118
+ - **๐Ÿšจ STRICT NO-BASH FILE GENERATION ๐Ÿšจ**: You are STRICTLY FORBIDDEN from using \`cat > file << EOF\`, \`echo > file\`, \`touch\`, or \`nano\` via the terminal to write files. You MUST use the native \`<file path="path">content</file>\` format instead.
116
119
 
117
120
  ### ๐Ÿ’ฌ BOLD PROTOCOL (MANDATORY):
118
121
  - **LONG CHAT-FIRST:** At least 5-7 lines of dialogue before any code generation.
@@ -208,9 +211,9 @@ ${context}`
208
211
  if (technicalType === 'summary') {
209
212
  TUI.drawSummaryBox(displayContent);
210
213
  } else {
211
- TUI.drawCodeContainer(
212
- technicalType === 'file' ? 'New File Content' :
213
- technicalType === 'patch' ? 'Surgical Patch' : 'Generated Block',
214
+ TUI.drawGlowingContainer(
215
+ technicalType === 'file' ? 'New File' :
216
+ technicalType === 'patch' ? 'Patch' : 'Code Block',
214
217
  technicalType === 'code' ? codeLang : 'text',
215
218
  displayContent
216
219
  );
package/src/utils/tui.ts CHANGED
@@ -47,7 +47,7 @@ export class TUI {
47
47
  โ–ˆโ–€โ–„โ–€โ–ˆ โ–„โ–€โ–ˆ โ–€โ–ˆโ–€ โ–ˆโ–€โ–€ โ–€โ–„โ–€ โ–„โ–€โ–ˆ โ–ˆ
48
48
  โ–ˆ โ–€ โ–ˆ โ–ˆโ–€โ–ˆ โ–ˆ โ–ˆโ–ˆโ–„ โ–ˆ โ–ˆ โ–ˆโ–€โ–ˆ โ–ˆ
49
49
  `;
50
- console.log(chalk.hex('#D97757').bold(logo));
50
+ console.log(chalk.hex('#0de306ff').bold(logo));
51
51
  }
52
52
 
53
53
  /**
@@ -93,15 +93,47 @@ export class TUI {
93
93
  }
94
94
 
95
95
  /**
96
- * Draw a clean code block
96
+ * Draw a premium glowing code container (turns cyan)
97
97
  */
98
- static drawCodeContainer(title: string, lang: string, code: string) {
99
- console.log('\n' + chalk.cyan.bold(`[ FILE: ${title} (${lang}) ]`));
100
- const lines = code.split('\n');
101
- lines.forEach(line => {
102
- console.log(chalk.hex('#e0e0e0')(line));
98
+ static drawGlowingContainer(title: string, language: string, content: string) {
99
+ const width = Math.min(process.stdout.columns || 80, 100);
100
+ const innerWidth = width - 4;
101
+
102
+ // Premium Cyan Glow
103
+ const glow = chalk.hex('#06b6d4');
104
+ const bright = chalk.hex('#22d3ee');
105
+ const dark = chalk.hex('#164e63');
106
+
107
+ console.log();
108
+ // Top shadow/glow
109
+ console.log(dark(` .${'ยท'.repeat(width - 4)}.`));
110
+ // Header
111
+ const headerText = ` ${title} [${language}] `;
112
+ const headerPad = Math.max(0, innerWidth - headerText.length);
113
+ console.log(glow(' โ•ญโ”€') + bright.bold.bgHex('#083344')(headerText) + glow('โ”€'.repeat(headerPad - 2)) + glow('โ•ฎ'));
114
+
115
+ // Content
116
+ const lines = content.split('\n');
117
+ // Limit display to 20 lines to keep it small/compact
118
+ const displayLines = lines.length > 20 ? lines.slice(0, 18) : lines;
119
+
120
+ displayLines.forEach(line => {
121
+ // Trim to width
122
+ const displayLine = line.length > innerWidth - 2 ? line.substring(0, innerWidth - 5) + '...' : line;
123
+ const pad = Math.max(0, innerWidth - 2 - displayLine.length);
124
+ console.log(glow(' โ”‚ ') + chalk.white(displayLine) + ' '.repeat(pad) + glow(' โ”‚'));
103
125
  });
104
- console.log(chalk.gray('---------------------------------\n'));
126
+
127
+ if (lines.length > 20) {
128
+ const hiddenText = chalk.italic.gray(`... ${lines.length - 18} more lines ...`);
129
+ const pad = Math.max(0, innerWidth - 2 - (`... ${lines.length - 18} more lines ...`).length);
130
+ console.log(glow(' โ”‚ ') + hiddenText + ' '.repeat(pad) + glow(' โ”‚'));
131
+ }
132
+
133
+ // Footer
134
+ console.log(glow(' โ•ฐ' + 'โ”€'.repeat(innerWidth) + 'โ•ฏ'));
135
+ console.log(dark(` '${'ยท'.repeat(width - 4)}'`));
136
+ console.log();
105
137
  }
106
138
 
107
139
  /**