Documentation
¶
Index ¶
- func CloneRepository(url string) (*git.Repository, error)
- func GetContributorStats(commits []Commit) map[string]struct{ ... }
- func GetRemoteURL(repo *git.Repository, remoteName string) string
- func OpenRepository(path string) (*git.Repository, error)
- type Author
- type Branch
- type Commit
- func GetCommitsByAuthor(commits []Commit, authorEmail string) []Commit
- func GetCommitsByDateRange(commits []Commit, start, end time.Time) []Commit
- func GetFileHistory(commits []Commit, filePath string) []Commit
- func ParseCommit(commit *object.Commit, includePatch bool) (*Commit, error)
- func ParseCommits(repo *git.Repository, maxCommits int, includePatch bool) ([]Commit, error)
- type CommitStats
- type Diff
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneRepository ¶
func CloneRepository(url string) (*git.Repository, error)
CloneRepository clones a Git repository to memory
func GetContributorStats ¶
func GetContributorStats(commits []Commit) map[string]struct { CommitCount int Additions int Deletions int }
GetContributorStats aggregates statistics by author
func GetRemoteURL ¶
func GetRemoteURL(repo *git.Repository, remoteName string) string
GetRemoteURL returns the URL for a given remote name (e.g., "origin") Returns empty string if remote doesn't exist
func OpenRepository ¶
func OpenRepository(path string) (*git.Repository, error)
OpenRepository opens a Git repository from a local path
Types ¶
type Author ¶
type Author struct {
Name string `json:"name"`
Email string `json:"email"`
When time.Time `json:"when"`
}
Author represents Git author/committer information Optimized for narrative generation with full contact and temporal data
func ParseAuthor ¶
ParseAuthor converts go-git Signature to Author
type Branch ¶
type Branch struct {
Name string `json:"name"`
Hash string `json:"hash"`
IsRemote bool `json:"is_remote"`
IsHead bool `json:"is_head"`
}
Branch represents a Git branch with metadata
func ParseBranches ¶
func ParseBranches(repo *git.Repository) ([]Branch, error)
ParseBranches extracts all branches from a repository
type Commit ¶
type Commit struct {
Hash string `json:"hash"`
ShortHash string `json:"short_hash"` // First 8 chars for display
Author Author `json:"author"`
Committer Author `json:"committer"`
Message string `json:"message"`
MessageSubject string `json:"message_subject"` // First line of message
MessageBody string `json:"message_body"` // Rest of message
CommittedAt time.Time `json:"committed_at"`
ParentHashes []string `json:"parent_hashes"`
TreeHash string `json:"tree_hash"`
IsMerge bool `json:"is_merge"`
Branch *Branch `json:"branch,omitempty"`
Diffs []Diff `json:"files_changed"`
Stats CommitStats `json:"stats"`
}
Commit represents a Git commit with full metadata Designed to capture the complete context of each change
func GetCommitsByAuthor ¶
GetCommitsByAuthor filters commits by author email
func GetCommitsByDateRange ¶
GetCommitsByDateRange filters commits within a date range
func GetFileHistory ¶
GetFileHistory tracks all changes to a specific file
func ParseCommit ¶
ParseCommit converts a go-git Commit to our Commit struct with full metadata
func ParseCommits ¶
ParseCommits extracts commits from a repository maxCommits: 0 for unlimited, >0 to limit includePatch: whether to include full diff patches (can be large)
type CommitStats ¶
type CommitStats struct {
FilesChanged int `json:"files_changed"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
NetChange int `json:"net_change"` // Additions - Deletions
}
CommitStats represents aggregate statistics for a commit
type Diff ¶
type Diff struct {
FilePath string `json:"file_path"`
OldPath string `json:"old_path,omitempty"` // For renames
Status string `json:"status"` // "added", "modified", "deleted", "renamed"
Additions int `json:"additions"`
Deletions int `json:"deletions"`
Patch string `json:"patch,omitempty"` // Actual diff content (optional for large repos)
IsBinary bool `json:"is_binary"`
FileType string `json:"file_type"` // Extension/language for context
}
Diff represents a file change in a commit Includes detailed metadata for understanding code evolution
type Repository ¶
type Repository struct {
URL string `json:"url"`
LocalPath string `json:"local_path,omitempty"`
Branches []Branch `json:"branches"`
Commits []Commit `json:"commits"`
HeadHash string `json:"head_hash"`
HeadBranch string `json:"head_branch"`
TotalCommits int `json:"total_commits"`
}
Repository represents a Git repository with parsed metadata Central data structure for narrative generation
func ParseRepository ¶
func ParseRepository(repo *git.Repository, url string, maxCommits int, includePatch bool) (*Repository, error)
ParseRepository extracts all metadata from a repository Optimized for narrative generation with configurable depth