Documentation
¶
Overview ¶
Package worktree manages git worktree lifecycle for agent isolation. Each agent gets its own worktree at .bc/agents/<name>/worktree/
Index ¶
- type Manager
- func (m *Manager) ClaudeDir(agentName string) string
- func (m *Manager) Create(ctx context.Context, agentName string) (string, error)
- func (m *Manager) EnsureClaudeDir(agentName string) error
- func (m *Manager) Exists(agentName string) bool
- func (m *Manager) Name(agentName string) string
- func (m *Manager) Path(agentName string) string
- func (m *Manager) Prune(ctx context.Context) error
- func (m *Manager) Remove(ctx context.Context, agentName string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles git worktree lifecycle for agent isolation.
func NewManager ¶
NewManager creates a new worktree manager rooted at the given repository path. It reads BC_HOST_WORKSPACE to determine the host base name for worktree naming.
func (*Manager) ClaudeDir ¶
ClaudeDir returns the path to the Claude home directory for the given agent.
func (*Manager) Create ¶
Create creates a git worktree for the given agent. It prunes stale worktrees, removes any existing worktree at the path, and creates a new detached worktree to avoid branch conflicts.
func (*Manager) EnsureClaudeDir ¶
EnsureClaudeDir creates the Claude home directory for the given agent if it does not already exist.
func (*Manager) Path ¶
Path returns the filesystem path for an agent's worktree. The directory is named bc-<workspace>-<agent> so git's internal worktree name matches the naming convention.