registry

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalPath added in v0.2.0

func CanonicalPath(path string) string

CanonicalPath makes two spellings of the same directory comparable: absolute, cleaned, and with symlinks resolved.

Resolving matters because the answer decides whether a directory counts as registered, and registration is what devvault requires before it mounts any credentials. On macOS /tmp and /var are symlinks, so a registry entry recorded as /var/x and a working directory reported as /private/var/x are the same directory; without resolving, devvault would treat a registered project as unregistered and refuse to work with it.

A path that does not exist cannot be resolved, in which case the cleaned absolute form is the best available answer.

func Home

func Home() (string, error)

func MakeID

func MakeID(customer, name string) string

func Path

func Path() (string, error)

func Save

func Save(reg Registry) error

func SetTrustedDigests added in v0.2.0

func SetTrustedDigests(reg *Registry, id string, files map[string]string) bool

SetTrustedDigests replaces the approved digests of a project. It reports whether the project exists; approvals for unknown projects are dropped instead of silently creating a registry entry.

func TrustedDigests added in v0.2.0

func TrustedDigests(reg Registry, id string) map[string]string

TrustedDigests returns the approved file digests of a project. The result is a copy and is never nil, so callers can read it without a registry lock.

func Upsert

func Upsert(reg *Registry, id string, project Project)

func UpsertCredentialSet

func UpsertCredentialSet(reg *Registry, customerID, setID string, set CredentialSet)

func UpsertCustomer

func UpsertCustomer(reg *Registry, id string, customer Customer)

Types

type CredentialSet

type CredentialSet struct {
	Profile    string `yaml:"profile"`
	Mount      string `yaml:"mount"`
	AuthMethod string `yaml:"auth_method"`
}

func ResolveCredentialSet

func ResolveCredentialSet(reg Registry, project Project) (CredentialSet, bool)

type Customer

type Customer struct {
	Name             string                   `yaml:"name,omitempty"`
	DefaultWorkspace string                   `yaml:"default_workspace,omitempty"`
	CredentialSets   map[string]CredentialSet `yaml:"credential_sets,omitempty"`
}

type GitInfo

type GitInfo struct {
	Provider    string `yaml:"provider,omitempty"`
	Host        string `yaml:"host,omitempty"`
	Owner       string `yaml:"owner,omitempty"`
	Repo        string `yaml:"repo,omitempty"`
	URL         string `yaml:"url,omitempty"`
	CloneMethod string `yaml:"clone_method,omitempty"`
	Local       bool   `yaml:"local,omitempty"`
}

type Project

type Project struct {
	Alias         string       `yaml:"alias,omitempty"`
	Customer      string       `yaml:"customer"`
	Name          string       `yaml:"name"`
	CredentialSet string       `yaml:"credential_set,omitempty"`
	Path          string       `yaml:"path"`
	GitURL        string       `yaml:"git_url,omitempty"`
	Git           GitInfo      `yaml:"git,omitempty"`
	Backend       string       `yaml:"backend,omitempty"`
	LastOpened    time.Time    `yaml:"last_opened,omitempty"`
	Trust         *TrustRecord `yaml:"trust,omitempty"`
}

func FindByPath added in v0.2.0

func FindByPath(reg Registry, path string) (string, Project, bool)

FindByPath returns the project registered for path. Callers that only know where a repository lives — not under which id it was registered — use it to reach the user-owned data for that repository.

func InferProject

func InferProject(path string) (Project, string, error)

func Resolve

func Resolve(reg Registry, key string) (string, Project, error)

type Registry

type Registry struct {
	Active    string              `yaml:"active"`
	Customers map[string]Customer `yaml:"customers,omitempty"`
	Projects  map[string]Project  `yaml:"projects"`
}

func Load

func Load() (Registry, error)

type TrustRecord added in v0.2.0

type TrustRecord struct {
	ApprovedAt time.Time `yaml:"approved_at"`
	// Files maps a repository-relative path to "sha256:<hex>".
	Files map[string]string `yaml:"files"`
}

TrustRecord holds the digests of the devvault-managed repository files the user approved for a project. It lives in the user-owned registry, never in the repository, so a repository can never approve itself.

Jump to

Keyboard shortcuts

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