Documentation
¶
Overview ¶
Package agentcli finds the coding-agent CLIs baum runs (Claude Code and Codex), checks their versions against the oldest each backend supports, and keeps the record `baum desktop-setup` writes from the user's terminal.
Some users put an agent on their PATH only in an interactive shell (a version manager set up in ~/.bashrc), which baum cannot start without a terminal, so it finds an older copy or none. The record names the directories the user's terminal found the agents in; baum puts them first on the PATH it uses (WithRecorded), so every lookup of `claude` or `codex`, and the `node` an npm-installed agent starts, finds what the user runs.
Index ¶
- Variables
- func Keep(ctx context.Context, base string, every time.Duration, ...)
- func RecordFile() (string, error)
- func Save(path string, record Record) error
- func Supported(version, minimum string) bool
- func Version(ctx context.Context, binary string) (string, error)
- func WithDirs(path string, dirs []string) string
- func WithRecorded(path string) string
- type Agent
- type Found
- type Record
- type Recorded
Constants ¶
This section is empty.
Variables ¶
var Agents = []Agent{ {Slug: "claude-code", Name: "Claude Code", Binary: "claude", Minimum: claude.MinimumVersion}, {Slug: "codex", Name: "Codex", Binary: "codex", Minimum: codex.MinimumVersion}, }
Agents are the CLIs baum checks, in the order it reports them.
Functions ¶
func Keep ¶
Keep sets this process's PATH to base with the recorded directories first, now and whenever the record changes, until ctx ends: the daemon keeps running while the user runs `baum desktop-setup`. changed is called after each change the record brings.
func RecordFile ¶
RecordFile is the record's location: terminal.json beside config.toml.
func Supported ¶
Supported reports whether version is minimum or newer. An unreadable version is not supported.
func WithRecorded ¶
WithRecorded is the PATH value path with the recorded directories first. Without a readable record it is path.
Types ¶
type Agent ¶
type Agent struct {
// Slug names the agent as `baum hooks` does.
Slug string
Name string
// Binary is the command's name on the PATH.
Binary string
// Minimum is the oldest version baum runs.
Minimum string
}
Agent is a coding-agent CLI baum runs.
type Found ¶
type Found struct {
Agent string `json:"agent"`
Name string `json:"name"`
// Path is where the PATH lookup found it; empty when it did not.
Path string `json:"path,omitempty"`
Version string `json:"version,omitempty"`
Minimum string `json:"minimum_version"`
// Supported is whether Version is Minimum or newer.
Supported bool `json:"supported"`
// Error is why the version could not be read.
Error string `json:"error,omitempty"`
}
Found is what Find learned about an agent on the PATH.
type Record ¶
type Record struct {
Agents []Recorded `json:"agents"`
}
Record is what `baum desktop-setup` saw on the user's terminal PATH.
func NewRecord ¶
NewRecord records the agents Find found on the PATH value path, in that PATH's order, so the recorded directories, put first on another PATH, resolve each agent as the terminal did: one agent's directory may hold an older copy of another, which must not come first unless it did there.
type Recorded ¶
type Recorded struct {
Agent string `json:"agent"`
// Path is the executable in Dir.
Path string `json:"path"`
// Dir is the PATH directory it was found in, with symbolic links
// resolved: a version manager's per-shell directory (fnm's
// fnm_multishells) is gone once that shell exits.
Dir string `json:"dir"`
Version string `json:"version,omitempty"`
}
Recorded is one agent found on the terminal's PATH.