resolver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package resolver turns a requested source reference into a resolved, immutable revision, keeping requested, resolved, and immutable refs distinct.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMatchingVersion = errors.New("no version matches constraint")

ErrNoMatchingVersion is returned when no tag satisfies a version constraint.

Functions

This section is empty.

Types

type OutdatedResult

type OutdatedResult struct {
	Current   string
	Latest    string
	Available bool
}

OutdatedResult reports whether a newer version is available for a skill.

func Outdated

func Outdated(ctx context.Context, runner git.Runner, ref source.Ref, req Requested, current Revision) (OutdatedResult, error)

Outdated reports available updates for a skill given its current locked revision and the requested constraint, with semantics that depend on the pin type (FR-009, design §9.2). Commit and local pins are never outdated; semver and tag pins compare against the highest satisfying tag; branch pins compare the branch head commit.

type RefKind

type RefKind string

RefKind records how a requested reference was resolved to a revision.

const (
	RefKindSemver RefKind = "semver"
	RefKindTag    RefKind = "tag"
	RefKindBranch RefKind = "branch"
	RefKindCommit RefKind = "commit"
	RefKindLocal  RefKind = "local"
)

Ref kinds (FR-009, FR-010). semver, tag, and commit are immutable; branch and local are mutable.

func (RefKind) Mutable

func (k RefKind) Mutable() bool

Mutable reports whether a revision resolved by this kind can change under the same reference over time (branch and local), which triggers a warning (FR-044, SC-008).

func (RefKind) Valid

func (k RefKind) Valid() bool

Valid reports whether k is a recognized ref kind.

type Requested

type Requested struct {
	Version string // semver constraint
	Ref     string // branch or tag
	Commit  string // explicit commit
}

Requested is the human's version intent (at most one field drives resolution).

type Revision

type Revision struct {
	RefKind    RefKind
	Version    string
	Tag        string
	Branch     string
	Commit     string
	MutableRef bool
}

Revision is the resolved, possibly-immutable identity to pin (FR-009, FR-010).

func Resolve

func Resolve(ctx context.Context, runner git.Runner, ref source.Ref, req Requested) (Revision, []string, error)

Resolve turns a source reference plus requested version into a Revision, returning any advisory warnings (e.g. mutable refs, SC-008).

Jump to

Keyboard shortcuts

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