Multi-Repository Management
Relevant source files
The following files were used as context for generating this wiki page:
Multi-Repository Management in code-review-graph provides a centralized mechanism for tracking and searching across multiple local codebases. It allows developers to register disparate projects into a global registry, enabling cross-repo analysis and unified tool access through the Model Context Protocol (MCP). Sources: CLAUDE.md, code_review_graph/registry.py
The system is built around a persistent registry file and a set of CLI commands and MCP tools that interact with multiple project-specific SQLite databases. This infrastructure supports large-scale development environments where context from one repository may be relevant to tasks in another. Sources: code_review_graph/cli.py, code_review_graph/main.py
Registry Architecture
The registry acts as the source of truth for all projects managed by the tool. It maintains a mapping of repository paths to optional aliases, facilitating easy identification and retrieval of project-specific metadata. Sources: code_review_graph/registry.py:1-20
Components and Data Flow
The architecture consists of three primary layers:
- Registry Store: A JSON-based configuration file typically located at
~/.code-review-graph/registry.json. - Management Layer: CLI commands and internal Python helpers that handle registration, unregistration, and listing.
- Discovery Layer: MCP tools that utilize the registry to perform cross-repo operations like hybrid semantic search.
The following diagram illustrates the flow of repository registration and discovery:
The diagram shows how user interactions via the CLI populate a centralized registry, which is then consumed by MCP clients to discover local project databases. Sources: code_review_graph/cli.py, code_review_graph/main.py, code_review_graph/registry.py
Registry Operations
Repository management is handled primarily through the Registry class and corresponding CLI commands. Sources: code_review_graph/registry.py, code_review_graph/cli.py
Registration and Unregistration
Repositories are registered by providing a local file path. During registration, the system validates the path to ensure it is a valid directory and optionally assigns an alias for easier reference in subsequent commands. Sources: code_review_graph/cli.py, code_review_graph/registry.py
This sequence shows the validation steps required before a repository is committed to the global registry. Sources: code_review_graph/registry.py, tests/test_registry.py
Key Registry Management Commands
| Command | Description | Relevant Arguments |
|---|---|---|
register | Adds a new project to the global registry. | <path>, --alias |
unregister | Removes a project from the registry. | <path_or_alias> |
repos | Lists all currently registered repositories. | N/A |
Sources: code_review_graph/cli.py:598-620
Cross-Repository Tools
The multi-repo management feature extends the tool's search capabilities beyond a single active project root. Sources: code_review_graph/main.py
Cross-Repo Search
The cross_repo_search_tool iterates through every repository listed in the registry. It executes a hybrid search (combining FTS5 keyword matching and vector similarity) against each individual graph.db and merges the results into a single prioritized list. Sources: code_review_graph/main.py:534-550
Registry Metadata
The system tracks specific metadata for each registered repository to ensure consistency during multi-repo operations. Sources: code_review_graph/registry.py
| Field | Type | Description |
|---|---|---|
path | string | Absolute path to the repository root. |
alias | string (optional) | A user-defined short name for the project. |
added_at | timestamp | The date and time the repository was registered. |
Sources: code_review_graph/registry.py, tests/test_registry.py
Implementation Details
The Registry class manages the underlying JSON persistence. It includes logic to handle path resolution (e.g., expanding ~) and ensures that aliases are unique within the registry. Sources: code_review_graph/registry.py:20-80, tests/test_registry.py:40-60
# code_review_graph/registry.py
def register(self, path: str, alias: Optional[str] = None) -> dict:
"""Register a repository in the multi-repo registry."""
# Path validation and resolution happens here
# Check for duplicate paths or aliases
# Write updated list to registry.json
Sources: code_review_graph/registry.py:45-70
Summary
Multi-Repository Management enables the code-review-graph to scale across multiple projects by maintaining a central registry.json. This system allows developers and AI assistants to maintain structural awareness across their entire local workspace, supporting cross-repo entity discovery and centralized project tracking. Sources: CLAUDE.md, code_review_graph/cli.py, code_review_graph/main.py