This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
make build- Build the binarymake run- Build and run the applicationmake install- Install to GOPATH/bin
make test- Run all testsmake test-coverage- Run tests with coverage reportmake test-integration- Run integration testsgo test -v ./cmd -run TestCreateCommand- Run a specific test
make lint- Run golangci-lintmake fmt- Format code with go fmt
make deps- Update and download dependencies
agentree is a Go CLI tool that creates isolated Git worktrees for AI coding agents. Key architectural components:
cmd/root.go- Base command configurationcmd/create.go- Worktree creation logic with flags for branch, base, push, PR, env copying, and setupcmd/remove.go- Worktree removal with optional branch deletion
internal/git/- Git operations wrapper around worktree managementinternal/detector/- Auto-detects package managers (pnpm, npm, yarn, cargo, go, pip, bundler)internal/tui/- Interactive branch selector using Bubble Tea frameworkinternal/config/- Configuration management for project (.agentreerc) and global settingsinternal/scripts/- Script execution engine for post-create commandsinternal/env/- Environment file operations (.env, .dev.vars copying)
- All Git operations go through
git.Repositorytype for consistency - Package manager detection uses file existence checks (package.json, Cargo.toml, etc.)
- TUI components use the Bubble Tea architecture (Model, Update, View)
- Configuration precedence: CLI flags > project config > global config > defaults
- Unit tests alongside implementation files (*_test.go)
- Integration tests in
cmd/integration_test.gousing build tags - Mock Git repository for testing Git operations without real repos