Documentation
¶
Overview ¶
Package install adds and removes Smif's hooks, status line, slash command, MCP registration and service unit (RFC 7.3, 7.4, R-OPS-1).
Every file it edits is backed up first. Uninstall restores the backup byte for byte when the file has not changed since install; otherwise it removes only Smif's entries.
Index ¶
- Constants
- Variables
- func CommandPath() string
- func HookCommand(bin, event string) string
- func LaunchdPlist(bin, logPath string) []byte
- func ServiceLoaded() (bool, string)
- func SettingsPath() string
- func SlashCommand(bin string) []byte
- func StatusLineCommand(bin, existing string) string
- func SystemdUnit(bin string) []byte
- func Uninstall(o Options) error
- type FileRecord
- type Manifest
- type Options
Constants ¶
const Label = "local.smif"
Label is the launchd label.
Variables ¶
var HookEvents = []string{"SessionStart", "SessionEnd", "UserPromptSubmit", "Stop"}
HookEvents are the Claude Code hooks Smif adds.
var LegacyLabels = []string{"local.mailroom", "dev.appnice.mailroom"}
LegacyLabels are the labels of installs made under the old name Mailroom (ADR-0016) and before 2026-11-02; install replaces such an agent and doctor still finds it.
Functions ¶
func HookCommand ¶
HookCommand is the command line for one hook event.
func LaunchdPlist ¶
LaunchdPlist renders the launchd agent.
func ServiceLoaded ¶
ServiceLoaded reports whether the service is loaded (for doctor).
func SlashCommand ¶
SlashCommand is the /smif command file. Digest content enters the session only when the human types /smif.
func StatusLineCommand ¶
StatusLineCommand builds the status-line command, wrapping an existing one.
Types ¶
type FileRecord ¶
type FileRecord struct {
Path string `json:"path"`
Existed bool `json:"existed"`
Backup string `json:"backup,omitempty"`
PreSHA string `json:"pre_sha,omitempty"`
PostSHA string `json:"post_sha"`
}
FileRecord tracks one edited file.
type Manifest ¶
type Manifest struct {
InstalledAt time.Time `json:"installed_at"`
Binary string `json:"binary"`
Files []FileRecord `json:"files"`
StatusLineOrig json.RawMessage `json:"statusline_original,omitempty"`
MCPRegistered bool `json:"mcp_registered"`
ServiceKind string `json:"service_kind,omitempty"`
ServicePath string `json:"service_path,omitempty"`
ServiceWasPresent bool `json:"service_was_present,omitempty"`
}
Manifest is ~/.config/smif/install.json.
func LoadManifest ¶
LoadManifest reads the manifest (nil if not installed).