Documentation
¶
Overview ¶
Package pr provides PR workflow orchestration for spectr change proposals.
This package handles the complete workflow for creating pull requests from spectr changes, including:
- Commit message templating for both archive and new proposal modes
- PR body generation with structured markdown
- Change metadata extraction for use in templates
The package supports two primary modes:
Archive mode: Creates PRs for completed changes that are being archived, including spec delta counts and updated capability information.
New mode: Creates PRs for new change proposals ready for team review, including proposal structure and file listings.
Templates use Go's text/template package and are designed to produce conventional commit messages and well-structured PR bodies that integrate with GitHub, GitLab, Gitea, and other git hosting platforms.
Package pr provides platform-specific PR creation functions. This file handles GitHub (gh), GitLab (glab), Gitea (tea), and Bitbucket.
Package pr provides PR workflow orchestration for creating pull requests from spectr changes using git worktrees for isolation.
Index ¶
Constants ¶
const ( ModeArchive = "archive" ModeProposal = "proposal" ModeRemove = "remove" )
Mode constants for PR template rendering
Variables ¶
This section is empty.
Functions ¶
func GetPRTitle ¶
GetPRTitle returns the PR title for the given change ID and mode.
func RenderCommitMessage ¶
func RenderCommitMessage( data CommitTemplateData, ) (string, error)
RenderCommitMessage renders the appropriate commit message based on the mode.
func RenderPRBody ¶
func RenderPRBody( data PRTemplateData, ) (string, error)
RenderPRBody renders the appropriate PR body based on the mode.
Types ¶
type CommitTemplateData ¶
type CommitTemplateData struct {
ChangeID string // The change identifier
ArchivePath string // Full archive path (archive mode only)
Mode string // "archive" or "proposal"
// Counts tracks spec operation counts (archive mode only)
Counts archive.OperationCounts
}
CommitTemplateData holds data for rendering commit messages.
type PRConfig ¶
type PRConfig struct {
ChangeID string // The change ID to create PR for
Mode string // "archive" or "proposal"
BaseBranch string // Target branch for PR (optional, auto-detect if empty)
Draft bool // Create as draft PR
Force bool // Delete existing remote branch if present
DryRun bool // Show what would be done without executing
SkipSpecs bool // For archive mode: pass --skip-specs to archive command
ProjectRoot string // Project root directory (for source change)
}
PRConfig contains configuration for the PR workflow.
type PRResult ¶
type PRResult struct {
PRURL string // URL of created PR
BranchName string // Branch name created
ArchivePath string // Archive path (archive mode only)
Counts archive.OperationCounts // Operation counts (archive mode only)
Capabilities []string // Updated capabilities (archive mode only)
Platform git.Platform // Detected platform
ManualURL string // Manual PR creation URL (Bitbucket)
}
PRResult contains the result of the PR workflow.
type PRTemplateData ¶
type PRTemplateData struct {
ChangeID string // The change identifier
ArchivePath string // Full archive path (archive mode only)
Capabilities []string // Updated capability names (archive mode only)
Mode string // "archive" or "new"
// Counts tracks spec operation counts (archive mode only)
Counts archive.OperationCounts
}
PRTemplateData holds data for rendering PR bodies.