Documentation
¶
Index ¶
- func BinaryDoctor(ctx context.Context, adapter Adapter, configured, prefix string) (Binary, []Check)
- func CredentialPath(relative string) bool
- func MakeHome(path string) error
- func SortedUnique(values []string) []string
- func TopLevel(relative string) string
- func VersionAtLeast(v Version, major, minor, patch int) bool
- type ActivationRequest
- type Adapter
- type AuthRequest
- type Binary
- type Capability
- type Category
- type Check
- type Classifier
- type Clock
- type Command
- type CommandRunner
- type CredentialState
- type CredentialStatus
- type DoctorOptions
- type Entry
- type EnvironmentPlan
- type ExecRunner
- type Inventory
- type Severity
- type Tool
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinaryDoctor ¶
func CredentialPath ¶
CredentialPath reports paths whose basename or extension conventionally carries authentication material. It deliberately checks the basename rather than only the top-level entry so credentials nested in otherwise durable directories (for example plugins/.credentials.json) cannot be imported.
func SortedUnique ¶
func VersionAtLeast ¶
Types ¶
type ActivationRequest ¶
type ActivationRequest struct {
Home string
AuthMode string
Variables map[string]string
ProviderVariables []string
}
ActivationRequest contains only vendor-specific activation inputs.
type Adapter ¶
type Adapter interface {
Tool() Tool
DetectBinary(context.Context, string) (Binary, error)
DefaultSourceHome() (string, error)
CreateHome(string) error
Inventory(string, bool) (Inventory, error)
ClassifyEntry(string, fs.FileInfo) (Category, bool, string)
ResolveEnvironment(ActivationRequest) (EnvironmentPlan, error)
ValidateConfig(string) []Check
CredentialStatusCommand(AuthRequest) (Command, error)
CredentialLoginCommand(AuthRequest) (Command, error)
CredentialLogoutCommand(AuthRequest) (Command, error)
ParseCredentialStatus([]byte) CredentialStatus
Capabilities(Version) []Capability
Doctor(context.Context, DoctorOptions) []Check
}
Adapter is the stable compiled-in boundary used by activation, import, authentication, and doctor commands.
type AuthRequest ¶
type AuthRequest struct {
Binary string
Home string
Mode string
Method string
Secret []byte
ProviderID string
}
AuthRequest contains enough information to construct a native auth command. Secret is carried separately so callers can pipe it through stdin.
type Binary ¶
type Binary struct {
Configured string `json:"configured"`
Path string `json:"path"`
Version Version `json:"version"`
}
Binary describes a resolved native executable.
func ResolveBinary ¶
type Capability ¶
type Capability struct {
Name string `json:"name"`
Supported bool `json:"supported"`
Severity Severity `json:"severity"`
Evidence string `json:"evidence,omitempty"`
Remediation string `json:"remediation,omitempty"`
}
Capability records whether an installed client can satisfy a required adapter behavior.
type Category ¶
type Category string
Category controls the default import disposition of a native entry.
type Check ¶
type Check struct {
Code string `json:"code"`
Severity Severity `json:"severity"`
Message string `json:"message"`
Remediation string `json:"remediation,omitempty"`
Paths []string `json:"paths,omitempty"`
Evidence string `json:"evidence,omitempty"`
}
Check is a structured diagnostic result. Evidence must never contain secrets.
type Command ¶
Command is an argv-safe native command plan. If Stdin is non-empty, callers must pipe it to the process rather than place it in argv or logs.
type CommandRunner ¶
type CommandRunner interface {
Output(ctx context.Context, path string, args ...string) ([]byte, error)
}
CommandRunner exists so binary detection and diagnostics can be tested without invoking a real vendor client.
type CredentialState ¶
type CredentialState string
CredentialState is a parsed, vendor-neutral credential status.
const ( CredentialUnknown CredentialState = "unknown" CredentialAuthenticated CredentialState = "authenticated" CredentialUnauthenticated CredentialState = "unauthenticated" )
type CredentialStatus ¶
type CredentialStatus struct {
State CredentialState `json:"state"`
Identity string `json:"identity,omitempty"`
Message string `json:"message,omitempty"`
}
type DoctorOptions ¶
type Entry ¶
type Entry struct {
Path string `json:"path"`
Category Category `json:"category"`
Include bool `json:"include"`
Reason string `json:"reason"`
Mode fs.FileMode `json:"mode"`
Size int64 `json:"size,omitempty"`
SymlinkTarget string `json:"symlink_target,omitempty"`
}
Entry is one path discovered while inventorying a native home.
type EnvironmentPlan ¶
EnvironmentPlan describes which inherited values to remove and which non-secret values to apply. Secret values belong in the later process-only credential layer and must not be placed here.
type ExecRunner ¶
type ExecRunner struct{}
type Inventory ¶
Inventory is a deterministic native-home inventory.
func WalkInventory ¶
func WalkInventory(home string, includeSessions bool, classify Classifier) (Inventory, error)