"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValidateWatchCommand = void 0;
const commander_1 = require("commander");
const chalk_1 = __importDefault(require("chalk"));
const ValidationDaemon_1 = require("../services/ValidationDaemon");
exports.ValidateWatchCommand = new commander_1.Command("validate:watch")
    .description("Run doctor validation in continuous watch mode")
    .argument("[directory]", "target directory", ".")
    .option("--interval <ms>", "polling interval in milliseconds", "5000")
    .action(async (directory, options) => {
    const interval = parseInt(options.interval, 10);
    if (isNaN(interval) || interval < 1000) {
        console.error(chalk_1.default.red("  Interval must be at least 1000ms"));
        process.exit(1);
    }
    const daemon = new ValidationDaemon_1.ValidationDaemon({
        interval,
    });
    process.on("SIGINT", () => {
        daemon.stop();
        process.exit(0);
    });
    process.on("SIGTERM", () => {
        daemon.stop();
        process.exit(0);
    });
    await daemon.start(directory);
});
//# sourceMappingURL=validate-watch.js.map