Documentation
¶
Index ¶
- func FormatIssuesForPrompt(issues []models.Issue, locale string) string
- func FormatTemplateForPrompt(template *models.IssueTemplate, lang string, templateType string) string
- func GetCommitPromptTemplate(lang string, hasTicket bool) string
- func GetIssueDefaultStructure(lang string) string
- func GetIssuePromptTemplate(lang string) string
- func GetIssueReferenceInstructions(lang string) string
- func GetNoIssueReferenceInstruction(locale string) string
- func GetPRIssueContextInstructions(locale string) string
- func GetPRPromptTemplate(lang string) string
- func GetPRTemplateInstructions(lang string) string
- func GetReleaseNotesSectionHeaders(locale string) map[string]string
- func GetReleasePromptTemplate(lang string) string
- func GetTechnicalAnalysisInstruction(locale string) string
- func GetTemplateInstructions(lang string) string
- func RenderPrompt(name, tmplStr string, data interface{}) (string, error)
- type CommitSummarizer
- type ConfirmationCallback
- type ConfirmationResult
- type CostAwareAIProvider
- type CostAwareWrapper
- type GenerateFunc
- type IssueContentGenerator
- type PRSummarizer
- type PromptData
- type ReleaseNotesGenerator
- type TokenCounter
- type WrapperConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatIssuesForPrompt ¶
FormatIssuesForPrompt formats the issue list to be included in the prompt
func FormatTemplateForPrompt ¶
func FormatTemplateForPrompt(template *models.IssueTemplate, lang string, templateType string) string
FormatTemplateForPrompt formats a template for inclusion in an AI prompt. It handles both Issue and PR templates with proper language support.
func GetCommitPromptTemplate ¶
GetCommitPromptTemplate returns the commit template based on language and whether there is a ticket
func GetIssueDefaultStructure ¶ added in v1.7.0
GetIssueDefaultStructure returns the default structure for issues when no template is provided
func GetIssuePromptTemplate ¶
GetIssuePromptTemplate returns the appropriate issue generation template based on language
func GetIssueReferenceInstructions ¶
GetIssueReferenceInstructions returns issue reference instructions based on the language
func GetPRIssueContextInstructions ¶
GetPRIssueContextInstructions returns issue context instructions for PRs
func GetPRPromptTemplate ¶
GetPRPromptTemplate returns the appropriate template based on the language
func GetPRTemplateInstructions ¶
GetPRTemplateInstructions returns PR template instructions based on the language
func GetReleasePromptTemplate ¶
GetReleasePromptTemplate returns the release template based on the language
func GetTemplateInstructions ¶
GetTemplateInstructions returns template instructions based on the language
func RenderPrompt ¶
RenderPrompt renders a prompt template with the provided data
Types ¶
type CommitSummarizer ¶ added in v1.6.0
type CommitSummarizer interface {
// GenerateSuggestions generates a list of commit message suggestions.
GenerateSuggestions(ctx context.Context, info models.CommitInfo, count int) ([]models.CommitSuggestion, error)
}
CommitSummarizer is an interface that defines the service to generate commit suggestions.
type ConfirmationCallback ¶
type ConfirmationCallback func(result ConfirmationResult) (choice string, proceed bool)
type ConfirmationResult ¶
type CostAwareAIProvider ¶ added in v1.6.0
type CostAwareAIProvider interface {
// CountTokens counts the tokens of a prompt without making the actual model call.
// This allows estimating the cost before executing the generation.
CountTokens(ctx context.Context, prompt string) (int, error)
// GetModelName returns the name of the current model (e.g.: "gemini-2.5-flash")
GetModelName() string
// GetProviderName returns the name of the provider (e.g.: "gemini", "openai", "anthropic")
GetProviderName() string
}
CostAwareAIProvider defines the interface for AI providers that support cost tracking.
type CostAwareWrapper ¶
type CostAwareWrapper struct {
// contains filtered or unexported fields
}
func NewCostAwareWrapper ¶
func NewCostAwareWrapper(cfg WrapperConfig) (*CostAwareWrapper, error)
NewCostAwareWrapper creates a provider-agnostic wrapper
func (*CostAwareWrapper) SetSkipConfirmation ¶
func (w *CostAwareWrapper) SetSkipConfirmation(skip bool)
SetSkipConfirmation allows enabling or disabling manual user confirmation.
func (*CostAwareWrapper) WrapGenerate ¶
func (w *CostAwareWrapper) WrapGenerate( ctx context.Context, command string, prompt string, generateFn GenerateFunc, ) (interface{}, *models.TokenUsage, error)
WrapGenerate wraps any generation function with tracking
type GenerateFunc ¶
type IssueContentGenerator ¶ added in v1.6.0
type IssueContentGenerator interface {
// GenerateIssueContent generates the title, description, and labels of an issue
// based on the context provided in the request.
GenerateIssueContent(ctx context.Context, request models.IssueGenerationRequest) (*models.IssueGenerationResult, error)
}
IssueContentGenerator defines the interface to generate issue content with AI.
type PRSummarizer ¶ added in v1.6.0
type PRSummarizer interface {
// GeneratePRSummary generates a summary of a Pull Request given a prompt.
GeneratePRSummary(ctx context.Context, prompt string, availableLabels []string) (models.PRSummary, error)
}
PRSummarizer defines the interface for services that summarize Pull Requests.
type PromptData ¶
type PromptData struct {
Count int
Files string
Diff string
Ticket string
History string
Instructions string
IssueNumber int
RelatedIssues string
IssueInfo string
RepoOwner string
RepoName string
PreviousVersion string
CurrentVersion string
LatestVersion string
ReleaseDate string
Changelog string
PRContent string
TechnicalInfo string
}
PromptData holds the parameters for template rendering
type ReleaseNotesGenerator ¶ added in v1.6.0
type ReleaseNotesGenerator interface {
GenerateNotes(ctx context.Context, release *models.Release) (*models.ReleaseNotes, error)
}
ReleaseNotesGenerator defines the interface to generate release notes.
type TokenCounter ¶ added in v1.6.0
TokenCounter is a simpler interface for providers that only need to count tokens.
type WrapperConfig ¶
type WrapperConfig struct {
Provider CostAwareAIProvider
BudgetDaily float64
EstimatedOutputTokens int
SkipConfirmation bool
OnConfirmation ConfirmationCallback
}