Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/code_index_mcp/indexing/shallow_index_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from .json_index_builder import JSONIndexBuilder
from ..constants import SETTINGS_DIR, INDEX_FILE_SHALLOW
from ..project_settings import ProjectSettings

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -58,8 +59,13 @@ def set_project_path(self, project_path: str, additional_excludes: Optional[List
self.project_path = project_path
self.index_builder = JSONIndexBuilder(project_path, additional_excludes)

project_hash = hashlib.md5(project_path.encode()).hexdigest()[:12]
self.temp_dir = os.path.join(tempfile.gettempdir(), SETTINGS_DIR, project_hash)
project_hash = hashlib.md5(project_path.encode()).hexdigest()
index_root = (
ProjectSettings.custom_index_root
if (hasattr(ProjectSettings, "custom_index_root") and ProjectSettings.custom_index_root)
else os.path.join(tempfile.gettempdir(), SETTINGS_DIR)
)
self.temp_dir = os.path.join(index_root, project_hash)
os.makedirs(self.temp_dir, exist_ok=True)
self.index_path = os.path.join(self.temp_dir, INDEX_FILE_SHALLOW)
if additional_excludes:
Expand Down
2 changes: 1 addition & 1 deletion src/code_index_mcp/indexing/sqlite_index_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def cleanup(self) -> None:
def _hash_project_path(project_path: str) -> str:
import hashlib

return hashlib.md5(project_path.encode()).hexdigest()[:12]
return hashlib.md5(project_path.encode()).hexdigest()


def _compile_glob_regex(pattern: str):
Expand Down