fetcher

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSemverTags = errors.New("no semver tags found")

ErrNoSemverTags is returned by LatestTag when a repository has no semver tags.

Functions

func LatestMatchingVersion

func LatestMatchingVersion(repoURL, constraint string) (version, gitTag string, err error)

LatestMatchingVersion queries the remote repo's git tags via git ls-remote and returns the highest version that satisfies constraint. Returns the bare version (e.g. "1.2.3") and the git tag/ref (e.g. "v1.2.3").

If constraint is a branch name (e.g. "main", "HEAD") rather than a semver constraint, it is resolved to the current HEAD SHA of that branch and used directly as the git ref. The returned version is the short SHA.

func LatestTag

func LatestTag(repoURL string) (version, gitTag string, err error)

LatestTag returns the highest semver tag in repoURL, regardless of constraints. Returns the bare version (e.g. "1.2.3") and the git tag (e.g. "v1.2.3").

func ParseDepName

func ParseDepName(name string) (repoURL, subdir string)

ParseDepName splits a GitHub dep name into the repo root URL and subdirectory.

"github.com/owner/repo"                                    → ("https://github.com/owner/repo", "")
"github.com/owner/repo/sub/dir"                            → ("https://github.com/owner/repo", "sub/dir")
"github.com/owner/repo/tree/<branch>/sub/dir"              → ("https://github.com/owner/repo", "sub/dir")

func TreeHash

func TreeHash(dir string) (hash string, files []string, err error)

TreeHash computes a deterministic SHA256 over all files in dir, sorted by relative path. Returns "sha256:<hex>" and the sorted relative file list.

Types

type FetchResult

type FetchResult struct {
	TreeHash string   // "sha256:<hex>"
	Files    []string // sorted relative file paths within the installed directory
}

FetchResult contains the computed tree hash and file list produced by Fetch.

func Fetch

func Fetch(dep resolver.ResolvedDep, installDir string) (FetchResult, error)

Fetch installs the skill directory for dep into installDir using a shallow git sparse-checkout. If installDir already exists and its tree hash matches dep.TreeHash the install is skipped (idempotent).

Returns a FetchResult with the computed tree hash and sorted file list.

Jump to

Keyboard shortcuts

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