import path from "node:path";
import { auditEnvironment, renderDiscoveryMarkdown } from "@shrey-junior/sj-core/core/discovery.js";
import { writeText } from "@shrey-junior/sj-core/utils/fs.js";
export async function runAudit(options) {
    const report = await auditEnvironment(options.targetRoot);
    const reportPath = options.reportPath ?? path.join(options.targetRoot, "docs", "shrey-junior-discovery-report.md");
    await writeText(reportPath, renderDiscoveryMarkdown(report));
    options.logger.info(`wrote sanitized discovery report to ${reportPath}`);
    return 0;
}
