Documentation
¶
Overview ¶
Package hivecli installs the `hive` command for Hive Desktop: a symlink at ~/.local/bin/hive that points at the desktop executable, which runs the hive CLI when it is invoked under that name. The link is the only record of ownership. The package writes or removes a path only when it is that link, and never touches a `hive` the user installed another way.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseVersion ¶
ParseVersion reads the first token after "version " in `hive --version` output ("hive version 1.2.3 (abc1234) 2026-01-01").
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager reconciles the install path with the user's choice.
func (*Manager) InstallPath ¶
InstallPath is where the command lives.
type Options ¶
type Options struct {
Home string
Version string
// Executable is the running binary with symlinks resolved. The default is
// os.Executable followed by filepath.EvalSymlinks.
Executable func() (string, error)
// UserPath is the login shell's PATH, without the prefixes the app adds
// for its own lookups.
UserPath func(context.Context) string
// Environ is the environment a probe of `hive --version` runs with.
Environ func(context.Context) []string
// Probe returns the output of `<path> --version`.
Probe func(ctx context.Context, path string, env []string) (string, error)
Logger zerolog.Logger
}
Options wires a Manager to its environment. Home, Version, and UserPath are required; the rest have working defaults.
type Skip ¶
type Skip string
Skip says why the app does not manage the command on this run.
const ( SkipNone Skip = "" // SkipDev is a development build. Its executable lives in a worktree, so a // link to it would break when the checkout moves. SkipDev Skip = "dev" // SkipTranslocated is a macOS app running from a read-only randomized // mount, which disappears when the app quits. SkipTranslocated Skip = "translocated" // SkipUnwritable is an install directory that cannot be created or written. SkipUnwritable Skip = "unwritable" // SkipUnrecognizable is an executable the ownership rule would not // recognize as the app, so a link to it could never be removed again. SkipUnrecognizable Skip = "unrecognizable" )
type Status ¶
type Status struct {
// Skip is non-empty when the app is not managing the command, and Detail
// carries the underlying error for SkipUnwritable.
Skip Skip `json:"skip"`
Detail string `json:"detail"`
// InstallPath is where the command lives, Owner who put the file there,
// and Target the link's destination (empty for a regular file).
InstallPath string `json:"installPath"`
Owner Owner `json:"owner"`
Target string `json:"target"`
// Resolved is where `hive` leads on the login shell's PATH, empty when
// nothing does.
Resolved string `json:"resolved"`
// Shadowed is true when Resolved is some other file than InstallPath.
Shadowed bool `json:"shadowed"`
// OnPath is true when the install directory is on the login shell's PATH.
OnPath bool `json:"onPath"`
// AppVersion is this build's version and CommandVersion what Resolved
// prints, empty when it printed nothing parseable.
AppVersion string `json:"appVersion"`
CommandVersion string `json:"commandVersion"`
Differs bool `json:"differs"`
}
Status is what Settings and first run render.