forge

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package forge provides interfaces and implementations for interacting with various forge platforms.

Index

Constants

View Source
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

View Source
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")
	ErrUnauthorized     = errors.New("unauthorized access to 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 NewGitHub

func NewGitHub() *GitHub

NewGitHub creates a new GitHub forge instance.

func (*GitHub) GenerateBranchName

func (g *GitHub) GenerateBranchName(issueInfo *issue.Info) string

GenerateBranchName generates branch name from issue information.

func (*GitHub) GetIssueInfo

func (g *GitHub) GetIssueInfo(issueRef string) (*issue.Info, error)

GetIssueInfo fetches issue information from GitHub API.

func (*GitHub) Name

func (g *GitHub) Name() string

Name returns the name of the forge.

func (*GitHub) ParseIssueReference

func (g *GitHub) ParseIssueReference(issueRef string) (*issue.Reference, error)

ParseIssueReference parses various issue reference formats.

func (*GitHub) ValidateForgeRepository

func (g *GitHub) ValidateForgeRepository(repoPath string) error

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

func NewManager(logger logger.Logger, statusManager status.Manager) *Manager

NewManager creates a new forge manager with registered forge implementations.

func (*Manager) GetForgeForRepository

func (m *Manager) GetForgeForRepository(repoName string) (Forge, error)

GetForgeForRepository returns the appropriate forge for the given repository.

type ManagerInterface

type ManagerInterface interface {
	// GetForgeForRepository returns the appropriate forge for the given repository
	GetForgeForRepository(repoName string) (Forge, error)
}

ManagerInterface defines the interface for forge management.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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