matex-cli 1.2.84 → 1.2.88

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.
@@ -1,214 +0,0 @@
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
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.RepoMapper = void 0;
40
- const fs = __importStar(require("fs"));
41
- const path = __importStar(require("path"));
42
- const chalk_1 = __importDefault(require("chalk"));
43
- const agent_orchestrator_1 = require("./agent-orchestrator");
44
- class RepoMapper {
45
- constructor(rootPath) {
46
- this.ignoreList = [
47
- '.git', 'node_modules', 'dist', 'build', '.next', '.DS_Store',
48
- 'coverage', '.vercel', '.firebase', 'out', 'public',
49
- 'bin', 'obj', '.vs', 'vendor', '__pycache__', 'env', '.env', 'venv'
50
- ];
51
- this.fileCount = 0;
52
- this.MAX_FILES = 500;
53
- this.fileContents = new Map();
54
- this.rootPath = rootPath;
55
- }
56
- /**
57
- * Generate a hierarchical map of the repository with deep entry-point analysis
58
- */
59
- async generateMap(silent = false) {
60
- if (!silent)
61
- agent_orchestrator_1.AgentOrchestrator.speak('System', `God-Mode Research: Indexing ${this.rootPath}...`);
62
- this.fileContents.clear();
63
- // 1. Identify Entry Points
64
- const entryPoints = ['README.md', 'package.json', 'index.ts', 'App.tsx', 'main.go', 'requirements.txt', 'index.html', 'style.css'];
65
- let delayMs = 15; // Animation delay
66
- if (!silent) {
67
- agent_orchestrator_1.AgentOrchestrator.speak('System', `God-Mode Research: Injecting scanners into ${this.rootPath}...`);
68
- console.log();
69
- }
70
- for (const file of entryPoints) {
71
- const fullPath = path.join(this.rootPath, file);
72
- if (fs.existsSync(fullPath)) {
73
- try {
74
- const content = fs.readFileSync(fullPath, 'utf-8').slice(0, 5000); // 5KB limit
75
- this.fileContents.set(file, content);
76
- if (!silent)
77
- console.log(chalk_1.default.hex('#4ade80')(` ⚡ [Core Injection] `) + chalk_1.default.gray(`Mapped entry node: `) + chalk_1.default.white.bold(file));
78
- }
79
- catch (e) { }
80
- }
81
- }
82
- if (!silent)
83
- console.log(chalk_1.default.cyan(` 🔍 [Deep Scan] `) + chalk_1.default.gray(`Mapping topology...`));
84
- const tree = this.scanDirectory(this.rootPath, 0);
85
- if (!silent) {
86
- console.log(chalk_1.default.hex('#FF6B00')(` 🔥 [Knowledge Graph] `) + chalk_1.default.gray(`Extracted ${this.fileContents.size} semantic nodes from source.`));
87
- console.log();
88
- }
89
- // Build the final map
90
- let finalMap = `--- ABSOLUTE WORKING DIRECTORY ---\n${this.rootPath}\n\n`;
91
- if (!tree.children || tree.children.length === 0) {
92
- finalMap += `⚠️ [CRITICAL WARNING]: THIS DIRECTORY IS COMPLETELY EMPTY.\nTHERE ARE NO FILES OR FOLDERS HERE.\nDO NOT HALLUCINATE ANY CONTENT!\n\n`;
93
- }
94
- else {
95
- finalMap += `--- DIRECTORY STRUCTURE ---\n` + this.formatTree(tree);
96
- }
97
- if (this.fileContents.size > 0) {
98
- finalMap += '\n\n--- CRAWLED FILE CONTENTS ---\n';
99
- for (const [filePath, content] of this.fileContents) {
100
- finalMap += `\nFILE: ${filePath}\n\`\`\`\n${content}\n\`\`\`\n----------------\n`;
101
- }
102
- }
103
- return finalMap;
104
- }
105
- /**
106
- * Recursive directory scan
107
- */
108
- scanDirectory(currentPath, depth) {
109
- const stats = fs.statSync(currentPath);
110
- const name = path.basename(currentPath);
111
- if (stats.isFile()) {
112
- const summary = this.extractSummary(currentPath);
113
- // Also auto-crawl any .ts, .js, .css, .html files if they are small
114
- const ext = path.extname(currentPath);
115
- const relPath = path.relative(this.rootPath, currentPath);
116
- if (stats.size < 5120 && ['.ts', '.js', '.css', '.html', '.json', '.py'].includes(ext)) {
117
- if (!this.fileContents.has(relPath)) {
118
- try {
119
- const content = fs.readFileSync(currentPath, 'utf-8');
120
- this.fileContents.set(relPath, content);
121
- }
122
- catch (e) { }
123
- }
124
- }
125
- return {
126
- path: currentPath,
127
- type: 'file',
128
- summary: summary
129
- };
130
- }
131
- // It's a directory
132
- if (depth > 5)
133
- return { path: currentPath, type: 'directory', children: [] }; // Max depth safety
134
- const children = [];
135
- try {
136
- const items = fs.readdirSync(currentPath);
137
- for (const item of items) {
138
- if (this.fileCount > this.MAX_FILES)
139
- break;
140
- if (this.ignoreList.includes(item))
141
- continue;
142
- const fullPath = path.join(currentPath, item);
143
- // Simple ignore check for hidden files
144
- if (item.startsWith('.') && item !== '.gitignore')
145
- continue;
146
- children.push(this.scanDirectory(fullPath, depth + 1));
147
- }
148
- }
149
- catch (error) {
150
- // Permission denied or other error
151
- }
152
- return {
153
- path: currentPath,
154
- type: 'directory',
155
- children: children
156
- };
157
- }
158
- /**
159
- * Extract key definitions (Classes, Functions) from file content
160
- * A lightweight "ctags" style summary
161
- */
162
- extractSummary(filePath) {
163
- const ext = path.extname(filePath);
164
- if (!['.ts', '.tsx', '.js', '.jsx', '.py', '.go', '.rs'].includes(ext))
165
- return '';
166
- try {
167
- const content = fs.readFileSync(filePath, 'utf-8');
168
- const lines = content.split('\n');
169
- const definitions = [];
170
- // Very header-heavy regex matching for speed
171
- for (const line of lines) {
172
- const trimmed = line.trim();
173
- if (trimmed.startsWith('export class ')) {
174
- definitions.push(`Class: ${trimmed.split(' ')[2]}`);
175
- }
176
- else if (trimmed.startsWith('function ') || trimmed.startsWith('export function ')) {
177
- const funcName = trimmed.split('(')[0].split(' ').pop();
178
- definitions.push(`Func: ${funcName}`);
179
- }
180
- else if (trimmed.includes('const ') && trimmed.includes(' = (') && trimmed.includes('=>')) {
181
- // Arrow functions
182
- const parts = trimmed.split(' = ');
183
- const name = parts[0].split(' ').pop();
184
- if (name && /^[A-Z]/.test(name)) {
185
- definitions.push(`Component: ${name}`); // React component guess
186
- }
187
- }
188
- }
189
- return definitions.slice(0, 5).join(', '); // Limit to top 5
190
- }
191
- catch (e) {
192
- return '';
193
- }
194
- }
195
- /**
196
- * Format the tree into a compressed string for the LLM
197
- */
198
- formatTree(node, indent = '') {
199
- const name = path.basename(node.path);
200
- let output = `${indent}${name}`;
201
- if (node.type === 'file' && node.summary) {
202
- output += ` [${node.summary}]`;
203
- }
204
- output += '\n';
205
- if (node.children) {
206
- for (const child of node.children) {
207
- output += this.formatTree(child, indent + ' ');
208
- }
209
- }
210
- return output;
211
- }
212
- }
213
- exports.RepoMapper = RepoMapper;
214
- //# sourceMappingURL=repo-mapper.js.map
@@ -1,67 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.spinner = exports.Spinner = void 0;
7
- const ora_1 = __importDefault(require("ora"));
8
- const chalk_1 = __importDefault(require("chalk"));
9
- class Spinner {
10
- constructor() {
11
- this.spinner = null;
12
- }
13
- /**
14
- * Start the premium MATEX loading spinner
15
- */
16
- start(text) {
17
- this.spinner = (0, ora_1.default)({
18
- text: chalk_1.default.hex('#00fb08ff').bold(text),
19
- color: 'cyan',
20
- spinner: {
21
- interval: 80,
22
- frames: [
23
- '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'
24
- ].map(f => chalk_1.default.cyan(f)) // Inject cyan into each frame
25
- },
26
- prefixText: chalk_1.default.bgHex('#1E1E1E').green(' ⚡ MATEX_SWARM_ACTIVE ') + ' ',
27
- }).start();
28
- }
29
- succeed(text) {
30
- if (this.spinner) {
31
- this.spinner.succeed(chalk_1.default.green('✓ ') + chalk_1.default.white.bold(text || 'Done'));
32
- this.spinner = null;
33
- }
34
- }
35
- fail(text) {
36
- if (this.spinner) {
37
- this.spinner.fail(chalk_1.default.red('✗ ') + chalk_1.default.white.bold(text || 'Failed'));
38
- this.spinner = null;
39
- }
40
- }
41
- warn(text) {
42
- if (this.spinner) {
43
- this.spinner.warn(chalk_1.default.yellow('⚠ ') + chalk_1.default.white(text || 'Warning'));
44
- this.spinner = null;
45
- }
46
- }
47
- info(text) {
48
- if (this.spinner) {
49
- this.spinner.info(chalk_1.default.blue('ℹ ') + chalk_1.default.white(text || 'Info'));
50
- this.spinner = null;
51
- }
52
- }
53
- stop() {
54
- if (this.spinner) {
55
- this.spinner.stop();
56
- this.spinner = null;
57
- }
58
- }
59
- updateText(text) {
60
- if (this.spinner) {
61
- this.spinner.text = chalk_1.default.hex('#00fb08ff').bold(text);
62
- }
63
- }
64
- }
65
- exports.Spinner = Spinner;
66
- exports.spinner = new Spinner();
67
- //# sourceMappingURL=spinner.js.map