install

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package install implements stagent's ledger-based installer: `install` (layout + manifest), `integrate` (harness hooks, shell wrappers, login service; planned as unified diffs before anything is written), `doctor` (state report, orphans) and `uninstall` (stop / unhook / purge). The app runs these over plain SSH exec and parses their JSON (PROTOCOL.md).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main(cmd string, args []string) int

Main runs one installer command and returns the exit code.

Types

type Change

type Change struct {
	ID      string `json:"id"`
	Target  string `json:"target"`
	Action  string `json:"action"` // create | modify | delete
	Summary string `json:"summary"`
	Diff    string `json:"diff"`
	Error   string `json:"error,omitempty"`
	// contains filtered or unexported fields
}

Change is one entry of `integrate` output (and of the removals unhook performs).

type ConfigEntry

type ConfigEntry struct {
	ID       string `json:"id"`
	Path     string `json:"path"`
	Owned    bool   `json:"owned,omitempty"`
	Created  bool   `json:"created"` // the file did not exist before
	Identify string `json:"identify"`

	SHA256Before string `json:"sha256_before,omitempty"`
	SHA256After  string `json:"sha256_after"`
	// Backup restores the file to its pre-stagent content. Cleared when the
	// file was changed by someone else between two of our edits.
	Backup string `json:"backup,omitempty"`

	// CreatedContainers are JSON pointers (e.g. "/hooks/Stop") of objects
	// and arrays we added; they are removed again once empty.
	CreatedContainers []string   `json:"created_containers,omitempty"`
	TOMLEdits         []TOMLEdit `json:"toml_edits,omitempty"`
	ModifiedAt        int64      `json:"modified_at"`
}

ConfigEntry records one integration target. For files we own entirely (omp extension, fish wrapper, service unit) Owned is set and removal deletes the file; for shared config files our elements are identified by Identify and removed element-wise, unless the file is unchanged since our last edit and a valid backup exists, in which case it is restored.

type DaemonReport

type DaemonReport struct {
	Running  bool   `json:"running"`
	PID      int    `json:"pid"`
	Version  string `json:"version"`
	Sessions int    `json:"sessions"`
}

type DoctorReport

type DoctorReport struct {
	Version      string          `json:"version"`
	Protocol     int             `json:"protocol"`
	OS           string          `json:"os"`
	Arch         string          `json:"arch"`
	Home         string          `json:"home"`
	Layout       LayoutInfo      `json:"layout"`
	Daemon       DaemonReport    `json:"daemon"`
	Harnesses    []HarnessReport `json:"harnesses"`
	ShellWrapper ShellReport     `json:"shell_wrapper"`
	Service      ServiceReport   `json:"service"`
	Orphans      []Finding       `json:"orphans"`
	Problems     []string        `json:"problems"`
}

DoctorReport is the output of `stagent doctor` (PROTOCOL.md).

type Failure

type Failure struct {
	Path     string   `json:"path"`
	Reason   string   `json:"reason"`
	Sessions []string `json:"sessions"`
}

type FileEntry

type FileEntry struct {
	Path   string `json:"path"`
	Kind   string `json:"kind"`
	SHA256 string `json:"sha256,omitempty"`
}

type Finding

type Finding struct {
	Target string `json:"target"`
	Detail string `json:"detail"`
}

Finding names something stagent left on the host.

type HarnessReport

type HarnessReport struct {
	ID             string   `json:"id"`
	Found          bool     `json:"found"`
	Path           string   `json:"path"`
	Version        string   `json:"version"`
	ConfigPath     string   `json:"config_path"`
	Integrated     bool     `json:"integrated"`
	HooksSupported bool     `json:"hooks_supported"`
	Notes          []string `json:"notes"`
}

type InstallResult

type InstallResult struct {
	OK      bool       `json:"ok"`
	Version string     `json:"version"`
	Layout  LayoutInfo `json:"layout"`
}

InstallResult is the output of `stagent install`.

type IntegrateResult

type IntegrateResult struct {
	Applied bool      `json:"applied"`
	Changes []*Change `json:"changes"`
	Notes   []string  `json:"notes"`
}

IntegrateResult is the output of `stagent integrate`.

type LayoutInfo

type LayoutInfo struct {
	Root            string `json:"root"`
	Bin             string `json:"bin"`
	RunDir          string `json:"run_dir"`
	DataDir         string `json:"data_dir"`
	DataOnNetworkFS bool   `json:"data_on_network_fs"`
}

LayoutInfo is the part of the layout the app shows and the uninstaller needs even if the home directory changes.

type Manifest

type Manifest struct {
	ManifestVersion int    `json:"manifest_version"`
	Version         string `json:"version"` // stagent version that last wrote it
	CreatedAt       int64  `json:"created_at"`
	UpdatedAt       int64  `json:"updated_at"`

	Layout     LayoutInfo `json:"layout"`
	DaemonAddr string     `json:"daemon_addr"` // actual socket / pipe location

	Files    []FileEntry    `json:"files"`    // files created by install (the binary)
	Dirs     []string       `json:"dirs"`     // directories created by install
	Configs  []*ConfigEntry `json:"configs"`  // integration targets created or modified
	Services []ServiceEntry `json:"services"` // login services / scheduled tasks
	// Backups are the pre-edit copies of modified config files. They stay
	// after unhook and are deleted by purge.
	Backups []string `json:"backups"`
}

Manifest is the installation ledger (layout.Manifest): everything stagent created or changed on the host, so that uninstall can take it back out.

type Runner

type Runner interface {
	Run(timeout time.Duration, name string, args ...string) (output string, err error)
}

Runner executes system commands (systemctl, launchctl, schtasks, harness --version). Tests substitute a fake so nothing touches the real system.

type ServiceEntry

type ServiceEntry struct {
	Kind   string `json:"kind"` // systemd | launchd | schtasks
	Name   string `json:"name"` // unit / label / task name
	Path   string `json:"path,omitempty"`
	SHA256 string `json:"sha256,omitempty"` // task definition (schtasks)
}

type ServiceReport

type ServiceReport struct {
	Kind      string `json:"kind"` // systemd | launchd | schtasks | none
	Installed bool   `json:"installed"`
	Running   bool   `json:"running"`
}

type ShellReport

type ShellReport struct {
	Installed bool     `json:"installed"`
	Files     []string `json:"files"`
}

type Step

type Step struct {
	Action string `json:"action"`
	Target string `json:"target"`
	OK     bool   `json:"ok"`
	Error  string `json:"error,omitempty"`
}

type TOMLEdit

type TOMLEdit struct {
	Kind         string `json:"kind"`   // features_hooks | notify
	Action       string `json:"action"` // added | changed
	PreviousLine string `json:"previous_line,omitempty"`
	AddedHeader  bool   `json:"added_header,omitempty"` // we also added [features]
	AddedBlank   bool   `json:"added_blank,omitempty"`  // and a blank line before it
}

TOMLEdit records a line-level change to Codex's config.toml.

type UninstallReport

type UninstallReport struct {
	Level     string    `json:"level"`
	Steps     []Step    `json:"steps"`
	Removed   []string  `json:"removed"`
	Failed    []Failure `json:"failed"`
	Remaining []Finding `json:"remaining"`
}

UninstallReport is the output of `stagent uninstall`.

Jump to

Keyboard shortcuts

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