#!/usr/bin/env sh # 🤖 ops validate — run every check this repo can run locally, in one command. # # ./deploy/ops validate # everything (what to run before opening a PR) # ./deploy/ops validate go # Go build + vet + tests # ./deploy/ops validate web # node --check on the ES modules + npm test # ./deploy/ops validate shell # sh -n (+ shellcheck if present) on deploy/ # ./deploy/ops validate infra # tofu fmt + validate on the dev-mesh stack # # Why this is a verb: the checks are spread across four toolchains, and every # one of them is easy to forget — the shell scripts and the tofu stack in # particular have no test suite and are only ever caught by running these by # hand. A contributor (human or agent) should not have to reconstruct the list # from CLAUDE.md; ops is where operational knowledge lives, and "what do I run # before pushing" is exactly that. # # Non-goals: this never touches a box, a credential, or the network beyond what # `go test` and `npm test` already do (both are hermetic — httptest servers and # Node's test runner). It is safe to run at any time, on any branch. # # Exit status is the number of FAILED sections (0 = all good), and every section # runs even when an earlier one fails — one pass tells you everything that is # broken, rather than making you re-run after each fix. set -eu here="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)" root="$(CDPATH= cd -- "$here/.." && pwd)" cd "$root" bold=''; red=''; green=''; yellow=''; off='' if [ -t 1 ]; then bold=$(printf '\033[1m'); red=$(printf '\033[31m'); green=$(printf '\033[32m') yellow=$(printf '\033[33m'); off=$(printf '\033[0m') fi failed=0 skipped=0 section() { printf '\n%s%s%s\n' "$bold" "$1" "$off"; } ok() { printf ' %sok%s %s\n' "$green" "$off" "$1"; } skip() { printf ' %sskip%s %s\n' "$yellow" "$off" "$1"; skipped=$((skipped + 1)); } bad() { printf ' %sFAIL%s %s\n' "$red" "$off" "$1"; failed=$((failed + 1)); } # run