buildAppleScript activates Warp, waits for the new tab from `open warp://...` to take key focus, then keystrokes `bash ` + Return into the front Warp session. Why `keystroke (ASCII character 13)` instead of `keystroke return` or `key code 36`: Warp v0.2026.04 filters synthetic Return-ke
(scriptPath string)
| 200 | // - 1.8s cold — cold-start Warp launch. |
| 201 | // - 0.5s mid — between typed text and CR; needed for ~90-char temp paths. |
| 202 | func buildAppleScript(scriptPath string) string { |
| 203 | safePath := escapeAppleScriptString(scriptPath) |
| 204 | return fmt.Sprintf(`set wasRunning to application id "dev.warp.Warp-Stable" is running |
| 205 | tell application "Warp" to activate |
| 206 | if wasRunning then |
| 207 | delay 0.6 |
| 208 | else |
| 209 | delay 1.8 |
| 210 | end if |
| 211 | tell application "System Events" |
| 212 | tell process "Warp" |
| 213 | keystroke "bash %s" |
| 214 | delay 0.5 |
| 215 | keystroke (ASCII character 13) |
| 216 | end tell |
| 217 | end tell |
| 218 | `, safePath) |
| 219 | } |
| 220 | |
| 221 | // tempScriptPath returns os.TempDir()/flow-warp-<uuid>.sh. UUID is 16 |
| 222 | // crypto/rand bytes hex-encoded — sufficient uniqueness for concurrent |
no test coverage detected