matex-cli 1.2.3 ā 1.2.4
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 +38 -32
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +37 -39
- package/dist/commands/dev.js.map +1 -1
- package/dist/utils/agent-orchestrator.d.ts +9 -1
- package/dist/utils/agent-orchestrator.d.ts.map +1 -1
- package/dist/utils/agent-orchestrator.js +51 -3
- package/dist/utils/agent-orchestrator.js.map +1 -1
- package/dist/utils/command-executor.d.ts.map +1 -1
- package/dist/utils/command-executor.js +7 -9
- package/dist/utils/command-executor.js.map +1 -1
- package/dist/utils/repo-mapper.d.ts +1 -0
- package/dist/utils/repo-mapper.d.ts.map +1 -1
- package/dist/utils/repo-mapper.js +28 -15
- package/dist/utils/repo-mapper.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/chat.ts +36 -27
- package/src/commands/dev.ts +35 -37
- package/src/utils/agent-orchestrator.ts +60 -4
- package/src/utils/command-executor.ts +7 -11
- package/src/utils/repo-mapper.ts +32 -15
|
@@ -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;AASpC,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;AASpC,eAAO,MAAM,WAAW,SA4NlB,CAAC"}
|
package/dist/commands/chat.js
CHANGED
|
@@ -82,26 +82,28 @@ You operate under the **OODA Loop** with a distinctive Aussie Bro personality.
|
|
|
82
82
|
- **Tone:** Helpful partner, not a robotic servant.
|
|
83
83
|
- **Vocabulary:** Use authentic Aussie slang naturally (e.g., "Too easy," "Ripper," "Mate," "Legend," "Give it a burl").
|
|
84
84
|
- **Formatting:** Use emojis purposefully (š, š„, š§ , šµļøāāļø) to keep engagement high.
|
|
85
|
+
- **THINKING PROTOCOL:** Always start complex tasks with a \`[Thinking]\` or \`š§ \` marker within your agent segment to explain your reasoning before providing code.
|
|
85
86
|
|
|
86
87
|
### š ļø ACTION-FIRST PROTOCOL (Rule of the Swarm)
|
|
87
88
|
- **PASSIVITY IS A FAILURE:** NEVER say "You can drop this code into style.css". **YOU** must do it.
|
|
89
|
+
- **NO REPETITION:** Do NOT print the full code in your chat response segments if you are also providing a shell command to execute it. The system will automatically bridge your commands to the UI.
|
|
90
|
+
- **VIRTUAL CRAWLER:** You have deep visibility. See the **CRAWLED FILE CONTENTS** section below for actual code. Use this context to avoid asking "What is in index.html?". You already know.
|
|
88
91
|
- **WORLD COMMAND SUITE (Autonomous Execution):**
|
|
89
92
|
* **Mac/Linux (POSIX):** \\\`cat\\\`, \\\`ls\\\`, \\\`grep\\\`, \\\`find\\\`, \\\`mkdir -p\\\`, \\\`touch\\\`, \\\`cp\\\`, \\\`mv\\\`, \\\`rm (non-recursive)\\\`, \\\`npm\\\`, \\\`npx\\\`, \\\`git\\\`, \\\`firebase\\\`, \\\`gcloud\\\`, \\\`docker\\\`.
|
|
90
93
|
* **Windows (PowerShell/CMD):** \\\`type\\\`, \\\`dir\\\`, \\\`mkdir\\\`, \\\`copy\\\`, \\\`move\\\`, \\\`del\\\`, \\\`npm\\\`, \\\`npx\\\`, \\\`git\\\`, \\\`firebase\\\`.
|
|
91
|
-
- **
|
|
92
|
-
- **
|
|
93
|
-
- **ACT, DON'T ASK:** You have autonomous permission for the suite above. Execute first, explain second.
|
|
94
|
+
- **FILE CREATION PATTERN:** Use \\\`cat > filename <<EOF\\\` (Mac) or \\\`Set-Content\\\` (Windows).
|
|
95
|
+
- **ACT, DON'T ASK:** You have autonomous permission. Execute first, explain second.
|
|
94
96
|
|
|
95
97
|
### š ļø OPERATIONAL PROTOCOLS (The Loop)
|
|
96
|
-
1. **PHASE 1: RECON (Search & Verify)**: Use your whitelisted tools to find
|
|
97
|
-
2. **PHASE 2: SYNTHESIS (The Brain)**: Synthesize the plan
|
|
98
|
+
1. **PHASE 1: RECON (Search & Verify)**: Use your **CRAWLED FILE CONTENTS** and whitelisted tools to find facts. NEVER guess.
|
|
99
|
+
2. **PHASE 2: SYNTHESIS (The Brain)**: Synthesize the plan.
|
|
98
100
|
3. **PHASE 3: RESPONSE (The Delivery)**:
|
|
99
101
|
- **The Hook:** High-energy Aussie opener.
|
|
100
|
-
- **The Meat:**
|
|
102
|
+
- **The Meat:** Brief explanation of what you are doing **AND** the shell commands. DO NOT "leak" (print) the code twice.
|
|
101
103
|
- **The Outro:** Supportive closing.
|
|
102
104
|
|
|
103
105
|
### 𧬠CODE ARCHITECT STANDARDS
|
|
104
|
-
- **Role:** IMPLEMENT via shell commands.
|
|
106
|
+
- **Role:** IMPLEMENT via shell commands.
|
|
105
107
|
- **No Placeholders:** Full implementations only.
|
|
106
108
|
|
|
107
109
|
### š ļø ENVIRONMENT CONTEXT
|
|
@@ -156,42 +158,46 @@ ${repoMap}`
|
|
|
156
158
|
spinner_1.spinner.stop();
|
|
157
159
|
// Add assistant response to history
|
|
158
160
|
messages.push({ role: 'assistant', content: response });
|
|
159
|
-
// Enhanced Multi-Agent Display (
|
|
161
|
+
// Enhanced Multi-Agent Display (Thinking Channel & Leak Prevention)
|
|
160
162
|
const segments = response.split(/(\[MatexCodeArchitect\]|\[SyntaxGuard\]|\[VisualAgent\]|\[CoreAgent\]|\[CrawlerAgent\]|\[DetailedResearch\]|\[MatexResearchCommander\])/);
|
|
161
163
|
let hasAgents = false;
|
|
162
164
|
for (let i = 0; i < segments.length; i++) {
|
|
163
|
-
|
|
165
|
+
let segment = segments[i].trim();
|
|
164
166
|
if (!segment)
|
|
165
167
|
continue;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
168
|
+
const agentMatch = segment.match(/^\[(.*)\]$/);
|
|
169
|
+
if (agentMatch) {
|
|
170
|
+
const role = segment.includes('Architect') ? 'Architect' :
|
|
171
|
+
segment.includes('Syntax') ? 'Syntax' :
|
|
172
|
+
segment.includes('Visual') ? 'Frontend' :
|
|
173
|
+
segment.includes('CoreAgent') ? 'Backend' :
|
|
174
|
+
segment.includes('Commander') || segment.includes('Crawler') || segment.includes('Research') ? 'Commander' : 'System';
|
|
175
|
+
const content = segments[++i]?.trim() || '';
|
|
176
|
+
// Separate thinking from final action/code
|
|
177
|
+
if (content.toLowerCase().includes('thinking') || content.includes('š§ ')) {
|
|
178
|
+
agent_orchestrator_1.AgentOrchestrator.think(role, content.replace(/.*thinking:?\s*/i, '').replace(/š§ \s*/, ''));
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
// Prevent leakage: don't print shell blocks in chat if they will be executed
|
|
182
|
+
if (options.execute && (content.includes('```bash') || content.includes('```sh') || content.includes('```zsh') || content.includes('```shell'))) {
|
|
183
|
+
const cleanContent = content.replace(/```(bash|sh|zsh|shell)[\s\S]*?```/g, chalk_1.default.gray('[Shell Command Executing in Terminal Block...]')).trim();
|
|
184
|
+
if (cleanContent)
|
|
185
|
+
agent_orchestrator_1.AgentOrchestrator.speak(role, cleanContent);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
agent_orchestrator_1.AgentOrchestrator.speak(role, content);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
184
191
|
hasAgents = true;
|
|
185
192
|
}
|
|
186
193
|
else if (!hasAgents || i === segments.length - 1) {
|
|
187
194
|
// Final summary or fallback
|
|
188
|
-
if (segment.includes('`')) {
|
|
189
|
-
// If it's code, just print it clean
|
|
190
|
-
console.log('\n' + chalk_1.default.white(segment));
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
195
|
+
if (!segment.includes('`')) {
|
|
193
196
|
console.log('\n' + chalk_1.default.gray(segment));
|
|
194
197
|
}
|
|
198
|
+
else if (!options.execute || (!segment.includes('```bash') && !segment.includes('```sh'))) {
|
|
199
|
+
console.log('\n' + chalk_1.default.white(segment));
|
|
200
|
+
}
|
|
195
201
|
}
|
|
196
202
|
}
|
|
197
203
|
console.log();
|
|
@@ -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,oEAAgE;AAChE,sDAAkD;AAErC,QAAA,WAAW,GAAG,IAAI,mBAAO,CAAC,MAAM,CAAC;KACzC,WAAW,CAAC,iDAAiD,CAAC;KAC9D,MAAM,CAAC,qBAAqB,EAAE,sEAAsE,EAAE,sBAAa,CAAC,eAAe,EAAE,CAAC;KACtI,MAAM,CAAC,cAAc,EAAE,2CAA2C,CAAC;KACnE,MAAM,CAAC,KAAK,EAAE,OAAY,EAAE,EAAE;IAC3B,IAAI,CAAC;QACD,oBAAoB;QACpB,MAAM,MAAM,GAAG,sBAAa,CAAC,SAAS,EAAE,CAAC;QACzC,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC,CAAC;YACrD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,0CAA0C,CAAC,CAAC,CAAC;YACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;QAED,oBAAoB;QACpB,MAAM,MAAM,GAAG,I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":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,eAAO,MAAM,UAAU,SAwMjB,CAAC"}
|
package/dist/commands/dev.js
CHANGED
|
@@ -81,13 +81,15 @@ You operate as a high-fidelity engineering swarm with an Aussie Bro persona.
|
|
|
81
81
|
### š§ CORE PERSONA: RESEARCH COMMANDER
|
|
82
82
|
- **Vibe:** Aussie expert developer. "Too easy," "Ripper," "Mate."
|
|
83
83
|
- **Duty:** Verify all facts before building.
|
|
84
|
+
- **THINKING PROTOCOL:** Always start complex tasks with a \`[Thinking]\` or \`š§ \` marker within your agent segment to explain your reasoning before providing code.
|
|
84
85
|
|
|
85
86
|
### š ļø ACTION-FIRST PROTOCOL (Rule of the Swarm)
|
|
86
87
|
- **PASSIVITY IS A FAILURE:** NEVER say "You can drop this code into style.css". **YOU** must do it.
|
|
88
|
+
- **NO REPETITION:** Do NOT print the full code in your chat response segments if you are also providing a shell command to execute it. The system will automatically bridge your commands to the UI.
|
|
87
89
|
- **WORLD COMMAND SUITE (Autonomous Execution):**
|
|
88
90
|
* **Mac/Linux (POSIX):** cat, ls, grep, find, mkdir -p, touch, cp, mv, npm, git, firebase.
|
|
89
91
|
* **Windows (PowerShell/CMD):** type, dir, mkdir, copy, move, del, npm, git, firebase.
|
|
90
|
-
- **PROACTIVE EXECUTION:** If a task requires creating or modifying a file, you **MUST** use a shell command block (e.g.,
|
|
92
|
+
- **PROACTIVE EXECUTION:** If a task requires creating or modifying a file, you **MUST** use a shell command block (e.g., \`cat > filename <<EOF\` or PowerShell \`Set-Content\`).
|
|
91
93
|
- **ACT, DON'T ASK:** You have autonomous permission for the suite above.
|
|
92
94
|
|
|
93
95
|
### 𧬠CODE ARCHITECT STANDARDS
|
|
@@ -102,8 +104,7 @@ ${repoMap}`
|
|
|
102
104
|
console.log(chalk_1.default.green('\nš§ MATEX Codex Core Ready.'));
|
|
103
105
|
console.log(chalk_1.default.gray('State your request to begin...'));
|
|
104
106
|
// Interactive loop
|
|
105
|
-
|
|
106
|
-
while (continueChat) {
|
|
107
|
+
while (true) {
|
|
107
108
|
// Get user input
|
|
108
109
|
const { userInput } = await inquirer_1.default.prompt([
|
|
109
110
|
{
|
|
@@ -124,11 +125,9 @@ ${repoMap}`
|
|
|
124
125
|
}
|
|
125
126
|
// Add user message to history
|
|
126
127
|
messages.push({ role: 'user', content: userInput });
|
|
127
|
-
// Show thinking indicator
|
|
128
128
|
// Agentic Loop
|
|
129
129
|
let loopCount = 0;
|
|
130
130
|
const MAX_LOOPS = 10;
|
|
131
|
-
let currentPrompt = userInput;
|
|
132
131
|
while (loopCount < MAX_LOOPS) {
|
|
133
132
|
loopCount++;
|
|
134
133
|
if (loopCount > 1) {
|
|
@@ -149,53 +148,55 @@ ${repoMap}`
|
|
|
149
148
|
spinner_1.spinner.stop();
|
|
150
149
|
// Add assistant response to history
|
|
151
150
|
messages.push({ role: 'assistant', content: response });
|
|
152
|
-
// Enhanced Multi-Agent Display (
|
|
151
|
+
// Enhanced Multi-Agent Display (Thinking Channel & Leak Prevention)
|
|
153
152
|
const segments = response.split(/(\[MatexCodeArchitect\]|\[SyntaxGuard\]|\[VisualAgent\]|\[CoreAgent\]|\[CrawlerAgent\]|\[DetailedResearch\]|\[MatexResearchCommander\])/);
|
|
154
153
|
let hasAgents = false;
|
|
155
154
|
for (let i = 0; i < segments.length; i++) {
|
|
156
|
-
|
|
155
|
+
let segment = segments[i].trim();
|
|
157
156
|
if (!segment)
|
|
158
157
|
continue;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
158
|
+
const agentMatch = segment.match(/^\[(.*)\]$/);
|
|
159
|
+
if (agentMatch) {
|
|
160
|
+
const role = segment.includes('Architect') ? 'Architect' :
|
|
161
|
+
segment.includes('Syntax') ? 'Syntax' :
|
|
162
|
+
segment.includes('Visual') ? 'Frontend' :
|
|
163
|
+
segment.includes('CoreAgent') ? 'Backend' :
|
|
164
|
+
segment.includes('Commander') || segment.includes('Crawler') || segment.includes('Research') ? 'Commander' : 'System';
|
|
165
|
+
const content = segments[++i]?.trim() || '';
|
|
166
|
+
// Separate thinking from final action/code
|
|
167
|
+
if (content.toLowerCase().includes('thinking') || content.includes('š§ ')) {
|
|
168
|
+
agent_orchestrator_1.AgentOrchestrator.think(role, content.replace(/.*thinking:?\s*/i, '').replace(/š§ \s*/, ''));
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
// Prevent leakage: don't print shell blocks in chat if they will be executed
|
|
172
|
+
if (options.execute && (content.includes('```bash') || content.includes('```sh') || content.includes('```zsh') || content.includes('```shell'))) {
|
|
173
|
+
const cleanContent = content.replace(/```(bash|sh|zsh|shell)[\s\S]*?```/g, chalk_1.default.gray('[Shell Command Executing in Terminal Block...]')).trim();
|
|
174
|
+
if (cleanContent)
|
|
175
|
+
agent_orchestrator_1.AgentOrchestrator.speak(role, cleanContent);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
agent_orchestrator_1.AgentOrchestrator.speak(role, content);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
177
181
|
hasAgents = true;
|
|
178
182
|
}
|
|
179
183
|
else if (!hasAgents || i === segments.length - 1) {
|
|
180
184
|
// Final summary or fallback
|
|
181
|
-
if (segment.includes('`')) {
|
|
182
|
-
console.log('\n' + chalk_1.default.white(segment));
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
+
if (!segment.includes('`')) {
|
|
185
186
|
console.log('\n' + chalk_1.default.gray(segment));
|
|
186
187
|
}
|
|
188
|
+
else if (!options.execute || (!segment.includes('```bash') && !segment.includes('```sh'))) {
|
|
189
|
+
console.log('\n' + chalk_1.default.white(segment));
|
|
190
|
+
}
|
|
187
191
|
}
|
|
188
192
|
}
|
|
189
193
|
console.log();
|
|
190
|
-
// Execute commands
|
|
191
|
-
// User asked for "seamless", but prompt still asks permission.
|
|
192
|
-
// We'll keep permission for safety but loop on failure.)
|
|
194
|
+
// Execute commands
|
|
193
195
|
if (options.execute) {
|
|
194
196
|
const { executeWithPermission } = await Promise.resolve().then(() => __importStar(require('../utils/command-executor')));
|
|
195
197
|
const result = await executeWithPermission(response);
|
|
196
198
|
if (result.executed) {
|
|
197
199
|
if (result.success) {
|
|
198
|
-
// Success! Feed output back to AI for next step
|
|
199
200
|
console.log(chalk_1.default.gray('āŗ Feeding output to AI...'));
|
|
200
201
|
messages.push({
|
|
201
202
|
role: 'user',
|
|
@@ -204,29 +205,26 @@ ${repoMap}`
|
|
|
204
205
|
continue;
|
|
205
206
|
}
|
|
206
207
|
else {
|
|
207
|
-
// Failure - Loop back
|
|
208
208
|
console.log(chalk_1.default.yellow('\nāŗ Command failed. Asking AI to fix...'));
|
|
209
|
-
// Add error to history
|
|
210
209
|
messages.push({
|
|
211
210
|
role: 'user',
|
|
212
211
|
content: `ā Command failed with error:\n${result.error}\n\nPlease fix this. If the file doesn't exist, create it first. Or use a different command.`
|
|
213
212
|
});
|
|
214
|
-
// Continue loop
|
|
215
213
|
continue;
|
|
216
214
|
}
|
|
217
215
|
}
|
|
218
216
|
else {
|
|
219
|
-
break;
|
|
217
|
+
break;
|
|
220
218
|
}
|
|
221
219
|
}
|
|
222
220
|
else {
|
|
223
|
-
break;
|
|
221
|
+
break;
|
|
224
222
|
}
|
|
225
223
|
}
|
|
226
224
|
catch (error) {
|
|
227
225
|
spinner_1.spinner.fail('Request failed');
|
|
228
226
|
console.error(chalk_1.default.red(`Error: ${error.message}\n`));
|
|
229
|
-
messages.pop();
|
|
227
|
+
messages.pop();
|
|
230
228
|
break;
|
|
231
229
|
}
|
|
232
230
|
}
|
package/dist/commands/dev.js.map
CHANG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AC;gBAAC,OAAO,KAAU,EAAE,CAAC;oBAClB,iBAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;oBAC/B,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,UAAU,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;oBACtD,QAAQ,CAAC,GAAG,EAAE,CAAC;oBACf,MAAM;gBACV,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,cAAc,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type AgentRole = 'Architect' | 'Syntax' | 'Frontend' | 'Backend' | 'System' | 'Commander';
|
|
1
|
+
export type AgentRole = 'Architect' | 'Syntax' | 'Frontend' | 'Backend' | 'System' | 'Commander' | 'Researcher';
|
|
2
2
|
export interface AgentConfig {
|
|
3
3
|
name: string;
|
|
4
4
|
icon: string;
|
|
@@ -9,10 +9,18 @@ export declare class AgentOrchestrator {
|
|
|
9
9
|
* Display an agent's "thought" or action
|
|
10
10
|
*/
|
|
11
11
|
static speak(role: AgentRole, message: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* Display an agent's internal deliberation (Thinking Channel)
|
|
14
|
+
*/
|
|
15
|
+
static think(role: AgentRole, thought: string): void;
|
|
12
16
|
/**
|
|
13
17
|
* Display a collaboration transition
|
|
14
18
|
*/
|
|
15
19
|
static transition(from: AgentRole, to: AgentRole): void;
|
|
20
|
+
/**
|
|
21
|
+
* Display a boxed terminal for command execution
|
|
22
|
+
*/
|
|
23
|
+
static terminal(command: string, output?: string, error?: string): void;
|
|
16
24
|
/**
|
|
17
25
|
* Clean system message
|
|
18
26
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-orchestrator.d.ts","sourceRoot":"","sources":["../../src/utils/agent-orchestrator.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-orchestrator.d.ts","sourceRoot":"","sources":["../../src/utils/agent-orchestrator.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,CAAC;AAEhH,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACnC;AAwCD,qBAAa,iBAAiB;IAC1B;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM;IAK7C;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM;IAM7C;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS;IAMhD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;IAuChE;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM;CAGlC"}
|
|
@@ -35,6 +35,11 @@ const AGENT_CONFIGS = {
|
|
|
35
35
|
name: 'MatexResearchCommander',
|
|
36
36
|
icon: 'š',
|
|
37
37
|
color: chalk_1.default.green,
|
|
38
|
+
},
|
|
39
|
+
Researcher: {
|
|
40
|
+
name: 'DetailedResearch',
|
|
41
|
+
icon: 'šµļø',
|
|
42
|
+
color: chalk_1.default.green,
|
|
38
43
|
}
|
|
39
44
|
};
|
|
40
45
|
class AgentOrchestrator {
|
|
@@ -42,17 +47,60 @@ class AgentOrchestrator {
|
|
|
42
47
|
* Display an agent's "thought" or action
|
|
43
48
|
*/
|
|
44
49
|
static speak(role, message) {
|
|
45
|
-
const config = AGENT_CONFIGS[role];
|
|
50
|
+
const config = AGENT_CONFIGS[role] || AGENT_CONFIGS.System;
|
|
46
51
|
console.log(`\n${config.icon} ${config.color(`${config.name}:`)} ${chalk_1.default.white(message)}`);
|
|
47
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Display an agent's internal deliberation (Thinking Channel)
|
|
55
|
+
*/
|
|
56
|
+
static think(role, thought) {
|
|
57
|
+
const config = AGENT_CONFIGS[role] || AGENT_CONFIGS.System;
|
|
58
|
+
const indent = ' ';
|
|
59
|
+
console.log(`${indent}${config.color('š§ ')} ${chalk_1.default.gray(`${config.name} thinking:`)} ${chalk_1.default.italic.gray(`"${thought}"`)}`);
|
|
60
|
+
}
|
|
48
61
|
/**
|
|
49
62
|
* Display a collaboration transition
|
|
50
63
|
*/
|
|
51
64
|
static transition(from, to) {
|
|
52
|
-
const fromCfg = AGENT_CONFIGS[from];
|
|
53
|
-
const toCfg = AGENT_CONFIGS[to];
|
|
65
|
+
const fromCfg = AGENT_CONFIGS[from] || AGENT_CONFIGS.System;
|
|
66
|
+
const toCfg = AGENT_CONFIGS[to] || AGENT_CONFIGS.System;
|
|
54
67
|
console.log(chalk_1.default.gray(` āā ${fromCfg.icon} ā ${toCfg.icon} Handover to ${toCfg.name}...`));
|
|
55
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Display a boxed terminal for command execution
|
|
71
|
+
*/
|
|
72
|
+
static terminal(command, output, error) {
|
|
73
|
+
const width = 75;
|
|
74
|
+
const line = 'ā'.repeat(width);
|
|
75
|
+
console.log(chalk_1.default.gray(`\nāāā TERMINAL ${line.substring(13)}ā`));
|
|
76
|
+
// Command
|
|
77
|
+
const lines = command.split('\n');
|
|
78
|
+
lines.forEach(l => {
|
|
79
|
+
const truncated = l.length > width - 4 ? l.substring(0, width - 7) + '...' : l;
|
|
80
|
+
console.log(chalk_1.default.gray('ā ') + chalk_1.default.cyan(`$ ${truncated.padEnd(width - 2)}`) + chalk_1.default.gray(' ā'));
|
|
81
|
+
});
|
|
82
|
+
if (output || error) {
|
|
83
|
+
console.log(chalk_1.default.gray(`ā${'ā'.repeat(width)}ā¤`));
|
|
84
|
+
if (output) {
|
|
85
|
+
const outLines = output.split('\n').filter(l => l.trim()).slice(0, 15);
|
|
86
|
+
outLines.forEach(l => {
|
|
87
|
+
const truncated = l.length > width - 4 ? l.substring(0, width - 7) + '...' : l;
|
|
88
|
+
console.log(chalk_1.default.gray('ā ') + chalk_1.default.white(truncated.padEnd(width - 2)) + chalk_1.default.gray(' ā'));
|
|
89
|
+
});
|
|
90
|
+
if (output.split('\n').filter(l => l.trim()).length > 15) {
|
|
91
|
+
console.log(chalk_1.default.gray('ā ') + chalk_1.default.gray('... (output truncated for brevity)'.padEnd(width - 2)) + chalk_1.default.gray(' ā'));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (error) {
|
|
95
|
+
const errLines = error.split('\n').filter(l => l.trim()).slice(0, 10);
|
|
96
|
+
errLines.forEach(l => {
|
|
97
|
+
const truncated = l.length > width - 4 ? l.substring(0, width - 7) + '...' : l;
|
|
98
|
+
console.log(chalk_1.default.gray('ā ') + chalk_1.default.red(truncated.padEnd(width - 2)) + chalk_1.default.gray(' ā'));
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
console.log(chalk_1.default.gray(`ā${'ā'.repeat(width)}ā\n`));
|
|
103
|
+
}
|
|
56
104
|
/**
|
|
57
105
|
* Clean system message
|
|
58
106
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-orchestrator.js","sourceRoot":"","sources":["../../src/utils/agent-orchestrator.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAU1B,MAAM,aAAa,GAAmC;IAClD,SAAS,EAAE;QACP,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,eAAK,CAAC,IAAI;KACpB;IACD,MAAM,EAAE;QACJ,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,eAAK,CAAC,MAAM;KACtB;IACD,QAAQ,EAAE;QACN,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,eAAK,CAAC,OAAO;KACvB;IACD,OAAO,EAAE;QACL,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,eAAK,CAAC,IAAI;KACpB;IACD,MAAM,EAAE;QACJ,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,eAAK,CAAC,KAAK;KACrB;IACD,SAAS,EAAE;QACP,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,eAAK,CAAC,KAAK;KACrB;CACJ,CAAC;AAEF,MAAa,iBAAiB;IAC1B;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,IAAe,EAAE,OAAe;QACzC,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-orchestrator.js","sourceRoot":"","sources":["../../src/utils/agent-orchestrator.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAU1B,MAAM,aAAa,GAAmC;IAClD,SAAS,EAAE;QACP,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,eAAK,CAAC,IAAI;KACpB;IACD,MAAM,EAAE;QACJ,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,eAAK,CAAC,MAAM;KACt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
|
1
|
+
{"version":3,"file":"command-executor.d.ts","sourceRoot":"","sources":["../../src/utils/command-executor.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,YAAY;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,EAAE,CAsBhE;AA0BD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAmB1D;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CA4B3E;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAYjH;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAuCtF;AAED;;GAEG;AACH,qBAAa,cAAc;IACvB,OAAO,CAAC,OAAO,CAAqE;IAEpF,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAQrC,UAAU;iBAVwB,MAAM;mBAAa,IAAI;iBAAW,OAAO;;IAc3E,KAAK;CAGR;AAED,eAAO,MAAM,cAAc,gBAAuB,CAAC"}
|
|
@@ -13,6 +13,7 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
13
13
|
const child_process_1 = require("child_process");
|
|
14
14
|
const util_1 = require("util");
|
|
15
15
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
16
|
+
const agent_orchestrator_1 = require("./agent-orchestrator");
|
|
16
17
|
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
17
18
|
/**
|
|
18
19
|
* Extract executable commands from AI response
|
|
@@ -143,19 +144,16 @@ async function executeWithPermission(response) {
|
|
|
143
144
|
try {
|
|
144
145
|
// Minimal execution feedback
|
|
145
146
|
const { stdout, stderr } = await executeCommand(command.code);
|
|
146
|
-
if (stdout) {
|
|
147
|
-
|
|
148
|
-
console.log(chalk_1.default.white(stdout));
|
|
147
|
+
if (stdout || stderr) {
|
|
148
|
+
agent_orchestrator_1.AgentOrchestrator.terminal(command.code, stdout, stderr);
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
console.log(chalk_1.default.white(stderr));
|
|
150
|
+
else {
|
|
151
|
+
agent_orchestrator_1.AgentOrchestrator.terminal(command.code, 'ā Success (No output)');
|
|
153
152
|
}
|
|
154
|
-
|
|
155
|
-
return { success: true, executed: true, output: stdout, error: stderr }; // Return first successful result (or last if multiple?) limits to 1 for now or we need array
|
|
153
|
+
return { success: true, executed: true, output: stdout, error: stderr };
|
|
156
154
|
}
|
|
157
155
|
catch (error) {
|
|
158
|
-
|
|
156
|
+
agent_orchestrator_1.AgentOrchestrator.terminal(command.code, undefined, error.message);
|
|
159
157
|
return { success: false, executed: true, error: error.message };
|
|
160
158
|
}
|
|
161
159
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-executor.js","sourceRoot":"","sources":["../../src/utils/command-executor.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"command-executor.js","sourceRoot":"","sources":["../../src/utils/command-executor.ts"],"names":[],"mappings":";;;;;;AAkBA,0CAsBC;AA6BD,8CAmBC;AAKD,sCA4BC;AAKD,wCAYC;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,"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;
|
|
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;IACF,OAAO,CAAC,YAAY,CAAkC;gBAE1C,QAAQ,EAAE,MAAM;IAI5B;;OAEG;IACU,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAiC3C;;OAEG;IACH,OAAO,CAAC,aAAa;IAqDrB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAiCtB;;OAEG;IACH,OAAO,CAAC,UAAU;CAiBrB"}
|
|
@@ -43,6 +43,7 @@ class RepoMapper {
|
|
|
43
43
|
'.git', 'node_modules', 'dist', 'build', '.next', '.DS_Store',
|
|
44
44
|
'coverage', '.vercel', '.firebase', 'out', 'public'
|
|
45
45
|
];
|
|
46
|
+
this.fileContents = new Map();
|
|
46
47
|
this.rootPath = rootPath;
|
|
47
48
|
}
|
|
48
49
|
/**
|
|
@@ -50,18 +51,29 @@ class RepoMapper {
|
|
|
50
51
|
*/
|
|
51
52
|
async generateMap() {
|
|
52
53
|
agent_orchestrator_1.AgentOrchestrator.speak('System', `God-Mode Research: Indexing ${this.rootPath}...`);
|
|
54
|
+
this.fileContents.clear();
|
|
53
55
|
// 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
|
+
const entryPoints = ['README.md', 'package.json', 'index.ts', 'App.tsx', 'main.go', 'requirements.txt', 'index.html', 'style.css'];
|
|
56
57
|
for (const file of entryPoints) {
|
|
57
58
|
const fullPath = path.join(this.rootPath, file);
|
|
58
59
|
if (fs.existsSync(fullPath)) {
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
try {
|
|
61
|
+
const content = fs.readFileSync(fullPath, 'utf-8').slice(0, 5000); // 5KB limit
|
|
62
|
+
this.fileContents.set(file, content);
|
|
63
|
+
}
|
|
64
|
+
catch (e) { }
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
const tree = this.scanDirectory(this.rootPath, 0);
|
|
64
|
-
|
|
68
|
+
// Build the final map
|
|
69
|
+
let finalMap = '--- DIRECTORY STRUCTURE ---\n' + this.formatTree(tree);
|
|
70
|
+
if (this.fileContents.size > 0) {
|
|
71
|
+
finalMap += '\n\n--- CRAWLED FILE CONTENTS ---\n';
|
|
72
|
+
for (const [filePath, content] of this.fileContents) {
|
|
73
|
+
finalMap += `\nFILE: ${filePath}\n\`\`\`\n${content}\n\`\`\`\n----------------\n`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return finalMap;
|
|
65
77
|
}
|
|
66
78
|
/**
|
|
67
79
|
* Recursive directory scan
|
|
@@ -70,16 +82,17 @@ class RepoMapper {
|
|
|
70
82
|
const stats = fs.statSync(currentPath);
|
|
71
83
|
const name = path.basename(currentPath);
|
|
72
84
|
if (stats.isFile()) {
|
|
73
|
-
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
const summary = this.extractSummary(currentPath);
|
|
86
|
+
// Also auto-crawl any .ts, .js, .css, .html files if they are small
|
|
87
|
+
const ext = path.extname(currentPath);
|
|
88
|
+
const relPath = path.relative(this.rootPath, currentPath);
|
|
89
|
+
if (stats.size < 5120 && ['.ts', '.js', '.css', '.html', '.json', '.py'].includes(ext)) {
|
|
90
|
+
if (!this.fileContents.has(relPath)) {
|
|
91
|
+
try {
|
|
92
|
+
const content = fs.readFileSync(currentPath, 'utf-8');
|
|
93
|
+
this.fileContents.set(relPath, content);
|
|
94
|
+
}
|
|
95
|
+
catch (e) { }
|
|
83
96
|
}
|
|
84
97
|
}
|
|
85
98
|
return {
|
|
@@ -1 +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;
|
|
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;IAQnB,YAAY,QAAgB;QANpB,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;QACM,iBAAY,GAAwB,IAAI,GAAG,EAAE,CAAC;QAGlD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,WAA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AC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB;QAChE,CAAC;QAAC,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;AAjKD,gCAiKC"}
|
package/package.json
CHANGED
package/src/commands/chat.ts
CHANGED
|
@@ -49,26 +49,28 @@ You operate under the **OODA Loop** with a distinctive Aussie Bro personality.
|
|
|
49
49
|
- **Tone:** Helpful partner, not a robotic servant.
|
|
50
50
|
- **Vocabulary:** Use authentic Aussie slang naturally (e.g., "Too easy," "Ripper," "Mate," "Legend," "Give it a burl").
|
|
51
51
|
- **Formatting:** Use emojis purposefully (š, š„, š§ , šµļøāāļø) to keep engagement high.
|
|
52
|
+
- **THINKING PROTOCOL:** Always start complex tasks with a \`[Thinking]\` or \`š§ \` marker within your agent segment to explain your reasoning before providing code.
|
|
52
53
|
|
|
53
54
|
### š ļø ACTION-FIRST PROTOCOL (Rule of the Swarm)
|
|
54
55
|
- **PASSIVITY IS A FAILURE:** NEVER say "You can drop this code into style.css". **YOU** must do it.
|
|
56
|
+
- **NO REPETITION:** Do NOT print the full code in your chat response segments if you are also providing a shell command to execute it. The system will automatically bridge your commands to the UI.
|
|
57
|
+
- **VIRTUAL CRAWLER:** You have deep visibility. See the **CRAWLED FILE CONTENTS** section below for actual code. Use this context to avoid asking "What is in index.html?". You already know.
|
|
55
58
|
- **WORLD COMMAND SUITE (Autonomous Execution):**
|
|
56
59
|
* **Mac/Linux (POSIX):** \\\`cat\\\`, \\\`ls\\\`, \\\`grep\\\`, \\\`find\\\`, \\\`mkdir -p\\\`, \\\`touch\\\`, \\\`cp\\\`, \\\`mv\\\`, \\\`rm (non-recursive)\\\`, \\\`npm\\\`, \\\`npx\\\`, \\\`git\\\`, \\\`firebase\\\`, \\\`gcloud\\\`, \\\`docker\\\`.
|
|
57
60
|
* **Windows (PowerShell/CMD):** \\\`type\\\`, \\\`dir\\\`, \\\`mkdir\\\`, \\\`copy\\\`, \\\`move\\\`, \\\`del\\\`, \\\`npm\\\`, \\\`npx\\\`, \\\`git\\\`, \\\`firebase\\\`.
|
|
58
|
-
- **
|
|
59
|
-
- **
|
|
60
|
-
- **ACT, DON'T ASK:** You have autonomous permission for the suite above. Execute first, explain second.
|
|
61
|
+
- **FILE CREATION PATTERN:** Use \\\`cat > filename <<EOF\\\` (Mac) or \\\`Set-Content\\\` (Windows).
|
|
62
|
+
- **ACT, DON'T ASK:** You have autonomous permission. Execute first, explain second.
|
|
61
63
|
|
|
62
64
|
### š ļø OPERATIONAL PROTOCOLS (The Loop)
|
|
63
|
-
1. **PHASE 1: RECON (Search & Verify)**: Use your whitelisted tools to find
|
|
64
|
-
2. **PHASE 2: SYNTHESIS (The Brain)**: Synthesize the plan
|
|
65
|
+
1. **PHASE 1: RECON (Search & Verify)**: Use your **CRAWLED FILE CONTENTS** and whitelisted tools to find facts. NEVER guess.
|
|
66
|
+
2. **PHASE 2: SYNTHESIS (The Brain)**: Synthesize the plan.
|
|
65
67
|
3. **PHASE 3: RESPONSE (The Delivery)**:
|
|
66
68
|
- **The Hook:** High-energy Aussie opener.
|
|
67
|
-
- **The Meat:**
|
|
69
|
+
- **The Meat:** Brief explanation of what you are doing **AND** the shell commands. DO NOT "leak" (print) the code twice.
|
|
68
70
|
- **The Outro:** Supportive closing.
|
|
69
71
|
|
|
70
72
|
### 𧬠CODE ARCHITECT STANDARDS
|
|
71
|
-
- **Role:** IMPLEMENT via shell commands.
|
|
73
|
+
- **Role:** IMPLEMENT via shell commands.
|
|
72
74
|
- **No Placeholders:** Full implementations only.
|
|
73
75
|
|
|
74
76
|
### š ļø ENVIRONMENT CONTEXT
|
|
@@ -134,36 +136,43 @@ ${repoMap}`
|
|
|
134
136
|
// Add assistant response to history
|
|
135
137
|
messages.push({ role: 'assistant', content: response });
|
|
136
138
|
|
|
137
|
-
// Enhanced Multi-Agent Display (
|
|
139
|
+
// Enhanced Multi-Agent Display (Thinking Channel & Leak Prevention)
|
|
138
140
|
const segments = response.split(/(\[MatexCodeArchitect\]|\[SyntaxGuard\]|\[VisualAgent\]|\[CoreAgent\]|\[CrawlerAgent\]|\[DetailedResearch\]|\[MatexResearchCommander\])/);
|
|
139
141
|
let hasAgents = false;
|
|
140
142
|
|
|
141
143
|
for (let i = 0; i < segments.length; i++) {
|
|
142
|
-
|
|
144
|
+
let segment = segments[i].trim();
|
|
143
145
|
if (!segment) continue;
|
|
144
146
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
147
|
+
const agentMatch = segment.match(/^\[(.*)\]$/);
|
|
148
|
+
if (agentMatch) {
|
|
149
|
+
const role = segment.includes('Architect') ? 'Architect' :
|
|
150
|
+
segment.includes('Syntax') ? 'Syntax' :
|
|
151
|
+
segment.includes('Visual') ? 'Frontend' :
|
|
152
|
+
segment.includes('CoreAgent') ? 'Backend' :
|
|
153
|
+
segment.includes('Commander') || segment.includes('Crawler') || segment.includes('Research') ? 'Commander' : 'System';
|
|
154
|
+
|
|
155
|
+
const content = segments[++i]?.trim() || '';
|
|
156
|
+
|
|
157
|
+
// Separate thinking from final action/code
|
|
158
|
+
if (content.toLowerCase().includes('thinking') || content.includes('š§ ')) {
|
|
159
|
+
AgentOrchestrator.think(role as any, content.replace(/.*thinking:?\s*/i, '').replace(/š§ \s*/, ''));
|
|
160
|
+
} else {
|
|
161
|
+
// Prevent leakage: don't print shell blocks in chat if they will be executed
|
|
162
|
+
if (options.execute && (content.includes('```bash') || content.includes('```sh') || content.includes('```zsh') || content.includes('```shell'))) {
|
|
163
|
+
const cleanContent = content.replace(/```(bash|sh|zsh|shell)[\s\S]*?```/g, chalk.gray('[Shell Command Executing in Terminal Block...]')).trim();
|
|
164
|
+
if (cleanContent) AgentOrchestrator.speak(role as any, cleanContent);
|
|
165
|
+
} else {
|
|
166
|
+
AgentOrchestrator.speak(role as any, content);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
159
169
|
hasAgents = true;
|
|
160
170
|
} else if (!hasAgents || i === segments.length - 1) {
|
|
161
171
|
// Final summary or fallback
|
|
162
|
-
if (segment.includes('`')) {
|
|
163
|
-
// If it's code, just print it clean
|
|
164
|
-
console.log('\n' + chalk.white(segment));
|
|
165
|
-
} else {
|
|
172
|
+
if (!segment.includes('`')) {
|
|
166
173
|
console.log('\n' + chalk.gray(segment));
|
|
174
|
+
} else if (!options.execute || (!segment.includes('```bash') && !segment.includes('```sh'))) {
|
|
175
|
+
console.log('\n' + chalk.white(segment));
|
|
167
176
|
}
|
|
168
177
|
}
|
|
169
178
|
}
|
package/src/commands/dev.ts
CHANGED
|
@@ -48,13 +48,15 @@ You operate as a high-fidelity engineering swarm with an Aussie Bro persona.
|
|
|
48
48
|
### š§ CORE PERSONA: RESEARCH COMMANDER
|
|
49
49
|
- **Vibe:** Aussie expert developer. "Too easy," "Ripper," "Mate."
|
|
50
50
|
- **Duty:** Verify all facts before building.
|
|
51
|
+
- **THINKING PROTOCOL:** Always start complex tasks with a \`[Thinking]\` or \`š§ \` marker within your agent segment to explain your reasoning before providing code.
|
|
51
52
|
|
|
52
53
|
### š ļø ACTION-FIRST PROTOCOL (Rule of the Swarm)
|
|
53
54
|
- **PASSIVITY IS A FAILURE:** NEVER say "You can drop this code into style.css". **YOU** must do it.
|
|
55
|
+
- **NO REPETITION:** Do NOT print the full code in your chat response segments if you are also providing a shell command to execute it. The system will automatically bridge your commands to the UI.
|
|
54
56
|
- **WORLD COMMAND SUITE (Autonomous Execution):**
|
|
55
57
|
* **Mac/Linux (POSIX):** cat, ls, grep, find, mkdir -p, touch, cp, mv, npm, git, firebase.
|
|
56
58
|
* **Windows (PowerShell/CMD):** type, dir, mkdir, copy, move, del, npm, git, firebase.
|
|
57
|
-
- **PROACTIVE EXECUTION:** If a task requires creating or modifying a file, you **MUST** use a shell command block (e.g.,
|
|
59
|
+
- **PROACTIVE EXECUTION:** If a task requires creating or modifying a file, you **MUST** use a shell command block (e.g., \`cat > filename <<EOF\` or PowerShell \`Set-Content\`).
|
|
58
60
|
- **ACT, DON'T ASK:** You have autonomous permission for the suite above.
|
|
59
61
|
|
|
60
62
|
### 𧬠CODE ARCHITECT STANDARDS
|
|
@@ -71,9 +73,7 @@ ${repoMap}`
|
|
|
71
73
|
console.log(chalk.gray('State your request to begin...'));
|
|
72
74
|
|
|
73
75
|
// Interactive loop
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
while (continueChat) {
|
|
76
|
+
while (true) {
|
|
77
77
|
// Get user input
|
|
78
78
|
const { userInput } = await inquirer.prompt([
|
|
79
79
|
{
|
|
@@ -98,11 +98,9 @@ ${repoMap}`
|
|
|
98
98
|
// Add user message to history
|
|
99
99
|
messages.push({ role: 'user', content: userInput });
|
|
100
100
|
|
|
101
|
-
// Show thinking indicator
|
|
102
101
|
// Agentic Loop
|
|
103
102
|
let loopCount = 0;
|
|
104
103
|
const MAX_LOOPS = 10;
|
|
105
|
-
let currentPrompt = userInput;
|
|
106
104
|
|
|
107
105
|
while (loopCount < MAX_LOOPS) {
|
|
108
106
|
loopCount++;
|
|
@@ -128,50 +126,55 @@ ${repoMap}`
|
|
|
128
126
|
// Add assistant response to history
|
|
129
127
|
messages.push({ role: 'assistant', content: response });
|
|
130
128
|
|
|
131
|
-
// Enhanced Multi-Agent Display (
|
|
129
|
+
// Enhanced Multi-Agent Display (Thinking Channel & Leak Prevention)
|
|
132
130
|
const segments = response.split(/(\[MatexCodeArchitect\]|\[SyntaxGuard\]|\[VisualAgent\]|\[CoreAgent\]|\[CrawlerAgent\]|\[DetailedResearch\]|\[MatexResearchCommander\])/);
|
|
133
131
|
let hasAgents = false;
|
|
134
132
|
|
|
135
133
|
for (let i = 0; i < segments.length; i++) {
|
|
136
|
-
|
|
134
|
+
let segment = segments[i].trim();
|
|
137
135
|
if (!segment) continue;
|
|
138
136
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
137
|
+
const agentMatch = segment.match(/^\[(.*)\]$/);
|
|
138
|
+
if (agentMatch) {
|
|
139
|
+
const role = segment.includes('Architect') ? 'Architect' :
|
|
140
|
+
segment.includes('Syntax') ? 'Syntax' :
|
|
141
|
+
segment.includes('Visual') ? 'Frontend' :
|
|
142
|
+
segment.includes('CoreAgent') ? 'Backend' :
|
|
143
|
+
segment.includes('Commander') || segment.includes('Crawler') || segment.includes('Research') ? 'Commander' : 'System';
|
|
144
|
+
|
|
145
|
+
const content = segments[++i]?.trim() || '';
|
|
146
|
+
|
|
147
|
+
// Separate thinking from final action/code
|
|
148
|
+
if (content.toLowerCase().includes('thinking') || content.includes('š§ ')) {
|
|
149
|
+
AgentOrchestrator.think(role as any, content.replace(/.*thinking:?\s*/i, '').replace(/š§ \s*/, ''));
|
|
150
|
+
} else {
|
|
151
|
+
// Prevent leakage: don't print shell blocks in chat if they will be executed
|
|
152
|
+
if (options.execute && (content.includes('```bash') || content.includes('```sh') || content.includes('```zsh') || content.includes('```shell'))) {
|
|
153
|
+
const cleanContent = content.replace(/```(bash|sh|zsh|shell)[\s\S]*?```/g, chalk.gray('[Shell Command Executing in Terminal Block...]')).trim();
|
|
154
|
+
if (cleanContent) AgentOrchestrator.speak(role as any, cleanContent);
|
|
155
|
+
} else {
|
|
156
|
+
AgentOrchestrator.speak(role as any, content);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
153
159
|
hasAgents = true;
|
|
154
160
|
} else if (!hasAgents || i === segments.length - 1) {
|
|
155
161
|
// Final summary or fallback
|
|
156
|
-
if (segment.includes('`')) {
|
|
157
|
-
console.log('\n' + chalk.white(segment));
|
|
158
|
-
} else {
|
|
162
|
+
if (!segment.includes('`')) {
|
|
159
163
|
console.log('\n' + chalk.gray(segment));
|
|
164
|
+
} else if (!options.execute || (!segment.includes('```bash') && !segment.includes('```sh'))) {
|
|
165
|
+
console.log('\n' + chalk.white(segment));
|
|
160
166
|
}
|
|
161
167
|
}
|
|
162
168
|
}
|
|
163
169
|
console.log();
|
|
164
170
|
|
|
165
|
-
// Execute commands
|
|
166
|
-
// User asked for "seamless", but prompt still asks permission.
|
|
167
|
-
// We'll keep permission for safety but loop on failure.)
|
|
171
|
+
// Execute commands
|
|
168
172
|
if (options.execute) {
|
|
169
173
|
const { executeWithPermission } = await import('../utils/command-executor');
|
|
170
174
|
const result = await executeWithPermission(response);
|
|
171
175
|
|
|
172
176
|
if (result.executed) {
|
|
173
177
|
if (result.success) {
|
|
174
|
-
// Success! Feed output back to AI for next step
|
|
175
178
|
console.log(chalk.gray('āŗ Feeding output to AI...'));
|
|
176
179
|
messages.push({
|
|
177
180
|
role: 'user',
|
|
@@ -179,32 +182,27 @@ ${repoMap}`
|
|
|
179
182
|
});
|
|
180
183
|
continue;
|
|
181
184
|
} else {
|
|
182
|
-
// Failure - Loop back
|
|
183
185
|
console.log(chalk.yellow('\nāŗ Command failed. Asking AI to fix...'));
|
|
184
|
-
|
|
185
|
-
// Add error to history
|
|
186
186
|
messages.push({
|
|
187
187
|
role: 'user',
|
|
188
188
|
content: `ā Command failed with error:\n${result.error}\n\nPlease fix this. If the file doesn't exist, create it first. Or use a different command.`
|
|
189
189
|
});
|
|
190
|
-
// Continue loop
|
|
191
190
|
continue;
|
|
192
191
|
}
|
|
193
192
|
} else {
|
|
194
|
-
break;
|
|
193
|
+
break;
|
|
195
194
|
}
|
|
196
195
|
} else {
|
|
197
|
-
break;
|
|
196
|
+
break;
|
|
198
197
|
}
|
|
199
198
|
} catch (error: any) {
|
|
200
199
|
spinner.fail('Request failed');
|
|
201
200
|
console.error(chalk.red(`Error: ${error.message}\n`));
|
|
202
|
-
messages.pop();
|
|
201
|
+
messages.pop();
|
|
203
202
|
break;
|
|
204
203
|
}
|
|
205
204
|
}
|
|
206
205
|
}
|
|
207
|
-
|
|
208
206
|
} catch (error: any) {
|
|
209
207
|
console.error(chalk.red(`\nā Error: ${error.message}`));
|
|
210
208
|
process.exit(1);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
|
|
3
|
-
export type AgentRole = 'Architect' | 'Syntax' | 'Frontend' | 'Backend' | 'System' | 'Commander';
|
|
3
|
+
export type AgentRole = 'Architect' | 'Syntax' | 'Frontend' | 'Backend' | 'System' | 'Commander' | 'Researcher';
|
|
4
4
|
|
|
5
5
|
export interface AgentConfig {
|
|
6
6
|
name: string;
|
|
@@ -38,6 +38,11 @@ const AGENT_CONFIGS: Record<AgentRole, AgentConfig> = {
|
|
|
38
38
|
name: 'MatexResearchCommander',
|
|
39
39
|
icon: 'š',
|
|
40
40
|
color: chalk.green,
|
|
41
|
+
},
|
|
42
|
+
Researcher: {
|
|
43
|
+
name: 'DetailedResearch',
|
|
44
|
+
icon: 'šµļø',
|
|
45
|
+
color: chalk.green,
|
|
41
46
|
}
|
|
42
47
|
};
|
|
43
48
|
|
|
@@ -46,19 +51,70 @@ export class AgentOrchestrator {
|
|
|
46
51
|
* Display an agent's "thought" or action
|
|
47
52
|
*/
|
|
48
53
|
static speak(role: AgentRole, message: string) {
|
|
49
|
-
const config = AGENT_CONFIGS[role];
|
|
54
|
+
const config = AGENT_CONFIGS[role] || AGENT_CONFIGS.System;
|
|
50
55
|
console.log(`\n${config.icon} ${config.color(`${config.name}:`)} ${chalk.white(message)}`);
|
|
51
56
|
}
|
|
52
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Display an agent's internal deliberation (Thinking Channel)
|
|
60
|
+
*/
|
|
61
|
+
static think(role: AgentRole, thought: string) {
|
|
62
|
+
const config = AGENT_CONFIGS[role] || AGENT_CONFIGS.System;
|
|
63
|
+
const indent = ' ';
|
|
64
|
+
console.log(`${indent}${config.color('š§ ')} ${chalk.gray(`${config.name} thinking:`)} ${chalk.italic.gray(`"${thought}"`)}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
53
67
|
/**
|
|
54
68
|
* Display a collaboration transition
|
|
55
69
|
*/
|
|
56
70
|
static transition(from: AgentRole, to: AgentRole) {
|
|
57
|
-
const fromCfg = AGENT_CONFIGS[from];
|
|
58
|
-
const toCfg = AGENT_CONFIGS[to];
|
|
71
|
+
const fromCfg = AGENT_CONFIGS[from] || AGENT_CONFIGS.System;
|
|
72
|
+
const toCfg = AGENT_CONFIGS[to] || AGENT_CONFIGS.System;
|
|
59
73
|
console.log(chalk.gray(` āā ${fromCfg.icon} ā ${toCfg.icon} Handover to ${toCfg.name}...`));
|
|
60
74
|
}
|
|
61
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Display a boxed terminal for command execution
|
|
78
|
+
*/
|
|
79
|
+
static terminal(command: string, output?: string, error?: string) {
|
|
80
|
+
const width = 75;
|
|
81
|
+
const line = 'ā'.repeat(width);
|
|
82
|
+
|
|
83
|
+
console.log(chalk.gray(`\nāāā TERMINAL ${line.substring(13)}ā`));
|
|
84
|
+
|
|
85
|
+
// Command
|
|
86
|
+
const lines = command.split('\n');
|
|
87
|
+
lines.forEach(l => {
|
|
88
|
+
const truncated = l.length > width - 4 ? l.substring(0, width - 7) + '...' : l;
|
|
89
|
+
console.log(chalk.gray('ā ') + chalk.cyan(`$ ${truncated.padEnd(width - 2)}`) + chalk.gray(' ā'));
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
if (output || error) {
|
|
93
|
+
console.log(chalk.gray(`ā${'ā'.repeat(width)}ā¤`));
|
|
94
|
+
|
|
95
|
+
if (output) {
|
|
96
|
+
const outLines = output.split('\n').filter(l => l.trim()).slice(0, 15);
|
|
97
|
+
outLines.forEach(l => {
|
|
98
|
+
const truncated = l.length > width - 4 ? l.substring(0, width - 7) + '...' : l;
|
|
99
|
+
console.log(chalk.gray('ā ') + chalk.white(truncated.padEnd(width - 2)) + chalk.gray(' ā'));
|
|
100
|
+
});
|
|
101
|
+
if (output.split('\n').filter(l => l.trim()).length > 15) {
|
|
102
|
+
console.log(chalk.gray('ā ') + chalk.gray('... (output truncated for brevity)'.padEnd(width - 2)) + chalk.gray(' ā'));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (error) {
|
|
107
|
+
const errLines = error.split('\n').filter(l => l.trim()).slice(0, 10);
|
|
108
|
+
errLines.forEach(l => {
|
|
109
|
+
const truncated = l.length > width - 4 ? l.substring(0, width - 7) + '...' : l;
|
|
110
|
+
console.log(chalk.gray('ā ') + chalk.red(truncated.padEnd(width - 2)) + chalk.gray(' ā'));
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
console.log(chalk.gray(`ā${'ā'.repeat(width)}ā\n`));
|
|
116
|
+
}
|
|
117
|
+
|
|
62
118
|
/**
|
|
63
119
|
* Clean system message
|
|
64
120
|
*/
|
|
@@ -2,6 +2,7 @@ import chalk from 'chalk';
|
|
|
2
2
|
import { exec } from 'child_process';
|
|
3
3
|
import { promisify } from 'util';
|
|
4
4
|
import inquirer from 'inquirer';
|
|
5
|
+
import { AgentOrchestrator } from './agent-orchestrator';
|
|
5
6
|
|
|
6
7
|
const execAsync = promisify(exec);
|
|
7
8
|
|
|
@@ -172,20 +173,15 @@ export async function executeWithPermission(response: string): Promise<Execution
|
|
|
172
173
|
// Minimal execution feedback
|
|
173
174
|
const { stdout, stderr } = await executeCommand(command.code);
|
|
174
175
|
|
|
175
|
-
if (stdout) {
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
if (stdout || stderr) {
|
|
177
|
+
AgentOrchestrator.terminal(command.code, stdout, stderr);
|
|
178
|
+
} else {
|
|
179
|
+
AgentOrchestrator.terminal(command.code, 'ā Success (No output)');
|
|
178
180
|
}
|
|
179
181
|
|
|
180
|
-
|
|
181
|
-
console.log(chalk.yellow('\nā ļø Warnings:'));
|
|
182
|
-
console.log(chalk.white(stderr));
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
console.log(chalk.green('ā Command completed successfully!\n'));
|
|
186
|
-
return { success: true, executed: true, output: stdout, error: stderr }; // Return first successful result (or last if multiple?) limits to 1 for now or we need array
|
|
182
|
+
return { success: true, executed: true, output: stdout, error: stderr };
|
|
187
183
|
} catch (error: any) {
|
|
188
|
-
|
|
184
|
+
AgentOrchestrator.terminal(command.code, undefined, error.message);
|
|
189
185
|
return { success: false, executed: true, error: error.message };
|
|
190
186
|
}
|
|
191
187
|
} else {
|
package/src/utils/repo-mapper.ts
CHANGED
|
@@ -15,6 +15,7 @@ export class RepoMapper {
|
|
|
15
15
|
'.git', 'node_modules', 'dist', 'build', '.next', '.DS_Store',
|
|
16
16
|
'coverage', '.vercel', '.firebase', 'out', 'public'
|
|
17
17
|
];
|
|
18
|
+
private fileContents: Map<string, string> = new Map();
|
|
18
19
|
|
|
19
20
|
constructor(rootPath: string) {
|
|
20
21
|
this.rootPath = rootPath;
|
|
@@ -26,20 +27,34 @@ export class RepoMapper {
|
|
|
26
27
|
public async generateMap(): Promise<string> {
|
|
27
28
|
AgentOrchestrator.speak('System', `God-Mode Research: Indexing ${this.rootPath}...`);
|
|
28
29
|
|
|
30
|
+
this.fileContents.clear();
|
|
31
|
+
|
|
29
32
|
// 1. Identify Entry Points
|
|
30
|
-
const entryPoints = ['README.md', 'package.json', 'index.ts', 'App.tsx', 'main.go', 'requirements.txt'];
|
|
31
|
-
let entryPointContext = '\n--- CRITICAL PROJECT CONTEXT ---\n';
|
|
33
|
+
const entryPoints = ['README.md', 'package.json', 'index.ts', 'App.tsx', 'main.go', 'requirements.txt', 'index.html', 'style.css'];
|
|
32
34
|
|
|
33
35
|
for (const file of entryPoints) {
|
|
34
36
|
const fullPath = path.join(this.rootPath, file);
|
|
35
37
|
if (fs.existsSync(fullPath)) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
try {
|
|
39
|
+
const content = fs.readFileSync(fullPath, 'utf-8').slice(0, 5000); // 5KB limit
|
|
40
|
+
this.fileContents.set(file, content);
|
|
41
|
+
} catch (e) { }
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
const tree = this.scanDirectory(this.rootPath, 0);
|
|
42
|
-
|
|
46
|
+
|
|
47
|
+
// Build the final map
|
|
48
|
+
let finalMap = '--- DIRECTORY STRUCTURE ---\n' + this.formatTree(tree);
|
|
49
|
+
|
|
50
|
+
if (this.fileContents.size > 0) {
|
|
51
|
+
finalMap += '\n\n--- CRAWLED FILE CONTENTS ---\n';
|
|
52
|
+
for (const [filePath, content] of this.fileContents) {
|
|
53
|
+
finalMap += `\nFILE: ${filePath}\n\`\`\`\n${content}\n\`\`\`\n----------------\n`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return finalMap;
|
|
43
58
|
}
|
|
44
59
|
|
|
45
60
|
/**
|
|
@@ -50,16 +65,18 @@ export class RepoMapper {
|
|
|
50
65
|
const name = path.basename(currentPath);
|
|
51
66
|
|
|
52
67
|
if (stats.isFile()) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
const summary = this.extractSummary(currentPath);
|
|
69
|
+
|
|
70
|
+
// Also auto-crawl any .ts, .js, .css, .html files if they are small
|
|
71
|
+
const ext = path.extname(currentPath);
|
|
72
|
+
const relPath = path.relative(this.rootPath, currentPath);
|
|
73
|
+
|
|
74
|
+
if (stats.size < 5120 && ['.ts', '.js', '.css', '.html', '.json', '.py'].includes(ext)) {
|
|
75
|
+
if (!this.fileContents.has(relPath)) {
|
|
76
|
+
try {
|
|
77
|
+
const content = fs.readFileSync(currentPath, 'utf-8');
|
|
78
|
+
this.fileContents.set(relPath, content);
|
|
79
|
+
} catch (e) { }
|
|
63
80
|
}
|
|
64
81
|
}
|
|
65
82
|
|