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 ¶
- func Main(cmd string, args []string) int
- type Change
- type ConfigEntry
- type DaemonReport
- type DoctorReport
- type Failure
- type FileEntry
- type Finding
- type HarnessReport
- type InstallResult
- type IntegrateResult
- type LayoutInfo
- type Manifest
- type Runner
- type ServiceEntry
- type ServiceReport
- type ShellReport
- type Step
- type TOMLEdit
- type UninstallReport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 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 HarnessReport ¶
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 ServiceReport ¶
type ShellReport ¶
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.