### Install Pandas and List Files Source: https://github.com/tirth8205/code-review-graph/blob/main/tests/fixtures/sample_notebook.ipynb Installs the pandas library and lists files in the current directory. Use this for initial setup and environment checks. ```python %pip install pandas ``` ```shell !ls -la ``` ```python import os from pathlib import Path ``` -------------------------------- ### CLI Commands - Setup Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Commands for installing and setting up the code-review-graph tool. ```APIDOC ## CLI Commands - Setup ### `install` **Description:** Register MCP server with Claude Code (alias: init). **Usage:** ```bash code-review-graph install ``` ### `install --dry-run` **Description:** Preview installation without writing files. **Usage:** ```bash code-review-graph install --dry-run ``` ``` -------------------------------- ### Install and Initialize Code Review Graph Source: https://github.com/tirth8205/code-review-graph/blob/main/README.md Use this command to install the code-review-graph package and perform initial setup. It is compatible with multiple coding platforms. ```bash pip install code-review-graph && code-review-graph install ``` -------------------------------- ### Configure MCP Server Command Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/TROUBLESHOOTING.md Example configuration for the .mcp.json file to ensure the server starts correctly using uvx. ```json "command": "uvx" "args": ["code-review-graph", "serve"] ``` -------------------------------- ### Install and Build code-review-graph Source: https://github.com/tirth8205/code-review-graph/blob/main/README.md Commands to install the package and initialize the codebase graph. ```bash pip install code-review-graph # or: pipx install code-review-graph code-review-graph install # auto-detects and configures all supported platforms code-review-graph build # parse your codebase ``` -------------------------------- ### Install via uv Source: https://github.com/tirth8205/code-review-graph/blob/main/code-review-graph-vscode/media/walkthrough/install.md Recommended installation method using the uv package manager. ```bash uv pip install code-review-graph ``` -------------------------------- ### Contributing to Code Review Graph Source: https://github.com/tirth8205/code-review-graph/blob/main/README.md Setup the development environment by cloning the repository, creating a virtual environment, and installing development dependencies. Run tests to ensure functionality. ```bash git clone https://github.com/tirth8205/code-review-graph.git cd code-review-graph python3 -m venv .venv && source .venv/bin/activate pip install -e ".[dev]" pytest ``` -------------------------------- ### Clone Repository and Install Dependencies Source: https://github.com/tirth8205/code-review-graph/blob/main/CONTRIBUTING.md Clone the repository and install development dependencies using uv. Ensure you have uv installed. ```bash git clone https://github.com/tirth8205/code-review-graph.git cd code-review-graph uv sync --extra dev ``` -------------------------------- ### Install via pipx or pip Source: https://github.com/tirth8205/code-review-graph/blob/main/code-review-graph-vscode/media/walkthrough/install.md Alternative installation methods using pipx or standard pip. ```bash pipx install code-review-graph # or pip install code-review-graph ``` -------------------------------- ### Start MCP Server Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Starts the MCP server using standard input/output for communication. ```bash code-review-graph serve # Start MCP server (stdio) ``` -------------------------------- ### Get Docs Section Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/skills/review-pr/SKILL.md Call this tool before starting to get optimized workflow documentation for the review-pr section. Avoid including full files unless specifically requested. ```python get_docs_section_tool(section_name="review-pr") ``` -------------------------------- ### Install Code Review Graph CLI Source: https://github.com/tirth8205/code-review-graph/blob/main/code-review-graph-vscode/README.md Install the Python CLI for the Code Review Graph extension. Recommended to use `uv` for installation. Requires Python 3.10+. ```bash # Recommended uv pip install code-review-graph # Alternatives pipx install code-review-graph pip install code-review-graph ``` -------------------------------- ### Install and Verify UV Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/TROUBLESHOOTING.md Commands to install or verify the presence of the uv package manager. ```bash uv --version pip install uv brew install uv ``` -------------------------------- ### Install Wiki Generation Dependency Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/TROUBLESHOOTING.md Install the dependencies required for LLM-powered wiki summaries. ```bash pip install code-review-graph[wiki] ``` -------------------------------- ### Install Code Review Graph Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/USAGE.md Installs the code-review-graph package and configures supported platforms. Run 'code-review-graph install' to auto-detect and configure all platforms, or specify a platform using the --platform flag. ```bash pip install code-review-graph code-review-graph install # auto-detects and configures all supported platforms code-review-graph build # parse your codebase ``` ```bash code-review-graph install --platform codex ``` ```bash code-review-graph install --platform cursor ``` ```bash code-review-graph install --platform claude-code ``` -------------------------------- ### CLI Commands - Server Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Command for starting the MCP server. ```APIDOC ## CLI Commands - Server ### `serve` **Description:** Start the MCP server using stdio communication. **Usage:** ```bash code-review-graph serve ``` ``` -------------------------------- ### Get Architecture Overview Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Provides an overview of the project's architecture. `repo_root` can be auto-detected. ```python get_architecture_overview_tool( repo_root: str | None ) ``` -------------------------------- ### Install Optional Dependency Groups Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/TROUBLESHOOTING.md Commands to install various optional feature sets for the project. ```bash pip install code-review-graph[embeddings] pip install code-review-graph[google-embeddings] pip install code-review-graph[communities] pip install code-review-graph[eval] pip install code-review-graph[wiki] pip install code-review-graph[all] ``` -------------------------------- ### Verify Setup with Pytest Source: https://github.com/tirth8205/code-review-graph/blob/main/CONTRIBUTING.md Run pytest to verify the development setup. This command runs tests quietly and shows a short traceback on failure. ```bash uv run pytest tests/ --tb=short -q ``` -------------------------------- ### Install and Configure Code Review Graph Source: https://context7.com/tirth8205/code-review-graph/llms.txt Install the package with optional dependencies and configure it for specific AI platforms. ```bash # Install the package pip install code-review-graph # Or with optional dependencies pip install code-review-graph[embeddings] # Local vector embeddings pip install code-review-graph[communities] # Community detection (igraph) pip install code-review-graph[all] # All optional dependencies # Auto-detect and configure all AI platforms code-review-graph install # Or target a specific platform code-review-graph install --platform cursor code-review-graph install --platform claude-code code-review-graph install --platform codex # Build the knowledge graph code-review-graph build # Example output: # Full build: 500 files, 6285 nodes, 27117 edges (postprocess=full) ``` -------------------------------- ### Manage Multi-Repository Setup Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Commands for registering, unregistering, and listing repositories managed by the code-review-graph tool. Aliases can be used for registered repositories. ```bash code-review-graph register [--alias name] # Register a repository ``` ```bash code-review-graph unregister # Remove from registry ``` ```bash code-review-graph repos # List registered repositories ``` -------------------------------- ### Install UV in WSL Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/TROUBLESHOOTING.md Install the uv package manager specifically within a WSL environment. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Start MCP Server Source: https://github.com/tirth8205/code-review-graph/blob/main/CLAUDE.md Launches the FastMCP server, which serves the code graph and registers tools and prompts. ```bash uv run code-review-graph serve ``` -------------------------------- ### Build Code Review Graph Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/USAGE.md Parses your entire codebase to build the initial graph. This is a one-time setup step. ```bash /code-review-graph:build-graph ``` -------------------------------- ### Install Community Detection Dependency Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/TROUBLESHOOTING.md Install the igraph-based community detection dependency. ```bash pip install code-review-graph[communities] ``` -------------------------------- ### Build Full Knowledge Graph Source: https://github.com/tirth8205/code-review-graph/blob/main/skills/build-graph/SKILL.md Call this tool with `full_rebuild=True` for first-time setup of the knowledge graph. Ensure the graph status is checked before running. ```python build_or_update_graph_tool(full_rebuild=True) ``` -------------------------------- ### Get Architecture Overview with get_architecture_overview_tool Source: https://context7.com/tirth8205/code-review-graph/llms.txt Generate an architecture overview based on community structure, highlighting potential coupling issues with recommendations. ```python result = get_architecture_overview_tool() ``` -------------------------------- ### Verify graph installation and status Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/TROUBLESHOOTING.md Check if the graph is correctly built and registered for the current project session. ```bash cd /path/to/your/project code-review-graph status # should print Files/Nodes/Edges from the built graph ls .mcp.json # should exist cat .mcp.json # should reference `code-review-graph serve` # then: fully quit Claude Code and reopen it inside this project ``` -------------------------------- ### Install Embeddings for Semantic Search Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/USAGE.md Installs the necessary package for computing embedding vectors for semantic search. This is required before using embedding-related tools. ```bash pip install "code-review-graph[embeddings]" ``` -------------------------------- ### Install Embeddings Dependency Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/TROUBLESHOOTING.md Install the necessary dependencies to enable semantic search and vector computation. ```bash pip install code-review-graph[embeddings] ``` -------------------------------- ### Install MCP Server with Claude Code Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Registers the MCP server with Claude Code. Use --dry-run to preview changes without writing files. ```bash code-review-graph install # Register MCP server with Claude Code (alias: init) ``` ```bash code-review-graph install --dry-run # Preview without writing files ``` -------------------------------- ### Installing Optional Dependencies for Code Review Graph Source: https://github.com/tirth8205/code-review-graph/blob/main/README.md Install optional dependency groups using pip to enable specific features like embeddings, community detection, or evaluation benchmarks. ```bash pip install code-review-graph[embeddings] # Local vector embeddings (sentence-transformers) ``` ```bash pip install code-review-graph[google-embeddings] # Google Gemini embeddings ``` ```bash pip install code-review-graph[communities] # Community detection (igraph) ``` ```bash pip install code-review-graph[eval] # Evaluation benchmarks (matplotlib) ``` ```bash pip install code-review-graph[wiki] # Wiki generation with LLM summaries (ollama) ``` ```bash pip install code-review-graph[all] # All optional dependencies ``` -------------------------------- ### CLI Commands for Code Review Graph Source: https://github.com/tirth8205/code-review-graph/blob/main/README.md Use these commands to manage and interact with the code graph. Commands cover installation, building, updating, and visualizing the graph. ```bash code-review-graph install # Auto-detect and configure all platforms ``` ```bash code-review-graph install --platform # Target a specific platform ``` ```bash code-review-graph build # Parse entire codebase ``` ```bash code-review-graph update # Incremental update (changed files only) ``` ```bash code-review-graph status # Graph statistics ``` ```bash code-review-graph watch # Auto-update on file changes ``` ```bash code-review-graph visualize # Generate interactive HTML graph ``` ```bash code-review-graph wiki # Generate markdown wiki from communities ``` ```bash code-review-graph detect-changes # Risk-scored change impact analysis ``` ```bash code-review-graph register # Register repo in multi-repo registry ``` ```bash code-review-graph unregister # Remove repo from registry ``` ```bash code-review-graph repos # List registered repositories ``` ```bash code-review-graph eval # Run evaluation benchmarks ``` ```bash code-review-graph serve # Start MCP server ``` -------------------------------- ### Get Wiki Page Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Retrieves a specific wiki page by `community_name`. `repo_root` can be auto-detected. ```python get_wiki_page_tool( community_name: str # Community name to look up repo_root: str | None ) ``` -------------------------------- ### Get Community Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Retrieves details for a specific community. Search by `community_name` or `community_id`. `include_members` determines if community members are listed. `repo_root` can be auto-detected. ```python get_community_tool( community_name: str | None # Name to search (partial match) community_id: int | None # Database ID include_members: bool = False repo_root: str | None ) ``` -------------------------------- ### Query Graph Tool - Get File Summary Source: https://context7.com/tirth8205/code-review-graph/llms.txt Obtain a summary of a specific file using the `query_graph_tool`. Set the `pattern` to "file_summary" and provide the `target` file path. ```python # Get file summary result = query_graph_tool(pattern="file_summary", target="src/auth/login.py") ``` -------------------------------- ### Get Minimal Context Tool Source: https://context7.com/tirth8205/code-review-graph/llms.txt Retrieve a concise context for a given task, typically used as a first step before employing other graph tools. It provides essential information like risk assessment and suggested tools. ```python result = get_minimal_context_tool( task="review PR #42", base="HEAD~1" ) ``` -------------------------------- ### List Repositories Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Lists all available repositories. This tool takes no parameters. ```python list_repos_tool( (no parameters) ) ``` -------------------------------- ### Build Full Code Graph Source: https://github.com/tirth8205/code-review-graph/blob/main/CLAUDE.md Initiates a complete build of the code graph from scratch. This is a foundational step before incremental updates. ```bash uv run code-review-graph build ``` -------------------------------- ### Get refactoring suggestions Source: https://context7.com/tirth8205/code-review-graph/llms.txt Retrieve automated suggestions for code improvements. ```python result = refactor_tool(mode="suggest") ``` -------------------------------- ### Run All Tests with Coverage Source: https://github.com/tirth8205/code-review-graph/blob/main/CONTRIBUTING.md Execute all tests and generate a coverage report. Fail the build if coverage is below 50%. ```bash uv run pytest --cov=code_review_graph --cov-report=term-missing --cov-fail-under=50 ``` -------------------------------- ### List Registered Repositories Source: https://github.com/tirth8205/code-review-graph/blob/main/CLAUDE.md Displays a list of all repositories currently registered in the multi-repo registry. ```bash uv run code-review-graph repos ``` -------------------------------- ### Review changes prompt Source: https://context7.com/tirth8205/code-review-graph/llms.txt Execute a pre-commit review workflow to identify changes and test gaps. ```python messages = review_changes(base="HEAD~1") ``` -------------------------------- ### Instantiate and Use DataProcessor Source: https://github.com/tirth8205/code-review-graph/blob/main/tests/fixtures/sample_notebook.ipynb Creates an instance of the DataProcessor class and calls its process method with an input value. Prints the final output. ```python processor = DataProcessor('test') output = processor.process(5) print(output) ``` -------------------------------- ### Configure Specific Platforms Source: https://github.com/tirth8205/code-review-graph/blob/main/README.md Commands to target configuration for specific AI coding platforms. ```bash code-review-graph install --platform codex # configure only Codex code-review-graph install --platform cursor # configure only Cursor code-review-graph install --platform claude-code # configure only Claude Code ``` -------------------------------- ### Debug Issue Prompt Source: https://context7.com/tirth8205/code-review-graph/llms.txt Generates a structured prompt for AI assistants to perform guided debugging based on a provided issue description. ```python # MCP Prompt Call messages = debug_issue(description="Login timeout after password reset") # Returns structured prompt for AI assistant to: # 1. Search for relevant functions # 2. Trace execution flows # 3. Check recent changes in affected areas # 4. Identify potential root causes ``` -------------------------------- ### CLI Commands - Wiki Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Command for generating a markdown wiki from code review communities. ```APIDOC ## CLI Commands - Wiki ### `wiki` **Description:** Generate a markdown wiki from the identified communities. **Usage:** ```bash code-review-graph wiki ``` ``` -------------------------------- ### Register Repository for Multi-repo Search Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/USAGE.md Registers another repository for cross-repository search. Use the --alias flag to provide a short name for the registered repository. ```bash code-review-graph register /path/to/other/repo --alias mylib ``` -------------------------------- ### Get Documentation Section Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Retrieves a specific section of the documentation. `section_name` can be 'usage', 'review-delta', 'review-pr', 'commands', 'legal', 'watch', 'embeddings', 'languages', or 'troubleshooting'. ```python get_docs_section_tool( section_name: str # usage, review-delta, review-pr, commands, legal, watch, embeddings, languages, troubleshooting ) ``` -------------------------------- ### get_architecture_overview_tool Source: https://context7.com/tirth8205/code-review-graph/llms.txt Generates a high-level architectural overview including coupling warnings. ```APIDOC ## get_architecture_overview_tool ### Description Provides an architectural summary, identifying communities and potential coupling issues. ### Response #### Success Response (200) - **communities** (array) - List of communities. - **coupling_warnings** (array) - Warnings regarding high coupling between components. ``` -------------------------------- ### Get Flow Details with get_flow_tool Source: https://context7.com/tirth8205/code-review-graph/llms.txt Retrieve detailed information about a specific execution flow, including the full call path. Can include source code snippets for steps. ```python result = get_flow_tool( flow_id=1, # Or use flow_name="login" for partial match include_source=True ) ``` -------------------------------- ### Get Impact Radius Tool Source: https://context7.com/tirth8205/code-review-graph/llms.txt Analyze the blast radius of changes within the codebase. This tool identifies impacted functions, classes, and files up to a specified `max_depth` and `detail_level`. ```python result = get_impact_radius_tool( changed_files=["src/auth/login.py", "src/utils/validators.py"], max_depth=2, detail_level="standard" # or "minimal" ) ``` -------------------------------- ### Create Table with SQL Source: https://github.com/tirth8205/code-review-graph/blob/main/tests/fixtures/sample_databricks_notebook.ipynb Creates a new table based on a select query from raw data. ```sql %sql CREATE TABLE catalog.schema.output AS SELECT * FROM catalog.schema.raw_data ``` -------------------------------- ### Get Affected Flows Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Identifies flows affected by code changes. `changed_files` can be auto-detected from git. `base` specifies the Git diff base. `repo_root` can be auto-detected. ```python get_affected_flows_tool( changed_files: list[str] | None # Auto-detected from git base: str = "HEAD~1" repo_root: str | None ) ``` -------------------------------- ### Get Flow Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Retrieves details for a specific flow. Use `flow_id` (from `list_flows_tool`) or `flow_name` for searching. `include_source` determines if source snippets are included. `repo_root` can be auto-detected. ```python get_flow_tool( flow_id: int | None # Database ID from list_flows_tool flow_name: str | None # Name to search (partial match) include_source: bool = False # Include source snippets for each step repo_root: str | None ) ``` -------------------------------- ### Environment Variable Configuration Source: https://context7.com/tirth8205/code-review-graph/llms.txt Configure embedding models, performance tuning, build settings, and data storage paths via environment variables. ```bash # Embedding configuration export CRG_EMBEDDING_MODEL="all-MiniLM-L6-v2" # Default embedding model export CRG_ACCEPT_CLOUD_EMBEDDINGS=1 # Suppress cloud API warning # Performance tuning export CRG_MAX_IMPACT_NODES=500 # Max nodes in impact analysis export CRG_MAX_IMPACT_DEPTH=3 # Max BFS depth export CRG_DEPENDENT_HOPS=2 # Multi-hop dependent discovery export CRG_MAX_SEARCH_RESULTS=100 # Max search results export CRG_BFS_ENGINE=sql # "sql" (default) or "networkx" # Build configuration export CRG_PARSE_WORKERS=4 # Parallel parsing workers export CRG_SERIAL_PARSE=1 # Disable parallel parsing export CRG_GIT_TIMEOUT=30 # Git command timeout (seconds) export CRG_RECURSE_SUBMODULES=1 # Include git submodules # Data storage export CRG_DATA_DIR=/custom/path # Override default .code-review-graph/ export CRG_REPO_ROOT=/path/to/repo # Override repo root detection ``` -------------------------------- ### Generate Wiki Pages Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/USAGE.md Creates markdown wiki pages for each detected community within the project. These pages are saved in the .code-review-graph/wiki/ directory. ```bash code-review-graph wiki ``` -------------------------------- ### Embed Graph Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Embeds the knowledge graph using a specified model. Requires `pip install code-review-graph[embeddings]`. `repo_root` can be auto-detected, and `model` specifies the embedding model name. ```python embed_graph_tool( repo_root: str | None model: str | None # Embedding model name ) ``` -------------------------------- ### List Graph Statistics Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Lists statistics for the knowledge graph. `repo_root` can be auto-detected. ```python list_graph_stats_tool( repo_root: str | None ) ``` -------------------------------- ### Get Impact Radius Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/skills/review-pr/SKILL.md Analyze the blast radius of changes across the entire pull request. This tool helps identify high-risk areas by highlighting widely depended-upon code. ```python get_impact_radius_tool(base="main") ``` -------------------------------- ### Get Review Context Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/skills/review-pr/SKILL.md This tool retrieves all changed files across all commits in a pull request, using a specified base branch for diffing. It is essential for obtaining the full context of the review. ```python get_review_context_tool(base="main") ``` -------------------------------- ### Multi-Repository Registry Commands Source: https://context7.com/tirth8205/code-review-graph/llms.txt Commands to manage multiple repositories for cross-repository operations. ```bash # Register a repository code-review-graph register /path/to/project --alias myproject # Output: Registered: /path/to/project (alias: myproject) # List all registered repositories code-review-graph repos # Output: # /path/to/project1 (myproject) # /path/to/project2 (api-service) # Remove from registry code-review-graph unregister myproject # Output: Unregistered: myproject ``` -------------------------------- ### Get Impact Radius Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Calculates the impact radius of changes. `changed_files` can be auto-detected from git. `max_depth` controls the number of hops in the graph. `repo_root` can be auto-detected, and `base` specifies the Git diff base. ```python get_impact_radius_tool( changed_files: list[str] | None # Auto-detected from git max_depth: int = 2 # Hops in graph repo_root: str | None base: str = "HEAD~1" ) ``` -------------------------------- ### Enable Windows Long Path Support Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/TROUBLESHOOTING.md Configure Git to support long file paths on native Windows systems. ```bash git config --system core.longpaths true ``` -------------------------------- ### Visualize Code Review Graph Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/USAGE.md Generates an interactive D3.js force-directed graph of your codebase. The graph starts collapsed and can be expanded by clicking files. Use the search bar to filter and legend to toggle edge visibility. ```bash code-review-graph visualize ``` ```bash open .code-review-graph/graph.html ``` -------------------------------- ### Run Tests for a Single File Source: https://github.com/tirth8205/code-review-graph/blob/main/CONTRIBUTING.md Execute tests specifically for the 'test_parser.py' file with verbose output. ```bash uv run pytest tests/test_parser.py -v ``` -------------------------------- ### List Communities Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Lists software communities, sortable by 'size', 'cohesion', or 'name'. `min_size` filters communities by minimum size. `repo_root` can be auto-detected. ```python list_communities_tool( sort_by: str = "size" # size, cohesion, name min_size: int = 0 repo_root: str | None ) ``` -------------------------------- ### Get Review Context Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Retrieves review context, including source code snippets. `changed_files` can be auto-detected from git. `max_depth` controls the graph traversal depth. `include_source` determines if source code is included. `max_lines_per_file` limits the lines per file. `repo_root` can be auto-detected, and `base` specifies the Git diff base. ```python get_review_context_tool( changed_files: list[str] | None max_depth: int = 2 include_source: bool = True max_lines_per_file: int = 200 repo_root: str | None base: str = "HEAD~1" ) ``` -------------------------------- ### Create a Feature Branch Source: https://github.com/tirth8205/code-review-graph/blob/main/CONTRIBUTING.md Create a new Git branch for developing a feature. Replace 'your-feature' with a descriptive name. ```bash git checkout -b feature/your-feature ``` -------------------------------- ### CLI Commands - Multi-repo Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Commands for managing multiple repositories within the code review graph. ```APIDOC ## CLI Commands - Multi-repo ### `register [--alias ]` **Description:** Register a repository with the code review graph. An optional alias can be provided. **Usage:** ```bash code-review-graph register /path/to/repo --alias my-repo ``` ### `unregister ` **Description:** Remove a registered repository from the code review graph. **Usage:** ```bash code-review-graph unregister my-repo ``` ### `repos` **Description:** List all currently registered repositories. **Usage:** ```bash code-review-graph repos ``` ``` -------------------------------- ### Register Repository Source: https://github.com/tirth8205/code-review-graph/blob/main/CLAUDE.md Adds a repository to the multi-repo registry. This is necessary for managing multiple codebases. ```bash uv run code-review-graph register ``` -------------------------------- ### CLI Commands - Evaluation Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Command for running evaluation benchmarks. ```APIDOC ## CLI Commands - Evaluation ### `eval` **Description:** Execute evaluation benchmarks for the code review graph. **Usage:** ```bash code-review-graph eval ``` ``` -------------------------------- ### Configuration Source: https://github.com/tirth8205/code-review-graph/blob/main/README.md Configuration options for the code-review-graph, including ignore files and optional dependencies. ```APIDOC ## Configuration ### Description Configuration options for the code-review-graph, including ignore files and optional dependencies. ### Ignore File To exclude paths from indexing, create a `.code-review-graphignore` file in your repository root. ``` generated/** *.generated.ts vendor/** node_modules/** ``` Note: in git repos, only tracked files are indexed (`git ls-files`), so gitignored files are skipped automatically. Use `.code-review-graphignore` to exclude tracked files or when git isn't available. ### Optional Dependencies - `pip install code-review-graph[embeddings]`: Local vector embeddings (sentence-transformers) - `pip install code-review-graph[google-embeddings]`: Google Gemini embeddings - `pip install code-review-graph[communities]`: Community detection (igraph) - `pip install code-review-graph[eval]`: Evaluation benchmarks (matplotlib) - `pip install code-review-graph[wiki]`: Wiki generation with LLM summaries (ollama) - `pip install code-review-graph[all]`: All optional dependencies ``` -------------------------------- ### List Flows Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Lists available flows, sortable by 'criticality', 'depth', 'node_count', 'file_count', or 'name'. `limit` sets the maximum number of results. `kind` can filter by entry point kind (e.g., 'Test', 'Function'). `repo_root` can be auto-detected. ```python list_flows_tool( sort_by: str = "criticality" # criticality, depth, node_count, file_count, name limit: int = 50 kind: str | None # Filter by entry point kind (e.g. "Test", "Function") repo_root: str | None ) ``` -------------------------------- ### Generate Wiki Documentation Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Generates markdown wiki documentation from defined communities within the code review graph. ```bash code-review-graph wiki # Generate markdown wiki from communities ``` -------------------------------- ### Generate Wiki Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Generates or regenerates wiki pages for the project. Set `force` to `True` to regenerate all pages regardless of changes. `repo_root` can be auto-detected. ```python generate_wiki_tool( repo_root: str | None force: bool = False # Regenerate all pages even if unchanged ) ``` -------------------------------- ### Apply refactoring Source: https://context7.com/tirth8205/code-review-graph/llms.txt Apply a previously previewed refactoring, optionally using a dry-run mode. ```python result = apply_refactor_tool( refactor_id="abc123", dry_run=True # Preview changes without writing ) ``` ```python result = apply_refactor_tool(refactor_id="abc123", dry_run=False) ``` -------------------------------- ### MCP Prompts - Workflow Templates Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Pre-defined workflow templates for common tasks. ```APIDOC ## review_changes ### Description Pre-commit review workflow using detect_changes, affected_flows, and test gaps. ### Method PROMPT TEMPLATE ### Endpoint review_changes ### Parameters #### Query Parameters - **base** (str) - Optional - Git diff base (default: HEAD~1) ### Request Example ```json { "base": "main" } ``` ### Response #### Success Response (200) (No specific response format defined) #### Response Example (No example provided) ``` -------------------------------- ### Architecture Map Prompt Source: https://context7.com/tirth8205/code-review-graph/llms.txt Generates a structured prompt for AI assistants to analyze architecture, communities, and module relationships. ```python # MCP Prompt Call messages = architecture_map() # Returns structured prompt for AI assistant to: # 1. Run get_architecture_overview_tool # 2. List top communities and their purposes # 3. Generate Mermaid diagram of module relationships # 4. Highlight coupling warnings ``` -------------------------------- ### Run Evaluation Benchmarks Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Executes evaluation benchmarks for the code review graph. ```bash code-review-graph eval # Run evaluation benchmarks ``` -------------------------------- ### Cross-Repository Search Tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Performs a search across multiple repositories. `query` is the search string. `kind` can filter results (e.g., 'File', 'Class'). `limit` sets the maximum number of results. ```python cross_repo_search_tool( query: str kind: str | None limit: int = 20 ) ``` -------------------------------- ### Generate wiki Source: https://context7.com/tirth8205/code-review-graph/llms.txt Create a markdown wiki based on the current code community structure. ```python result = generate_wiki_tool(force=False) ``` -------------------------------- ### Configuration - Environment Variables Source: https://context7.com/tirth8205/code-review-graph/llms.txt Environment variables for configuring Code Review Graph behavior. ```APIDOC ## Configuration - Environment Variables ### Description Set these environment variables to customize the behavior of Code Review Graph. ### Variables #### Embedding Configuration - **CRG_EMBEDDING_MODEL** (string) - Default: `all-MiniLM-L6-v2` - Specifies the embedding model to use. - **CRG_ACCEPT_CLOUD_EMBEDDINGS** (integer) - Default: `0` - Set to `1` to suppress cloud API warnings. #### Performance Tuning - **CRG_MAX_IMPACT_NODES** (integer) - Default: `500` - Maximum number of nodes to consider in impact analysis. - **CRG_MAX_IMPACT_DEPTH** (integer) - Default: `3` - Maximum depth for Breadth-First Search (BFS) in impact analysis. - **CRG_DEPENDENT_HOPS** (integer) - Default: `2` - Number of hops for multi-hop dependent discovery. - **CRG_MAX_SEARCH_RESULTS** (integer) - Default: `100` - Maximum number of search results to return. - **CRG_BFS_ENGINE** (string) - Default: `sql` - The engine to use for BFS. Options: `sql` or `networkx`. #### Build Configuration - **CRG_PARSE_WORKERS** (integer) - Default: `4` - Number of parallel workers for parsing code. - **CRG_SERIAL_PARSE** (integer) - Default: `0` - Set to `1` to disable parallel parsing. - **CRG_GIT_TIMEOUT** (integer) - Default: `30` - Timeout in seconds for Git commands. - **CRG_RECURSE_SUBMODULES** (integer) - Default: `0` - Set to `1` to include Git submodules. #### Data Storage - **CRG_DATA_DIR** (string) - Default: `.code-review-graph/` - Overrides the default directory for storing graph data. - **CRG_REPO_ROOT** (string) - Default: Auto-detected - Overrides the repository root detection. ### Example Usage ```bash export CRG_EMBEDDING_MODEL="all-MiniLM-L6-v2" export CRG_MAX_IMPACT_NODES=1000 ``` ``` -------------------------------- ### CLI Commands - Build and Update Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/COMMANDS.md Commands for building and updating the code review graph. ```APIDOC ## CLI Commands - Build and Update ### `build` **Description:** Perform a full build of the code review graph. **Usage:** ```bash code-review-graph build ``` ### `update` **Description:** Perform an incremental update of the code review graph. **Usage:** ```bash code-review-graph update ``` ### `update --base ` **Description:** Perform an incremental update with a custom base reference. **Usage:** ```bash code-review-graph update --base origin/main ``` ``` -------------------------------- ### Build and Update Graph CLI Commands Source: https://context7.com/tirth8205/code-review-graph/llms.txt Commands for performing full builds or incremental updates to the knowledge graph. ```bash # Full build - parse all files in the repository code-review-graph build # Output: Full build: 1122 files, 6285 nodes, 27117 edges (postprocess=full) # Incremental update - only changed files since last commit code-review-graph update # Output: Incremental: 5 files updated, 6290 nodes, 27125 edges (postprocess=full) # Incremental update with custom base ref code-review-graph update --base origin/main # Skip expensive post-processing for faster builds code-review-graph build --skip-flows # Skip flow/community detection code-review-graph build --skip-postprocess # Skip all post-processing # Run post-processing separately code-review-graph postprocess code-review-graph postprocess --no-flows # Skip flow detection code-review-graph postprocess --no-communities # Skip community detection ``` -------------------------------- ### Retrieve Review Context Source: https://github.com/tirth8205/code-review-graph/blob/main/skills/review-delta/SKILL.md Fetch the necessary context including changed files, impacted nodes, and source snippets. ```python get_review_context_tool() ``` -------------------------------- ### Configuration - Ignore Patterns Source: https://context7.com/tirth8205/code-review-graph/llms.txt Configure files to exclude from indexing using a `.code-review-graphignore` file. ```APIDOC ## Configuration - Ignore Patterns ### Description Specify file patterns in a `.code-review-graphignore` file to exclude them from being indexed by Code Review Graph. ### File Format Uses standard glob patterns, similar to `.gitignore`. ### Example `.code-review-graphignore` Content ```gitignore generated/** *.generated.ts vendor/** node_modules/** dist/** build/** *.min.js ``` ``` -------------------------------- ### Ignore Patterns Configuration Source: https://context7.com/tirth8205/code-review-graph/llms.txt Define files and directories to exclude from indexing using the .code-review-graphignore file. ```gitignore # .code-review-graphignore generated/** *.generated.ts vendor/** node_modules/** dist/** build/** *.min.js ``` -------------------------------- ### Contributing Source: https://github.com/tirth8205/code-review-graph/blob/main/README.md Instructions for contributing to the code-review-graph project. ```APIDOC ## Contributing ### Setup ```bash git clone https://github.com/tirth8205/code-review-graph.git cd code-review-graph python3 -m venv .venv && source .venv/bin/activate pip install -e ".[dev]" pytest ``` ### Adding a new language Edit `code_review_graph/parser.py` and add your extension to `EXTENSION_TO_LANGUAGE` along with node type mappings in `_CLASS_TYPES`, `_FUNCTION_TYPES`, `_IMPORT_TYPES`, and `_CALL_TYPES`. Include a test fixture and open a PR. ``` -------------------------------- ### get_minimal_context_tool Source: https://github.com/tirth8205/code-review-graph/blob/main/docs/LLM-OPTIMIZED-REFERENCE.md Retrieves a minimal context summary for a given task, including risks, communities, flows, and suggested next tools. ```APIDOC ## POST get_minimal_context_tool ### Description Returns a concise summary (approx. 100 tokens) to guide the next steps in a code review or analysis task. ### Parameters #### Request Body - **task** (string) - Required - The description of the task being performed. ```