HeadlinesBriefing favicon HeadlinesBriefing.com

Coasts: Git Worktree Isolation for Localhost Development

Hacker News •
×

Coasts is a new CLI tool designed to solve the headache of running multiple isolated localhost instances alongside git worktrees. Created by GitHub developers, it addresses a common pain point: testing code changes in different worktrees requires separate localhost runtimes, which is impractical with complex Docker Compose setups. Coasts introduces the concept of a 'coast'—a containerized host representing your project's runtime, similar to a devcontainer but focused purely on the runtime environment.

You define a Coastfile at your repo root, pointing to your Docker Compose, and run `coast build` to generate a build image. This allows you to spin up multiple Docker-in-Docker runtimes of your project. Crucially, Coasts enables agents to work host-side while running `exec` commands against a specific coast instance for testing or accessing logs, making it harness-agnostic.

It also provides dynamic ports and the ability to 'checkout' a coast to bind canonical ports to the host, simplifying webhook testing and hardcoded port scenarios.