operations

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package operations provides reusable operations for module manipulation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeriveDependencyName added in v0.12.1

func DeriveDependencyName(path string) string

DeriveDependencyName extracts a display name from a file path. For .version files, uses the parent directory name. For other files (package.json, etc.), uses the filename.

func SyncDependencies added in v0.12.1

func SyncDependencies(registry *plugins.PluginRegistry, version semver.SemVersion, bumpedPaths ...string) error

SyncDependencies updates all configured dependency files to match the new version. Returns nil if dependency checker is not enabled or auto-sync is disabled. The bumpedPaths parameter contains paths that were already bumped as modules and should be excluded from the output (they're still synced but not displayed twice).

Types

type BumpOperation

type BumpOperation struct {
	// contains filtered or unexported fields
}

BumpOperation performs a version bump on a module.

func NewBumpOperation

func NewBumpOperation(fs core.FileSystem, bumper semver.VersionBumper, bumpType BumpType, preRelease, metadata string, preserveMetadata bool) *BumpOperation

NewBumpOperation creates a new bump operation.

func (*BumpOperation) Execute

func (op *BumpOperation) Execute(ctx context.Context, mod *workspace.Module) error

Execute performs the bump operation on the module.

func (*BumpOperation) Name

func (op *BumpOperation) Name() string

Name returns the name of this operation.

func (*BumpOperation) Preview added in v0.12.1

func (op *BumpOperation) Preview(ctx context.Context, path string) (BumpResult, error)

Preview calculates the new version without writing it. This allows callers to inspect the result for hooks and validation before committing the write via Write().

func (*BumpOperation) Write added in v0.12.1

func (op *BumpOperation) Write(ctx context.Context, path string, version semver.SemVersion) error

Write saves the given version to the specified path. Used after Preview() when the caller has completed hooks and validation.

type BumpResult added in v0.12.1

type BumpResult struct {
	PreviousVersion semver.SemVersion
	NewVersion      semver.SemVersion
}

BumpResult holds the result of a version bump calculation.

type BumpType

type BumpType string

BumpType represents the type of version bump to perform.

const (
	BumpPatch   BumpType = "patch"
	BumpMinor   BumpType = "minor"
	BumpMajor   BumpType = "major"
	BumpRelease BumpType = "release"
	BumpAuto    BumpType = "auto"
	BumpPre     BumpType = "pre"
)

type PreOperation

type PreOperation struct {
	// contains filtered or unexported fields
}

PreOperation sets or increments pre-release labels on a module.

func NewPreOperation

func NewPreOperation(fs core.FileSystem, label string, increment bool) *PreOperation

NewPreOperation creates a new pre-release operation.

func (*PreOperation) Execute

func (op *PreOperation) Execute(ctx context.Context, mod *workspace.Module) error

Execute performs the pre-release operation on the module.

func (*PreOperation) Name

func (op *PreOperation) Name() string

Name returns the name of this operation.

type SetOperation

type SetOperation struct {
	// contains filtered or unexported fields
}

SetOperation sets the version of a module to a specific value.

func NewSetOperation

func NewSetOperation(fs core.FileSystem, version string) *SetOperation

NewSetOperation creates a new set operation.

func (*SetOperation) Execute

func (op *SetOperation) Execute(ctx context.Context, mod *workspace.Module) error

Execute sets the version on the module.

func (*SetOperation) Name

func (op *SetOperation) Name() string

Name returns the name of this operation.

type ShowOperation

type ShowOperation struct {
	// contains filtered or unexported fields
}

ShowOperation reads and displays the current version of a module.

func NewShowOperation

func NewShowOperation(fs core.FileSystem) *ShowOperation

NewShowOperation creates a new show operation.

func (*ShowOperation) Execute

func (op *ShowOperation) Execute(ctx context.Context, mod *workspace.Module) error

Execute reads the version from the module. The version is stored in the module's CurrentVersion field.

func (*ShowOperation) Name

func (op *ShowOperation) Name() string

Name returns the name of this operation.

type ValidateOperation

type ValidateOperation struct {
	// contains filtered or unexported fields
}

ValidateOperation validates the version file of a module.

func NewValidateOperation

func NewValidateOperation(fs core.FileSystem) *ValidateOperation

NewValidateOperation creates a new validate operation.

func (*ValidateOperation) Execute

func (op *ValidateOperation) Execute(ctx context.Context, mod *workspace.Module) error

Execute validates the version file in the module. The current version is stored in the module's CurrentVersion field on success.

func (*ValidateOperation) Name

func (op *ValidateOperation) Name() string

Name returns the name of this operation.

Jump to

Keyboard shortcuts

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