vcs

package
v0.0.0-...-87e4b86 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package vcs provides interfaces and implementations for version control system interactions

Package vcs provides interfaces and implementations for version control system interactions

Package vcs provides interfaces and implementations for version control system interactions

Package vcs provides interfaces and implementations for version control system interactions

Package vcs provides interfaces and implementations for version control system interactions

Package vcs provides interfaces and implementations for version control system interactions

Package vcs provides interfaces and implementations for version control system interactions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseIssue

type BaseIssue struct {
	Owner     string
	Repo      string
	Number    int
	Title     string
	Body      string
	User      string
	State     string
	CreatedAt time.Time
	UpdatedAt time.Time
	URL       string
	Comments  []IssueComment
	Labels    []string
	Assignees []string
}

BaseIssue provides a common implementation of Issue

func (*BaseIssue) GetAssignees

func (i *BaseIssue) GetAssignees() []string

GetAssignees returns usernames of people assigned to the issue

func (*BaseIssue) GetBody

func (i *BaseIssue) GetBody() string

GetBody returns the issue body

func (*BaseIssue) GetComments

func (i *BaseIssue) GetComments() []IssueComment

GetComments returns the issue comments

func (*BaseIssue) GetCreatedAt

func (i *BaseIssue) GetCreatedAt() time.Time

GetCreatedAt returns the issue creation timestamp

func (*BaseIssue) GetLabels

func (i *BaseIssue) GetLabels() []string

GetLabels returns the issue labels

func (*BaseIssue) GetNumber

func (i *BaseIssue) GetNumber() int

GetNumber returns the issue number

func (*BaseIssue) GetOwner

func (i *BaseIssue) GetOwner() string

GetOwner returns the repository owner

func (*BaseIssue) GetRepo

func (i *BaseIssue) GetRepo() string

GetRepo returns the repository name

func (*BaseIssue) GetState

func (i *BaseIssue) GetState() string

GetState returns the issue state (open/closed)

func (*BaseIssue) GetTitle

func (i *BaseIssue) GetTitle() string

GetTitle returns the issue title

func (*BaseIssue) GetURL

func (i *BaseIssue) GetURL() string

GetURL returns the issue URL

func (*BaseIssue) GetUpdatedAt

func (i *BaseIssue) GetUpdatedAt() time.Time

GetUpdatedAt returns when the issue was last updated

func (*BaseIssue) GetUser

func (i *BaseIssue) GetUser() string

GetUser returns the issue creator username

type BasePullRequest

type BasePullRequest struct {
	Number     int
	Title      string
	Body       string
	State      string
	IsDraft    bool
	User       string
	HeadBranch string
	BaseBranch string
	URL        string
}

BasePullRequest provides a common implementation of PullRequest

func (*BasePullRequest) GetBaseBranch

func (p *BasePullRequest) GetBaseBranch() string

GetBaseBranch returns the base branch

func (*BasePullRequest) GetBody

func (p *BasePullRequest) GetBody() string

GetBody returns the PR body

func (*BasePullRequest) GetHeadBranch

func (p *BasePullRequest) GetHeadBranch() string

GetHeadBranch returns the head branch

func (*BasePullRequest) GetIsDraft

func (p *BasePullRequest) GetIsDraft() bool

GetIsDraft returns whether the PR is a draft

func (*BasePullRequest) GetNumber

func (p *BasePullRequest) GetNumber() int

GetNumber returns the PR number

func (*BasePullRequest) GetState

func (p *BasePullRequest) GetState() string

GetState returns the PR state (open/closed/merged)

func (*BasePullRequest) GetTitle

func (p *BasePullRequest) GetTitle() string

GetTitle returns the PR title

func (*BasePullRequest) GetURL

func (p *BasePullRequest) GetURL() string

GetURL returns the PR URL

func (*BasePullRequest) GetUser

func (p *BasePullRequest) GetUser() string

GetUser returns the username of the PR creator

type BaseRepository

type BaseRepository struct {
	Owner           string
	Name            string
	DefaultBranch   string
	URL             string
	Description     string
	HasIssues       bool
	StargazersCount int
	ForksCount      int
}

BaseRepository provides a common implementation of Repository

func (*BaseRepository) GetDefaultBranch

func (r *BaseRepository) GetDefaultBranch() string

GetDefaultBranch returns the default branch name

func (*BaseRepository) GetDescription

func (r *BaseRepository) GetDescription() string

GetDescription returns the repository description

func (*BaseRepository) GetForksCount

func (r *BaseRepository) GetForksCount() int

GetForksCount returns the number of forks

func (*BaseRepository) GetHasIssues

func (r *BaseRepository) GetHasIssues() bool

GetHasIssues returns whether the repository has issues enabled

func (*BaseRepository) GetName

func (r *BaseRepository) GetName() string

GetName returns the repository name

func (*BaseRepository) GetOwner

func (r *BaseRepository) GetOwner() string

GetOwner returns the repository owner

func (*BaseRepository) GetStargazersCount

func (r *BaseRepository) GetStargazersCount() int

GetStargazersCount returns the number of stars

func (*BaseRepository) GetURL

func (r *BaseRepository) GetURL() string

GetURL returns the repository URL

type Factory

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

Factory creates VCS service providers based on platform

func NewFactory

func NewFactory(cfg *config.Config) *Factory

NewFactory creates a new VCS factory

func (*Factory) GetService

func (f *Factory) GetService() (Service, error)

GetService is a convenience method to get a Service directly

func (*Factory) GetServiceProvider

func (f *Factory) GetServiceProvider() (ServiceProvider, error)

GetServiceProvider returns the appropriate service provider based on configuration

func (*Factory) RegisterProvider

func (f *Factory) RegisterProvider(platform string, creator func(*config.Config) ServiceProvider)

RegisterProvider registers a provider creator function for a platform

type Issue

type Issue interface {
	GetOwner() string
	GetRepo() string
	GetNumber() int
	GetTitle() string
	GetBody() string
	GetUser() string
	GetState() string
	GetCreatedAt() time.Time
	GetUpdatedAt() time.Time
	GetURL() string
	GetComments() []IssueComment
	GetLabels() []string
	GetAssignees() []string
}

Issue represents a generic issue across VCS platforms

type IssueComment

type IssueComment struct {
	ID        string
	User      string
	Body      string
	CreatedAt time.Time
}

IssueComment represents a comment on an issue

type IssueProcessor

type IssueProcessor interface {
	Process(Issue) error
}

IssueProcessor defines a function that processes a single issue

type Monitor

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

Monitor provides a generic VCS monitor for any platform

func NewMonitor

func NewMonitor(cfg MonitorConfig) (*Monitor, error)

NewMonitor creates a new VCS monitor with the given configuration

func (*Monitor) CheckOnce

func (m *Monitor) CheckOnce() error

CheckOnce runs a single check for assigned issues

func (*Monitor) GetStats

func (m *Monitor) GetStats() map[string]interface{}

GetStats returns monitoring statistics

func (*Monitor) GetUsername

func (m *Monitor) GetUsername() string

GetUsername returns the username being used for monitoring

func (*Monitor) Start

func (m *Monitor) Start() error

Start begins the continuous monitoring process

type MonitorConfig

type MonitorConfig struct {
	Config    *config.Config
	Service   Service
	Processor IssueProcessor
}

MonitorConfig holds configuration for creating a monitor

type Provider

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

Provider creates VCS services based on configuration

func NewProvider

func NewProvider(cfg *config.Config) *Provider

NewProvider creates a new service provider

func (*Provider) GetService

func (p *Provider) GetService() Service

GetService returns the appropriate service based on configuration

type PullRequest

type PullRequest interface {
	GetNumber() int
	GetTitle() string
	GetBody() string
	GetState() string
	GetIsDraft() bool
	GetUser() string
	GetHeadBranch() string
	GetBaseBranch() string
	GetURL() string
}

PullRequest represents a generic pull request across VCS platforms

type Repository

type Repository interface {
	GetOwner() string
	GetName() string
	GetDefaultBranch() string
	GetURL() string
	GetDescription() string
	GetHasIssues() bool
	GetStargazersCount() int
	GetForksCount() int
}

Repository represents a generic repository across VCS platforms

type Service

type Service interface {
	// Issue operations
	GetIssue(owner, repo string, number int) (Issue, error)
	GetIssueWithComments(owner, repo string, number int) (Issue, error)
	GetAssignedIssues(username string, since time.Time, limit int) ([]Issue, error)
	RespondToIssue(owner, repo string, issueNumber int, comment string) error

	// Repository operations
	GetRepository(owner, repo string) (Repository, error)
	GetDefaultBranch(owner, repo string) (string, error)
	CloneRepository(owner, repo, branch string, number int) (string, error)
	GetRepositories() ([]Repository, error) // Get all accessible repositories for the authenticated user

	// Branch operations
	CreateBranch(owner, repo, branchName, baseBranch string) error

	// PR operations
	CreateDraftPullRequest(owner, repo, title, body, head, base string) (PullRequest, error)
	GetPullRequestsForIssue(owner, repo string, issueNumber int) ([]PullRequest, error)

	// Authentication
	GetAuthenticatedUser() (string, error)
}

Service defines the common interface for all VCS providers (GitHub, GitLab, etc.)

type ServiceProvider

type ServiceProvider interface {
	GetService() Service
}

ServiceProvider creates VCS service instances

Jump to

Keyboard shortcuts

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