feat(ops): add setup operator pack, heartbeat alert cooldown, and doctor strict mode

This commit is contained in:
William Valentin
2026-02-16 14:57:56 -08:00
parent 030fb13a26
commit 3210e75c94
12 changed files with 274 additions and 17 deletions
+18 -2
View File
@@ -632,12 +632,25 @@ export async function runChecks(ctx: DoctorContext): Promise<CheckResult[]> {
return results;
}
export function computeDoctorExitCode(results: CheckResult[], strict: boolean): number {
const failCount = results.filter((r) => r.status === 'fail').length;
const warnCount = results.filter((r) => r.status === 'warn').length;
if (failCount > 0) {
return 1;
}
if (strict && warnCount > 0) {
return 1;
}
return 0;
}
export function registerDoctorCommand(program: Command): void {
program
.command('doctor')
.description('Validate configuration and check system health')
.option('-c, --config <path>', 'Config file path')
.action(async (opts: { config?: string }) => {
.option('--strict', 'Treat warnings as failures')
.action(async (opts: { config?: string; strict?: boolean }) => {
const configPath = opts.config ?? getConfigPath();
const dataDir = getDataDir();
@@ -662,7 +675,10 @@ export function registerDoctorCommand(program: Command): void {
};
console.log(`Results: ${counts.pass} passed, ${counts.fail} failed, ${counts.warn} warnings, ${counts.skip} skipped`);
if (opts.strict && counts.warn > 0) {
console.log('Strict mode enabled: warnings are treated as failures.');
}
process.exit(counts.fail > 0 ? 1 : 0);
process.exit(computeDoctorExitCode(results, Boolean(opts.strict)));
});
}