#!/usr/bin/env bash # ═══════════════════════════════════════════════════════════════ # purpose-agent v3.0.0 — Local Test Runner (including cloud model) # # Run on your own machine (no HF credits needed): # git clone https://huggingface.co/Rohan03/purpose-agent pa && cd pa # pip install -e . # export OPENROUTER_API_KEY="sk-or-v1-..." # bash local_test_with_api.sh # ═══════════════════════════════════════════════════════════════ set -e PASS=0; FAIL=0; TOTAL=0 run_test() { local name="$1"; local cmd="$2" echo "" echo "══════════════════════════════════════════════════════════" echo " Running: $name" echo "══════════════════════════════════════════════════════════" if eval "$cmd"; then echo " ✅ $name PASSED"; PASS=$((PASS+1)) else echo " ❌ $name FAILED"; FAIL=$((FAIL+1)) fi TOTAL=$((TOTAL+1)) } echo "╔══════════════════════════════════════════════════════════╗" echo "║ purpose-agent v3.0.0 — Full Test Suite (Local + Cloud)║" echo "╚══════════════════════════════════════════════════════════╝" # Pre-flight echo "═══ Pre-flight ═══" python -c " import purpose_agent as pa print(f' v{pa.__version__} — {len(pa.__all__)} exports') assert pa.__version__ == '3.0.0', f'Version: {pa.__version__}' assert len(pa.__all__) >= 110, f'Exports: {len(pa.__all__)}' missing = [n for n in pa.__all__ if not hasattr(pa, n)] assert not missing, f'Missing: {missing}' print(' ✅ All exports importable') " # Apply fixes echo "" echo "═══ Applying test fixes ═══" python apply_fixes.py # Layer 1: Unit Tests run_test "test_core" "python tests/test_core.py" run_test "test_public_api_211" "python tests/compat/test_public_api_211.py" run_test "test_first_principles" "python tests/test_first_principles.py" run_test "test_hardening" "python tests/test_hardening.py" run_test "test_sre_regression" "python tests/test_sre_regression.py" # Layer 2: Feature Tests run_test "test_sprint1_events" "python tests/test_sprint1_events.py" run_test "test_sprint2_checkpoint" "python tests/test_sprint2_checkpoint.py" run_test "test_sprint3_homeostasis" "python tests/test_sprint3_homeostasis.py" run_test "test_sprint4_8_protocols" "python tests/test_sprint4_8_protocols.py" run_test "test_track_c" "python tests/test_track_c.py" run_test "test_track_d" "python tests/test_track_d.py" # Layer 3: Integration run_test "validate_quick" "python benchmarks/validate.py --quick" run_test "benchmark_v3" "python -m purpose_agent.benchmark_v3" # Layer 4: Cloud Model Tests if [ -n "$OPENROUTER_API_KEY" ]; then run_test "prod_test (real model)" "python tests/prod_test.py" else echo " ⚠️ OPENROUTER_API_KEY not set — skipping cloud tests" fi # Report echo "" echo "╔══════════════════════════════════════════════════════════╗" echo "║ RESULTS: $PASS/$TOTAL passed, $FAIL failed" if [ $FAIL -eq 0 ]; then echo "║ ✅ ALL TESTS PASSED — READY TO PUBLISH" echo "║ Next: python build_and_publish.py" else echo "║ ❌ $FAIL FAILURES — FIX BEFORE PUBLISHING" fi echo "╚══════════════════════════════════════════════════════════╝" exit $FAIL