MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / Detect

Function Detect

internal/tools/installer.go:165–174  ·  view source on GitHub ↗

Detect reports whether the tool's CLI binary is on PATH and, when installed, its version string in a single pass. Version detection is skipped for missing binaries — we never spawn a doomed process just to learn the binary is absent — and each probe is bounded by versionProbeTimeout so one hung bina

(tool Tool)

Source from the content-addressed store, hash-verified

163// stall the caller. Prefer this over IsInstalled + DetectVersion when you need
164// both values.
165func Detect(tool Tool) (installed bool, version string) {
166 bin := tool.LaunchCommand()
167 if bin == "" {
168 return false, ""
169 }
170 if _, err := exec.LookPath(bin); err != nil {
171 return false, ""
172 }
173 return true, detectVersion(bin)
174}
175
176// DetectVersion returns the tool's version string by running `<bin> --version`.
177// Returns "unknown" when the binary is missing or every probe fails (including

Callers 2

ListMethod · 0.92
toolDTOFunction · 0.92

Calls 2

detectVersionFunction · 0.85
LaunchCommandMethod · 0.80

Tested by

no test coverage detected