Documentation
¶
Index ¶
- func ApproversFromJSON(jsonStr string) []string
- func ApproversToJSON(approvers []string) string
- func CheckAndResolveComments(ctx context.Context, proj *project.Project, workID string) error
- func GetBeadType(feedbackType github.FeedbackType) string
- func ProcessPRFeedback(ctx context.Context, proj *project.Project, database *db.DB, workID string) (int, error)
- func ResolveFeedbackForBeads(ctx context.Context, database *db.DB, beadClient *beads.Client, workID string, ...) error
- func UpdatePRStatusIfChanged(ctx context.Context, database *db.DB, work *db.Work, newStatus *PRStatusInfo, ...) bool
- type BeadInfo
- type DefaultProcessor
- type FeedbackProcessor
- type FeedbackProcessorMock
- type Integration
- func (i *Integration) CreateBeadFromFeedback(ctx context.Context, beadDir string, beadInfo BeadInfo) (string, error)
- func (i *Integration) ExtractPRStatus(ctx context.Context, prURL string) (*PRStatusInfo, error)
- func (i *Integration) FetchAndStoreFeedback(ctx context.Context, prURL string) ([]github.FeedbackItem, error)
- type PRStatusInfo
- type Processor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApproversFromJSON ¶
ApproversFromJSON parses a JSON string into a list of approvers.
func ApproversToJSON ¶
ApproversToJSON converts a list of approvers to a JSON string.
func CheckAndResolveComments ¶
CheckAndResolveComments checks for feedback items and resolves those with closed beads.
func GetBeadType ¶
func GetBeadType(feedbackType github.FeedbackType) string
GetBeadType converts a feedback type to a bead type string.
func ProcessPRFeedback ¶
func ProcessPRFeedback(ctx context.Context, proj *project.Project, database *db.DB, workID string) (int, error)
ProcessPRFeedback processes PR feedback for a work and creates beads. This is an internal function that can be called directly. Returns the number of beads created and any error.
func ResolveFeedbackForBeads ¶
func ResolveFeedbackForBeads(ctx context.Context, database *db.DB, beadClient *beads.Client, workID string, closedBeadIDs []string) error
ResolveFeedbackForBeads posts resolution comments on GitHub for closed beads. It checks the provided beads and posts resolution comments for any associated unresolved feedback items. Uses the transactional outbox pattern: atomically marks feedback as resolved and schedules comment tasks, then attempts optimistic execution.
func UpdatePRStatusIfChanged ¶
func UpdatePRStatusIfChanged(ctx context.Context, database *db.DB, work *db.Work, newStatus *PRStatusInfo, quiet bool) bool
UpdatePRStatusIfChanged compares the new PR status with the stored status and updates the database if anything changed. Returns true if status changed.
Types ¶
type BeadInfo ¶
type BeadInfo struct {
Title string
Description string
Type string // task, bug, feature
Priority int // 0-4
ParentID string // Parent issue ID (root_issue_id)
Labels []string
SourceURL string // GitHub URL for external reference generation
}
BeadInfo represents information for creating a bead from feedback.
type DefaultProcessor ¶
type DefaultProcessor struct{}
DefaultProcessor implements Processor using the actual feedback processing logic.
type FeedbackProcessor ¶
type FeedbackProcessor struct {
// contains filtered or unexported fields
}
FeedbackProcessor processes PR feedback and generates actionable items.
func NewFeedbackProcessor ¶
func NewFeedbackProcessor(client github.ClientInterface) *FeedbackProcessor
NewFeedbackProcessor creates a new feedback processor.
func NewFeedbackProcessorWithProject ¶
func NewFeedbackProcessorWithProject(client github.ClientInterface, proj *project.Project, workID string) *FeedbackProcessor
NewFeedbackProcessorWithProject creates a feedback processor with project context. This enables Claude-based log analysis when configured.
func (*FeedbackProcessor) ProcessPRFeedback ¶
func (p *FeedbackProcessor) ProcessPRFeedback(ctx context.Context, prURL string) ([]github.FeedbackItem, error)
ProcessPRFeedback fetches and processes feedback for a PR.
type FeedbackProcessorMock ¶
type FeedbackProcessorMock struct {
// ProcessPRFeedbackFunc mocks the ProcessPRFeedback method.
ProcessPRFeedbackFunc func(ctx context.Context, proj *project.Project, database *db.DB, workID string) (int, error)
// contains filtered or unexported fields
}
FeedbackProcessorMock is a mock implementation of Processor.
func TestSomethingThatUsesProcessor(t *testing.T) {
// make and configure a mocked Processor
mockedProcessor := &FeedbackProcessorMock{
ProcessPRFeedbackFunc: func(ctx context.Context, proj *project.Project, database *db.DB, workID string) (int, error) {
panic("mock out the ProcessPRFeedback method")
},
}
// use mockedProcessor in code that requires Processor
// and then make assertions.
}
func (*FeedbackProcessorMock) ProcessPRFeedback ¶
func (mock *FeedbackProcessorMock) ProcessPRFeedback(ctx context.Context, proj *project.Project, database *db.DB, workID string) (int, error)
ProcessPRFeedback calls ProcessPRFeedbackFunc.
func (*FeedbackProcessorMock) ProcessPRFeedbackCalls ¶
func (mock *FeedbackProcessorMock) ProcessPRFeedbackCalls() []struct { Ctx context.Context Proj *project.Project Database *db.DB WorkID string }
ProcessPRFeedbackCalls gets all the calls that were made to ProcessPRFeedback. Check the length with:
len(mockedProcessor.ProcessPRFeedbackCalls())
type Integration ¶
type Integration struct {
// contains filtered or unexported fields
}
Integration handles the integration between GitHub PR feedback and beads.
func NewIntegrationWithProject ¶
func NewIntegrationWithProject(proj *project.Project, workID string) *Integration
NewIntegrationWithProject creates a new feedback integration with project context. This enables Claude-based log analysis when configured.
func (*Integration) CreateBeadFromFeedback ¶
func (i *Integration) CreateBeadFromFeedback(ctx context.Context, beadDir string, beadInfo BeadInfo) (string, error)
CreateBeadFromFeedback creates a bead using the beads package with proper input validation.
func (*Integration) ExtractPRStatus ¶
func (i *Integration) ExtractPRStatus(ctx context.Context, prURL string) (*PRStatusInfo, error)
ExtractPRStatus fetches a PR and extracts CI and approval status.
func (*Integration) FetchAndStoreFeedback ¶
func (i *Integration) FetchAndStoreFeedback(ctx context.Context, prURL string) ([]github.FeedbackItem, error)
FetchAndStoreFeedback fetches PR feedback and returns actionable items.
type PRStatusInfo ¶
type PRStatusInfo struct {
CIStatus string // pending, success, failure
ApprovalStatus string // pending, approved, changes_requested
Approvers []string // List of usernames who approved
PRState string // open, closed, merged
MergeableState string // CLEAN, DIRTY, BLOCKED, BEHIND, DRAFT, UNSTABLE, UNKNOWN
}
PRStatusInfo represents the extracted PR status information.
func ExtractStatusFromPRStatus ¶
func ExtractStatusFromPRStatus(status *github.PRStatus) *PRStatusInfo
ExtractStatusFromPRStatus extracts CI and approval status from a PRStatus object.
type Processor ¶
type Processor interface {
// ProcessPRFeedback processes PR feedback for a work and creates beads.
// Returns the number of beads created and any error.
ProcessPRFeedback(ctx context.Context, proj *project.Project, database *db.DB, workID string) (int, error)
}
Processor defines the interface for processing PR feedback. This abstraction enables testing without actual GitHub API calls.
func NewProcessor ¶
func NewProcessor() Processor
NewProcessor creates a new default Processor implementation.