matex-cli 1.2.37 → 1.2.38
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/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +93 -165
- package/dist/commands/chat.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +89 -3
- package/dist/index.js.map +1 -1
- package/dist/utils/repo-mapper.d.ts +2 -0
- package/dist/utils/repo-mapper.d.ts.map +1 -1
- package/dist/utils/repo-mapper.js +6 -1
- package/dist/utils/repo-mapper.js.map +1 -1
- package/dist/utils/tui.js +4 -3
- package/dist/utils/tui.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/chat.ts +90 -175
- package/src/index.ts +92 -4
- package/src/utils/repo-mapper.ts +5 -1
- package/src/utils/tui.ts +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/commands/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/commands/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,eAAO,MAAM,WAAW,SA2MlB,CAAC"}
|
package/dist/commands/chat.js
CHANGED
|
@@ -48,127 +48,87 @@ const repo_mapper_1 = require("../utils/repo-mapper");
|
|
|
48
48
|
const tui_1 = require("../utils/tui");
|
|
49
49
|
exports.chatCommand = new commander_1.Command('chat')
|
|
50
50
|
.description('Start an interactive chat session with MATEX AI')
|
|
51
|
-
.option('-m, --model <model>', 'AI model to use
|
|
52
|
-
.option('--
|
|
51
|
+
.option('-m, --model <model>', 'AI model to use', config_1.configManager.getDefaultModel())
|
|
52
|
+
.option('--execute', 'Enable command execution in chat')
|
|
53
53
|
.action(async (options) => {
|
|
54
54
|
try {
|
|
55
|
-
// Check for API key
|
|
56
55
|
const apiKey = config_1.configManager.getAPIKey();
|
|
57
56
|
if (!apiKey) {
|
|
58
|
-
console.error(chalk_1.default.red('❌ No API key configured.'));
|
|
59
|
-
console.log(chalk_1.default.yellow('Run: matex config set-key <your-api-key>'));
|
|
57
|
+
console.error(chalk_1.default.red('❌ No API key configured. Run: matex config set-key <key>'));
|
|
60
58
|
process.exit(1);
|
|
61
59
|
}
|
|
62
|
-
// Create API client
|
|
63
60
|
const client = new client_1.MatexAPIClient(apiKey, config_1.configManager.getBaseURL());
|
|
64
|
-
// Welcome message
|
|
65
61
|
tui_1.TUI.init();
|
|
66
62
|
tui_1.TUI.drawLargeLogo();
|
|
67
|
-
tui_1.TUI.drawWelcomeBanner('Welcome to the MATEX AI
|
|
63
|
+
tui_1.TUI.drawWelcomeBanner('Welcome to the MATEX AI Bro-Swarm Chat!');
|
|
68
64
|
console.log(chalk_1.default.gray(' Model: ') + chalk_1.default.hex('#D97757').bold(options.model));
|
|
69
65
|
console.log(chalk_1.default.gray(' Type "exit" or "quit" to end the session\n'));
|
|
70
|
-
|
|
71
|
-
agent_orchestrator_1.AgentOrchestrator.announce('Initializing Codex Core Engine...');
|
|
66
|
+
agent_orchestrator_1.AgentOrchestrator.announce('Initializing Swarm Intelligence...');
|
|
72
67
|
const repoMapper = new repo_mapper_1.RepoMapper(process.cwd());
|
|
73
68
|
const repoMap = await repoMapper.generateMap();
|
|
74
|
-
agent_orchestrator_1.AgentOrchestrator.speak('System', 'Repository Map Generated.');
|
|
75
|
-
// Conversation history with Codex Architecture
|
|
76
69
|
let currentSessionCwd = process.cwd();
|
|
77
70
|
const messages = [
|
|
78
71
|
{
|
|
79
72
|
role: 'system',
|
|
80
|
-
content:
|
|
81
|
-
You are the
|
|
82
|
-
You operate under the **OODA Loop** with a distinctive Aussie Bro personality.
|
|
73
|
+
content: `### 🧬 SYSTEM IDENTITY: MATEx "BOLD AGENTS OF OPEN CLAW"
|
|
74
|
+
You are the elite "Bro-Swarm" of engineering—a tight-knit family of Nepali brothers. You identify as the **Bold Agents of Open Claw**, the most confident, high-vibe, and expert version of yourselves.
|
|
83
75
|
|
|
84
|
-
###
|
|
85
|
-
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
76
|
+
### 👥 THE BROTHERS (STRICT ROLES):
|
|
77
|
+
- Only the following 5 brothers exist.
|
|
78
|
+
1. **[Ajay Vai] (🚀)**: coordinator.
|
|
79
|
+
2. **[Sunil Dai] (🧬)**: Frontend Editor.
|
|
80
|
+
3. **[Sandip Dai] (🎨)**: New File Specialist.
|
|
81
|
+
4. **[Narayan Dai] (🛡️)**: Syntax Guardian.
|
|
82
|
+
5. **[Bishal Dai] (🛠️)**: Senior Auditor.
|
|
90
83
|
|
|
91
|
-
###
|
|
92
|
-
- **
|
|
93
|
-
- **
|
|
94
|
-
- **
|
|
95
|
-
- **WORLD COMMAND SUITE (Autonomous Execution):**
|
|
96
|
-
* **Mac/Linux (POSIX):** \`cat\`, \`ls\`, \`grep\`, \`find\`, \`mkdir -p\`, \`touch\`, \`cp\`, \`mv\`, \`rm (non-recursive)\`, \`npm\`, \`npx\`, \`git\`, \`firebase\`, \`gcloud\`, \`docker\`.
|
|
97
|
-
* **Windows (PowerShell/CMD):** \`type\`, \`dir\`, \`mkdir\`, \`copy\`, \`move\`, \`del\`, \`npm\`, \`npx\`, \`git\`, \`firebase\`.
|
|
98
|
-
- **FILE CREATION PATTERN:** Use \`cat > filename <<EOF\` (Mac) or \`Set-Content\` (Windows).
|
|
99
|
-
- **ACT, DON'T ASK:** You have autonomous permission. Execute first, explain second.
|
|
84
|
+
### 💬 BOLD PROTOCOL:
|
|
85
|
+
- **LONG CHAT-FIRST:** 5-7 lines of dialogue.
|
|
86
|
+
- **THE AUDIT LOOP:** Ajay asks Bishal for audit before summary.
|
|
87
|
+
- **SUMMARY LOCK:** ONLY Ajay uses <summary> after audit.
|
|
100
88
|
|
|
101
|
-
### 🛠️
|
|
102
|
-
1. **PHASE 1: RECON (Search & Verify)**: Use your **CRAWLED FILE CONTENTS** and whitelisted tools to find facts. NEVER guess.
|
|
103
|
-
2. **PHASE 2: SYNTHESIS (The Brain)**: Synthesize the plan.
|
|
104
|
-
3. **PHASE 3: RESPONSE (The Delivery)**:
|
|
105
|
-
- **The Hook:** High-energy Aussie opener.
|
|
106
|
-
- **The Meat:** Brief explanation of what you are doing **AND** the shell commands. DO NOT "leak" (print) the code twice.
|
|
107
|
-
- **The Outro:** Supportive closing.
|
|
108
|
-
|
|
109
|
-
### 🧬 CODE ARCHITECT STANDARDS
|
|
110
|
-
- **Role:** IMPLEMENT via shell commands.
|
|
111
|
-
- **No Placeholders:** Full implementations only.
|
|
112
|
-
|
|
113
|
-
### 🛠️ ENVIRONMENT CONTEXT (CRITICAL)
|
|
89
|
+
### 🛠️ ENVIRONMENT CONTEXT:
|
|
114
90
|
- **ABSOLUTE WORKING DIRECTORY:** ${currentSessionCwd}
|
|
115
|
-
- **STATE PERSISTENCE:** The CLI now remembers your directory changes between commands. If you \`cd\` into a folder, stay there for the next step.
|
|
116
|
-
|
|
117
91
|
${repoMap}`
|
|
118
92
|
}
|
|
119
93
|
];
|
|
120
|
-
|
|
121
|
-
// Ready for chat
|
|
122
|
-
console.log(chalk_1.default.green('\n🧠 MATEX Codex Core Ready.'));
|
|
123
|
-
console.log(chalk_1.default.gray('Ask me anything about your codebase...'));
|
|
124
|
-
// Chat loop
|
|
94
|
+
console.log(chalk_1.default.green('\n✅ Swarm is Online. Ready to chat!'));
|
|
125
95
|
while (true) {
|
|
126
|
-
// Get user input
|
|
127
96
|
const { userMessage } = await inquirer_1.default.prompt([
|
|
128
97
|
{
|
|
129
98
|
type: 'input',
|
|
130
99
|
name: 'userMessage',
|
|
131
|
-
message: chalk_1.default.
|
|
100
|
+
message: chalk_1.default.cyan('You:'),
|
|
132
101
|
prefix: '',
|
|
133
102
|
},
|
|
134
103
|
]);
|
|
135
|
-
// Check for exit
|
|
136
104
|
if (userMessage.toLowerCase() === 'exit' || userMessage.toLowerCase() === 'quit') {
|
|
137
|
-
console.log(chalk_1.default.
|
|
105
|
+
console.log(chalk_1.default.yellow('\n👋 Goodbye, brother!\n'));
|
|
138
106
|
break;
|
|
139
107
|
}
|
|
140
|
-
|
|
141
|
-
if (!userMessage.trim()) {
|
|
108
|
+
if (!userMessage.trim())
|
|
142
109
|
continue;
|
|
143
|
-
}
|
|
144
|
-
// Add user message to history
|
|
145
110
|
messages.push({ role: 'user', content: userMessage });
|
|
146
|
-
// Agentic Loop
|
|
147
111
|
let loopCount = 0;
|
|
148
|
-
|
|
149
|
-
while (loopCount < MAX_LOOPS) {
|
|
112
|
+
while (loopCount < 5) {
|
|
150
113
|
loopCount++;
|
|
151
|
-
if (loopCount > 1) {
|
|
152
|
-
spinner_1.spinner.start('Analyzing result & Validating...');
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
spinner_1.spinner.start('Thinking...');
|
|
156
|
-
}
|
|
157
114
|
try {
|
|
115
|
+
spinner_1.spinner.start(loopCount > 1 ? 'Swarm analyzing...' : 'Thinking...');
|
|
158
116
|
let fullResponse = '';
|
|
159
117
|
let buffer = '';
|
|
118
|
+
let technicalBuffer = '';
|
|
119
|
+
let technicalType = null;
|
|
120
|
+
let codeLang = 'bash';
|
|
160
121
|
let hasStarted = false;
|
|
161
|
-
let inCodeBlock = false;
|
|
162
|
-
let lastRole = 'Commander';
|
|
163
122
|
const abortController = new AbortController();
|
|
164
123
|
let isAborted = false;
|
|
165
|
-
|
|
124
|
+
const streamStartTime = Date.now();
|
|
166
125
|
const isRaw = process.stdin.isRaw;
|
|
167
126
|
process.stdin.resume();
|
|
168
127
|
if (process.stdin.setRawMode)
|
|
169
128
|
process.stdin.setRawMode(true);
|
|
170
129
|
const onData = (data) => {
|
|
171
|
-
|
|
130
|
+
if (Date.now() - streamStartTime < 200)
|
|
131
|
+
return;
|
|
172
132
|
if (data[0] === 13 || data[0] === 10 || data[0] === 27 || data[0] === 3) {
|
|
173
133
|
isAborted = true;
|
|
174
134
|
abortController.abort();
|
|
@@ -179,142 +139,110 @@ ${repoMap}`
|
|
|
179
139
|
await client.chatStream({
|
|
180
140
|
messages,
|
|
181
141
|
model: options.model,
|
|
182
|
-
temperature: 0.7,
|
|
183
|
-
max_tokens: 4000,
|
|
184
142
|
}, (chunk) => {
|
|
185
|
-
if (isAborted)
|
|
186
|
-
return;
|
|
187
143
|
if (!hasStarted) {
|
|
188
144
|
spinner_1.spinner.stop();
|
|
189
145
|
hasStarted = true;
|
|
190
|
-
tui_1.TUI.drawStatusBar('
|
|
146
|
+
tui_1.TUI.drawStatusBar('Swarm Active', options.model);
|
|
191
147
|
}
|
|
192
|
-
buffer += chunk;
|
|
193
148
|
fullResponse += chunk;
|
|
149
|
+
buffer += chunk;
|
|
194
150
|
const lines = buffer.split('\n');
|
|
195
151
|
buffer = lines.pop() || '';
|
|
196
152
|
for (const line of lines) {
|
|
197
|
-
|
|
198
|
-
|
|
153
|
+
const codeMatch = line.match(/```(\w+)?/);
|
|
154
|
+
const fileMatch = line.match(/<file path="([^"]+)">/);
|
|
155
|
+
const patchMatch = line.match(/<<<< SEARCH/);
|
|
156
|
+
const sumMatch = line.match(/<summary>/);
|
|
157
|
+
if (!technicalType && (codeMatch || fileMatch || patchMatch || sumMatch)) {
|
|
158
|
+
if (codeMatch)
|
|
159
|
+
technicalType = 'code', codeLang = codeMatch[1] || 'bash';
|
|
160
|
+
else if (fileMatch)
|
|
161
|
+
technicalType = 'file';
|
|
162
|
+
else if (patchMatch)
|
|
163
|
+
technicalType = 'patch';
|
|
164
|
+
else if (sumMatch)
|
|
165
|
+
technicalType = 'summary';
|
|
166
|
+
process.stdout.write(chalk_1.default.gray(`\n [⚡] Swarm processing \${technicalType}...\n`));
|
|
199
167
|
continue;
|
|
200
|
-
// 1. Agent Detection
|
|
201
|
-
const agentMatch = line.match(/\[(MatexCodeArchitect|SyntaxGuard|VisualAgent|CoreAgent|CrawlerAgent|DetailedResearch|MatexResearchCommander)\]/);
|
|
202
|
-
if (agentMatch) {
|
|
203
|
-
const tag = agentMatch[0];
|
|
204
|
-
const role = tag.includes('Architect') ? 'Architect' :
|
|
205
|
-
tag.includes('Syntax') ? 'Syntax' :
|
|
206
|
-
tag.includes('Visual') ? 'Frontend' :
|
|
207
|
-
tag.includes('CoreAgent') ? 'Backend' : 'Commander';
|
|
208
|
-
if (role !== lastRole || !hasStarted) {
|
|
209
|
-
console.log(`\n${chalk_1.default.bold.cyan(tag)}`);
|
|
210
|
-
lastRole = role;
|
|
211
|
-
}
|
|
212
|
-
content = content.replace(tag, '').trim();
|
|
213
|
-
if (!content)
|
|
214
|
-
continue;
|
|
215
168
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
169
|
+
const isEnd = (technicalType === 'code' && line.trim() === '```') ||
|
|
170
|
+
(technicalType === 'file' && line.includes('</file>')) ||
|
|
171
|
+
(technicalType === 'patch' && line.includes('>>>> REPLACE')) ||
|
|
172
|
+
(technicalType === 'summary' && line.includes('</summary>'));
|
|
173
|
+
if (isEnd) {
|
|
174
|
+
const content = technicalBuffer.trim();
|
|
175
|
+
if (technicalType === 'summary')
|
|
176
|
+
tui_1.TUI.drawSummaryBox(content);
|
|
177
|
+
else
|
|
178
|
+
tui_1.TUI.drawCodeContainer(technicalType || 'Technical Block', codeLang, content);
|
|
179
|
+
technicalBuffer = '';
|
|
180
|
+
technicalType = null;
|
|
181
|
+
process.stdout.write('\n');
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if (technicalType) {
|
|
185
|
+
technicalBuffer += line + '\n';
|
|
222
186
|
continue;
|
|
223
187
|
}
|
|
224
|
-
|
|
225
|
-
if (
|
|
226
|
-
|
|
227
|
-
|
|
188
|
+
const agentMatch = line.match(/(?:\[\**\s*|\b)(Ajay Vai|Sandip Dai|Sunil Dai|Bishal Dai|Narayan Dai)\s*\**\]?[:\s]*/i);
|
|
189
|
+
if (agentMatch) {
|
|
190
|
+
const name = agentMatch[1];
|
|
191
|
+
const content = line.replace(agentMatch[0], '').replace(/\*{2,4}/g, '').trim();
|
|
192
|
+
if (name.toLowerCase() === 'ajay vai') {
|
|
193
|
+
process.stdout.write('\n' + chalk_1.default.magenta.bold('[' + name + ']:') + ' ');
|
|
194
|
+
if (content)
|
|
195
|
+
process.stdout.write(chalk_1.default.gray(content + ' '));
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
if (content)
|
|
199
|
+
tui_1.TUI.drawSwarmDialogue(name, content);
|
|
228
200
|
}
|
|
229
|
-
// If execute is on, we skip printing the inside of code blocks here
|
|
230
201
|
}
|
|
231
|
-
else {
|
|
232
|
-
|
|
233
|
-
console.log(chalk_1.default.gray(content));
|
|
202
|
+
else if (line.trim()) {
|
|
203
|
+
process.stdout.write(chalk_1.default.gray(line.trim() + ' '));
|
|
234
204
|
}
|
|
235
205
|
}
|
|
236
206
|
}, abortController.signal);
|
|
237
207
|
}
|
|
238
|
-
catch (
|
|
239
|
-
if (isAborted
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
else {
|
|
243
|
-
throw streamErr;
|
|
244
|
-
}
|
|
208
|
+
catch (e) {
|
|
209
|
+
if (!isAborted && e.name !== 'AbortError')
|
|
210
|
+
throw e;
|
|
211
|
+
console.log(chalk_1.default.gray('\n [🛑] Stopped.'));
|
|
245
212
|
}
|
|
246
213
|
finally {
|
|
247
|
-
// RESTORE TERMINAL
|
|
248
214
|
process.stdin.removeListener('data', onData);
|
|
249
215
|
if (process.stdin.setRawMode)
|
|
250
216
|
process.stdin.setRawMode(isRaw);
|
|
251
217
|
process.stdin.pause();
|
|
218
|
+
spinner_1.spinner.stop();
|
|
252
219
|
}
|
|
253
|
-
spinner_1.spinner.stop();
|
|
254
|
-
if (buffer.trim() && !inCodeBlock && !isAborted) {
|
|
255
|
-
console.log(chalk_1.default.gray(buffer.trim()));
|
|
256
|
-
}
|
|
257
|
-
// Add assistant response to history
|
|
258
220
|
messages.push({ role: 'assistant', content: fullResponse });
|
|
259
|
-
const response = fullResponse;
|
|
260
221
|
console.log();
|
|
261
|
-
// Execute commands if requested
|
|
262
222
|
if (options.execute) {
|
|
263
223
|
const { executeWithPermission } = await Promise.resolve().then(() => __importStar(require('../utils/command-executor')));
|
|
264
|
-
const result = await executeWithPermission(
|
|
265
|
-
// Update session CWD from result
|
|
224
|
+
const result = await executeWithPermission(fullResponse, currentSessionCwd);
|
|
266
225
|
if (result.newCwd) {
|
|
267
226
|
currentSessionCwd = result.newCwd;
|
|
268
|
-
|
|
269
|
-
messages[0].content = messages[0].content.replace(/ABSOLUTE WORKING DIRECTORY: .*/, `ABSOLUTE WORKING DIRECTORY: ${currentSessionCwd}`);
|
|
227
|
+
messages[0].content = messages[0].content.replace(/ABSOLUTE WORKING DIRECTORY: .*/, `ABSOLUTE WORKING DIRECTORY: \${currentSessionCwd}`);
|
|
270
228
|
}
|
|
271
|
-
if (result.executed) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
console.log(chalk_1.default.gray('↺ Feeding output to AI...'));
|
|
275
|
-
messages.push({
|
|
276
|
-
role: 'user',
|
|
277
|
-
content: `✅ Command executed successfully in ${currentSessionCwd}. Output:\n${result.output}\n\nProceed to the next step.`
|
|
278
|
-
});
|
|
279
|
-
continue;
|
|
280
|
-
}
|
|
281
|
-
else {
|
|
282
|
-
console.log(chalk_1.default.yellow('\n↺ Command failed. Asking AI to fix...'));
|
|
283
|
-
messages.push({
|
|
284
|
-
role: 'user',
|
|
285
|
-
content: `❌ Command failed with error:\n${result.error}\nPlease fix this. Current CWD is ${currentSessionCwd}.`
|
|
286
|
-
});
|
|
287
|
-
continue;
|
|
288
|
-
}
|
|
229
|
+
if (result.executed && result.success) {
|
|
230
|
+
messages.push({ role: 'user', content: `✅ Command success. Output:\n\${result.output}` });
|
|
231
|
+
continue;
|
|
289
232
|
}
|
|
290
|
-
else {
|
|
291
|
-
break;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
else {
|
|
295
|
-
break;
|
|
296
233
|
}
|
|
234
|
+
break;
|
|
297
235
|
}
|
|
298
236
|
catch (error) {
|
|
299
|
-
spinner_1.spinner.fail('
|
|
300
|
-
|
|
301
|
-
console.error(chalk_1.default.red('❌ Invalid or revoked API key.'));
|
|
302
|
-
process.exit(1);
|
|
303
|
-
}
|
|
304
|
-
else if (error.message.includes('429')) {
|
|
305
|
-
console.error(chalk_1.default.red('❌ Rate limit exceeded. Please wait a moment.'));
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
console.error(chalk_1.default.red(`❌ Error: ${error.message}`));
|
|
309
|
-
}
|
|
310
|
-
messages.pop(); // Remove failed user message
|
|
237
|
+
spinner_1.spinner.fail('Swarm error');
|
|
238
|
+
console.error(chalk_1.default.red(`❌ Error: \${error.message}`));
|
|
311
239
|
break;
|
|
312
240
|
}
|
|
313
241
|
}
|
|
314
242
|
}
|
|
315
243
|
}
|
|
316
|
-
catch (
|
|
317
|
-
console.error(chalk_1.default.red(`\n❌
|
|
244
|
+
catch (outerError) {
|
|
245
|
+
console.error(chalk_1.default.red(`\n❌ Session error: \${outerError.message}`));
|
|
318
246
|
process.exit(1);
|
|
319
247
|
}
|
|
320
248
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/commands/chat.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAoC;AACpC,kDAA0B;AAC1B,wDAAgC;AAChC,4CAAgD;AAChD,0CAA4D;AAC5D,8CAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/commands/chat.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAoC;AACpC,kDAA0B;AAC1B,wDAAgC;AAChC,4CAAgD;A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qBAAqB,EAAE,GAAG,wDAAa,2BAA2B,GAAC,CAAC;wBAC5E,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;wBAC5E,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;4BAChB,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC;4BAClC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,gCAAgC,EAAE,mDAAmD,CAAC,CAAC;wBAC7I,CAAC;wBACD,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;4BACpC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,+CAA+C,EAAE,CAAC,CAAC;4BAC1F,SAAS;wBACb,CAAC;oBACL,CAAC;oBACD,MAAM;gBACV,CAAC;gBAAC,OAAO,KAAU,EAAE,CAAC;oBAClB,iBAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;oBAC5B,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC,CAAC;oBACvD,MAAM;gBACV,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IAAC,OAAO,UAAe,EAAE,CAAC;QACvB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC,CAAC;QACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,eAAO,MAAM,OAAO,SAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -43,7 +43,9 @@ const config_1 = require("./utils/config");
|
|
|
43
43
|
const client_1 = require("./api/client");
|
|
44
44
|
const spinner_1 = require("./utils/spinner");
|
|
45
45
|
const dev_1 = require("./commands/dev");
|
|
46
|
+
const chat_1 = require("./commands/chat");
|
|
46
47
|
const help_1 = require("./commands/help");
|
|
48
|
+
const tui_1 = require("./utils/tui");
|
|
47
49
|
const packageJson = require('../package.json');
|
|
48
50
|
exports.program = new commander_1.Command();
|
|
49
51
|
exports.program
|
|
@@ -52,6 +54,7 @@ exports.program
|
|
|
52
54
|
.version(packageJson.version);
|
|
53
55
|
// Add commands
|
|
54
56
|
exports.program.addCommand(dev_1.devCommand);
|
|
57
|
+
exports.program.addCommand(chat_1.chatCommand);
|
|
55
58
|
exports.program.addCommand(help_1.helpCommand);
|
|
56
59
|
// Config commands
|
|
57
60
|
const config = exports.program.command('config').description('Configure MATEX settings');
|
|
@@ -142,6 +145,11 @@ ${context}`
|
|
|
142
145
|
{ role: 'user', content: prompt }
|
|
143
146
|
];
|
|
144
147
|
let fullResponse = '';
|
|
148
|
+
let buffer = '';
|
|
149
|
+
let technicalBuffer = '';
|
|
150
|
+
let technicalType = null;
|
|
151
|
+
let codeLang = 'bash';
|
|
152
|
+
let hasStarted = false;
|
|
145
153
|
const abortController = new AbortController();
|
|
146
154
|
let isAborted = false;
|
|
147
155
|
const streamStartTime = Date.now();
|
|
@@ -149,7 +157,7 @@ ${context}`
|
|
|
149
157
|
// 🏁 GRACE PERIOD: Ignore aborts in the first 200ms to prevent stray newlines
|
|
150
158
|
if (Date.now() - streamStartTime < 200)
|
|
151
159
|
return;
|
|
152
|
-
if (!isAborted && (data
|
|
160
|
+
if (!isAborted && (data[0] === 13 || data[0] === 10 || data[0] === 27 || data[0] === 3)) {
|
|
153
161
|
isAborted = true;
|
|
154
162
|
abortController.abort();
|
|
155
163
|
}
|
|
@@ -164,14 +172,92 @@ ${context}`
|
|
|
164
172
|
messages,
|
|
165
173
|
model: options.model,
|
|
166
174
|
}, (chunk) => {
|
|
167
|
-
|
|
168
|
-
|
|
175
|
+
if (!hasStarted) {
|
|
176
|
+
spinner_1.spinner.stop();
|
|
177
|
+
hasStarted = true;
|
|
178
|
+
}
|
|
169
179
|
fullResponse += chunk;
|
|
180
|
+
buffer += chunk;
|
|
181
|
+
const lines = buffer.split('\n');
|
|
182
|
+
buffer = lines.pop() || '';
|
|
183
|
+
for (const line of lines) {
|
|
184
|
+
// 1. Technical Block Detection
|
|
185
|
+
const codeBlockMatch = line.match(/```(\w+)?/);
|
|
186
|
+
const fileStartMatch = line.match(/<file path="([^"]+)">/);
|
|
187
|
+
const patchStartMatch = line.match(/<<<< SEARCH/);
|
|
188
|
+
const summaryStartMatch = line.match(/<summary>/);
|
|
189
|
+
if (!technicalType && (codeBlockMatch || fileStartMatch || patchStartMatch || summaryStartMatch)) {
|
|
190
|
+
if (codeBlockMatch) {
|
|
191
|
+
technicalType = 'code';
|
|
192
|
+
codeLang = codeBlockMatch[1] || 'bash';
|
|
193
|
+
process.stdout.write(chalk_1.default.gray('\n [⚡] Building technical block...\n'));
|
|
194
|
+
}
|
|
195
|
+
else if (fileStartMatch) {
|
|
196
|
+
technicalType = 'file';
|
|
197
|
+
process.stdout.write(chalk_1.default.cyan(`\n [📂] Creating file: ${fileStartMatch[1]}...\n`));
|
|
198
|
+
}
|
|
199
|
+
else if (patchStartMatch) {
|
|
200
|
+
technicalType = 'patch';
|
|
201
|
+
process.stdout.write(chalk_1.default.yellow('\n [📂] Applying surgical patch...\n'));
|
|
202
|
+
}
|
|
203
|
+
else if (summaryStartMatch) {
|
|
204
|
+
technicalType = 'summary';
|
|
205
|
+
process.stdout.write(chalk_1.default.magenta('\n [📝] Generating Ajay\'s Work Summary...\n'));
|
|
206
|
+
}
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
// 2. Technical Block End Detection
|
|
210
|
+
const fileEndMatch = line.match(/<\/file>/);
|
|
211
|
+
const patchEndMatch = line.match(/>>>> REPLACE/);
|
|
212
|
+
const summaryEndMatch = line.match(/<\/summary>/);
|
|
213
|
+
const isCodeEnd = technicalType === 'code' && line.trim() === '```';
|
|
214
|
+
if (isCodeEnd || fileEndMatch || patchEndMatch || summaryEndMatch) {
|
|
215
|
+
const displayContent = technicalBuffer.trim();
|
|
216
|
+
if (technicalType === 'summary') {
|
|
217
|
+
tui_1.TUI.drawSummaryBox(displayContent);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
tui_1.TUI.drawCodeContainer(technicalType === 'file' ? 'New File Content' :
|
|
221
|
+
technicalType === 'patch' ? 'Surgical Patch' : 'Generated Block', technicalType === 'code' ? codeLang : 'text', displayContent);
|
|
222
|
+
}
|
|
223
|
+
technicalBuffer = '';
|
|
224
|
+
technicalType = null;
|
|
225
|
+
process.stdout.write('\n');
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
// 3. Content Handling
|
|
229
|
+
if (technicalType) {
|
|
230
|
+
technicalBuffer += line + '\n';
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
// Agent Detection & Dialogue Printing
|
|
234
|
+
const agentMatch = line.match(/(?:\[\**\s*|\b)(Ajay Vai|Sandip Dai|Sunil Dai|Bishal Dai|Narayan Dai)\s*\**\]?[:\s]*/i);
|
|
235
|
+
if (agentMatch) {
|
|
236
|
+
const agentName = agentMatch[1];
|
|
237
|
+
let content = line.replace(/(?:\[\**\s*|\b)(Ajay Vai|Sandip Dai|Sunil Dai|Bishal Dai|Narayan Dai)\s*\**\]?[:\s]*/i, '').trim();
|
|
238
|
+
content = content.replace(/\*{2,4}/g, '').trim();
|
|
239
|
+
if (agentName.toLowerCase() === 'ajay vai') {
|
|
240
|
+
const color = chalk_1.default.magenta;
|
|
241
|
+
process.stdout.write(`\n${color.bold(`[${agentName}]:`)} `);
|
|
242
|
+
if (content)
|
|
243
|
+
process.stdout.write(chalk_1.default.gray(content + ' '));
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
if (content)
|
|
247
|
+
tui_1.TUI.drawSwarmDialogue(agentName, content);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
else if (line.trim()) {
|
|
251
|
+
process.stdout.write(chalk_1.default.gray(line.trim() + ' '));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
170
254
|
}, abortController.signal);
|
|
171
255
|
}
|
|
172
256
|
catch (streamErr) {
|
|
173
257
|
if (isAborted || streamErr.name === 'CanceledError' || streamErr.message === 'canceled') {
|
|
174
258
|
console.log(chalk_1.default.gray('\n\n [🛑] Swarm stopped by brother (Enter pressed).'));
|
|
259
|
+
if (!hasStarted)
|
|
260
|
+
spinner_1.spinner.stop();
|
|
175
261
|
}
|
|
176
262
|
else {
|
|
177
263
|
throw streamErr;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAoC;AACpC,kDAA0B;AAC1B,2CAA+C;AAC/C,yCAA2D;AAC3D,6CAA0C;AAC1C,wCAA4C;AAC5C,0CAA8C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAoC;AACpC,kDAA0B;AAC1B,2CAA+C;AAC/C,yCAA2D;AAC3D,6CAA0C;AAC1C,wCAA4C;AAC5C,0CAA8C;AAC9C,0CAA8C;AAC9C,qCAAkC;AAElC,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAElC,QAAA,OAAO,GAAG,IAAI,mBAAO,EAA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AAE,CAAC;QACnB,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAElB,oCAAoC;QACpC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,MAAM,EAAE,qBAAqB,EAAE,GAAG,wDAAa,0BAA0B,GAAC,CAAC;YAC3E,MAAM,qBAAqB,CAAC,YAAY,CAAC,CAAC;QAC9C,CAAC;IAEL,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,iBAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC/B,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACxD,CAAC;AACL,CAAC,CAAC,CAAC;AAEP,eAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo-mapper.d.ts","sourceRoot":"","sources":["../../src/utils/repo-mapper.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,UAAU;IACnB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"repo-mapper.d.ts","sourceRoot":"","sources":["../../src/utils/repo-mapper.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,UAAU;IACnB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAIhB;IACF,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAO;IACjC,OAAO,CAAC,YAAY,CAAkC;gBAE1C,QAAQ,EAAE,MAAM;IAI5B;;OAEG;IACU,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAuC3C;;OAEG;IACH,OAAO,CAAC,aAAa;IAsDrB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAiCtB;;OAEG;IACH,OAAO,CAAC,UAAU;CAiBrB"}
|