import { driftDetectionGate } from "./drift-detection-gate.js";
import { iterCompletionReconcilerGate } from "../sf-db/iteration-completion-reconciler.js";
import { getGateRegistry } from "./gate-registry.js";
// R081 detector gates — all 6 retrofitted from the detector function exports.
// Wired here so they are routed through UokGateRegistry rather than imported
// as bare functions by auto/loop.js + uok/auto-runaway-guard.js (the latter
// still uses bare-function imports during the R081→R119 wiring transition).
import { sameUnitLoopGate } from "../detectors/same-unit-loop.js";
import { zeroProgressGate } from "../detectors/zero-progress.js";
import { repeatedFeedbackKindGate } from "../detectors/repeated-feedback-kind.js";
import { artifactFlapGate } from "../detectors/artifact-flap.js";
import { staleLockGate } from "../detectors/stale-lock.js";
import { periodicDetectorSweepGate } from "../detectors/periodic-runner.js";

/**
 * gate-registry-bootstrap.js — register ADR-0075 UOK gates that are liftable.
 *
 * Purpose: centralize process-wide gate registration without changing existing
 * inline call sites while ADR-0075 migration proceeds.
 *
 * Consumer: future UOK call sites that import the bootstrap before running a
 * gate through UokGateRegistry.
 */
const registry = getGateRegistry();

// SKIP unit-verification-gate: execute() closes over deps, s, ctx, pi, and pauseAuto from auto/phases-finalize.js.
// SKIP milestone-validation-post-check: execute() closes over persistGate arguments from runValidateMilestonePostCheck.
// SKIP verification-gate: execute() closes over the local verification result and helper formatting state from uok/auto-verification.js.
// SKIP post-execution-checks: execute() closes over postExecResult, strict-mode prefs, and derived blocking state from uok/auto-verification.js.
// milestone-validation-gates: lifted to module scope in tools/validate-milestone.js (R079 pilot).
//   Registered lazily at call site via registry.has() guard; ctxFactory pattern supplies verdict/rationale/remediationPlan.
// SKIP planning-flow-gate: execute() closes over persistGate arguments from guided-flow.js.
registry.register(driftDetectionGate);
registry.register(iterCompletionReconcilerGate);
// R081 detector gates — 6 total. All ctx-driven (no host-file closure), so
// they register cleanly. Closes the gap reported by sf-mp9udspu-fsf7si
// ("UOK gate bootstrap registers only 2 of 6+ detector gates").
registry.register(sameUnitLoopGate);
registry.register(zeroProgressGate);
registry.register(repeatedFeedbackKindGate);
registry.register(artifactFlapGate);
registry.register(staleLockGate);
registry.register(periodicDetectorSweepGate);

export { registry as gateRegistry };
