Documentation
¶
Index ¶
- Constants
- func ComputeDiff(repoPath string) (string, error)
- func ComputeDiffStat(repoPath string) (string, error)
- func CurrentBranch(repoPath string) (string, error)
- func DefaultBranch(repoPath string) string
- func DiffCmd(sessionID, workDir string) tea.Cmd
- func GitStatus(repoPath string) (string, error)
- func IsGitRepo(path string) bool
- func ListBranches(repoPath string) ([]string, error)
- func WatchCmd(sessionID string, interval time.Duration) tea.Cmd
- type BranchChangedMsg
- type DiffFile
- type DiffHunk
- type DiffLine
- type DiffLineType
- type DiffUpdatedMsg
- type WatchTickMsg
- type WorktreeCreatedMsg
- type WorktreeManager
- func (wm *WorktreeManager) Create(repoPath, projectName, featureName, baseBranch string) (string, error)
- func (wm *WorktreeManager) Exists(projectName, featureName string) bool
- func (wm *WorktreeManager) List(repoPath string) ([]string, error)
- func (wm *WorktreeManager) Remove(repoPath, projectName, featureName string) error
- func (wm *WorktreeManager) WorktreePath(projectName, featureName string) string
- type WorktreeRemovedMsg
Constants ¶
const WatchInterval = 5 * time.Second
WatchInterval is the default polling interval for git changes.
Variables ¶
This section is empty.
Functions ¶
func ComputeDiff ¶
ComputeDiff runs `git diff` in the given directory and returns the output.
func ComputeDiffStat ¶
ComputeDiffStat runs `git diff --stat` and returns the summary.
func CurrentBranch ¶
CurrentBranch returns the current branch of a repository.
func DefaultBranch ¶
DefaultBranch detects the default branch for a repository. It checks origin/HEAD first, then falls back to checking if "main" or "master" exists.
func ListBranches ¶
ListBranches lists all branches (local and remote) for a repository.
Types ¶
type BranchChangedMsg ¶
BranchChangedMsg is sent when a branch change is detected.
type DiffFile ¶
type DiffFile struct {
Path string
OldPath string // for renames
Added int
Removed int
Hunks []DiffHunk
}
DiffFile represents a file in a diff.
func ParseUnifiedDiff ¶
ParseUnifiedDiff parses a unified diff string into structured data.
type DiffLine ¶
type DiffLine struct {
Type DiffLineType
Content string
}
DiffLine represents a line in a diff hunk.
type DiffLineType ¶
type DiffLineType int
DiffLineType indicates whether a line was added, removed, or unchanged.
const ( DiffLineContext DiffLineType = iota DiffLineAdded DiffLineRemoved )
type DiffUpdatedMsg ¶
DiffUpdatedMsg is sent when the diff for a session has been updated.
type WatchTickMsg ¶
type WatchTickMsg struct {
SessionID string
}
WatchTickMsg is sent periodically to trigger diff updates.
type WorktreeCreatedMsg ¶
WorktreeCreatedMsg is sent when a worktree is successfully created.
type WorktreeManager ¶
type WorktreeManager struct {
// contains filtered or unexported fields
}
WorktreeManager handles git worktree operations.
func NewWorktreeManager ¶
func NewWorktreeManager(baseDir string) *WorktreeManager
NewWorktreeManager creates a new worktree manager.
func (*WorktreeManager) Create ¶
func (wm *WorktreeManager) Create(repoPath, projectName, featureName, baseBranch string) (string, error)
Create creates a new git worktree for a feature branch. repoPath is the path to the main repository. featureBranch is the name of the new branch to create. baseBranch is the branch to base the new branch on (e.g. "main").
func (*WorktreeManager) Exists ¶
func (wm *WorktreeManager) Exists(projectName, featureName string) bool
Exists checks if a worktree exists for the given project/feature.
func (*WorktreeManager) List ¶
func (wm *WorktreeManager) List(repoPath string) ([]string, error)
List lists all worktrees for a repository.
func (*WorktreeManager) Remove ¶
func (wm *WorktreeManager) Remove(repoPath, projectName, featureName string) error
Remove removes a git worktree.
func (*WorktreeManager) WorktreePath ¶
func (wm *WorktreeManager) WorktreePath(projectName, featureName string) string
WorktreePath returns the expected worktree path for a project/feature.
type WorktreeRemovedMsg ¶
WorktreeRemovedMsg is sent when a worktree is removed.