Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SortedDays ¶
func SortedDays(byDay map[string]*ActivityResult) []string
SortedDays returns the day keys from ByDay in chronological order.
Types ¶
type ActivityMetadata ¶
type ActivityMetadata struct {
Since time.Time `json:"since"`
Until time.Time `json:"until"`
PRCount int `json:"pr_count"`
IssueCount int `json:"issue_count"`
CommitCount int `json:"commit_count"`
}
ActivityMetadata records the query parameters and result counts.
type ActivityResult ¶
type ActivityResult struct {
PRClusters []PRCluster `json:"-"`
StandaloneIssues []StandaloneIssue `json:"-"`
StandaloneCommits []StandaloneCommit `json:"-"`
Metadata ActivityMetadata `json:"-"`
}
ActivityResult contains assembled GitHub activity grouped by cluster type. Use MarshalEventClusters() to produce the flat JSON array for the extractor.
func AssembleActivity ¶
func AssembleActivity(ctx context.Context, s *store.Store, since, until time.Time) (*ActivityResult, error)
AssembleActivity queries CodeDB for GitHub activity within the given time window and returns structured event clusters for the fact extractor.
func (*ActivityResult) ByDay ¶
func (r *ActivityResult) ByDay() map[string]*ActivityResult
ByDay partitions the ActivityResult into per-day buckets keyed by YYYY-MM-DD. Primary timestamps: PRCluster uses MergedAt (if set) else UpdatedAt; StandaloneIssue uses UpdatedAt; StandaloneCommit uses Timestamp. Items with unparseable timestamps go into today's bucket.
func (*ActivityResult) MarshalEventClusters ¶
func (r *ActivityResult) MarshalEventClusters() ([]byte, error)
MarshalEventClusters produces a flat JSON array of event clusters with type discriminators, matching the extractor input spec.
type Comment ¶
type Comment struct {
Author string `json:"author"`
Body string `json:"body"`
CreatedAt string `json:"created_at"`
}
Comment is a discussion comment (PR or issue).
type CommitEntry ¶
type CommitEntry struct {
SHA string `json:"sha"`
Message *string `json:"message"`
Author *string `json:"author"`
Timestamp *string `json:"timestamp"`
}
CommitEntry is a commit linked to a PR or standalone. Fields may be nil when commit metadata is unavailable (squash/rebase).
type PRCluster ¶
type PRCluster struct {
Number int `json:"number"`
Title string `json:"title"`
Description string `json:"description"`
Author string `json:"author"`
Status string `json:"status"`
MergedAt *string `json:"merged_at,omitempty"`
UpdatedAt *string `json:"-"` // internal: for per-day bucketing
URL string `json:"url"`
Labels []string `json:"labels,omitempty"`
Commits []CommitEntry `json:"commits"`
Reviews []ReviewGroup `json:"reviews"`
DiscussionComments []Comment `json:"discussion_comments"`
}
PRCluster represents a pull request with its associated comments and commits.
type ReviewComment ¶
type ReviewComment struct {
Body string `json:"body"`
Path *string `json:"path"`
Line *int `json:"line"`
}
ReviewComment is a single code review comment with optional file location.
type ReviewGroup ¶
type ReviewGroup struct {
Reviewer string `json:"reviewer"`
Comments []ReviewComment `json:"comments"`
}
ReviewGroup groups review comments by reviewer.
type StandaloneCommit ¶
type StandaloneCommit struct {
SHA string `json:"sha"`
Message string `json:"message"`
Author string `json:"author"`
Timestamp string `json:"timestamp"`
}
StandaloneCommit is a commit not linked to any PR.
type StandaloneIssue ¶
type StandaloneIssue struct {
Number int `json:"number"`
Title string `json:"title"`
Body string `json:"body"`
Author string `json:"author"`
State string `json:"state"`
UpdatedAt *string `json:"-"` // internal: for per-day bucketing
URL string `json:"url"`
Comments []Comment `json:"comments"`
}
StandaloneIssue is an issue not referenced by any PR in the window.
type TriageOpts ¶ added in v0.10.1
type TriageOpts struct {
Limit int // default 20
Sort string // "stalled" (default — most-idle first), "age" (oldest first), "activity" (most comments first)
State string // "open" (default), "closed", "merged", "all"
}
TriageOpts configures PR triage queries.
type TriagedPR ¶ added in v0.10.1
type TriagedPR struct {
Number int `json:"number"`
Title string `json:"title"`
Author string `json:"author,omitempty"`
URL string `json:"url,omitempty"`
Labels []string `json:"labels,omitempty"`
State string `json:"state"`
AgeDays int `json:"age_days"` // days since created_at
StalledDays int `json:"stalled_days"` // days since max(updated_at, last comment created_at)
Comments int `json:"comments"` // total pr_comments rows
Reviewers int `json:"reviewers"` // distinct comment authors with path != NULL (code reviews)
Discussants int `json:"discussants"` // distinct comment authors with path = NULL (discussion)
Commits int `json:"commits"` // pr_commits rows
}
TriagedPR is the agent-facing summary of a pull request with deterministic ranking signals attached. All signals are computed from indexed GitHub data (pull_requests, pr_comments, pr_commits) — no LLM ranking, no external API.
func TriagePRs ¶ added in v0.10.1
TriagePRs returns ranked pull-request summaries for triage. Deterministic: the same inputs always produce the same ranking; no LLM scoring. Default behavior surfaces the most-stalled open PRs (those an agent or human should look at first because they've been idle longest).