manifestplugins

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveState

func SaveState(path string, s *ManifestState) error

SaveState writes the manifest state to path atomically (write to .tmp then rename).

func StatePath

func StatePath(annaHome string) string

StatePath returns the path for the manifest state file.

func Validate

func Validate(m *Manifest) error

Types

type BinaryInstallState

type BinaryInstallState struct {
	Name        string    `json:"name"`
	Tool        string    `json:"tool"`
	Version     string    `json:"version"`
	InstalledAt time.Time `json:"installed_at"`
}

type BinaryReconcileResult

type BinaryReconcileResult struct {
	Name     string
	Version  string
	CacheHit bool
	Err      error
}

BinaryReconcileResult holds the result for a single binary within a plugin.

type Manifest

type Manifest struct {
	OAuthProviders []ManifestOAuthProvider `json:"oauth_providers,omitempty" yaml:"oauth_providers,omitempty"`
	Plugins        []ManifestPlugin        `json:"plugins" yaml:"plugins"`
}

func LoadBuiltin

func LoadBuiltin() (*Manifest, error)

func LoadUser

func LoadUser(path string) (*Manifest, error)

func Merge

func Merge(builtin, user *Manifest) *Manifest

Merge merges two Manifest values. Because Manifest.Enabled is bool (not *bool), user entries that omit enabled are treated as enabled=false. To preserve nil semantics, parse user YAML with LoadUserRaw and use MergeRaw.

func MergeRaw

func MergeRaw(builtin, user rawManifest) *Manifest

MergeRaw merges parsed raw manifests, preserving nil Enabled for correct inheritance.

type ManifestBinary

type ManifestBinary struct {
	// Name is the binary name written to $ANNA_HOME/bin/.
	Name string `json:"name" yaml:"name"`

	// Tool is the mise tool key in "backend:identifier" format, e.g.:
	//   github:cli/cli   pipx:mypy   npm:serve   http:sentinel
	Tool string `json:"tool" yaml:"tool"`

	// URL is required for the http backend (the download URL template).
	URL string `json:"url,omitempty" yaml:"url,omitempty"`

	// Version to install; defaults to "latest" when omitted.
	Version string `json:"version,omitempty" yaml:"version,omitempty"`

	// Shared asset options (github + http)
	StripComponents int    `json:"strip_components,omitempty" yaml:"strip_components,omitempty"`
	BinPath         string `json:"bin_path,omitempty" yaml:"bin_path,omitempty"`
	Bin             string `json:"bin,omitempty" yaml:"bin,omitempty"`
	RenameExe       string `json:"rename_exe,omitempty" yaml:"rename_exe,omitempty"`
	Checksum        string `json:"checksum,omitempty" yaml:"checksum,omitempty"`

	// GitHub-only options
	AssetPattern  string `json:"asset_pattern,omitempty" yaml:"asset_pattern,omitempty"`
	VersionPrefix string `json:"version_prefix,omitempty" yaml:"version_prefix,omitempty"`
	NoApp         bool   `json:"no_app,omitempty" yaml:"no_app,omitempty"`
	FilterBins    string `json:"filter_bins,omitempty" yaml:"filter_bins,omitempty"`
	Prerelease    bool   `json:"prerelease,omitempty" yaml:"prerelease,omitempty"`
	APIURL        string `json:"api_url,omitempty" yaml:"api_url,omitempty"`

	// HTTP-only options
	Size            string `json:"size,omitempty" yaml:"size,omitempty"`
	Format          string `json:"format,omitempty" yaml:"format,omitempty"`
	VersionListURL  string `json:"version_list_url,omitempty" yaml:"version_list_url,omitempty"`
	VersionRegex    string `json:"version_regex,omitempty" yaml:"version_regex,omitempty"`
	VersionJSONPath string `json:"version_json_path,omitempty" yaml:"version_json_path,omitempty"`
	VersionExpr     string `json:"version_expr,omitempty" yaml:"version_expr,omitempty"`

	// Pipx-only options
	Extras   string `json:"extras,omitempty" yaml:"extras,omitempty"`
	PipxArgs string `json:"pipx_args,omitempty" yaml:"pipx_args,omitempty"`
	UVX      bool   `json:"uvx,omitempty" yaml:"uvx,omitempty"`
	UVXArgs  string `json:"uvx_args,omitempty" yaml:"uvx_args,omitempty"`
}

type ManifestOAuthFlow

type ManifestOAuthFlow struct {
	Type          string `json:"type" yaml:"type"`
	AuthURL       string `json:"auth_url,omitempty" yaml:"auth_url,omitempty"`
	DeviceAuthURL string `json:"device_auth_url,omitempty" yaml:"device_auth_url,omitempty"`
	TokenURL      string `json:"token_url" yaml:"token_url"`
	AuthStyle     string `json:"auth_style,omitempty" yaml:"auth_style,omitempty"`
}

type ManifestOAuthProvider

type ManifestOAuthProvider struct {
	ID       string              `json:"id" yaml:"id"`
	Scopes   []string            `json:"scopes" yaml:"scopes"`
	VaultKey string              `json:"vault_key" yaml:"vault_key"`
	Flows    []ManifestOAuthFlow `json:"flows" yaml:"flows"`
}

type ManifestPlugin

type ManifestPlugin struct {
	ID                       string               `json:"id" yaml:"id"`
	Kind                     string               `json:"kind" yaml:"kind"`
	Name                     string               `json:"name" yaml:"name"`
	DisplayName              string               `json:"display_name" yaml:"display_name"`
	Description              string               `json:"description" yaml:"description"`
	Enabled                  bool                 `json:"enabled" yaml:"enabled"`
	Prompt                   string               `json:"prompt,omitempty" yaml:"prompt,omitempty"`
	Binaries                 []ManifestBinary     `json:"binaries,omitempty" yaml:"binaries,omitempty"`
	Skills                   []ManifestSkill      `json:"skills,omitempty" yaml:"skills,omitempty"`
	SessionEnvs              []ManifestSessionEnv `json:"session_env,omitempty" yaml:"session_env,omitempty"`
	OAuthProvider            string               `json:"oauth_provider,omitempty" yaml:"oauth_provider,omitempty"`
	OAuthProviderConfigField string               `json:"oauth_provider_config_field,omitempty" yaml:"oauth_provider_config_field,omitempty"`
	OAuthProviderChoices     []string             `json:"oauth_provider_choices,omitempty" yaml:"oauth_provider_choices,omitempty"`
}

type ManifestSessionEnv

type ManifestSessionEnv struct {
	EnvVar   string `json:"env_var" yaml:"env_var"`
	Source   string `json:"source" yaml:"source"`
	Value    string `json:"value,omitempty" yaml:"value,omitempty"`
	Required bool   `json:"required,omitempty" yaml:"required,omitempty"`
}

type ManifestSkill

type ManifestSkill struct {
	Repo string `json:"repo" yaml:"repo"`
	Name string `json:"name" yaml:"name"`
}

type ManifestState

type ManifestState struct {
	UpdatedAt time.Time                     `json:"updated_at"`
	Plugins   map[string]PluginInstallState `json:"plugins"`
}

func LoadState

func LoadState(path string) (*ManifestState, error)

LoadState reads the manifest state file at path. If the file does not exist, an empty state is returned.

type PluginInstallState

type PluginInstallState struct {
	Binaries []BinaryInstallState `json:"binaries,omitempty"`
	Skills   []SkillInstallState  `json:"skills,omitempty"`
}

type PluginReconcileResult

type PluginReconcileResult struct {
	PluginID string
	Binaries []BinaryReconcileResult
	// Skills not yet implemented (bundled-only in v1), but reserved for future use
	Err error
}

PluginReconcileResult holds the result for a single plugin.

type ReconcileResult

type ReconcileResult struct {
	EnabledCount int
	// Per-plugin results, keyed by plugin ID
	Plugins map[string]PluginReconcileResult
}

ReconcileResult summarizes one reconcile run.

func Reconcile

func Reconcile(ctx context.Context, m *Manifest, annaHome string) ReconcileResult

Reconcile processes all enabled plugins in the manifest, downloading any binaries that are not already at the correct version according to the state file.

type SkillInstallState

type SkillInstallState struct {
	Repo        string    `json:"repo"`
	Name        string    `json:"name"`
	InstalledAt time.Time `json:"installed_at"`
}

Jump to

Keyboard shortcuts

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