@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
|
@@ -14,8 +14,15 @@ import ora from 'ora';
|
|
|
14
14
|
import YAML from 'yaml';
|
|
15
15
|
|
|
16
16
|
// Constants
|
|
17
|
-
const ORCHESTRATOR_CONFIG_DIR = path.join(
|
|
18
|
-
|
|
17
|
+
const ORCHESTRATOR_CONFIG_DIR = path.join(
|
|
18
|
+
os.homedir(),
|
|
19
|
+
'.wundr',
|
|
20
|
+
'orchestrator-daemon'
|
|
21
|
+
);
|
|
22
|
+
const ORCHESTRATOR_CONFIG_FILE = path.join(
|
|
23
|
+
ORCHESTRATOR_CONFIG_DIR,
|
|
24
|
+
'config.yaml'
|
|
25
|
+
);
|
|
19
26
|
const ORCHESTRATOR_PID_FILE = path.join(ORCHESTRATOR_CONFIG_DIR, 'daemon.pid');
|
|
20
27
|
const ORCHESTRATOR_LOG_FILE = path.join(ORCHESTRATOR_CONFIG_DIR, 'daemon.log');
|
|
21
28
|
|
|
@@ -204,9 +211,7 @@ function formatUptime(ms: number): string {
|
|
|
204
211
|
// Create Orchestrator command
|
|
205
212
|
export function createOrchestratorCommand(): Command {
|
|
206
213
|
const command = new Command('orchestrator')
|
|
207
|
-
.description(
|
|
208
|
-
'Manage the Orchestrator Daemon for agent orchestration',
|
|
209
|
-
)
|
|
214
|
+
.description('Manage the Orchestrator Daemon for agent orchestration')
|
|
210
215
|
.addHelpText(
|
|
211
216
|
'after',
|
|
212
217
|
chalk.gray(`
|
|
@@ -217,7 +222,7 @@ Examples:
|
|
|
217
222
|
${chalk.green('wundr orchestrator stop')} Stop the daemon gracefully
|
|
218
223
|
${chalk.green('wundr orchestrator config show')} View current configuration
|
|
219
224
|
${chalk.green('wundr orchestrator config set daemon.port=9000')} Update configuration
|
|
220
|
-
`)
|
|
225
|
+
`)
|
|
221
226
|
);
|
|
222
227
|
|
|
223
228
|
// Start command
|
|
@@ -308,7 +313,7 @@ async function startDaemon(options: {
|
|
|
308
313
|
const currentStatus = await getDaemonStatus();
|
|
309
314
|
if (currentStatus.running) {
|
|
310
315
|
spinner.fail(
|
|
311
|
-
`Orchestrator Daemon is already running (PID: ${currentStatus.pid}, port: ${currentStatus.port})
|
|
316
|
+
`Orchestrator Daemon is already running (PID: ${currentStatus.pid}, port: ${currentStatus.port})`
|
|
312
317
|
);
|
|
313
318
|
return;
|
|
314
319
|
}
|
|
@@ -343,7 +348,9 @@ async function startDaemon(options: {
|
|
|
343
348
|
.replace(/\.js$/, '');
|
|
344
349
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
345
350
|
const daemonModule = require(daemonModulePath);
|
|
346
|
-
const OrchestratorDaemon =
|
|
351
|
+
const OrchestratorDaemon =
|
|
352
|
+
daemonModule.OrchestratorDaemon ||
|
|
353
|
+
daemonModule.default?.OrchestratorDaemon;
|
|
347
354
|
|
|
348
355
|
if (!OrchestratorDaemon) {
|
|
349
356
|
throw new Error('OrchestratorDaemon class not found in module');
|
|
@@ -361,18 +368,22 @@ async function startDaemon(options: {
|
|
|
361
368
|
} catch (importError) {
|
|
362
369
|
// Fallback: try to spawn the daemon as a subprocess
|
|
363
370
|
spinner.fail('Failed to load Orchestrator Daemon module');
|
|
364
|
-
console.error(
|
|
371
|
+
console.error(
|
|
372
|
+
chalk.red('\nThe Orchestrator Daemon module could not be loaded.')
|
|
373
|
+
);
|
|
365
374
|
console.error(chalk.gray('Options to resolve:'));
|
|
366
|
-
console.error(
|
|
375
|
+
console.error(
|
|
376
|
+
chalk.white(' 1. Install: npm install @wundr/orchestrator-daemon')
|
|
377
|
+
);
|
|
367
378
|
console.error(
|
|
368
379
|
chalk.white(
|
|
369
|
-
' 2. Or build from source: cd scripts/orchestrator-daemon && npm run build'
|
|
370
|
-
)
|
|
380
|
+
' 2. Or build from source: cd scripts/orchestrator-daemon && npm run build'
|
|
381
|
+
)
|
|
371
382
|
);
|
|
372
383
|
console.error(
|
|
373
384
|
chalk.gray(
|
|
374
|
-
`\nError: ${importError instanceof Error ? importError.message : String(importError)}
|
|
375
|
-
)
|
|
385
|
+
`\nError: ${importError instanceof Error ? importError.message : String(importError)}`
|
|
386
|
+
)
|
|
376
387
|
);
|
|
377
388
|
return;
|
|
378
389
|
}
|
|
@@ -393,13 +404,13 @@ async function startDaemon(options: {
|
|
|
393
404
|
([k, v]: [string, unknown]) => [
|
|
394
405
|
k,
|
|
395
406
|
(v as { status?: string })?.status ?? 'unknown',
|
|
396
|
-
]
|
|
397
|
-
)
|
|
407
|
+
]
|
|
408
|
+
)
|
|
398
409
|
),
|
|
399
410
|
};
|
|
400
411
|
fs.writeFile(
|
|
401
412
|
path.join(ORCHESTRATOR_CONFIG_DIR, 'status.json'),
|
|
402
|
-
JSON.stringify(statusData, null, 2)
|
|
413
|
+
JSON.stringify(statusData, null, 2)
|
|
403
414
|
).catch(() => {});
|
|
404
415
|
};
|
|
405
416
|
|
|
@@ -408,7 +419,9 @@ async function startDaemon(options: {
|
|
|
408
419
|
// Set up cleanup handlers
|
|
409
420
|
const cleanup = async () => {
|
|
410
421
|
await fs.unlink(ORCHESTRATOR_PID_FILE).catch(() => {});
|
|
411
|
-
await fs
|
|
422
|
+
await fs
|
|
423
|
+
.unlink(path.join(ORCHESTRATOR_CONFIG_DIR, 'status.json'))
|
|
424
|
+
.catch(() => {});
|
|
412
425
|
};
|
|
413
426
|
|
|
414
427
|
daemon.on('stopped', cleanup);
|
|
@@ -417,7 +430,7 @@ async function startDaemon(options: {
|
|
|
417
430
|
await daemon.start();
|
|
418
431
|
|
|
419
432
|
spinner.succeed(
|
|
420
|
-
`Orchestrator Daemon started successfully on ${config.daemon.host}:${config.daemon.port}
|
|
433
|
+
`Orchestrator Daemon started successfully on ${config.daemon.host}:${config.daemon.port}`
|
|
421
434
|
);
|
|
422
435
|
|
|
423
436
|
console.log(chalk.gray('\nDaemon Information:'));
|
|
@@ -442,7 +455,7 @@ async function startDaemon(options: {
|
|
|
442
455
|
} catch (error) {
|
|
443
456
|
spinner.fail('Failed to start Orchestrator Daemon');
|
|
444
457
|
console.error(
|
|
445
|
-
chalk.red(error instanceof Error ? error.message : String(error))
|
|
458
|
+
chalk.red(error instanceof Error ? error.message : String(error))
|
|
446
459
|
);
|
|
447
460
|
}
|
|
448
461
|
}
|
|
@@ -468,8 +481,8 @@ async function showStatus(options: { json?: boolean }): Promise<void> {
|
|
|
468
481
|
},
|
|
469
482
|
},
|
|
470
483
|
null,
|
|
471
|
-
2
|
|
472
|
-
)
|
|
484
|
+
2
|
|
485
|
+
)
|
|
473
486
|
);
|
|
474
487
|
return;
|
|
475
488
|
}
|
|
@@ -502,7 +515,7 @@ async function showStatus(options: { json?: boolean }): Promise<void> {
|
|
|
502
515
|
? chalk.yellow
|
|
503
516
|
: chalk.red;
|
|
504
517
|
console.log(
|
|
505
|
-
healthColor(`Health: ${status.health.toUpperCase()}`)
|
|
518
|
+
healthColor(`Health: ${status.health.toUpperCase()}`)
|
|
506
519
|
);
|
|
507
520
|
}
|
|
508
521
|
|
|
@@ -530,7 +543,7 @@ async function showStatus(options: { json?: boolean }): Promise<void> {
|
|
|
530
543
|
} catch (error) {
|
|
531
544
|
spinner.fail('Failed to get daemon status');
|
|
532
545
|
console.error(
|
|
533
|
-
chalk.red(error instanceof Error ? error.message : String(error))
|
|
546
|
+
chalk.red(error instanceof Error ? error.message : String(error))
|
|
534
547
|
);
|
|
535
548
|
}
|
|
536
549
|
}
|
|
@@ -556,7 +569,9 @@ async function stopDaemon(options: {
|
|
|
556
569
|
spinner.text = 'Force stopping daemon...';
|
|
557
570
|
process.kill(pid, 'SIGKILL');
|
|
558
571
|
await fs.unlink(ORCHESTRATOR_PID_FILE).catch(() => {});
|
|
559
|
-
await fs
|
|
572
|
+
await fs
|
|
573
|
+
.unlink(path.join(ORCHESTRATOR_CONFIG_DIR, 'status.json'))
|
|
574
|
+
.catch(() => {});
|
|
560
575
|
spinner.succeed('Orchestrator Daemon force stopped');
|
|
561
576
|
return;
|
|
562
577
|
}
|
|
@@ -586,12 +601,14 @@ async function stopDaemon(options: {
|
|
|
586
601
|
spinner.text = 'Graceful shutdown timed out, forcing stop...';
|
|
587
602
|
process.kill(pid, 'SIGKILL');
|
|
588
603
|
await fs.unlink(ORCHESTRATOR_PID_FILE).catch(() => {});
|
|
589
|
-
await fs
|
|
604
|
+
await fs
|
|
605
|
+
.unlink(path.join(ORCHESTRATOR_CONFIG_DIR, 'status.json'))
|
|
606
|
+
.catch(() => {});
|
|
590
607
|
spinner.warn('Orchestrator Daemon stopped (forced after timeout)');
|
|
591
608
|
} catch (error) {
|
|
592
609
|
spinner.fail('Failed to stop Orchestrator Daemon');
|
|
593
610
|
console.error(
|
|
594
|
-
chalk.red(error instanceof Error ? error.message : String(error))
|
|
611
|
+
chalk.red(error instanceof Error ? error.message : String(error))
|
|
595
612
|
);
|
|
596
613
|
}
|
|
597
614
|
}
|
|
@@ -611,7 +628,7 @@ async function showConfig(options: { json?: boolean }): Promise<void> {
|
|
|
611
628
|
}
|
|
612
629
|
} catch (error) {
|
|
613
630
|
console.error(
|
|
614
|
-
chalk.red(error instanceof Error ? error.message : String(error))
|
|
631
|
+
chalk.red(error instanceof Error ? error.message : String(error))
|
|
615
632
|
);
|
|
616
633
|
}
|
|
617
634
|
}
|
|
@@ -623,10 +640,12 @@ async function setConfig(keyValue: string): Promise<void> {
|
|
|
623
640
|
|
|
624
641
|
if (!keyPath || valueStr === undefined) {
|
|
625
642
|
console.error(
|
|
626
|
-
chalk.red(
|
|
643
|
+
chalk.red(
|
|
644
|
+
'Invalid format. Use: wundr orchestrator config set <key>=<value>'
|
|
645
|
+
)
|
|
627
646
|
);
|
|
628
647
|
console.error(
|
|
629
|
-
chalk.gray('Example: wundr orchestrator config set daemon.port=9000')
|
|
648
|
+
chalk.gray('Example: wundr orchestrator config set daemon.port=9000')
|
|
630
649
|
);
|
|
631
650
|
return;
|
|
632
651
|
}
|
|
@@ -671,13 +690,13 @@ async function setConfig(keyValue: string): Promise<void> {
|
|
|
671
690
|
console.log(chalk.green('Configuration updated:'));
|
|
672
691
|
console.log(
|
|
673
692
|
chalk.white(
|
|
674
|
-
` ${keyPath}: ${JSON.stringify(oldValue)} -> ${JSON.stringify(value)}
|
|
675
|
-
)
|
|
693
|
+
` ${keyPath}: ${JSON.stringify(oldValue)} -> ${JSON.stringify(value)}`
|
|
694
|
+
)
|
|
676
695
|
);
|
|
677
696
|
console.log(chalk.gray('\nRestart the daemon for changes to take effect.'));
|
|
678
697
|
} catch (error) {
|
|
679
698
|
console.error(
|
|
680
|
-
chalk.red(error instanceof Error ? error.message : String(error))
|
|
699
|
+
chalk.red(error instanceof Error ? error.message : String(error))
|
|
681
700
|
);
|
|
682
701
|
}
|
|
683
702
|
}
|
|
@@ -709,7 +728,7 @@ async function resetConfig(options: { force?: boolean }): Promise<void> {
|
|
|
709
728
|
console.log(chalk.gray(`Saved to: ${ORCHESTRATOR_CONFIG_FILE}`));
|
|
710
729
|
} catch (error) {
|
|
711
730
|
console.error(
|
|
712
|
-
chalk.red(error instanceof Error ? error.message : String(error))
|
|
731
|
+
chalk.red(error instanceof Error ? error.message : String(error))
|
|
713
732
|
);
|
|
714
733
|
}
|
|
715
734
|
}
|
|
@@ -724,20 +743,26 @@ async function viewLogs(options: {
|
|
|
724
743
|
console.log(chalk.yellow('No log file found.'));
|
|
725
744
|
console.log(chalk.gray(`Expected location: ${ORCHESTRATOR_LOG_FILE}`));
|
|
726
745
|
console.log(
|
|
727
|
-
chalk.gray('Start the daemon with --verbose to enable logging.')
|
|
746
|
+
chalk.gray('Start the daemon with --verbose to enable logging.')
|
|
728
747
|
);
|
|
729
748
|
return;
|
|
730
749
|
}
|
|
731
750
|
|
|
732
751
|
try {
|
|
733
752
|
if (options.follow) {
|
|
734
|
-
console.log(
|
|
753
|
+
console.log(
|
|
754
|
+
chalk.cyan(`Following logs from ${ORCHESTRATOR_LOG_FILE}...`)
|
|
755
|
+
);
|
|
735
756
|
console.log(chalk.gray('Press Ctrl+C to stop.\n'));
|
|
736
757
|
|
|
737
758
|
const { spawn } = await import('child_process');
|
|
738
|
-
const tail = spawn(
|
|
739
|
-
|
|
740
|
-
|
|
759
|
+
const tail = spawn(
|
|
760
|
+
'tail',
|
|
761
|
+
['-f', '-n', String(lines), ORCHESTRATOR_LOG_FILE],
|
|
762
|
+
{
|
|
763
|
+
stdio: 'inherit',
|
|
764
|
+
}
|
|
765
|
+
);
|
|
741
766
|
|
|
742
767
|
await new Promise<void>(resolve => {
|
|
743
768
|
process.on('SIGINT', () => {
|
|
@@ -751,12 +776,14 @@ async function viewLogs(options: {
|
|
|
751
776
|
const logLines = content.split('\n');
|
|
752
777
|
const lastLines = logLines.slice(-lines).join('\n');
|
|
753
778
|
|
|
754
|
-
console.log(
|
|
779
|
+
console.log(
|
|
780
|
+
chalk.cyan(`Last ${lines} lines from ${ORCHESTRATOR_LOG_FILE}:\n`)
|
|
781
|
+
);
|
|
755
782
|
console.log(lastLines);
|
|
756
783
|
}
|
|
757
784
|
} catch (error) {
|
|
758
785
|
console.error(
|
|
759
|
-
chalk.red(error instanceof Error ? error.message : String(error))
|
|
786
|
+
chalk.red(error instanceof Error ? error.message : String(error))
|
|
760
787
|
);
|
|
761
788
|
}
|
|
762
789
|
}
|
|
@@ -17,7 +17,6 @@ import { logger } from '../utils/logger';
|
|
|
17
17
|
import type { ConfigManager } from '../utils/config-manager';
|
|
18
18
|
import type { Command } from 'commander';
|
|
19
19
|
|
|
20
|
-
|
|
21
20
|
interface OptimizationResult {
|
|
22
21
|
category: 'memory' | 'concurrency' | 'cpu' | 'io' | 'network';
|
|
23
22
|
description: string;
|
|
@@ -137,7 +136,7 @@ class MemoryOptimizer {
|
|
|
137
136
|
}
|
|
138
137
|
|
|
139
138
|
async optimizeMemoryUsage(
|
|
140
|
-
optimizations: OptimizationResult[]
|
|
139
|
+
optimizations: OptimizationResult[]
|
|
141
140
|
): Promise<void> {
|
|
142
141
|
for (const opt of optimizations.filter(o => o.automated && !o.applied)) {
|
|
143
142
|
logger.info(`Applying memory optimization: ${opt.description}`);
|
|
@@ -156,7 +155,7 @@ class MemoryOptimizer {
|
|
|
156
155
|
}
|
|
157
156
|
|
|
158
157
|
private async applyMemoryOptimization(
|
|
159
|
-
opt: OptimizationResult
|
|
158
|
+
opt: OptimizationResult
|
|
160
159
|
): Promise<void> {
|
|
161
160
|
// Force garbage collection if available
|
|
162
161
|
if (
|
|
@@ -175,7 +174,7 @@ class MemoryOptimizer {
|
|
|
175
174
|
) {
|
|
176
175
|
// 1GB
|
|
177
176
|
logger.warn(
|
|
178
|
-
'Consider increasing Node.js heap size with --max-old-space-size'
|
|
177
|
+
'Consider increasing Node.js heap size with --max-old-space-size'
|
|
179
178
|
);
|
|
180
179
|
}
|
|
181
180
|
}
|
|
@@ -251,7 +250,7 @@ class ConcurrencyOptimizer {
|
|
|
251
250
|
}
|
|
252
251
|
|
|
253
252
|
async optimizeConcurrency(
|
|
254
|
-
optimizations: OptimizationResult[]
|
|
253
|
+
optimizations: OptimizationResult[]
|
|
255
254
|
): Promise<void> {
|
|
256
255
|
for (const opt of optimizations.filter(o => o.automated && !o.applied)) {
|
|
257
256
|
logger.info(`Applying concurrency optimization: ${opt.description}`);
|
|
@@ -266,16 +265,16 @@ class ConcurrencyOptimizer {
|
|
|
266
265
|
}
|
|
267
266
|
|
|
268
267
|
private async applyConcurrencyOptimization(
|
|
269
|
-
opt: OptimizationResult
|
|
268
|
+
opt: OptimizationResult
|
|
270
269
|
): Promise<void> {
|
|
271
270
|
if (opt.metrics?.['utilization'] && opt.metrics['utilization'] < 0.7) {
|
|
272
271
|
// Increase worker thread pool for better CPU utilization
|
|
273
272
|
const newWorkerCount = Math.min(
|
|
274
273
|
this.workerThreads,
|
|
275
|
-
Math.floor(this.workerThreads * 1.2)
|
|
274
|
+
Math.floor(this.workerThreads * 1.2)
|
|
276
275
|
);
|
|
277
276
|
logger.info(
|
|
278
|
-
`Increasing worker threads from ${this.activeWorkers} to ${newWorkerCount}
|
|
277
|
+
`Increasing worker threads from ${this.activeWorkers} to ${newWorkerCount}`
|
|
279
278
|
);
|
|
280
279
|
// Implementation would update the actual worker pool
|
|
281
280
|
}
|
|
@@ -359,7 +358,7 @@ export class PerformanceOptimizerCommands {
|
|
|
359
358
|
|
|
360
359
|
constructor(
|
|
361
360
|
private program: Command,
|
|
362
|
-
private configManager: ConfigManager
|
|
361
|
+
private configManager: ConfigManager
|
|
363
362
|
) {
|
|
364
363
|
this.registerCommands();
|
|
365
364
|
}
|
|
@@ -407,7 +406,7 @@ export class PerformanceOptimizerCommands {
|
|
|
407
406
|
.description('run all optimization analyses and apply safe optimizations')
|
|
408
407
|
.option(
|
|
409
408
|
'--dry-run',
|
|
410
|
-
'show what would be optimized without applying changes'
|
|
409
|
+
'show what would be optimized without applying changes'
|
|
411
410
|
)
|
|
412
411
|
.option('--report <path>', 'generate comprehensive optimization report')
|
|
413
412
|
.action(async options => {
|
|
@@ -447,7 +446,7 @@ export class PerformanceOptimizerCommands {
|
|
|
447
446
|
}
|
|
448
447
|
|
|
449
448
|
logger.info(
|
|
450
|
-
`Found ${optimizations.length} memory optimization opportunities
|
|
449
|
+
`Found ${optimizations.length} memory optimization opportunities:`
|
|
451
450
|
);
|
|
452
451
|
optimizations.forEach(opt => {
|
|
453
452
|
const impactColor =
|
|
@@ -457,7 +456,7 @@ export class PerformanceOptimizerCommands {
|
|
|
457
456
|
? 'yellow'
|
|
458
457
|
: 'green';
|
|
459
458
|
console.log(
|
|
460
|
-
` ${chalk[impactColor](`[${opt.impact.toUpperCase()}]`)} ${opt.description}
|
|
459
|
+
` ${chalk[impactColor](`[${opt.impact.toUpperCase()}]`)} ${opt.description}`
|
|
461
460
|
);
|
|
462
461
|
});
|
|
463
462
|
|
|
@@ -472,7 +471,7 @@ export class PerformanceOptimizerCommands {
|
|
|
472
471
|
await this.generateOptimizationReport(
|
|
473
472
|
optimizations,
|
|
474
473
|
options.report,
|
|
475
|
-
'memory'
|
|
474
|
+
'memory'
|
|
476
475
|
);
|
|
477
476
|
}
|
|
478
477
|
} catch (error) {
|
|
@@ -480,7 +479,7 @@ export class PerformanceOptimizerCommands {
|
|
|
480
479
|
'WUNDR_MEMORY_OPTIMIZATION_FAILED',
|
|
481
480
|
'Failed to optimize memory usage',
|
|
482
481
|
{ options },
|
|
483
|
-
true
|
|
482
|
+
true
|
|
484
483
|
);
|
|
485
484
|
}
|
|
486
485
|
}
|
|
@@ -491,7 +490,7 @@ export class PerformanceOptimizerCommands {
|
|
|
491
490
|
|
|
492
491
|
if (options.workers) {
|
|
493
492
|
this.concurrencyOptimizer.updateActiveWorkers(
|
|
494
|
-
parseInt(options.workers)
|
|
493
|
+
parseInt(options.workers)
|
|
495
494
|
);
|
|
496
495
|
}
|
|
497
496
|
|
|
@@ -504,7 +503,7 @@ export class PerformanceOptimizerCommands {
|
|
|
504
503
|
}
|
|
505
504
|
|
|
506
505
|
logger.info(
|
|
507
|
-
`Found ${optimizations.length} concurrency optimization opportunities
|
|
506
|
+
`Found ${optimizations.length} concurrency optimization opportunities:`
|
|
508
507
|
);
|
|
509
508
|
optimizations.forEach(opt => {
|
|
510
509
|
const impactColor =
|
|
@@ -514,7 +513,7 @@ export class PerformanceOptimizerCommands {
|
|
|
514
513
|
? 'yellow'
|
|
515
514
|
: 'green';
|
|
516
515
|
console.log(
|
|
517
|
-
` ${chalk[impactColor](`[${opt.impact.toUpperCase()}]`)} ${opt.description}
|
|
516
|
+
` ${chalk[impactColor](`[${opt.impact.toUpperCase()}]`)} ${opt.description}`
|
|
518
517
|
);
|
|
519
518
|
});
|
|
520
519
|
|
|
@@ -529,7 +528,7 @@ export class PerformanceOptimizerCommands {
|
|
|
529
528
|
'WUNDR_CONCURRENCY_OPTIMIZATION_FAILED',
|
|
530
529
|
'Failed to optimize concurrency',
|
|
531
530
|
{ options },
|
|
532
|
-
true
|
|
531
|
+
true
|
|
533
532
|
);
|
|
534
533
|
}
|
|
535
534
|
}
|
|
@@ -548,7 +547,7 @@ export class PerformanceOptimizerCommands {
|
|
|
548
547
|
}
|
|
549
548
|
|
|
550
549
|
logger.info(
|
|
551
|
-
`Found ${optimizations.length} bundle optimization opportunities
|
|
550
|
+
`Found ${optimizations.length} bundle optimization opportunities:`
|
|
552
551
|
);
|
|
553
552
|
optimizations.forEach(opt => {
|
|
554
553
|
const impactColor =
|
|
@@ -558,7 +557,7 @@ export class PerformanceOptimizerCommands {
|
|
|
558
557
|
? 'yellow'
|
|
559
558
|
: 'green';
|
|
560
559
|
console.log(
|
|
561
|
-
` ${chalk[impactColor](`[${opt.impact.toUpperCase()}]`)} ${opt.description}
|
|
560
|
+
` ${chalk[impactColor](`[${opt.impact.toUpperCase()}]`)} ${opt.description}`
|
|
562
561
|
);
|
|
563
562
|
opt.recommendations.forEach(rec => console.log(` ⢠${rec}`));
|
|
564
563
|
});
|
|
@@ -567,7 +566,7 @@ export class PerformanceOptimizerCommands {
|
|
|
567
566
|
'WUNDR_BUNDLE_OPTIMIZATION_FAILED',
|
|
568
567
|
'Failed to optimize bundle',
|
|
569
568
|
{ options },
|
|
570
|
-
true
|
|
569
|
+
true
|
|
571
570
|
);
|
|
572
571
|
}
|
|
573
572
|
}
|
|
@@ -583,7 +582,7 @@ export class PerformanceOptimizerCommands {
|
|
|
583
582
|
const concurrencyOpts =
|
|
584
583
|
await this.concurrencyOptimizer.analyzeConcurrency();
|
|
585
584
|
const bundleOpts = await this.assetOptimizer.analyzeBundleSize(
|
|
586
|
-
process.cwd()
|
|
585
|
+
process.cwd()
|
|
587
586
|
);
|
|
588
587
|
|
|
589
588
|
allOptimizations.push(...memoryOpts, ...concurrencyOpts, ...bundleOpts);
|
|
@@ -598,19 +597,19 @@ export class PerformanceOptimizerCommands {
|
|
|
598
597
|
(acc, opt) => {
|
|
599
598
|
if (opt && opt.category) {
|
|
600
599
|
if (!acc[opt.category]) {
|
|
601
|
-
acc[opt.category] = [];
|
|
602
|
-
}
|
|
600
|
+
acc[opt.category] = [];
|
|
601
|
+
}
|
|
603
602
|
acc[opt.category]!.push(opt);
|
|
604
603
|
}
|
|
605
604
|
return acc;
|
|
606
605
|
},
|
|
607
|
-
{} as Record<string, OptimizationResult[]
|
|
606
|
+
{} as Record<string, OptimizationResult[]>
|
|
608
607
|
);
|
|
609
608
|
|
|
610
609
|
logger.info('\nš Optimization Summary:');
|
|
611
610
|
Object.entries(grouped).forEach(([category, opts]) => {
|
|
612
611
|
console.log(
|
|
613
|
-
` ${chalk.bold(category.toUpperCase())}: ${opts.length} opportunities
|
|
612
|
+
` ${chalk.bold(category.toUpperCase())}: ${opts.length} opportunities`
|
|
614
613
|
);
|
|
615
614
|
});
|
|
616
615
|
|
|
@@ -619,7 +618,7 @@ acc[opt.category] = [];
|
|
|
619
618
|
const automated = allOptimizations.filter(o => o.automated);
|
|
620
619
|
if (automated.length > 0) {
|
|
621
620
|
logger.info(
|
|
622
|
-
`\nš§ Applying ${automated.length} automated optimizations
|
|
621
|
+
`\nš§ Applying ${automated.length} automated optimizations...`
|
|
623
622
|
);
|
|
624
623
|
|
|
625
624
|
for (const opt of automated) {
|
|
@@ -641,7 +640,7 @@ acc[opt.category] = [];
|
|
|
641
640
|
const manual = allOptimizations.filter(o => !o.automated).length;
|
|
642
641
|
if (manual > 0) {
|
|
643
642
|
logger.info(
|
|
644
|
-
`ā¹ļø ${manual} optimizations require manual intervention
|
|
643
|
+
`ā¹ļø ${manual} optimizations require manual intervention`
|
|
645
644
|
);
|
|
646
645
|
}
|
|
647
646
|
}
|
|
@@ -650,7 +649,7 @@ acc[opt.category] = [];
|
|
|
650
649
|
await this.generateOptimizationReport(
|
|
651
650
|
allOptimizations,
|
|
652
651
|
options.report,
|
|
653
|
-
'comprehensive'
|
|
652
|
+
'comprehensive'
|
|
654
653
|
);
|
|
655
654
|
}
|
|
656
655
|
} catch (error) {
|
|
@@ -658,7 +657,7 @@ acc[opt.category] = [];
|
|
|
658
657
|
'WUNDR_COMPREHENSIVE_OPTIMIZATION_FAILED',
|
|
659
658
|
'Failed to run comprehensive optimization',
|
|
660
659
|
{ options },
|
|
661
|
-
true
|
|
660
|
+
true
|
|
662
661
|
);
|
|
663
662
|
}
|
|
664
663
|
}
|
|
@@ -669,7 +668,7 @@ acc[opt.category] = [];
|
|
|
669
668
|
const startTime = Date.now();
|
|
670
669
|
|
|
671
670
|
logger.info(
|
|
672
|
-
`š Starting performance monitoring for ${options.duration} seconds
|
|
671
|
+
`š Starting performance monitoring for ${options.duration} seconds...`
|
|
673
672
|
);
|
|
674
673
|
|
|
675
674
|
const metrics: SystemMetrics[] = [];
|
|
@@ -706,7 +705,7 @@ acc[opt.category] = [];
|
|
|
706
705
|
const heapMB = (memory.heapUsed / 1024 / 1024).toFixed(2);
|
|
707
706
|
const rssMB = (memory.rss / 1024 / 1024).toFixed(2);
|
|
708
707
|
process.stdout.write(
|
|
709
|
-
`\rš¾ Heap: ${heapMB}MB | RSS: ${rssMB}MB | CPU: ${cpu.user}μs
|
|
708
|
+
`\rš¾ Heap: ${heapMB}MB | RSS: ${rssMB}MB | CPU: ${cpu.user}μs`
|
|
710
709
|
);
|
|
711
710
|
}, interval);
|
|
712
711
|
|
|
@@ -792,7 +791,7 @@ acc[opt.category] = [];
|
|
|
792
791
|
'WUNDR_BENCHMARK_FAILED',
|
|
793
792
|
'Failed to run performance benchmarks',
|
|
794
793
|
{ options },
|
|
795
|
-
true
|
|
794
|
+
true
|
|
796
795
|
);
|
|
797
796
|
}
|
|
798
797
|
}
|
|
@@ -819,7 +818,7 @@ acc[opt.category] = [];
|
|
|
819
818
|
// Simulate concurrent task processing
|
|
820
819
|
const tasks = Array.from(
|
|
821
820
|
{ length: 100 },
|
|
822
|
-
(_, i) => new Promise(resolve => setTimeout(resolve, Math.random() * 10))
|
|
821
|
+
(_, i) => new Promise(resolve => setTimeout(resolve, Math.random() * 10))
|
|
823
822
|
);
|
|
824
823
|
await Promise.all(tasks);
|
|
825
824
|
}
|
|
@@ -839,7 +838,7 @@ acc[opt.category] = [];
|
|
|
839
838
|
private async generateOptimizationReport(
|
|
840
839
|
optimizations: OptimizationResult[],
|
|
841
840
|
reportPath: string,
|
|
842
|
-
type: string
|
|
841
|
+
type: string
|
|
843
842
|
): Promise<void> {
|
|
844
843
|
const report = {
|
|
845
844
|
timestamp: new Date().toISOString(),
|