gitref

package
v1.0.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package gitref holds the pure, dependency-light logic for classifying and parsing module reference strings (local path vs git, scheme detection, git repo-root resolution). It deliberately avoids importing the engine "core" package (and the Linux-only engine code that comes with it) so that the CLI can reuse this logic and still cross-compile for darwin/windows.

The richer, dagql-aware wrappers (ModuleSourceKind enum, ParsedGitRefString with its GitRef resolution) live in package core and delegate here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RefString

func RefString(cloneRef, sourceRootSubpath, version string) string

RefString builds a module ref string from a clone ref, an optional source root subpath and an optional version.

Types

type EndpointError

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

EndpointError indicates the ref could not be parsed/resolved as a git endpoint (callers may choose to fall back to treating it as a local path).

type Kind

type Kind int

Kind is a quick classification of a module ref string.

const (
	// KindUnknown means the kind could not be determined by a fast heuristic
	// and further inspection (e.g. statting the filesystem) is required.
	KindUnknown Kind = iota
	KindLocal
	KindGit
)

func FastKindCheck

func FastKindCheck(refString, refPin string) Kind

FastKindCheck performs a quick heuristic check to determine whether a module ref string refers to a local path or a git source. Returns KindUnknown if the kind cannot be determined without further inspection.

type Parsed

type Parsed struct {
	ModPath string

	ModVersion string
	HasVersion bool

	RepoRoot       *vcs.RepoRoot
	RepoRootSubdir string

	Scheme SchemeType

	SourceUser     string
	CloneUser      string
	SourceCloneRef string // original user-provided username
	CloneRef       string // resolved username
}

Parsed holds the parsed components of a git ref string.

func Parse

func Parse(ctx context.Context, refString string) (_ Parsed, rerr error)

Parse parses a git ref string into its components.

type SchemeType

type SchemeType int

SchemeType is the URL scheme of a git ref string.

const (
	NoScheme SchemeType = iota
	SchemeHTTP
	SchemeHTTPS
	SchemeSSH
	SchemeSCPLike
)

func (SchemeType) IsSSH

func (s SchemeType) IsSSH() bool

func (SchemeType) Prefix

func (s SchemeType) Prefix() string

Jump to

Keyboard shortcuts

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