#!/bin/bash # Advanced test runner with multi-agent support # Usage: ./scripts/test.sh [agent] [model] [options] set -e # Colors GREEN='\033[0;32m' BLUE='\033[0;34m' YELLOW='\033[1;33m' RED='\033[0;31m' NC='\033[0m' # No Color # Defaults AGENT=${1:-all} MODEL=${2:-opencode/grok-code-fast} shift 2 2>/dev/null || true EXTRA_ARGS="$@" echo -e "${BLUE}🧪 OpenCode Agents Test Runner${NC}" echo -e "${BLUE}================================${NC}" echo "" echo -e "Agent: ${GREEN}${AGENT}${NC}" echo -e "Model: ${GREEN}${MODEL}${NC}" if [ -n "$EXTRA_ARGS" ]; then echo -e "Extra: ${YELLOW}${EXTRA_ARGS}${NC}" fi echo "" # Navigate to framework directory cd "$(dirname "$0")/../evals/framework" || exit 1 # Check if dependencies are installed if [ ! -d "node_modules" ]; then echo -e "${YELLOW}⚠️ Dependencies not installed. Running npm install...${NC}" npm install echo "" fi # Run tests if [ "$AGENT" = "all" ]; then echo -e "${YELLOW}Running tests for ALL agents...${NC}" npm run eval:sdk -- --model="$MODEL" $EXTRA_ARGS else echo -e "${YELLOW}Running tests for ${AGENT}...${NC}" npm run eval:sdk -- --agent="$AGENT" --model="$MODEL" $EXTRA_ARGS fi EXIT_CODE=$? echo "" if [ $EXIT_CODE -eq 0 ]; then echo -e "${GREEN}✅ Tests complete!${NC}" else echo -e "${RED}❌ Tests failed with exit code ${EXIT_CODE}${NC}" fi echo -e "${BLUE}View results: npm run dashboard${NC}" echo "" exit $EXIT_CODE