sandlot/README.md

76 lines
2.1 KiB
Markdown

# sandlot
A CLI for branch-based development using git worktrees and [Apple Container](https://github.com/apple/container). Each branch gets its own worktree and isolated container.
## Prerequisites
- macOS on Apple Silicon
- [Bun](https://bun.sh)
- [Apple Container](https://github.com/apple/container) (`brew install container`)
- Git
### First-time setup
After installing Apple Container, run `container system start` in your terminal. It will prompt to install the Kata kernel — say yes. This is a one-time step.
## Install
```bash
git clone https://github.com/your/sandlot
cd sandlot
bun install
bun link
alias sl=sandlot
```
## Usage
Run all commands from inside a cloned git repo.
### Start a session
```bash
sandlot new fix-POST
```
Creates a worktree, boots a container, and launches Claude Code inside it.
### Other commands
```bash
sandlot list # show all sessions
sandlot open <branch> # re-enter a session
sandlot stop <branch> # stop a container without destroying it
sandlot rm <branch> # tear down session (container, worktree, local branch)
```
Use git directly for commits, pushes, merges, etc. The worktree is a normal git checkout.
### Configuration
```bash
sandlot config # show all options and current values
sandlot config memory # show current memory setting
sandlot config memory 32G # set container memory limit
```
Config is stored in `~/.config/sandlot/config.json`.
| Key | Default | Description |
|-----|---------|-------------|
| `memory` | `16G` | Container memory limit (e.g. 4G, 16G, 32G, 64G) |
| `hosts` | `[]` | Hostnames to resolve on the host and inject into the container |
#### Local network hosts
The container can't resolve `.local` (mDNS) hostnames natively. To make local network hosts reachable from inside the container, add them to the `hosts` config:
```bash
sandlot config hosts add claude.toes.local
sandlot config hosts add myserver.local
sandlot config hosts rm myserver.local
sandlot config hosts # list configured hosts
```
Hostnames are resolved on the Mac via mDNS and written to the container's `/etc/hosts` every time the VM starts.