This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
GitPool is a CLI + daemon tool for managing a pool of pre-initialized Git worktrees. It enables fast, disposable checkouts for builds, tests, and CI pipelines without repeated Git fetches.
make build # Build the gitpool binary
make test # Run all tests (unit + integration)
make test-unit # Run unit tests only
make test-integration # Run integration tests
make fmt # Format Go code with goimports
make lint # Run golangci-lint
make install # Install to /usr/local/binClient-Server Model:
- CLI client (
cmd/) communicates with daemon via Unix socket - Daemon (
daemon/) manages worktree pool in background - SQLite database stores persistent state (
db/store.go)
Key Components:
cmd/commands/: Individual CLI command implementationsdaemon/reconciler.go: Maintains pool health and updatespool/: Worktree allocation and lifecycle managementrepo/: Git repository operationsmodels/: Core data structures (Repo, Worktree, Status)ipc/: Unix socket communication protocol
Data Locations:
- Database:
~/.gitpool/worktrees/gitpool.db - Socket:
~/.gitpool/worktrees/daemon.sock - Worktrees:
~/.gitpool/worktrees/<repo>/<id>
Integration tests in tests/ create isolated environments. Run a single test:
go test ./tests -run TestSpecificFunction -vTests use temporary directories (/tmp/gitpool-test-*) and clean up automatically.
gitpool start: Start daemongitpool track <repo-name> <repo-path>: Track repository (use --max flag for worktree count, defaults to 8)gitpool untrack <repo-name>: Stop tracking repository and clean up worktreesgitpool refresh <repo-name>: Manually fetch updates and refresh idle worktreesgitpool claim <repo> --branch <branch>: Claim worktree (returns JSON)gitpool release <worktree-id>: Release worktree back to poolgitpool show <worktree-id>: Get details about a specific worktree (supports --format path)gitpool list: Show all worktrees
- Branch uniqueness: Each branch name must be unique per repository
- JSON output: The
claimcommand returns JSON with worktree ID and path for scripting - Error handling: Use descriptive errors and proper cleanup in defer blocks
- Testing: Always run
make testbefore committing changes