#!/usr/bin/env bash
set -euo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

echo "checking binaries"
command -v pi >/dev/null 2>&1
command -v bun >/dev/null 2>&1
command -v python3 >/dev/null 2>&1

echo "versions"
pi --version || true
bun --version
python3 --version

echo "typecheck"
cd "$ROOT"
bun run typecheck

echo "tool helps"
"$ROOT/bin/task-init" --help >/dev/null
"$ROOT/bin/task-phase-init" --help >/dev/null
"$ROOT/bin/task-phase-run" --help >/dev/null
"$ROOT/bin/task-phase-loop" --help >/dev/null
"$ROOT/bin/tool-usage-report" >/dev/null || true

echo "agents-database status"
curl -fsSL http://100.116.176.16:8091/api/status >/dev/null

echo "validation ok"
