Documentation
¶
Index ¶
- func GetCodeReviewPrompt() string
- func GetCodeReviewPromptWithStyleGuide(styleGuideRules string) string
- func GetPRSummaryPrompt() string
- type AnthropicClient
- func (c *AnthropicClient) GenerateCodeReview(prTitle, prDescription, diff string) (*ReviewResult, error)
- func (c *AnthropicClient) GenerateCodeReviewWithStyleGuide(prTitle, prDescription, diff, styleGuide string) (*ReviewResult, error)
- func (c *AnthropicClient) GeneratePRSummary(prTitle, prDescription, diff string) (*PRSummary, error)
- func (c *AnthropicClient) GenerateResponse(prompt string) (string, error)
- type AnthropicMessage
- type AnthropicRequest
- type AnthropicResponse
- type BaseClient
- type ChatCompletionRequest
- type ChatCompletionResponse
- type ChatMessage
- type Client
- type Comment
- type Config
- type GoogleClient
- func (c *GoogleClient) GenerateCodeReview(prTitle, prDescription, diff string) (*ReviewResult, error)
- func (c *GoogleClient) GenerateCodeReviewWithStyleGuide(prTitle, prDescription, diff, styleGuide string) (*ReviewResult, error)
- func (c *GoogleClient) GeneratePRSummary(prTitle, prDescription, diff string) (*PRSummary, error)
- func (c *GoogleClient) GenerateResponse(prompt string) (string, error)
- type GoogleContent
- type GoogleGenConfig
- type GooglePart
- type GoogleRequest
- type GoogleResponse
- type OpenAIClient
- func (c *OpenAIClient) GenerateCodeReview(prTitle, prDescription, diff string) (*ReviewResult, error)
- func (c *OpenAIClient) GenerateCodeReviewWithStyleGuide(prTitle, prDescription, diff, styleGuide string) (*ReviewResult, error)
- func (c *OpenAIClient) GeneratePRSummary(prTitle, prDescription, diff string) (*PRSummary, error)
- func (c *OpenAIClient) GenerateResponse(prompt string) (string, error)
- type OpenRouterClient
- func (c *OpenRouterClient) GenerateCodeReview(prTitle, prDescription, diff string) (*ReviewResult, error)
- func (c *OpenRouterClient) GenerateCodeReviewWithStyleGuide(prTitle, prDescription, diff, styleGuide string) (*ReviewResult, error)
- func (c *OpenRouterClient) GeneratePRSummary(prTitle, prDescription, diff string) (*PRSummary, error)
- func (c *OpenRouterClient) GenerateResponse(prompt string) (string, error)
- type PRSummary
- type ReviewAction
- type ReviewResult
- type ReviewSummary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCodeReviewPrompt ¶
func GetCodeReviewPrompt() string
func GetPRSummaryPrompt ¶
func GetPRSummaryPrompt() string
Types ¶
type AnthropicClient ¶
type AnthropicClient struct {
*BaseClient
}
func NewAnthropicClient ¶
func NewAnthropicClient(config Config) *AnthropicClient
func (*AnthropicClient) GenerateCodeReview ¶
func (c *AnthropicClient) GenerateCodeReview(prTitle, prDescription, diff string) (*ReviewResult, error)
func (*AnthropicClient) GenerateCodeReviewWithStyleGuide ¶
func (c *AnthropicClient) GenerateCodeReviewWithStyleGuide(prTitle, prDescription, diff, styleGuide string) (*ReviewResult, error)
func (*AnthropicClient) GeneratePRSummary ¶
func (c *AnthropicClient) GeneratePRSummary(prTitle, prDescription, diff string) (*PRSummary, error)
func (*AnthropicClient) GenerateResponse ¶
func (c *AnthropicClient) GenerateResponse(prompt string) (string, error)
type AnthropicMessage ¶
type AnthropicRequest ¶
type AnthropicRequest struct {
Model string `json:"model"`
MaxTokens int `json:"max_tokens"`
Messages []AnthropicMessage `json:"messages"`
System string `json:"system,omitempty"`
}
type AnthropicResponse ¶
type BaseClient ¶
type BaseClient struct {
// contains filtered or unexported fields
}
Base HTTP client for LLM providers
func NewBaseClient ¶
func NewBaseClient(apiKey, model, baseURL string, headers map[string]string) *BaseClient
type ChatCompletionRequest ¶
type ChatCompletionRequest struct {
Model string `json:"model"`
Messages []ChatMessage `json:"messages"`
Temperature *float64 `json:"temperature,omitempty"`
MaxTokens *int `json:"max_tokens,omitempty"`
}
type ChatCompletionResponse ¶
type ChatCompletionResponse struct {
Choices []struct {
Message struct {
Role string `json:"role"`
Content string `json:"content"`
} `json:"message"`
FinishReason string `json:"finish_reason"`
} `json:"choices"`
Error *struct {
Message string `json:"message"`
Type string `json:"type"`
Code string `json:"code"`
} `json:"error,omitempty"`
}
type ChatMessage ¶
type Client ¶
type Client interface {
GeneratePRSummary(prTitle, prDescription, diff string) (*PRSummary, error)
GenerateCodeReview(prTitle, prDescription, diff string) (*ReviewResult, error)
GenerateCodeReviewWithStyleGuide(prTitle, prDescription, diff, styleGuide string) (*ReviewResult, error)
GenerateResponse(prompt string) (string, error) // For conversational responses
}
type Comment ¶
type Comment struct {
File string `json:"file"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
HighlightedCode string `json:"highlighted_code"`
Header string `json:"header"`
Content string `json:"content"`
Label string `json:"label"` // e.g. "bug", "security"
Critical bool `json:"critical"`
SuggestedCode string `json:"suggested_code,omitempty"` // GitHub suggestion block content
}
type GoogleClient ¶
type GoogleClient struct {
*BaseClient
}
func NewGoogleClient ¶
func NewGoogleClient(config Config) *GoogleClient
func (*GoogleClient) GenerateCodeReview ¶
func (c *GoogleClient) GenerateCodeReview(prTitle, prDescription, diff string) (*ReviewResult, error)
func (*GoogleClient) GenerateCodeReviewWithStyleGuide ¶
func (c *GoogleClient) GenerateCodeReviewWithStyleGuide(prTitle, prDescription, diff, styleGuide string) (*ReviewResult, error)
func (*GoogleClient) GeneratePRSummary ¶
func (c *GoogleClient) GeneratePRSummary(prTitle, prDescription, diff string) (*PRSummary, error)
func (*GoogleClient) GenerateResponse ¶
func (c *GoogleClient) GenerateResponse(prompt string) (string, error)
type GoogleContent ¶
type GoogleContent struct {
Role string `json:"role"`
Parts []GooglePart `json:"parts"`
}
type GoogleGenConfig ¶
type GooglePart ¶
type GooglePart struct {
Text string `json:"text"`
}
type GoogleRequest ¶
type GoogleRequest struct {
Contents []GoogleContent `json:"contents"`
SystemInstruction *GoogleContent `json:"systemInstruction,omitempty"`
GenerationConfig *GoogleGenConfig `json:"generationConfig,omitempty"`
}
type GoogleResponse ¶
type GoogleResponse struct {
Candidates []struct {
Content struct {
Parts []GooglePart `json:"parts"`
Role string `json:"role"`
} `json:"content"`
FinishReason string `json:"finishReason"`
} `json:"candidates"`
Error *struct {
Code int `json:"code"`
Message string `json:"message"`
Status string `json:"status"`
} `json:"error,omitempty"`
}
type OpenAIClient ¶
type OpenAIClient struct {
*BaseClient
}
func NewOpenAIClient ¶
func NewOpenAIClient(config Config) *OpenAIClient
func (*OpenAIClient) GenerateCodeReview ¶
func (c *OpenAIClient) GenerateCodeReview(prTitle, prDescription, diff string) (*ReviewResult, error)
func (*OpenAIClient) GenerateCodeReviewWithStyleGuide ¶
func (c *OpenAIClient) GenerateCodeReviewWithStyleGuide(prTitle, prDescription, diff, styleGuide string) (*ReviewResult, error)
func (*OpenAIClient) GeneratePRSummary ¶
func (c *OpenAIClient) GeneratePRSummary(prTitle, prDescription, diff string) (*PRSummary, error)
func (*OpenAIClient) GenerateResponse ¶
func (c *OpenAIClient) GenerateResponse(prompt string) (string, error)
type OpenRouterClient ¶
type OpenRouterClient struct {
*BaseClient
}
func NewOpenRouterClient ¶
func NewOpenRouterClient(config Config) *OpenRouterClient
func (*OpenRouterClient) GenerateCodeReview ¶
func (c *OpenRouterClient) GenerateCodeReview(prTitle, prDescription, diff string) (*ReviewResult, error)
func (*OpenRouterClient) GenerateCodeReviewWithStyleGuide ¶
func (c *OpenRouterClient) GenerateCodeReviewWithStyleGuide(prTitle, prDescription, diff, styleGuide string) (*ReviewResult, error)
func (*OpenRouterClient) GeneratePRSummary ¶
func (c *OpenRouterClient) GeneratePRSummary(prTitle, prDescription, diff string) (*PRSummary, error)
func (*OpenRouterClient) GenerateResponse ¶
func (c *OpenRouterClient) GenerateResponse(prompt string) (string, error)
type PRSummary ¶
type PRSummary struct {
Title string `json:"title"` // Max 10 words
Description string `json:"description"`
Type []string `json:"type"` // e.g., BUG, ENHANCEMENT
Files []struct {
Filename string `json:"filename"`
Summary string `json:"summary"` // Max 70 words
Title string `json:"title"` // 5-10 words
} `json:"files"`
}
type ReviewAction ¶
type ReviewAction string
ReviewAction represents the GitHub review action type
const ( ReviewActionComment ReviewAction = "COMMENT" ReviewActionApprove ReviewAction = "APPROVE" ReviewActionRequestChanges ReviewAction = "REQUEST_CHANGES" )
type ReviewResult ¶
type ReviewResult struct {
Review ReviewSummary `json:"review"`
Comments []Comment `json:"comments"`
}
func (*ReviewResult) GetReviewAction ¶
func (r *ReviewResult) GetReviewAction(autoApproveThreshold int, blockOnCritical bool) ReviewAction
GetReviewAction determines the appropriate GitHub review action based on the review result
Click to show internal directories.
Click to hide internal directories.