lorepackage

package
v0.1.0-dev.20260217020211 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package registry provides the client interface for accessing the devlore registry. It abstracts the underlying transport (git for demo, OCI for scale) and provides a sync-based API where the registry is cloned/pulled locally and accessed from cache.

Index

Constants

This section is empty.

Variables

View Source
var DecommissionPhaseOrder = []string{"unprovision", "uninstall", "cleanup"}

DecommissionPhaseOrder is the order for decommission operations.

View Source
var DeployPhaseOrder = []string{"prepare", "install", "provision", "verify"}

DeployPhaseOrder is the standard order of deploy pipeline phases.

View Source
var LifecycleSchema []byte

LifecycleSchema is the JSON schema for lifecycle.yaml files. These files define lore package metadata. Phase scripts are discovered from the directory structure (see RFC Section 9.3).

View Source
var UpgradePhaseOrder = []string{"prepare", "upgrade", "migrate", "verify"}

UpgradePhaseOrder is the order for upgrade operations. The "migrate" phase handles version-specific migrations (config format changes, data migrations, etc.) that may be needed between versions.

Functions

func ParsePackagePrefix

func ParsePackagePrefix(name string) (string, string)

ParsePackagePrefix extracts the package manager prefix from a package name. On Darwin, packages can be prefixed to explicitly select the package manager:

  • brew: — Homebrew formula (CLI tools)
  • cask: — Homebrew Cask (GUI applications)
  • port: — MacPorts

Without a prefix, auto-detection is used (port if installed, else brew).

Examples:

"brew:wget"        → ("wget", "brew")
"cask:iterm2"      → ("iterm2", "cask")
"port:wget"        → ("wget", "port")
"wget"             → ("wget", "")

Returns (packageName, prefix) where prefix is "brew", "cask", "port", or "" for auto-detect.

func PhaseOrder

func PhaseOrder(op Operation) []string

PhaseOrder returns the phase order for an operation.

func PlatformResolutionOrder

func PlatformResolutionOrder(platform string) []string

PlatformResolutionOrder returns the order of platform directories for phase script chaining, from most general to most specific.

Scripts are executed in this order, allowing specific platforms to build upon general setup. Each script that exists is executed.

Examples:

  • "Linux.Debian" → ["Common", "Unix", "Linux", "Linux.Debian"]
  • "Darwin" → ["Common", "Unix", "Darwin"]
  • "Windows" → ["Common", "Windows"]

func RequiredPhase

func RequiredPhase(op Operation) string

RequiredPhase returns the required phase for an operation. Each operation has exactly one required phase that must be implemented. Native PM packages implement only this phase; lore packages may add others.

  • Deploy requires "install"
  • Upgrade requires "upgrade"
  • Decommission requires "uninstall"

Types

type CacheStats

type CacheStats struct {
	TotalPackages    int
	VerifiedPackages int
	ExpiredPackages  int
	BySource         map[PackageSource]int
}

Stats returns cache statistics.

type Confidence

type Confidence int

Confidence indicates how reliably a package can be installed.

const (
	// ConfidenceHigh means the package is from the lore registry with full lifecycle support.
	ConfidenceHigh Confidence = iota
	// ConfidenceMedium means the package was found in a native PM and verified to exist.
	ConfidenceMedium
	// ConfidenceLow means the package was synthesized but not verified to exist.
	ConfidenceLow
)

func (Confidence) String

func (c Confidence) String() string

type ExampleEntry

type ExampleEntry struct {
	Name        string `yaml:"name"`
	Purpose     string `yaml:"purpose,omitempty"`
	Description string `yaml:"description,omitempty"`
}

ExampleEntry describes an examples asset with discovery metadata.

type Feature

type Feature struct {
	Description string   `yaml:"description"`
	Default     bool     `yaml:"default"`
	Platforms   []string `yaml:"platforms,omitempty"`
}

Feature represents a package feature definition.

type GitProvider

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

GitProvider implements the Provider interface using git. This is the demo-phase provider per ADR-014.

Versioning model:

  • Tags represent package versions (e.g., v1.0.0, v1.2.3)
  • "latest" is a special tag tracking the latest release
  • On main branch: "latest" resolves to the "latest" tag
  • On other branches: "latest" resolves to HEAD (dev convenience)

func NewGitProvider

func NewGitProvider(repoURL, branch string) *GitProvider

NewGitProvider creates a new git-based registry provider.

func (*GitProvider) Branch

func (g *GitProvider) Branch() string

Branch returns the configured branch.

func (*GitProvider) CheckoutVersion

func (g *GitProvider) CheckoutVersion(ctx context.Context, cacheDir, version string) error

CheckoutVersion checks out a specific version (tag or ref) in the cache. This is used when a user requests a specific package version.

func (*GitProvider) CurrentRef

func (g *GitProvider) CurrentRef(ctx context.Context, cacheDir string) (string, error)

CurrentRef returns the current HEAD ref in the cache.

func (*GitProvider) CurrentVersion

func (g *GitProvider) CurrentVersion(ctx context.Context, cacheDir string) (string, error)

CurrentVersion returns the version tag at HEAD, or "" if HEAD is not tagged.

func (*GitProvider) HasTag

func (g *GitProvider) HasTag(ctx context.Context, cacheDir, tag string) (bool, error)

HasTag checks if a specific tag exists.

func (*GitProvider) ListVersions

func (g *GitProvider) ListVersions(ctx context.Context, cacheDir string) ([]string, error)

ListVersions returns all available version tags from the repository. Tags are returned in descending semver order (newest first). Non-semver tags are excluded.

func (*GitProvider) Name

func (g *GitProvider) Name() string

Name returns "git".

func (*GitProvider) RepoURL

func (g *GitProvider) RepoURL() string

RepoURL returns the configured repository URL.

func (*GitProvider) ResolveVersion

func (g *GitProvider) ResolveVersion(ctx context.Context, cacheDir, version string) (string, error)

ResolveVersion resolves a version string to a git ref.

Resolution rules:

  • "latest" on main branch → resolves to "latest" tag
  • "latest" on other branches → resolves to HEAD
  • Semver (e.g., "v1.0.0", "1.0.0") → resolves to that tag
  • Empty string → same as "latest"

func (*GitProvider) Sync

func (g *GitProvider) Sync(ctx context.Context, cacheDir string, opts SyncOptions) (*SyncResult, error)

Sync clones or updates the registry cache. Per ADR-014, uses shallow clone and hard reset (cache semantics, not workspace).

type HardwareProvision

type HardwareProvision struct {
	Description string `yaml:"description"`
	Reference   string `yaml:"reference,omitempty"`
	BootArg     string `yaml:"boot_arg,omitempty"`
}

HardwareProvision defines hardware-specific configuration.

type KnowledgeDomain

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

KnowledgeDomain provides access to knowledge assets within a domain. Methods correspond to subdirectories in the knowledge/{domain}/ structure. Assets are resolved with fallback to the "shared" domain.

func (*KnowledgeDomain) Examples

func (k *KnowledgeDomain) Examples(name string) ([]byte, error)

Examples reads an examples file from knowledge/{domain}/examples/{name}. Falls back to knowledge/shared/examples/{name} if not found in domain.

func (*KnowledgeDomain) Index

func (k *KnowledgeDomain) Index() (*KnowledgeIndex, error)

Index loads the index.yaml manifest for this knowledge domain. Returns nil if the index doesn't exist (domain may have no indexed assets).

func (*KnowledgeDomain) Prompt

func (k *KnowledgeDomain) Prompt(name string) (string, error)

Prompt reads a prompt file from knowledge/{domain}/prompts/{name}. Falls back to knowledge/shared/prompts/{name} if not found in domain.

func (*KnowledgeDomain) Providers

func (k *KnowledgeDomain) Providers(name string) ([]byte, error)

Providers reads a providers reference file from knowledge/{domain}/providers/{name}. Falls back to knowledge/shared/providers/{name} if not found in domain. This is typically used for model context limits and configuration.

func (*KnowledgeDomain) Schema

func (k *KnowledgeDomain) Schema(name string) ([]byte, error)

Schema reads a JSON schema file from knowledge/{domain}/schemas/{name}. Falls back to knowledge/shared/schemas/{name} if not found in domain.

func (*KnowledgeDomain) Signature

func (k *KnowledgeDomain) Signature(name string) ([]byte, error)

Signature reads a signature file from knowledge/{domain}/signatures/{name}. Falls back to knowledge/shared/signatures/{name} if not found in domain.

func (*KnowledgeDomain) Slots

func (k *KnowledgeDomain) Slots(name string) ([]byte, error)

Slots reads a slots definition file from knowledge/{domain}/slots/{name}. Falls back to knowledge/shared/slots/{name} if not found in domain.

func (*KnowledgeDomain) Transform

func (k *KnowledgeDomain) Transform(name string) ([]byte, error)

Transform reads a transform file from knowledge/{domain}/transforms/{name}. Falls back to knowledge/shared/transforms/{name} if not found in domain.

type KnowledgeIndex

type KnowledgeIndex struct {
	Domain     string           `yaml:"domain"`
	Prompts    []PromptEntry    `yaml:"prompts,omitempty"`
	Schemas    []SchemaEntry    `yaml:"schemas,omitempty"`
	Examples   []ExampleEntry   `yaml:"examples,omitempty"`
	Transforms []TransformEntry `yaml:"transforms,omitempty"`
	Signatures []SignatureEntry `yaml:"signatures,omitempty"`
	Slots      []SlotEntry      `yaml:"slots,omitempty"`
}

KnowledgeIndex represents the index.yaml manifest for a knowledge domain. It lists all available assets by type with metadata for discovery.

func (*KnowledgeIndex) PromptByPurpose

func (idx *KnowledgeIndex) PromptByPurpose(purpose string) string

PromptByPurpose finds a prompt by its semantic purpose key. Returns empty string if not found.

func (*KnowledgeIndex) SchemaByPurpose

func (idx *KnowledgeIndex) SchemaByPurpose(purpose string) string

SchemaByPurpose finds a schema by its semantic purpose key.

func (*KnowledgeIndex) SignatureNames

func (idx *KnowledgeIndex) SignatureNames() []string

SignatureNames returns just the filenames for iteration.

func (*KnowledgeIndex) TransformBySourceSystem

func (idx *KnowledgeIndex) TransformBySourceSystem(system string) string

TransformBySourceSystem finds a transform by the source system it handles.

type Lifecycle

type Lifecycle struct {
	Name        string             `yaml:"name"`
	Version     string             `yaml:"version"`
	Description string             `yaml:"description"`
	Homepage    string             `yaml:"homepage,omitempty"`
	Repository  string             `yaml:"repository,omitempty"`
	License     string             `yaml:"license,omitempty"`
	Maintainer  string             `yaml:"maintainer,omitempty"`
	Aliases     []string           `yaml:"aliases,omitempty"`
	Signatures  Signatures         `yaml:"signatures,omitempty"`
	Platforms   []string           `yaml:"platforms"`
	Provides    []string           `yaml:"provides,omitempty"`
	Conflicts   []string           `yaml:"conflicts,omitempty"`
	Features    map[string]Feature `yaml:"features,omitempty"`
	Settings    map[string]Setting `yaml:"settings,omitempty"`
	Tags        []string           `yaml:"tags,omitempty"`
	Notes       string             `yaml:"notes,omitempty"`

	// Verification defines how to verify the installation.
	Verification struct {
		Command string `yaml:"command,omitempty"`
		Pattern string `yaml:"pattern,omitempty"`
	} `yaml:"verification,omitempty"`

	// HardwareProvisions defines hardware-specific configuration requirements.
	HardwareProvisions map[string]HardwareProvision `yaml:"hardware_provisions,omitempty"`
	// contains filtered or unexported fields
}

Lifecycle represents a lore package's lifecycle manifest. This is loaded from lifecycle.yaml in the package directory. Phase scripts are discovered from the directory structure, not from YAML.

func LoadLifecycle

func LoadLifecycle(packageDir string) (*Lifecycle, error)

LoadLifecycle loads a lifecycle manifest from a package directory.

func (*Lifecycle) DiscoverAllPhases

func (l *Lifecycle) DiscoverAllPhases(packageDir, platform string, op Operation) map[string][]string

DiscoverAllPhases returns a map of phase name to script paths for all phases in an operation on the given platform.

func (*Lifecycle) DiscoverPhaseScripts

func (l *Lifecycle) DiscoverPhaseScripts(packageDir, platform string, op Operation, phase string) []string

DiscoverPhaseScripts returns all phase scripts for a phase, ordered from most general to most specific for chained execution.

Example for platform="Linux.Debian", op=OpDeploy, phase="install":

["Common/Deploy/install.star", "Unix/Deploy/install.star",
 "Linux/Deploy/install.star", "Linux.Debian/Deploy/install.star"]

Only scripts that exist are included.

func (*Lifecycle) EnabledFeatures

func (l *Lifecycle) EnabledFeatures(explicit []string) []string

EnabledFeatures returns the list of enabled features given explicit enables and the default settings.

func (*Lifecycle) GetPhaseScript

func (l *Lifecycle) GetPhaseScript(packageDir, platform string, op Operation, phase string) string

GetPhaseScript returns the path to a single phase script for the given platform and operation. This finds the MOST SPECIFIC script only. For chained execution, use DiscoverPhaseScripts instead.

Returns empty string if no script exists for this phase.

func (*Lifecycle) HasPhase

func (l *Lifecycle) HasPhase(packageDir, platform string, op Operation, phase string) bool

HasPhase returns true if at least one phase script exists for this phase on the given platform and operation.

func (*Lifecycle) IsSynthetic

func (l *Lifecycle) IsSynthetic() bool

IsSynthetic returns true if this lifecycle was synthesized for a native PM package.

func (*Lifecycle) ResolvedSettings

func (l *Lifecycle) ResolvedSettings(explicit map[string]string) map[string]string

ResolvedSettings returns settings with defaults filled in.

func (*Lifecycle) SupportsPlatform

func (l *Lifecycle) SupportsPlatform(platform string) bool

SupportsPlatform returns true if the lifecycle supports the given platform.

type NativePMAction

type NativePMAction struct {
	// Manager identifies which package manager to use.
	Manager PackageSource

	// Operation is the PM operation (install, remove, update).
	Operation PMOperation

	// Packages is the list of package names to operate on.
	Packages []string

	// PhaseName is the phase this action belongs to.
	PhaseName string
}

NativePMAction executes a native package manager operation.

func (*NativePMAction) Batchable

func (a *NativePMAction) Batchable() bool

Batchable returns true if this action can be batched with others. Native PM install/upgrade/remove operations are batchable; update (index refresh) is not.

func (*NativePMAction) CanBatchWith

func (a *NativePMAction) CanBatchWith(other *NativePMAction) bool

CanBatchWith returns true if this action can be batched with another. Actions can be batched if they have the same manager, operation, and phase.

func (*NativePMAction) Merge

func (a *NativePMAction) Merge(other *NativePMAction) *NativePMAction

Merge combines this action with another, returning a new batched action. Returns nil if the actions cannot be batched.

func (*NativePMAction) Phase

func (a *NativePMAction) Phase() string

Phase returns the phase name.

func (*NativePMAction) Type

func (a *NativePMAction) Type() PhaseActionType

Type returns ActionNativePM.

type Operation

type Operation string

Operation represents a pipeline operation type.

const (
	OpDeploy       Operation = "Deploy"
	OpUpgrade      Operation = "Upgrade"
	OpDecommission Operation = "Decommission"
)

type PMOperation

type PMOperation int

PMOperation represents a native package manager operation.

const (
	// PMInstall installs packages.
	PMInstall PMOperation = iota
	// PMRemove removes packages.
	PMRemove
	// PMUpdate refreshes the package index.
	PMUpdate
	// PMUpgrade upgrades installed packages.
	PMUpgrade
)

func (PMOperation) String

func (op PMOperation) String() string

String returns the operation name.

type PackageSource

type PackageSource string

PackageSource indicates where a package was resolved from.

const (
	SourceLore   PackageSource = "lore"   // Lore registry (full lifecycle)
	SourceApt    PackageSource = "apt"    // Debian/Ubuntu apt
	SourceDnf    PackageSource = "dnf"    // Fedora/RHEL dnf
	SourceBrew   PackageSource = "brew"   // macOS Homebrew
	SourcePort   PackageSource = "port"   // macOS MacPorts
	SourceWinget PackageSource = "winget" // Windows winget
)

type PhaseAction

type PhaseAction interface {
	// Type returns the action type (script or native PM).
	Type() PhaseActionType

	// Phase returns the phase name this action belongs to.
	Phase() string
}

PhaseAction represents an executable phase action. This provides a uniform interface for both Starlark scripts and native PM operations.

type PhaseActionType

type PhaseActionType int

PhaseActionType distinguishes between script and native PM actions.

const (
	// ActionScript is a Starlark phase script.
	ActionScript PhaseActionType = iota
	// ActionNativePM is a native package manager operation.
	ActionNativePM
)

type PromptEntry

type PromptEntry struct {
	Name        string `yaml:"name"`
	Purpose     string `yaml:"purpose,omitempty"`     // semantic key for discovery
	Description string `yaml:"description,omitempty"` // human-readable description
}

PromptEntry describes a prompt asset with discovery metadata.

type Provider

type Provider interface {
	// Sync updates the local cache from the remote registry.
	// Returns information about what changed.
	Sync(ctx context.Context, cacheDir string, opts SyncOptions) (*SyncResult, error)

	// Name returns the provider type ("git", "oci", etc.)
	Name() string
}

Provider abstracts the transport mechanism for registry access.

type Registry

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

Registry provides access to a devlore registry.

func New

func New(name string, provider Provider, cacheDir string) *Registry

New creates a new registry.

func NewRegistry

func NewRegistry() (*Registry, error)

NewRegistry creates a registry using configuration from ~/.config/devlore/config.yaml. Empty config values use defaults. To override, update your config file.

func (*Registry) Branch

func (r *Registry) Branch() string

Branch returns the configured branch name.

func (*Registry) CacheDir

func (r *Registry) CacheDir() string

CacheDir returns the local cache directory path.

func (*Registry) CheckoutVersion

func (r *Registry) CheckoutVersion(ctx context.Context, version string) error

CheckoutVersion checks out a specific version in the cache.

func (*Registry) CurrentVersion

func (r *Registry) CurrentVersion(ctx context.Context) (string, error)

CurrentVersion returns the version tag at HEAD, or "" if HEAD is not tagged.

func (*Registry) Exists

func (r *Registry) Exists() bool

Exists returns true if the cache exists.

func (*Registry) FileExists

func (r *Registry) FileExists(relPath string) bool

FileExists returns true if the file exists in the cache.

func (*Registry) FilePath

func (r *Registry) FilePath(relPath string) string

FilePath returns the absolute path to a file in the cache.

func (*Registry) ForceTags

func (r *Registry) ForceTags() bool

ForceTags returns whether tag resolution is forced (even on non-main branches).

func (*Registry) Knowledge

func (r *Registry) Knowledge(domain string) *KnowledgeDomain

Knowledge returns a domain accessor for reading knowledge assets. The registry organizes knowledge by domain:

knowledge/migration/   - writ migrate prompts, transforms, signatures
knowledge/onboarding/  - environment initialization
knowledge/package-authoring/ - lore package creation
knowledge/shared/      - common assets inherited by all domains

Usage:

registry.Knowledge("migration").Prompt("migrate-to-writ.txt")
registry.Knowledge("migration").Transform("from-stow.yaml")

func (*Registry) ListPackages

func (r *Registry) ListPackages() ([]SearchResultItem, error)

ListPackages returns all packages in the lore registry.

func (*Registry) ListVersions

func (r *Registry) ListVersions(ctx context.Context) ([]string, error)

ListVersions returns all available version tags. Tags are returned in descending semver order (newest first).

func (*Registry) Open

func (r *Registry) Open(relPath string) (io.ReadCloser, error)

Open opens a file from the cache for reading.

func (*Registry) ReadDir

func (r *Registry) ReadDir(relPath string) ([]os.DirEntry, error)

ReadDir reads a directory from the cache.

func (*Registry) ReadFile

func (r *Registry) ReadFile(relPath string) ([]byte, error)

ReadFile reads a file from the cache.

func (*Registry) Resolve

func (r *Registry) Resolve(name string, platform string) (*Release, error)

Resolve looks up a package by name in the registry. It checks the lore registry first, then falls back to native package managers.

func (*Registry) ResolveVersion

func (r *Registry) ResolveVersion(ctx context.Context, version string) (string, error)

ResolveVersion resolves a version string to a git ref. Uses ForceTags setting to determine behavior on non-main branches.

func (*Registry) ResolveWithConfidence

func (r *Registry) ResolveWithConfidence(name string, platform string) (*Release, Confidence, error)

ResolveWithConfidence resolves a package and returns confidence information.

func (*Registry) Search

func (r *Registry) Search(query string, opts SearchOptions) ([]SearchResultItem, error)

Search performs a federated search across the lore registry and native package managers.

func (*Registry) SignatureIndex

func (r *Registry) SignatureIndex() map[string]map[string]string

SignatureIndex returns the package signature index from signatures.yaml. The index maps manager → native_name → lore_package for detecting native package installations and resolving them to lore packages. Returns an empty map if the file doesn't exist or is invalid.

func (*Registry) Sync

func (r *Registry) Sync(ctx context.Context, opts SyncOptions) (*SyncResult, error)

Sync updates the local cache from the remote registry.

func (*Registry) SyncInfo

func (r *Registry) SyncInfo() (*SyncInfo, error)

SyncInfo returns information about the last sync, if available.

func (*Registry) SyntheticCache

func (r *Registry) SyntheticCache() *SyntheticCache

SyntheticCache returns the synthetic package cache for this registry.

func (*Registry) VerifySyntheticPackage

func (r *Registry) VerifySyntheticPackage(pkg *Release) bool

VerifySyntheticPackage checks if a synthetic package is available and updates the cache.

type Release

type Release struct {
	Name        string        // Package name
	Version     string        // Version (may be "latest" for native PMs)
	Description string        // One-line description
	Source      PackageSource // Where this package was resolved from
	Dir         string        // Package directory (lore packages only)

	// Native package manager name (for non-lore packages)
	// e.g., "docker.io" for apt, "docker" for brew
	NativeName string
	// contains filtered or unexported fields
}

Release provides a uniform view over any package release, whether from the lore registry or a native package manager. Use Lifecycle() to get phase and feature metadata.

func (*Release) DiscoverPhaseScripts

func (rel *Release) DiscoverPhaseScripts(platform string, op Operation, phase string) []string

DiscoverPhaseScripts returns all phase scripts for a phase, ordered from most general to most specific for chained execution.

For native PM packages, returns empty (the engine handles install directly).

func (*Release) HasPhase

func (rel *Release) HasPhase(platform string, op Operation, phase string) bool

HasPhase returns true if at least one phase script exists for this phase.

func (*Release) IsNative

func (rel *Release) IsNative() bool

IsNative returns true if this package comes from a native package manager.

func (*Release) IsSynthetic

func (rel *Release) IsSynthetic() bool

IsSynthetic returns true if the lifecycle is synthetic (not from lifecycle.yaml).

func (*Release) Lifecycle

func (rel *Release) Lifecycle() *Lifecycle

Lifecycle returns the package's lifecycle metadata. For lore packages, this loads from lifecycle.yaml. For native PM packages, this returns a synthetic lifecycle.

func (*Release) PhaseActions

func (rel *Release) PhaseActions(platform string, op Operation, phase string) []PhaseAction

PhaseActions returns the executable actions for a phase. This provides a uniform interface for both lore and native PM packages.

For lore packages: returns ScriptAction items for each discovered script. For native PM packages: returns a NativePMAction for install/uninstall phases.

type SchemaEntry

type SchemaEntry struct {
	Name        string `yaml:"name"`
	Purpose     string `yaml:"purpose,omitempty"`
	Description string `yaml:"description,omitempty"`
}

SchemaEntry describes a JSON schema asset with discovery metadata.

type ScriptAction

type ScriptAction struct {
	// Path is the absolute path to the .star file.
	Path string

	// PhaseName is the phase name (function to call in the script).
	PhaseName string

	// Platform is the platform directory this script came from.
	Platform string
}

ScriptAction executes a Starlark phase script.

func (*ScriptAction) Phase

func (a *ScriptAction) Phase() string

Phase returns the phase name.

func (*ScriptAction) Type

func (a *ScriptAction) Type() PhaseActionType

Type returns ActionScript.

type SearchOptions

type SearchOptions struct {
	IncludeLore   bool // Search lore registry
	IncludeNative bool // Search native package manager
	Limit         int  // Maximum results per source (0 = no limit)
}

SearchOptions controls search behavior.

func DefaultSearchOptions

func DefaultSearchOptions() SearchOptions

DefaultSearchOptions returns sensible defaults for search.

type SearchResultItem

type SearchResultItem struct {
	Name        string        // Package name
	Version     string        // Available version (may be empty)
	Description string        // Package description
	Source      PackageSource // Where this package came from
	Confidence  Confidence    // How reliable is this result
	Installed   bool          // Is it currently installed
}

SearchResultItem represents a package found during federated search.

type Setting

type Setting struct {
	Description string   `yaml:"description"`
	Type        string   `yaml:"type"`
	Default     string   `yaml:"default"`
	Values      []string `yaml:"values,omitempty"`
	Platforms   []string `yaml:"platforms,omitempty"`
}

Setting represents a package setting definition.

type SignatureEntry

type SignatureEntry struct {
	Name        string `yaml:"name"`
	System      string `yaml:"system,omitempty"` // system this signature detects
	Description string `yaml:"description,omitempty"`
}

SignatureEntry describes a signature asset with discovery metadata.

type Signatures

type Signatures map[string][]string

Signatures maps package managers to the names this package is known by. Keys are package manager names (brew, apt, dnf, pacman, winget, choco, cargo, pip, npm, go). Special key "urls" contains regex patterns for detecting URL-based installations (curl|bash, wget, etc.).

Example:

signatures:
  brew: [ripgrep, rg]
  apt: [ripgrep]
  cargo: [ripgrep]
  urls: ['github\.com/BurntSushi/ripgrep']

type SlotEntry

type SlotEntry struct {
	Name        string `yaml:"name"`
	Purpose     string `yaml:"purpose,omitempty"`
	Description string `yaml:"description,omitempty"`
}

SlotEntry describes a slots asset with discovery metadata.

type SyncInfo

type SyncInfo struct {
	LastSync time.Time `yaml:"last_sync"`
	Ref      string    `yaml:"ref"`
	Provider string    `yaml:"provider"`
	Endpoint string    `yaml:"endpoint"`
}

SyncInfo tracks the last sync state.

type SyncOptions

type SyncOptions struct {
	Force bool // Force sync even if cache is fresh
}

SyncOptions controls sync behavior.

type SyncResult

type SyncResult struct {
	Updated   bool      // Whether the cache was updated
	FromRef   string    // Previous reference (commit SHA, digest, etc.)
	ToRef     string    // New reference
	SyncedAt  time.Time // When sync completed
	FromClone bool      // True if this was a fresh clone
}

SyncResult contains information about a sync operation.

type SyntheticCache

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

SyntheticCache manages cached synthetic package definitions. Synthetic packages are created for native PM packages that aren't in the lore registry. The cache reduces repeated package manager queries and provides persistence.

func NewSyntheticCache

func NewSyntheticCache(cacheDir string) *SyntheticCache

NewSyntheticCache creates a new synthetic package cache.

func (*SyntheticCache) Clear

func (c *SyntheticCache) Clear() error

Clear removes all cached synthetic packages.

func (*SyntheticCache) ClearSource

func (c *SyntheticCache) ClearSource(source PackageSource) error

ClearSource removes all cached synthetic packages for a specific source.

func (*SyntheticCache) Delete

func (c *SyntheticCache) Delete(source PackageSource, name string) error

Delete removes a synthetic package from the cache.

func (*SyntheticCache) Get

Get retrieves a cached synthetic package, if it exists and is not expired. Returns nil if not cached or expired.

func (*SyntheticCache) List

func (c *SyntheticCache) List() ([]SyntheticPackageInfo, error)

List returns all cached synthetic packages.

func (*SyntheticCache) Put

Put stores a synthetic package in the cache.

func (*SyntheticCache) Stats

func (c *SyntheticCache) Stats() (*CacheStats, error)

Stats returns statistics about the synthetic cache.

type SyntheticPackageInfo

type SyntheticPackageInfo struct {
	Name        string        `yaml:"name"`
	Source      PackageSource `yaml:"source"`
	NativeName  string        `yaml:"native_name"`
	Version     string        `yaml:"version,omitempty"`
	Description string        `yaml:"description,omitempty"`
	Verified    bool          `yaml:"verified"`    // Was availability verified?
	CachedAt    time.Time     `yaml:"cached_at"`   // When was this cached?
	VerifiedAt  time.Time     `yaml:"verified_at"` // When was availability last verified?
}

SyntheticPackageInfo is the cached metadata for a synthetic package.

type TransformEntry

type TransformEntry struct {
	Name         string `yaml:"name"`
	SourceSystem string `yaml:"source_system,omitempty"` // source system this transform handles
	Description  string `yaml:"description,omitempty"`
}

TransformEntry describes a transform asset with discovery metadata.

Jump to

Keyboard shortcuts

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