Documentation
¶
Overview ¶
Package sdk provides the plugin author interface and helpers for implementing preflight plugins as standalone executables speaking JSON-RPC over stdin/stdout.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Discover ¶
Discover scans well-known directories for preflight plugins and returns a map of plugin name → absolute executable path.
Scan order (first match wins):
- binaryDir — directory alongside the preflight binary
- ~/.preflight/plugins/
- ./plugins/ — relative to the current working directory
On Windows, executables must have the ".exe" suffix. On all other platforms, executables have no required suffix.
Types ¶
type ApplyResult ¶
type ApplyResult struct {
Changed bool `json:"changed"`
State map[string]any `json:"state"`
Error string `json:"error,omitempty"`
}
ApplyResult is returned by a module's Apply method.
type CheckResult ¶
type CheckResult struct {
Changed bool `json:"changed"`
State map[string]any `json:"state"`
Error string `json:"error,omitempty"`
}
CheckResult is returned by a module's Check method.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the runner-side handle for a running plugin process.
func NewClient ¶
NewClient starts the plugin at executablePath, sends an "initialize" request, and returns a ready-to-use Client.
func (*Client) Apply ¶
func (c *Client) Apply(args map[string]any) (ApplyResult, error)
Apply calls the plugin's apply method.
type Module ¶
type Module interface {
// Name returns the module's canonical name (e.g. "my-module").
Name() string
// Check reports whether the system is already in the desired state.
Check(args map[string]any) (CheckResult, error)
// Apply brings the system into the desired state.
Apply(args map[string]any) (ApplyResult, error)
}
Module is the interface plugin authors implement.