# Remote Iteration

Use this when you want to build OpenMouse here, copy it to the other Mac over SSH, and launch it without AirDrop.

## One-Time Setup

On the other Mac:

1. Turn on **System Settings > General > Sharing > Remote Login**.
2. Make sure the user account can SSH in.
3. Launch OpenMouse once from the path you plan to reuse and allow Accessibility manually.

For passwordless deploys from this Mac:

```bash
ssh-keygen -t ed25519 -f ~/.ssh/openmouse_remote -N ''
cat ~/.ssh/openmouse_remote.pub | ssh Zephyr@192.168.86.36 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys'
```

## Build Here

```bash
clang -framework ApplicationServices native/openmouse-keytap.m -o bin/openmouse-keytap
codesign --force --sign - bin/openmouse-keytap
PATH="/Users/dhirendras/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH" \
  ./node_modules/.bin/electron-packager . OpenMouse \
  --platform=darwin \
  --arch=arm64 \
  --out=dist \
  --overwrite \
  --app-bundle-id=com.openmouse.app \
  --extend-info=build/mac/Info.plist \
  --ignore='^/dist($|/)' \
  --ignore='^/.git($|/)'
ditto -c -k --keepParent dist/OpenMouse-darwin-arm64/OpenMouse.app dist/OpenMouse-mac-arm64-signed.zip
```

## Temporary Remote Run

This does not replace `/Applications/OpenMouse.app` on the other Mac:

```bash
REMOTE='Zephyr@192.168.86.36'
SSH_KEY="$HOME/.ssh/openmouse_remote"

scp -i "$SSH_KEY" dist/OpenMouse-mac-arm64-signed.zip "$REMOTE:/tmp/OpenMouse-mac-arm64-signed.zip"
ssh -i "$SSH_KEY" "$REMOTE" '
  pkill -x OpenMouse || true
  rm -rf /tmp/OpenMouse-test
  mkdir -p /tmp/OpenMouse-test
  ditto -x -k /tmp/OpenMouse-mac-arm64-signed.zip /tmp/OpenMouse-test
  xattr -cr /tmp/OpenMouse-test/OpenMouse.app
  codesign --force --deep --sign - /tmp/OpenMouse-test/OpenMouse.app
  open /tmp/OpenMouse-test/OpenMouse.app
'
```

If Accessibility does not work from `/tmp`, use a stable dev path instead:

```bash
REMOTE='Zephyr@192.168.86.36'
SSH_KEY="$HOME/.ssh/openmouse_remote"

scp -i "$SSH_KEY" dist/OpenMouse-mac-arm64-signed.zip "$REMOTE:/tmp/OpenMouse-mac-arm64-signed.zip"
ssh -i "$SSH_KEY" "$REMOTE" '
  pkill -x OpenMouse || true
  rm -rf /tmp/OpenMouse-dev-extract
  rm -rf /Applications/OpenMouse-dev.app
  mkdir -p /tmp/OpenMouse-dev-extract
  ditto -x -k /tmp/OpenMouse-mac-arm64-signed.zip /tmp/OpenMouse-dev-extract
  mv /tmp/OpenMouse-dev-extract/OpenMouse.app /Applications/OpenMouse-dev.app
  xattr -cr /Applications/OpenMouse-dev.app
  codesign --force --deep --sign - /Applications/OpenMouse-dev.app
  open /Applications/OpenMouse-dev.app
'
```

Add `/Applications/OpenMouse-dev.app` to Accessibility once, then reuse that same path for future test builds.
