addon

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(m *Manifest) error

Install executes all steps defined in the manifest inside the current Keel project.

Types

type Manifest

type Manifest struct {
	Name         string   `json:"name"`
	Version      string   `json:"version"`
	Description  string   `json:"description"`
	Repo         string   `json:"repo"`
	DependsOn    []string `json:"depends_on,omitempty"`
	Capabilities []string `json:"capabilities,omitempty"`
	Resources    []string `json:"resources,omitempty"`
	Steps        []Step   `json:"steps"`
}

Manifest is the keel-addon.json structure from an addon repo.

func FetchManifest

func FetchManifest(repo string) (*Manifest, error)

FetchManifest downloads keel-addon.json from a Go module path. Supports github.com module paths and local addon directories.

func InstallOfficialAlias added in v1.3.1

func InstallOfficialAlias(alias string, forceRefresh bool) (*Manifest, error)

InstallOfficialAlias resolves an official addon alias from the registry and installs it.

func InstallRepo added in v1.3.1

func InstallRepo(repo string) (*Manifest, error)

InstallRepo fetches an addon's manifest and executes its installation steps.

func LoadLocalManifest

func LoadLocalManifest() (*Manifest, error)

LoadLocalManifest reads keel-addon.json from the current directory. Used for testing an addon locally before publishing.

type Registry

type Registry struct {
	Version string          `json:"version"`
	Addons  []RegistryEntry `json:"addons"`
}

Registry is the full addon registry fetched from ss-keel-addons.

func FetchRegistry

func FetchRegistry(forceRefresh bool) (*Registry, error)

FetchRegistry returns the addon registry, using a local cache when fresh. Pass forceRefresh=true to bypass the cache.

func (*Registry) ResolveRepo

func (r *Registry) ResolveRepo(alias string) (string, bool)

ResolveRepo maps an alias (e.g. "gorm") to a Go module path. Returns ("", false) when the alias is not in the registry.

type RegistryEntry

type RegistryEntry struct {
	Alias       string `json:"alias"`
	Repo        string `json:"repo"`
	Description string `json:"description"`
	Official    bool   `json:"official"`
}

RegistryEntry is a single addon entry in the official registry.

type Step

type Step struct {
	// Type is one of: go_get | env | property | main_import | main_code |
	// create_provider_file | note
	Type string `json:"type"`

	// go_get
	Package string `json:"package,omitempty"`

	// env | property
	Key         string `json:"key,omitempty"`
	Example     string `json:"example,omitempty"`
	Description string `json:"description,omitempty"`
	Required    bool   `json:"required,omitempty"`
	Secret      bool   `json:"secret,omitempty"`
	Message     string `json:"message,omitempty"`

	// main_import
	Path string `json:"path,omitempty"`

	// main_code
	Anchor string `json:"anchor,omitempty"` // "before_listen" | "before_modules"
	Guard  string `json:"guard,omitempty"`  // skip if already present
	// Replace, when set, replaces the first line in cmd/main.go containing this
	// substring with Code before falling back to insertion.
	Replace string `json:"replace,omitempty"`
	Code    string `json:"code,omitempty"`

	// create_provider_file creates a dedicated setup file with an initializer
	// function, keeping cmd/main.go clean. Guard checks the file before creating.
	Filename string `json:"filename,omitempty"` // e.g. "cmd/setup_provider.go"
	Content  string `json:"content,omitempty"`  // full Go source for the file
}

Step is a single installation action defined in keel-addon.json.

Jump to

Keyboard shortcuts

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