CLAUDE.md (1428B)
1 # CLAUDE.md 2 3 ## Build & Test 4 - `go build ./...` — build all packages 5 - `go test ./...` — run all tests 6 - `GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o esync-darwin-arm64 .` — trimmed release binary 7 8 ## Gotchas 9 10 ### macOS rsync 11 - `/usr/bin/rsync` is Apple's `openrsync` — it lacks `--info=progress2` and other modern flags 12 - `rsyncBin()` in `internal/syncer/syncer.go` resolves to homebrew rsync (`/opt/homebrew/bin/rsync`) when available 13 - `exec.Command` does not use shell aliases, so the binary path must be resolved explicitly 14 - `CheckRsync()` validates rsync >= 3.1.0 on startup 15 16 ### rsync output parsing 17 - With `--info=progress2`, both per-file and overall progress lines contain `xfr#`/`to-chk=` 18 - In `extractFiles()`, the 100% size-extraction check MUST come before the progress2 skip guard, or per-file sizes are lost 19 - Fast transfers may skip the 100% progress line entirely, leaving per-file `Bytes: 0` 20 - When per-file sizes are missing, `cmd/sync.go` distributes `BytesTotal` across groups weighted by file count 21 - `extractStats()` must match `Total transferred file size:` (actual bytes sent), NOT `Total file size:` (entire source tree size) 22 23 ### TUI channels 24 - Status-only messages use `"status:..."` prefix (e.g. `"status:syncing 45%"`) 25 - Channel sends from the sync handler use non-blocking `select/default` to avoid deadlocks 26 - `syncEvents` and `logEntries` channels are buffered (capacity 64)