installer

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package installer runs the staging-verify-activate install transaction with temp-then-rename atomicity under an exclusive lock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupStaging

func CleanupStaging(roots ...string) (int, error)

CleanupStaging removes orphaned staging temp directories left under the given roots by an interrupted install, so a crash never leaves torn state behind (FR-024, SC-007). It returns the number of entries removed.

Types

type Installer

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

Installer runs the staging-verify-activate transaction over the store, cache, and git runner.

func New

func New(g git.Runner, c *cache.Cache, s *store.Store) *Installer

New builds an Installer. The git runner may be nil for local-only installs.

func (*Installer) Discover

func (i *Installer) Discover(ctx context.Context, req Request) (discovery.Skill, error)

Discover materializes the source and discovers the skill without activating it, for pre-flight checks such as learning the skill name or detecting a manifest conflict. Materialized git content is cached, so a following Install reuses it.

func (*Installer) Install

func (i *Installer) Install(ctx context.Context, req Request) (Result, error)

Install materializes, verifies, and activates the requested skill (FR-015, FR-018, FR-019, FR-020). It verifies content before activating into any agent directory, failing closed on a checksum mismatch.

type Mode

type Mode string

Mode is the actual activation method recorded for an installed skill. The requested preference may be "auto", but only symlink or copy is ever recorded (FR-020).

const (
	ModeSymlink Mode = "symlink"
	ModeCopy    Mode = "copy"
)

Install modes.

func (Mode) Valid

func (m Mode) Valid() bool

Valid reports whether m is a recognized install mode.

type Request

type Request struct {
	Ref         source.Ref
	Revision    resolver.Revision
	Name        string // declared manifest key; must match frontmatter name
	Path        string // explicit in-repo subpath (optional)
	Agents      []agent.Agent
	Scope       Scope
	ModePref    string // symlink | copy | auto
	ProjectRoot string
	Home        string
	// Offline forbids network fetches; material must already be cached (FR-026).
	Offline bool
	// ExpectContentHash, when set, must equal the materialized content hash or
	// the install fails closed (used by frozen restore, FR-015/FR-037).
	ExpectContentHash string
}

Request is everything needed to install one skill.

type Result

type Result struct {
	Skill         discovery.Skill
	ContentHash   string
	SkillFileHash string
	Mode          Mode
	Agents        []string
	Targets       map[string]string // agentID -> recorded dir (relative for project scope)
	Warnings      []string
}

Result is the outcome of a successful install, sufficient to build a lock entry.

type Scope

type Scope string

Scope selects whether a skill installs into the current project or the user-global location (FR-028).

const (
	ScopeProject Scope = "project"
	ScopeGlobal  Scope = "global"
)

Install scopes.

func (Scope) Valid

func (s Scope) Valid() bool

Valid reports whether s is a recognized scope.

Jump to

Keyboard shortcuts

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