@wundr.io/cli 1.0.11 ā 1.0.13
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/bin/wundr.js +8 -4
- package/dist/ai/ai-service.d.ts.map +1 -1
- package/dist/ai/ai-service.js.map +1 -1
- package/dist/ai/claude-client.js.map +1 -1
- package/dist/ai/conversation-manager.js.map +1 -1
- package/dist/commands/ai.d.ts.map +1 -1
- package/dist/commands/ai.js +179 -24
- package/dist/commands/ai.js.map +1 -1
- package/dist/commands/analyze-optimized.d.ts.map +1 -1
- package/dist/commands/analyze-optimized.js +15 -6
- package/dist/commands/analyze-optimized.js.map +1 -1
- package/dist/commands/batch.d.ts +22 -0
- package/dist/commands/batch.d.ts.map +1 -1
- package/dist/commands/batch.js +130 -14
- package/dist/commands/batch.js.map +1 -1
- package/dist/commands/chat.d.ts +1 -0
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +7 -3
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/claude-init.d.ts +1 -1
- package/dist/commands/claude-init.d.ts.map +1 -1
- package/dist/commands/claude-init.js +16 -16
- package/dist/commands/claude-init.js.map +1 -1
- package/dist/commands/claude-setup.d.ts +5 -5
- package/dist/commands/claude-setup.d.ts.map +1 -1
- package/dist/commands/claude-setup.js +65 -59
- package/dist/commands/claude-setup.js.map +1 -1
- package/dist/commands/computer-setup.d.ts +1 -0
- package/dist/commands/computer-setup.d.ts.map +1 -1
- package/dist/commands/computer-setup.js +35 -7
- package/dist/commands/computer-setup.js.map +1 -1
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/govern.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +3 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/orchestrator.d.ts.map +1 -1
- package/dist/commands/orchestrator.js +11 -4
- package/dist/commands/orchestrator.js.map +1 -1
- package/dist/commands/performance-optimizer.d.ts.map +1 -1
- package/dist/commands/performance-optimizer.js.map +1 -1
- package/dist/commands/rag.d.ts.map +1 -1
- package/dist/commands/rag.js +9 -6
- package/dist/commands/rag.js.map +1 -1
- package/dist/commands/setup.d.ts +5 -10
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +35 -260
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js.map +1 -1
- package/dist/context/session-manager.js.map +1 -1
- package/dist/framework/command-interface.d.ts +349 -0
- package/dist/framework/command-interface.d.ts.map +1 -0
- package/dist/framework/command-interface.js +101 -0
- package/dist/framework/command-interface.js.map +1 -0
- package/dist/framework/command-registry.d.ts +173 -0
- package/dist/framework/command-registry.d.ts.map +1 -0
- package/dist/framework/command-registry.js +734 -0
- package/dist/framework/command-registry.js.map +1 -0
- package/dist/framework/completion-exporter.d.ts +79 -0
- package/dist/framework/completion-exporter.d.ts.map +1 -0
- package/dist/framework/completion-exporter.js +259 -0
- package/dist/framework/completion-exporter.js.map +1 -0
- package/dist/framework/debug-logger.d.ts +163 -0
- package/dist/framework/debug-logger.d.ts.map +1 -0
- package/dist/framework/debug-logger.js +373 -0
- package/dist/framework/debug-logger.js.map +1 -0
- package/dist/framework/error-handler.d.ts +196 -0
- package/dist/framework/error-handler.d.ts.map +1 -0
- package/dist/framework/error-handler.js +613 -0
- package/dist/framework/error-handler.js.map +1 -0
- package/dist/framework/help-generator.d.ts +78 -0
- package/dist/framework/help-generator.d.ts.map +1 -0
- package/dist/framework/help-generator.js +414 -0
- package/dist/framework/help-generator.js.map +1 -0
- package/dist/framework/index.d.ts +62 -0
- package/dist/framework/index.d.ts.map +1 -0
- package/dist/framework/index.js +95 -0
- package/dist/framework/index.js.map +1 -0
- package/dist/framework/interactive-repl.d.ts +138 -0
- package/dist/framework/interactive-repl.d.ts.map +1 -0
- package/dist/framework/interactive-repl.js +567 -0
- package/dist/framework/interactive-repl.js.map +1 -0
- package/dist/framework/output-formatter.d.ts +274 -0
- package/dist/framework/output-formatter.d.ts.map +1 -0
- package/dist/framework/output-formatter.js +545 -0
- package/dist/framework/output-formatter.js.map +1 -0
- package/dist/framework/progress-manager.d.ts +192 -0
- package/dist/framework/progress-manager.d.ts.map +1 -0
- package/dist/framework/progress-manager.js +408 -0
- package/dist/framework/progress-manager.js.map +1 -0
- package/dist/interactive/interactive-mode.js.map +1 -1
- package/dist/nlp/command-mapper.js.map +1 -1
- package/dist/nlp/command-parser.js.map +1 -1
- package/dist/nlp/intent-parser.d.ts.map +1 -1
- package/dist/nlp/intent-parser.js +4 -2
- package/dist/nlp/intent-parser.js.map +1 -1
- package/dist/plugins/plugin-manager.d.ts +2 -1
- package/dist/plugins/plugin-manager.d.ts.map +1 -1
- package/dist/plugins/plugin-manager.js +30 -19
- package/dist/plugins/plugin-manager.js.map +1 -1
- package/dist/utils/backup-rollback-manager.d.ts.map +1 -1
- package/dist/utils/backup-rollback-manager.js +1 -2
- package/dist/utils/backup-rollback-manager.js.map +1 -1
- package/dist/utils/logger.js.map +1 -1
- package/package.json +6 -6
- package/src/ai/ai-service.ts +16 -17
- package/src/ai/claude-client.ts +16 -16
- package/src/ai/conversation-manager.ts +29 -29
- package/src/cli.ts +4 -4
- package/src/commands/ai.ts +246 -78
- package/src/commands/alignment.ts +74 -74
- package/src/commands/analyze-optimized.ts +111 -78
- package/src/commands/analyze.ts +14 -14
- package/src/commands/batch.ts +179 -42
- package/src/commands/chat.ts +37 -30
- package/src/commands/claude-init.ts +41 -45
- package/src/commands/claude-setup.ts +204 -119
- package/src/commands/computer-setup.ts +85 -43
- package/src/commands/create-command.ts +4 -4
- package/src/commands/create.ts +27 -27
- package/src/commands/dashboard.ts +24 -24
- package/src/commands/govern.ts +25 -25
- package/src/commands/governance.ts +34 -34
- package/src/commands/guardian.ts +56 -56
- package/src/commands/init.ts +25 -22
- package/src/commands/orchestrator.ts +68 -41
- package/src/commands/performance-optimizer.ts +34 -35
- package/src/commands/plugins.ts +27 -27
- package/src/commands/project-update.ts +175 -72
- package/src/commands/rag.ts +185 -78
- package/src/commands/session.ts +35 -35
- package/src/commands/setup.ts +40 -344
- package/src/commands/test-init.ts +3 -3
- package/src/commands/test.ts +4 -4
- package/src/commands/watch.ts +28 -29
- package/src/commands/worktree.ts +49 -49
- package/src/context/context-manager.ts +10 -10
- package/src/context/session-manager.ts +41 -41
- package/src/framework/command-interface.ts +520 -0
- package/src/framework/command-registry.ts +942 -0
- package/src/framework/completion-exporter.ts +383 -0
- package/src/framework/debug-logger.ts +519 -0
- package/src/framework/error-handler.ts +867 -0
- package/src/framework/help-generator.ts +540 -0
- package/src/framework/index.ts +169 -0
- package/src/framework/interactive-repl.ts +703 -0
- package/src/framework/output-formatter.ts +834 -0
- package/src/framework/progress-manager.ts +539 -0
- package/src/index.ts +4 -4
- package/src/interactive/interactive-mode.ts +16 -16
- package/src/lib/conflict-resolution.ts +799 -9
- package/src/lib/merge-strategy.ts +529 -7
- package/src/lib/safety-mechanisms.ts +422 -18
- package/src/lib/state-detection.ts +1015 -13
- package/src/nlp/command-mapper.ts +29 -29
- package/src/nlp/command-parser.ts +17 -17
- package/src/nlp/intent-classifier.ts +7 -7
- package/src/nlp/intent-parser.ts +54 -52
- package/src/plugins/plugin-manager.ts +61 -39
- package/src/tests/computer-setup-integration.test.ts +46 -15
- package/src/types/modules.d.ts +424 -1
- package/src/utils/backup-rollback-manager.ts +11 -8
- package/src/utils/config-manager.ts +3 -3
- package/src/utils/error-handler.ts +2 -2
- package/src/utils/logger.ts +22 -22
- package/templates/batch/ci-cd.yaml +7 -7
- package/test-suites/api/health.spec.ts +20 -23
- package/test-suites/helpers/test-config.ts +14 -13
- package/test-suites/ui/accessibility.spec.ts +27 -22
- package/test-suites/ui/smoke.spec.ts +26 -21
- package/dist/commands/computer-setup-commands.d.ts +0 -53
- package/dist/commands/computer-setup-commands.d.ts.map +0 -1
- package/dist/commands/computer-setup-commands.js +0 -705
- package/dist/commands/computer-setup-commands.js.map +0 -1
- package/dist/commands/vp.d.ts +0 -7
- package/dist/commands/vp.d.ts.map +0 -1
- package/dist/commands/vp.js +0 -571
- package/dist/commands/vp.js.map +0 -1
- package/src/commands/computer-setup-commands.ts +0 -872
|
@@ -10,7 +10,6 @@ import { Command } from 'commander';
|
|
|
10
10
|
import * as fs from 'fs-extra';
|
|
11
11
|
import ora from 'ora';
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
// Use analysis-engine modules for testing
|
|
15
14
|
// Temporarily using inline implementation for CodeAnalyzer
|
|
16
15
|
|
|
@@ -90,7 +89,10 @@ interface BenchmarkSuiteConfig {
|
|
|
90
89
|
// Functional implementations for testing
|
|
91
90
|
class MemoryMonitor {
|
|
92
91
|
private config: MemoryMonitorConfig;
|
|
93
|
-
private eventHandlers: Map<
|
|
92
|
+
private eventHandlers: Map<
|
|
93
|
+
string,
|
|
94
|
+
EventCallback<MemoryAlert | MemoryLeakAnalysis>[]
|
|
95
|
+
> = new Map();
|
|
94
96
|
private monitoringInterval: NodeJS.Timeout | null = null;
|
|
95
97
|
private samples: number[] = [];
|
|
96
98
|
|
|
@@ -102,7 +104,10 @@ class MemoryMonitor {
|
|
|
102
104
|
};
|
|
103
105
|
}
|
|
104
106
|
|
|
105
|
-
on(
|
|
107
|
+
on(
|
|
108
|
+
event: string,
|
|
109
|
+
callback: EventCallback<MemoryAlert | MemoryLeakAnalysis>
|
|
110
|
+
): void {
|
|
106
111
|
if (!this.eventHandlers.has(event)) {
|
|
107
112
|
this.eventHandlers.set(event, []);
|
|
108
113
|
}
|
|
@@ -123,10 +128,16 @@ class MemoryMonitor {
|
|
|
123
128
|
this.samples.push(currentMemory);
|
|
124
129
|
|
|
125
130
|
// Check for memory threshold alerts
|
|
126
|
-
if (
|
|
131
|
+
if (
|
|
132
|
+
currentMemory >
|
|
133
|
+
this.config.maxMemoryUsage! * this.config.alertThreshold!
|
|
134
|
+
) {
|
|
127
135
|
this.emit('memory-alert', {
|
|
128
136
|
type: 'threshold',
|
|
129
|
-
severity:
|
|
137
|
+
severity:
|
|
138
|
+
currentMemory > this.config.maxMemoryUsage!
|
|
139
|
+
? 'critical'
|
|
140
|
+
: 'warning',
|
|
130
141
|
current: currentMemory,
|
|
131
142
|
threshold: this.config.maxMemoryUsage!,
|
|
132
143
|
});
|
|
@@ -139,7 +150,8 @@ class MemoryMonitor {
|
|
|
139
150
|
const lastSample = recentSamples[9];
|
|
140
151
|
if (firstSample !== undefined && lastSample !== undefined) {
|
|
141
152
|
const growthRate = (lastSample - firstSample) / 10;
|
|
142
|
-
if (growthRate > 1024 * 1024) {
|
|
153
|
+
if (growthRate > 1024 * 1024) {
|
|
154
|
+
// Growing more than 1MB per sample
|
|
143
155
|
this.emit('memory-leak-detected', {
|
|
144
156
|
detected: true,
|
|
145
157
|
growthRate,
|
|
@@ -161,10 +173,14 @@ class MemoryMonitor {
|
|
|
161
173
|
|
|
162
174
|
getMetrics() {
|
|
163
175
|
const currentMemory = process.memoryUsage();
|
|
164
|
-
const peakHeapUsed =
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
176
|
+
const peakHeapUsed =
|
|
177
|
+
this.samples.length > 0
|
|
178
|
+
? Math.max(...this.samples)
|
|
179
|
+
: currentMemory.heapUsed * 1.2;
|
|
180
|
+
const averageHeapUsed =
|
|
181
|
+
this.samples.length > 0
|
|
182
|
+
? this.samples.reduce((a, b) => a + b, 0) / this.samples.length
|
|
183
|
+
: currentMemory.heapUsed;
|
|
168
184
|
|
|
169
185
|
return {
|
|
170
186
|
data: {
|
|
@@ -249,14 +265,20 @@ class SimpleAnalyzer {
|
|
|
249
265
|
class OptimizedBaseAnalysisService {
|
|
250
266
|
private analyzer: SimpleAnalyzer;
|
|
251
267
|
private config: AnalysisServiceConfig;
|
|
252
|
-
private eventHandlers: Map<
|
|
268
|
+
private eventHandlers: Map<
|
|
269
|
+
string,
|
|
270
|
+
EventCallback<ProgressEvent | MemoryLeakWarning>[]
|
|
271
|
+
> = new Map();
|
|
253
272
|
|
|
254
273
|
constructor(config: AnalysisServiceConfig) {
|
|
255
274
|
this.config = config;
|
|
256
275
|
this.analyzer = new SimpleAnalyzer();
|
|
257
276
|
}
|
|
258
277
|
|
|
259
|
-
on(
|
|
278
|
+
on(
|
|
279
|
+
event: string,
|
|
280
|
+
callback: EventCallback<ProgressEvent | MemoryLeakWarning>
|
|
281
|
+
): void {
|
|
260
282
|
if (!this.eventHandlers.has(event)) {
|
|
261
283
|
this.eventHandlers.set(event, []);
|
|
262
284
|
}
|
|
@@ -271,7 +293,10 @@ class OptimizedBaseAnalysisService {
|
|
|
271
293
|
}
|
|
272
294
|
|
|
273
295
|
async initialize(): Promise<void> {
|
|
274
|
-
this.emit('progress', {
|
|
296
|
+
this.emit('progress', {
|
|
297
|
+
type: 'phase',
|
|
298
|
+
message: 'Initializing analysis service...',
|
|
299
|
+
});
|
|
275
300
|
|
|
276
301
|
// Ensure output directory exists
|
|
277
302
|
await fs.ensureDir(this.config.outputDir);
|
|
@@ -389,7 +414,7 @@ class PerformanceBenchmarkSuite {
|
|
|
389
414
|
metrics: {
|
|
390
415
|
avgExecutionTime: executionTime,
|
|
391
416
|
peakMemory: memoryAfter,
|
|
392
|
-
filesPerSecond: 1000 / executionTime * 100,
|
|
417
|
+
filesPerSecond: (1000 / executionTime) * 100,
|
|
393
418
|
},
|
|
394
419
|
},
|
|
395
420
|
});
|
|
@@ -397,7 +422,10 @@ class PerformanceBenchmarkSuite {
|
|
|
397
422
|
|
|
398
423
|
// Save results if profiling is enabled
|
|
399
424
|
if (this.config.enableProfiling) {
|
|
400
|
-
const outputPath = path.join(
|
|
425
|
+
const outputPath = path.join(
|
|
426
|
+
this.config.outputDir!,
|
|
427
|
+
'benchmark-results.json'
|
|
428
|
+
);
|
|
401
429
|
await fs.writeJson(outputPath, results, { spaces: 2 });
|
|
402
430
|
}
|
|
403
431
|
|
|
@@ -423,7 +451,12 @@ class PerformanceBenchmarkSuite {
|
|
|
423
451
|
const recoveryTime = Date.now() - this.startTime;
|
|
424
452
|
|
|
425
453
|
return {
|
|
426
|
-
stabilityScore: Math.min(
|
|
454
|
+
stabilityScore: Math.min(
|
|
455
|
+
100,
|
|
456
|
+
Math.round(
|
|
457
|
+
100 - ((peakMemory - memoryBefore) / this.config.memoryLimit!) * 100
|
|
458
|
+
)
|
|
459
|
+
),
|
|
427
460
|
peakMemory,
|
|
428
461
|
recoveryTime,
|
|
429
462
|
};
|
|
@@ -457,24 +490,24 @@ export function createOptimizedAnalyzeCommand(): Command {
|
|
|
457
490
|
const command = new Command('analyze-optimized')
|
|
458
491
|
.alias('ao')
|
|
459
492
|
.description(
|
|
460
|
-
'Run optimized analysis with memory management and high concurrency'
|
|
493
|
+
'Run optimized analysis with memory management and high concurrency'
|
|
461
494
|
)
|
|
462
495
|
.argument('<directory>', 'Directory to analyze')
|
|
463
496
|
.option(
|
|
464
497
|
'-o, --output <path>',
|
|
465
498
|
'Output directory for results',
|
|
466
|
-
'./wundr-analysis'
|
|
499
|
+
'./wundr-analysis'
|
|
467
500
|
)
|
|
468
501
|
.option(
|
|
469
502
|
'-f, --format <format>',
|
|
470
503
|
'Output format (json, html, markdown, all)',
|
|
471
|
-
'json'
|
|
504
|
+
'json'
|
|
472
505
|
)
|
|
473
506
|
.option('-v, --verbose', 'Verbose output with detailed progress', false)
|
|
474
507
|
.option(
|
|
475
508
|
'--max-memory <size>',
|
|
476
509
|
'Maximum memory usage (e.g., 250MB, 1GB)',
|
|
477
|
-
'250MB'
|
|
510
|
+
'250MB'
|
|
478
511
|
)
|
|
479
512
|
.option('--max-workers <count>', 'Maximum number of workers', '32')
|
|
480
513
|
.option('--enable-streaming', 'Enable streaming for large codebases', true)
|
|
@@ -484,7 +517,7 @@ export function createOptimizedAnalyzeCommand(): Command {
|
|
|
484
517
|
.option(
|
|
485
518
|
'--cache-enabled',
|
|
486
519
|
'Enable caching for faster repeated analysis',
|
|
487
|
-
true
|
|
520
|
+
true
|
|
488
521
|
)
|
|
489
522
|
.option('--include <patterns...>', 'File patterns to include', [
|
|
490
523
|
'**/*.{ts,tsx,js,jsx}',
|
|
@@ -505,7 +538,7 @@ export function createOptimizedAnalyzeCommand(): Command {
|
|
|
505
538
|
*/
|
|
506
539
|
async function runOptimizedAnalysis(
|
|
507
540
|
directory: string,
|
|
508
|
-
options: OptimizedAnalysisOptions
|
|
541
|
+
options: OptimizedAnalysisOptions
|
|
509
542
|
): Promise<void> {
|
|
510
543
|
const startTime = Date.now();
|
|
511
544
|
const spinner = ora('Initializing optimized analysis...').start();
|
|
@@ -550,8 +583,8 @@ async function runOptimizedAnalysis(
|
|
|
550
583
|
if (options.verbose) {
|
|
551
584
|
spinner.warn(
|
|
552
585
|
color(
|
|
553
|
-
`Memory Alert: ${alert.type} - ${Math.round(alert.current / 1024 / 1024)}MB
|
|
554
|
-
)
|
|
586
|
+
`Memory Alert: ${alert.type} - ${Math.round(alert.current / 1024 / 1024)}MB`
|
|
587
|
+
)
|
|
555
588
|
);
|
|
556
589
|
}
|
|
557
590
|
});
|
|
@@ -559,8 +592,8 @@ async function runOptimizedAnalysis(
|
|
|
559
592
|
memoryMonitor.on('memory-leak-detected', (analysis: any) => {
|
|
560
593
|
spinner.warn(
|
|
561
594
|
chalk.red(
|
|
562
|
-
`Memory leak detected! Growth rate: ${Math.round(analysis.growthRate / 1024)}KB/s
|
|
563
|
-
)
|
|
595
|
+
`Memory leak detected! Growth rate: ${Math.round(analysis.growthRate / 1024)}KB/s`
|
|
596
|
+
)
|
|
564
597
|
);
|
|
565
598
|
});
|
|
566
599
|
|
|
@@ -597,8 +630,8 @@ async function runOptimizedAnalysis(
|
|
|
597
630
|
analysisService.on('memory-leak-warning', (warning: any) => {
|
|
598
631
|
spinner.warn(
|
|
599
632
|
chalk.yellow(
|
|
600
|
-
`Memory Warning: ${warning.severity} - Growth: ${Math.round(warning.growthRate / 1024)}KB/s
|
|
601
|
-
)
|
|
633
|
+
`Memory Warning: ${warning.severity} - Growth: ${Math.round(warning.growthRate / 1024)}KB/s`
|
|
634
|
+
)
|
|
602
635
|
);
|
|
603
636
|
});
|
|
604
637
|
}
|
|
@@ -626,27 +659,27 @@ async function runOptimizedAnalysis(
|
|
|
626
659
|
console.log(chalk.cyan('š Performance Summary:'));
|
|
627
660
|
console.log(chalk.gray(` Duration: ${formatDuration(duration)}`));
|
|
628
661
|
console.log(
|
|
629
|
-
chalk.gray(` Files analyzed: ${result.data?.summary.totalFiles || 0}`)
|
|
662
|
+
chalk.gray(` Files analyzed: ${result.data?.summary.totalFiles || 0}`)
|
|
630
663
|
);
|
|
631
664
|
console.log(
|
|
632
665
|
chalk.gray(
|
|
633
|
-
` Entities found: ${result.data?.summary.totalEntities || 0}
|
|
634
|
-
)
|
|
666
|
+
` Entities found: ${result.data?.summary.totalEntities || 0}`
|
|
667
|
+
)
|
|
635
668
|
);
|
|
636
669
|
console.log(
|
|
637
670
|
chalk.gray(
|
|
638
|
-
` Peak memory: ${formatFileSize(memoryMetrics.peak.heapUsed)}
|
|
639
|
-
)
|
|
671
|
+
` Peak memory: ${formatFileSize(memoryMetrics.peak.heapUsed)}`
|
|
672
|
+
)
|
|
640
673
|
);
|
|
641
674
|
console.log(
|
|
642
675
|
chalk.gray(
|
|
643
|
-
` Average memory: ${formatFileSize(memoryMetrics.average.heapUsed)}
|
|
644
|
-
)
|
|
676
|
+
` Average memory: ${formatFileSize(memoryMetrics.average.heapUsed)}`
|
|
677
|
+
)
|
|
645
678
|
);
|
|
646
679
|
console.log(
|
|
647
680
|
chalk.gray(
|
|
648
|
-
` Processing rate: ${Math.round((result.data?.summary.totalFiles || 0) / (duration / 1000))} files/sec
|
|
649
|
-
)
|
|
681
|
+
` Processing rate: ${Math.round((result.data?.summary.totalFiles || 0) / (duration / 1000))} files/sec`
|
|
682
|
+
)
|
|
650
683
|
);
|
|
651
684
|
|
|
652
685
|
// Analysis results
|
|
@@ -654,49 +687,49 @@ async function runOptimizedAnalysis(
|
|
|
654
687
|
console.log(chalk.cyan('\nš Analysis Results:'));
|
|
655
688
|
console.log(
|
|
656
689
|
chalk.gray(
|
|
657
|
-
` Duplicate clusters: ${result.data.summary.duplicateClusters}
|
|
658
|
-
)
|
|
690
|
+
` Duplicate clusters: ${result.data.summary.duplicateClusters}`
|
|
691
|
+
)
|
|
659
692
|
);
|
|
660
693
|
console.log(
|
|
661
694
|
chalk.gray(
|
|
662
|
-
` Circular dependencies: ${result.data.summary.circularDependencies}
|
|
663
|
-
)
|
|
695
|
+
` Circular dependencies: ${result.data.summary.circularDependencies}`
|
|
696
|
+
)
|
|
664
697
|
);
|
|
665
698
|
console.log(
|
|
666
|
-
chalk.gray(` Code smells: ${result.data.summary.codeSmells}`)
|
|
699
|
+
chalk.gray(` Code smells: ${result.data.summary.codeSmells}`)
|
|
667
700
|
);
|
|
668
701
|
console.log(
|
|
669
702
|
chalk.gray(
|
|
670
|
-
` Technical debt score: ${result.data.summary.technicalDebt}/100
|
|
671
|
-
)
|
|
703
|
+
` Technical debt score: ${result.data.summary.technicalDebt}/100`
|
|
704
|
+
)
|
|
672
705
|
);
|
|
673
706
|
}
|
|
674
707
|
|
|
675
708
|
// Memory efficiency
|
|
676
709
|
const memoryEfficiency = calculateMemoryEfficiency(
|
|
677
710
|
result.data?.summary.totalFiles || 0,
|
|
678
|
-
memoryMetrics.peak.heapUsed
|
|
711
|
+
memoryMetrics.peak.heapUsed
|
|
679
712
|
);
|
|
680
713
|
console.log(chalk.cyan('\nš¾ Memory Efficiency:'));
|
|
681
714
|
console.log(
|
|
682
|
-
chalk.gray(` Efficiency score: ${memoryEfficiency.toFixed(1)}%`)
|
|
715
|
+
chalk.gray(` Efficiency score: ${memoryEfficiency.toFixed(1)}%`)
|
|
683
716
|
);
|
|
684
717
|
console.log(
|
|
685
718
|
chalk.gray(
|
|
686
|
-
` Memory per file: ${Math.round(memoryMetrics.average.heapUsed / Math.max(1, result.data?.summary.totalFiles || 1) / 1024)}KB
|
|
687
|
-
)
|
|
719
|
+
` Memory per file: ${Math.round(memoryMetrics.average.heapUsed / Math.max(1, result.data?.summary.totalFiles || 1) / 1024)}KB`
|
|
720
|
+
)
|
|
688
721
|
);
|
|
689
722
|
|
|
690
723
|
// Leak analysis
|
|
691
724
|
if (memoryMetrics.leakAnalysis.leakDetected) {
|
|
692
725
|
console.log(chalk.red('\nā ļø Memory Leak Detected:'));
|
|
693
726
|
console.log(
|
|
694
|
-
chalk.gray(` Severity: ${memoryMetrics.leakAnalysis.severity}`)
|
|
727
|
+
chalk.gray(` Severity: ${memoryMetrics.leakAnalysis.severity}`)
|
|
695
728
|
);
|
|
696
729
|
console.log(
|
|
697
730
|
chalk.gray(
|
|
698
|
-
` Growth rate: ${Math.round(memoryMetrics.leakAnalysis.growthRate / 1024)}KB/s
|
|
699
|
-
)
|
|
731
|
+
` Growth rate: ${Math.round(memoryMetrics.leakAnalysis.growthRate / 1024)}KB/s`
|
|
732
|
+
)
|
|
700
733
|
);
|
|
701
734
|
}
|
|
702
735
|
|
|
@@ -737,18 +770,18 @@ async function runOptimizedAnalysis(
|
|
|
737
770
|
console.log(chalk.cyan('ā” Benchmark Results:'));
|
|
738
771
|
console.log(
|
|
739
772
|
chalk.gray(
|
|
740
|
-
` Speedup: ${mainResult.results.improvement.speedup.toFixed(1)}x
|
|
741
|
-
)
|
|
773
|
+
` Speedup: ${mainResult.results.improvement.speedup.toFixed(1)}x`
|
|
774
|
+
)
|
|
742
775
|
);
|
|
743
776
|
console.log(
|
|
744
777
|
chalk.gray(
|
|
745
|
-
` Memory reduction: ${mainResult.results.improvement.memoryReduction.toFixed(1)}
|
|
746
|
-
)
|
|
778
|
+
` Memory reduction: ${mainResult.results.improvement.memoryReduction.toFixed(1)}%`
|
|
779
|
+
)
|
|
747
780
|
);
|
|
748
781
|
console.log(
|
|
749
782
|
chalk.gray(
|
|
750
|
-
` Throughput increase: ${mainResult.results.improvement.throughputIncrease.toFixed(1)}
|
|
751
|
-
)
|
|
783
|
+
` Throughput increase: ${mainResult.results.improvement.throughputIncrease.toFixed(1)}%`
|
|
784
|
+
)
|
|
752
785
|
);
|
|
753
786
|
}
|
|
754
787
|
|
|
@@ -760,7 +793,7 @@ async function runOptimizedAnalysis(
|
|
|
760
793
|
spinner.fail('Analysis failed');
|
|
761
794
|
console.error(
|
|
762
795
|
chalk.red('\nā Error:'),
|
|
763
|
-
error instanceof Error ? error.message : String(error)
|
|
796
|
+
error instanceof Error ? error.message : String(error)
|
|
764
797
|
);
|
|
765
798
|
|
|
766
799
|
if (options.verbose && error instanceof Error) {
|
|
@@ -802,14 +835,14 @@ function parseMemoryLimit(memoryStr: string): number {
|
|
|
802
835
|
*/
|
|
803
836
|
function formatDuration(ms: number): string {
|
|
804
837
|
if (ms < 1000) {
|
|
805
|
-
return `${ms}ms`;
|
|
806
|
-
}
|
|
838
|
+
return `${ms}ms`;
|
|
839
|
+
}
|
|
807
840
|
if (ms < 60000) {
|
|
808
|
-
return `${(ms / 1000).toFixed(1)}s`;
|
|
809
|
-
}
|
|
841
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
842
|
+
}
|
|
810
843
|
if (ms < 3600000) {
|
|
811
|
-
return `${(ms / 60000).toFixed(1)}m`;
|
|
812
|
-
}
|
|
844
|
+
return `${(ms / 60000).toFixed(1)}m`;
|
|
845
|
+
}
|
|
813
846
|
return `${(ms / 3600000).toFixed(1)}h`;
|
|
814
847
|
}
|
|
815
848
|
|
|
@@ -834,12 +867,12 @@ function formatFileSize(bytes: number): string {
|
|
|
834
867
|
*/
|
|
835
868
|
function calculateMemoryEfficiency(
|
|
836
869
|
fileCount: number,
|
|
837
|
-
memoryUsed: number
|
|
870
|
+
memoryUsed: number
|
|
838
871
|
): number {
|
|
839
872
|
const expectedMemory = fileCount * 50 * 1024; // 50KB per file baseline
|
|
840
873
|
const efficiency = Math.max(
|
|
841
874
|
0,
|
|
842
|
-
100 - ((memoryUsed - expectedMemory) / expectedMemory) * 100
|
|
875
|
+
100 - ((memoryUsed - expectedMemory) / expectedMemory) * 100
|
|
843
876
|
);
|
|
844
877
|
return Math.min(100, efficiency);
|
|
845
878
|
}
|
|
@@ -851,12 +884,12 @@ export function createBenchmarkCommand(): Command {
|
|
|
851
884
|
const command = new Command('benchmark')
|
|
852
885
|
.alias('bench')
|
|
853
886
|
.description(
|
|
854
|
-
'Run performance benchmarks for memory and concurrency optimizations'
|
|
887
|
+
'Run performance benchmarks for memory and concurrency optimizations'
|
|
855
888
|
)
|
|
856
889
|
.option(
|
|
857
890
|
'-o, --output <path>',
|
|
858
891
|
'Output directory for benchmark results',
|
|
859
|
-
'./benchmark-results'
|
|
892
|
+
'./benchmark-results'
|
|
860
893
|
)
|
|
861
894
|
.option('--iterations <count>', 'Number of benchmark iterations', '3')
|
|
862
895
|
.option('--memory-limit <size>', 'Memory limit for testing', '500MB')
|
|
@@ -905,41 +938,41 @@ async function runBenchmarks(options: any): Promise<void> {
|
|
|
905
938
|
const avgSpeedup =
|
|
906
939
|
results.reduce(
|
|
907
940
|
(sum: any, r: any) => sum + r.results.improvement.speedup,
|
|
908
|
-
0
|
|
941
|
+
0
|
|
909
942
|
) / results.length;
|
|
910
943
|
const avgMemoryReduction =
|
|
911
944
|
results.reduce(
|
|
912
945
|
(sum: any, r: any) => sum + r.results.improvement.memoryReduction,
|
|
913
|
-
0
|
|
946
|
+
0
|
|
914
947
|
) / results.length;
|
|
915
948
|
const avgThroughputIncrease =
|
|
916
949
|
results.reduce(
|
|
917
950
|
(sum: any, r: any) => sum + r.results.improvement.throughputIncrease,
|
|
918
|
-
0
|
|
951
|
+
0
|
|
919
952
|
) / results.length;
|
|
920
953
|
|
|
921
954
|
console.log(chalk.cyan(`š Average Speedup: ${avgSpeedup.toFixed(1)}x`));
|
|
922
955
|
console.log(
|
|
923
956
|
chalk.cyan(
|
|
924
|
-
`š¾ Average Memory Reduction: ${avgMemoryReduction.toFixed(1)}
|
|
925
|
-
)
|
|
957
|
+
`š¾ Average Memory Reduction: ${avgMemoryReduction.toFixed(1)}%`
|
|
958
|
+
)
|
|
926
959
|
);
|
|
927
960
|
console.log(
|
|
928
961
|
chalk.cyan(
|
|
929
|
-
`š Average Throughput Increase: ${avgThroughputIncrease.toFixed(1)}
|
|
930
|
-
)
|
|
962
|
+
`š Average Throughput Increase: ${avgThroughputIncrease.toFixed(1)}%`
|
|
963
|
+
)
|
|
931
964
|
);
|
|
932
965
|
|
|
933
966
|
console.log(
|
|
934
967
|
chalk.green(
|
|
935
|
-
`\nš Results saved to: ${options.output || './benchmark-results'}\n
|
|
936
|
-
)
|
|
968
|
+
`\nš Results saved to: ${options.output || './benchmark-results'}\n`
|
|
969
|
+
)
|
|
937
970
|
);
|
|
938
971
|
} catch (error) {
|
|
939
972
|
spinner.fail('Benchmarks failed');
|
|
940
973
|
console.error(
|
|
941
974
|
chalk.red('\nā Error:'),
|
|
942
|
-
error instanceof Error ? error.message : String(error)
|
|
975
|
+
error instanceof Error ? error.message : String(error)
|
|
943
976
|
);
|
|
944
977
|
process.exit(1);
|
|
945
978
|
}
|
package/src/commands/analyze.ts
CHANGED
|
@@ -17,7 +17,7 @@ export class AnalyzeCommands {
|
|
|
17
17
|
constructor(
|
|
18
18
|
private program: Command,
|
|
19
19
|
private _configManager: ConfigManager,
|
|
20
|
-
private _pluginManager: PluginManager
|
|
20
|
+
private _pluginManager: PluginManager
|
|
21
21
|
) {
|
|
22
22
|
this.registerCommands();
|
|
23
23
|
}
|
|
@@ -39,7 +39,7 @@ export class AnalyzeCommands {
|
|
|
39
39
|
.option(
|
|
40
40
|
'--format <format>',
|
|
41
41
|
'output format (json, table, graph)',
|
|
42
|
-
'table'
|
|
42
|
+
'table'
|
|
43
43
|
)
|
|
44
44
|
.action(async options => {
|
|
45
45
|
await this.analyzeDependencies(options);
|
|
@@ -150,7 +150,7 @@ export class AnalyzeCommands {
|
|
|
150
150
|
'WUNDR_ANALYZE_DEPS_FAILED',
|
|
151
151
|
'Failed to analyze dependencies',
|
|
152
152
|
{ options },
|
|
153
|
-
true
|
|
153
|
+
true
|
|
154
154
|
);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
@@ -200,7 +200,7 @@ export class AnalyzeCommands {
|
|
|
200
200
|
'WUNDR_ANALYZE_QUALITY_FAILED',
|
|
201
201
|
'Failed to analyze code quality',
|
|
202
202
|
{ options },
|
|
203
|
-
true
|
|
203
|
+
true
|
|
204
204
|
);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
@@ -245,7 +245,7 @@ export class AnalyzeCommands {
|
|
|
245
245
|
'WUNDR_ANALYZE_PERF_FAILED',
|
|
246
246
|
'Failed to analyze performance',
|
|
247
247
|
{ options },
|
|
248
|
-
true
|
|
248
|
+
true
|
|
249
249
|
);
|
|
250
250
|
}
|
|
251
251
|
}
|
|
@@ -289,7 +289,7 @@ export class AnalyzeCommands {
|
|
|
289
289
|
'WUNDR_ANALYZE_ARCH_FAILED',
|
|
290
290
|
'Failed to analyze architecture',
|
|
291
291
|
{ options },
|
|
292
|
-
true
|
|
292
|
+
true
|
|
293
293
|
);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
@@ -331,7 +331,7 @@ export class AnalyzeCommands {
|
|
|
331
331
|
'WUNDR_ANALYZE_ALL_FAILED',
|
|
332
332
|
'Failed to run comprehensive analysis',
|
|
333
333
|
{ options },
|
|
334
|
-
true
|
|
334
|
+
true
|
|
335
335
|
);
|
|
336
336
|
}
|
|
337
337
|
}
|
|
@@ -365,7 +365,7 @@ export class AnalyzeCommands {
|
|
|
365
365
|
'WUNDR_SCAN_FAILED',
|
|
366
366
|
'Failed to scan for issues',
|
|
367
367
|
{ scanPath, options },
|
|
368
|
-
true
|
|
368
|
+
true
|
|
369
369
|
);
|
|
370
370
|
}
|
|
371
371
|
}
|
|
@@ -485,7 +485,7 @@ export class AnalyzeCommands {
|
|
|
485
485
|
|
|
486
486
|
private async performDirectoryScan(
|
|
487
487
|
scanPath: string,
|
|
488
|
-
options: any
|
|
488
|
+
options: any
|
|
489
489
|
): Promise<Finding[]> {
|
|
490
490
|
// Implementation for directory scanning
|
|
491
491
|
return [];
|
|
@@ -510,7 +510,7 @@ export class AnalyzeCommands {
|
|
|
510
510
|
*/
|
|
511
511
|
private async outputResults(
|
|
512
512
|
results: AnalysisResult,
|
|
513
|
-
format: string
|
|
513
|
+
format: string
|
|
514
514
|
): Promise<void> {
|
|
515
515
|
switch (format) {
|
|
516
516
|
case 'json':
|
|
@@ -537,7 +537,7 @@ export class AnalyzeCommands {
|
|
|
537
537
|
Line: f.line || 'N/A',
|
|
538
538
|
Description: f.description,
|
|
539
539
|
Fixable: f.fixable ? 'ā' : 'ā',
|
|
540
|
-
}))
|
|
540
|
+
}))
|
|
541
541
|
);
|
|
542
542
|
}
|
|
543
543
|
|
|
@@ -550,7 +550,7 @@ export class AnalyzeCommands {
|
|
|
550
550
|
console.log(chalk.green('\nRecommendations:'));
|
|
551
551
|
results.recommendations.forEach((rec, i) => {
|
|
552
552
|
console.log(
|
|
553
|
-
`${i + 1}. ${rec.title} (${rec.impact} impact, ${rec.effort} effort)
|
|
553
|
+
`${i + 1}. ${rec.title} (${rec.impact} impact, ${rec.effort} effort)`
|
|
554
554
|
);
|
|
555
555
|
});
|
|
556
556
|
}
|
|
@@ -562,7 +562,7 @@ export class AnalyzeCommands {
|
|
|
562
562
|
}
|
|
563
563
|
|
|
564
564
|
private async generateComprehensiveReport(
|
|
565
|
-
results: AnalysisResult[]
|
|
565
|
+
results: AnalysisResult[]
|
|
566
566
|
): Promise<void> {
|
|
567
567
|
// Implementation for comprehensive report generation
|
|
568
568
|
logger.info('Generating comprehensive report...');
|
|
@@ -570,7 +570,7 @@ export class AnalyzeCommands {
|
|
|
570
570
|
|
|
571
571
|
private async exportResults(
|
|
572
572
|
results: AnalysisResult[],
|
|
573
|
-
exportPath: string
|
|
573
|
+
exportPath: string
|
|
574
574
|
): Promise<void> {
|
|
575
575
|
await fs.writeJson(exportPath, results, { spaces: 2 });
|
|
576
576
|
logger.success(`Results exported to ${exportPath}`);
|