Documentation
¶
Index ¶
- func AggregateActivity(repoActivities []map[string]*github.UserActivity) []*github.UserActivity
- func AggregateDetails(allDetails [][]github.ReviewCommentDetail) []github.ReviewCommentDetail
- func BuildAnalysisPrompt(groups []ReviewerGroup) string
- func EstimateTokenCount(text string) int
- func FilterDetailsByReviewers(details []github.ReviewCommentDetail, reviewers []*github.UserActivity) []github.ReviewCommentDetail
- func FormatMarkdownReport(analysis string, detailsPath string, totalComments int, reviewers []string) string
- func ResolveOrgAndRepos(org string, repos string, workDir string) (string, []string, error)
- func Run(ctx context.Context, opts Options, streams iostream.Streams) error
- func TopN(activities []*github.UserActivity, n int) ([]*github.UserActivity, error)
- func WriteDetailsJSON(details []github.ReviewCommentDetail, path string, org string, since time.Time, ...) error
- func WritePRRankingsCSV(rankings []PRRankingRow, path string) (err error)
- type DetailsJSON
- type DetailsMetadata
- type Options
- type OutputPaths
- type PRContext
- type PRRankingRow
- type ReviewCommentWithContext
- type ReviewerGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AggregateActivity ¶
func AggregateActivity(repoActivities []map[string]*github.UserActivity) []*github.UserActivity
AggregateActivity merges activity maps from multiple repos into a sorted slice.
func AggregateDetails ¶
func AggregateDetails(allDetails [][]github.ReviewCommentDetail) []github.ReviewCommentDetail
AggregateDetails flattens detail slices from multiple repos.
func BuildAnalysisPrompt ¶
func BuildAnalysisPrompt(groups []ReviewerGroup) string
BuildAnalysisPrompt builds the prompt for Claude to analyze review patterns.
func EstimateTokenCount ¶
EstimateTokenCount estimates the token count for a prompt using ~4 chars per token.
func FilterDetailsByReviewers ¶
func FilterDetailsByReviewers(details []github.ReviewCommentDetail, reviewers []*github.UserActivity) []github.ReviewCommentDetail
FilterDetailsByReviewers keeps only comments from the given reviewer logins.
func FormatMarkdownReport ¶
func FormatMarkdownReport(analysis string, detailsPath string, totalComments int, reviewers []string) string
FormatMarkdownReport formats the analysis into a markdown report.
func ResolveOrgAndRepos ¶
ResolveOrgAndRepos resolves the org and repos from flags or git remote.
func TopN ¶
func TopN(activities []*github.UserActivity, n int) ([]*github.UserActivity, error)
TopN returns the top n activities. Returns an error if n <= 0.
func WriteDetailsJSON ¶
func WriteDetailsJSON(details []github.ReviewCommentDetail, path string, org string, since time.Time, totalRepos int) error
WriteDetailsJSON writes the details JSON output file.
func WritePRRankingsCSV ¶
func WritePRRankingsCSV(rankings []PRRankingRow, path string) (err error)
WritePRRankingsCSV writes the PR rankings CSV file.
Types ¶
type DetailsJSON ¶
type DetailsJSON struct {
Metadata DetailsMetadata `json:"metadata"`
Comments []github.ReviewCommentDetail `json:"comments"`
}
DetailsJSON is the structure of the details output file.
type DetailsMetadata ¶
type DetailsMetadata struct {
Organization string `json:"organization"`
Since string `json:"since,omitempty"`
AnalyzedAt string `json:"analyzedAt"`
TotalRepos int `json:"totalReposAnalyzed"`
TotalComments int `json:"totalComments"`
}
DetailsMetadata is the metadata section of the details JSON.
type Options ¶
type Options struct {
Org string
Repos []string
Top int
Since time.Time
OutputPath string
MaxComments int
AnalyzeModel string
PromptModel string
IncludeAttribution bool
}
Options holds the configuration for a build-prompt run.
type OutputPaths ¶
OutputPaths holds the derived file paths for build-prompt outputs.
func DeriveOutputPaths ¶
func DeriveOutputPaths(outputPath string) OutputPaths
DeriveOutputPaths computes the intermediate output file paths.
type PRRankingRow ¶
type PRRankingRow struct {
Rank int
Repo string
PRNumber int
PRTitle string
PRAuthor string
PRURL string
TotalComments int
ReviewerCount int
State string
}
PRRankingRow is a row in the PR rankings CSV.
func AggregatePRRankings ¶
func AggregatePRRankings(details []github.ReviewCommentDetail) []PRRankingRow
AggregatePRRankings computes PR rankings sorted by total comments descending.
type ReviewCommentWithContext ¶
type ReviewCommentWithContext struct {
Reviewer string
Body string
DiffHunk string
CreatedAt string
Repo string
PR *PRContext
}
ReviewCommentWithContext is a comment with repo context for analysis.
type ReviewerGroup ¶
type ReviewerGroup struct {
Reviewer string
Comments []ReviewCommentWithContext
TotalComments int
}
ReviewerGroup groups comments by reviewer for analysis.
func GroupByReviewer ¶
func GroupByReviewer(comments []github.ReviewCommentDetail) []ReviewerGroup
GroupByReviewer groups comments by reviewer login.
func LimitCommentsPerReviewer ¶
func LimitCommentsPerReviewer(groups []ReviewerGroup, maxComments int) []ReviewerGroup
LimitCommentsPerReviewer limits each reviewer group to the most recent N comments.