hyf

Context-aware query service for Radroots
git clone https://radroots.dev/git/hyf.git
Log | Files | Refs | README | LICENSE

commit 3ef15f9f61cb6b9881e54ab0f79addb44449bb01
parent 4067db2b4bd6393a06650b130f5b7abb3c37801f
Author: triesap <tyson@radroots.org>
Date:   Mon, 21 Sep 2026 03:46:30 +0000

spec: add format and static-check discovery

Diffstat:
Mpixi.toml | 1+
Atools/check_format.sh | 37+++++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/pixi.toml b/pixi.toml @@ -26,6 +26,7 @@ test-stdio = "mojo -I src tests/test_stdio_contract.mojo" test-provider-adapter = "mojo -I src -I tests tests/test_provider_adapter.mojo" test-spec = "mojo -I src -I tests tests/test_traceability.mojo" check-build = "mkdir -p .pixi/build && mojo build -I src src/main.mojo -o .pixi/build/hyfd" +check-format = "sh tools/check_format.sh" smoke-max-local = "mojo -I src -I tests tests/max_local_operator_smoke.mojo" test-runtime-contract = { depends-on = [ "test-runtime", diff --git a/tools/check_format.sh b/tools/check_format.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env sh +# Check-only Mojo formatting verification. +# +# The pinned toolchain has `mojo format` but no `--check` mode, and it rewrites +# files in place. This wrapper formats a temporary copy and diffs it against the +# originals, so the working tree is never modified. Exit non-zero if any target +# file is not already formatted. +# +# Usage: sh tools/check_format.sh [path ...] (default: src tests) +set -eu + +tmp="$(mktemp -d)" +trap 'rm -rf "$tmp"' EXIT + +status=0 + +check() { + src="$1" + dst="$tmp/$(printf '%s' "$src" | tr '/' '_')" + cp -R "$src" "$dst" + mojo format -q "$dst" >/dev/null 2>&1 || true + if ! diff -r "$src" "$dst" >/dev/null 2>&1; then + echo "unformatted: $src" + status=1 + fi +} + +if [ "$#" -eq 0 ]; then + check src + check tests +else + for path in "$@"; do + check "$path" + done +fi + +exit "$status"