test-validator.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/bash
  2. # Test script for Agent Validator Plugin
  3. # Tests basic plugin functionality and validation tools
  4. echo "🧪 Testing Agent Validator Plugin"
  5. echo "=================================="
  6. echo ""
  7. # Test 1: Simple task with approval gate
  8. echo "📝 Test 1: Simple task (should request approval)"
  9. echo "Running: 'List files in current directory'"
  10. echo ""
  11. opencode run "List the files in the current directory" --format json > /tmp/test1-output.json 2>&1
  12. echo "✅ Test 1 complete"
  13. echo ""
  14. # Test 2: Validate the session
  15. echo "📊 Test 2: Validate session behavior"
  16. echo "Running: validate_session"
  17. echo ""
  18. opencode run "validate_session" --format json > /tmp/test2-output.json 2>&1
  19. echo "✅ Test 2 complete"
  20. echo ""
  21. # Test 3: Check approval gates
  22. echo "🔒 Test 3: Check approval gates"
  23. echo "Running: check_approval_gates"
  24. echo ""
  25. opencode run "check_approval_gates" --format json > /tmp/test3-output.json 2>&1
  26. echo "✅ Test 3 complete"
  27. echo ""
  28. # Display results
  29. echo "=================================="
  30. echo "📋 Test Results"
  31. echo "=================================="
  32. echo ""
  33. echo "Test 1 Output (last 20 lines):"
  34. echo "---"
  35. tail -20 /tmp/test1-output.json
  36. echo ""
  37. echo "Test 2 Output (validation report):"
  38. echo "---"
  39. tail -30 /tmp/test2-output.json
  40. echo ""
  41. echo "Test 3 Output (approval gates):"
  42. echo "---"
  43. tail -20 /tmp/test3-output.json
  44. echo ""
  45. echo "=================================="
  46. echo "✅ All tests complete!"
  47. echo ""
  48. echo "Full outputs saved to:"
  49. echo " - /tmp/test1-output.json"
  50. echo " - /tmp/test2-output.json"
  51. echo " - /tmp/test3-output.json"