Documentation
¶
Overview ¶
Package integrate connects hopsesh to the rest of the user's machine: the command-line tool on PATH (for app installs) and the hopsesh skill for Claude Code. Both are opt-in and reversible, and neither ever replaces something hopsesh did not create.
Index ¶
- Constants
- func AddToPath() (string, error)
- func AdoptLoginEnv()
- func AppCLI() (string, error)
- func ClaudeConfigDir() string
- func ClaudeSettingsPath() string
- func InstallSkill(force, addRules bool) (claudeskill.Status, []string, error)
- func LinkPath() string
- func LoginEnv() map[string]string
- func LoginPathHas(dir string) bool
- func LookLoginPath(name string) string
- func RemovePathBlock() error
- func RemoveSkill(force bool) error
- func SkillBin() string
- func SkillParams() claudeskill.Params
- func SkillRulesPresent() bool
- func SkillStatus() (claudeskill.Status, error)
- func UninstallCLI() error
- type CLIStatus
Constants ¶
const ( CLIMissing = "missing" // nothing there CLIOurs = "ours" // a link to this app's tool CLIOtherApp = "other-app" // a link into another copy of hopsesh.app CLIDangling = "dangling" // a link whose target is gone (the app moved or was deleted) CLIStandalone = "standalone" // a regular file (install script, go install) CLIForeign = "foreign" // a link somewhere else (e.g. Homebrew) )
States of the command-line tool link at ~/.local/bin/hopsesh.
Variables ¶
This section is empty.
Functions ¶
func AddToPath ¶
AddToPath appends a marked block that puts ~/.local/bin on PATH to the login-shell profile (only when the user asks). It returns the file it changed.
func AdoptLoginEnv ¶
func AdoptLoginEnv()
AdoptLoginEnv sets CLAUDE_CONFIG_DIR in this process from the login shell when the process does not have it (an app started from Finder), so every part of hopsesh, and the programs it starts, use the same Claude Code folder.
func AppCLI ¶
AppCLI is the command-line tool inside the running app bundle, or an error explaining why it cannot be linked (not an app, running from a disk image or a translocated copy).
func ClaudeConfigDir ¶
func ClaudeConfigDir() string
ClaudeConfigDir is Claude Code's config folder: CLAUDE_CONFIG_DIR from this process or the login shell, else ~/.claude.
func ClaudeSettingsPath ¶
func ClaudeSettingsPath() string
ClaudeSettingsPath is Claude Code's user settings file.
func InstallSkill ¶
func InstallSkill(force, addRules bool) (claudeskill.Status, []string, error)
InstallSkill installs or updates the skill, and adds the permission rules when asked.
func LoginEnv ¶
LoginEnv returns PATH, CLAUDE_CONFIG_DIR and HOME from an interactive login shell (cached; empty values when it cannot be read).
func LoginPathHas ¶
LoginPathHas reports whether dir is on the login shell's PATH (falling back to this process's PATH when the shell cannot be read).
func LookLoginPath ¶
LookLoginPath finds a command on the login shell's PATH.
func RemovePathBlock ¶
func RemovePathBlock() error
RemovePathBlock removes the block AddToPath added, if present.
func RemoveSkill ¶
RemoveSkill removes the skill hopsesh installed (force: even an edited one).
func SkillBin ¶
func SkillBin() string
SkillBin is how Claude Code should run hopsesh: plain "hopsesh" when the user's login shell finds it, otherwise an absolute path (the linked tool, the app's tool, or this program).
func SkillParams ¶
func SkillParams() claudeskill.Params
SkillParams are what this build renders into the skill.
func SkillRulesPresent ¶
func SkillRulesPresent() bool
SkillRulesPresent reports whether the optional permission rules are in place.
func SkillStatus ¶
func SkillStatus() (claudeskill.Status, error)
SkillStatus checks the installed skill against this build.
func UninstallCLI ¶
func UninstallCLI() error
UninstallCLI removes the link when it points into a hopsesh.app (or is broken), and the PATH block hopsesh added, if any.
Types ¶
type CLIStatus ¶
type CLIStatus struct {
State string `json:"state"`
Path string `json:"path"` // ~/.local/bin/hopsesh
Target string `json:"target,omitempty"` // where the link points
AppCLI string `json:"appCli,omitempty"` // the tool inside this app
DirOnPath bool `json:"dirOnPath"` // ~/.local/bin is on the login PATH
Resolves string `json:"resolves,omitempty"`
Profile string `json:"profile,omitempty"` // file "Add to PATH" would change
PathLine string `json:"pathLine"`
PathAdded bool `json:"pathAdded,omitempty"` // hopsesh's block is in the profile
CanInstall string `json:"cannotInstall,omitempty"`
}
CLIStatus describes the command-line tool link.
func CheckCLI ¶
func CheckCLI() CLIStatus
CheckCLI reports the state of ~/.local/bin/hopsesh without following it.
func InstallCLI ¶
InstallCLI links ~/.local/bin/hopsesh to this app's tool. It replaces only links that hopsesh made (into a hopsesh.app, or broken ones); a standalone copy or someone else's link is replaced only with force, and kept as hopsesh.bak-<time>.