test-bootstrap-caching.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env bash
  2. # Test: Bootstrap Content Caching (#1202)
  3. # Verifies the OpenCode transform caches bootstrap content between agent steps.
  4. set -euo pipefail
  5. SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
  6. echo "=== Test: Bootstrap Content Caching (#1202) ==="
  7. source "$SCRIPT_DIR/setup.sh"
  8. trap cleanup_test_env EXIT
  9. run_present_file_check() {
  10. node "$SCRIPT_DIR/test-bootstrap-caching.mjs" "$SUPERPOWERS_PLUGIN_FILE" present
  11. }
  12. run_missing_file_check() {
  13. mv "$SUPERPOWERS_SKILLS_DIR/using-superpowers/SKILL.md" "$TEST_HOME/using-superpowers.SKILL.md.bak"
  14. node "$SCRIPT_DIR/test-bootstrap-caching.mjs" "$SUPERPOWERS_PLUGIN_FILE" missing
  15. }
  16. echo "Test 1: Caches bootstrap after the first successful transform..."
  17. run_present_file_check
  18. echo " [PASS] Bootstrap content is cached while fresh message arrays still receive injection"
  19. echo "Test 2: Caches missing SKILL.md result..."
  20. run_missing_file_check
  21. echo " [PASS] Missing bootstrap file is cached and not re-probed every transform"
  22. echo ""
  23. echo "=== All bootstrap caching tests passed ==="