MCPcopy Create free account
hub / github.com/T0UGH/codex-self-evolution-plugin / _probe_version

Function _probe_version

src/codex_self_evolution/diagnostics.py:358–378  ·  view source on GitHub ↗
(argv: list[str])

Source from the content-addressed store, hash-verified

356
357
358def _probe_version(argv: list[str]) -> dict[str, Any]:
359 binary = argv[0]
360 path = shutil.which(binary)
361 if path is None:
362 return {"available": False, "path": None, "version": None, "error": "not on PATH"}
363 try:
364 proc = subprocess.run(
365 argv, capture_output=True, text=True, timeout=10, check=False,
366 )
367 except (OSError, subprocess.TimeoutExpired) as exc:
368 return {"available": True, "path": path, "version": None, "error": str(exc)}
369 combined = (proc.stdout + "\n" + proc.stderr).strip()
370 if proc.returncode != 0 and not combined:
371 return {
372 "available": True, "path": path, "version": None,
373 "error": f"{binary} --version exited {proc.returncode}",
374 }
375 # Grab the first line; CLIs like to print banners. "codex-cli 0.122.0"
376 # or "1.4.0" — caller can eyeball either.
377 first_line = combined.splitlines()[0].strip() if combined else ""
378 return {"available": True, "path": path, "version": first_line, "error": None}
379
380
381# ---------- per-project buckets -----------------------------------------

Callers 1

_check_toolsFunction · 0.85

Calls 1

runMethod · 0.45

Tested by

no test coverage detected