atlas-pipeline-mcp 1.0.19 → 1.0.21
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/mcp.js +191 -0
- package/dist/mcp.js.map +1 -1
- package/dist/tools/context.d.ts +33 -7
- package/dist/tools/context.d.ts.map +1 -1
- package/dist/tools/context.js +167 -82
- package/dist/tools/context.js.map +1 -1
- package/dist/tools/dashboard.d.ts +107 -0
- package/dist/tools/dashboard.d.ts.map +1 -0
- package/dist/tools/dashboard.js +544 -0
- package/dist/tools/dashboard.js.map +1 -0
- package/dist/tools/dependencies.d.ts +105 -0
- package/dist/tools/dependencies.d.ts.map +1 -0
- package/dist/tools/dependencies.js +410 -0
- package/dist/tools/dependencies.js.map +1 -0
- package/dist/tools/git.d.ts +27 -4
- package/dist/tools/git.d.ts.map +1 -1
- package/dist/tools/git.js +156 -59
- package/dist/tools/git.js.map +1 -1
- package/dist/tools/profiler.d.ts +83 -0
- package/dist/tools/profiler.d.ts.map +1 -0
- package/dist/tools/profiler.js +385 -0
- package/dist/tools/profiler.js.map +1 -0
- package/dist/tools/refactor.d.ts +63 -0
- package/dist/tools/refactor.d.ts.map +1 -0
- package/dist/tools/refactor.js +308 -0
- package/dist/tools/refactor.js.map +1 -0
- package/dist/tools/resource-manager.d.ts +167 -0
- package/dist/tools/resource-manager.d.ts.map +1 -0
- package/dist/tools/resource-manager.js +352 -0
- package/dist/tools/resource-manager.js.map +1 -0
- package/dist/tools/review.d.ts +98 -0
- package/dist/tools/review.d.ts.map +1 -0
- package/dist/tools/review.js +428 -0
- package/dist/tools/review.js.map +1 -0
- package/dist/tools/test-utils.d.ts +170 -0
- package/dist/tools/test-utils.d.ts.map +1 -0
- package/dist/tools/test-utils.js +490 -0
- package/dist/tools/test-utils.js.map +1 -0
- package/dist/tools/validation.d.ts +237 -0
- package/dist/tools/validation.d.ts.map +1 -0
- package/dist/tools/validation.js +323 -0
- package/dist/tools/validation.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atlas Server - Performance Profiling and Analysis Tool
|
|
3
|
+
*
|
|
4
|
+
* Advanced performance profiling for code optimization:
|
|
5
|
+
* - Time complexity analysis
|
|
6
|
+
* - Space complexity analysis
|
|
7
|
+
* - Benchmark generation
|
|
8
|
+
* - Memory leak detection
|
|
9
|
+
* - CPU hotspot identification
|
|
10
|
+
* - I/O bottleneck detection
|
|
11
|
+
* - Algorithm efficiency suggestions
|
|
12
|
+
* - Big-O notation analysis
|
|
13
|
+
*
|
|
14
|
+
* @module profiler
|
|
15
|
+
* @author Nishant Unavane
|
|
16
|
+
* @version 1.0.0
|
|
17
|
+
*/
|
|
18
|
+
import { getActiveProvider, isNoLLMMode } from '../providers/index.js';
|
|
19
|
+
import { logger, createTimer } from '../utils.js';
|
|
20
|
+
import { z } from 'zod';
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// Validation Schema
|
|
23
|
+
// ============================================================================
|
|
24
|
+
const ProfileOptionsSchema = z.object({
|
|
25
|
+
code: z.string().min(1).max(500000),
|
|
26
|
+
language: z.string().min(1),
|
|
27
|
+
filePath: z.string().optional(),
|
|
28
|
+
analyzeTime: z.boolean().optional(),
|
|
29
|
+
analyzeSpace: z.boolean().optional(),
|
|
30
|
+
detectLeaks: z.boolean().optional(),
|
|
31
|
+
identifyHotspots: z.boolean().optional(),
|
|
32
|
+
generateBenchmark: z.boolean().optional(),
|
|
33
|
+
inputSizes: z.array(z.number()).optional(),
|
|
34
|
+
expectedInputSize: z.enum(['small', 'medium', 'large', 'huge']).optional(),
|
|
35
|
+
constraints: z.array(z.string()).optional(),
|
|
36
|
+
});
|
|
37
|
+
// ============================================================================
|
|
38
|
+
// Static Code Analysis
|
|
39
|
+
// ============================================================================
|
|
40
|
+
/**
|
|
41
|
+
* Analyze code structure for performance patterns
|
|
42
|
+
*/
|
|
43
|
+
function analyzeCodeStructure(code, language) {
|
|
44
|
+
// Count loops
|
|
45
|
+
const loopPatterns = /\b(for|while|forEach|map|filter|reduce|each)\b/gi;
|
|
46
|
+
const loops = (code.match(loopPatterns) || []).length;
|
|
47
|
+
// Detect nested loops (simplified)
|
|
48
|
+
const nestedLoopPattern = /\b(for|while)\b[^{]*{[^}]*(for|while)\b/gis;
|
|
49
|
+
const nestedLoops = (code.match(nestedLoopPattern) || []).length;
|
|
50
|
+
// Detect recursion
|
|
51
|
+
const functionNames = [...code.matchAll(/(?:function|def|fn)\s+(\w+)/g)].map(m => m[1]);
|
|
52
|
+
const recursiveCalls = functionNames.filter(name => new RegExp(`\\b${name}\\s*\\(`).test(code)).length;
|
|
53
|
+
// Detect I/O operations
|
|
54
|
+
const ioOperations = [];
|
|
55
|
+
// File I/O
|
|
56
|
+
if (code.match(/\b(readFile|writeFile|open|read|write|createWriteStream)\b/i)) {
|
|
57
|
+
ioOperations.push({
|
|
58
|
+
type: 'file',
|
|
59
|
+
operation: 'File I/O detected',
|
|
60
|
+
isBlocking: code.includes('Sync') || code.includes('await'),
|
|
61
|
+
isRepeated: /\b(for|while)[^{]*{[^}]*(read|write)/i.test(code),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
// Network I/O
|
|
65
|
+
if (code.match(/\b(fetch|axios|request|http\.get|http\.post)\b/i)) {
|
|
66
|
+
ioOperations.push({
|
|
67
|
+
type: 'network',
|
|
68
|
+
operation: 'Network request detected',
|
|
69
|
+
isBlocking: code.includes('await') || code.includes('.then('),
|
|
70
|
+
isRepeated: /\b(for|while)[^{]*{[^}]*(fetch|request)/i.test(code),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
// Database operations
|
|
74
|
+
if (code.match(/\b(query|execute|find|findOne|insert|update|delete|aggregate)\b/i)) {
|
|
75
|
+
ioOperations.push({
|
|
76
|
+
type: 'database',
|
|
77
|
+
operation: 'Database query detected',
|
|
78
|
+
isBlocking: true,
|
|
79
|
+
isRepeated: /\b(for|while)[^{]*{[^}]*(query|find)/i.test(code),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return { loops, nestedLoops, recursiveCalls, ioOperations };
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Estimate Big-O complexity from code structure
|
|
86
|
+
*/
|
|
87
|
+
function estimateComplexity(structure) {
|
|
88
|
+
const { loops, nestedLoops, recursiveCalls, ioOperations } = structure;
|
|
89
|
+
let timeComplexity = 'O(1)';
|
|
90
|
+
let spaceComplexity = 'O(1)';
|
|
91
|
+
let confidence = 0.6;
|
|
92
|
+
// Time complexity estimation
|
|
93
|
+
if (nestedLoops >= 3) {
|
|
94
|
+
timeComplexity = 'O(n³) or worse';
|
|
95
|
+
confidence = 0.7;
|
|
96
|
+
}
|
|
97
|
+
else if (nestedLoops >= 2) {
|
|
98
|
+
timeComplexity = 'O(n²)';
|
|
99
|
+
confidence = 0.75;
|
|
100
|
+
}
|
|
101
|
+
else if (nestedLoops === 1 || loops > 1) {
|
|
102
|
+
timeComplexity = 'O(n log n) or O(n²)';
|
|
103
|
+
confidence = 0.65;
|
|
104
|
+
}
|
|
105
|
+
else if (loops === 1) {
|
|
106
|
+
timeComplexity = 'O(n)';
|
|
107
|
+
confidence = 0.8;
|
|
108
|
+
}
|
|
109
|
+
else if (recursiveCalls > 0) {
|
|
110
|
+
timeComplexity = 'O(2ⁿ) or O(n!)';
|
|
111
|
+
confidence = 0.5;
|
|
112
|
+
}
|
|
113
|
+
// Space complexity estimation
|
|
114
|
+
if (recursiveCalls > 0) {
|
|
115
|
+
spaceComplexity = 'O(n) recursion stack';
|
|
116
|
+
confidence = Math.min(confidence, 0.7);
|
|
117
|
+
}
|
|
118
|
+
else if (loops > 0) {
|
|
119
|
+
spaceComplexity = 'O(n) or O(1)';
|
|
120
|
+
confidence = Math.min(confidence, 0.6);
|
|
121
|
+
}
|
|
122
|
+
return { time: timeComplexity, space: spaceComplexity, confidence };
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Detect memory leak patterns
|
|
126
|
+
*/
|
|
127
|
+
function detectMemoryLeaks(code, language) {
|
|
128
|
+
let riskScore = 0;
|
|
129
|
+
// Global variable accumulation
|
|
130
|
+
if (code.match(/\b(global|window)\.\w+\s*=\s*\[/)) {
|
|
131
|
+
riskScore += 3;
|
|
132
|
+
}
|
|
133
|
+
// Event listeners without cleanup
|
|
134
|
+
if (code.match(/addEventListener/) && !code.match(/removeEventListener/)) {
|
|
135
|
+
riskScore += 2;
|
|
136
|
+
}
|
|
137
|
+
// Timers without cleanup
|
|
138
|
+
if ((code.match(/setInterval|setTimeout/) || []).length >
|
|
139
|
+
(code.match(/clearInterval|clearTimeout/) || []).length) {
|
|
140
|
+
riskScore += 2;
|
|
141
|
+
}
|
|
142
|
+
// Circular references
|
|
143
|
+
if (code.match(/\w+\.\w+\s*=\s*\w+/) && code.match(/\w+\.\w+\s*=\s*this/)) {
|
|
144
|
+
riskScore += 1;
|
|
145
|
+
}
|
|
146
|
+
// Unbounded collections
|
|
147
|
+
if (code.match(/\[\]\.push|Map\(\)|Set\(\)/) && !code.match(/clear|delete|splice/)) {
|
|
148
|
+
riskScore += 2;
|
|
149
|
+
}
|
|
150
|
+
if (riskScore >= 6)
|
|
151
|
+
return 'high';
|
|
152
|
+
if (riskScore >= 4)
|
|
153
|
+
return 'medium';
|
|
154
|
+
if (riskScore >= 2)
|
|
155
|
+
return 'low';
|
|
156
|
+
return 'none';
|
|
157
|
+
}
|
|
158
|
+
// ============================================================================
|
|
159
|
+
// Main Profile Function
|
|
160
|
+
// ============================================================================
|
|
161
|
+
/**
|
|
162
|
+
* Comprehensive performance profiling and analysis
|
|
163
|
+
*/
|
|
164
|
+
export async function profileCode(options) {
|
|
165
|
+
const timer = createTimer();
|
|
166
|
+
const { code, language, filePath, analyzeTime = true, analyzeSpace = true, detectLeaks = true, identifyHotspots = true, generateBenchmark = false, inputSizes = [10, 100, 1000, 10000], expectedInputSize = 'medium', constraints = [], } = ProfileOptionsSchema.parse(options);
|
|
167
|
+
logger.info({ language, filePath }, 'Starting performance profiling');
|
|
168
|
+
const warnings = [];
|
|
169
|
+
// Static analysis
|
|
170
|
+
const structure = analyzeCodeStructure(code, language);
|
|
171
|
+
const complexity = estimateComplexity(structure);
|
|
172
|
+
const memoryLeakRisk = detectLeaks ? detectMemoryLeaks(code, language) : 'none';
|
|
173
|
+
// Build analysis prompt
|
|
174
|
+
const prompt = `You are a performance optimization expert with 50 years of experience. Analyze this ${language} code for performance.
|
|
175
|
+
|
|
176
|
+
**Code:**
|
|
177
|
+
\`\`\`${language}
|
|
178
|
+
${code}
|
|
179
|
+
\`\`\`
|
|
180
|
+
|
|
181
|
+
**Static Analysis:**
|
|
182
|
+
- Loops detected: ${structure.loops}
|
|
183
|
+
- Nested loops: ${structure.nestedLoops}
|
|
184
|
+
- Recursive calls: ${structure.recursiveCalls}
|
|
185
|
+
- I/O operations: ${structure.ioOperations.length}
|
|
186
|
+
- Estimated time complexity: ${complexity.time}
|
|
187
|
+
- Estimated space complexity: ${complexity.space}
|
|
188
|
+
- Memory leak risk: ${memoryLeakRisk}
|
|
189
|
+
- Expected input size: ${expectedInputSize}
|
|
190
|
+
|
|
191
|
+
**I/O Operations:**
|
|
192
|
+
${structure.ioOperations.map(io => `- ${io.type} (${io.isBlocking ? 'blocking' : 'non-blocking'}${io.isRepeated ? ', repeated' : ''})`).join('\n') || '- None detected'}
|
|
193
|
+
|
|
194
|
+
**Constraints:**
|
|
195
|
+
${constraints.length > 0 ? constraints.join('\n') : '- None specified'}
|
|
196
|
+
|
|
197
|
+
**Tasks:**
|
|
198
|
+
1. Analyze time complexity (Big-O notation) for best, average, and worst cases
|
|
199
|
+
2. Analyze space complexity
|
|
200
|
+
3. Identify performance hotspots (CPU, memory, I/O)
|
|
201
|
+
4. Provide optimization suggestions ranked by impact
|
|
202
|
+
5. ${generateBenchmark ? 'Generate benchmark code' : ''}
|
|
203
|
+
|
|
204
|
+
**Format your response as:**
|
|
205
|
+
|
|
206
|
+
TIME_COMPLEXITY:
|
|
207
|
+
Best: O(...)
|
|
208
|
+
Average: O(...)
|
|
209
|
+
Worst: O(...)
|
|
210
|
+
Explanation: [why this complexity]
|
|
211
|
+
|
|
212
|
+
SPACE_COMPLEXITY:
|
|
213
|
+
Best: O(...)
|
|
214
|
+
Average: O(...)
|
|
215
|
+
Worst: O(...)
|
|
216
|
+
Explanation: [why this complexity]
|
|
217
|
+
|
|
218
|
+
HOTSPOTS:
|
|
219
|
+
- [location]: [type] - [description] - Impact: [X%]
|
|
220
|
+
...
|
|
221
|
+
|
|
222
|
+
OPTIMIZATIONS:
|
|
223
|
+
Priority 1: [category] - [description] - Gain: [X%]
|
|
224
|
+
Priority 2: [category] - [description] - Gain: [X%]
|
|
225
|
+
...
|
|
226
|
+
|
|
227
|
+
${generateBenchmark ? `BENCHMARK:
|
|
228
|
+
\`\`\`${language}
|
|
229
|
+
[benchmark code here]
|
|
230
|
+
\`\`\`
|
|
231
|
+
` : ''}`;
|
|
232
|
+
let analysis = {
|
|
233
|
+
timeComplexity: {
|
|
234
|
+
bigO: complexity.time,
|
|
235
|
+
bestCase: complexity.time,
|
|
236
|
+
averageCase: complexity.time,
|
|
237
|
+
worstCase: complexity.time,
|
|
238
|
+
explanation: 'Static analysis estimate',
|
|
239
|
+
confidence: complexity.confidence,
|
|
240
|
+
},
|
|
241
|
+
spaceComplexity: {
|
|
242
|
+
bigO: complexity.space,
|
|
243
|
+
bestCase: complexity.space,
|
|
244
|
+
averageCase: complexity.space,
|
|
245
|
+
worstCase: complexity.space,
|
|
246
|
+
explanation: 'Static analysis estimate',
|
|
247
|
+
confidence: complexity.confidence,
|
|
248
|
+
},
|
|
249
|
+
potentialBottlenecks: [],
|
|
250
|
+
memoryLeakRisk,
|
|
251
|
+
ioOperations: structure.ioOperations,
|
|
252
|
+
};
|
|
253
|
+
let hotspots = [];
|
|
254
|
+
let suggestions = [];
|
|
255
|
+
let benchmarkCode;
|
|
256
|
+
if (isNoLLMMode()) {
|
|
257
|
+
warnings.push('No LLM provider - using static analysis only');
|
|
258
|
+
// Add basic suggestions based on static analysis
|
|
259
|
+
if (structure.nestedLoops >= 2) {
|
|
260
|
+
suggestions.push({
|
|
261
|
+
priority: 9,
|
|
262
|
+
category: 'algorithm',
|
|
263
|
+
description: 'Nested loops detected - consider using hash maps or better algorithm',
|
|
264
|
+
estimatedGain: '10-100x faster',
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
if (structure.ioOperations.some(io => io.isRepeated)) {
|
|
268
|
+
suggestions.push({
|
|
269
|
+
priority: 10,
|
|
270
|
+
category: 'io',
|
|
271
|
+
description: 'Repeated I/O operations in loop - batch or cache results',
|
|
272
|
+
estimatedGain: '5-50x faster',
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
if (memoryLeakRisk === 'high' || memoryLeakRisk === 'medium') {
|
|
276
|
+
suggestions.push({
|
|
277
|
+
priority: 8,
|
|
278
|
+
category: 'memory',
|
|
279
|
+
description: 'High memory leak risk - add cleanup for timers/listeners',
|
|
280
|
+
estimatedGain: 'Prevents memory growth',
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
const provider = await getActiveProvider();
|
|
286
|
+
try {
|
|
287
|
+
const response = await provider.complete(prompt, {
|
|
288
|
+
maxTokens: 3000,
|
|
289
|
+
temperature: 0.2,
|
|
290
|
+
});
|
|
291
|
+
const responseText = response.text;
|
|
292
|
+
// Parse time complexity
|
|
293
|
+
const timeMatch = responseText.match(/TIME_COMPLEXITY:\s*Best:\s*([^\n]+)\s*Average:\s*([^\n]+)\s*Worst:\s*([^\n]+)\s*Explanation:\s*([^\n]+)/i);
|
|
294
|
+
if (timeMatch && timeMatch[1] && timeMatch[2] && timeMatch[3] && timeMatch[4]) {
|
|
295
|
+
analysis.timeComplexity = {
|
|
296
|
+
bigO: timeMatch[2].trim(),
|
|
297
|
+
bestCase: timeMatch[1].trim(),
|
|
298
|
+
averageCase: timeMatch[2].trim(),
|
|
299
|
+
worstCase: timeMatch[3].trim(),
|
|
300
|
+
explanation: timeMatch[4].trim(),
|
|
301
|
+
confidence: 0.85,
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
// Parse space complexity
|
|
305
|
+
const spaceMatch = responseText.match(/SPACE_COMPLEXITY:\s*Best:\s*([^\n]+)\s*Average:\s*([^\n]+)\s*Worst:\s*([^\n]+)\s*Explanation:\s*([^\n]+)/i);
|
|
306
|
+
if (spaceMatch && spaceMatch[1] && spaceMatch[2] && spaceMatch[3] && spaceMatch[4]) {
|
|
307
|
+
analysis.spaceComplexity = {
|
|
308
|
+
bigO: spaceMatch[2].trim(),
|
|
309
|
+
bestCase: spaceMatch[1].trim(),
|
|
310
|
+
averageCase: spaceMatch[2].trim(),
|
|
311
|
+
worstCase: spaceMatch[3].trim(),
|
|
312
|
+
explanation: spaceMatch[4].trim(),
|
|
313
|
+
confidence: 0.85,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
// Parse hotspots
|
|
317
|
+
const hotspotsMatch = responseText.match(/HOTSPOTS:\s*([\s\S]*?)(?:OPTIMIZATIONS:|$)/i);
|
|
318
|
+
if (hotspotsMatch && hotspotsMatch[1]) {
|
|
319
|
+
const hotspotLines = hotspotsMatch[1].trim().split('\n')
|
|
320
|
+
.filter((line) => line.trim().startsWith('-'));
|
|
321
|
+
hotspots = hotspotLines.map((line) => {
|
|
322
|
+
const clean = line.replace(/^-\s*/, '').trim();
|
|
323
|
+
const parts = clean.split(' - ');
|
|
324
|
+
return {
|
|
325
|
+
location: parts[0] || 'Unknown',
|
|
326
|
+
type: parts[1]?.toLowerCase() || 'cpu',
|
|
327
|
+
severity: 'high',
|
|
328
|
+
description: parts[2] || clean,
|
|
329
|
+
estimatedImpact: parts[3] || 'Unknown',
|
|
330
|
+
};
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
// Parse optimizations
|
|
334
|
+
const optsMatch = responseText.match(/OPTIMIZATIONS:\s*([\s\S]*?)(?:BENCHMARK:|$)/i);
|
|
335
|
+
if (optsMatch && optsMatch[1]) {
|
|
336
|
+
const optLines = optsMatch[1].trim().split('\n')
|
|
337
|
+
.filter((line) => /Priority\s+\d+:/i.test(line));
|
|
338
|
+
suggestions = optLines.map((line) => {
|
|
339
|
+
const priorityMatch = line.match(/Priority\s+(\d+):/i);
|
|
340
|
+
const priority = priorityMatch ? parseInt(priorityMatch[1] || '5') : 5;
|
|
341
|
+
const parts = line.split(' - ');
|
|
342
|
+
const categoryPart = parts[0]?.split(':')[1]?.trim() || 'algorithm';
|
|
343
|
+
return {
|
|
344
|
+
priority,
|
|
345
|
+
category: categoryPart.toLowerCase(),
|
|
346
|
+
description: parts[1] || line,
|
|
347
|
+
estimatedGain: parts[2] || 'Unknown',
|
|
348
|
+
};
|
|
349
|
+
}).sort((a, b) => b.priority - a.priority);
|
|
350
|
+
}
|
|
351
|
+
// Parse benchmark code
|
|
352
|
+
if (generateBenchmark) {
|
|
353
|
+
const benchMatch = responseText.match(/BENCHMARK:\s*```[\w]*\s*([\s\S]*?)```/i);
|
|
354
|
+
if (benchMatch && benchMatch[1]) {
|
|
355
|
+
benchmarkCode = benchMatch[1].trim();
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
catch (error) {
|
|
360
|
+
logger.error({ error }, 'Profiling failed');
|
|
361
|
+
warnings.push(`LLM error: ${error instanceof Error ? error.message : 'Unknown'}`);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
const executionTimeMs = timer.elapsed();
|
|
365
|
+
logger.info({
|
|
366
|
+
timeComplexity: analysis.timeComplexity.bigO,
|
|
367
|
+
hotspots: hotspots.length,
|
|
368
|
+
suggestions: suggestions.length,
|
|
369
|
+
executionTimeMs
|
|
370
|
+
}, 'Profiling completed');
|
|
371
|
+
return {
|
|
372
|
+
code,
|
|
373
|
+
analysis,
|
|
374
|
+
hotspots,
|
|
375
|
+
suggestions,
|
|
376
|
+
benchmarkCode,
|
|
377
|
+
executionTimeMs,
|
|
378
|
+
warnings,
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
// ============================================================================
|
|
382
|
+
// Export
|
|
383
|
+
// ============================================================================
|
|
384
|
+
export default profileCode;
|
|
385
|
+
//# sourceMappingURL=profiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiler.js","sourceRoot":"","sources":["../../src/tools/profiler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAiB,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqGxB,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IACnC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACnC,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACpC,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACnC,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACxC,iBAAiB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACzC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EA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,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atlas Server - AI-Powered Code Refactoring Tool
|
|
3
|
+
*
|
|
4
|
+
* Advanced refactoring capabilities beyond simple code cleanup:
|
|
5
|
+
* - Pattern detection (design patterns, anti-patterns)
|
|
6
|
+
* - Complexity reduction (cyclomatic complexity analysis)
|
|
7
|
+
* - SOLID principles enforcement
|
|
8
|
+
* - Performance hotspot identification
|
|
9
|
+
* - Automated Extract Method/Class/Interface
|
|
10
|
+
* - Dead code elimination
|
|
11
|
+
* - Type inference and migration
|
|
12
|
+
* - Dependency injection suggestions
|
|
13
|
+
*
|
|
14
|
+
* @module refactor
|
|
15
|
+
* @author Nishant Unavane
|
|
16
|
+
* @version 1.0.0
|
|
17
|
+
*/
|
|
18
|
+
export interface RefactorOptions {
|
|
19
|
+
code: string;
|
|
20
|
+
language: string;
|
|
21
|
+
filePath?: string;
|
|
22
|
+
targets?: RefactorTarget[];
|
|
23
|
+
maxComplexity?: number;
|
|
24
|
+
enforceSOLID?: boolean;
|
|
25
|
+
preserveBehavior?: boolean;
|
|
26
|
+
addTypes?: boolean;
|
|
27
|
+
modernize?: boolean;
|
|
28
|
+
projectContext?: string;
|
|
29
|
+
dependencies?: string[];
|
|
30
|
+
}
|
|
31
|
+
export type RefactorTarget = 'complexity' | 'duplication' | 'naming' | 'structure' | 'performance' | 'solid' | 'patterns' | 'types' | 'async' | 'functional' | 'deadcode';
|
|
32
|
+
export interface RefactorResult {
|
|
33
|
+
originalCode: string;
|
|
34
|
+
refactoredCode: string;
|
|
35
|
+
changes: RefactorChange[];
|
|
36
|
+
metrics: CodeMetrics;
|
|
37
|
+
suggestions: string[];
|
|
38
|
+
executionTimeMs: number;
|
|
39
|
+
warnings: string[];
|
|
40
|
+
}
|
|
41
|
+
export interface RefactorChange {
|
|
42
|
+
type: RefactorTarget;
|
|
43
|
+
description: string;
|
|
44
|
+
lineNumber: number;
|
|
45
|
+
impact: 'high' | 'medium' | 'low';
|
|
46
|
+
autoApplicable: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface CodeMetrics {
|
|
49
|
+
linesOfCode: number;
|
|
50
|
+
cyclomaticComplexity: number;
|
|
51
|
+
maintainabilityIndex: number;
|
|
52
|
+
duplicatedLines: number;
|
|
53
|
+
functionCount: number;
|
|
54
|
+
classCount: number;
|
|
55
|
+
commentRatio: number;
|
|
56
|
+
testCoverage?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* AI-powered code refactoring with pattern detection
|
|
60
|
+
*/
|
|
61
|
+
export declare function refactorCode(options: RefactorOptions): Promise<RefactorResult>;
|
|
62
|
+
export default refactorCode;
|
|
63
|
+
//# sourceMappingURL=refactor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refactor.d.ts","sourceRoot":"","sources":["../../src/tools/refactor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAWH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAG3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IAGpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,MAAM,cAAc,GACtB,YAAY,GACZ,aAAa,GACb,QAAQ,GACR,WAAW,GACX,aAAa,GACb,OAAO,GACP,UAAU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