import { printJsonResults, printResults } from "./format.js";
import { checkNodeVersion } from "./checks/node-version.js";
import { checkConfigHealth } from "./checks/config-health.js";
import { checkStateIntegrity } from "./checks/state-integrity.js";
import { checkProviderAuth } from "./checks/provider-auth.js";
import { checkChannelConfig } from "./checks/channel-config.js";
import { checkChannelPairingPending } from "./checks/channel-pairing-pending.js";
import { checkGatewayHealth } from "./checks/gateway-health.js";
import { checkSessionIntegrity } from "./checks/session-integrity.js";
import { checkGatewayService } from "./checks/gateway-service.js";
import { checkSecurityAudit } from "./checks/security-audit.js";
import { checkWorkspaceStatus } from "./checks/workspace-status.js";
import { checkCronHealth } from "./checks/cron-health.js";
import { checkVersionUpdate } from "./checks/version-check.js";
import { checkChannelPlugins } from "./checks/channel-plugins.js";
//#region src/cli/commands/doctor/flow.ts
const DOCTOR_CHECKS = [
	checkVersionUpdate,
	checkNodeVersion,
	checkConfigHealth,
	checkStateIntegrity,
	checkProviderAuth,
	checkChannelConfig,
	checkChannelPairingPending,
	checkSecurityAudit,
	checkWorkspaceStatus,
	checkGatewayService,
	checkGatewayHealth,
	checkCronHealth,
	checkSessionIntegrity
];
/**
* Headless data collection — used by both CLI and gateway API.
*/
async function collectDoctorResults(ctx) {
	if (ctx.options.security) return [await checkSecurityAudit(ctx)];
	const results = [];
	for (const check of DOCTOR_CHECKS) results.push(await check(ctx));
	results.push(...await checkChannelPlugins(ctx));
	return results;
}
/**
* CLI entry point — collect and print.
*/
async function runDoctor(ctx) {
	const results = await collectDoctorResults(ctx);
	if (ctx.options.json) printJsonResults(results);
	else printResults(results, { security: ctx.options.security });
	return results;
}
//#endregion
export { collectDoctorResults, runDoctor };

//# sourceMappingURL=flow.js.map