Documentation
¶
Index ¶
- Constants
- func ComputeCommentHash(file string, startLine, endLine int, content string) string
- func CountCommits(baseBranch, headSHA string) (int, error)
- func CreateSessionMarker(session *Session) string
- func CreateStateMarker(state *ReviewState) string
- func GetCommitRange(baseSHA, headSHA string) ([]string, error)
- func GetIncrementalDiff(lastReviewedSHA, currentSHA string) (string, error)
- func StripSessionMarker(body string) string
- func StripStateMarker(body string) string
- type DismissedIssue
- type Interaction
- type ReviewRecord
- type ReviewState
- type Session
- func (s *Session) AddInteraction(interactionType string, commentID int64, content, botResponse string)
- func (s *Session) AddReviewRecord(sha string, commentHashes []string, score, issueCount int)
- func (s *Session) DismissIssue(hash, reason string)
- func (s *Session) GetPreviousCommentHashes() map[string]bool
- func (s *Session) GetSummary() string
- func (s *Session) IsDismissed(hash string) bool
- func (s *Session) MarkAddressed(hashes []string)
- func (s *Session) TrimSession(maxReviews int)
- func (s *Session) WasAddressed(hash string) bool
- type SessionManager
- type Tracker
Constants ¶
const PRStateMarker = "<!-- manque-state:"
PRStateMarker is the HTML comment marker used to store state in PR body
const SessionMarker = "<!-- manque-session:"
SessionMarker is the HTML comment marker used to store session data in PR body
Variables ¶
This section is empty.
Functions ¶
func ComputeCommentHash ¶
ComputeCommentHash generates a unique hash for a comment
func CountCommits ¶
CountCommits counts the number of commits in a PR
func CreateSessionMarker ¶
CreateSessionMarker creates the HTML comment with session data
func CreateStateMarker ¶
func CreateStateMarker(state *ReviewState) string
CreateStateMarker creates the HTML comment with state data
func GetCommitRange ¶
GetCommitRange gets the commits between two SHAs
func GetIncrementalDiff ¶
GetIncrementalDiff gets the diff between the last reviewed commit and current HEAD
func StripSessionMarker ¶
StripSessionMarker removes the session marker from a PR body
func StripStateMarker ¶
StripStateMarker removes the state marker from a PR body
Types ¶
type DismissedIssue ¶
type DismissedIssue struct {
Hash string `json:"hash"` // file:line:content hash
Reason string `json:"reason,omitempty"`
DismissedAt time.Time `json:"dismissed_at"`
}
DismissedIssue represents an issue the user explicitly dismissed
type Interaction ¶
type Interaction struct {
Type string `json:"type"` // "reply", "resolve", "dismiss", "command"
CommentID int64 `json:"comment_id,omitempty"`
Content string `json:"content,omitempty"`
Timestamp time.Time `json:"timestamp"`
BotReponse string `json:"bot_response,omitempty"`
}
Interaction represents a user interaction with the bot
type ReviewRecord ¶
type ReviewRecord struct {
SHA string `json:"sha"`
ReviewedAt time.Time `json:"reviewed_at"`
CommentHashes []string `json:"comment_hashes"` // SHA256 of file:line:content
Score int `json:"score"`
IssueCount int `json:"issue_count"`
Addressed []string `json:"addressed,omitempty"` // Hashes of issues fixed in subsequent commits
}
ReviewRecord represents a single review round
type ReviewState ¶
type ReviewState struct {
PRNumber int `json:"pr_number"`
Repository string `json:"repository"`
LastReviewedSHA string `json:"last_reviewed_sha"`
ReviewedAt time.Time `json:"reviewed_at"`
CommitCount int `json:"commit_count"`
}
ReviewState represents the state of a PR review
func ExtractStateFromBody ¶
func ExtractStateFromBody(body string) *ReviewState
ExtractStateFromBody extracts the review state from a PR body
type Session ¶
type Session struct {
PRNumber int `json:"pr_number"`
Repository string `json:"repository"`
Reviews []ReviewRecord `json:"reviews"`
Interactions []Interaction `json:"interactions"`
Dismissed []DismissedIssue `json:"dismissed"`
UpdatedAt time.Time `json:"updated_at"`
}
Session represents the accumulated review session data
func ExtractSessionFromBody ¶
ExtractSessionFromBody extracts the session from a PR body
func (*Session) AddInteraction ¶
func (s *Session) AddInteraction(interactionType string, commentID int64, content, botResponse string)
AddInteraction records a user interaction
func (*Session) AddReviewRecord ¶
AddReviewRecord adds a new review record to the session
func (*Session) DismissIssue ¶
DismissIssue marks an issue as dismissed
func (*Session) GetPreviousCommentHashes ¶
GetPreviousCommentHashes returns all comment hashes from previous reviews
func (*Session) GetSummary ¶
GetSummary returns a human-readable summary of the session
func (*Session) IsDismissed ¶
IsDismissed checks if an issue has been dismissed
func (*Session) MarkAddressed ¶
MarkAddressed marks issues as addressed in the previous review
func (*Session) TrimSession ¶
TrimSession removes old data to keep the marker size manageable
func (*Session) WasAddressed ¶
WasAddressed checks if an issue was marked as addressed
type SessionManager ¶
SessionManager handles session persistence and retrieval
func NewSessionManager ¶
func NewSessionManager(repository string, prNumber int) *SessionManager
NewSessionManager creates a new session manager
func (*SessionManager) GetOrCreateSession ¶
func (m *SessionManager) GetOrCreateSession(prBody string) *Session
GetOrCreateSession retrieves existing session or creates a new one
type Tracker ¶
Tracker manages incremental review state
func NewTracker ¶
NewTracker creates a new state tracker
func (*Tracker) CreateNewState ¶
func (t *Tracker) CreateNewState(currentSHA string, commitCount int) *ReviewState
CreateNewState creates a new review state
func (*Tracker) IsIncrementalReview ¶
func (t *Tracker) IsIncrementalReview(prBody, currentSHA string) (bool, *ReviewState)
IsIncrementalReview determines if this is an incremental review