git

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGitmoji added in v0.3.0

func AddGitmoji(message, commitType string) string

AddGitmoji adds emoji if configured, or just ensures a clean type prefix.

func CommitChanges

func CommitChanges(ctx context.Context, commitMessage string) error

CommitChanges creates a commit with a supplied message and the configured author identity.

func FilterLockFiles

func FilterLockFiles(diff string, lockFiles []string) string

FilterLockFiles drops entire file sections that match any of the provided lock file names.

func GetCurrentBranch

func GetCurrentBranch(ctx context.Context) (string, error)

GetCurrentBranch returns the short name of the current branch.

func GetGitDiffIgnoringMoves added in v0.6.0

func GetGitDiffIgnoringMoves(ctx context.Context) (string, error)

GetGitDiffIgnoringMoves builds a textual diff based on HEAD vs current working tree, focused on staged changes (status.Staging != Unmodified). It removes moves and attempts to drop pure comment-only changes to produce a cleaner prompt for LLMs.

NOTE: New content is read from the working tree, not the index. This is a known limitation if the user stages partial changes and then edits further. To make it *exactly* reflect the index, you’d need to read blobs from the index (or shell-out to `git show :path`).

func GetHeadCommitMessage added in v0.1.0

func GetHeadCommitMessage(ctx context.Context) (string, error)

GetHeadCommitMessage returns the HEAD commit message.

func IsGitRepository added in v0.3.0

func IsGitRepository(ctx context.Context) bool

IsGitRepository returns true if "." is a Git repo.

func PrependCommitType added in v0.3.0

func PrependCommitType(message, commitType string, withEmoji bool) string

PrependCommitType ensures there's a single prefix (optionally with gitmoji) and prepends it.

Types

type DiffChunk added in v0.1.0

type DiffChunk struct {
	FilePath   string
	HunkHeader string
	Lines      []string
}

DiffChunk represents a parsed @@ hunk from a diff.

func ParseDiffToChunks added in v0.1.0

func ParseDiffToChunks(diff string) ([]DiffChunk, error)

ParseDiffToChunks splits our diff into per-file hunk chunks used by the interactive splitter.

Jump to

Keyboard shortcuts

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