#!/usr/bin/env bash # # Fast gate for manual pushes and the auto-deploy timer: # typecheck (app + servers) → lint → i18n → unit tests. Does NOT build; the # deploy script builds and boots the bundle afterwards. # # Run manually: scripts/preflight.sh # Bypass once: SKIP_PREFLIGHT=1 git push (or git push --no-verify) set -euo pipefail REPO="$(cd "$(dirname "$0")/.." && pwd)" cd "$REPO" if [ -d "$HOME/.nvm/versions/node" ]; then NODE_BIN="$(ls -d "$HOME"/.nvm/versions/node/*/bin 2>/dev/null | sort -V | tail -1)" [ -n "$NODE_BIN" ] && export PATH="$NODE_BIN:$PATH" fi export PATH="$HOME/go/bin:$PATH" [ -d node_modules ] || { echo "preflight: node_modules missing — run npm ci" >&2; exit 1; } echo "preflight: typecheck" npx tsc --noEmit npx tsc -p cvm-server/tsconfig.json npx tsc -p ai-proxy/tsconfig.json npx tsc -p push-service/tsconfig.json echo "preflight: lint" npx eslint echo "preflight: i18n" node scripts/check-i18n.mjs echo "preflight: unit tests" npx vitest run --reporter=dot --silent echo "preflight: OK"