Documentation
¶
Overview ¶
Package preflight checks the tools the runtime needs on the machine — tmux, git, Claude Code, Codex — the way the person's own login shell finds them.
Index ¶
- func AuthDirOf(file string) string
- func Version(stdout string) *string
- type Antigravity
- type AntigravityModel
- type Checker
- func (c *Checker) AntigravityStatus() Antigravity
- func (c *Checker) Invalidate()
- func (c *Checker) LoginCmd(ctx context.Context, script string, extraEnv ...string) (*exec.Cmd, error)
- func (c *Checker) LoginShell() string
- func (c *Checker) Report(ctx context.Context, o ReportOptions) hubproto.PreflightReport
- func (c *Checker) RunLogin(ctx context.Context, script string, extraEnv ...string) (LoginResult, error)
- func (c *Checker) Runtime() Result
- func (c *Checker) SetAntigravityBinary(binary string)
- func (c *Checker) ShellPath() string
- type Claude
- type Codex
- type LoginResult
- type ReportOptions
- type Result
- type Tmux
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Antigravity ¶
type Antigravity struct {
Installed bool `json:"installed"`
Version *string `json:"version"`
BinaryPath *string `json:"binaryPath"`
LoggedIn bool `json:"loggedIn"`
Uncertain bool `json:"uncertain,omitempty"`
Models []AntigravityModel `json:"models"`
}
Antigravity keeps authentication evidence separate from executable discovery.
type AntigravityModel ¶
AntigravityModel is a model actually reported by agy models.
type Checker ¶
type Checker struct {
Home string
// Env is the environment the runtime started with; the login shell gets the person's part of it.
Env []string
// Shell is the person's login shell ("" — the account's, else $SHELL, else /bin/bash).
Shell string
// AuthDir is the login folder a managed machine keeps Claude's sign-in in ("" — the CLI's own): the chats get it
// as CLAUDE_SECURESTORAGE_CONFIG_DIR, so the probe asks with it too.
AuthDir string
// contains filtered or unexported fields
}
Checker runs the checks and keeps the answer for half a minute.
func Shared ¶
Shared is the process's one Checker of a home: its answers are kept once, not once per part of the runtime that asks (each New has a cache of its own, and each cache started the CLIs again).
func (*Checker) AntigravityStatus ¶
func (c *Checker) AntigravityStatus() Antigravity
AntigravityStatus shares the runtime's minute-cached, bounded native CLI probe.
func (*Checker) Invalidate ¶
func (c *Checker) Invalidate()
Invalidate drops the cached answer and the Codex probe: the next Runtime checks again, even while a check runs.
func (*Checker) LoginCmd ¶ added in v0.16.5
func (c *Checker) LoginCmd(ctx context.Context, script string, extraEnv ...string) (*exec.Cmd, error)
LoginCmd is the login shell set up to run an sh script, not yet started: the shell reads the profile, then hands the script to sh. extraEnv (KEY=VALUE) is added to the shell's environment. Whoever starts it decides what its input and output are (RunLogin reads the output; a login in a terminal gives it a terminal).
func (*Checker) LoginShell ¶ added in v0.16.16
LoginShell is the account's shell from the password file, else $SHELL, else /bin/bash.
func (*Checker) Report ¶ added in v0.16.5
func (c *Checker) Report(ctx context.Context, o ReportOptions) hubproto.PreflightReport
Report is the machine's preflight for the hub: what the system is, how much disk and memory it has, and which tools are there, with a verdict per concern. It looks again at the tools each time (the answer of Runtime is kept for 30 s).
func (*Checker) RunLogin ¶ added in v0.16.5
func (c *Checker) RunLogin(ctx context.Context, script string, extraEnv ...string) (LoginResult, error)
RunLogin runs an sh script in the account's login shell: the shell reads the profile, then hands the script to sh. extraEnv (KEY=VALUE) is added to the shell's environment. The error is for a shell that did not run the script at all, or ran out of time; a script that exits non-zero is a result.
func (*Checker) Runtime ¶
Runtime is the cached answer, checked again once it is older than 30 seconds; concurrent callers share one check.
func (*Checker) SetAntigravityBinary ¶
SetAntigravityBinary selects the launcher's binary for native probes. Empty uses agy on the login PATH, then ~/.local/bin; an explicit binary never falls back. Shared Checkers drop both cached answers only when the selection changes.
type Claude ¶
type Claude struct {
Installed bool `json:"installed"`
Version *string `json:"version"`
BinaryPath *string `json:"binaryPath"`
// LoggedIn is what `claude auth status` says (exit 0); a probe that ran out of time counts as signed in, as it
// does not prove the opposite. A ~/.claude folder says nothing: the CLI makes it on its first start, signed in or not.
LoggedIn bool `json:"loggedIn"`
// Unchecked: the runtime's screen reading was not checked against this version (cliversion's table).
Unchecked bool `json:"unchecked,omitempty"`
}
type Codex ¶
type Codex struct {
Installed bool `json:"installed"`
Version *string `json:"version"`
BinaryPath *string `json:"binaryPath"`
// LoggedIn is what `codex login status` says (exit 0); a probe that ran out of time counts as signed in, as it
// does not prove the opposite.
LoggedIn bool `json:"loggedIn"`
}
type LoginResult ¶ added in v0.16.5
type LoginResult struct {
// Stdout is what the script printed, without what the shell's profile printed before it.
Stdout string
// Exit is the script's exit code.
Exit int
}
LoginResult is a script run through the login shell.
type ReportOptions ¶ added in v0.16.5
type ReportOptions struct {
// WorkDir is the folder whose filesystem the disk numbers are about (the runtime's work folder).
WorkDir string
// HubURL is the hub's public address; its Date header is the clock the machine is compared with. "": no clock check.
HubURL string
// HTTP fetches the hub's date (nil: http.DefaultClient).
HTTP *http.Client
// Now is the clock (nil: time.Now).
Now func() time.Time
// The next three are for tests: where /proc/meminfo, the cgroup and os-release live, and a disk probe.
MeminfoFile, CgroupDir, OSReleaseFile string
Disk func(path string) (total, free int64, err error)
}
ReportOptions say what a report looks at beyond the tools.