Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version = "0.0.0-dev"
Version is overridden at link time via -ldflags "-X .../cli.Version=...". When built via `just build` or `just ci`, it is set to the git describe output (tag or commit hash). When installed via `go install` without ldflags, it defaults to "0.0.0-dev", meaning an untagged/install build.
Functions ¶
func NewRootCmd ¶
func PrintDoctor ¶
func PrintDoctor(out io.Writer, r DoctorReport)
PrintDoctor writes the report to out as human-readable text.
Types ¶
type DoctorReport ¶
type DoctorReport struct {
Platform string // normalised platform identifier
CAExists bool // CA cert + key files present
CADir string // path to the CA directory (may not exist)
CAError string // non-empty if CA check failed (e.g. corrupt cert)
// Manifest checks.
ManifestPath string // path to stunt.yaml (may not exist)
ManifestFound bool // true if stunt.yaml exists
ManifestError string // non-empty if parse/validate failed
ServiceCount int // number of services (0 if not loaded)
UnknownFields []string // unknown top-level keys (typos)
ServiceChecks []DoctorService // per-service adapter/port checks
}
DoctorReport is a structured health check. BuildDoctor fills it in and PrintDoctor writes it as human-readable text.
func BuildDoctor ¶
func BuildDoctor(caDir, manifestPath string) DoctorReport
BuildDoctor inspects the platform, CA, manifest, adapters, and ports, returning a read-only report. It never mutates state (except the port probe which performs a harmless TCP connect to 127.0.0.1).
type DoctorService ¶
type DoctorService struct {
Name string
AdapterSpec string // adapter source spec (empty for rules-only)
AdapterOK bool // adapter loaded successfully
AdapterError string // non-empty if adapter failed to load
BasePort int // assigned port (port mode, 0 otherwise)
PortInUse bool // true if the port is currently bound by something
}
DoctorService is the per-service health entry.
type Instance ¶ added in v0.2.0
type Instance struct {
PID int `json:"pid"`
Manifest string `json:"manifest"`
Mode string `json:"mode"`
Services []string `json:"services,omitempty"`
Addresses []string `json:"addresses,omitempty"`
DashboardURL string `json:"dashboard_url,omitempty"`
DashboardToken string `json:"dashboard_token,omitempty"`
StartedAt string `json:"started_at"`
}
Instance records one running stunt server in the global registry (~/.stunt/instances.json). It is the cross-manifest counterpart to the per-manifest RuntimeFile (which stays as the fast path for stunt down / auto-discovery).
type Registry ¶ added in v0.2.0
type Registry struct {
// contains filtered or unexported fields
}
Registry is a file-locked view over ~/.stunt/instances.json. All mutations go through a flock-protected read-modify-write + atomic rename; reads optionally prune dead PIDs (signal-0 liveness check, same as stunt down).
func OpenRegistry ¶ added in v0.2.0
OpenRegistry opens (creating ~/.stunt if needed) the global instance registry.
func (*Registry) Deregister ¶ added in v0.2.0
Deregister removes the entry for pid (best-effort; missing is fine).
type RuntimeFile ¶
type RuntimeFile struct {
PID int `json:"pid"`
Manifest string `json:"manifest"`
Mode string `json:"mode"`
Addresses []string `json:"addresses"`
StartedAt string `json:"started_at"`
DashboardURL string `json:"dashboard_url,omitempty"`
DashboardToken string `json:"dashboard_token,omitempty"`
}
RuntimeFile records the state of a running `stunt up` process so that `stunt down` can find and stop it. It is written as JSON under <manifest-dir>/.stunt/runtime/up.json when `stunt up` starts and removed on clean shutdown.
type ServiceUnit ¶
type ServiceUnit struct {
Label string // platform label (e.g. "com.stunt.proxy")
FileName string // file name within the unit dir
Content string // full file content
}
ServiceUnit is a generated service unit file.