Documentation
¶
Overview ¶
Package install puts beekeeper in place on a machine and takes it away again: the Claude Code hooks, the platform's standby service and memory guard, and a starter config. A manifest in the state directory records what install wrote, so uninstall removes exactly that; what install finds in place and did not write, it keeps as it is.
Index ¶
- func AgyHook(exe string) json.RawMessage
- func AgyHooksUnguarded(path string) string
- func AgySkillsDir(stateDir string) string
- func AgySkillsEntry(skillsDir string) json.RawMessage
- func CheckAgyHooks(path, exe, home string) string
- func CheckAgySkills(path, stateDir, home string) string
- func CheckClaudeHooks(path, exe, _ string) string
- func CheckCodexHooks(path, exe, home string) string
- func CheckCodexSkills(path, stateDir, home string) string
- func CheckSkillMirror(stateDir string) error
- func CodexHook(exe string) json.RawMessage
- func CodexWorkerHooks(stateDir string) string
- func CodexWorkerSkills(stateDir string) string
- func Install(ctx context.Context, e Env) error
- func RefreshSkills(stateDir string) error
- func Starter() []byte
- func Uninstall(ctx context.Context, e Env, purge bool) error
- type Env
- type Hook
- type Manifest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgyHook ¶ added in v0.171.0
func AgyHook(exe string) json.RawMessage
AgyHook is the named hook entry install writes under project.Name in agy's hooks.json (~/.gemini/config/hooks.json): PreInvocation for mid-turn message injection and PreToolUse for the tool guards.
func AgyHooksUnguarded ¶
AgyHooksUnguarded is why an agy started now would run without beekeeper's guard, or "" when its hooks.json at path loads with the project.Name PreToolUse hook: the file is missing or unreadable, agy rejects one of its entries and so drops them all, or it lacks beekeeper's entry or its guard.
func AgySkillsDir ¶ added in v0.171.0
AgySkillsDir is the directory under stateDir where install writes the embedded skills that ~/.gemini/config/skills.json points at.
func AgySkillsEntry ¶ added in v0.171.0
func AgySkillsEntry(skillsDir string) json.RawMessage
AgySkillsEntry is the JSON object install adds to the "entries" list of agy's skills.json (~/.gemini/config/skills.json).
func CheckAgyHooks ¶ added in v0.171.0
CheckAgyHooks checks that agy's hooks.json at path holds the PreInvocation and PreToolUse entry for project.Name in a shape agy accepts (running exe when exe is non-empty), and that agy accepts every other entry too: it drops the whole file for one it rejects. It returns a one-line finding for `beekeeper doctor`, or "" when healthy or path is empty. A hooks.json that is a link install never writes through, so its finding says to edit the target.
func CheckAgySkills ¶ added in v0.171.0
CheckAgySkills checks that agy's skills.json at path registers AgySkillsDir(stateDir) and that the skill files there match what this binary embeds. It returns a one-line finding for `beekeeper doctor`, or "" when healthy or path is empty.
func CheckClaudeHooks ¶
CheckClaudeHooks validates the installed guard without returning settings or command values. Installation ownership determines whether to call it.
func CheckCodexHooks ¶ added in v0.171.0
CheckCodexHooks checks that Codex's hooks.json at path holds the PreToolUse entry for project.Name (running exe when exe is non-empty); it returns a one-line finding for `beekeeper doctor`, or "" when healthy or path is empty.
func CheckCodexSkills ¶ added in v0.171.0
CheckCodexSkills checks that Codex's skills directory at path links all embedded skills in AgySkillsDir(stateDir) and that the skill files there match what this binary embeds. Returns a one-line finding for `beekeeper doctor`, or "" when healthy or path is empty.
func CheckSkillMirror ¶
CheckSkillMirror fails when any shipped skill or supporting file is absent or stale.
func CodexHook ¶ added in v0.171.0
func CodexHook(exe string) json.RawMessage
CodexHook is the PreToolUse entry install writes under hooks.PreToolUse in Codex's hooks.json (~/.codex/hooks.json).
func CodexWorkerHooks ¶ added in v0.171.0
CodexWorkerHooks returns the hooks.json path inside beekeeper's isolated worker CODEX_HOME (<stateDir>/codex/home/hooks.json), or "" when stateDir is empty.
func CodexWorkerSkills ¶ added in v0.171.0
CodexWorkerSkills returns the skills path inside beekeeper's isolated worker CODEX_HOME (<stateDir>/codex/home/skills), or "" when stateDir is empty.
func Install ¶
Install writes the hooks, the standby service, the memory guard and a starter config where they are missing, and updates what an earlier install wrote; a second run changes nothing.
func RefreshSkills ¶
RefreshSkills updates an existing harness mirror from the complete embedded plugin. It leaves machines without an installed mirror alone.
func Starter ¶
func Starter() []byte
Starter is the example config with every key commented out: the defaults apply until a key is set.
Types ¶
type Env ¶
type Env struct {
// Exe is the absolute path of the binary the hooks and the standby
// service run.
Exe string
// Settings is Claude Code's user settings file, AgyHooks agy's
// user hooks file (~/.gemini/config/hooks.json; empty when agy is
// not installed), AgySkills agy's user skills manifest
// (~/.gemini/config/skills.json; empty when agy is not installed),
// CodexHooks codex's user hooks file (~/.codex/hooks.json; empty
// when codex is not installed), CodexSkills codex's user skills
// directory (~/.codex/skills; empty when codex is not installed),
// Config beekeeper's config file, StateDir its state directory (the
// manifest's).
Settings, AgyHooks, AgySkills, CodexHooks, CodexSkills, Config, StateDir string
Setup platform.Setup
Spec platform.SetupSpec
// Run runs one service manager command.
Run func(ctx context.Context, argv []string) error
// BeforeRestart prepares a service for restart. A refusal skips only this
// service's restart and prints its reason, allowing the install to finish.
BeforeRestart func(context.Context, string) error
// RestartFailed revokes any prepared state when a restart command fails.
RestartFailed func(context.Context, string) error
// BeforeServices runs after the config is materialized and before any
// service work, so recovery can pin validated admission before starting.
BeforeServices func() error
Out io.Writer
// DryRun prints every step and takes none.
DryRun bool
// RecoveryOnly installs the independent fatal sentinel and timer driver,
// without restoring hooks, watch, loop or other deliberately disabled parts.
RecoveryOnly bool
}
Env is the machine install and uninstall act on.
type Hook ¶
type Hook struct {
Event string `json:"event"`
Entry json.RawMessage `json:"entry"`
}
Hook is one entry of a hook event's list in Claude Code's settings.
type Manifest ¶
type Manifest struct {
// Previous retains ownership candidates until every install step succeeds.
Previous []Manifest `json:"previous,omitempty"`
// Files are the files install wrote and the SHA-256 of their content.
Files map[string]string `json:"files,omitempty"`
// Dirs are the directories install created.
Dirs []string `json:"dirs,omitempty"`
// Services are the definitions of the units install started: the
// standby service, the keeper's timer.
Services []string `json:"services,omitempty"`
// ReloadPending and RestartsPending survive a failed or deferred service
// update even when its new definition is already on disk.
ReloadPending bool `json:"reloadPending,omitempty"`
RestartsPending []string `json:"restartsPending,omitempty"`
// Service is the standby service's definition as earlier installs
// recorded it, read into Services.
Service string `json:"service,omitempty"`
// Hooks are the settings entries install added.
Hooks []Hook `json:"hooks,omitempty"`
// SettingsKeys are the settings keys install created ("hooks",
// "hooks.PreToolUse"); SettingsCreated says it created the file.
SettingsKeys []string `json:"settingsKeys,omitempty"`
SettingsCreated bool `json:"settingsCreated,omitempty"`
// AgyHook is the entry install added under project.Name in AgyHooks;
// AgyHooksCreated says it created the file.
AgyHook json.RawMessage `json:"agyHook,omitempty"`
AgyHooksCreated bool `json:"agyHooksCreated,omitempty"`
// AgySkills is the entry install added under "entries" in AgySkills;
// AgySkillsDir is the directory of embedded skills it points at;
// AgySkillsEntries says install created the "entries" key, and
// AgySkillsCreated says it created the file.
AgySkills json.RawMessage `json:"agySkills,omitempty"`
AgySkillsDir string `json:"agySkillsDir,omitempty"`
AgySkillsEntries bool `json:"agySkillsEntries,omitempty"`
AgySkillsCreated bool `json:"agySkillsCreated,omitempty"`
// CodexHook is the PreToolUse entry install added to CodexHooks;
// CodexHooksKeys are the keys install created ("hooks",
// "hooks.PreToolUse"); CodexHooksCreated says it created CodexHooks, and
// CodexWorkerHooksCreated says it created <stateDir>/codex/home/hooks.json.
CodexHook json.RawMessage `json:"codexHook,omitempty"`
CodexHooksKeys []string `json:"codexHooksKeys,omitempty"`
CodexHooksCreated bool `json:"codexHooksCreated,omitempty"`
CodexWorkerHooksKeys []string `json:"codexWorkerHooksKeys,omitempty"`
CodexWorkerHooksCreated bool `json:"codexWorkerHooksCreated,omitempty"`
// CodexSkillLinks are the skill symlinks install added under CodexSkills;
// CodexSkillsDir is the directory of embedded skills they point at.
CodexSkillLinks []string `json:"codexSkillLinks,omitempty"`
CodexSkillsDir string `json:"codexSkillsDir,omitempty"`
}
Manifest is what install wrote, read by the next install and uninstall.