Files
kandev/apps/backend/internal/agent/worktree/errors.go
T
jcfs 20c456dc07 feat: implement Git worktrees for concurrent agent execution
- Add worktree package with Manager, Store, Config, and error types
- Integrate worktree creation/reuse into lifecycle manager
- Update executor to pass worktree configuration
- Add WorktreeConfig to common config package
- Enable worktrees by default for agent isolation
- Add unit tests for worktree manager

This allows multiple agents to work on the same repository simultaneously
by creating isolated worktrees for each task. Worktrees persist between
agent runs for task resumption and are only cleaned up when tasks are
explicitly deleted.
2026-01-12 15:04:16 +00:00

35 lines
1.4 KiB
Go

// Package worktree provides Git worktree management for concurrent agent execution.
package worktree
import "errors"
var (
// ErrWorktreeExists is returned when attempting to create a worktree that already exists.
ErrWorktreeExists = errors.New("worktree already exists for task")
// ErrWorktreeNotFound is returned when the requested worktree does not exist.
ErrWorktreeNotFound = errors.New("worktree not found")
// ErrRepoNotGit is returned when the repository path is not a Git repository.
ErrRepoNotGit = errors.New("repository is not a git repository")
// ErrBranchExists is returned when the branch name already exists in the repository.
ErrBranchExists = errors.New("branch already exists")
// ErrMaxWorktrees is returned when the maximum number of worktrees per repository is reached.
ErrMaxWorktrees = errors.New("maximum worktrees reached for repository")
// ErrWorktreeLocked is returned when the worktree is locked by another process.
ErrWorktreeLocked = errors.New("worktree is locked by another process")
// ErrInvalidBaseBranch is returned when the base branch does not exist.
ErrInvalidBaseBranch = errors.New("base branch does not exist")
// ErrWorktreeCorrupted is returned when the worktree directory is corrupted or invalid.
ErrWorktreeCorrupted = errors.New("worktree directory is corrupted")
// ErrGitCommandFailed is returned when a git command fails to execute.
ErrGitCommandFailed = errors.New("git command failed")
)