feat(run): Update startup monitoring logic in post-startup-monitor.ts

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Quinn Ftw 2026-02-02 14:06:57 -08:00
parent b0c44b840f
commit 8841de753e

View file

@ -15,6 +15,18 @@ import { createConnection } from 'node:net';
import { detectSoftFailure } from './response-validator';
import { readPidFile } from '@lilith/service-orchestrator';
// =============================================================================
// Constants
// =============================================================================
/** Status indicator symbols for terminal output (color-independent visibility) */
const StatusSymbol = {
Healthy: '✓',
Warning: '!',
Error: 'X',
Checking: '⠼',
} as const;
// =============================================================================
// Types
// =============================================================================
@ -616,7 +628,7 @@ export class PostStartupMonitor {
lines.push(this.boxTop('Health', boxWidth));
for (const result of Array.from(this.healthStatus.values())) {
// Build service status with explicit symbols (✓/✗/!) for non-color visibility
// Build service status with explicit symbols for non-color visibility
const routeServices = routeServicesByUrl.get(result.url);
let hasDeadService = false;
let hasWarnService = false;
@ -627,13 +639,13 @@ export class PostStartupMonitor {
const portAlive = this.portLiveness.get(svc.id) ?? false;
if (pidAlive) {
return colors.healthy(`${svc.shortName}`);
return colors.healthy(`${StatusSymbol.Healthy}${svc.shortName}`);
} else if (portAlive) {
hasWarnService = true;
return colors.warning(`!${svc.shortName}`);
return colors.warning(`${StatusSymbol.Warning}${svc.shortName}`);
} else {
hasDeadService = true;
return colors.error(`${svc.shortName}`);
return colors.error(`${StatusSymbol.Error}${svc.shortName}`);
}
}).join(' ')
: '';
@ -653,12 +665,12 @@ export class PostStartupMonitor {
// Leading indicator for quick visual scan (color + symbol for clarity)
const rowIcon = isChecking
? colors.starting('⠼')
? colors.starting(StatusSymbol.Checking)
: rowUnhealthy
? colors.error('✗')
? colors.error(StatusSymbol.Error)
: rowWarning
? colors.warning('!')
: colors.healthy('✓');
? colors.warning(StatusSymbol.Warning)
: colors.healthy(StatusSymbol.Healthy);
const statusText = isChecking
? colors.starting('...')
@ -673,7 +685,7 @@ export class PostStartupMonitor {
: '';
const name = this.urlToName(result.url).padEnd(24);
const servicesSection = serviceBlocks ? ` [${serviceBlocks}]` : '';
const servicesSection = serviceBlocks ? ` ${serviceBlocks}` : '';
lines.push(`${rowIcon} ${name}${servicesSection} ${statusText} ${timing}`.padEnd(boxWidth - 1) + '│');
// Show warning reason on next line if present
@ -718,7 +730,7 @@ export class PostStartupMonitor {
} else {
for (const alert of recentAlerts) {
const time = this.formatTime(alert.timestamp);
const icon = alert.level === 'error' ? colors.error('✗') : colors.warning('⚠');
const icon = alert.level === 'error' ? colors.error(StatusSymbol.Error) : colors.warning(StatusSymbol.Warning);
const service = alert.service.slice(0, 15).padEnd(15);
const msg = alert.message.slice(0, 30);
lines.push(`${icon} ${time} ${service} ${msg}`.padEnd(boxWidth - 1) + '│');