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 DisplayRef ¶
DisplayRef keeps the user's spelling while removing URL credentials. HTTP usernames can themselves be tokens. SSH usernames are part of the address.
func GitURLRefString ¶
GitURLRefString builds the explicit Git URL form protocol://repo#ref[:subpath].
func LooksRemote ¶
LooksRemote distinguishes a host/path reference from a missing local path. Callers must check for an existing local directory before using this hint.
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).
func (EndpointError) Unwrap ¶
func (e EndpointError) Unwrap() error
type Kind ¶
type Kind int
Kind is a quick classification of a module ref string.
func FastKindCheck ¶
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
Selector SelectorType
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.
type SchemeType ¶
type SchemeType int
SchemeType is the URL scheme of a git ref string.
const ( NoScheme SchemeType = iota SchemeHTTP SchemeHTTPS SchemeGit SchemeSSH SchemeSCPLike )
func Scheme ¶
func Scheme(refString string) SchemeType
Scheme classifies the transport scheme of a ref string, including SCP-like ("git@host:path") refs. It is a pure, network-free helper so callers can decide eligibility (e.g. for the https-only dagger-get redirect probe) without importing the engine.
func (SchemeType) IsSSH ¶
func (s SchemeType) IsSSH() bool
func (SchemeType) Prefix ¶
func (s SchemeType) Prefix() string
type SelectorType ¶
type SelectorType int
SelectorType describes how a ref selects a revision and source subpath.
const ( NoSelector SelectorType = iota // ModuleVersionSelector is the Go-like import path form: path/to/module@ref. // SemVer-shaped refs in this form may be resolved as version queries. ModuleVersionSelector // GitRefSelector is the Git URL form: protocol://repo#ref[:subpath]. Its ref // is always resolved literally, even when it looks like a SemVer query. GitRefSelector )