# sftp-autosync

> Valet-style SFTP auto-sync for macOS. Park a parent folder; every child project with a sync config is watched and uploaded over OpenSSH ControlMaster.

**macOS · BUN · OPENSSH**

## Park a folder. Every save is already remote.

Valet-style SFTP auto-sync. Watch ~/Sites, reuse one SSH tunnel, and upload only the bytes that actually changed.

- [Install on GitHub](https://github.com/ahp-sooyaa/sftp-autosync)
- [Agent skill](/.well-known/agent-skills/sftp-autosync/SKILL.md)

## One tunnel. Every path.

Split folder routing: longest matching local prefix wins. Everything else maps under `remotePath`. Same host, user, and key share one ControlMaster socket.

| Local                          | Remote                   |
| ------------------------------ | ------------------------ |
| `~/Sites/my-app`               | `/var/www/my-app`        |
| `~/Sites/my-app/shared-assets` | `/var/www/shared-assets` |

ControlMaster socket reused at `~/Library/Caches/sftp-autosync/cm`.

## How it works

### 01 — `sftp-autosync init`

Park ~/Sites, write global config, optionally install a launchd daemon that starts at login.

### 02 — `sftp-autosync setup`

Point a project at host, key, and remote path. Seed hashes if it is already in sync.

### 03 — `sftp-autosync start`

The watcher debounce-coalesces saves and uploads only files whose SHA-256 changed.

## Features

- **ControlMaster reuse** — One SSH socket per host/user/key. Projects and split routes share it.
- **Content fingerprints** — SHA-256 after every successful upload. Same-content IDE rewrites never hit the remote.
- **launchd at login** — Install the daemon from init. Logs land in `~/Library/Logs/sftp-autosync`.
- **Split folder routing** — Longest local prefix wins. Shared assets can live outside the project remote.
- **macOS notifications** — Always on failure. Optional slow-op and success alerts.
- **Sensible ignores** — `.git`, `node_modules`, `.DS_Store`, `.sftp-autosync`, tmp and swap files.

## Stats

| Metric  | Label                 |
| ------- | --------------------- |
| 1       | daemon, many projects |
| 0       | extra SSH tunnels     |
| 0       | package dependencies  |
| SHA-256 | skip unchanged bytes  |
| login   | start with launchd    |

## Install

```bash
bun install -g sftp-autosync
npm install -g sftp-autosync
brew tap ahp-sooyaa/sftp-autosync && brew install --HEAD sftp-autosync
```

## Links

- [GitHub](https://github.com/ahp-sooyaa/sftp-autosync)
- [Issues](https://github.com/ahp-sooyaa/sftp-autosync/issues)
- [Homebrew tap](https://github.com/ahp-sooyaa/homebrew-sftp-autosync)
- [llms.txt](/llms.txt)
