resolver

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 8 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

View Source
const (
	VersionKindRelease = "release" // semver-parseable tag
	VersionKindTag     = "tag"     // non-semver tag
	VersionKindBranch  = "branch"
)

Version kinds for SourceVersion (spec 011 US3).

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). Git sources report the ls-remote round-trip through the context progress sink, so every caller gets resolve progress without emitting its own.

type SourceVersion added in v0.3.0

type SourceVersion struct {
	Kind   string
	Name   string
	Commit string
}

SourceVersion is one selectable version of a git source.

func ListVersions added in v0.3.0

func ListVersions(ctx context.Context, runner git.Runner, ref source.Ref) ([]SourceVersion, error)

ListVersions lists a source's selectable versions: release tags in descending semver order, then other tags, then branch heads. Listing failures are returned to the caller — the app layer decides how to degrade (FR-012); the resolver only reports.

Jump to

Keyboard shortcuts

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