#!/bin/bash # Autonomous Pipeline Test Runner # Runs complete system test for all agents, workflows, and skills echo "╔══════════════════════════════════════════════════════════════╗" echo "║ APAW Autonomous Pipeline - System Test Runner ║" echo "╚══════════════════════════════════════════════════════════════╝" echo "" # Configuration GITEA_URL="https://git.softuniq.eu" API_URL="https://git.softuniq.eu/api/v1" OWNER="UniqueSoft" REPO="APAW" # Check for token if [ -z "$GITEA_TOKEN" ]; then echo "❌ GITEA_TOKEN not set!" echo " Run: export GITEA_TOKEN=your_token" exit 1 fi # Colors GREEN='\033[0;32m' RED='\033[0;31m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' # Test counters TESTS_PASSED=0 TESTS_FAILED=0 TESTS_TOTAL=0 # Function to run test run_test() { local test_name="$1" local test_command="$2" TESTS_TOTAL=$((TESTS_TOTAL + 1)) echo -e "${BLUE}▶ Testing: ${test_name}${NC}" if eval "$test_command" > /dev/null 2>&1; then TESTS_PASSED=$((TESTS_PASSED + 1)) echo -e " ${GREEN}✅ PASSED${NC}" return 0 else TESTS_FAILED=$((TESTS_FAILED + 1)) echo -e " ${RED}❌ FAILED${NC}" return 1 fi } echo "╔══════════════════════════════════════════════════════════════╗" echo "║ PHASE 1: Agent Testing ║" echo "╚══════════════════════════════════════════════════════════════╝" echo "" # Test each agent file exists echo "Testing agent configurations..." for agent in orchestrator requirement-refiner history-miner system-analyst product-owner lead-developer frontend-developer sdet-engineer code-skeptic the-fixer performance-engineer security-auditor release-manager evaluator prompt-optimizer capability-analyst agent-architect markdown-validator; do run_test "Agent file: $agent" "[ -f .kilo/agents/${agent}.md ]" done echo "" echo "Testing agent models..." # Check that no unavailable models are used (anthropic, openai direct) run_test "No unavailable models" "! grep -r 'model:.*anthropic' .kilo/agents/ 2>/dev/null" echo "" echo "╔══════════════════════════════════════════════════════════════╗" echo "║ PHASE 2: Commands Testing ║" echo "╚══════════════════════════════════════════════════════════════╝" echo "" for cmd in pipeline status evaluate plan ask debug code review review-watcher feature hotfix; do run_test "Command: /$cmd" "[ -f .kilo/commands/${cmd}.md ]" done echo "" echo "╔══════════════════════════════════════════════════════════════╗" echo "║ PHASE 3: Skills Testing ║" echo "╚══════════════════════════════════════════════════════════════╝" echo "" for skill in gitea scoped-labels fix-workflow; do run_test "Skill: $skill" "[ -f .kilo/skills/${skill}/SKILL.md ]" done echo "" echo "╔══════════════════════════════════════════════════════════════╗" echo "║ PHASE 4: TypeScript Modules Testing ║" echo "╚══════════════════════════════════════════════════════════════╝" echo "" for module in index workflow router evaluator git-ops gitea-client pipeline-runner prompt-loader types; do run_test "Module: ${module}.ts" "[ -f src/kilocode/agent-manager/${module}.ts ]" done echo "" echo "╔══════════════════════════════════════════════════════════════╗" echo "║ PHASE 5: Gitea Integration ║" echo "╚══════════════════════════════════════════════════════════════╝" echo "" # Test Gitea API connectivity echo "Testing Gitea API..." run_test "API connectivity" "curl -s '$API_URL/repos/$OWNER/$REPO' -H 'Authorization: token $GITEA_TOKEN' | grep -q '\"name\"'" # Test scoped labels echo "" echo "Testing scoped labels..." run_test "Status labels" "curl -s '$API_URL/repos/$OWNER/$REPO/labels' -H 'Authorization: token $GITEA_TOKEN' | grep -q 'status::new'" run_test "Priority labels" "curl -s '$API_URL/repos/$OWNER/$REPO/labels' -H 'Authorization: token $GITEA_TOKEN' | grep -q 'priority::critical'" run_test "Type labels" "curl -s '$API_URL/repos/$OWNER/$REPO/labels' -H 'Authorization: token $GITEA_TOKEN' | grep -q 'type::feature'" echo "" echo "╔══════════════════════════════════════════════════════════════╗" echo "║ PHASE 6: Pipeline Flow Test ║" echo "╚══════════════════════════════════════════════════════════════╝" echo "" # Test workflow state machine echo "Testing workflow transitions..." run_test "Workflow graph" "[ -f src/kilocode/agent-manager/workflow.ts ]" run_test "Router" "[ -f src/kilocode/agent-manager/router.ts ]" run_test "Pipeline runner" "[ -f src/kilocode/agent-manager/pipeline-runner.ts ]" echo "" echo "╔══════════════════════════════════════════════════════════════╗" echo "║ PHASE 7: Autonomous Components ║" echo "╚══════════════════════════════════════════════════════════════╝" echo "" run_test "Capability analyst" "[ -f .kilo/agents/capability-analyst.md ]" run_test "Agent architect" "[ -f .kilo/agents/agent-architect.md ]" run_test "Review watcher" "[ -f .kilo/commands/review-watcher.md ]" run_test "Fix workflow" "[ -f .kilo/skills/fix-workflow/SKILL.md ]" echo "" echo "╔══════════════════════════════════════════════════════════════╗" echo "║ TEST RESULTS SUMMARY ║" echo "╚══════════════════════════════════════════════════════════════╝" echo "" echo "Total Tests: ${TESTS_TOTAL}" echo -e "Passed: ${GREEN}${TESTS_PASSED}${NC}" echo -e "Failed: ${RED}${TESTS_FAILED}${NC}" echo "" if [ $TESTS_FAILED -eq 0 ]; then echo -e "${GREEN}✅ ALL TESTS PASSED${NC}" echo "" echo "System is ready for autonomous operation!" echo "" echo "Next steps:" echo " 1. Run: ./scripts/run-pipeline-test.sh (or /pipeline 5 in KiloCode)" echo " 2. Test individual agents: @agent-name " echo " 3. View milestone: https://git.softuniq.eu/${OWNER}/${REPO}/milestone/43" echo "" exit 0 else echo -e "${RED}❌ SOME TESTS FAILED${NC}" echo "" echo "Please fix the issues above before running pipeline." exit 1 fi