Documentation
¶
Index ¶
- func BuildSystemPrompt(rules []entities.Rule) string
- func BuildUserPrompt(title string, sourceBranch string, targetBranch string, ...) string
- func ClassifyFile(path string) string
- func ClassifyFiles(paths []string) []string
- func ParseReviewResponse(content string) (*entities.ReviewResult, error)
- func SplitUnifiedDiff(fullDiff string) map[string]string
- type ParsedPRURL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildSystemPrompt ¶
BuildSystemPrompt assembles the system prompt from the given rules.
func BuildUserPrompt ¶
func BuildUserPrompt(title string, sourceBranch string, targetBranch string, diffs []entities.FileDiff) string
BuildUserPrompt assembles the user prompt from PR metadata and file diffs.
func ClassifyFile ¶
ClassifyFile returns the rule category for a file path based on its extension. Returns an empty string if the extension is not recognized.
func ClassifyFiles ¶
ClassifyFiles returns the unique set of rule categories for the given file paths.
func ParseReviewResponse ¶
func ParseReviewResponse(content string) (*entities.ReviewResult, error)
ParseReviewResponse parses an AI response string into a ReviewResult. It tries direct JSON parsing first, then extracts from markdown code fences, and falls back to treating the entire content as a summary.
func SplitUnifiedDiff ¶
SplitUnifiedDiff splits a multi-file unified diff into per-file chunks. Each returned element is keyed by the new-side file path (b/...) with its diff hunk.
Types ¶
type ParsedPRURL ¶
type ParsedPRURL struct {
ProviderType string
Organization string
Project string // Azure DevOps only
RepoName string
PRID int
}
ParsedPRURL holds the components extracted from a pull request URL.
func ParsePullRequestURL ¶
func ParsePullRequestURL(rawURL string) (*ParsedPRURL, error)
ParsePullRequestURL extracts provider, org, repo, and PR ID from a pull request URL. Delegates to gitforge's ParsePullRequestURL and converts the result to code-guru's ParsedPRURL.