Documentation
¶
Index ¶
- Variables
- func CalculateJaccardSimilarity(setA map[plumbing.Hash]struct{}, setB map[plumbing.Hash]struct{}) float64
- func GenerateReport(result CompareResult, reportPath string) error
- func GetCommitMessages(repo Repository, commits map[plumbing.Hash]struct{}) ([]string, error)
- func GetConfigPath() (string, error)
- func GetDefaultModel(provider string) string
- func PrintCompareResult(result CompareResult)
- func PrintUsage()
- func PrintVersion()
- func RunConfigCommand(cmdConfig ConfigCommandConfig) error
- func SaveConfig(config *AIConfig) error
- type AIConfig
- type AIProvider
- type ClaudeMessage
- type ClaudeRequest
- type ClaudeResponse
- type Command
- type CompareConfig
- type CompareResult
- type ConfigCommandConfig
- type GeminiContent
- type GeminiRequest
- type GeminiResponse
- type GitRepository
- func (gr *GitRepository) FetchAllTags() ([]*plumbing.Reference, error)
- func (gr *GitRepository) GetCommitObject(hash plumbing.Hash) (*object.Commit, error)
- func (gr *GitRepository) GetCommitSetForTag(ref *plumbing.Reference) (map[plumbing.Hash]struct{}, error)
- func (gr *GitRepository) GetCommitSetForTagFilteredByDirectory(ref *plumbing.Reference, directory string) (map[plumbing.Hash]struct{}, error)
- func (gr *GitRepository) GetDiffBetweenTags(tag1 *plumbing.Reference, tag2 *plumbing.Reference, directory string) (string, error)
- type OpenAIMessage
- type OpenAIRequest
- type OpenAIResponse
- type Repository
Constants ¶
This section is empty.
Variables ¶
var ( ErrMissingRepo = errors.New("repository path is required") ErrMissingTag1 = errors.New("first tag name is required") ErrMissingTag2 = errors.New("second tag name is required") ErrInvalidRepo = errors.New("invalid repository path") ErrTag1NotFound = errors.New("first tag not found in repository") ErrTag2NotFound = errors.New("second tag not found in repository") ErrInvalidCommand = errors.New("invalid command") ErrNoCommand = errors.New("no command specified") )
var ( ErrInvalidConfiguration = errors.New("invalid configuration") ErrValidationFailed = errors.New("validation failed") ErrGetTagReference = errors.New("failed to get tag reference") ErrGetCommits = errors.New("failed to get commits") ErrInvalidDirectory = errors.New("invalid directory path") )
var ( ErrConfigNotFound = errors.New("config file not found") ErrInvalidProvider = errors.New("invalid AI provider") ErrMissingAPIKey = errors.New("API key is required") ErrConfigDirCreation = errors.New("failed to create config directory") ErrConfigFileWrite = errors.New("failed to write config file") ErrConfigFileRead = errors.New("failed to read config file") ErrInvalidConfigData = errors.New("invalid config data") )
var ( ErrReportGeneration = errors.New("failed to generate report") ErrAPIRequest = errors.New("API request failed") ErrReportWrite = errors.New("failed to write report file") )
var ( ErrOpenRepository = errors.New("failed to open repository") ErrFetchTags = errors.New("failed to fetch tags") ErrGetCommit = errors.New("failed to get commit") ErrDereferenceTag = errors.New("failed to dereference tag") ErrTraverseCommits = errors.New("failed to traverse commits") )
Functions ¶
func CalculateJaccardSimilarity ¶
func CalculateJaccardSimilarity(setA map[plumbing.Hash]struct{}, setB map[plumbing.Hash]struct{}) float64
CalculateJaccardSimilarity computes the Jaccard similarity coefficient between two commit sets Returns a value between 0.0 and 1.0, where 1.0 means identical sets
func GenerateReport ¶ added in v1.2.0
func GenerateReport(result CompareResult, reportPath string) error
GenerateReport creates an AI-generated markdown report analyzing the tag differences
func GetCommitMessages ¶ added in v1.2.0
func GetCommitMessages(repo Repository, commits map[plumbing.Hash]struct{}) ([]string, error)
GetCommitMessages returns commit messages for a set of commit hashes
func GetConfigPath ¶ added in v1.2.0
GetConfigPath returns the path to the config file
func GetDefaultModel ¶ added in v1.2.0
GetDefaultModel returns the default model for a given provider
func PrintCompareResult ¶ added in v0.1.3
func PrintCompareResult(result CompareResult)
func PrintVersion ¶
func PrintVersion()
PrintVersion prints the version information retrieved from the binary's build info
func RunConfigCommand ¶ added in v1.2.0
func RunConfigCommand(cmdConfig ConfigCommandConfig) error
RunConfigCommand executes the config command
func SaveConfig ¶ added in v1.2.0
SaveConfig saves the AI configuration to disk
Types ¶
type AIConfig ¶ added in v1.2.0
type AIConfig struct {
Provider AIProvider `json:"provider"`
APIKey string `json:"api_key"`
Model string `json:"model"`
}
AIConfig stores AI-related configuration
func LoadConfig ¶ added in v1.2.0
LoadConfig loads the AI configuration from disk
type AIProvider ¶ added in v1.2.0
type AIProvider string
AIProvider represents supported AI providers
const ( ProviderClaude AIProvider = "claude" ProviderOpenAI AIProvider = "openai" ProviderGemini AIProvider = "gemini" )
type ClaudeMessage ¶ added in v1.2.0
ClaudeMessage represents a message in the Claude API
type ClaudeRequest ¶ added in v1.2.0
type ClaudeRequest struct {
Model string `json:"model"`
MaxTokens int `json:"max_tokens"`
Messages []ClaudeMessage `json:"messages"`
}
ClaudeRequest represents a request to the Claude API
type ClaudeResponse ¶ added in v1.2.0
type ClaudeResponse struct {
Content []struct {
Type string `json:"type"`
Text string `json:"text"`
} `json:"content"`
Error *struct {
Type string `json:"type"`
Message string `json:"message"`
} `json:"error,omitempty"`
}
ClaudeResponse represents a response from the Claude API
type Command ¶
type Command string
Command represents the CLI command type
func ParseCommand ¶
ParseCommand parses command-line arguments and returns the configuration
type CompareConfig ¶ added in v0.1.3
type CompareConfig struct {
Command Command
RepoPath string
Tag1Name string
Tag2Name string
Directory string
Verbose bool
ReportPath string
}
CompareConfig holds the application configuration from command-line arguments
func NewCompareConfig ¶ added in v0.1.3
func NewCompareConfig(args []string) (CompareConfig, error)
NewCompareConfig parses the compare command flags
func (*CompareConfig) GetTagReference ¶ added in v0.1.3
func (c *CompareConfig) GetTagReference(repo Repository, tagName string) (*plumbing.Reference, error)
GetTagReference finds and returns the reference for a specific tag name
func (*CompareConfig) Validate ¶ added in v0.1.3
func (c *CompareConfig) Validate() error
Validate checks if the configuration is valid
func (*CompareConfig) ValidateWithRepository ¶ added in v0.1.3
func (c *CompareConfig) ValidateWithRepository(repo Repository) error
ValidateWithRepository checks if both tags exist in the repository
type CompareResult ¶ added in v0.1.3
type CompareResult struct {
Repo Repository
Config CompareConfig
Tag1Ref *plumbing.Reference
Tag2Ref *plumbing.Reference
Similarity float64
OnlyInTag1 map[plumbing.Hash]struct{}
OnlyInTag2 map[plumbing.Hash]struct{}
DiffStat string
}
func Compare ¶ added in v0.1.3
func Compare(config CompareConfig) (CompareResult, error)
type ConfigCommandConfig ¶ added in v1.2.0
ConfigCommandConfig holds the config command configuration
func NewConfigCommandConfig ¶ added in v1.2.0
func NewConfigCommandConfig(args []string) (ConfigCommandConfig, error)
NewConfigCommandConfig parses the config command flags
func (*ConfigCommandConfig) Validate ¶ added in v1.2.0
func (c *ConfigCommandConfig) Validate() error
Validate checks if the config command configuration is valid
type GeminiContent ¶ added in v1.2.0
type GeminiContent struct {
Parts []struct {
Text string `json:"text"`
} `json:"parts"`
Role string `json:"role,omitempty"`
}
Gemini API structures
type GeminiRequest ¶ added in v1.2.0
type GeminiRequest struct {
Contents []GeminiContent `json:"contents"`
}
type GeminiResponse ¶ added in v1.2.0
type GitRepository ¶
type GitRepository struct {
// contains filtered or unexported fields
}
GitRepository is a concrete implementation of Repository using go-git
func NewGitRepository ¶
func NewGitRepository(path string) (*GitRepository, error)
NewGitRepository creates a new GitRepository instance
func (*GitRepository) FetchAllTags ¶
func (gr *GitRepository) FetchAllTags() ([]*plumbing.Reference, error)
FetchAllTags retrieves all tag references from the repository
func (*GitRepository) GetCommitObject ¶
GetCommitObject retrieves a commit object by its hash
func (*GitRepository) GetCommitSetForTag ¶
func (gr *GitRepository) GetCommitSetForTag(ref *plumbing.Reference) (map[plumbing.Hash]struct{}, error)
GetCommitSetForTag traverses the history of a tag and returns all parent commit hashes. Handles both annotated tags (tag objects) and lightweight tags (direct commit refs).
func (*GitRepository) GetCommitSetForTagFilteredByDirectory ¶ added in v1.1.0
func (gr *GitRepository) GetCommitSetForTagFilteredByDirectory(ref *plumbing.Reference, directory string) (map[plumbing.Hash]struct{}, error)
GetCommitSetForTagFilteredByDirectory traverses the history of a tag and returns commits that touch files in the specified directory. Handles both annotated tags (tag objects) and lightweight tags (direct commit refs). Uses native git log command for performance (go-git's PathFilter is extremely slow).
func (*GitRepository) GetDiffBetweenTags ¶ added in v1.2.0
func (gr *GitRepository) GetDiffBetweenTags(tag1 *plumbing.Reference, tag2 *plumbing.Reference, directory string) (string, error)
GetDiffBetweenTags returns the diff between two tags. Handles both annotated tags (tag objects) and lightweight tags (direct commit refs). If directory is specified, only shows diff for files in that directory.
type OpenAIMessage ¶ added in v1.2.0
OpenAI API structures
type OpenAIRequest ¶ added in v1.2.0
type OpenAIRequest struct {
Model string `json:"model"`
Messages []OpenAIMessage `json:"messages"`
}
type OpenAIResponse ¶ added in v1.2.0
type Repository ¶
type Repository interface {
FetchAllTags() ([]*plumbing.Reference, error)
GetCommitSetForTag(ref *plumbing.Reference) (map[plumbing.Hash]struct{}, error)
GetCommitSetForTagFilteredByDirectory(ref *plumbing.Reference, directory string) (map[plumbing.Hash]struct{}, error)
GetCommitObject(hash plumbing.Hash) (*object.Commit, error)
GetDiffBetweenTags(tag1 *plumbing.Reference, tag2 *plumbing.Reference, directory string) (string, error)
}
Repository is an interface that abstracts Git operations for testability