pr

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(opts PROptions) (string, error)

Create creates a GitHub PR using the gh CLI with full options support

func CreatePR

func CreatePR(title, body, branch string) (string, error)

CreatePR creates a GitHub PR using the gh CLI (legacy wrapper)

func CreatePRDraft

func CreatePRDraft(title, body, branch string) (string, error)

CreatePRDraft creates a draft GitHub PR using the gh CLI (legacy wrapper)

func CreateStackedPR

func CreateStackedPR(opts PROptions, baseBranch string) (string, error)

CreateStackedPR creates a GitHub PR with a specific base branch (for stacked PRs) This allows creating PRs that target a branch other than the repository default

func ExtractIssueReference

func ExtractIssueReference(text string) string

ExtractIssueReference extracts issue references from text Supports formats: #123, fixes #123, closes #123, resolves #123

func FormatClosesClause

func FormatClosesClause(issues []string) string

FormatClosesClause formats issue references for PR body

func RenderTemplate

func RenderTemplate(tmplStr string, data TemplateData) (string, error)

RenderTemplate renders a custom PR body template with the given data

func ResolveReviewers

func ResolveReviewers(changedFiles []string, defaultReviewers []string, byPath map[string][]string) []string

ResolveReviewers determines reviewers based on changed files and config

Types

type Context

type Context struct {
	Task         string
	Branch       string
	Diff         string
	CommitLog    string
	ChangedFiles []string
	InstanceID   string
}

Context holds all the information needed to generate PR content

type Generator

type Generator struct{}

Generator creates PR content using Claude

func New

func New() *Generator

New creates a new PR generator

func (*Generator) Generate

func (g *Generator) Generate(ctx Context) (*PRContent, error)

Generate uses Claude to create PR content from the provided context

type PRContent

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

PRContent holds the generated PR title and body

type PROptions

type PROptions struct {
	Title     string
	Body      string
	Branch    string
	Draft     bool
	Reviewers []string
	Labels    []string
}

PROptions contains options for PR creation

type TemplateData

type TemplateData struct {
	// AISummary is the AI-generated summary (if available)
	AISummary string
	// Task is the original task description
	Task string
	// Branch is the branch name
	Branch string
	// ChangedFiles is a list of modified file paths
	ChangedFiles []string
	// CommitLog is the git commit history
	CommitLog string
	// LinkedIssue is any detected issue reference (e.g., "#42")
	LinkedIssue string
	// InstanceID is the Claudio instance identifier
	InstanceID string
}

TemplateData contains all data available to PR templates

Jump to

Keyboard shortcuts

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