message

package
v0.2.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: 4 Imported by: 0

Documentation

Overview

Package message builds the LLM prompt for a commit message and sanitizes the model's response. It is pure: no I/O, no environment, no process execution.

Index

Constants

View Source
const (
	TypePlain        = "plain"
	TypeConventional = "conventional"
	TypeGitmoji      = "gitmoji"
)

Commit message format types. These are the only values csp generates for; the "+body" variants of earlier versions were dropped because csp always produces a single-line message.

Variables

This section is empty.

Functions

func BuildPrompt

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

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

func Sanitize

func Sanitize(msg string) string

Sanitize turns a raw model response into a single-line commit message.

It does NOT strip Markdown code fences: that is the codex layer's responsibility (and applies to the pr command too), whereas Sanitize is only applied to generated commit messages. The steps are: remove <think> blocks, keep the first line, drop a trailing period, strip surrounding quotes, and strip a leading tag.

Types

This section is empty.

Jump to

Keyboard shortcuts

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