let d = import "../defaults.ncl" in

d.make_mode String {
  id      = "validate-adrs",
  trigger = "Run all typed constraint checks from accepted ADRs and report compliance. Fails on any Hard constraint violation.",

  preconditions = [
    "ONTOREF_PROJECT_ROOT is set and points to a project with adrs/ directory",
    "Nushell >= 0.111.0 is available on PATH",
    "nickel binary is available on PATH",
    "rg (ripgrep) is available on PATH for Grep-type checks",
  ],

  steps = [
    {
      id     = "run-checks",
      action = "Load all accepted ADRs, dispatch each typed constraint check (Grep, Cargo, NuCmd, ApiCall, FileExists), and print a structured pass/fail report.",
      cmd    = "nu --no-config-file -c 'use reflection/modules/validate.nu *; validate check-all'",
      actor  = 'Both,
      on_error = { strategy = 'Stop },
    },
  ],

  postconditions = [
    "All Hard constraints from accepted ADRs exit with passed = true",
    "No constraint is missing the typed 'check' field",
  ],
}
