pr

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package pr hosts reusable helpers for the pull request workflows that power the `magi pr` command. It includes prompt builders, AGENTS guideline loaders, and the AgenticReviewer used in cmd/pr.go so commands can share hardened logic without reimplementing multi-agent orchestration or sanitization steps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectAgentGuidelines

func CollectAgentGuidelines(root string) (string, error)

CollectAgentGuidelines aggregates every AGENTS.md file discovered under root.

func FormatFindingsComment

func FormatFindingsComment(findings AgentFindings) string

FormatFindingsComment produces a markdown comment from analysis findings.

func LoadPullRequestTemplate

func LoadPullRequestTemplate(path string) (string, error)

LoadPullRequestTemplate returns the contents of the GitHub pull request template.

Types

type AgentFindings

type AgentFindings struct {
	Summary               string   `json:"summary"`
	CodeSmells            []string `json:"code_smells"`
	SecurityConcerns      []string `json:"security_concerns"`
	AgentsGuidelineAlerts []string `json:"agents_guideline_alerts"`
	TestRecommendations   []string `json:"test_recommendations"`
	DocumentationUpdates  []string `json:"documentation_updates"`
	RiskCallouts          []string `json:"risk_callouts"`
}

AgentFindings captures the structured response from the analysis agent.

type AgenticReviewer

type AgenticReviewer struct {
	// contains filtered or unexported fields
}

AgenticReviewer orchestrates the AgenticGoKit workflow for PR prep.

func NewAgenticReviewer

func NewAgenticReviewer(runtime *shared.RuntimeContext) *AgenticReviewer

NewAgenticReviewer creates a reviewer bound to the shared runtime context.

func (*AgenticReviewer) Review

func (r *AgenticReviewer) Review(ctx context.Context, input ReviewInput) (*ReviewArtifacts, error)

Review executes the multi-agent workflow and returns structured artifacts.

type PullRequestPlan

type PullRequestPlan struct {
	Title string `json:"title"`
	Body  string `json:"body"`
}

PullRequestPlan stores the generated title and filled template.

type ReviewArtifacts

type ReviewArtifacts struct {
	Analysis AgentFindings
	Plan     PullRequestPlan
}

ReviewArtifacts groups the analysis findings with the final PR plan.

type ReviewInput

type ReviewInput struct {
	Diff              string
	Branch            string
	RemoteRef         string
	Guidelines        string
	AdditionalContext string
	Template          string
}

ReviewInput encapsulates the information sent to the analysis workflow.

Jump to

Keyboard shortcuts

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