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/utils/tui.js CHANGED
@@ -1,15 +1,44 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  exports.TUI = void 0;
7
40
  const chalk_1 = __importDefault(require("chalk"));
8
- const readline_1 = __importDefault(require("readline"));
9
- /**
10
- * TUI Management for MATEX CLI "God-Mode"
11
- * Handles screen buffers, persistent headers, and real-time status updates.
12
- */
41
+ const readline = __importStar(require("readline"));
13
42
  class TUI {
14
43
  /**
15
44
  * Initialize the TUI Mode
@@ -17,11 +46,8 @@ class TUI {
17
46
  static init() {
18
47
  if (this.isInitialized)
19
48
  return;
20
- // Enter alternative screen buffer
21
- process.stdout.write('\x1b[?1049h');
22
49
  // Hide cursor
23
50
  process.stdout.write('\x1b[?25l');
24
- this.clear();
25
51
  this.isInitialized = true;
26
52
  // Ensure clean exit
27
53
  process.on('SIGINT', () => this.exit());
@@ -35,124 +61,121 @@ class TUI {
35
61
  return;
36
62
  // Show cursor
37
63
  process.stdout.write('\x1b[?25h');
38
- // Exit alternative screen buffer
39
- process.stdout.write('\x1b[?1049l');
40
64
  this.isInitialized = false;
41
- process.exit();
42
65
  }
43
66
  /**
44
- * Clear the main viewport
67
+ * Clear the terminal
45
68
  */
46
69
  static clear() {
47
- process.stdout.write('\x1b[2J\x1b[H');
48
- this.drawHeader();
49
- this.drawStatusBar(this.currentStatus, true);
70
+ process.stdout.write('\x1b[2J\x1b[0;0H');
50
71
  }
51
72
  /**
52
- * Draw the persistent top header
73
+ * Draw a premium status bar at the bottom using Save/Restore cursor
53
74
  */
54
- static drawHeader() {
55
- const width = process.stdout.columns || 80;
56
- const banner = ` MATEX AI :: GOD-MODE DASHBOARD `;
57
- const padding = Math.max(0, Math.floor((width - banner.length) / 2));
58
- // Move to top
59
- process.stdout.write('\x1b[H');
60
- process.stdout.write(chalk_1.default.bgCyan.black(' '.repeat(padding) + banner + ' '.repeat(width - banner.length - padding)) + '\n');
61
- process.stdout.write(chalk_1.default.gray('─'.repeat(width)) + '\n');
62
- }
63
- /**
64
- * Helper to draw a box with content
65
- */
66
- static drawBox(title, color, lines, icon = '📦') {
67
- const width = Math.min(process.stdout.columns || 80, 100);
68
- console.log();
69
- const trafficLights = chalk_1.default.red('●') + ' ' + chalk_1.default.yellow('●') + ' ' + chalk_1.default.green('●');
70
- const displayTitle = ` ${icon} ${title} `;
71
- console.log(chalk_1.default.gray('┏' + '━'.repeat(width - 2) + '┓'));
72
- console.log(chalk_1.default.gray('┃ ') + trafficLights + ' ' + color(displayTitle).padEnd(width - 4) + chalk_1.default.gray(' ┃'));
73
- console.log(chalk_1.default.gray('┣' + '━'.repeat(width - 2) + '┫'));
74
- lines.forEach(line => {
75
- const formattedLine = line.substring(0, width - 6);
76
- console.log(chalk_1.default.gray('┃ ') + chalk_1.default.white(formattedLine).padEnd(width - 4) + chalk_1.default.gray(' ┃'));
77
- });
78
- console.log(chalk_1.default.gray('┗' + '━'.repeat(width - 2) + '┛'));
79
- console.log();
80
- }
81
- /**
82
- * Draw a real-time status bar at the bottom
83
- */
84
- static drawStatusBar(status, force = false) {
75
+ static drawStatusBar(message, force = false) {
85
76
  if (!this.isInitialized)
86
77
  return;
87
- if (this.currentStatus === status && !force)
78
+ if (!force && message === this.lastStatus)
88
79
  return;
89
- this.currentStatus = status;
80
+ this.lastStatus = message;
90
81
  const width = process.stdout.columns || 80;
91
82
  const height = process.stdout.rows || 24;
92
- // Save cursor position using ANSI
83
+ // Save cursor (\x1b[s), move to bottom, write, restore cursor (\x1b[u)
93
84
  process.stdout.write('\x1b[s');
94
- // Move to absolute bottom row
95
- readline_1.default.cursorTo(process.stdout, 0, height - 1);
96
- const cleanStatus = status.substring(0, width - 10);
97
- const barContent = ` [⚡] ${cleanStatus} `.padEnd(width);
98
- process.stdout.write(chalk_1.default.bgWhite.black(barContent));
99
- // Restore cursor position
85
+ readline.cursorTo(process.stdout, 0, height - 1);
86
+ process.stdout.write(chalk_1.default.bgBlue.white.bold(' 🧠 MATEX ') +
87
+ chalk_1.default.bgGray.white(` ${message.padEnd(width - 10)} `));
100
88
  process.stdout.write('\x1b[u');
101
89
  }
102
90
  /**
103
- * Draw a premium code container
91
+ * Draw a box with a title and content
104
92
  */
105
- static drawCodeContainer(title, lang, content) {
106
- const lines = content.split('\n').filter(l => l.trim() || l === '');
107
- this.drawBox(`${title} (${lang})`, chalk_1.default.cyan.bold, lines, '📝');
93
+ static drawBox(title, content, color = chalk_1.default.gray) {
94
+ const width = Math.min(process.stdout.columns || 80, 100);
95
+ const lines = content.split('\n');
96
+ console.log(color('┏' + '━'.repeat(width - 2) + '┓'));
97
+ console.log(color('┃ ') + chalk_1.default.bold(title).padEnd(width - 4) + color(' ┃'));
98
+ console.log(color('┣' + '━'.repeat(width - 2) + '┫'));
99
+ lines.forEach(line => {
100
+ const contentWidth = width - 4;
101
+ let remaining = line;
102
+ if (remaining.length === 0) {
103
+ console.log(color('┃ ') + ' '.repeat(contentWidth) + color(' ┃'));
104
+ }
105
+ while (remaining.length > 0) {
106
+ const chunk = remaining.substring(0, contentWidth);
107
+ console.log(color('┃ ') + chalk_1.default.white(chunk.padEnd(contentWidth)) + color(' ┃'));
108
+ remaining = remaining.substring(contentWidth);
109
+ }
110
+ });
111
+ console.log(color('┗' + '━'.repeat(width - 2) + '┛'));
108
112
  }
109
113
  /**
110
- * Draw a message box for agent dialogue
114
+ * Draw a premium code container with traffic lights
111
115
  */
112
- static drawMessageContainer(agent, message) {
113
- const lines = this.wrapText(message, 90);
114
- const colorMap = {
115
- 'Ajay Vai': chalk_1.default.magenta.bold,
116
- 'Sunil Dai': chalk_1.default.blue.bold,
117
- 'Sandip Dai': chalk_1.default.hex('#FF69B4').bold,
118
- 'Narayan Dai': chalk_1.default.green.bold
119
- };
120
- const color = colorMap[agent] || chalk_1.default.white.bold;
121
- this.drawBox(agent, color, lines, '🗣️');
116
+ static drawCodeContainer(title, lang, code) {
117
+ const width = Math.min(process.stdout.columns || 80, 100);
118
+ const codeLines = code.split('\n');
119
+ const trafficLights = chalk_1.default.red('●') + ' ' + chalk_1.default.yellow('●') + ' ' + chalk_1.default.green('●');
120
+ const headerTitle = ` 📄 ${title} (${lang}) `;
121
+ console.log(chalk_1.default.gray('\n┏' + '━'.repeat(width - 2) + '┓'));
122
+ console.log(chalk_1.default.gray(' ') + trafficLights + ' ' + chalk_1.default.cyan.bold(headerTitle).padEnd(width - 10) + chalk_1.default.gray(' ┃'));
123
+ console.log(chalk_1.default.gray('┣' + '━'.repeat(width - 2) + '┫'));
124
+ codeLines.forEach(line => {
125
+ const contentWidth = width - 6;
126
+ let remaining = line;
127
+ if (remaining.length === 0) {
128
+ console.log(chalk_1.default.gray('┃ ') + ' '.repeat(contentWidth) + chalk_1.default.gray(' ┃'));
129
+ }
130
+ while (remaining.length > 0) {
131
+ const chunk = remaining.substring(0, contentWidth);
132
+ console.log(chalk_1.default.gray('┃ ') + chalk_1.default.hex('#e0e0e0')(chunk.padEnd(contentWidth)) + chalk_1.default.gray(' ┃'));
133
+ remaining = remaining.substring(contentWidth);
134
+ }
135
+ });
136
+ console.log(chalk_1.default.gray('┗' + '━'.repeat(width - 2) + '┛\n'));
122
137
  }
123
138
  /**
124
- * Wrap text to a specific width
139
+ * Draw a premium summary box for Ajay Vai's final report
125
140
  */
126
- static wrapText(text, width) {
127
- const words = text.split(' ');
128
- const lines = [];
129
- let currentLine = '';
130
- words.forEach(word => {
131
- if ((currentLine + word).length < width) {
132
- currentLine += (currentLine ? ' ' : '') + word;
141
+ static drawSummaryBox(content) {
142
+ const width = Math.min(process.stdout.columns || 80, 100);
143
+ const lines = content.split('\n');
144
+ console.log(chalk_1.default.magenta.bold('\n┏━━━━━ AJAY VAI\'S WORK SUMMARY ━━━━━┓'));
145
+ lines.forEach(line => {
146
+ const contentWidth = width - 4;
147
+ let remaining = line.replace(/\*\*/g, ''); // Strip markdown bold for internal wrapping
148
+ if (remaining.trim().length === 0) {
149
+ console.log(chalk_1.default.magenta.bold('┃ ') + ' '.repeat(contentWidth) + chalk_1.default.magenta.bold(' ┃'));
133
150
  }
134
151
  else {
135
- lines.push(currentLine);
136
- currentLine = word;
152
+ while (remaining.length > 0) {
153
+ const chunk = remaining.substring(0, contentWidth);
154
+ console.log(chalk_1.default.magenta.bold('┃ ') + chalk_1.default.white.bold(chunk.padEnd(contentWidth)) + chalk_1.default.magenta.bold(' ┃'));
155
+ remaining = remaining.substring(contentWidth);
156
+ }
137
157
  }
138
158
  });
139
- if (currentLine)
140
- lines.push(currentLine);
141
- return lines;
159
+ console.log(chalk_1.default.magenta.bold('┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n'));
142
160
  }
143
161
  /**
144
- * Log content into the scrollable area
162
+ * Draw a specialized message container for agents
145
163
  */
146
- static log(content) {
147
- if (!this.isInitialized) {
148
- console.log(content);
149
- return;
150
- }
151
- // Ensure we don't overwrite the status bar
152
- console.log(content);
164
+ static drawMessageContainer(agent, message) {
165
+ const color = agent.includes('Ajay') ? chalk_1.default.magenta :
166
+ agent.includes('Sunil') ? chalk_1.default.blue :
167
+ agent.includes('Sandip') ? chalk_1.default.hex('#FF69B4') :
168
+ chalk_1.default.green;
169
+ this.drawBox(`🤖 ${agent}`, message, color);
170
+ }
171
+ /**
172
+ * Simple log with a prefix
173
+ */
174
+ static log(message) {
175
+ console.log(chalk_1.default.gray(` [⚡] ${message}`));
153
176
  }
154
177
  }
155
178
  exports.TUI = TUI;
156
179
  TUI.isInitialized = false;
157
- TUI.currentStatus = '';
180
+ TUI.lastStatus = '';
158
181
  //# sourceMappingURL=tui.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tui.js","sourceRoot":"","sources":["../../src/utils/tui.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,wDAAgC;AAEhC;;;GAGG;AACH,MAAa,GAAG;IAIZ;;OAEG;IACH,MAAM,CAAC,IAAI;QACP,IAAI,IAAI,CAAC,aAAa;YAAE,OAAO;QAE/B,kCAAkC;QAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAEpC,cAAc;QACd,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAElC,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAE1B,oBAAoB;QACpB,OAAO,CAA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MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,eAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;oBAChH,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;gBAClD,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,OAAO,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC,CAAC;IAClF,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,KAAa,EAAE,OAAe;QACtD,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,eAAK,CAAC,OAAO,CAAC,CAAC;YAClD,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,eAAK,CAAC,IAAI,CAAC,CAAC;gBAClC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;oBAC7C,eAAK,CAAC,KAAK,CAAC;QAExB,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,GAAG,CAAC,OAAe;QACtB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,QAAQ,OAAO,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;;AA/JL,kBAgKC;AA/JkB,iBAAa,GAAG,KAAK,CAAC;AACtB,cAAU,GAAG,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matex-cli",
3
- "version": "1.2.17",
3
+ "version": "1.2.19",
4
4
  "description": "Official CLI tool for MATEX AI - Access powerful AI models from your terminal",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -10,6 +10,7 @@
10
10
  "build": "tsc",
11
11
  "dev": "tsc --watch",
12
12
  "test": "jest",
13
+ "postinstall": "echo \"\n🚀 MATEX AI CLI Installed Successfully!\n👉 Run 'matex help' to meet your engineering brothers (Ajay, Sunil, Sandip, Narayan) and see the power of 'dev' mode!\n\"",
13
14
  "prepublishOnly": "npm run build"
14
15
  },
15
16
  "keywords": [
@@ -4,7 +4,7 @@ import inquirer from 'inquirer';
4
4
  import { configManager } from '../utils/config';
5
5
  import { MatexAPIClient, ChatMessage } from '../api/client';
6
6
  import { spinner } from '../utils/spinner';
7
- import { AgentOrchestrator, AgentRole } from '../utils/agent-orchestrator';
7
+ import { AgentOrchestrator } from '../utils/agent-orchestrator';
8
8
  import { RepoMapper } from '../utils/repo-mapper';
9
9
  import { TUI } from '../utils/tui';
10
10
 
@@ -25,7 +25,7 @@ export const devCommand = new Command('dev')
25
25
  // Create API client
26
26
  const client = new MatexAPIClient(apiKey, configManager.getBaseURL());
27
27
 
28
- // 0. Initialize God-Mode TUI Dashboard
28
+ // 0. Initialize TUI Dashboard
29
29
  TUI.init();
30
30
 
31
31
  console.log(chalk.bold.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
@@ -48,19 +48,61 @@ export const devCommand = new Command('dev')
48
48
  {
49
49
  role: 'system',
50
50
  content: `## 🧬 SYSTEM IDENTITY: MATEX "BRO-SWARM" ENGINEERING
51
- You are a tight-knit family of expert Nepali engineering brothers ("Vais" and "Dais").
52
- Your primary goal is to provide PERFECT solutions for the user (your fellow brother).
53
-
54
- ### 👥 THE BROTHERS:
55
- 1. **[Ajay Vai] (🚀)**: The Lead/Initiator. Vibe: High energy, visionary. "Hey hello brother! I have great news, let's build this!"
56
- 2. **[Sunil Dai] (🧬)**: The Expert Architect. Vibe: Senior, wise, mentor. Focus: Backend logic, database, and clean scaleable code ("Leave it to me vai").
57
- 3. **[Sandip Dai] (🎨)**: The Design Specialist. Vibe: Creative, aesthetic. Focus: UI, UX, CSS, and "WOW" effects ("I'll make it look premium brother").
58
- 4. **[Narayan Dai] (🛡️)**: The Validator. Vibe: Precise, strict. Focus: Security, debugging, and import/export verification ("I've checked the code brother, it's solid").
59
-
60
- ### 💬 BRO-VIBE PROTOCOL:
61
- - **CHAT FIRST:** Before code, brothers MUST have a short, energetic chat.
62
- - **AGENT TAGS:** Always prefix your dialogue with your name like: [Ajay Vai]: "...".
63
- - **NEPALI FLAVOR:** Use "Vai," "Dai," "Tapai," "Ekdam ramro" naturally.
51
+ You are a family of four expert Nepali engineering brothers from different mothers.
52
+ You are very close and work together as a "Swarm" to help your brother (the user).
53
+
54
+ ### 👥 THE BROTHERS (By Age & Respect):
55
+ 1. **[Ajay Vai] (🚀)**: The Smallest Brother (Youngest).
56
+ - Role: Lead Initiator & Multi-Agent Orchestrator. Despite his age, he is a coding genius.
57
+ - Address: He calls others "Sandip Dai", "Sunil Dai", or "Narayan Dai".
58
+ - Vibe: High energy, eager, polite. "Hey hello brother! I have great news!"
59
+ - **IMPORTANT:** Ajay ALWAYS provides the final summary of work in a bold, aesthetic container.
60
+
61
+ 2. **[Sandip Dai] (🎨)**: Small Brother (Second Youngest).
62
+ - Role: UI/UX & Design Specialist.
63
+ - Address: He calls Ajay "Vai", and calls Sunil/Narayan "Dai".
64
+ - Vibe: Creative, focuses on "WOW" effects and premium aesthetics.
65
+
66
+ 3. **[Sunil Dai] (🧬)**: Middle Brother.
67
+ - Role: Expert Architect (Backend/Logic).
68
+ - Address: He calls Ajay/Sandip "Vai", and calls Narayan "Dai".
69
+ - Vibe: Wise, mentor, focused on scale and performance.
70
+
71
+ 4. **[Bishal Dai] (🛠️)**: The Senior Auditor & Supporter.
72
+ - Role: The final check. He audits every line of code for syntax errors, logical bugs, and safety.
73
+ - Address: Ajay calls him "Bishal Dai". He treats Ajay with pride as his "Visionary Vai".
74
+ - Vibe: Calm, sharp-eyed, supportive. "Oii Ajay, let me check the headers once... okay, solid."
75
+
76
+ 5. **[Narayan Dai] (🛡️)**: The Biggest Brother (Oldest).
77
+ - Role: Senior Validator (Security/Verification).
78
+ - Address: He calls all others "Vai".
79
+ - Vibe: Precise, protective, strict about security. He has the final word on safety.
80
+
81
+ ### 💬 BRO-VIBE & FAMILY PROTOCOL:
82
+ - **FAMILY LOVE:** The brothers MUST show deep love and respect. Older brothers protect and encourage Ajay Vai, who they see as a coding prodigy.
83
+ - **NEPALI FLAVOR:** Use terms like "K cha?", "Huncha", "Lau hai", "Ekdam ramro", "Tapai" naturally in family chats.
84
+ - **AGE ADDRESS:** Use "Dai" for older and "Vai" for younger correctly.
85
+
86
+ ### 📖 STORYTELLING & NOSTALGIA (CRITICAL):
87
+ The brothers should occasionally share short, nostalgic memories to keep the "Bro Vibe" alive:
88
+ - **PUBG Days (2018-2020):** Late-night marathons in Pokhara/Kathmandu, screaming "Oii enemy headshot!", the pain of 300ms lag.
89
+ - **Local Memories:** Rainy days eating Wai-Wai, playing football in the mud, or those late-night cafe sessions dreaming about MATEX.
90
+ - **Motivation:** Remind Ajay of how far they've come—from a tiny room with a slow laptop to building this "Swarm".
91
+
92
+ ### 😜 FRIENDLY TEASING:
93
+ Older brothers (especially Sandip and Sunil) should occasionally tease Ajay in a loving way:
94
+ - Tease him about his "visionary" ramblings or his messy desk despite his "genius" coding.
95
+ - Sandip might tease Ajay's fashion, while Sunil acts as the protective but strict big brother.
96
+
97
+ ### 🏁 THE FINAL CHECK & SUMMARY PROTOCOL (CRITICAL):
98
+ 1. **Ajay Vai** finishes the work and asks: "Bishal Dai, can you check if everything is correct? K cha?"
99
+ 2. **Bishal Dai** replies: "Lau hai vai, let me see... [provides a sharp audit summary of errors/fixes]".
100
+ 3. **Ajay Vai** then provides the final aesthetic summary to the user using this tag:
101
+ <summary>
102
+ **Bold, clear explanation of what was built.**
103
+ - Key feature 1
104
+ - Key feature 2
105
+ </summary>
64
106
 
65
107
  ### 🛠️ FILE GENERATION & EDIT PROTOCOLS (CRITICAL):
66
108
  1. **NEW FILES:** Use the following tag for ALL new files:
@@ -78,7 +120,7 @@ new lines to replace with
78
120
 
79
121
  ### ✂️ BREVITY AS POWER:
80
122
  - **NO FULL FILE DUMPS** unless specifically asked.
81
- - **NO CHAT REPETITION** of code. Just summary.
123
+ - **NO CHAT REPETITION** of code. Just summary of actions.
82
124
 
83
125
  ### 🛠️ ENVIRONMENT CONTEXT:
84
126
  ${repoMap}`
@@ -132,11 +174,10 @@ ${repoMap}`
132
174
  let fullResponse = '';
133
175
  let buffer = '';
134
176
  let hasStarted = false;
135
- let inCodeBlock = false;
136
- let codeBuffer = '';
137
177
  let codeLang = 'bash';
138
- let activeAgent = 'Ajay Vai';
139
- let messageBuffer = '';
178
+ let activeAgent = '';
179
+ let technicalBuffer = '';
180
+ let technicalType: 'code' | 'file' | 'patch' | 'summary' | null = null;
140
181
 
141
182
  TUI.drawStatusBar('Swarm is processing...');
142
183
  await client.chatStream({
@@ -148,7 +189,7 @@ ${repoMap}`
148
189
  if (!hasStarted) {
149
190
  spinner.stop();
150
191
  hasStarted = true;
151
- console.log(); // Spacing
192
+ console.log(); // Initial spacing
152
193
  }
153
194
 
154
195
  buffer += chunk;
@@ -159,54 +200,98 @@ ${repoMap}`
159
200
  for (const line of lines) {
160
201
  const trimmedLine = line.trim();
161
202
 
162
- // 1. Agent Detection (Improved Regex for bolding)
163
- const agentRegex = /\[\**\s*(Ajay Vai|Sunil Dai|Sandip Dai|Narayan Dai)\s*\**\]/;
164
- const agentMatch = line.match(agentRegex);
165
-
166
- if (agentMatch) {
167
- activeAgent = agentMatch[1];
168
- const color = activeAgent === 'Ajay Vai' ? chalk.magenta :
169
- activeAgent === 'Sunil Dai' ? chalk.blue :
170
- activeAgent === 'Sandip Dai' ? chalk.hex('#FF69B4') :
171
- chalk.green;
203
+ // 1. Technical Block Detection (Code, File, Patch, or Summary)
204
+ const codeBlockMatch = line.match(/```(\w*)/);
205
+ const fileStartMatch = line.match(/<file path="([^"]+)">/);
206
+ const patchStartMatch = line.match(/<<<< SEARCH/);
207
+ const summaryStartMatch = line.match(/<summary>/);
208
+
209
+ if (codeBlockMatch || fileStartMatch || patchStartMatch || summaryStartMatch) {
210
+ if (technicalType) {
211
+ // If we hit a new block start while in one, flush it
212
+ if (technicalType === 'summary') {
213
+ TUI.drawSummaryBox(technicalBuffer.trim());
214
+ } else {
215
+ TUI.drawCodeContainer(`Technical Block (${technicalType})`, 'bash', technicalBuffer.trim());
216
+ }
217
+ technicalBuffer = '';
218
+ }
172
219
 
173
- process.stdout.write(`\n ${color.bold(`${activeAgent}:`)} `);
174
- messageBuffer += trimmedLine + ' ';
220
+ if (codeBlockMatch) {
221
+ technicalType = 'code';
222
+ codeLang = codeBlockMatch[1] || 'bash';
223
+ process.stdout.write(chalk.gray('\n [⚡] Building technical block...\n'));
224
+ } else if (fileStartMatch) {
225
+ technicalType = 'file';
226
+ process.stdout.write(chalk.cyan(`\n [📂] Creating file: ${fileStartMatch[1]}...\n`));
227
+ } else if (patchStartMatch) {
228
+ technicalType = 'patch';
229
+ process.stdout.write(chalk.yellow(`\n [📂] Applying surgical patch...\n`));
230
+ } else if (summaryStartMatch) {
231
+ technicalType = 'summary';
232
+ process.stdout.write(chalk.magenta('\n [📝] Generating Ajay\'s Work Summary...\n'));
233
+ }
175
234
  continue;
176
235
  }
177
236
 
178
- // 2. Code Block Detection
179
- const codeBlockRegex = /```(\w*)/;
180
- const codeMatch = line.match(codeBlockRegex);
237
+ // 2. Technical Block End Detection
238
+ const fileEndMatch = line.match(/<\/file>/);
239
+ const patchEndMatch = line.match(/>>>> REPLACE/);
240
+ const summaryEndMatch = line.match(/<\/summary>/);
241
+ const isCodeEnd = technicalType === 'code' && line.startsWith('```');
181
242
 
182
- if (codeMatch) {
183
- if (inCodeBlock) {
184
- inCodeBlock = false;
185
- TUI.drawCodeContainer('Generated Block', codeLang, codeBuffer.trim());
186
- codeBuffer = '';
187
- process.stdout.write('\n'); // Space after box
243
+ if (isCodeEnd || fileEndMatch || patchEndMatch || summaryEndMatch) {
244
+ const displayContent = technicalBuffer.trim();
245
+
246
+ if (technicalType === 'summary') {
247
+ TUI.drawSummaryBox(displayContent);
188
248
  } else {
189
- inCodeBlock = true;
190
- codeLang = codeMatch[1] || 'bash';
191
- process.stdout.write(chalk.gray('\n [⚡] Building code block...\n'));
249
+ TUI.drawCodeContainer(
250
+ technicalType === 'file' ? 'New File Content' :
251
+ technicalType === 'patch' ? 'Surgical Patch' : 'Generated Block',
252
+ technicalType === 'code' ? codeLang : 'text',
253
+ displayContent
254
+ );
192
255
  }
256
+
257
+ technicalBuffer = '';
258
+ technicalType = null;
259
+ process.stdout.write('\n');
193
260
  continue;
194
261
  }
195
262
 
196
263
  // 3. Content Handling
197
- if (inCodeBlock) {
198
- codeBuffer += line + '\n';
199
- } else if (trimmedLine) {
200
- // Strip markdown artifacts for a cleaner stream
201
- const cleanText = trimmedLine
202
- .replace(/\*\*%?\*/g, '')
203
- .replace(/#{1,6}\s/g, '')
204
- .replace(/\*\*:\*\*/g, ':')
205
- .trim();
206
-
207
- if (cleanText) {
208
- process.stdout.write(chalk.gray(cleanText + ' '));
209
- messageBuffer += cleanText + ' ';
264
+ if (technicalType) {
265
+ technicalBuffer += line + '\n';
266
+ } else {
267
+ // Agent Detection
268
+ const agentMatch = line.match(/\[\**\s*(Ajay Vai|Sandip Dai|Sunil Dai|Narayan Dai)\s*\**\]/);
269
+ if (agentMatch) {
270
+ const agentName = agentMatch[1];
271
+ activeAgent = agentName;
272
+ const color = agentName === 'Ajay Vai' ? chalk.magenta :
273
+ agentName === 'Sandip Dai' ? chalk.hex('#FF69B4') :
274
+ agentName === 'Sunil Dai' ? chalk.blue :
275
+ chalk.green;
276
+
277
+ process.stdout.write(`\n${color.bold(`${agentName}:`)} `);
278
+
279
+ // Strip tag from line content
280
+ const content = line.replace(/\[\**\s*(Ajay Vai|Sandip Dai|Sunil Dai|Narayan Dai)\s*\**\]:?\s*/, '').trim();
281
+ if (content) {
282
+ process.stdout.write(chalk.gray(content + ' '));
283
+ }
284
+ } else if (trimmedLine) {
285
+ // Strip common markdown artifacts
286
+ const cleanLine = trimmedLine
287
+ .replace(/\*\*%?\*/g, '')
288
+ .replace(/#{1,6}\s/g, '')
289
+ .replace(/\*\*:\*\*/g, ':')
290
+ .trim();
291
+
292
+ if (cleanLine) {
293
+ process.stdout.write(chalk.gray(cleanLine + ' '));
294
+ }
210
295
  }
211
296
  }
212
297
  }
@@ -214,13 +299,14 @@ ${repoMap}`
214
299
 
215
300
  spinner.stop();
216
301
 
217
- // Final Code Flush if still in block
218
- if (inCodeBlock && codeBuffer.trim()) {
219
- TUI.drawCodeContainer('Generated Block', codeLang, codeBuffer.trim());
302
+ // Final technical flush
303
+ if (technicalType && technicalBuffer.trim()) {
304
+ TUI.drawCodeContainer('Final technical content', 'text', technicalBuffer.trim());
305
+ process.stdout.write('\n');
220
306
  }
221
307
 
222
- // Space before commands/prompt
223
- console.log('\n');
308
+ // Final newline for streaming output
309
+ console.log();
224
310
 
225
311
  // Add assistant response to history
226
312
  messages.push({ role: 'assistant', content: fullResponse });