commitmsg

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package commitmsg builds the LLM prompt for a commit message and sanitizes the model's response.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(ctx context.Context, opts GenerateOptions) (string, error)

Generate builds the system prompt, invokes codexcli.Run once, and returns the sanitized single-line commit message.

func GeneratePrompt

func GeneratePrompt(locale string, maxLength int, commitType string, customPrompt string) string

GeneratePrompt builds the system prompt sent to the LLM for the given locale, max commit-message length, commit message type, and optional user-supplied custom prompt fragment.

Types

type GenerateOptions

type GenerateOptions struct {
	Model        string
	Locale       string
	Diff         string
	MaxLength    int
	Type         string
	Timeout      time.Duration
	CustomPrompt string
	// Debug, when true, logs the diff being sent to the AI to stdout. The
	// caller is responsible for deciding whether debug logging should be
	// enabled (e.g. based on DEBUG/CSP_DEBUG env vars and headless mode).
	Debug bool
}

GenerateOptions configures Generate.

Jump to

Keyboard shortcuts

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