hitl-loop.template.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/env bash
  2. # Human-in-the-loop reproduction loop.
  3. # Copy this file, edit the steps below, and run it.
  4. # The agent runs the script; the user follows prompts in their terminal.
  5. #
  6. # Usage:
  7. # bash hitl-loop.template.sh
  8. #
  9. # Two helpers:
  10. # step "<instruction>" → show instruction, wait for Enter
  11. # capture VAR "<question>" → show question, read response into VAR
  12. #
  13. # At the end, captured values are printed as KEY=VALUE for the agent to parse.
  14. #
  15. # `capture` prints its value back to the terminal, where the agent reads it — so
  16. # capture observations, and leave signing in to the user as a `step`.
  17. set -euo pipefail
  18. step() {
  19. printf '\n>>> %s\n' "$1"
  20. read -r -p " [Enter when done] " _
  21. }
  22. capture() {
  23. local var="$1" question="$2" answer
  24. printf '\n>>> %s\n' "$question"
  25. read -r -p " > " answer
  26. printf -v "$var" '%s' "$answer"
  27. }
  28. # --- edit below ---------------------------------------------------------
  29. step "Open the app at http://localhost:3000 and sign in."
  30. capture ERRORED "Click the 'Export' button. Did it throw an error? (y/n)"
  31. capture ERROR_MSG "Paste the error message (or 'none'):"
  32. # --- edit above ---------------------------------------------------------
  33. printf '\n--- Captured ---\n'
  34. printf 'ERRORED=%s\n' "$ERRORED"
  35. printf 'ERROR_MSG=%s\n' "$ERROR_MSG"