Documentation
¶
Overview ¶
Package forge provides interfaces and implementations for interacting with various forge platforms.
Package forge is a generated GoMock package.
Index ¶
- Constants
- Variables
- type Forge
- type GitHub
- func (g *GitHub) GenerateBranchName(issueInfo *issue.Info) string
- func (g *GitHub) GetIssueInfo(issueRef string) (*issue.Info, error)
- func (g *GitHub) Name() string
- func (g *GitHub) ParseIssueReference(issueRef string) (*issue.Reference, error)
- func (g *GitHub) ValidateForgeRepository(repoPath string) error
- type Manager
- type ManagerInterface
- type MockForge
- func (m *MockForge) EXPECT() *MockForgeMockRecorder
- func (m *MockForge) GenerateBranchName(issueInfo *issue.Info) string
- func (m *MockForge) GetIssueInfo(issueRef string) (*issue.Info, error)
- func (m *MockForge) Name() string
- func (m *MockForge) ParseIssueReference(issueRef string) (*issue.Reference, error)
- func (m *MockForge) ValidateForgeRepository(repoPath string) error
- type MockForgeMockRecorder
- func (mr *MockForgeMockRecorder) GenerateBranchName(issueInfo any) *gomock.Call
- func (mr *MockForgeMockRecorder) GetIssueInfo(issueRef any) *gomock.Call
- func (mr *MockForgeMockRecorder) Name() *gomock.Call
- func (mr *MockForgeMockRecorder) ParseIssueReference(issueRef any) *gomock.Call
- func (mr *MockForgeMockRecorder) ValidateForgeRepository(repoPath any) *gomock.Call
- type MockManagerInterface
- type MockManagerInterfaceMockRecorder
Constants ¶
const ( // GitHubName is the name identifier for GitHub forge. GitHubName = "github" // GitHubDomain is the GitHub domain for URL validation. GitHubDomain = "github.com" // MaxTitleLength is the maximum length for sanitized issue titles in branch names. MaxTitleLength = 80 )
Variables ¶
var ( ErrUnsupportedForge = errors.New("unsupported forge") ErrIssueNotFound = errors.New("issue not found") ErrIssueClosed = errors.New("issue is closed, only open issues are supported") ErrInvalidIssueRef = errors.New("invalid issue reference format") ErrRateLimited = errors.New("rate limited by forge API") )
Forge-specific errors.
Functions ¶
This section is empty.
Types ¶
type Forge ¶
type Forge interface { // Name returns the name of the forge Name() string // GetIssueInfo fetches issue information from the forge GetIssueInfo(issueRef string) (*issue.Info, error) // ValidateForgeRepository validates that repository has supported forge remote origin ValidateForgeRepository(repoPath string) error // ParseIssueReference parses various issue reference formats ParseIssueReference(issueRef string) (*issue.Reference, error) // GenerateBranchName generates branch name from issue information GenerateBranchName(issueInfo *issue.Info) string }
Forge interface defines the methods that all forge implementations must provide.
type GitHub ¶
type GitHub struct {
// contains filtered or unexported fields
}
GitHub represents the GitHub forge implementation.
func (*GitHub) GenerateBranchName ¶
GenerateBranchName generates branch name from issue information.
func (*GitHub) GetIssueInfo ¶
GetIssueInfo fetches issue information from GitHub API.
func (*GitHub) ParseIssueReference ¶
ParseIssueReference parses various issue reference formats.
func (*GitHub) ValidateForgeRepository ¶
ValidateForgeRepository validates that repository has GitHub remote origin.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages forge implementations and provides a unified interface.
func NewManager ¶
NewManager creates a new forge manager with registered forge implementations.
type ManagerInterface ¶
type ManagerInterface interface { // GetForge returns the forge implementation for the given name GetForge(name string) (Forge, error) // GetForgeForRepository returns the appropriate forge for the given repository GetForgeForRepository(repoPath string) (Forge, error) }
ManagerInterface defines the interface for forge management.
type MockForge ¶
type MockForge struct {
// contains filtered or unexported fields
}
MockForge is a mock of Forge interface.
func NewMockForge ¶
func NewMockForge(ctrl *gomock.Controller) *MockForge
NewMockForge creates a new mock instance.
func (*MockForge) EXPECT ¶
func (m *MockForge) EXPECT() *MockForgeMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockForge) GenerateBranchName ¶
GenerateBranchName mocks base method.
func (*MockForge) GetIssueInfo ¶
GetIssueInfo mocks base method.
func (*MockForge) ParseIssueReference ¶
ParseIssueReference mocks base method.
func (*MockForge) ValidateForgeRepository ¶
ValidateForgeRepository mocks base method.
type MockForgeMockRecorder ¶
type MockForgeMockRecorder struct {
// contains filtered or unexported fields
}
MockForgeMockRecorder is the mock recorder for MockForge.
func (*MockForgeMockRecorder) GenerateBranchName ¶
func (mr *MockForgeMockRecorder) GenerateBranchName(issueInfo any) *gomock.Call
GenerateBranchName indicates an expected call of GenerateBranchName.
func (*MockForgeMockRecorder) GetIssueInfo ¶
func (mr *MockForgeMockRecorder) GetIssueInfo(issueRef any) *gomock.Call
GetIssueInfo indicates an expected call of GetIssueInfo.
func (*MockForgeMockRecorder) Name ¶
func (mr *MockForgeMockRecorder) Name() *gomock.Call
Name indicates an expected call of Name.
func (*MockForgeMockRecorder) ParseIssueReference ¶
func (mr *MockForgeMockRecorder) ParseIssueReference(issueRef any) *gomock.Call
ParseIssueReference indicates an expected call of ParseIssueReference.
func (*MockForgeMockRecorder) ValidateForgeRepository ¶
func (mr *MockForgeMockRecorder) ValidateForgeRepository(repoPath any) *gomock.Call
ValidateForgeRepository indicates an expected call of ValidateForgeRepository.
type MockManagerInterface ¶
type MockManagerInterface struct {
// contains filtered or unexported fields
}
MockManagerInterface is a mock of ManagerInterface interface.
func NewMockManagerInterface ¶
func NewMockManagerInterface(ctrl *gomock.Controller) *MockManagerInterface
NewMockManagerInterface creates a new mock instance.
func (*MockManagerInterface) EXPECT ¶
func (m *MockManagerInterface) EXPECT() *MockManagerInterfaceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockManagerInterface) GetForge ¶
func (m *MockManagerInterface) GetForge(name string) (Forge, error)
GetForge mocks base method.
func (*MockManagerInterface) GetForgeForRepository ¶
func (m *MockManagerInterface) GetForgeForRepository(repoPath string) (Forge, error)
GetForgeForRepository mocks base method.
type MockManagerInterfaceMockRecorder ¶
type MockManagerInterfaceMockRecorder struct {
// contains filtered or unexported fields
}
MockManagerInterfaceMockRecorder is the mock recorder for MockManagerInterface.
func (*MockManagerInterfaceMockRecorder) GetForge ¶
func (mr *MockManagerInterfaceMockRecorder) GetForge(name any) *gomock.Call
GetForge indicates an expected call of GetForge.
func (*MockManagerInterfaceMockRecorder) GetForgeForRepository ¶
func (mr *MockManagerInterfaceMockRecorder) GetForgeForRepository(repoPath any) *gomock.Call
GetForgeForRepository indicates an expected call of GetForgeForRepository.