commitrules

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommitRules = map[string]CommitRule{
	"feat": {
		Type:        "feat",
		Description: "A new feature",
		Examples:    []string{"feat(core): add user authentication service", "feat(ui): implement dark mode toggle"},
	},
	"fix": {
		Type:        "fix",
		Description: "A bug fix",
		Examples:    []string{"fix(api): resolve null pointer in validation", "fix(ui): correct button alignment"},
	},
	"docs": {
		Type:        "docs",
		Description: "Documentation only changes",
		Examples:    []string{"docs(readme): update installation instructions", "docs(api): add endpoint documentation"},
	},
	"style": {
		Type:        "style",
		Description: "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)",
		Examples:    []string{"style(utils): format code with prettier", "style(ui): fix indentation"},
	},
	"refactor": {
		Type:        "refactor",
		Description: "A code change that neither fixes a bug nor adds a feature",
		Examples:    []string{"refactor(utils): extract validation logic", "refactor(api): simplify request handling"},
	},
	"test": {
		Type:        "test",
		Description: "Adding missing tests or correcting existing tests",
		Examples:    []string{"test(core): add unit tests for user service", "test(api): fix integration tests"},
	},
	"chore": {
		Type:        "chore",
		Description: "Other changes that don't modify src or test files",
		Examples:    []string{"chore(deps): update dependencies", "chore(build): update build configuration"},
	},
}

CommitRules holds all available commit types and their rules

Functions

func CleanCommitMessage

func CleanCommitMessage(message string) string

CleanCommitMessage cleans and formats the generated commit message

func GetCommitTypes

func GetCommitTypes() []string

GetCommitTypes returns all available commit types

func GetPrompt

func GetPrompt(analysisInput string) string

GetPrompt generates the commit message prompt based on analysis input

func ValidateCommitMessage

func ValidateCommitMessage(message string) error

ValidateCommitMessage validates if a commit message follows the conventional format

Types

type CommitRule

type CommitRule struct {
	Type        string
	Description string
	Examples    []string
}

CommitRule defines the structure for commit message rules

Jump to

Keyboard shortcuts

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