autocommit

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const SystemMsg string = `` /* 2542-byte string literal not displayed */

SystemMsg is the message that will feed the OpenAI API to generate the commit message.

Variables

View Source
var (
	CommitChangesOption   = fmt.Sprintf("%-2s Commit changes", "💾")
	RegenerateOption      = fmt.Sprintf("%-2s Regenerate", "🔄")
	CopyToClipboardOption = fmt.Sprintf("%-2s Copy to clipboard", "📋")
	AddInstructionOption  = fmt.Sprintf("%-4s Add instruction", "✏️")
	ExitOption            = fmt.Sprintf("%-2s Exit", "🚪")
)

Functions

This section is empty.

Types

type AddInstructionCli added in v1.4.3

type AddInstructionCli interface {
	// Execute executes the add instruction CLI.
	Execute() (string, error)
}

AddInstructionCli is an interface for executing add instruction CLI operations.

func MakeAddInstructionCli added in v1.4.3

func MakeAddInstructionCli() AddInstructionCli

func NewAddInstructionCli added in v1.4.3

func NewAddInstructionCli() AddInstructionCli

NewAddInstructionCli creates a new instance of AddInstructionCli.

type AddInstructionCommand added in v1.4.3

type AddInstructionCommand interface {
	Execute(config *openai.Config, instruction string) (string, error)
}

AddInstructionCommand is the interface that wraps the Execute method.

func MakeAddInstructionCommand added in v1.4.3

func MakeAddInstructionCommand() AddInstructionCommand

func NewAddInstructionCommand added in v1.4.3

func NewAddInstructionCommand(
	chatCommand openai.ChatCommand,
) AddInstructionCommand

NewAddInstructionCommand creates a new instance of AddInstructionCommand.

type Clipboard

type Clipboard interface {
	// Copy copies the given message to the clipboard.
	Copy(message string) error
}

Clipboard is an interface that defines the Copy method.

func MakeClipboard

func MakeClipboard() Clipboard

func NewClipboard

func NewClipboard() Clipboard

NewClipboard creates a new instance of Clipboard.

type ClipboardCommand

type ClipboardCommand interface {
	Execute(message string) error
}

ClipboardCommand is the interface that wraps the Execute method.

func MakeClipboardCommand

func MakeClipboardCommand() ClipboardCommand

func NewClipboardCommand

func NewClipboardCommand(clipboard Clipboard) ClipboardCommand

NewClipboardCommand creates a new instance of ClipboardCommand.

type GeneratorCommand

type GeneratorCommand interface {
	// Execute returns the commit message generated by OpenAI.
	Execute(config *openai.Config) (string, error)
}

GeneratorCommand is the interface that wraps the Execute method.

func MakeGeneratorCommand

func MakeGeneratorCommand() GeneratorCommand

func NewGeneratorCommand

func NewGeneratorCommand(
	chatCommand openai.ChatCommand,
	diffCommand git.DiffCommand,
	systemMsgRepo SystemMsgRepo,
) GeneratorCommand

NewGeneratorCommand creates a new instance of GeneratorCommand.

type OpenSystemMsgCommand added in v1.5.0

type OpenSystemMsgCommand interface {
	Execute() error
}

OpenSystemMsgCommand is the interface that wraps the Execute method.

func MakeOpenSystemMsgCommand added in v1.5.0

func MakeOpenSystemMsgCommand() OpenSystemMsgCommand

func NewOpenSystemMsgCommand added in v1.5.0

func NewOpenSystemMsgCommand() OpenSystemMsgCommand

NewOpenSystemMsgCommand creates a new instance of UpdateSystemMsgCommand.

type PostCommitCli

type PostCommitCli interface {
	// Execute executes the post commit CLI.
	Execute() (string, error)
}

PostCommitCli is an interface for executing post commit CLI operations.

func MakePostCommitCli

func MakePostCommitCli() PostCommitCli

func NewPostCommitCli

func NewPostCommitCli() PostCommitCli

NewPostCommitCli creates a new instance of PostCommitCli.

type SystemMsgHealthCheckCommand added in v1.5.0

type SystemMsgHealthCheckCommand interface {
	Execute() error
}

SystemMsgHealthCheckCommand is the interface that wraps the Execute method.

func MakeSystemMsgHealthCheckCommand added in v1.5.0

func MakeSystemMsgHealthCheckCommand() SystemMsgHealthCheckCommand

func NewSystemMsgHealthCheckCommand added in v1.5.0

func NewSystemMsgHealthCheckCommand(
	systemMsgRepo SystemMsgRepo,
) SystemMsgHealthCheckCommand

NewSystemMsgHealthCheckCommand creates a new instance of SystemMsgHealthCheckCommand.

type SystemMsgRepo added in v1.5.0

type SystemMsgRepo interface {
	// SaveSystemMsg saves the system message file.
	SaveSystemMsg() error

	// GetSystemMsg returns the system message file.
	GetSystemMsg() (string, error)

	// Exists returns true if the system message file exists.
	Exists() bool
}

SystemMsgRepo is the interface that wraps the basic operations with the system message file.

func MakeSystemMsgRepo added in v1.5.0

func MakeSystemMsgRepo() SystemMsgRepo

func NewSystemMsgRepo added in v1.5.0

func NewSystemMsgRepo(storage *storage.Storage) SystemMsgRepo

NewSystemMsgRepo creates a new instance of SystemMsgRepo.

Jump to

Keyboard shortcuts

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