Documentation
¶
Overview ¶
Package setup provides host-environment detection for the first-run setup surface (GET /api/v1/setup/status): which resident coding-agent CLIs are present, and the OS/WSL posture the environment-step copy keys off. It is a leaf package (stdlib only) so the API handler and tests can depend on it without pulling in the rest of the control plane.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLIProvider ¶
CLIProvider is a resident coding-agent CLI detected on the wardynd host. LoggedIn is a HEURISTIC (a home-dir credential-file check), not a live probe. BinPath is the resolved PATH location when Installed (empty otherwise) — the setup surface uses it to warn "logged in but the CLI is off PATH".
func DetectCLIProviders ¶
func DetectCLIProviders() []CLIProvider
DetectCLIProviders reports the resident coding-agent CLIs (claude, codex): whether each is on PATH (Installed) and an advisory login signal (LoggedIn + the LoginVia path that produced it).
ponytail: LoggedIn is advisory — a stale/expired session whose credential file still exists reads as logged-in. The honest upgrade is shelling out to `claude whoami` (or the codex equivalent) and parsing it; the first-run check deliberately avoids the subprocess.
type HostProxyDetection ¶
type HostProxyDetection struct {
HTTPProxy *HostProxySetting `json:"http_proxy,omitempty"`
HTTPSProxy *HostProxySetting `json:"https_proxy,omitempty"`
AllProxy *HostProxySetting `json:"all_proxy,omitempty"`
NoProxy *HostProxySetting `json:"no_proxy,omitempty"`
// EnvCaseMismatch lists "UPPER/lower" pairs whose values disagree (httpoxy
// hygiene warning) — the lowercase value is still what wins the merge.
EnvCaseMismatch []string `json:"env_case_mismatch,omitempty"`
GitProxy *HostProxyGitConfig `json:"git_proxy,omitempty"`
ToolConfigs []HostProxyToolConfig `json:"tool_configs,omitempty"`
PAC *HostProxyPAC `json:"pac,omitempty"`
// HasCredentials is true when ANY of the above carried a masked
// credential — a single convenience flag the UI can check without
// walking every sub-field.
HasCredentials bool `json:"has_credentials"`
}
HostProxyDetection is the aggregate, masked-safe host-proxy detection result. Every field is best-effort: absence of a mechanism (no env var, no git config, powershell.exe unavailable, ...) is not an error.
func DetectHostProxy ¶
func DetectHostProxy() HostProxyDetection
DetectHostProxy runs every detector in the R4 catalog and merges the generic HTTP_PROXY/HTTPS_PROXY/ALL_PROXY/NO_PROXY signal by precedence (env > shell profile > OS). It never fails: every detector tolerates the absence of its mechanism (missing file, missing binary, non-zero exit).
type HostProxyGitConfig ¶
type HostProxyGitConfig struct {
HTTPProxy *HostProxySetting `json:"http_proxy,omitempty"`
HTTPSProxy *HostProxySetting `json:"https_proxy,omitempty"`
}
HostProxyGitConfig is `git config --global http.proxy` / `https.proxy` — kept separate from the generic HTTP(S)_PROXY resolution because git honors its own config over the environment.
type HostProxyPAC ¶
type HostProxyPAC struct {
URL string `json:"url"`
Source HostProxySource `json:"source"`
Detail string `json:"detail,omitempty"`
}
HostProxyPAC flags a discovered PAC/WPAD auto-config URL. It is never fetched or executed (it's arbitrary JS) — presence alone is surfaced so the operator can resolve the effective proxy manually.
type HostProxySetting ¶
type HostProxySetting struct {
Value string `json:"value"`
Source HostProxySource `json:"source"`
Detail string `json:"detail,omitempty"`
HasCredentials bool `json:"has_credentials"`
}
HostProxySetting is one detected proxy value, safe to render directly: any embedded credential has already been masked (see maskProxyURL) — the raw value is never retained. HasCredentials flags that a credential WAS present in the raw value, so the UI can prompt to store it as a secret.
type HostProxySource ¶
type HostProxySource string
HostProxySource is where a detected proxy setting came from.
const ( ProxySourceEnv HostProxySource = "env" ProxySourceShell HostProxySource = "shell_profile" ProxySourceGit HostProxySource = "git_config" ProxySourceTool HostProxySource = "tool_config" ProxySourceOS HostProxySource = "os" )
type HostProxyToolConfig ¶
type HostProxyToolConfig struct {
Tool string `json:"tool"`
Path string `json:"path"`
Setting HostProxySetting `json:"setting"`
}
HostProxyToolConfig is one per-tool proxy directive found in a config file that does NOT honor HTTP_PROXY/HTTPS_PROXY env vars (npm/pip/cargo honor env already and are skipped; this covers git-adjacent tools that need explicit config: maven, cargo's own config file, apt). Informational only — nothing here is ever written to.
type Platform ¶
Platform is the wardynd host's OS, whether it is running under WSL, and whether it exposes KVM virtualization (/dev/kvm) — the hardware fact that separates "Vault is incompatible here" from "Vault just needs setup".
func DetectPlatform ¶
func DetectPlatform() Platform
DetectPlatform reports the host OS (runtime.GOOS), whether it is WSL, and whether /dev/kvm is exposed.