Skip to content
All work
Case study

sftp-autosync

A Valet-style CLI and daemon for macOS that uploads local changes to remote servers over SFTP. It reuses one SSH connection, so each upload stays fast.

Role
Solo, covering design, build, tests, docs and the landing page
Timeline
Aug – Oct 2026
Status
Released
Stack
Bun, OpenSSH, macOS, CLI
sftp-autosync landing page: 'Park a folder. Every save is already remote.' with a terminal log of uploads

Overview

Some of the sites I work on still deploy the old way: edit a file locally, then upload it over SFTP. sftp-autosync makes that a background job. It borrows Laravel Valet’s “park a folder” idea. You park ~/Sites, add a small config to any project inside it, and that project’s changes reach the server without opening FileZilla or an editor plugin.

It ships as a CLI (bun, npm or a Homebrew tap) and a login daemon, along with an agent skill so AI coding agents can push files too. It also has its own landing page.

The problem

Editor SFTP extensions are tied to one editor and one window. They open a new connection for every upload, and they get confused when files are rewritten by tools or agents rather than saved by hand. FileZilla is manual. For several small sites on several hosts, I wanted the following:

Approach

The tool is a one-way uploader built on the system’s OpenSSH, not an SFTP library. Each user, host, port and key combination shares one ControlMaster socket with ControlPersist, so after the first connection every scp reuses an open session.

The runtime is Bun with no npm dependencies. I even replaced @clack/prompts with a small in-repo terminal UI to keep installs light.

Key decisions

Fingerprints, not timestamps. Editors and agents often rewrite files without changing them. Each project keeps a content-hashes.json. An upload is skipped when size and modification time match, and if they don’t, the SHA-256 hash is compared. Identical rewrites never reach the server, even after a daemon restart.

Manual by default. Autosync is convenient, but a background process that deletes files on a production server is risky. New projects start in manual mode. Older configs with no mode stay on autosync, so existing setups don’t quietly stop syncing.

Deletes go to a trash folder. Remote deletes are off unless you turn them on. When they’re on, files move to .sftp-autosync-trash/<timestamp>/ on the server instead of being removed with rm, and that trash is pruned after 7 days.

Challenges

Making a wrong path harmless. Several safety rules came out of one scare:

Failing loudly but recovering quietly. SSH errors are sorted into types such as authentication, host key, network and permission, so doctor and status can say what’s actually wrong. Failed uploads go to a retry queue with a circuit breaker, and the last error stays visible until a later upload succeeds.

Testing against a real server. A Docker sandbox runs real OpenSSH on localhost:2222 with two parked projects. An end-to-end check confirms that edits and deletes in one project never touch the other project’s remote files.

Outcome

What I’d do next