discovery

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: BSD-2-Clause Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHubResolver

type GitHubResolver struct {
	Client *github.Client
}

GitHubResolver resolves github:topic/<topic> meta-sources via the GitHub API.

func NewGitHubResolver

func NewGitHubResolver(client *github.Client) *GitHubResolver

func NewGitHubResolverUnauthenticated

func NewGitHubResolverUnauthenticated() *GitHubResolver

NewGitHubResolverUnauthenticated creates an unauthenticated resolver (lower rate limits).

func NewGitHubResolverWithToken

func NewGitHubResolverWithToken(token string) *GitHubResolver

NewGitHubResolverWithToken creates a resolver authenticated with a personal access token.

func (*GitHubResolver) Handles

func (r *GitHubResolver) Handles(source string) bool

func (*GitHubResolver) Resolve

func (r *GitHubResolver) Resolve(source string) ([]ResolvedRepo, error)

type ResolvedRepo

type ResolvedRepo struct {
	URL          string            // git clone URL
	Branch       string            // branch to fetch from
	Origin       string            // how this repo was discovered (e.g. "explicit", "github:topic/vctm")
	Organization string            // explicit organization label (empty = infer from URL)
	Path         string            // optional relative path within the repo to restrict credential discovery
	Layout       string            // repo plugin layout name (empty = "default")
	Options      map[string]string // layout-specific options from sources.yaml
}

ResolvedRepo is a concrete git repository to fetch credential data from.

func ResolveAll

func ResolveAll(manifest *SourceManifest, resolvers []Resolver) ([]ResolvedRepo, error)

ResolveAll resolves all sources in a manifest into concrete repos using the provided resolvers. Explicit git: entries are resolved directly. Duplicate repos (same URL) are deduplicated, with explicit entries taking precedence over meta-source results.

type Resolver

type Resolver interface {
	// Resolve takes a meta-source URI and returns the repos it resolves to.
	Resolve(source string) ([]ResolvedRepo, error)
	// Handles returns true if this resolver can handle the given source URI scheme.
	Handles(source string) bool
}

Resolver resolves meta-sources into concrete repos.

type SourceDefaults

type SourceDefaults struct {
	Branch string `yaml:"branch"`
}

SourceDefaults contains default settings applied to all resolved repos.

type SourceEntry added in v0.7.0

type SourceEntry struct {
	URL          string            `yaml:"url"`
	Organization string            `yaml:"organization,omitempty"`
	Branch       string            `yaml:"branch,omitempty"`
	Path         string            `yaml:"path,omitempty"`
	Layout       string            `yaml:"layout,omitempty"`
	Options      map[string]string `yaml:"options,omitempty"`
}

SourceEntry represents a source in the manifest. It can be either a plain string URI or a struct with explicit organization and branch overrides.

Plain string:

sources:
  - "git:https://github.com/org/repo.git"

Struct with organization and branch:

sources:
  - url: "git:https://github.com/org/repo.git"
    organization: "MyOrg"
    branch: "vctm"

func (*SourceEntry) UnmarshalYAML added in v0.7.0

func (s *SourceEntry) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML allows SourceEntry to be parsed from either a plain string or a mapping with url and organization fields.

type SourceManifest

type SourceManifest struct {
	Sources  []SourceEntry  `yaml:"sources"`
	Defaults SourceDefaults `yaml:"defaults"`
}

SourceManifest is the top-level structure of a sources.yaml file.

func LoadManifest

func LoadManifest(path string) (*SourceManifest, error)

LoadManifest reads and parses a sources.yaml file.

Jump to

Keyboard shortcuts

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