repository

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package repository provides plugin repository management for Tinct.

Package repository provides plugin repository management for Tinct.

Package repository provides plugin repository management for Tinct.

Index

Constants

View Source
const OfficialRepoURL = "https://raw.githubusercontent.com/jmylchreest/tinct-plugins/refs/heads/main/repository/repository.json"

OfficialRepoURL is the URL for the official Tinct plugin repository.

Variables

This section is empty.

Functions

func NormalizePlatform added in v0.0.5

func NormalizePlatform(goos, goarch string) string

NormalizePlatform converts Go's GOOS/GOARCH to repository platform naming. Repository uses "x86" instead of "amd64" for compatibility with other languages.

Types

type CacheConfig

type CacheConfig struct {
	TTL        int              `json:"ttl"`         // Cache TTL in seconds
	LastUpdate map[string]int64 `json:"last_update"` // repo name -> unix timestamp
}

CacheConfig contains cache settings.

type Config

type Config struct {
	Repositories []*Repository `json:"repositories"`
	Cache        *CacheConfig  `json:"cache,omitempty"`
}

Config contains all configured repositories.

type Download

type Download struct {
	URL               string     `json:"url"`
	Checksum          string     `json:"checksum"` // Format: "sha256:..."
	Size              int64      `json:"size,omitempty"`
	Runtime           string     `json:"runtime,omitempty"`      // e.g., "python3", "bash"
	Dependencies      []string   `json:"dependencies,omitempty"` // Runtime dependencies
	Available         bool       `json:"available"`
	LastVerified      *time.Time `json:"last_verified,omitempty"`
	UnavailableSince  *time.Time `json:"unavailable_since,omitempty"`
	UnavailableReason string     `json:"unavailable_reason,omitempty"`
}

Download represents a downloadable artifact for a specific platform.

type Manager

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

Manager handles plugin repository operations.

func NewManager

func NewManager(configPath, cachePath string) (*Manager, error)

NewManager creates a new repository manager.

func (*Manager) AddRepository

func (m *Manager) AddRepository(name, url string) error

AddRepository adds a new repository.

func (*Manager) FindPlugin

func (m *Manager) FindPlugin(name, version string) (*SearchResult, error)

FindPlugin finds a specific plugin by name across all repositories.

func (*Manager) FindPluginInRepository

func (m *Manager) FindPluginInRepository(repoName, pluginName, version string) (*SearchResult, error)

FindPluginInRepository finds a plugin in a specific repository.

func (*Manager) GetRepository

func (m *Manager) GetRepository(name string) (*Repository, error)

GetRepository returns a repository by name.

func (*Manager) ListRepositories

func (m *Manager) ListRepositories() []*Repository

ListRepositories returns all configured repositories.

func (*Manager) RemoveRepository

func (m *Manager) RemoveRepository(name string) error

RemoveRepository removes a repository by name.

func (*Manager) Search

func (m *Manager) Search(filter SearchFilter) ([]*SearchResult, error)

Search searches for plugins across all repositories.

func (*Manager) UpdateAllRepositories

func (m *Manager) UpdateAllRepositories() error

UpdateAllRepositories refreshes all repositories.

func (*Manager) UpdateRepository

func (m *Manager) UpdateRepository(name string) error

UpdateRepository refreshes a repository's manifest.

type Manifest

type Manifest struct {
	Version      string             `json:"version"`
	Name         string             `json:"name"`
	Description  string             `json:"description"`
	URL          string             `json:"url"`
	MaintainedBy string             `json:"maintained_by,omitempty"`
	LastUpdated  time.Time          `json:"last_updated"`
	LastPruned   *time.Time         `json:"last_pruned,omitempty"`
	Plugins      map[string]*Plugin `json:"plugins"`
}

Manifest represents a plugin repository manifest.

type Plugin

type Plugin struct {
	Name        string    `json:"name"`
	Type        string    `json:"type"` // "input" or "output"
	Description string    `json:"description"`
	Repository  string    `json:"repository"`
	Author      string    `json:"author,omitempty"`
	License     string    `json:"license,omitempty"`
	Tags        []string  `json:"tags,omitempty"`
	Versions    []Version `json:"versions"`
}

Plugin represents a plugin in the repository.

type PluginSource

type PluginSource struct {
	Type         string `json:"type"` // "repository", "http", "local"
	Repository   string `json:"repository,omitempty"`
	Plugin       string `json:"plugin,omitempty"`
	Version      string `json:"version,omitempty"`
	URL          string `json:"url,omitempty"`
	Checksum     string `json:"checksum,omitempty"`
	OriginalPath string `json:"original_path,omitempty"`
}

PluginSource represents where a plugin was installed from.

type Repository

type Repository struct {
	Name     string    `json:"name"`
	URL      string    `json:"url"`
	Manifest *Manifest `json:"-"` // Cached manifest (not persisted)
}

Repository represents a configured plugin repository.

type SearchFilter

type SearchFilter struct {
	Query      string
	Type       string // "input" or "output"
	Tags       []string
	Author     string
	Repository string
}

SearchFilter contains criteria for searching plugins.

type SearchResult

type SearchResult struct {
	Plugin     *Plugin
	Version    *Version
	Repository string
}

SearchResult represents a plugin found in search.

type SyncStats

type SyncStats struct {
	Total     int
	Installed int
	Existing  int
	Failed    int
	Skipped   int
}

SyncStats tracks statistics for sync operations.

type VerifyResult

type VerifyResult struct {
	Name     string
	Status   string // "valid", "mismatch", "missing", "no_checksum"
	Error    error
	Expected string
	Got      string
}

VerifyResult represents the result of verifying a plugin.

type Version

type Version struct {
	Version       string               `json:"version"`
	Released      time.Time            `json:"released"`
	Compatibility string               `json:"compatibility,omitempty"` // e.g., ">=1.0.0"
	ChangelogURL  string               `json:"changelog_url,omitempty"`
	Downloads     map[string]*Download `json:"downloads"`
}

Version represents a specific version of a plugin.

Jump to

Keyboard shortcuts

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