diff --git a/java_codebase_rag/pipeline.py b/java_codebase_rag/pipeline.py index 16cd6b5b..f1d34270 100644 --- a/java_codebase_rag/pipeline.py +++ b/java_codebase_rag/pipeline.py @@ -2,6 +2,7 @@ from __future__ import annotations import os +import shutil import subprocess import sys import threading @@ -19,7 +20,13 @@ def bundle_dir() -> Path: def cocoindex_bin() -> Path: - return Path(sys.executable).parent / "cocoindex" + candidate = Path(sys.executable).parent / "cocoindex" + if candidate.is_file(): + return candidate + found = shutil.which("cocoindex") + if found: + return Path(found) + return candidate class _LineFilter: @@ -110,7 +117,7 @@ def run_cocoindex_update( args=[str(exe)], returncode=127, stdout="", - stderr=f"cocoindex not found next to Python: {exe}", + stderr=f"cocoindex not found: {exe}", ) bd = bundle_dir() flow = bd / "java_index_flow_lancedb.py" @@ -172,7 +179,7 @@ def run_cocoindex_drop(env: dict[str, str], *, quiet: bool) -> subprocess.Comple args=[str(exe)], returncode=127, stdout="", - stderr=f"cocoindex not found next to Python: {exe}", + stderr=f"cocoindex not found: {exe}", ) bd = bundle_dir() cmd = [str(exe), "drop", COCOINDEX_TARGET, "-f"] diff --git a/pyproject.toml b/pyproject.toml index 60f96b72..2cf7ce8e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "java-codebase-rag" -version = "0.3.0" +version = "0.3.1" description = "MCP server for semantic + structural search over Java codebases" readme = "README.md" requires-python = ">=3.11" diff --git a/tests/test_java_codebase_rag_cli.py b/tests/test_java_codebase_rag_cli.py index 892fa77e..1d67cb77 100644 --- a/tests/test_java_codebase_rag_cli.py +++ b/tests/test_java_codebase_rag_cli.py @@ -784,7 +784,7 @@ def fake_coco(*_a: object, **_k: object) -> subprocess.CompletedProcess[str]: args=["/nonexistent/cocoindex"], returncode=127, stdout="", - stderr="cocoindex not found next to Python", + stderr="cocoindex not found", ) monkeypatch.setattr(cli_mod, "run_cocoindex_update", fake_coco)