@wundr.io/cli 1.0.0 ā 1.0.3
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/README.md +696 -280
- package/dist/ai/ai-service.d.ts +2 -2
- package/dist/ai/ai-service.d.ts.map +1 -1
- package/dist/ai/ai-service.js +1 -1
- package/dist/ai/ai-service.js.map +1 -1
- package/dist/ai/claude-client.d.ts.map +1 -1
- package/dist/ai/claude-client.js +2 -1
- package/dist/ai/claude-client.js.map +1 -1
- package/dist/ai/conversation-manager.d.ts +2 -2
- package/dist/ai/conversation-manager.d.ts.map +1 -1
- package/dist/ai/conversation-manager.js +5 -3
- package/dist/ai/conversation-manager.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +32 -13
- package/dist/cli.js.map +1 -1
- package/dist/commands/ai.d.ts +3 -3
- package/dist/commands/ai.d.ts.map +1 -1
- package/dist/commands/ai.js +2 -2
- package/dist/commands/ai.js.map +1 -1
- package/dist/commands/alignment.d.ts +78 -0
- package/dist/commands/alignment.d.ts.map +1 -0
- package/dist/commands/alignment.js +817 -0
- package/dist/commands/alignment.js.map +1 -0
- package/dist/commands/analyze-optimized.d.ts.map +1 -1
- package/dist/commands/analyze-optimized.js +9 -6
- package/dist/commands/analyze-optimized.js.map +1 -1
- package/dist/commands/analyze.d.ts +3 -3
- package/dist/commands/analyze.d.ts.map +1 -1
- package/dist/commands/analyze.js +2 -2
- package/dist/commands/analyze.js.map +1 -1
- package/dist/commands/batch.d.ts +3 -3
- package/dist/commands/batch.d.ts.map +1 -1
- package/dist/commands/batch.js +7 -7
- package/dist/commands/batch.js.map +1 -1
- package/dist/commands/chat.d.ts +3 -3
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +3 -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 +11 -7
- package/dist/commands/claude-init.js.map +1 -1
- package/dist/commands/claude-setup.d.ts +88 -1
- package/dist/commands/claude-setup.d.ts.map +1 -1
- package/dist/commands/claude-setup.js +549 -46
- package/dist/commands/claude-setup.js.map +1 -1
- package/dist/commands/computer-setup-commands.d.ts +17 -3
- package/dist/commands/computer-setup-commands.d.ts.map +1 -1
- package/dist/commands/computer-setup-commands.js +145 -3
- package/dist/commands/computer-setup-commands.js.map +1 -1
- package/dist/commands/computer-setup.d.ts.map +1 -1
- package/dist/commands/computer-setup.js +372 -4
- package/dist/commands/computer-setup.js.map +1 -1
- package/dist/commands/create-command.d.ts.map +1 -1
- package/dist/commands/create-command.js +3 -3
- package/dist/commands/create-command.js.map +1 -1
- package/dist/commands/create.d.ts +3 -3
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +3 -3
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/dashboard.d.ts +3 -3
- package/dist/commands/dashboard.d.ts.map +1 -1
- package/dist/commands/dashboard.js +4 -3
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/govern.d.ts +3 -3
- package/dist/commands/govern.d.ts.map +1 -1
- package/dist/commands/govern.js +4 -3
- package/dist/commands/govern.js.map +1 -1
- package/dist/commands/governance.d.ts +17 -0
- package/dist/commands/governance.d.ts.map +1 -0
- package/dist/commands/governance.js +703 -0
- package/dist/commands/governance.js.map +1 -0
- package/dist/commands/guardian.d.ts +20 -0
- package/dist/commands/guardian.d.ts.map +1 -0
- package/dist/commands/guardian.js +597 -0
- package/dist/commands/guardian.js.map +1 -0
- package/dist/commands/init.d.ts +7 -3
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +71 -5
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/performance-optimizer.d.ts +2 -2
- package/dist/commands/performance-optimizer.d.ts.map +1 -1
- package/dist/commands/performance-optimizer.js +8 -7
- package/dist/commands/performance-optimizer.js.map +1 -1
- package/dist/commands/plugins.d.ts +3 -3
- package/dist/commands/plugins.d.ts.map +1 -1
- package/dist/commands/plugins.js +2 -2
- package/dist/commands/plugins.js.map +1 -1
- package/dist/commands/rag.d.ts +7 -0
- package/dist/commands/rag.d.ts.map +1 -0
- package/dist/commands/rag.js +748 -0
- package/dist/commands/rag.js.map +1 -0
- package/dist/commands/session.d.ts +41 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +441 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/setup.d.ts +3 -3
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +1 -3
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/test-init.d.ts.map +1 -1
- package/dist/commands/test-init.js +2 -2
- package/dist/commands/test-init.js.map +1 -1
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +2 -2
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/vp.d.ts +7 -0
- package/dist/commands/vp.d.ts.map +1 -0
- package/dist/commands/vp.js +571 -0
- package/dist/commands/vp.js.map +1 -0
- package/dist/commands/watch.d.ts +3 -3
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +10 -7
- package/dist/commands/watch.js.map +1 -1
- package/dist/commands/worktree.d.ts +63 -0
- package/dist/commands/worktree.d.ts.map +1 -0
- package/dist/commands/worktree.js +774 -0
- package/dist/commands/worktree.js.map +1 -0
- package/dist/context/context-manager.d.ts +1 -1
- package/dist/context/context-manager.d.ts.map +1 -1
- package/dist/context/context-manager.js +1 -1
- package/dist/context/context-manager.js.map +1 -1
- package/dist/context/session-manager.d.ts +2 -2
- package/dist/context/session-manager.d.ts.map +1 -1
- package/dist/context/session-manager.js +9 -5
- package/dist/context/session-manager.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interactive/interactive-mode.d.ts +2 -2
- package/dist/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/interactive/interactive-mode.js +6 -4
- package/dist/interactive/interactive-mode.js.map +1 -1
- package/dist/nlp/command-mapper.d.ts +1 -1
- package/dist/nlp/command-mapper.d.ts.map +1 -1
- package/dist/nlp/command-mapper.js +3 -2
- package/dist/nlp/command-mapper.js.map +1 -1
- package/dist/nlp/command-parser.d.ts +1 -1
- package/dist/nlp/command-parser.d.ts.map +1 -1
- package/dist/nlp/command-parser.js +2 -1
- package/dist/nlp/command-parser.js.map +1 -1
- package/dist/nlp/intent-parser.d.ts +1 -1
- package/dist/nlp/intent-parser.d.ts.map +1 -1
- package/dist/nlp/intent-parser.js +14 -9
- package/dist/nlp/intent-parser.js.map +1 -1
- package/dist/plugins/plugin-manager.d.ts +2 -2
- package/dist/plugins/plugin-manager.d.ts.map +1 -1
- package/dist/plugins/plugin-manager.js +3 -3
- package/dist/plugins/plugin-manager.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/backup-rollback-manager.d.ts +72 -0
- package/dist/utils/backup-rollback-manager.d.ts.map +1 -0
- package/dist/utils/backup-rollback-manager.js +289 -0
- package/dist/utils/backup-rollback-manager.js.map +1 -0
- package/dist/utils/claude-config-installer.d.ts +94 -0
- package/dist/utils/claude-config-installer.d.ts.map +1 -0
- package/dist/utils/claude-config-installer.js +628 -0
- package/dist/utils/claude-config-installer.js.map +1 -0
- package/dist/utils/config-manager.d.ts +1 -1
- package/dist/utils/config-manager.d.ts.map +1 -1
- package/dist/utils/config-manager.js +5 -5
- package/dist/utils/config-manager.js.map +1 -1
- package/dist/utils/error-handler.d.ts +1 -1
- package/dist/utils/error-handler.d.ts.map +1 -1
- package/dist/utils/error-handler.js.map +1 -1
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +22 -11
- package/dist/utils/logger.js.map +1 -1
- package/package.json +26 -7
- package/src/ai/ai-service.ts +22 -19
- package/src/ai/claude-client.ts +20 -16
- package/src/ai/conversation-manager.ts +37 -30
- package/src/cli.ts +42 -13
- package/src/commands/ai.ts +59 -57
- package/src/commands/alignment.ts +1212 -0
- package/src/commands/analyze-optimized.ts +70 -62
- package/src/commands/analyze.ts +22 -20
- package/src/commands/batch.ts +41 -38
- package/src/commands/chat.ts +37 -34
- package/src/commands/claude-init.ts +38 -30
- package/src/commands/claude-setup.ts +692 -97
- package/src/commands/computer-setup-commands.ts +203 -37
- package/src/commands/computer-setup.ts +474 -4
- package/src/commands/create-command.ts +7 -7
- package/src/commands/create.ts +36 -33
- package/src/commands/dashboard.ts +33 -28
- package/src/commands/govern.ts +34 -29
- package/src/commands/governance.ts +1005 -0
- package/src/commands/guardian.ts +887 -0
- package/src/commands/init.ts +112 -22
- package/src/commands/performance-optimizer.ts +48 -42
- package/src/commands/plugins.ts +35 -32
- package/src/commands/project-update.ts +1053 -0
- package/src/commands/rag.ts +904 -0
- package/src/commands/session.ts +631 -0
- package/src/commands/setup.ts +35 -31
- package/src/commands/test-init.ts +6 -5
- package/src/commands/test.ts +7 -6
- package/src/commands/vp.ts +762 -0
- package/src/commands/watch.ts +44 -33
- package/src/commands/worktree.ts +1057 -0
- package/src/context/context-manager.ts +15 -12
- package/src/context/session-manager.ts +51 -40
- package/src/index.ts +7 -6
- package/src/interactive/interactive-mode.ts +25 -18
- package/src/lib/conflict-resolution.ts +28 -0
- package/src/lib/merge-strategy.ts +28 -0
- package/src/lib/safety-mechanisms.ts +47 -0
- package/src/lib/state-detection.ts +28 -0
- package/src/nlp/command-mapper.ts +35 -30
- package/src/nlp/command-parser.ts +20 -17
- package/src/nlp/intent-classifier.ts +7 -7
- package/src/nlp/intent-parser.ts +61 -49
- package/src/plugins/plugin-manager.ts +27 -23
- package/src/tests/computer-setup-integration.test.ts +439 -0
- package/src/types/index.ts +1 -1
- package/src/types/modules.d.ts +1 -0
- package/src/utils/backup-rollback-manager.ts +363 -0
- package/src/utils/claude-config-installer.ts +734 -0
- package/src/utils/config-manager.ts +12 -9
- package/src/utils/error-handler.ts +5 -3
- package/src/utils/logger.ts +35 -12
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
* Enhanced CLI command for large-scale codebase analysis
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
|
|
7
8
|
import chalk from 'chalk';
|
|
8
|
-
import
|
|
9
|
+
import { Command } from 'commander';
|
|
9
10
|
import * as fs from 'fs-extra';
|
|
10
|
-
import
|
|
11
|
+
import ora from 'ora';
|
|
12
|
+
|
|
11
13
|
|
|
12
14
|
// Use analysis-engine modules for testing
|
|
13
15
|
// Temporarily using inline implementation for CodeAnalyzer
|
|
@@ -158,24 +160,24 @@ export function createOptimizedAnalyzeCommand(): Command {
|
|
|
158
160
|
const command = new Command('analyze-optimized')
|
|
159
161
|
.alias('ao')
|
|
160
162
|
.description(
|
|
161
|
-
'Run optimized analysis with memory management and high concurrency'
|
|
163
|
+
'Run optimized analysis with memory management and high concurrency',
|
|
162
164
|
)
|
|
163
165
|
.argument('<directory>', 'Directory to analyze')
|
|
164
166
|
.option(
|
|
165
167
|
'-o, --output <path>',
|
|
166
168
|
'Output directory for results',
|
|
167
|
-
'./wundr-analysis'
|
|
169
|
+
'./wundr-analysis',
|
|
168
170
|
)
|
|
169
171
|
.option(
|
|
170
172
|
'-f, --format <format>',
|
|
171
173
|
'Output format (json, html, markdown, all)',
|
|
172
|
-
'json'
|
|
174
|
+
'json',
|
|
173
175
|
)
|
|
174
176
|
.option('-v, --verbose', 'Verbose output with detailed progress', false)
|
|
175
177
|
.option(
|
|
176
178
|
'--max-memory <size>',
|
|
177
179
|
'Maximum memory usage (e.g., 250MB, 1GB)',
|
|
178
|
-
'250MB'
|
|
180
|
+
'250MB',
|
|
179
181
|
)
|
|
180
182
|
.option('--max-workers <count>', 'Maximum number of workers', '32')
|
|
181
183
|
.option('--enable-streaming', 'Enable streaming for large codebases', true)
|
|
@@ -185,7 +187,7 @@ export function createOptimizedAnalyzeCommand(): Command {
|
|
|
185
187
|
.option(
|
|
186
188
|
'--cache-enabled',
|
|
187
189
|
'Enable caching for faster repeated analysis',
|
|
188
|
-
true
|
|
190
|
+
true,
|
|
189
191
|
)
|
|
190
192
|
.option('--include <patterns...>', 'File patterns to include', [
|
|
191
193
|
'**/*.{ts,tsx,js,jsx}',
|
|
@@ -206,7 +208,7 @@ export function createOptimizedAnalyzeCommand(): Command {
|
|
|
206
208
|
*/
|
|
207
209
|
async function runOptimizedAnalysis(
|
|
208
210
|
directory: string,
|
|
209
|
-
options: OptimizedAnalysisOptions
|
|
211
|
+
options: OptimizedAnalysisOptions,
|
|
210
212
|
): Promise<void> {
|
|
211
213
|
const startTime = Date.now();
|
|
212
214
|
const spinner = ora('Initializing optimized analysis...').start();
|
|
@@ -251,8 +253,8 @@ async function runOptimizedAnalysis(
|
|
|
251
253
|
if (options.verbose) {
|
|
252
254
|
spinner.warn(
|
|
253
255
|
color(
|
|
254
|
-
`Memory Alert: ${alert.type} - ${Math.round(alert.current / 1024 / 1024)}MB
|
|
255
|
-
)
|
|
256
|
+
`Memory Alert: ${alert.type} - ${Math.round(alert.current / 1024 / 1024)}MB`,
|
|
257
|
+
),
|
|
256
258
|
);
|
|
257
259
|
}
|
|
258
260
|
});
|
|
@@ -260,8 +262,8 @@ async function runOptimizedAnalysis(
|
|
|
260
262
|
memoryMonitor.on('memory-leak-detected', (analysis: any) => {
|
|
261
263
|
spinner.warn(
|
|
262
264
|
chalk.red(
|
|
263
|
-
`Memory leak detected! Growth rate: ${Math.round(analysis.growthRate / 1024)}KB/s
|
|
264
|
-
)
|
|
265
|
+
`Memory leak detected! Growth rate: ${Math.round(analysis.growthRate / 1024)}KB/s`,
|
|
266
|
+
),
|
|
265
267
|
);
|
|
266
268
|
});
|
|
267
269
|
|
|
@@ -298,8 +300,8 @@ async function runOptimizedAnalysis(
|
|
|
298
300
|
analysisService.on('memory-leak-warning', (warning: any) => {
|
|
299
301
|
spinner.warn(
|
|
300
302
|
chalk.yellow(
|
|
301
|
-
`Memory Warning: ${warning.severity} - Growth: ${Math.round(warning.growthRate / 1024)}KB/s
|
|
302
|
-
)
|
|
303
|
+
`Memory Warning: ${warning.severity} - Growth: ${Math.round(warning.growthRate / 1024)}KB/s`,
|
|
304
|
+
),
|
|
303
305
|
);
|
|
304
306
|
});
|
|
305
307
|
}
|
|
@@ -327,27 +329,27 @@ async function runOptimizedAnalysis(
|
|
|
327
329
|
console.log(chalk.cyan('š Performance Summary:'));
|
|
328
330
|
console.log(chalk.gray(` Duration: ${formatDuration(duration)}`));
|
|
329
331
|
console.log(
|
|
330
|
-
chalk.gray(` Files analyzed: ${result.data?.summary.totalFiles || 0}`)
|
|
332
|
+
chalk.gray(` Files analyzed: ${result.data?.summary.totalFiles || 0}`),
|
|
331
333
|
);
|
|
332
334
|
console.log(
|
|
333
335
|
chalk.gray(
|
|
334
|
-
` Entities found: ${result.data?.summary.totalEntities || 0}
|
|
335
|
-
)
|
|
336
|
+
` Entities found: ${result.data?.summary.totalEntities || 0}`,
|
|
337
|
+
),
|
|
336
338
|
);
|
|
337
339
|
console.log(
|
|
338
340
|
chalk.gray(
|
|
339
|
-
` Peak memory: ${formatFileSize(memoryMetrics.peak.heapUsed)}
|
|
340
|
-
)
|
|
341
|
+
` Peak memory: ${formatFileSize(memoryMetrics.peak.heapUsed)}`,
|
|
342
|
+
),
|
|
341
343
|
);
|
|
342
344
|
console.log(
|
|
343
345
|
chalk.gray(
|
|
344
|
-
` Average memory: ${formatFileSize(memoryMetrics.average.heapUsed)}
|
|
345
|
-
)
|
|
346
|
+
` Average memory: ${formatFileSize(memoryMetrics.average.heapUsed)}`,
|
|
347
|
+
),
|
|
346
348
|
);
|
|
347
349
|
console.log(
|
|
348
350
|
chalk.gray(
|
|
349
|
-
` Processing rate: ${Math.round((result.data?.summary.totalFiles || 0) / (duration / 1000))} files/sec
|
|
350
|
-
)
|
|
351
|
+
` Processing rate: ${Math.round((result.data?.summary.totalFiles || 0) / (duration / 1000))} files/sec`,
|
|
352
|
+
),
|
|
351
353
|
);
|
|
352
354
|
|
|
353
355
|
// Analysis results
|
|
@@ -355,49 +357,49 @@ async function runOptimizedAnalysis(
|
|
|
355
357
|
console.log(chalk.cyan('\nš Analysis Results:'));
|
|
356
358
|
console.log(
|
|
357
359
|
chalk.gray(
|
|
358
|
-
` Duplicate clusters: ${result.data.summary.duplicateClusters}
|
|
359
|
-
)
|
|
360
|
+
` Duplicate clusters: ${result.data.summary.duplicateClusters}`,
|
|
361
|
+
),
|
|
360
362
|
);
|
|
361
363
|
console.log(
|
|
362
364
|
chalk.gray(
|
|
363
|
-
` Circular dependencies: ${result.data.summary.circularDependencies}
|
|
364
|
-
)
|
|
365
|
+
` Circular dependencies: ${result.data.summary.circularDependencies}`,
|
|
366
|
+
),
|
|
365
367
|
);
|
|
366
368
|
console.log(
|
|
367
|
-
chalk.gray(` Code smells: ${result.data.summary.codeSmells}`)
|
|
369
|
+
chalk.gray(` Code smells: ${result.data.summary.codeSmells}`),
|
|
368
370
|
);
|
|
369
371
|
console.log(
|
|
370
372
|
chalk.gray(
|
|
371
|
-
` Technical debt score: ${result.data.summary.technicalDebt}/100
|
|
372
|
-
)
|
|
373
|
+
` Technical debt score: ${result.data.summary.technicalDebt}/100`,
|
|
374
|
+
),
|
|
373
375
|
);
|
|
374
376
|
}
|
|
375
377
|
|
|
376
378
|
// Memory efficiency
|
|
377
379
|
const memoryEfficiency = calculateMemoryEfficiency(
|
|
378
380
|
result.data?.summary.totalFiles || 0,
|
|
379
|
-
memoryMetrics.peak.heapUsed
|
|
381
|
+
memoryMetrics.peak.heapUsed,
|
|
380
382
|
);
|
|
381
383
|
console.log(chalk.cyan('\nš¾ Memory Efficiency:'));
|
|
382
384
|
console.log(
|
|
383
|
-
chalk.gray(` Efficiency score: ${memoryEfficiency.toFixed(1)}%`)
|
|
385
|
+
chalk.gray(` Efficiency score: ${memoryEfficiency.toFixed(1)}%`),
|
|
384
386
|
);
|
|
385
387
|
console.log(
|
|
386
388
|
chalk.gray(
|
|
387
|
-
` Memory per file: ${Math.round(memoryMetrics.average.heapUsed / Math.max(1, result.data?.summary.totalFiles || 1) / 1024)}KB
|
|
388
|
-
)
|
|
389
|
+
` Memory per file: ${Math.round(memoryMetrics.average.heapUsed / Math.max(1, result.data?.summary.totalFiles || 1) / 1024)}KB`,
|
|
390
|
+
),
|
|
389
391
|
);
|
|
390
392
|
|
|
391
393
|
// Leak analysis
|
|
392
394
|
if (memoryMetrics.leakAnalysis.leakDetected) {
|
|
393
395
|
console.log(chalk.red('\nā ļø Memory Leak Detected:'));
|
|
394
396
|
console.log(
|
|
395
|
-
chalk.gray(` Severity: ${memoryMetrics.leakAnalysis.severity}`)
|
|
397
|
+
chalk.gray(` Severity: ${memoryMetrics.leakAnalysis.severity}`),
|
|
396
398
|
);
|
|
397
399
|
console.log(
|
|
398
400
|
chalk.gray(
|
|
399
|
-
` Growth rate: ${Math.round(memoryMetrics.leakAnalysis.growthRate / 1024)}KB/s
|
|
400
|
-
)
|
|
401
|
+
` Growth rate: ${Math.round(memoryMetrics.leakAnalysis.growthRate / 1024)}KB/s`,
|
|
402
|
+
),
|
|
401
403
|
);
|
|
402
404
|
}
|
|
403
405
|
|
|
@@ -438,18 +440,18 @@ async function runOptimizedAnalysis(
|
|
|
438
440
|
console.log(chalk.cyan('ā” Benchmark Results:'));
|
|
439
441
|
console.log(
|
|
440
442
|
chalk.gray(
|
|
441
|
-
` Speedup: ${mainResult.results.improvement.speedup.toFixed(1)}x
|
|
442
|
-
)
|
|
443
|
+
` Speedup: ${mainResult.results.improvement.speedup.toFixed(1)}x`,
|
|
444
|
+
),
|
|
443
445
|
);
|
|
444
446
|
console.log(
|
|
445
447
|
chalk.gray(
|
|
446
|
-
` Memory reduction: ${mainResult.results.improvement.memoryReduction.toFixed(1)}
|
|
447
|
-
)
|
|
448
|
+
` Memory reduction: ${mainResult.results.improvement.memoryReduction.toFixed(1)}%`,
|
|
449
|
+
),
|
|
448
450
|
);
|
|
449
451
|
console.log(
|
|
450
452
|
chalk.gray(
|
|
451
|
-
` Throughput increase: ${mainResult.results.improvement.throughputIncrease.toFixed(1)}
|
|
452
|
-
)
|
|
453
|
+
` Throughput increase: ${mainResult.results.improvement.throughputIncrease.toFixed(1)}%`,
|
|
454
|
+
),
|
|
453
455
|
);
|
|
454
456
|
}
|
|
455
457
|
|
|
@@ -461,7 +463,7 @@ async function runOptimizedAnalysis(
|
|
|
461
463
|
spinner.fail('Analysis failed');
|
|
462
464
|
console.error(
|
|
463
465
|
chalk.red('\nā Error:'),
|
|
464
|
-
error instanceof Error ? error.message : String(error)
|
|
466
|
+
error instanceof Error ? error.message : String(error),
|
|
465
467
|
);
|
|
466
468
|
|
|
467
469
|
if (options.verbose && error instanceof Error) {
|
|
@@ -502,9 +504,15 @@ function parseMemoryLimit(memoryStr: string): number {
|
|
|
502
504
|
* Format duration in milliseconds to human-readable string
|
|
503
505
|
*/
|
|
504
506
|
function formatDuration(ms: number): string {
|
|
505
|
-
if (ms < 1000)
|
|
506
|
-
|
|
507
|
-
|
|
507
|
+
if (ms < 1000) {
|
|
508
|
+
return `${ms}ms`;
|
|
509
|
+
}
|
|
510
|
+
if (ms < 60000) {
|
|
511
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
512
|
+
}
|
|
513
|
+
if (ms < 3600000) {
|
|
514
|
+
return `${(ms / 60000).toFixed(1)}m`;
|
|
515
|
+
}
|
|
508
516
|
return `${(ms / 3600000).toFixed(1)}h`;
|
|
509
517
|
}
|
|
510
518
|
|
|
@@ -529,12 +537,12 @@ function formatFileSize(bytes: number): string {
|
|
|
529
537
|
*/
|
|
530
538
|
function calculateMemoryEfficiency(
|
|
531
539
|
fileCount: number,
|
|
532
|
-
memoryUsed: number
|
|
540
|
+
memoryUsed: number,
|
|
533
541
|
): number {
|
|
534
542
|
const expectedMemory = fileCount * 50 * 1024; // 50KB per file baseline
|
|
535
543
|
const efficiency = Math.max(
|
|
536
544
|
0,
|
|
537
|
-
100 - ((memoryUsed - expectedMemory) / expectedMemory) * 100
|
|
545
|
+
100 - ((memoryUsed - expectedMemory) / expectedMemory) * 100,
|
|
538
546
|
);
|
|
539
547
|
return Math.min(100, efficiency);
|
|
540
548
|
}
|
|
@@ -546,12 +554,12 @@ export function createBenchmarkCommand(): Command {
|
|
|
546
554
|
const command = new Command('benchmark')
|
|
547
555
|
.alias('bench')
|
|
548
556
|
.description(
|
|
549
|
-
'Run performance benchmarks for memory and concurrency optimizations'
|
|
557
|
+
'Run performance benchmarks for memory and concurrency optimizations',
|
|
550
558
|
)
|
|
551
559
|
.option(
|
|
552
560
|
'-o, --output <path>',
|
|
553
561
|
'Output directory for benchmark results',
|
|
554
|
-
'./benchmark-results'
|
|
562
|
+
'./benchmark-results',
|
|
555
563
|
)
|
|
556
564
|
.option('--iterations <count>', 'Number of benchmark iterations', '3')
|
|
557
565
|
.option('--memory-limit <size>', 'Memory limit for testing', '500MB')
|
|
@@ -600,41 +608,41 @@ async function runBenchmarks(options: any): Promise<void> {
|
|
|
600
608
|
const avgSpeedup =
|
|
601
609
|
results.reduce(
|
|
602
610
|
(sum: any, r: any) => sum + r.results.improvement.speedup,
|
|
603
|
-
0
|
|
611
|
+
0,
|
|
604
612
|
) / results.length;
|
|
605
613
|
const avgMemoryReduction =
|
|
606
614
|
results.reduce(
|
|
607
615
|
(sum: any, r: any) => sum + r.results.improvement.memoryReduction,
|
|
608
|
-
0
|
|
616
|
+
0,
|
|
609
617
|
) / results.length;
|
|
610
618
|
const avgThroughputIncrease =
|
|
611
619
|
results.reduce(
|
|
612
620
|
(sum: any, r: any) => sum + r.results.improvement.throughputIncrease,
|
|
613
|
-
0
|
|
621
|
+
0,
|
|
614
622
|
) / results.length;
|
|
615
623
|
|
|
616
624
|
console.log(chalk.cyan(`š Average Speedup: ${avgSpeedup.toFixed(1)}x`));
|
|
617
625
|
console.log(
|
|
618
626
|
chalk.cyan(
|
|
619
|
-
`š¾ Average Memory Reduction: ${avgMemoryReduction.toFixed(1)}
|
|
620
|
-
)
|
|
627
|
+
`š¾ Average Memory Reduction: ${avgMemoryReduction.toFixed(1)}%`,
|
|
628
|
+
),
|
|
621
629
|
);
|
|
622
630
|
console.log(
|
|
623
631
|
chalk.cyan(
|
|
624
|
-
`š Average Throughput Increase: ${avgThroughputIncrease.toFixed(1)}
|
|
625
|
-
)
|
|
632
|
+
`š Average Throughput Increase: ${avgThroughputIncrease.toFixed(1)}%`,
|
|
633
|
+
),
|
|
626
634
|
);
|
|
627
635
|
|
|
628
636
|
console.log(
|
|
629
637
|
chalk.green(
|
|
630
|
-
`\nš Results saved to: ${options.output || './benchmark-results'}\n
|
|
631
|
-
)
|
|
638
|
+
`\nš Results saved to: ${options.output || './benchmark-results'}\n`,
|
|
639
|
+
),
|
|
632
640
|
);
|
|
633
641
|
} catch (error) {
|
|
634
642
|
spinner.fail('Benchmarks failed');
|
|
635
643
|
console.error(
|
|
636
644
|
chalk.red('\nā Error:'),
|
|
637
|
-
error instanceof Error ? error.message : String(error)
|
|
645
|
+
error instanceof Error ? error.message : String(error),
|
|
638
646
|
);
|
|
639
647
|
process.exit(1);
|
|
640
648
|
}
|
package/src/commands/analyze.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import chalk from 'chalk';
|
|
2
2
|
import fs from 'fs-extra';
|
|
3
|
+
|
|
3
4
|
// import path from 'path'; // Unused import
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
import { ConfigManager } from '../utils/config-manager';
|
|
6
|
-
import { PluginManager } from '../plugins/plugin-manager';
|
|
7
|
-
import { logger } from '../utils/logger';
|
|
8
5
|
import { errorHandler } from '../utils/error-handler';
|
|
9
|
-
import {
|
|
6
|
+
import { logger } from '../utils/logger';
|
|
7
|
+
|
|
8
|
+
import type { PluginManager } from '../plugins/plugin-manager';
|
|
9
|
+
import type { AnalysisResult, Finding } from '../types';
|
|
10
|
+
import type { ConfigManager } from '../utils/config-manager';
|
|
11
|
+
import type { Command } from 'commander';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Analyze commands for code analysis and dependency management
|
|
@@ -15,7 +17,7 @@ export class AnalyzeCommands {
|
|
|
15
17
|
constructor(
|
|
16
18
|
private program: Command,
|
|
17
19
|
private _configManager: ConfigManager,
|
|
18
|
-
private _pluginManager: PluginManager
|
|
20
|
+
private _pluginManager: PluginManager,
|
|
19
21
|
) {
|
|
20
22
|
this.registerCommands();
|
|
21
23
|
}
|
|
@@ -37,7 +39,7 @@ export class AnalyzeCommands {
|
|
|
37
39
|
.option(
|
|
38
40
|
'--format <format>',
|
|
39
41
|
'output format (json, table, graph)',
|
|
40
|
-
'table'
|
|
42
|
+
'table',
|
|
41
43
|
)
|
|
42
44
|
.action(async options => {
|
|
43
45
|
await this.analyzeDependencies(options);
|
|
@@ -148,7 +150,7 @@ export class AnalyzeCommands {
|
|
|
148
150
|
'WUNDR_ANALYZE_DEPS_FAILED',
|
|
149
151
|
'Failed to analyze dependencies',
|
|
150
152
|
{ options },
|
|
151
|
-
true
|
|
153
|
+
true,
|
|
152
154
|
);
|
|
153
155
|
}
|
|
154
156
|
}
|
|
@@ -198,7 +200,7 @@ export class AnalyzeCommands {
|
|
|
198
200
|
'WUNDR_ANALYZE_QUALITY_FAILED',
|
|
199
201
|
'Failed to analyze code quality',
|
|
200
202
|
{ options },
|
|
201
|
-
true
|
|
203
|
+
true,
|
|
202
204
|
);
|
|
203
205
|
}
|
|
204
206
|
}
|
|
@@ -243,7 +245,7 @@ export class AnalyzeCommands {
|
|
|
243
245
|
'WUNDR_ANALYZE_PERF_FAILED',
|
|
244
246
|
'Failed to analyze performance',
|
|
245
247
|
{ options },
|
|
246
|
-
true
|
|
248
|
+
true,
|
|
247
249
|
);
|
|
248
250
|
}
|
|
249
251
|
}
|
|
@@ -287,7 +289,7 @@ export class AnalyzeCommands {
|
|
|
287
289
|
'WUNDR_ANALYZE_ARCH_FAILED',
|
|
288
290
|
'Failed to analyze architecture',
|
|
289
291
|
{ options },
|
|
290
|
-
true
|
|
292
|
+
true,
|
|
291
293
|
);
|
|
292
294
|
}
|
|
293
295
|
}
|
|
@@ -329,7 +331,7 @@ export class AnalyzeCommands {
|
|
|
329
331
|
'WUNDR_ANALYZE_ALL_FAILED',
|
|
330
332
|
'Failed to run comprehensive analysis',
|
|
331
333
|
{ options },
|
|
332
|
-
true
|
|
334
|
+
true,
|
|
333
335
|
);
|
|
334
336
|
}
|
|
335
337
|
}
|
|
@@ -363,7 +365,7 @@ export class AnalyzeCommands {
|
|
|
363
365
|
'WUNDR_SCAN_FAILED',
|
|
364
366
|
'Failed to scan for issues',
|
|
365
367
|
{ scanPath, options },
|
|
366
|
-
true
|
|
368
|
+
true,
|
|
367
369
|
);
|
|
368
370
|
}
|
|
369
371
|
}
|
|
@@ -483,7 +485,7 @@ export class AnalyzeCommands {
|
|
|
483
485
|
|
|
484
486
|
private async performDirectoryScan(
|
|
485
487
|
scanPath: string,
|
|
486
|
-
options: any
|
|
488
|
+
options: any,
|
|
487
489
|
): Promise<Finding[]> {
|
|
488
490
|
// Implementation for directory scanning
|
|
489
491
|
return [];
|
|
@@ -508,7 +510,7 @@ export class AnalyzeCommands {
|
|
|
508
510
|
*/
|
|
509
511
|
private async outputResults(
|
|
510
512
|
results: AnalysisResult,
|
|
511
|
-
format: string
|
|
513
|
+
format: string,
|
|
512
514
|
): Promise<void> {
|
|
513
515
|
switch (format) {
|
|
514
516
|
case 'json':
|
|
@@ -535,7 +537,7 @@ export class AnalyzeCommands {
|
|
|
535
537
|
Line: f.line || 'N/A',
|
|
536
538
|
Description: f.description,
|
|
537
539
|
Fixable: f.fixable ? 'ā' : 'ā',
|
|
538
|
-
}))
|
|
540
|
+
})),
|
|
539
541
|
);
|
|
540
542
|
}
|
|
541
543
|
|
|
@@ -548,7 +550,7 @@ export class AnalyzeCommands {
|
|
|
548
550
|
console.log(chalk.green('\nRecommendations:'));
|
|
549
551
|
results.recommendations.forEach((rec, i) => {
|
|
550
552
|
console.log(
|
|
551
|
-
`${i + 1}. ${rec.title} (${rec.impact} impact, ${rec.effort} effort)
|
|
553
|
+
`${i + 1}. ${rec.title} (${rec.impact} impact, ${rec.effort} effort)`,
|
|
552
554
|
);
|
|
553
555
|
});
|
|
554
556
|
}
|
|
@@ -560,7 +562,7 @@ export class AnalyzeCommands {
|
|
|
560
562
|
}
|
|
561
563
|
|
|
562
564
|
private async generateComprehensiveReport(
|
|
563
|
-
results: AnalysisResult[]
|
|
565
|
+
results: AnalysisResult[],
|
|
564
566
|
): Promise<void> {
|
|
565
567
|
// Implementation for comprehensive report generation
|
|
566
568
|
logger.info('Generating comprehensive report...');
|
|
@@ -568,7 +570,7 @@ export class AnalyzeCommands {
|
|
|
568
570
|
|
|
569
571
|
private async exportResults(
|
|
570
572
|
results: AnalysisResult[],
|
|
571
|
-
exportPath: string
|
|
573
|
+
exportPath: string,
|
|
572
574
|
): Promise<void> {
|
|
573
575
|
await fs.writeJson(exportPath, results, { spaces: 2 });
|
|
574
576
|
logger.success(`Results exported to ${exportPath}`);
|