Documentation
¶
Overview ¶
Package git provides git worktree isolation services for multi-agent coordination.
Package git provides git worktree isolation functionality for multi-agent coordination.
Index ¶
- func FindProjectRoot(startDir string) (string, error)
- func IsGitRepository(dir string) bool
- type AgentPane
- type AutoProvisionRequest
- type AutoProvisionResponse
- type ProvisionError
- type SkippedProvision
- type WorktreeInfo
- type WorktreeManager
- func (wm *WorktreeManager) CleanupStaleWorktrees(ctx context.Context, maxAge time.Duration) error
- func (wm *WorktreeManager) ListWorktrees(ctx context.Context) ([]*WorktreeInfo, error)
- func (wm *WorktreeManager) ProvisionWorktree(ctx context.Context, agentName, sessionID string) (*WorktreeInfo, error)
- func (wm *WorktreeManager) RemoveWorktree(ctx context.Context, agentName, sessionID string) error
- func (wm *WorktreeManager) SyncWorktree(ctx context.Context, worktreePath string) error
- type WorktreeProvision
- type WorktreeService
- func (ws *WorktreeService) AutoProvisionSession(ctx context.Context, sessionName string) (*AutoProvisionResponse, error)
- func (ws *WorktreeService) CleanupSessionWorktrees(ctx context.Context, sessionName string) error
- func (ws *WorktreeService) CleanupStaleWorktrees(ctx context.Context, maxAge time.Duration) error
- func (ws *WorktreeService) GetAllWorktrees(ctx context.Context) (map[string][]*WorktreeInfo, error)
- func (ws *WorktreeService) GetSessionWorktreeStatus(ctx context.Context, sessionName string) (map[string]*WorktreeInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindProjectRoot ¶
FindProjectRoot attempts to find the root of the git repository containing the given directory. Returns empty string if not found.
func IsGitRepository ¶
IsGitRepository checks if a directory is a git repository
Types ¶
type AgentPane ¶
type AgentPane struct {
PaneID string `json:"pane_id"`
AgentType string `json:"agent_type"`
AgentNum int `json:"agent_num"`
Title string `json:"title"`
}
AgentPane represents an agent pane that needs worktree isolation
type AutoProvisionRequest ¶
type AutoProvisionRequest struct {
SessionName string `json:"session_name"`
ProjectDir string `json:"project_dir"`
AgentPanes []AgentPane `json:"agent_panes"`
}
AutoProvisionRequest represents a request for automatic worktree provisioning
type AutoProvisionResponse ¶
type AutoProvisionResponse struct {
SessionName string `json:"session_name"`
ProjectDir string `json:"project_dir"`
Provisions []WorktreeProvision `json:"provisions"`
Skipped []SkippedProvision `json:"skipped"`
Errors []ProvisionError `json:"errors"`
TotalProvisions int `json:"total_provisions"`
SuccessCount int `json:"success_count"`
ProcessingTime string `json:"processing_time"`
}
AutoProvisionResponse represents the result of automatic provisioning
type ProvisionError ¶
type ProvisionError struct {
PaneID string `json:"pane_id"`
AgentType string `json:"agent_type"`
Error string `json:"error"`
}
ProvisionError represents a provision error
type SkippedProvision ¶
type SkippedProvision struct {
PaneID string `json:"pane_id"`
AgentType string `json:"agent_type"`
Reason string `json:"reason"`
}
SkippedProvision represents a skipped provision (e.g., not a git repo)
type WorktreeInfo ¶
type WorktreeInfo struct {
Path string `json:"path"`
Branch string `json:"branch"`
Commit string `json:"commit"`
Agent string `json:"agent"`
CreatedAt time.Time `json:"created_at"`
LastUsed time.Time `json:"last_used"`
}
WorktreeInfo represents information about a git worktree
type WorktreeManager ¶
type WorktreeManager struct {
// contains filtered or unexported fields
}
WorktreeManager handles git worktree creation and management for agent isolation
func NewWorktreeManager ¶
func NewWorktreeManager(projectDir string) (*WorktreeManager, error)
NewWorktreeManager creates a new worktree manager for a project
func (*WorktreeManager) CleanupStaleWorktrees ¶
CleanupStaleWorktrees removes worktrees that haven't been used recently
func (*WorktreeManager) ListWorktrees ¶
func (wm *WorktreeManager) ListWorktrees(ctx context.Context) ([]*WorktreeInfo, error)
ListWorktrees returns all worktrees associated with agents
func (*WorktreeManager) ProvisionWorktree ¶
func (wm *WorktreeManager) ProvisionWorktree(ctx context.Context, agentName, sessionID string) (*WorktreeInfo, error)
ProvisionWorktree creates an isolated worktree for an agent
func (*WorktreeManager) RemoveWorktree ¶
func (wm *WorktreeManager) RemoveWorktree(ctx context.Context, agentName, sessionID string) error
RemoveWorktree removes a worktree and its associated branch
func (*WorktreeManager) SyncWorktree ¶
func (wm *WorktreeManager) SyncWorktree(ctx context.Context, worktreePath string) error
SyncWorktree ensures a worktree is up-to-date with its base branch
type WorktreeProvision ¶
type WorktreeProvision struct {
PaneID string `json:"pane_id"`
AgentType string `json:"agent_type"`
WorktreePath string `json:"worktree_path"`
Branch string `json:"branch"`
Commit string `json:"commit"`
ChangeDir string `json:"change_dir_command"`
}
WorktreeProvision represents a successful worktree provision
type WorktreeService ¶
type WorktreeService struct {
// contains filtered or unexported fields
}
WorktreeService provides high-level git worktree isolation services
func NewWorktreeService ¶
func NewWorktreeService(cfg *config.Config) *WorktreeService
NewWorktreeService creates a new worktree service
func (*WorktreeService) AutoProvisionSession ¶
func (ws *WorktreeService) AutoProvisionSession(ctx context.Context, sessionName string) (*AutoProvisionResponse, error)
AutoProvisionSession automatically provisions worktrees for all agent panes in a session
func (*WorktreeService) CleanupSessionWorktrees ¶
func (ws *WorktreeService) CleanupSessionWorktrees(ctx context.Context, sessionName string) error
CleanupSessionWorktrees removes worktrees associated with a specific session
func (*WorktreeService) CleanupStaleWorktrees ¶
CleanupStaleWorktrees removes stale worktrees across all managed projects
func (*WorktreeService) GetAllWorktrees ¶
func (ws *WorktreeService) GetAllWorktrees(ctx context.Context) (map[string][]*WorktreeInfo, error)
GetAllWorktrees returns worktrees across all managed projects
func (*WorktreeService) GetSessionWorktreeStatus ¶
func (ws *WorktreeService) GetSessionWorktreeStatus(ctx context.Context, sessionName string) (map[string]*WorktreeInfo, error)
GetSessionWorktreeStatus returns the status of worktrees for a session