| 1 | |
| 2 | set -euo pipefail |
| 3 | SHOTS="${HARNESS_STATE:-/tmp/claude-1000/yumush-harness}/shots" |
| 4 | mkdir -p "$SHOTS" |
| 5 | monitor() { podman exec yumush-win sh -c "printf '%s\n' \"$1\" | nc -q1 -U /run/shm/monitor.sock >/dev/null"; } |
| 6 | ssh_win() { ssh -i ~/vm/yumush-win/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10 -o LogLevel=ERROR -p 2222 yumush@127.0.0.1 "$@"; } |
| 7 | case "$1" in |
| 8 | shot) |
| 9 | monitor "screendump /tmp/win.ppm"; sleep 0.5 |
| 10 | podman cp yumush-win:/tmp/win.ppm "$SHOTS/win.ppm" |
| 11 | magick "$SHOTS/win.ppm" "$SHOTS/${2:-win}.png"; echo "$SHOTS/${2:-win}.png";; |
| 12 | click) |
| 13 | ssh_win "schtasks /create /f /tn yumush_click /sc once /st 00:00 /it /ru yumush /tr 'powershell -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File C:\\Users\\yumush\\click.ps1 $2 $3 ${4:-left}' 2>&1 | Out-Null; schtasks /run /tn yumush_click | Out-Null";; |
| 14 | key) monitor "sendkey $2";; |
| 15 | type) for ((i=0; i<${#2}; i++)); do c="${2:i:1}"; case "$c" in [A-Z]) monitor "sendkey shift-${c,,}";; " ") monitor "sendkey spc";; ".") monitor "sendkey dot";; *) monitor "sendkey $c";; esac; done;; |
| 16 | run) |
| 17 | ssh_win "schtasks /create /f /tn yumush_$2 /sc once /st 00:00 /it /ru yumush /tr \"$3\" | Out-Null; schtasks /run /tn yumush_$2";; |
| 18 | ssh) shift; ssh_win "$@";; |
| 19 | sync) |
| 20 | ssh_win 'Stop-Process -Name client,server -ErrorAction SilentlyContinue' || true |
| 21 | (cd .. && (git ls-files -co --exclude-standard; echo fullchain.pem; echo privkey.pem; echo configs/server_config.toml) | grep -v "^harness/" | tar czf /tmp/claude-1000/src.tgz -T -) |
| 22 | scp -q -i ~/vm/yumush-win/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR -P 2222 /tmp/claude-1000/src.tgz yumush@127.0.0.1:src.tgz |
| 23 | ssh_win 'tar xmzf src.tgz -C yumush; cd yumush; $env:Path += ";C:\Users\yumush\.cargo\bin"; cargo build --profile harness -p client -p server 2>&1 | Select-String -Pattern "^error|^warning|Finished|error\[" -Context 0,8 | Select -First 40';; |
| 24 | esac |
| 25 | sleep "${UI_DELAY:-0.3}" |