services

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangelogWarning added in v1.7.0

type ChangelogWarning struct {
	Type    string
	Message string
}

ChangelogWarning represents a validation warning

type CommitService

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

func NewCommitService

func NewCommitService(gitSvc commitGitService, aiSvc ai.CommitSummarizer, opts ...Option) *CommitService

func (*CommitService) GenerateSuggestions

func (s *CommitService) GenerateSuggestions(ctx context.Context, count int, issueNumber int, progress func(models.ProgressEvent)) ([]models.CommitSuggestion, error)

type IssueGeneratorOption

type IssueGeneratorOption func(*IssueGeneratorService)

func WithIssueConfig

func WithIssueConfig(cfg *config.Config) IssueGeneratorOption

func WithIssueTemplateService

func WithIssueTemplateService(ts issueTemplateService) IssueGeneratorOption

func WithIssueVCSClient

func WithIssueVCSClient(vcs vcs.VCSClient) IssueGeneratorOption

type IssueGeneratorService

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

func NewIssueGeneratorService

func NewIssueGeneratorService(
	gitSvc issueGitService,
	ai ai.IssueContentGenerator,
	opts ...IssueGeneratorOption,
) *IssueGeneratorService

func (*IssueGeneratorService) CreateIssue

func (s *IssueGeneratorService) CreateIssue(ctx context.Context, result *models.IssueGenerationResult, assignees []string) (*models.Issue, error)

CreateIssue creates a new issue in the repository using the configured VCS client. It returns the created issue with its assigned number and URL.

func (*IssueGeneratorService) GenerateFromDescription

func (s *IssueGeneratorService) GenerateFromDescription(ctx context.Context, description string, skipLabels bool, autoTemplate bool, explicitTemplate *models.IssueTemplate) (*models.IssueGenerationResult, error)

GenerateFromDescription generates issue content based on a manual description. Useful when the user wants to create an issue without having local changes.

func (*IssueGeneratorService) GenerateFromDiff

func (s *IssueGeneratorService) GenerateFromDiff(ctx context.Context, hint string, skipLabels bool, autoTemplate bool, explicitTemplate *models.IssueTemplate) (*models.IssueGenerationResult, error)

GenerateFromDiff generates issue content based on the current git diff. It analyzes local changes (staged and unstaged) to create an appropriate title, description, and labels.

func (*IssueGeneratorService) GenerateFromPR

func (s *IssueGeneratorService) GenerateFromPR(ctx context.Context, prNumber int, hint string, skipLabels bool, autoTemplate bool, explicitTemplate *models.IssueTemplate) (*models.IssueGenerationResult, error)

func (*IssueGeneratorService) GenerateWithTemplate

func (s *IssueGeneratorService) GenerateWithTemplate(ctx context.Context, templateName string, hint string, fromDiff bool, description string, skipLabels bool) (*models.IssueGenerationResult, error)

func (*IssueGeneratorService) GetAuthenticatedUser

func (s *IssueGeneratorService) GetAuthenticatedUser(ctx context.Context) (string, error)

GetAuthenticatedUser gets the username of the current authenticated user.

func (*IssueGeneratorService) InferBranchName

func (s *IssueGeneratorService) InferBranchName(issueNumber int, labels []string) string

func (*IssueGeneratorService) LinkIssueToPR

func (s *IssueGeneratorService) LinkIssueToPR(ctx context.Context, prNumber int, issueNumber int) error

LinkIssueToPR links an issue to a Pull Request by adding "Closes #issueNumber" to the PR description.

func (*IssueGeneratorService) SelectTemplateWithAI

func (s *IssueGeneratorService) SelectTemplateWithAI(ctx context.Context, title, description string, changedFiles, labels []string) (*models.IssueTemplate, error)

SelectTemplateWithAI uses AI to analyze the context (diff/description) and select the best template

func (*IssueGeneratorService) SuggestTemplates

func (s *IssueGeneratorService) SuggestTemplates(ctx context.Context) ([]models.TemplateMetadata, error)

type IssueOption

type IssueOption func(*IssueTemplateService)

func WithTemplateConfig

func WithTemplateConfig(cfg *config.Config) IssueOption

type IssueTemplateService

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

func NewIssueTemplateService

func NewIssueTemplateService(opts ...IssueOption) *IssueTemplateService

func (*IssueTemplateService) GetPRTemplate

func (s *IssueTemplateService) GetPRTemplate(ctx context.Context, name string) (*models.IssueTemplate, error)

GetPRTemplate loads a specific PR template by name

func (*IssueTemplateService) GetPRTemplatesDir

func (s *IssueTemplateService) GetPRTemplatesDir(ctx context.Context) (string, error)

GetPRTemplatesDir returns the directory where PR templates are stored

func (*IssueTemplateService) GetTemplateByName

func (s *IssueTemplateService) GetTemplateByName(ctx context.Context, name string) (*models.IssueTemplate, error)

func (*IssueTemplateService) GetTemplatesDir

func (s *IssueTemplateService) GetTemplatesDir(ctx context.Context) (string, error)

func (*IssueTemplateService) InitializeTemplates

func (s *IssueTemplateService) InitializeTemplates(ctx context.Context, force bool) error

func (*IssueTemplateService) ListPRTemplates

func (s *IssueTemplateService) ListPRTemplates(ctx context.Context) ([]models.TemplateMetadata, error)

func (*IssueTemplateService) ListTemplates

func (s *IssueTemplateService) ListTemplates(ctx context.Context) ([]models.TemplateMetadata, error)

func (*IssueTemplateService) LoadMarkdownTemplate

func (s *IssueTemplateService) LoadMarkdownTemplate(ctx context.Context, filePath string) (*models.IssueTemplate, error)

LoadMarkdownTemplate loads a Markdown template file

func (*IssueTemplateService) LoadTemplate

func (s *IssueTemplateService) LoadTemplate(ctx context.Context, filePath string) (*models.IssueTemplate, error)

func (*IssueTemplateService) MergeWithGeneratedContent

func (s *IssueTemplateService) MergeWithGeneratedContent(template *models.IssueTemplate, generated *models.IssueGenerationResult) *models.IssueGenerationResult

type MockAIProvider

type MockAIProvider struct {
	mock.Mock
}

func (*MockAIProvider) GenerateSuggestions

func (m *MockAIProvider) GenerateSuggestions(ctx context.Context, info models.CommitInfo, count int) ([]models.CommitSuggestion, error)

type MockGitService

type MockGitService struct {
	mock.Mock
}

func (*MockGitService) AddFileToStaging

func (m *MockGitService) AddFileToStaging(ctx context.Context, file string) error

func (*MockGitService) CreateCommit

func (m *MockGitService) CreateCommit(ctx context.Context, message string) error

func (*MockGitService) CreateTag

func (m *MockGitService) CreateTag(ctx context.Context, version, message string) error

func (*MockGitService) FetchTags

func (m *MockGitService) FetchTags(ctx context.Context) error

func (*MockGitService) GetChangedFiles

func (m *MockGitService) GetChangedFiles(ctx context.Context) ([]string, error)

func (*MockGitService) GetCommitCount

func (m *MockGitService) GetCommitCount(ctx context.Context) (int, error)

func (*MockGitService) GetCommitsBetweenTags

func (m *MockGitService) GetCommitsBetweenTags(ctx context.Context, fromTag, toTag string) ([]models.Commit, error)

func (*MockGitService) GetCommitsSinceTag

func (m *MockGitService) GetCommitsSinceTag(ctx context.Context, tag string) ([]models.Commit, error)

func (*MockGitService) GetCurrentBranch

func (m *MockGitService) GetCurrentBranch(ctx context.Context) (string, error)

func (*MockGitService) GetDiff

func (m *MockGitService) GetDiff(ctx context.Context) (string, error)

func (*MockGitService) GetLastTag

func (m *MockGitService) GetLastTag(ctx context.Context) (string, error)

func (*MockGitService) GetRecentCommitMessages

func (m *MockGitService) GetRecentCommitMessages(ctx context.Context, count int) ([]string, error)

func (*MockGitService) GetRepoInfo

func (m *MockGitService) GetRepoInfo(ctx context.Context) (string, string, string, error)

func (*MockGitService) GetTagDate

func (m *MockGitService) GetTagDate(ctx context.Context, tag string) (string, error)

func (*MockGitService) HasStagedChanges

func (m *MockGitService) HasStagedChanges(ctx context.Context) bool

func (*MockGitService) Push

func (m *MockGitService) Push(ctx context.Context) error

func (*MockGitService) PushTag

func (m *MockGitService) PushTag(ctx context.Context, version string) error

func (*MockGitService) StageAllChanges

func (m *MockGitService) StageAllChanges(ctx context.Context) error

func (*MockGitService) ValidateTagExists

func (m *MockGitService) ValidateTagExists(ctx context.Context, tag string) error

type MockIssueContentGenerator

type MockIssueContentGenerator struct {
	mock.Mock
}

func (*MockIssueContentGenerator) GenerateIssueContent

type MockIssueTemplateService

type MockIssueTemplateService struct {
	mock.Mock
}

func (*MockIssueTemplateService) GetTemplateByName

func (m *MockIssueTemplateService) GetTemplateByName(ctx context.Context, name string) (*models.IssueTemplate, error)

func (*MockIssueTemplateService) GetTemplatesDir

func (m *MockIssueTemplateService) GetTemplatesDir(ctx context.Context) (string, error)

func (*MockIssueTemplateService) InitializeTemplates

func (m *MockIssueTemplateService) InitializeTemplates(ctx context.Context, force bool) error

func (*MockIssueTemplateService) ListTemplates

func (*MockIssueTemplateService) LoadTemplate

func (m *MockIssueTemplateService) LoadTemplate(ctx context.Context, filePath string) (*models.IssueTemplate, error)

func (*MockIssueTemplateService) MergeWithGeneratedContent

func (m *MockIssueTemplateService) MergeWithGeneratedContent(template *models.IssueTemplate, generated *models.IssueGenerationResult) *models.IssueGenerationResult

type MockJiraService

type MockJiraService struct {
	mock.Mock
}

func (*MockJiraService) GetTicketInfo

func (m *MockJiraService) GetTicketInfo(ticketID string) (*models.TicketInfo, error)

type MockPRSummarizer

type MockPRSummarizer struct {
	mock.Mock
}

func (*MockPRSummarizer) GeneratePRSummary

func (m *MockPRSummarizer) GeneratePRSummary(ctx context.Context, prompt string, availableLabels []string) (models.PRSummary, error)

type MockReleaseNotesGenerator

type MockReleaseNotesGenerator struct {
	mock.Mock
}

func (*MockReleaseNotesGenerator) GenerateNotes

func (m *MockReleaseNotesGenerator) GenerateNotes(ctx context.Context, release *models.Release) (*models.ReleaseNotes, error)

type MockVCSClient

type MockVCSClient struct {
	mock.Mock
}

func (*MockVCSClient) AddLabelsToPR

func (m *MockVCSClient) AddLabelsToPR(ctx context.Context, prNumber int, labels []string) error

func (*MockVCSClient) CreateIssue

func (m *MockVCSClient) CreateIssue(ctx context.Context, title string, body string, labels []string, assignees []string) (*models.Issue, error)

func (*MockVCSClient) CreateLabel

func (m *MockVCSClient) CreateLabel(ctx context.Context, name, color, description string) error

func (*MockVCSClient) CreateRelease

func (m *MockVCSClient) CreateRelease(ctx context.Context, release *models.Release, notes *models.ReleaseNotes, draft bool, buildBinaries bool, progressCh chan<- models.BuildProgress) error

func (*MockVCSClient) GetAuthenticatedUser

func (m *MockVCSClient) GetAuthenticatedUser(ctx context.Context) (string, error)

func (*MockVCSClient) GetClosedIssuesBetweenTags

func (m *MockVCSClient) GetClosedIssuesBetweenTags(ctx context.Context, previousTag, currentTag string) ([]models.Issue, error)

func (*MockVCSClient) GetContributorsBetweenTags

func (m *MockVCSClient) GetContributorsBetweenTags(ctx context.Context, previousTag, currentTag string) ([]string, error)

func (*MockVCSClient) GetFileAtTag

func (m *MockVCSClient) GetFileAtTag(ctx context.Context, tag, filepath string) (string, error)

func (*MockVCSClient) GetFileStatsBetweenTags

func (m *MockVCSClient) GetFileStatsBetweenTags(ctx context.Context, previousTag, currentTag string) (*models.FileStatistics, error)

func (*MockVCSClient) GetIssue

func (m *MockVCSClient) GetIssue(ctx context.Context, issueNumber int) (*models.Issue, error)

func (*MockVCSClient) GetMergedPRsBetweenTags

func (m *MockVCSClient) GetMergedPRsBetweenTags(ctx context.Context, previousTag, currentTag string) ([]models.PullRequest, error)

func (*MockVCSClient) GetPR

func (m *MockVCSClient) GetPR(ctx context.Context, prNumber int) (models.PRData, error)

func (*MockVCSClient) GetPRIssues

func (m *MockVCSClient) GetPRIssues(ctx context.Context, branchName string, commits []string, prDescription string) ([]models.Issue, error)

func (*MockVCSClient) GetRelease

func (m *MockVCSClient) GetRelease(ctx context.Context, version string) (*models.VCSRelease, error)

func (*MockVCSClient) GetRepoLabels

func (m *MockVCSClient) GetRepoLabels(ctx context.Context) ([]string, error)

func (*MockVCSClient) UpdateIssueChecklist

func (m *MockVCSClient) UpdateIssueChecklist(ctx context.Context, issueNumber int, indices []int) error

func (*MockVCSClient) UpdatePR

func (m *MockVCSClient) UpdatePR(ctx context.Context, prNumber int, summary models.PRSummary) error

func (*MockVCSClient) UpdateRelease

func (m *MockVCSClient) UpdateRelease(ctx context.Context, version, body string) error

type Option

type Option func(*CommitService)

func WithConfig

func WithConfig(cfg *config.Config) Option

func WithTicketManager

func WithTicketManager(tm tickets.TicketManager) Option

func WithVCSClient

func WithVCSClient(vcsClient vcs.VCSClient) Option

type PROption

type PROption func(*PRService)

func WithPRAIProvider

func WithPRAIProvider(ai prAIProvider) PROption

func WithPRConfig

func WithPRConfig(cfg *config.Config) PROption

func WithPRTemplateService

func WithPRTemplateService(ts prTemplateService) PROption

func WithPRVCSClient

func WithPRVCSClient(vcs prVCSClient) PROption

type PRService

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

func NewPRService

func NewPRService(opts ...PROption) *PRService

func (*PRService) SummarizePR

func (s *PRService) SummarizePR(ctx context.Context, prNumber int, hint string, progress func(models.ProgressEvent)) (models.PRSummary, error)

type ReleaseOption

type ReleaseOption func(*ReleaseService)

func WithReleaseConfig

func WithReleaseConfig(cfg *config.Config) ReleaseOption

func WithReleaseNotesGenerator

func WithReleaseNotesGenerator(rng ai.ReleaseNotesGenerator) ReleaseOption

func WithReleaseVCSClient

func WithReleaseVCSClient(vcs vcs.VCSClient) ReleaseOption

type ReleaseService

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

func NewReleaseService

func NewReleaseService(
	gitSvc releaseGitService,
	opts ...ReleaseOption,
) *ReleaseService

func (*ReleaseService) AnalyzeNextRelease

func (s *ReleaseService) AnalyzeNextRelease(ctx context.Context) (*models.Release, error)

func (*ReleaseService) BuildChangelogPreview added in v1.7.0

func (s *ReleaseService) BuildChangelogPreview(ctx context.Context, release *models.Release, notes *models.ReleaseNotes) string

BuildChangelogPreview generates a preview of how the CHANGELOG entry will look

func (*ReleaseService) CommitChangelog

func (s *ReleaseService) CommitChangelog(ctx context.Context, version string) error

func (*ReleaseService) CreateTag

func (s *ReleaseService) CreateTag(ctx context.Context, version, message string) error

func (*ReleaseService) EnrichReleaseContext

func (s *ReleaseService) EnrichReleaseContext(ctx context.Context, release *models.Release) error

func (*ReleaseService) EnsureUnreleasedSection added in v1.7.0

func (s *ReleaseService) EnsureUnreleasedSection(filename string) error

EnsureUnreleasedSection ensures an Unreleased section exists in the CHANGELOG

func (*ReleaseService) FindVersionFile

func (s *ReleaseService) FindVersionFile(ctx context.Context) (string, string, error)

func (*ReleaseService) GenerateReleaseNotes

func (s *ReleaseService) GenerateReleaseNotes(ctx context.Context, release *models.Release) (*models.ReleaseNotes, error)

func (*ReleaseService) GetRelease

func (s *ReleaseService) GetRelease(ctx context.Context, version string) (*models.VCSRelease, error)

func (*ReleaseService) MoveUnreleasedToVersion added in v1.7.0

func (s *ReleaseService) MoveUnreleasedToVersion(filename string, release *models.Release, notes *models.ReleaseNotes) error

MoveUnreleasedToVersion moves Unreleased section content to a new version

func (*ReleaseService) PublishRelease

func (s *ReleaseService) PublishRelease(ctx context.Context, release *models.Release, notes *models.ReleaseNotes, draft bool, buildBinaries bool, progressCh chan<- models.BuildProgress) error

func (*ReleaseService) PushChanges

func (s *ReleaseService) PushChanges(ctx context.Context) error

PushChanges pushes committed changes to the remote repository

func (*ReleaseService) PushTag

func (s *ReleaseService) PushTag(ctx context.Context, version string) error

func (*ReleaseService) UpdateAppVersion

func (s *ReleaseService) UpdateAppVersion(ctx context.Context, version string) error

func (*ReleaseService) UpdateLocalChangelog

func (s *ReleaseService) UpdateLocalChangelog(release *models.Release, notes *models.ReleaseNotes) error

func (*ReleaseService) UpdateRelease

func (s *ReleaseService) UpdateRelease(ctx context.Context, version, body string) error

func (*ReleaseService) ValidateChangelog added in v1.7.0

func (s *ReleaseService) ValidateChangelog(filename string) ([]ChangelogWarning, error)

ValidateChangelog validates the entire CHANGELOG file

func (*ReleaseService) ValidateMainBranch

func (s *ReleaseService) ValidateMainBranch(ctx context.Context) error

type UpdateCache

type UpdateCache struct {
	LastCheck   time.Time `json:"last_check"`
	LatestKnown string    `json:"latest_known"`
}

type UpdateInfo added in v1.6.0

type UpdateInfo struct {
	CurrentVersion string
	LatestVersion  string
	IsAvailable    bool
}

UpdateInfo contains information about an available update

type VersionOption

type VersionOption func(*VersionUpdater)

func WithCurrentVersion

func WithCurrentVersion(version string) VersionOption

type VersionUpdater

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

func NewVersionUpdater

func NewVersionUpdater(opts ...VersionOption) *VersionUpdater

func (*VersionUpdater) CheckForUpdates

func (v *VersionUpdater) CheckForUpdates(ctx context.Context) (string, bool)

func (*VersionUpdater) GetUpdateInfo added in v1.6.0

func (v *VersionUpdater) GetUpdateInfo() (*UpdateInfo, error)

GetUpdateInfo returns information about available updates without displaying anything Returns nil if no update is available or if update checks are disabled

func (*VersionUpdater) NotifyUpdate added in v1.6.0

func (v *VersionUpdater) NotifyUpdate(trans *translations.Translations)

NotifyUpdate displays an update notification to the user Deprecated: Use GetUpdateInfo() and display the notification in the UI layer instead

func (*VersionUpdater) UpdateCLI

func (v *VersionUpdater) UpdateCLI(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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