resolver

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 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
	Status        OutdatedStatus
	Informational string
}

OutdatedResult reports a skill's update eligibility. Status is the single source of truth for actionability (StatusUpdateAvailable and nothing else); Latest is the actionable candidate (equal to Current when there is none); Informational names the newest upstream revision that exists outside the requested policy and is never applied by a normal update (FR-004, FR-007).

func Outdated

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

Outdated reports update eligibility for a skill given its current locked revision and the requested constraint (spec 018 FR-004/FR-005). Semver constraints compare against the highest satisfying tag; branch tracking compares the branch head; exact tag and commit pins and local sources are stable, never-actionable states.

func (OutdatedResult) Available

func (r OutdatedResult) Available() bool

Available reports whether a normal update can act on this result.

type OutdatedStatus added in v0.5.1

type OutdatedStatus string

OutdatedStatus classifies a skill's update eligibility (spec 018 FR-003).

const (
	StatusUpdateAvailable    OutdatedStatus = "update-available"
	StatusUpToDate           OutdatedStatus = "up-to-date"
	StatusPinnedTag          OutdatedStatus = "pinned-tag"
	StatusPinnedCommit       OutdatedStatus = "pinned-commit"
	StatusLocalSource        OutdatedStatus = "local-source"
	StatusNoCompatibleUpdate OutdatedStatus = "no-compatible-update"
)

Eligibility statuses. Only StatusUpdateAvailable is actionable by a normal update; every other status explains why the skill cannot move without changing its requested tracking policy.

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