install

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(root string, opts Options) error

Run initializes the repository with the required Agent Layer structure.

Types

type MatchTemplateFunc added in v0.5.7

type MatchTemplateFunc func(sys System, path string, templatePath string, info fs.FileInfo) (bool, error)

MatchTemplateFunc compares a destination file to a template.

type Options

type Options struct {
	Overwrite  bool
	Force      bool
	Prompter   Prompter
	WarnWriter io.Writer
	PinVersion string
	System     System
}

Options controls installer behavior.

type PromptDeleteUnknownAllFunc added in v0.5.4

type PromptDeleteUnknownAllFunc func(paths []string) (bool, error)

PromptDeleteUnknownAllFunc asks whether to delete all unknown paths.

type PromptDeleteUnknownFunc added in v0.5.4

type PromptDeleteUnknownFunc func(path string) (bool, error)

PromptDeleteUnknownFunc asks whether to delete a specific unknown path.

type PromptFuncs added in v0.5.7

type PromptFuncs struct {
	OverwriteAllFunc       PromptOverwriteAllFunc
	OverwriteAllMemoryFunc PromptOverwriteAllFunc
	OverwriteFunc          PromptOverwriteFunc
	DeleteUnknownAllFunc   PromptDeleteUnknownAllFunc
	DeleteUnknownFunc      PromptDeleteUnknownFunc
}

PromptFuncs adapts optional prompt callbacks into a Prompter.

func (PromptFuncs) DeleteUnknown added in v0.5.7

func (p PromptFuncs) DeleteUnknown(path string) (bool, error)

DeleteUnknown prompts the user to confirm deleting a single unknown path. Returns an error if no DeleteUnknownFunc is configured.

func (PromptFuncs) DeleteUnknownAll added in v0.5.7

func (p PromptFuncs) DeleteUnknownAll(paths []string) (bool, error)

DeleteUnknownAll prompts the user to confirm deleting all unknown paths. Returns an error if no DeleteUnknownAllFunc is configured.

func (PromptFuncs) Overwrite added in v0.5.7

func (p PromptFuncs) Overwrite(path string) (bool, error)

Overwrite prompts the user to confirm overwriting a single path. Returns an error if no OverwriteFunc is configured.

func (PromptFuncs) OverwriteAll added in v0.5.7

func (p PromptFuncs) OverwriteAll(paths []string) (bool, error)

OverwriteAll prompts the user to confirm overwriting all given paths. Returns an error if no OverwriteAllFunc is configured.

func (PromptFuncs) OverwriteAllMemory added in v0.5.7

func (p PromptFuncs) OverwriteAllMemory(paths []string) (bool, error)

OverwriteAllMemory prompts the user to confirm overwriting all memory file paths. Returns an error if no OverwriteAllMemoryFunc is configured.

type PromptOverwriteAllFunc added in v0.5.4

type PromptOverwriteAllFunc func(paths []string) (bool, error)

PromptOverwriteAllFunc asks whether to overwrite all managed files. paths contains the relative files that differ from templates.

type PromptOverwriteFunc

type PromptOverwriteFunc func(path string) (bool, error)

PromptOverwriteFunc asks whether to overwrite a given path.

type Prompter added in v0.5.7

type Prompter interface {
	OverwriteAll(paths []string) (bool, error)
	OverwriteAllMemory(paths []string) (bool, error)
	Overwrite(path string) (bool, error)
	DeleteUnknownAll(paths []string) (bool, error)
	DeleteUnknown(path string) (bool, error)
}

Prompter provides user prompts for overwrite and delete decisions.

type RealSystem added in v0.5.7

type RealSystem struct{}

RealSystem implements System using the OS filesystem.

func (RealSystem) MkdirAll added in v0.5.7

func (RealSystem) MkdirAll(path string, perm os.FileMode) error

MkdirAll creates a directory named path, along with any necessary parents.

func (RealSystem) ReadFile added in v0.5.7

func (RealSystem) ReadFile(name string) ([]byte, error)

ReadFile reads the named file and returns the contents.

func (RealSystem) RemoveAll added in v0.5.7

func (RealSystem) RemoveAll(path string) error

RemoveAll removes path and any children it contains.

func (RealSystem) Stat added in v0.5.7

func (RealSystem) Stat(name string) (os.FileInfo, error)

Stat returns a FileInfo describing the named file.

func (RealSystem) WalkDir added in v0.5.7

func (RealSystem) WalkDir(root string, fn fs.WalkDirFunc) error

WalkDir walks the file tree rooted at root.

func (RealSystem) WriteFileAtomic added in v0.5.7

func (RealSystem) WriteFileAtomic(filename string, data []byte, perm os.FileMode) error

WriteFileAtomic writes data to a file atomically by writing to a temp file and renaming.

type System added in v0.5.7

type System interface {
	Stat(name string) (os.FileInfo, error)
	ReadFile(name string) ([]byte, error)
	MkdirAll(path string, perm os.FileMode) error
	RemoveAll(path string) error
	WalkDir(root string, fn fs.WalkDirFunc) error
	WriteFileAtomic(filename string, data []byte, perm os.FileMode) error
}

System abstracts filesystem operations needed by the installer. This interface is intentionally package-local per Decision edefea6 to enable parallel-safe unit tests without shared global state. Other packages (dispatch, sync) define their own System interfaces with operations specific to their needs.

Jump to

Keyboard shortcuts

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