nandi/oripublic Fork 0
main
Commits
Clone
git clone https://git.rickub.com/nandi/ori.git
git clone ssh://git@rickub.com/nandi/ori.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

forked from bots-garden/ori

README.md · 54 lines · 3.0 KBmarkdown
Blame HistoryOpen raw

Scripts

Version française

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:

  1. Finds the repository root from its own location (<repo>/scripts/…). Set the repoDirOverride property at the top of the file if you move it elsewhere.
  2. Checks that ori-desktop/build/bin/ori-desktop.app exists; otherwise shows how to build it (cd ori-desktop && wails build && xattr -cr build/bin/ori-desktop.app).
  3. If sbx ls -q already lists a sandbox named ori, restarts it with sbx 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
    
  4. Polls http://localhost:5555/healthz every 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.
  5. Opens ori-desktop.app, which auto-connects to the server URL it remembered last time (~/Library/Application Support/ori-desktop/settings.json, key serverUrl). Set it to http://localhost:5555 on 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.app in the Finder, drag it to the Dock, or launch it from Spotlight ("Launch Ori").
  • The .app is 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 run failing, usually because Docker Desktop is not running) opens an alert dialog.

Why these choices

  • Finder launches get a minimal PATH without /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
# Scripts

*[Version française](README.fr.md)*

## `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:

1. Finds the repository root from its own location (`<repo>/scripts/…`). Set the `repoDirOverride` property at the top of the file if you move it elsewhere.
2. Checks that `ori-desktop/build/bin/ori-desktop.app` exists; otherwise shows how to build it (`cd ori-desktop && wails build && xattr -cr build/bin/ori-desktop.app`).
3. If `sbx ls -q` already lists a sandbox named `ori`, restarts it with `sbx run -d --name ori`. Otherwise creates it:
   ```bash
   sbx run -d claude . --template k33g/ori:0.0.2 --kit ./kits/ori --name ori -p 5555:8888/tcp
   ```
4. Polls `http://localhost:5555/healthz` every 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`.
5. Opens `ori-desktop.app`, which auto-connects to the server URL it remembered last time (`~/Library/Application Support/ori-desktop/settings.json`, key `serverUrl`). Set it to `http://localhost:5555` on 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

```bash
osascript scripts/launch-ori.applescript
```

### Make it double-clickable

Compile the script into an application bundle:

```bash
osacompile -o "scripts/Launch Ori.app" scripts/launch-ori.applescript
```

- Double-click `scripts/Launch Ori.app` in the Finder, drag it to the Dock, or launch it from Spotlight ("Launch Ori").
- The `.app` is 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 run` failing, usually because Docker Desktop is not running) opens an alert dialog.

### Why these choices

- **Finder launches get a minimal `PATH`** without `/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

```bash
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
```