forked from bots-garden/ori
Scripts
launch-ori.applescript — start the sandbox and open ori-desktop
One gesture instead of two commands: the script starts (or restarts) the ori sandbox, waits until the ori server answers, then opens the desktop app.
What it does, in order:
- Finds the repository root from its own location (
<repo>/scripts/…). Set therepoDirOverrideproperty at the top of the file if you move it elsewhere. - Checks that
ori-desktop/build/bin/ori-desktop.appexists; otherwise shows how to build it (cd ori-desktop && wails build && xattr -cr build/bin/ori-desktop.app). - If
sbx ls -qalready lists a sandbox namedori, restarts it withsbx run -d --name ori. Otherwise creates it:sbx run -d claude . --template k33g/ori:0.0.2 --kit ./kits/ori --name ori -p 5555:8888/tcp - Polls
http://localhost:5555/healthzevery 2 s, up to 90 s (healthTimeoutSeconds). If the server never answers it still opens the app and tells you where to look:sbx exec ori cat /var/log/sbx-kit-startup.log. - Opens
ori-desktop.app, which auto-connects to the server URL it remembered last time (~/Library/Application Support/ori-desktop/settings.json, keyserverUrl). Set it tohttp://localhost:5555on the first connection screen.
Template, kit, ports, sandbox name and timeout are property lines at the top of the script.
Run it from a terminal
osascript scripts/launch-ori.applescript
Make it double-clickable
Compile the script into an application bundle:
osacompile -o "scripts/Launch Ori.app" scripts/launch-ori.applescript
- Double-click
scripts/Launch Ori.appin the Finder, drag it to the Dock, or launch it from Spotlight ("Launch Ori"). - The
.appis a build artefact and is gitignored (scripts/*.app/). Rebuild it after every edit of the.applescript. - Built locally, it carries no quarantine attribute, so Gatekeeper does not block it. macOS may ask once for permission to show notifications.
- Progress is reported with notifications; a hard failure (app not built,
sbx runfailing, usually because Docker Desktop is not running) opens an alert dialog.
Why these choices
- Finder launches get a minimal
PATHwithout/opt/homebrew/bin, so the script exports it before every shell command. sbx run -d(detached) returns as soon as the sandbox exists, and exempts it from sbx's 30 s auto-stop. The kit then starts the ori server asynchronously, hence the health poll before opening the app.- Restart instead of recreate when the sandbox exists: re-running the create command would collide on the name, and
sbx rm+ create would lose the sandbox's Claude session.
Test the handlers without creating a sandbox
osacompile -o /tmp/launch-ori.scpt scripts/launch-ori.applescript
osascript -e 'set s to load script POSIX file "/tmp/launch-ori.scpt"
set s'"'"'s healthTimeoutSeconds to 4
return s'"'"'s waitForServer("http://localhost:5555")' # false unless something answers on :5555
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|