git

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitAndRelease

func CommitAndRelease(ctx context.Context, changelogEntry string, bump VersionBump) error

CommitAndRelease performs the full git workflow: 1. git add -A 2. Read CHANGELOG.md and add entry 3. Bump version (patch or minor) 4. git commit 5. git tag 6. git push + push tag

func CommitCompletedFile

func CommitCompletedFile(ctx context.Context, path string) error

CommitCompletedFile stages and commits a completed prompt file. This is called after MoveToCompleted() to ensure the moved file is committed. Does nothing if the file is already staged or committed.

func GetNextVersion

func GetNextVersion(ctx context.Context, bump VersionBump) (string, error)

GetNextVersion determines the next version based on the bump type.

func MoveFile

func MoveFile(ctx context.Context, oldPath string, newPath string) error

MoveFile moves a file using git-aware operations to preserve history. Falls back to os.Rename if git operations fail or not in a git repo.

Types

type Brancher added in v0.9.0

type Brancher interface {
	CreateAndSwitch(ctx context.Context, name string) error
	Push(ctx context.Context, name string) error
	Switch(ctx context.Context, name string) error
	CurrentBranch(ctx context.Context) (string, error)
}

Brancher handles git branch operations.

func NewBrancher added in v0.9.0

func NewBrancher() Brancher

NewBrancher creates a new Brancher.

type PRCreator added in v0.9.0

type PRCreator interface {
	Create(ctx context.Context, title string, body string) (string, error)
}

PRCreator handles GitHub pull request creation.

func NewPRCreator added in v0.9.0

func NewPRCreator() PRCreator

NewPRCreator creates a new PRCreator.

type Releaser

type Releaser interface {
	GetNextVersion(ctx context.Context, bump VersionBump) (string, error)
	CommitAndRelease(ctx context.Context, title string, bump VersionBump) error
	CommitCompletedFile(ctx context.Context, path string) error
	CommitOnly(ctx context.Context, message string) error
	HasChangelog(ctx context.Context) bool
	MoveFile(ctx context.Context, oldPath string, newPath string) error
}

Releaser handles git commit, tag, and push operations.

func NewReleaser

func NewReleaser() Releaser

NewReleaser creates a new Releaser.

type SemanticVersionNumber

type SemanticVersionNumber struct {
	Major int
	Minor int
	Patch int
}

SemanticVersionNumber represents a parsed semantic version.

func ParseSemanticVersionNumber

func ParseSemanticVersionNumber(ctx context.Context, tag string) (SemanticVersionNumber, error)

ParseSemanticVersionNumber parses "vX.Y.Z" into a SemanticVersionNumber. Returns error if format is invalid.

func (SemanticVersionNumber) BumpMinor

BumpMinor returns a new version with minor incremented and patch reset to 0.

func (SemanticVersionNumber) BumpPatch

BumpPatch returns a new version with patch incremented.

func (SemanticVersionNumber) Less

Less returns true if v is lower than other.

func (SemanticVersionNumber) String

func (v SemanticVersionNumber) String() string

String returns the "vX.Y.Z" representation.

type VersionBump

type VersionBump int

VersionBump specifies the type of version bump to perform.

const (
	// PatchBump increments the patch version (vX.Y.Z -> vX.Y.Z+1)
	PatchBump VersionBump = iota
	// MinorBump increments the minor version (vX.Y.Z -> vX.Y+1.0)
	MinorBump
)

Jump to

Keyboard shortcuts

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