pluginrepo

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package pluginrepo manages external plugin repositories (the plugin store). Repositories are JSON indexes listing plugin file names; the luaplugin service owns installation from downloaded bytes.

Index

Constants

This section is empty.

Variables

View Source
var BuiltinRepos = []BuiltinRepo{
	{
		Source: "https://github.com/TheSlopMachine/llm-router-store",
		Index:  "https://raw.githubusercontent.com/TheSlopMachine/llm-router-store/main/llm-router-plugins/index.json",
	},
}

BuiltinRepos lists repositories seeded in code on every startup.

View Source
var ErrBuiltinRepoProtected = errors.New("built-in repository cannot be removed")

ErrBuiltinRepoProtected is returned when removing a built-in repository.

Functions

This section is empty.

Types

type BuiltinRepo

type BuiltinRepo struct {
	Source string
	Index  string
}

BuiltinRepo is one code-defined repository: the source URL shown in the UI and the resolved index.json URL used for downloads.

type IndexDoc

type IndexDoc struct {
	Title       string
	Description string
	Files       []RepoFile
}

IndexDoc is a fetched index: display info plus resolved plugin files.

type RepoFile

type RepoFile struct {
	Path string
	URL  string
}

RepoFile is one plugin file inside a repository.

type RepoRecord

type RepoRecord struct {
	ID          string    `json:"id"`
	Kind        string    `json:"kind"`
	IndexURL    string    `json:"index_url"`
	SourceURL   string    `json:"source_url"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	Builtin     bool      `json:"builtin"`
	AddedAt     time.Time `json:"added_at"`
}

RepoRecord is the stored repository row in BucketPluginRepos.

type RepoRef

type RepoRef struct {
	ID       string
	IndexURL string
}

RepoRef identifies one repository.

type Service

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

Service owns repository records.

func New

func New(database *db.DB) *Service

New constructs a pluginrepo Service.

func (*Service) AddRepo

func (s *Service) AddRepo(ctx context.Context, rawURL string) (*RepoRecord, error)

AddRepo validates a repository or index URL and stores the repo. The first candidate index that parses with a non-empty plugin list wins.

func (*Service) EnsureBuiltinRepos

func (s *Service) EnsureBuiltinRepos() error

EnsureBuiltinRepos seeds the code-defined repositories without network validation, so startup never depends on store availability. Existing rows with the same ID are marked built-in.

func (*Service) FetchFile

func (s *Service) FetchFile(ctx context.Context, id, path string) ([]byte, error)

FetchFile downloads one plugin file.

func (*Service) Get

func (s *Service) Get(id string) (*RepoRecord, error)

Get returns one repository by ID.

func (*Service) GetIndex

func (s *Service) GetIndex(ctx context.Context, id string) (IndexDoc, error)

GetIndex fetches the index document with display info and files.

func (*Service) License

func (s *Service) License(ctx context.Context, id string) (string, bool, error)

License returns the repository license when present.

func (*Service) List

func (s *Service) List() ([]*RepoRecord, error)

List returns all added repositories sorted by ID.

func (*Service) ListPluginFiles

func (s *Service) ListPluginFiles(ctx context.Context, id string) ([]RepoFile, error)

ListPluginFiles lists plugin files for one repository.

func (*Service) PruneLegacyRepos

func (s *Service) PruneLegacyRepos() error

PruneLegacyRepos deletes repository rows from retired schemes. Installed plugins keep working; updates resume after reinstall from the catalog.

func (*Service) ReadMe

func (s *Service) ReadMe(ctx context.Context, id string) (string, bool, error)

ReadMe returns the repository README when present.

func (*Service) Remove

func (s *Service) Remove(id string) error

Remove deletes a repository record.

Jump to

Keyboard shortcuts

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