Documentation
¶
Index ¶
Constants ¶
const BinaryPrefix = "harness-"
BinaryPrefix is the required prefix on every plugin binary's file name. The convention is load-bearing, not cosmetic: it is how a plugin binary is picked out of a release tarball that also holds licenses, docs, and other binaries, and it lets the file name be cross-checked against the gated identity name.
Variables ¶
This section is empty.
Functions ¶
func BinaryName ¶
BinaryName is the file name a plugin named name must be shipped and installed under. Callers derive this from a gated identity, never from an archive entry or a user-supplied path, so the install destination is always predictable.
func NameFromBinary ¶
NameFromBinary extracts the plugin name from a binary's file name, which must be harness-<name>[.exe]. It reports whether the file name conforms; a non-conforming name is not a plugin binary as far as the host is concerned.
path may be a full path — only the base name is considered.
func Resolve ¶
Resolve returns the absolute path of the binary a plugin module dispatches to. This is the single resolution point for every host→plugin hop (command exec, completion), so they can never disagree about which binary serves a module.
binaryPath comes from the installed spec's provenance block, which the installer writes as an absolute path. A missing binary means the plugin's spec outlived its binary (bin dir cleaned out, home moved), which is reported as NotFoundError so callers can suggest reinstalling.
func ValidateName ¶
ValidateName reports whether name is a legal plugin/module name.
Types ¶
type Identity ¶
type Identity struct {
Name string `json:"harness_plugin_name"`
Version string `json:"version"`
BuildTime string `json:"build_time"`
}
Identity is the sentinel-gated object a cooperating harness plugin emits from `<plugin> --identity`. harness_plugin_name is both the gate and the name: the harness_ prefix makes it an unforgeable sentinel, so a binary that emits this key is asserting it is a harness plugin.
func QueryIdentity ¶
QueryIdentity runs `binPath --identity`, then parses and validates the sentinel object. It is the plugin identity gate: it fails unless the output is JSON with a non-empty, well-formed harness_plugin_name. version is trusted only after the gate passes; build_time is displayed-only and never compared.
Errors name no path: binPath is often a scratch extract dir that means nothing to the user, so the caller supplies the ref it wants reported.
type NotFoundError ¶
type NotFoundError struct {
Binary string
}
NotFoundError is returned by Resolve when the plugin binary a spec points at cannot be found.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string