summaryrefslogtreecommitdiffhomepage
path: root/tools/check-types.sh
blob: 907616c81a6ff9b9fc8e17b92764b7a86c23d5e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env bash
# Type-check gate for raylib-jamstack: RBS signature consistency + Steep type check.
#
#   rbs validate  — sig/*.rbs are internally consistent (catches duplicate
#                   methods, bad types, broken aliases). HARD FAIL.
#   steep check   — the Steep project loads cleanly + no :error-level issues.
#
# Under the Steepfile's `D::Ruby.lenient` config, game-code type typos are
# :information — visible in the editor (live LSP) and via
# `steep check --severity-level=information`, but NOT a CI failure here. So this
# gate fails only on real signature/structural breakage and is GREEN on correct
# code. (Editor = live type guidance; this script = sig/structural integrity.)
#
# Self-contained: sets the gem env (rbs + steep live in the user gem dir, like
# opencode.json's ruby-lsp/steep env). Run from the repo root.
set -euo pipefail

GEM_BIN="${GEM_BIN:-$HOME/.local/share/gem/ruby/3.4.0/bin}"
export PATH="$GEM_BIN:$PATH"
command -v rbs   >/dev/null 2>&1 || { echo "rbs not found — install: gem install rbs" >&2; exit 1; }
command -v steep >/dev/null 2>&1 || { echo "steep not found — install: gem install steep" >&2; exit 1; }

echo "== rbs validate =="
rbs validate
echo "== steep check =="
steep check
echo "OK: signatures valid + steep project loads clean."