Documentation
¶
Overview ¶
Package app provides the main business logic for the snappr application.
Index ¶
- Constants
- func CheckGHToken() error
- func CheckLLMToken() error
- func CheckTokens() error
- func GetWorkflowByName(name string, workflowList []config.PromptWorkflow) *config.PromptWorkflow
- func NewDefaultPromptAndKnowledgeConfig(configPath string) error
- func RetrieveKnowledge(sourceName string, knowledgeSources []config.KnowledgeSource) (string, error)
- type App
- type FileChange
- type PRChanges
- type PRCommentInfo
- type PRCreation
- type PRCreationFile
- type PRReviewMap
- type SnapprUserConfig
Constants ¶
View Source
const ( ErrUnmarshalLLMResponse = errors.New("error unmarshalling LLM response") ErrMissingGHToken = errors.New("GH_TOKEN environment variable is required. Please set it before running this command") ErrMissingLLMToken = errors.New("LLM_TOKEN environment variable is required. Please set it before running this command") )
View Source
const (
NotImplementedMessage string = "Not implemented"
)
Variables ¶
This section is empty.
Functions ¶
func CheckGHToken ¶
func CheckGHToken() error
CheckGHToken checks if the GH_TOKEN environment variable is set.
func CheckLLMToken ¶
func CheckLLMToken() error
CheckLLMToken checks if the LLM_TOKEN environment variable is set.
func CheckTokens ¶
func CheckTokens() error
func GetWorkflowByName ¶
func GetWorkflowByName(name string, workflowList []config.PromptWorkflow) *config.PromptWorkflow
GetWorkflowByName returns workflow information by name from a list of workflows.
func NewDefaultPromptAndKnowledgeConfig ¶
NewDefaultPromptAndKnowledgeConfig creates a config.yaml file with the default prompt and knowledge config.
func RetrieveKnowledge ¶
func RetrieveKnowledge(sourceName string, knowledgeSources []config.KnowledgeSource) (string, error)
RetrieveKnowledge retrieves knowledge from a knowledge source.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func New ¶
func New( cfg *config.Config, githubClient githubClient, llmClient llmClient, logger zerolog.Logger) *App
New creates a new instance of the App.
func SetupNoEnv ¶
SetupNoEnv sets up the application from a config struct instead of utilizing environment variables.
type FileChange ¶
type PRChanges ¶
type PRChanges struct {
Files []FileChange `json:"files"`
}
type PRCommentInfo ¶
type PRCommentInfo struct {
CommentBody string
// The start_line is the first line in the pull request diff that your multi-line comment applies to.
StartLine int
// The line of the blob in the pull request diff that the comment applies to. For a multi-line comment, the last line of the range that your comment applies to.
Line int
// Side of the diff for the last line. Can be LEFT or RIGHT.
Side clients.Side
// The start_side is the starting side of the diff that the comment applies to. Can be LEFT or RIGHT.
StartSide clients.Side
}
type PRCreation ¶
type PRCreation struct {
// Title of the pull request
Title string `json:"title"`
// Body of the pull request
Body string `json:"body"`
// UpdatedFiles is a list of files that have been updated in the pull request
UpdatedFiles []PRCreationFile `json:"updated_files"`
}
type PRCreationFile ¶
type PRReviewMap ¶
type PRReviewMap map[string][]PRCommentInfo
PRReviewMap is a map of file paths to a list of PRCommentInfo
type SnapprUserConfig ¶
type SnapprUserConfig struct {
PromptWorkflows []config.PromptWorkflow `yaml:"promptWorkflows"`
KnowledgeSources []config.KnowledgeSource `yaml:"knowledgeSources"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.