feedback

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const FeedbackMarker = "<!-- manque-feedback:"

FeedbackMarker is the HTML comment marker for storing feedback in PR body

Variables

This section is empty.

Functions

func CreateFeedbackMarker

func CreateFeedbackMarker(entries []FeedbackEntry) string

CreateFeedbackMarker creates the HTML comment with feedback data

func StripFeedbackMarker

func StripFeedbackMarker(body string) string

StripFeedbackMarker removes the feedback marker from a PR body

Types

type FeedbackEntry

type FeedbackEntry struct {
	CommentHash string       `json:"comment_hash"`
	Type        FeedbackType `json:"type"`
	Repository  string       `json:"repository"`
	PRNumber    int          `json:"pr_number"`
	FilePath    string       `json:"file_path"`
	Line        int          `json:"line"`
	IssueType   string       `json:"issue_type"` // bug, security, style, etc.
	IsCritical  bool         `json:"is_critical"`
	RecordedAt  time.Time    `json:"recorded_at"`
	UserComment string       `json:"user_comment,omitempty"` // Optional user explanation
}

FeedbackEntry represents a single feedback entry

func ExtractFeedbackFromBody

func ExtractFeedbackFromBody(body string) []FeedbackEntry

ExtractFeedbackFromBody extracts feedback data from a PR body

type FeedbackStats

type FeedbackStats struct {
	TotalComments    int                   `json:"total_comments"`
	AcceptedCount    int                   `json:"accepted_count"`
	DismissedCount   int                   `json:"dismissed_count"`
	ResolvedCount    int                   `json:"resolved_count"`
	IgnoredCount     int                   `json:"ignored_count"`
	AcceptanceRate   float64               `json:"acceptance_rate"`
	ByIssueType      map[string]IssueStats `json:"by_issue_type"`
	ByRepository     map[string]RepoStats  `json:"by_repository"`
	CommonDismissals []string              `json:"common_dismissals"`
	UpdatedAt        time.Time             `json:"updated_at"`
}

FeedbackStats represents aggregated feedback statistics

type FeedbackType

type FeedbackType string

FeedbackType represents the type of feedback

const (
	FeedbackAccepted   FeedbackType = "accepted"    // Suggestion was applied
	FeedbackDismissed  FeedbackType = "dismissed"   // User dismissed the issue
	FeedbackResolved   FeedbackType = "resolved"    // Issue was fixed
	FeedbackThumbsUp   FeedbackType = "thumbs_up"   // User liked the comment
	FeedbackThumbsDown FeedbackType = "thumbs_down" // User disliked the comment
	FeedbackModified   FeedbackType = "modified"    // User modified the suggestion
	FeedbackIgnored    FeedbackType = "ignored"     // User didn't act on it
)

type IssueStats

type IssueStats struct {
	Total          int     `json:"total"`
	Accepted       int     `json:"accepted"`
	Dismissed      int     `json:"dismissed"`
	AcceptanceRate float64 `json:"acceptance_rate"`
}

IssueStats represents stats for a specific issue type

type RepoStats

type RepoStats struct {
	Total          int     `json:"total"`
	Accepted       int     `json:"accepted"`
	Dismissed      int     `json:"dismissed"`
	AcceptanceRate float64 `json:"acceptance_rate"`
}

RepoStats represents stats for a specific repository

type Tracker

type Tracker struct {
	Repository string
	PRNumber   int
	Entries    []FeedbackEntry
}

Tracker manages feedback collection and storage

func NewTracker

func NewTracker(repository string, prNumber int) *Tracker

NewTracker creates a new feedback tracker

func (*Tracker) GetLearnings

func (t *Tracker) GetLearnings() string

GetLearnings generates insights from the feedback for improving reviews

func (*Tracker) GetStats

func (t *Tracker) GetStats() *FeedbackStats

GetStats computes statistics from recorded feedback

func (*Tracker) LoadFromBody

func (t *Tracker) LoadFromBody(body string)

LoadFromBody loads existing feedback from PR body and adds to tracker

func (*Tracker) RecordAcceptance

func (t *Tracker) RecordAcceptance(commentHash, filePath string, line int, issueType string, critical bool)

RecordAcceptance records that a suggestion was accepted

func (*Tracker) RecordDismissal

func (t *Tracker) RecordDismissal(commentHash, filePath string, line int, issueType string, reason string)

RecordDismissal records that an issue was dismissed

func (*Tracker) RecordFeedback

func (t *Tracker) RecordFeedback(entry FeedbackEntry)

RecordFeedback records a new feedback entry

func (*Tracker) RecordReaction

func (t *Tracker) RecordReaction(commentHash string, isPositive bool)

RecordReaction records a thumbs up/down reaction

func (*Tracker) RecordResolution

func (t *Tracker) RecordResolution(commentHash, filePath string, line int, issueType string)

RecordResolution records that an issue was resolved (fixed by user)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL