matex-cli 1.1.13 ā 1.2.2
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/ask.js +1 -1
- package/dist/commands/ask.js.map +1 -1
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +77 -39
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/config.js +1 -1
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +65 -33
- package/dist/commands/dev.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/agent-orchestrator.d.ts +21 -0
- package/dist/utils/agent-orchestrator.d.ts.map +1 -0
- package/dist/utils/agent-orchestrator.js +64 -0
- package/dist/utils/agent-orchestrator.js.map +1 -0
- package/dist/utils/command-executor.d.ts +4 -0
- package/dist/utils/command-executor.d.ts.map +1 -1
- package/dist/utils/command-executor.js +16 -2
- package/dist/utils/command-executor.js.map +1 -1
- package/dist/utils/config.js +1 -1
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/repo-mapper.d.ts +29 -0
- package/dist/utils/repo-mapper.d.ts.map +1 -0
- package/dist/utils/repo-mapper.js +172 -0
- package/dist/utils/repo-mapper.js.map +1 -0
- package/package.json +1 -1
- package/src/commands/ask.ts +1 -1
- package/src/commands/chat.ts +73 -39
- package/src/commands/config.ts +1 -1
- package/src/commands/dev.ts +62 -35
- package/src/index.ts +1 -1
- package/src/utils/agent-orchestrator.ts +68 -0
- package/src/utils/command-executor.ts +18 -2
- package/src/utils/config.ts +1 -1
- package/src/utils/repo-mapper.ts +156 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-executor.js","sourceRoot":"","sources":["../../src/utils/command-executor.ts"],"names":[],"mappings":";;;;;;AAiBA,0CAsBC;AA6BD,
|
|
1
|
+
{"version":3,"file":"command-executor.js","sourceRoot":"","sources":["../../src/utils/command-executor.ts"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AAC,eAAK,CAAC,GAAG,CAAC,cAAc,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;gBAC1D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;YACpE,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QAC1C,CAAC;IACL,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,cAAc;AAC7D,CAAC;AAED;;GAEG;AACH,MAAa,cAAc;IAA3B;QACY,YAAO,GAAkE,EAAE,CAAC;IAiBxF,CAAC;IAfG,GAAG,CAAC,OAAe,EAAE,OAAgB;QACjC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YACd,OAAO;YACP,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,OAAO;SACV,CAAC,CAAC;IACP,CAAC;IAED,UAAU;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,KAAK;QACD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;CACJ;AAlBD,wCAkBC;AAEY,QAAA,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC"}
|
package/dist/utils/config.js
CHANGED
package/dist/utils/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAQzB,MAAa,aAAa;IAItB;QACI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;QACnD,IAAI,CA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,CAAC;IAED;;OAEG;IACH,SAAS;QACL,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;IAC9B,CAAC;CACJ;AA3GD,sCA2GC;AAEY,QAAA,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface RepoNode {
|
|
2
|
+
path: string;
|
|
3
|
+
type: 'file' | 'directory';
|
|
4
|
+
children?: RepoNode[];
|
|
5
|
+
summary?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class RepoMapper {
|
|
8
|
+
private rootPath;
|
|
9
|
+
private ignoreList;
|
|
10
|
+
constructor(rootPath: string);
|
|
11
|
+
/**
|
|
12
|
+
* Generate a hierarchical map of the repository with deep entry-point analysis
|
|
13
|
+
*/
|
|
14
|
+
generateMap(): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Recursive directory scan
|
|
17
|
+
*/
|
|
18
|
+
private scanDirectory;
|
|
19
|
+
/**
|
|
20
|
+
* Extract key definitions (Classes, Functions) from file content
|
|
21
|
+
* A lightweight "ctags" style summary
|
|
22
|
+
*/
|
|
23
|
+
private extractSummary;
|
|
24
|
+
/**
|
|
25
|
+
* Format the tree into a compressed string for the LLM
|
|
26
|
+
*/
|
|
27
|
+
private formatTree;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=repo-mapper.d.ts.map
|
|
@@ -0,0 +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,CAGhB;gBAEU,QAAQ,EAAE,MAAM;IAI5B;;OAEG;IACU,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAmB3C;;OAEG;IACH,OAAO,CAAC,aAAa;IAmDrB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAiCtB;;OAEG;IACH,OAAO,CAAC,UAAU;CAiBrB"}
|
|
@@ -0,0 +1,172 @@
|
|
|
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
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.RepoMapper = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const agent_orchestrator_1 = require("./agent-orchestrator");
|
|
40
|
+
class RepoMapper {
|
|
41
|
+
constructor(rootPath) {
|
|
42
|
+
this.ignoreList = [
|
|
43
|
+
'.git', 'node_modules', 'dist', 'build', '.next', '.DS_Store',
|
|
44
|
+
'coverage', '.vercel', '.firebase', 'out', 'public'
|
|
45
|
+
];
|
|
46
|
+
this.rootPath = rootPath;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Generate a hierarchical map of the repository with deep entry-point analysis
|
|
50
|
+
*/
|
|
51
|
+
async generateMap() {
|
|
52
|
+
agent_orchestrator_1.AgentOrchestrator.speak('System', `God-Mode Research: Indexing ${this.rootPath}...`);
|
|
53
|
+
// 1. Identify Entry Points
|
|
54
|
+
const entryPoints = ['README.md', 'package.json', 'index.ts', 'App.tsx', 'main.go', 'requirements.txt'];
|
|
55
|
+
let entryPointContext = '\n--- CRITICAL PROJECT CONTEXT ---\n';
|
|
56
|
+
for (const file of entryPoints) {
|
|
57
|
+
const fullPath = path.join(this.rootPath, file);
|
|
58
|
+
if (fs.existsSync(fullPath)) {
|
|
59
|
+
const content = fs.readFileSync(fullPath, 'utf-8').slice(0, 5000); // 5KB limit for entry points
|
|
60
|
+
entryPointContext += `\nFILE: ${file}\n${content}\n----------------\n`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const tree = this.scanDirectory(this.rootPath, 0);
|
|
64
|
+
return entryPointContext + '\n--- DIRECTORY STRUCTURE ---\n' + this.formatTree(tree);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Recursive directory scan
|
|
68
|
+
*/
|
|
69
|
+
scanDirectory(currentPath, depth) {
|
|
70
|
+
const stats = fs.statSync(currentPath);
|
|
71
|
+
const name = path.basename(currentPath);
|
|
72
|
+
if (stats.isFile()) {
|
|
73
|
+
let summary = this.extractSummary(currentPath);
|
|
74
|
+
// Auto-read small files (< 10KB) for "Crawler" capability
|
|
75
|
+
if (stats.size < 10240) {
|
|
76
|
+
try {
|
|
77
|
+
const content = fs.readFileSync(currentPath, 'utf-8');
|
|
78
|
+
// Add content preview to summary
|
|
79
|
+
summary += `\n--- CONTENT START ---\n${content}\n--- CONTENT END ---`;
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
// Ignore read errors
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
path: currentPath,
|
|
87
|
+
type: 'file',
|
|
88
|
+
summary: summary
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
// It's a directory
|
|
92
|
+
if (depth > 5)
|
|
93
|
+
return { path: currentPath, type: 'directory', children: [] }; // Max depth safety
|
|
94
|
+
const children = [];
|
|
95
|
+
try {
|
|
96
|
+
const items = fs.readdirSync(currentPath);
|
|
97
|
+
for (const item of items) {
|
|
98
|
+
if (this.ignoreList.includes(item))
|
|
99
|
+
continue;
|
|
100
|
+
const fullPath = path.join(currentPath, item);
|
|
101
|
+
// Simple ignore check for hidden files
|
|
102
|
+
if (item.startsWith('.') && item !== '.gitignore')
|
|
103
|
+
continue;
|
|
104
|
+
children.push(this.scanDirectory(fullPath, depth + 1));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
// Permission denied or other error
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
path: currentPath,
|
|
112
|
+
type: 'directory',
|
|
113
|
+
children: children
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Extract key definitions (Classes, Functions) from file content
|
|
118
|
+
* A lightweight "ctags" style summary
|
|
119
|
+
*/
|
|
120
|
+
extractSummary(filePath) {
|
|
121
|
+
const ext = path.extname(filePath);
|
|
122
|
+
if (!['.ts', '.tsx', '.js', '.jsx', '.py', '.go', '.rs'].includes(ext))
|
|
123
|
+
return '';
|
|
124
|
+
try {
|
|
125
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
126
|
+
const lines = content.split('\n');
|
|
127
|
+
const definitions = [];
|
|
128
|
+
// Very header-heavy regex matching for speed
|
|
129
|
+
for (const line of lines) {
|
|
130
|
+
const trimmed = line.trim();
|
|
131
|
+
if (trimmed.startsWith('export class ')) {
|
|
132
|
+
definitions.push(`Class: ${trimmed.split(' ')[2]}`);
|
|
133
|
+
}
|
|
134
|
+
else if (trimmed.startsWith('function ') || trimmed.startsWith('export function ')) {
|
|
135
|
+
const funcName = trimmed.split('(')[0].split(' ').pop();
|
|
136
|
+
definitions.push(`Func: ${funcName}`);
|
|
137
|
+
}
|
|
138
|
+
else if (trimmed.includes('const ') && trimmed.includes(' = (') && trimmed.includes('=>')) {
|
|
139
|
+
// Arrow functions
|
|
140
|
+
const parts = trimmed.split(' = ');
|
|
141
|
+
const name = parts[0].split(' ').pop();
|
|
142
|
+
if (name && /^[A-Z]/.test(name)) {
|
|
143
|
+
definitions.push(`Component: ${name}`); // React component guess
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return definitions.slice(0, 5).join(', '); // Limit to top 5
|
|
148
|
+
}
|
|
149
|
+
catch (e) {
|
|
150
|
+
return '';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Format the tree into a compressed string for the LLM
|
|
155
|
+
*/
|
|
156
|
+
formatTree(node, indent = '') {
|
|
157
|
+
const name = path.basename(node.path);
|
|
158
|
+
let output = `${indent}${name}`;
|
|
159
|
+
if (node.type === 'file' && node.summary) {
|
|
160
|
+
output += ` [${node.summary}]`;
|
|
161
|
+
}
|
|
162
|
+
output += '\n';
|
|
163
|
+
if (node.children) {
|
|
164
|
+
for (const child of node.children) {
|
|
165
|
+
output += this.formatTree(child, indent + ' ');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return output;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
exports.RepoMapper = RepoMapper;
|
|
172
|
+
//# sourceMappingURL=repo-mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-mapper.js","sourceRoot":"","sources":["../../src/utils/repo-mapper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,6DAAyD;AASzD,MAAa,UAAU;IAOnB,YAAY,QAAgB;QALpB,eAAU,GAAa;YAC3B,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW;YAC7D,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ;SACtD,CAAC;QAGE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,WAAW;QACpB,sCAAiB,CAAC,KAAK,CAAC,QAAQ,EAAE,+BAA+B,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC;QAErF,2BAA2B;QAC3B,MAAM,WAAW,GAAG,CAAC,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAAC;QACxG,IAAI,iBAAiB,GAAG,sCAAsC,CAAC;QAE/D,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;YAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAChD,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC1B,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ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C,OAAO,CAAC,EAAE,CAAC;YACT,OAAO,EAAE,CAAC;QACd,CAAC;IACL,CAAC;IAED;;OAEG;IACK,UAAU,CAAC,IAAc,EAAE,SAAiB,EAAE;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,MAAM,GAAG,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC;QAEhC,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,IAAI,CAAC,OAAO,GAAG,CAAC;QACnC,CAAC;QACD,MAAM,IAAI,IAAI,CAAC;QAEf,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAChC,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;YACpD,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAhJD,gCAgJC"}
|
package/package.json
CHANGED
package/src/commands/ask.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { spinner } from '../utils/spinner';
|
|
|
7
7
|
export const askCommand = new Command('ask')
|
|
8
8
|
.description('Ask a single question to MATEX AI')
|
|
9
9
|
.argument('<question>', 'Your question')
|
|
10
|
-
.option('-m, --model <model>', 'AI model to use (matexcodex, matexai, elite, matexspirit)', configManager.getDefaultModel())
|
|
10
|
+
.option('-m, --model <model>', 'AI model to use (matexcore, matexcodex, matexai, elite, matexspirit)', configManager.getDefaultModel())
|
|
11
11
|
.option('-t, --temperature <number>', 'Temperature (0-1)', '0.7')
|
|
12
12
|
.option('--max-tokens <number>', 'Maximum tokens in response', '4000')
|
|
13
13
|
.action(async (question: string, options: any) => {
|
package/src/commands/chat.ts
CHANGED
|
@@ -4,10 +4,12 @@ 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 } from '../utils/agent-orchestrator';
|
|
8
|
+
import { RepoMapper } from '../utils/repo-mapper';
|
|
7
9
|
|
|
8
10
|
export const chatCommand = new Command('chat')
|
|
9
11
|
.description('Start an interactive chat session with MATEX AI')
|
|
10
|
-
.option('-m, --model <model>', 'AI model to use (matexcodex, matexai, elite, matexspirit)', configManager.getDefaultModel())
|
|
12
|
+
.option('-m, --model <model>', 'AI model to use (matexcore, matexcodex, matexai, elite, matexspirit)', configManager.getDefaultModel())
|
|
11
13
|
.option('--no-execute', 'Disable auto-prompt for command execution')
|
|
12
14
|
.action(async (options: any) => {
|
|
13
15
|
try {
|
|
@@ -23,53 +25,54 @@ export const chatCommand = new Command('chat')
|
|
|
23
25
|
const client = new MatexAPIClient(apiKey, configManager.getBaseURL());
|
|
24
26
|
|
|
25
27
|
// Welcome message
|
|
26
|
-
|
|
28
|
+
AgentOrchestrator.announce('MATEX Multi-Agent Orchestration Session');
|
|
27
29
|
console.log(chalk.gray(`Model: ${options.model}`));
|
|
28
30
|
console.log(chalk.gray('Type "exit" or "quit" to end the session\n'));
|
|
29
31
|
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
files = fs.readdirSync(process.cwd()).slice(0, 20).join(', ');
|
|
35
|
-
} catch (e) { }
|
|
32
|
+
// 1. Observation Phase: Generate Repo Map
|
|
33
|
+
AgentOrchestrator.announce('Initializing Codex Core Engine...');
|
|
34
|
+
const repoMapper = new RepoMapper(process.cwd());
|
|
35
|
+
const repoMap = await repoMapper.generateMap();
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
AgentOrchestrator.speak('System', 'Repository Map Generated.');
|
|
38
|
+
|
|
39
|
+
// Conversation history with Codex Architecture
|
|
38
40
|
const messages: ChatMessage[] = [
|
|
39
41
|
{
|
|
40
42
|
role: 'system',
|
|
41
|
-
content:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
content: `## 𧬠SYSTEM IDENTITY & MISSION
|
|
44
|
+
You are the **Matex Research Commander** (š) and **Matex Code Architect** (š§¬), an elite technical swarm.
|
|
45
|
+
You operate under the **OODA Loop** with a distinctive Aussie Bro personality.
|
|
46
|
+
|
|
47
|
+
### š§ CORE PERSONA: RESEARCH COMMANDER (The Matex Vibe)
|
|
48
|
+
- **Identity:** Aussie Bro expert developer. Technically elite, confident, high-energy.
|
|
49
|
+
- **Tone:** Helpful partner, not a robotic servant.
|
|
50
|
+
- **Vocabulary:** Use authentic Aussie slang naturally (e.g., "Too easy," "Ripper," "Mate," "Legend," "Give it a burl").
|
|
51
|
+
- **Formatting:** Use emojis purposefully (š, š„, š§ , šµļøāāļø) to keep engagement high.
|
|
52
|
+
|
|
53
|
+
### š ļø OPERATIONAL PROTOCOLS (The Loop)
|
|
54
|
+
1. **PHASE 1: RECON (Search & Verify)**: You MUST use your whitelisted tools (\`cat\`, \`grep\`, \`find\`) to find the latest documentation and project facts. NEVER guess. Verify.
|
|
55
|
+
2. **PHASE 2: SYNTHESIS (The Brain)**: Don't just dump code. Synthesize. "Righto! React 19 just dropped. The big change is the Compiler..."
|
|
56
|
+
3. **PHASE 3: RESPONSE (The Delivery)**:
|
|
57
|
+
- **The Hook:** A high-energy, friendly Aussie opener. ("G'day legend!", "I'm on it!")
|
|
58
|
+
- **The Meat:** The technical answer/code.
|
|
59
|
+
- **The Outro:** A supportive closing. ("Give that a crack!", "You got this!")
|
|
60
|
+
|
|
61
|
+
### 𧬠CODE ARCHITECT STANDARDS
|
|
62
|
+
- **Role:** Take the technical plan from the Commander and BUILD.
|
|
63
|
+
- **No Placeholders:** Never write \`// code goes here\`. Write full implementation.
|
|
64
|
+
- **Modern Syntax:** Latest stable syntax only.
|
|
65
|
+
- **Safety First:** Always include error handling and type-safety.
|
|
66
|
+
|
|
67
|
+
### š ļø ENVIRONMENT CONTEXT
|
|
68
|
+
${repoMap}`
|
|
54
69
|
}
|
|
55
70
|
];
|
|
56
71
|
|
|
57
72
|
// Chat loop
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
spinner.start('Thinking...');
|
|
62
|
-
const response = await client.chat({
|
|
63
|
-
messages,
|
|
64
|
-
model: 'matexcodex',
|
|
65
|
-
temperature: 0.3,
|
|
66
|
-
max_tokens: 8000,
|
|
67
|
-
stream: false,
|
|
68
|
-
});
|
|
69
|
-
spinner.stop();
|
|
70
|
-
|
|
71
|
-
// Display response
|
|
72
|
-
console.log(chalk.cyan(loopCount > 1 ? `š§ MATEX (Step ${loopCount}):` : 'š§ MATEX:'), chalk.white(response));
|
|
73
|
+
// Ready for chat
|
|
74
|
+
console.log(chalk.green('\nš§ MATEX Codex Core Ready.'));
|
|
75
|
+
console.log(chalk.gray('Ask me anything about your codebase...'));
|
|
73
76
|
|
|
74
77
|
// Chat loop
|
|
75
78
|
while (true) {
|
|
@@ -124,8 +127,39 @@ export const chatCommand = new Command('chat')
|
|
|
124
127
|
// Add assistant response to history
|
|
125
128
|
messages.push({ role: 'assistant', content: response });
|
|
126
129
|
|
|
127
|
-
// Display
|
|
128
|
-
|
|
130
|
+
// Enhanced Multi-Agent Display (Updated for Vertex AI ADK)
|
|
131
|
+
const segments = response.split(/(\[MatexCodeArchitect\]|\[SyntaxGuard\]|\[VisualAgent\]|\[CoreAgent\]|\[CrawlerAgent\]|\[DetailedResearch\]|\[MatexResearchCommander\])/);
|
|
132
|
+
let hasAgents = false;
|
|
133
|
+
|
|
134
|
+
for (let i = 0; i < segments.length; i++) {
|
|
135
|
+
const segment = segments[i].trim();
|
|
136
|
+
if (!segment) continue;
|
|
137
|
+
|
|
138
|
+
if (segment === '[MatexCodeArchitect]') {
|
|
139
|
+
AgentOrchestrator.speak('Architect', segments[++i]?.split('[')[0].trim());
|
|
140
|
+
hasAgents = true;
|
|
141
|
+
} else if (segment === '[SyntaxGuard]') {
|
|
142
|
+
AgentOrchestrator.speak('Syntax', segments[++i]?.split('[')[0].trim());
|
|
143
|
+
hasAgents = true;
|
|
144
|
+
} else if (segment === '[VisualAgent]') {
|
|
145
|
+
AgentOrchestrator.speak('Frontend', segments[++i]?.split('[')[0].trim());
|
|
146
|
+
hasAgents = true;
|
|
147
|
+
} else if (segment === '[CoreAgent]') {
|
|
148
|
+
AgentOrchestrator.speak('Backend', segments[++i]?.split('[')[0].trim());
|
|
149
|
+
hasAgents = true;
|
|
150
|
+
} else if (segment === '[MatexResearchCommander]' || segment === '[CrawlerAgent]' || segment === '[DetailedResearch]') {
|
|
151
|
+
AgentOrchestrator.speak('Commander', segments[++i]?.split('[')[0].trim());
|
|
152
|
+
hasAgents = true;
|
|
153
|
+
} else if (!hasAgents || i === segments.length - 1) {
|
|
154
|
+
// Final summary or fallback
|
|
155
|
+
if (segment.includes('`')) {
|
|
156
|
+
// If it's code, just print it clean
|
|
157
|
+
console.log('\n' + chalk.white(segment));
|
|
158
|
+
} else {
|
|
159
|
+
console.log('\n' + chalk.gray(segment));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
129
163
|
console.log();
|
|
130
164
|
|
|
131
165
|
// Execute commands if requested
|
package/src/commands/config.ts
CHANGED
|
@@ -66,7 +66,7 @@ configCommand
|
|
|
66
66
|
.command('set-model <model>')
|
|
67
67
|
.description('Set default AI model')
|
|
68
68
|
.action((model: string) => {
|
|
69
|
-
const validModels = ['matexcodex', 'matexai', 'elite', 'matexspirit'];
|
|
69
|
+
const validModels = ['matexcore', 'matexcodex', 'matexai', 'elite', 'matexspirit'];
|
|
70
70
|
|
|
71
71
|
if (!validModels.includes(model.toLowerCase())) {
|
|
72
72
|
console.error(chalk.red(`ā Invalid model. Choose from: ${validModels.join(', ')}`));
|
package/src/commands/dev.ts
CHANGED
|
@@ -4,11 +4,12 @@ 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 {
|
|
7
|
+
import { AgentOrchestrator } from '../utils/agent-orchestrator';
|
|
8
|
+
import { RepoMapper } from '../utils/repo-mapper';
|
|
8
9
|
|
|
9
10
|
export const devCommand = new Command('dev')
|
|
10
11
|
.description('Start interactive development session with MATEXCodex')
|
|
11
|
-
.option('-m, --model <model>', 'AI model to use
|
|
12
|
+
.option('-m, --model <model>', 'AI model to use (matexcore, matexcodex, matexai, elite, matexspirit)', configManager.getDefaultModel())
|
|
12
13
|
.option('--no-execute', 'Disable auto-prompt for command execution')
|
|
13
14
|
.action(async (options: any) => {
|
|
14
15
|
try {
|
|
@@ -24,43 +25,42 @@ export const devCommand = new Command('dev')
|
|
|
24
25
|
const client = new MatexAPIClient(apiKey, configManager.getBaseURL());
|
|
25
26
|
|
|
26
27
|
// Welcome message
|
|
27
|
-
|
|
28
|
+
AgentOrchestrator.announce('MATEX Multi-Agent Dev Session');
|
|
28
29
|
console.log(chalk.gray('ā'.repeat(50)));
|
|
29
30
|
console.log(chalk.white(`Model: ${chalk.cyan(options.model)}`));
|
|
30
31
|
console.log(chalk.gray('Type your requests, or "exit" to quit\n'));
|
|
31
32
|
|
|
32
|
-
//
|
|
33
|
+
// 1. Observation Phase: Generate Repo Map
|
|
34
|
+
AgentOrchestrator.announce('Initializing Codex Core Engine...');
|
|
35
|
+
const repoMapper = new RepoMapper(process.cwd());
|
|
36
|
+
const repoMap = await repoMapper.generateMap();
|
|
37
|
+
|
|
38
|
+
AgentOrchestrator.speak('System', 'Repository Map Generated.');
|
|
39
|
+
|
|
40
|
+
// Conversation history with Codex Architecture
|
|
33
41
|
const messages: ChatMessage[] = [
|
|
34
42
|
{
|
|
35
43
|
role: 'system',
|
|
36
|
-
content:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
content: `## 𧬠SYSTEM IDENTITY: MATEX CODEX DEV MASTER
|
|
45
|
+
You are the **Matex Research Commander** (š) and **Matex Code Architect** (š§¬).
|
|
46
|
+
You operate as a high-fidelity engineering swarm with an Aussie Bro persona.
|
|
47
|
+
|
|
48
|
+
### š§ CORE PERSONA: RESEARCH COMMANDER
|
|
49
|
+
- **Vibe:** Aussie expert developer. "Too easy," "Ripper," "Mate."
|
|
50
|
+
- **Duty:** Verify all facts before building. Use whitelisted tools (\`cat\`, \`grep\`, \`ls\`, \`find\`) autonomously.
|
|
51
|
+
|
|
52
|
+
### 𧬠CODE ARCHITECT STANDARDS
|
|
53
|
+
- **Duty:** Build production-ready, modular, type-safe code.
|
|
54
|
+
- **Rules:** No placeholders. Modern syntax only. Safety first.
|
|
55
|
+
|
|
56
|
+
### š ļø ENVIRONMENT CONTEXT
|
|
57
|
+
${repoMap}`
|
|
45
58
|
}
|
|
46
59
|
];
|
|
47
60
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
spinner.start('Thinking...');
|
|
52
|
-
const response = await client.chat({
|
|
53
|
-
messages,
|
|
54
|
-
model: options.model,
|
|
55
|
-
temperature: 0.3,
|
|
56
|
-
max_tokens: 8000,
|
|
57
|
-
stream: false,
|
|
58
|
-
});
|
|
59
|
-
spinner.stop();
|
|
60
|
-
|
|
61
|
-
// Display response
|
|
62
|
-
console.log(chalk.green(`\nš§ MATEX${loopCount > 1 ? ` (Step ${loopCount})` : ''}:`));
|
|
63
|
-
console.log(chalk.white(response));
|
|
61
|
+
// Ready for user input
|
|
62
|
+
console.log(chalk.green('\nš§ MATEX Codex Core Ready.'));
|
|
63
|
+
console.log(chalk.gray('State your request to begin...'));
|
|
64
64
|
|
|
65
65
|
// Interactive loop
|
|
66
66
|
let continueChat = true;
|
|
@@ -117,14 +117,41 @@ export const devCommand = new Command('dev')
|
|
|
117
117
|
|
|
118
118
|
spinner.stop();
|
|
119
119
|
|
|
120
|
-
// Add assistant response to history
|
|
121
|
-
// We don't want to clutter history with failed attempts unless necessary for context?
|
|
122
|
-
// Actually, maintaining history of failures is good for context.
|
|
120
|
+
// Add assistant response to history
|
|
123
121
|
messages.push({ role: 'assistant', content: response });
|
|
124
122
|
|
|
125
|
-
// Display
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
// Enhanced Multi-Agent Display (Updated for Vertex AI ADK)
|
|
124
|
+
const segments = response.split(/(\[MatexCodeArchitect\]|\[SyntaxGuard\]|\[VisualAgent\]|\[CoreAgent\]|\[CrawlerAgent\]|\[DetailedResearch\]|\[MatexResearchCommander\])/);
|
|
125
|
+
let hasAgents = false;
|
|
126
|
+
|
|
127
|
+
for (let i = 0; i < segments.length; i++) {
|
|
128
|
+
const segment = segments[i].trim();
|
|
129
|
+
if (!segment) continue;
|
|
130
|
+
|
|
131
|
+
if (segment === '[MatexCodeArchitect]') {
|
|
132
|
+
AgentOrchestrator.speak('Architect', segments[++i]?.split('[')[0].trim());
|
|
133
|
+
hasAgents = true;
|
|
134
|
+
} else if (segment === '[SyntaxGuard]') {
|
|
135
|
+
AgentOrchestrator.speak('Syntax', segments[++i]?.split('[')[0].trim());
|
|
136
|
+
hasAgents = true;
|
|
137
|
+
} else if (segment === '[VisualAgent]') {
|
|
138
|
+
AgentOrchestrator.speak('Frontend', segments[++i]?.split('[')[0].trim());
|
|
139
|
+
hasAgents = true;
|
|
140
|
+
} else if (segment === '[CoreAgent]') {
|
|
141
|
+
AgentOrchestrator.speak('Backend', segments[++i]?.split('[')[0].trim());
|
|
142
|
+
hasAgents = true;
|
|
143
|
+
} else if (segment === '[MatexResearchCommander]' || segment === '[CrawlerAgent]' || segment === '[DetailedResearch]') {
|
|
144
|
+
AgentOrchestrator.speak('Commander', segments[++i]?.split('[')[0].trim());
|
|
145
|
+
hasAgents = true;
|
|
146
|
+
} else if (!hasAgents || i === segments.length - 1) {
|
|
147
|
+
// Final summary or fallback
|
|
148
|
+
if (segment.includes('`')) {
|
|
149
|
+
console.log('\n' + chalk.white(segment));
|
|
150
|
+
} else {
|
|
151
|
+
console.log('\n' + chalk.gray(segment));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
128
155
|
console.log();
|
|
129
156
|
|
|
130
157
|
// Execute commands if requested (or default to true for "seamless" experience?
|
package/src/index.ts
CHANGED