bump

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package bump handles semantic version bumping in package.json, Cargo.toml, pyproject.toml, and plain text version files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detector

type Detector struct {
	Files []string
	Name  string
}

type FileChange

type FileChange struct {
	Path   string
	Before []byte
	After  []byte
	Mode   os.FileMode
	// contains filtered or unexported fields
}

FileChange is an exact file mutation produced by a bump plan. Path is relative to RepoPath so it can be passed directly to Git without consulting the worktree status.

type Level

type Level int
const (
	Patch Level = iota + 1
	Minor
	Major
)

func ParseLevel

func ParseLevel(s string) (Level, error)

func (Level) String

func (l Level) String() string

type Plan

type Plan struct {
	RepoPath       string
	CurrentVersion string
	NewVersion     string
	Changes        []FileChange
}

Plan is a side-effect-free description of a version bump. Creating a Plan only reads files; Apply is the mutation boundary.

func CreatePlan

func CreatePlan(repoPath string, level Level, extraFiles []string, autoDetect bool) (*Plan, error)

CreatePlan inspects all supported manifests and returns the exact mutations required for a bump. When autoDetect is false, only extraFiles are planned.

func (*Plan) Apply

func (p *Plan) Apply() error

Apply transactionally writes all planned changes. It verifies every source file before the first write and restores committed files if a later rename fails.

func (*Plan) ChangedFiles

func (p *Plan) ChangedFiles() []string

ChangedFiles returns the exact repository-relative files Apply will mutate.

func (*Plan) Clone

func (p *Plan) Clone() *Plan

Clone returns a deep copy suitable for embedding in a higher-level immutable release plan without sharing mutable byte slices with the caller.

type Result

type Result struct {
	CurrentVersion string
	NewVersion     string
	ChangedFiles   []string
}

Result reports the exact files changed by a completed bump operation.

func Run

func Run(repoPath string, level Level, extraFiles []string) (Result, error)

Jump to

Keyboard shortcuts

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