commitassist

package
v0.0.0-...-80055c2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(client *openai.Client) *Client

func (*Client) GetCommitMessage

func (o *Client) GetCommitMessage(ctx context.Context, gitDiff string, cfg *MessageConfig) (GetTypeResponse, error)

GetCommitMessage returns a commit message based on the git diff provided.

type GetTypeResponse

type GetTypeResponse struct {
	Message string

	// Cost is the cost of the request in cent.
	Cost float64
}

type MessageConfig

type MessageConfig struct {
	Style                       Style
	ConventionalCommitCompliant bool
}

type Style

type Style string
const (
	// DescriptiveAndNeutral: This style focuses on stating the changes as
	// plainly and objectively as possible. It's typically preferred in most
	// development environments.
	DescriptiveAndNeutral Style = "DescriptiveAndNeutral"

	// ConversationalAndCasual: This style includes using casual language or
	// even humor to describe changes. It's less common and more appropriate
	// for less formal environments or small, close-knit teams.
	ConversationalAndCasual Style = "ConversationalAndCasual"

	// ListBased: Changes are presented in a list format, often
	// used when there are multiple distinct changes that are easier to
	// understand when broken down.
	ListBased Style = "ListBased"

	// ProblemSolution: This style first states the problem that was present
	// and then details the solution that was implemented. It's especially
	// useful when the commit addresses specific bugs or issues.
	ProblemSolution Style = "ProblemSolution"
)

func ValidateMessageStyle

func ValidateMessageStyle(assumedStyle string) (Style, error)

ValidateMessageStyle returns an error if the assumedStyle is not a valid.

type UnexpectedStateError

type UnexpectedStateError struct {
	Msg string
}

func (UnexpectedStateError) Error

func (e UnexpectedStateError) Error() string

type UnsureError

type UnsureError struct {
	Msg string
}

func (UnsureError) Error

func (e UnsureError) Error() string

Jump to

Keyboard shortcuts

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