commit

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package commit provides conventional commit message parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BumpMapping added in v0.4.9

type BumpMapping map[string]BumpType

BumpMapping maps conventional commit types to their bump levels. Types not present in the map produce BumpNone. Breaking commits always produce BumpMajor regardless of mapping.

func DefaultBumpMapping added in v0.4.9

func DefaultBumpMapping() BumpMapping

DefaultBumpMapping returns the default mapping: feat→minor, fix/perf→patch.

type BumpType

type BumpType = string
const (
	BumpNone  BumpType = "none"
	BumpPatch BumpType = "patch"
	BumpMinor BumpType = "minor"
	BumpMajor BumpType = "major"
)

func DetermineBump

func DetermineBump(commits []Commit, mapping BumpMapping) BumpType

type Commit

type Commit struct {
	Hash        string
	Type        string
	Scope       string
	Description string
	Body        string
	Footers     []Footer
	Breaking    bool
	Raw         string
}

func FilterByTypes

func FilterByTypes(commits []Commit, types []string) []Commit

func Parse

func Parse(hash, rawMessage string) Commit

Parse parses a raw commit message into a Commit. If the message does not follow the conventional commit format, it returns a Commit with an empty Type.

func (Commit) IsConventional

func (c Commit) IsConventional() bool
type Footer struct {
	Key   string
	Value string
}

Footer represents a conventional commit footer (e.g., "BREAKING CHANGE: description").

Jump to

Keyboard shortcuts

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