### Setup SCIP Indexers Source: https://codegraphcontext.github.io/reference/cli Installs or verifies external SCIP indexers. C/C++ projects require a `compile_commands.json` file. ```bash cgc setup-scip ``` -------------------------------- ### Initialize Virtual Environment and Install Dependencies Source: https://codegraphcontext.github.io/contributing Set up an isolated Python environment and install project dependencies, including development tools. ```bash python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" ``` -------------------------------- ### Setup MCP and Neo4j Source: https://codegraphcontext.github.io/reference/cli Run interactive wizards for MCP IDE setup and Neo4j connection. Also lists registered MCP tools. ```bash cgc mcp setup # Interactive IDE wizard (shortcut: cgc m) cgc mcp start # Start stdio MCP server cgc mcp tools # List registered MCP tools cgc neo4j setup # Neo4j connection wizard (shortcut: cgc n) ``` -------------------------------- ### Start Neo4j Server with Docker Source: https://codegraphcontext.github.io/concepts/backends Starts a Neo4j server instance using Docker. Ensure ports 7474 and 7687 are available. ```bash docker run -d --name neo4j-cgc -p 7474:7474 -p 7687:7687 -e NEO4J_AUTH=neo4j/password neo4j:latest ``` -------------------------------- ### Start Local Visualizer Server Source: https://codegraphcontext.github.io/guides/visualization Run this command to start the local visualization server. It resolves the active database context, launches a FastAPI server on port 8000, and opens your browser to http://localhost:8000. ```bash cgc visualize ``` -------------------------------- ### Install KuzuDB and FalkorDB Client Packages Source: https://codegraphcontext.github.io/reference/troubleshooting Install necessary Python client packages for KuzuDB, Neo4j, and FalkorDB to resolve 'No database backend available' errors. Ensure these are installed in your active virtual environment. ```bash pip install kuzu neo4j falkordb ``` -------------------------------- ### Install Neo4j Drivers Source: https://codegraphcontext.github.io/getting-started/installation Install the Python driver for connecting to a standalone Neo4j instance. ```bash pip install neo4j ``` -------------------------------- ### Install FalkorDB Remote Server Client Source: https://codegraphcontext.github.io/getting-started/installation Install the client driver for connecting to a remote FalkorDB server. ```bash pip install falkordb ``` -------------------------------- ### AI Assistant Context Example Source: https://codegraphcontext.github.io/guides/bundles Illustrates how an AI assistant can query code structure instantly using loaded bundles. ```bash # AI can now query structure instantly # "Show me all functions that use numpy.linalg" ``` -------------------------------- ### Install KuzuDB Driver Source: https://codegraphcontext.github.io/concepts/backends Install the KuzuDB driver using pip. This is a prerequisite for using KuzuDB as a backend. ```bash pip install kuzu ``` -------------------------------- ### MCP & Neo4j Setup Source: https://codegraphcontext.github.io/reference/cli Commands for setting up MCP and Neo4j connections. ```APIDOC ## `mcp` & `neo4j` Setup ### Description Commands for setting up the IDE wizard, MCP server, and Neo4j connections. ### Usage ``` cgc mcp setup # Interactive IDE wizard (shortcut: cgc m) cgc mcp start # Start stdio MCP server cgc mcp tools # List registered MCP tools cgc neo4j setup # Neo4j connection wizard (shortcut: cgc n) ``` ``` -------------------------------- ### Run CGC MCP Setup Wizard Source: https://codegraphcontext.github.io/getting-started/mcp-setup Execute the interactive wizard to automatically configure MCP client settings for supported IDEs and applications. ```bash cgc mcp setup ``` -------------------------------- ### Install CGC with pip Source: https://codegraphcontext.github.io/getting-started/installation Install CGC into your active Python or virtual environment using pip. ```bash pip install codegraphcontext ``` -------------------------------- ### Install FalkorDB Lite Drivers Source: https://codegraphcontext.github.io/getting-started/installation Install the FalkorDB Lite driver, available on Unix with Python 3.12+. ```bash pip install falkordblite ``` -------------------------------- ### Install CGC CLI Globally with pipx Source: https://codegraphcontext.github.io/getting-started/installation Install the CGC CLI into an isolated Python environment for global availability. ```bash pipx install codegraphcontext ``` -------------------------------- ### Install Neo4j Client Library Source: https://codegraphcontext.github.io/concepts/backends Installs the official Neo4j client library for Python using pip. This is required for CGC to connect to a Neo4j database. ```bash pip install neo4j ``` -------------------------------- ### Install KuzuDB Drivers Source: https://codegraphcontext.github.io/getting-started/installation Install the Python driver bindings for KuzuDB, which is embedded and runs within the Python process. ```bash pip install kuzu ``` -------------------------------- ### Verify Installed CLI Version Source: https://codegraphcontext.github.io/getting-started/installation Check the installed version of the CodeGraphContext CLI. ```bash # Verify the installed CLI version cgc version ``` -------------------------------- ### Start the CGC Gateway Server Source: https://codegraphcontext.github.io/reference/api Starts the CodeGraphContext HTTP server. Use `--host` and `--port` to specify the address and port. The `--reload` flag is for development only. ```bash cgc api start cgc api start --host 127.0.0.1 --port 8080 cgc api start --reload # development only ``` -------------------------------- ### Kubernetes Deployment Manifests Source: https://codegraphcontext.github.io/guides/onboarding-codebase Example Kubernetes manifests for deploying the FastAPI gateway, MCP server, and Neo4j database. ```yaml deployment.yaml & service.yaml neo4j-deployment.yaml ``` -------------------------------- ### Start HTTP API Gateway Source: https://codegraphcontext.github.io/reference/cli Start the HTTP API gateway to expose REST endpoints and a liveness probe. Configure host, port, and reload behavior. ```bash cgc api start [--host 0.0.0.0] [--port 8000] [--reload] ``` -------------------------------- ### Emacs Lisp Smoke Test Setup and Queries Source: https://codegraphcontext.github.io/contributing_languages This script sets up environment variables for Kuzu database, indexes an Emacs Lisp project, and runs several diagnostic queries to verify parsing of files, functions, variables, and import relationships. It uses `uv run` for Python execution. ```bash tmpdir=$(mktemp -d) export PYTHONPATH=src export DEFAULT_DATABASE=kuzudb export CGC_RUNTIME_DB_TYPE=kuzudb export CGC_RUNTIME_DB_PATH="$tmpdir/kuzu.db" uv run python -m codegraphcontext index tests/fixtures/sample_projects/sample_project_elisp --force uv run python -m codegraphcontext query "MATCH (f:File) WHERE f.path ENDS WITH '.el' RETURN f.name AS file ORDER BY file" uv run python -m codegraphcontext query "MATCH (fn:Function) WHERE fn.lang = 'elisp' RETURN fn.name AS function ORDER BY function" uv run python -m codegraphcontext query "MATCH (v:Variable) WHERE v.lang = 'elisp' RETURN v.name AS variable ORDER BY variable" uv run python -m codegraphcontext query "MATCH (f:File)-[:IMPORTS]->(m:Module) RETURN f.name AS file, m.name AS module ORDER BY file, module" uv run python -m codegraphcontext query "MATCH (caller:Function)-[:CALLS]->(callee:Function) WHERE caller.lang = 'elisp' RETURN caller.name AS caller_name, callee.name AS callee_name ORDER BY caller_name, callee_name" rm -rf "$tmpdir" ``` -------------------------------- ### Run CGC CLI On-Demand with uvx Source: https://codegraphcontext.github.io/getting-started/installation Use this method to run the CGC CLI without a global installation if you are using uv. ```bash uvx codegraphcontext --help ``` -------------------------------- ### metadata.json Example Source: https://codegraphcontext.github.io/guides/bundles Contains repository and indexing metadata for the bundle, including CGC version, export time, repository details, and language information. ```json { "cgc_version": "0.5.0", "exported_at": "2026-01-13T22:00:00", "repo": "numpy/numpy", "commit": "a1b2c3d4", "languages": ["python", "c"], "format_version": "1.0" } ``` -------------------------------- ### Customize Visualizer Server Port and Repo Source: https://codegraphcontext.github.io/guides/visualization Specify a custom port or target repository path when starting the visualization server. This allows for flexible deployment and targeting specific projects. ```bash # Run server on port 9000 for a specific repository cgc visualize --repo ~/projects/my-api --port 9000 # Use a specific named context database cgc visualize --context StagingGraph ``` -------------------------------- ### Start CodeGraphContext MCP Server Source: https://codegraphcontext.github.io/reference/troubleshooting Test the MCP server execution by running the launch command directly in your shell. The server should wait for input on stdin/stdout. If it crashes, inspect the stack trace. ```bash cgc mcp start ``` -------------------------------- ### Start Real-Time Directory Watcher Source: https://codegraphcontext.github.io/guides/indexing Run a filesystem watcher in the background to capture file writes and incrementally sync the code graph. ```bash # Start watching the active workspace cgc watch ``` -------------------------------- ### Install FalkorDB Lite Driver Source: https://codegraphcontext.github.io/concepts/backends Install the necessary Python package for FalkorDB Lite, an embedded, in-memory graph engine. Requires Unix-like systems and Python 3.12+. ```bash # For FalkorDB Lite pip install falkordblite ``` -------------------------------- ### Start CGC MCP Server Manually Source: https://codegraphcontext.github.io/getting-started/mcp-setup Test starting the CGC MCP server manually in your shell to ensure it listens on standard input/output (stdin/stdout) for JSON-RPC messages and does not exit immediately. This is useful for troubleshooting connection issues. ```bash cgc mcp start ``` -------------------------------- ### Start CodeGraphContext API Gateway Source: https://codegraphcontext.github.io/reference/troubleshooting Confirm the API gateway process is running by starting it on a specified port. Use the health probe to verify its status. ```bash cgc api start --port 8000 ``` -------------------------------- ### Bundle Structure Example Source: https://codegraphcontext.github.io/guides/bundles A .cgc file is a ZIP archive containing metadata, schema, nodes, edges, statistics, and a README. ```treeview numpy.cgc ├── metadata.json # Repository and indexing metadata ├── schema.json # Graph schema definition ├── nodes.jsonl # All nodes (one JSON per line) ├── edges.jsonl # All relationships (one JSON per line) ├── stats.json # Graph statistics └── README.md # Human-readable description ``` -------------------------------- ### Distribute Bundles via Hugging Face Datasets Source: https://codegraphcontext.github.io/guides/bundles Upload your bundle files to Hugging Face Datasets for easy sharing and versioning. Ensure you have the `huggingface_hub` library installed. ```bash # Install huggingface_hub pip install huggingface_hub # Upload huggingface-cli upload your-org/cgc-bundles your-repo-*.cgc ``` -------------------------------- ### Install and Manage Git Hooks Source: https://codegraphcontext.github.io/reference/cli Keep the graph in sync with your Git commits using these hook management commands. ```bash cgc hook install [PATH] [--force] ``` ```bash cgc hook uninstall [PATH] ``` ```bash cgc hook status [PATH] ``` -------------------------------- ### nodes.jsonl Excerpt Source: https://codegraphcontext.github.io/guides/bundles An excerpt from the nodes.jsonl file, showing examples of node entries with their IDs, labels, names, paths, and line numbers. ```json {"_id": "4:abc123", "_labels": ["Function"], "name": "array", "path": "/numpy/core/array.py", "line_number": 42} {"_id": "4:def456", "_labels": ["Class"], "name": "ndarray", "path": "/numpy/core/multiarray.py", "line_number": 100} ``` -------------------------------- ### Run System Diagnostics Source: https://codegraphcontext.github.io/reference/cli Diagnose potential issues with your CodeGraph setup. This command checks configuration, database connectivity, parsers, dependencies, and file permissions. ```bash cgc doctor ``` -------------------------------- ### Python AST Query for Language Parsing Source: https://codegraphcontext.github.io/guides/onboarding-codebase Example of a Tree-sitter tag query file used for parsing Python code, specifically for identifying tags like classes and functions. ```scm queries/python/tags.scm ``` -------------------------------- ### Enable Real-Time Code Graph Watcher Source: https://codegraphcontext.github.io/getting-started/quickstart Keep your code graph updated in real-time as you write code by starting a background watcher with the `watch` command. Use `cgc unwatch ` to stop it. ```bash cgc watch ``` -------------------------------- ### Clone, Index, and Export a Repository Source: https://codegraphcontext.github.io/guides/bundles Clone a repository, index its contents using cgc, and then export it into a versioned bundle file. This is the first step in creating your own bundle registry. ```bash # Clone and index git clone https://github.com/your-org/your-repo cd your-repo cgc index . ``` ```bash # Get commit info COMMIT=$(git rev-parse --short HEAD) TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "main") # Export with version info cgc export "your-repo-${TAG}-${COMMIT}.cgc" --repo . ``` -------------------------------- ### Inspect Effective Settings with `cgc config show` Source: https://codegraphcontext.github.io/reference/config Prints the merged configuration values, resolving defaults, global `.env`, and local workspaces. ```bash cgc config show ``` -------------------------------- ### List All Contexts Source: https://codegraphcontext.github.io/guides/contexts Displays active modes, registered contexts, database backend configurations, and associated repository directories. ```bash cgc context list ``` -------------------------------- ### Manage Configuration Source: https://codegraphcontext.github.io/reference/cli Show, set, or reset configuration values. You can also specify the database backend. ```bash cgc config show cgc config set cgc config db cgc config reset ``` -------------------------------- ### Load Registry Bundle Source: https://codegraphcontext.github.io/guides/bundles Download and load a package from the registry into your local database. If not found locally, it will be downloaded and imported. ```bash cgc bundle load flask ``` -------------------------------- ### List All Registry Packages Source: https://codegraphcontext.github.io/guides/bundles List all available graph packages hosted in the public registry. ```bash cgc registry list ``` -------------------------------- ### Install FalkorDB Remote Driver Source: https://codegraphcontext.github.io/concepts/backends Install the Python package for connecting to a remote FalkorDB server. This driver is used for external Redis-compatible FalkorDB instances. ```bash # For FalkorDB Remote pip install falkordb ``` -------------------------------- ### Educational Resources: Explore Codebases Source: https://codegraphcontext.github.io/guides/bundles Load bundles for famous codebases to allow students to explore their structure and analyze code chains. ```bash # Students can explore famous codebases cgc load django.cgc cgc find name authenticate cgc analyze chain authenticate ``` -------------------------------- ### Index Current Workspace Source: https://codegraphcontext.github.io/guides/indexing Navigate to your project directory and run this command to index the entire repository. ```bash cd /path/to/project cgc index ``` -------------------------------- ### Visualize Graph UI Source: https://codegraphcontext.github.io/reference/cli Launch the React force-directed graph UI. The default port is 8000. You can specify a repository path. ```bash cgc visualize [--repo ] [--port 8000] ``` -------------------------------- ### List and Set Global Context Mode Source: https://codegraphcontext.github.io/guides/contexts Verify the current context mode and set it to global. Global mode is the default and uses a single shared database for all indexed repositories. ```bash # Verify active mode settings cgc context list # Set mode to global cgc context mode global ``` -------------------------------- ### Index a Local Repository with CodeGraphContext Source: https://codegraphcontext.github.io/getting-started/quickstart Navigate to your repository's root directory and run the `index` command to scan the codebase and populate the code graph. CGC respects .gitignore and .cgcignore configurations. ```bash cd /path/to/your/repository cgc index ``` -------------------------------- ### Ingest Third-Party Python Package Source: https://codegraphcontext.github.io/guides/indexing Manually add an installed Python library to your active code graph for reference tracing. ```bash # Ingest requests library cgc add-package requests python ``` -------------------------------- ### load_bundle Source: https://codegraphcontext.github.io/reference/mcp Imports a portable `.cgc` file, downloading it from the registry if needed. ```APIDOC ## load_bundle ### Description Imports a portable `.cgc` file, downloading it from the registry if needed. ### Parameters #### Query Parameters - **bundle_name** (string, required): Package name (e.g., `requests`) or file name. - **clear_existing** (boolean, optional): Purges active context before loading. ``` -------------------------------- ### Set Database Backend with `cgc config db` Source: https://codegraphcontext.github.io/reference/config A shortcut to quickly update the `DEFAULT_DATABASE` key. Supported backends include `kuzudb`, `ladybugdb`, `falkordb` (Lite/embedded), `falkordb-remote`, `neo4j`, and `nornic`. ```bash cgc config db falkordb ``` -------------------------------- ### Configure Default Database Backend Source: https://codegraphcontext.github.io/getting-started/installation Set your preferred default database backend using the cgc config db command. ```bash cgc config db falkordb # FalkorDB Lite (default on Unix when falkordblite is installed) cgc config db kuzudb # KuzuDB (cross-platform fallback) cgc config db ladybugdb # LadybugDB cgc config db falkordb-remote # Remote FalkorDB server cgc config db neo4j # Neo4j cgc config db nornic # Nornic (Neo4j-compatible) ``` -------------------------------- ### Manage Bundle Registry Source: https://codegraphcontext.github.io/reference/cli Browse, search, download, and request pre-indexed bundles from the registry. Use --load to automatically load downloaded bundles. ```bash cgc registry list [--verbose] [--unique] cgc registry search cgc registry download [--output DIR] [--load] cgc registry request ``` -------------------------------- ### Override Database with CLI Flag Source: https://codegraphcontext.github.io/concepts/backends Demonstrates how to explicitly set the database backend for a specific CGC command using the --database or -db flag. ```bash cgc index --database neo4j ``` -------------------------------- ### Find Call Chain Between Functions with CodeGraphContext Source: https://codegraphcontext.github.io/getting-started/quickstart Determine a call chain or path between two functions using the `analyze chain` command, specifying the start and end function names. ```bash cgc analyze chain main save_record ``` -------------------------------- ### Manage Context Workspaces Source: https://codegraphcontext.github.io/reference/cli Manage isolation modes and named workspaces for context. Available commands include list, mode, create, delete, and default. ```bash cgc context list cgc context mode cgc context create [--database kuzudb] [--db-path /path] cgc context delete cgc context default ``` -------------------------------- ### View Bundle Contents Source: https://codegraphcontext.github.io/guides/bundles Inspect the contents of a local bundle file. Use `unzip -l` to list files, `unzip -p` with a filename to extract and view specific files like metadata or READMEs. `jq` is used for pretty-printing JSON. ```bash # Extract and view unzip -l numpy.cgc ``` ```bash # View metadata unzip -p numpy.cgc metadata.json | jq ``` ```bash # View statistics unzip -p numpy.cgc stats.json | jq ``` ```bash # Read README unzip -p numpy.cgc README.md ``` -------------------------------- ### Downloading and Loading Pre-indexed Bundles Source: https://codegraphcontext.github.io/guides/bundles Download a pre-indexed bundle from GitHub Releases and load it into CodeGraphContext. After loading, you can immediately query and analyze the code. ```bash wget https://github.com/CodeGraphContext/CodeGraphContext/releases/download/bundles-20260113/numpy-1.26.4-a1b2c3d.cgc ``` ```bash cgc load numpy-1.26.4-a1b2c3d.cgc ``` ```bash cgc find name linalg ``` ```bash cgc analyze deps numpy.linalg ``` -------------------------------- ### Manage Real-Time Watchers Source: https://codegraphcontext.github.io/reference/cli Use these commands to manage real-time filesystem watchers. Watchers reconcile the graph with the filesystem on startup. ```bash cgc watch [PATH] # Shortcut: cgc w ``` ```bash cgc unwatch ``` ```bash cgc watching ``` -------------------------------- ### Command Shortcuts Source: https://codegraphcontext.github.io/reference/cli Provides a mapping of common command shortcuts to their full command equivalents for convenience. ```bash cgc i | cgc index ``` ```bash cgc ls | cgc list ``` ```bash cgc rm | cgc delete ``` ```bash cgc v | cgc visualize ``` ```bash cgc w | cgc watch ``` ```bash cgc m | cgc mcp ``` ```bash cgc n | cgc neo4j ``` ```bash cgc export | cgc bundle export ``` ```bash cgc load | cgc bundle load ``` -------------------------------- ### Distribute Bundles via Object Storage (S3) Source: https://codegraphcontext.github.io/guides/bundles Upload your bundle files to an S3 bucket for distribution. This allows for scalable and accessible storage of your code graphs. ```bash # Upload to S3 aws s3 cp your-repo-*.cgc s3://your-bucket/bundles/ # Make public or use signed URLs aws s3 presign s3://your-bucket/bundles/your-repo-*.cgc ``` -------------------------------- ### Reset Configuration to Defaults Source: https://codegraphcontext.github.io/reference/config Restores all configuration keys to their factory default settings. ```bash cgc config reset ``` -------------------------------- ### Run System Diagnostics Check Source: https://codegraphcontext.github.io/getting-started/installation Execute the system diagnostics tool to verify CLI and database binding configuration. ```bash # Run the system diagnostics check cgc doctor ``` -------------------------------- ### Typical .cgcignore Configuration Source: https://codegraphcontext.github.io/guides/indexing Define ignore rules in a .cgcignore file to prevent indexing unwanted files like build artifacts, dependencies, and IDE configurations. ```ignore # Exclude build and compiled outputs build/ dist/ *.egg-info/ __pycache__/ *.pyc # Exclude dependency libraries node_modules/ .venv/ virtualenv/ env/ # Exclude IDE configurations .git/ .vscode/ .idea/ .project ``` -------------------------------- ### Export Specific Repositories to Bundles Source: https://codegraphcontext.github.io/guides/bundles Index individual repositories and then export them into separate bundle files. This allows for granular management and distribution of code graphs. ```bash # Index multiple repos cgc index /path/to/numpy cgc index /path/to/pandas # Export each separately cgc export numpy.cgc --repo /path/to/numpy cgc export pandas.cgc --repo /path/to/pandas # Or export everything cgc export all-my-projects.cgc ``` -------------------------------- ### Import Bundle with Clear Flag Source: https://codegraphcontext.github.io/guides/bundles Load a bundle into the CodeGraphContext database. Use the --clear flag cautiously as it will delete existing data before importing. ```bash # Try with --clear flag cgc load bundle.cgc --clear ``` -------------------------------- ### Set Configuration Values with `cgc config set` Source: https://codegraphcontext.github.io/reference/config Persists key-value settings to the global environment configuration file. Use this to set the default database engine or change file size thresholds. ```bash # Set default database engine cgc config set DEFAULT_DATABASE falkordb # Change file size threshold (in MB) cgc config set MAX_FILE_SIZE_MB 25 ``` -------------------------------- ### Distribute Bundles via GitHub Releases Source: https://codegraphcontext.github.io/guides/bundles Create a GitHub release and upload your generated bundle files. This method is suitable for sharing bundles with a wider audience. ```bash # Create a release gh release create bundles-$(date +%Y%m%d) \ your-repo-*.cgc \ --title "Pre-indexed Bundles - $(date +%Y-%m-%d)" \ --notes "Pre-indexed code graphs for instant loading" ``` -------------------------------- ### Code Analysis Pipeline: Load Dependencies Source: https://codegraphcontext.github.io/guides/bundles Load pre-indexed dependency bundles into the analysis environment as part of a CI/CD pipeline. ```bash # CI/CD: Load pre-indexed dependencies cgc load fastapi.cgc cgc load sqlalchemy.cgc ``` -------------------------------- ### Load and Query Multiple Bundles Source: https://codegraphcontext.github.io/guides/bundles Load several bundles into the same graph to query across them simultaneously. Ensure all desired bundles are loaded before executing cross-bundle queries. ```bash # Load multiple bundles into the same graph cgc load numpy.cgc cgc load pandas.cgc cgc load scikit-learn.cgc # Now query across all three cgc find name fit --type function ``` -------------------------------- ### watch_directory Source: https://codegraphcontext.github.io/reference/mcp Launches a directory watcher for incremental updates. ```APIDOC ## watch_directory ### Description Launches a directory watcher for incremental updates. ### Parameters #### Path Parameters - **path** (string, required): Directory path to watch. ``` -------------------------------- ### Generate Project Report Source: https://codegraphcontext.github.io/reference/cli Generate a CGC_REPORT.md file with god-node, complexity, and coupling metrics. Optionally include Java metrics. ```bash cgc report [--include-java] ``` -------------------------------- ### Configure CGC to Connect to Neo4j Source: https://codegraphcontext.github.io/concepts/backends Sets up CGC to use Neo4j as its database backend. This involves configuring the database type, URI, username, and password. ```bash cgc config db neo4j cgc config set NEO4J_URI bolt://localhost:7687 cgc config set NEO4J_USERNAME neo4j cgc config set NEO4J_PASSWORD password ``` -------------------------------- ### Verify Bundle Format Version Source: https://codegraphcontext.github.io/guides/bundles Extract and parse the metadata.json file to check the bundle's format version using jq. This is crucial for ensuring compatibility with your CGC version. ```bash # Verify format version unzip -p bundle.cgc metadata.json | jq .cgc_version ``` -------------------------------- ### Loading Bundles into the Code Graph Source: https://codegraphcontext.github.io/guides/bundles Import a bundle into your existing code graph. Use the --clear flag to replace existing data, with --yes for non-interactive confirmation. ```bash cgc bundle import numpy.cgc ``` ```bash cgc bundle import numpy.cgc --clear ``` ```bash cgc bundle import numpy.cgc --clear --yes ``` ```bash cgc bundle load numpy --clear -y ``` ```bash cgc load numpy.cgc ``` -------------------------------- ### Index Repositories in Global Mode Source: https://codegraphcontext.github.io/guides/contexts Index multiple repositories in global mode. Nodes from all indexed repositories are ingested into the same graph structure, enabling cross-project relationship tracing. ```bash cd ~/projects/service-api cgc index . cd ~/projects/service-gateway cgc index . # List all ingested repositories cgc list ``` -------------------------------- ### Configure LadybugDB Backend Source: https://codegraphcontext.github.io/concepts/backends Set LadybugDB as the default database backend for CodeGraphContext. This backend is thread-safe and uses relational SQL drivers. ```bash cgc config db ladybugdb ``` -------------------------------- ### Portable Bundles Source: https://codegraphcontext.github.io/reference/cli Commands for exporting, importing, and loading portable bundles. ```APIDOC ## `bundle` ### Description Manage portable bundles for CodeGraphContext. ### Usage ``` cgc bundle export [--repo PATH] [--no-stats] [--context NAME] cgc bundle import [--clear] [--yes|-y] [--context NAME] cgc bundle load [--clear] [--yes|-y] # Shortcuts cgc export my-project.cgc --repo /path/to/project cgc load numpy ``` *Use `--yes` / `-y` with `--clear` to skip the destructive-import confirmation (required in CI/non-interactive shells).* ## `registry` ### Description Browse and download pre-indexed bundles from the registry. ### Usage ``` cgc registry list [--verbose] [--unique] cgc registry search cgc registry download [--output DIR] [--load] cgc registry request ``` ``` -------------------------------- ### Exporting Indexed Repositories to Bundles Source: https://codegraphcontext.github.io/guides/bundles Export your current indexed repository or all indexed repositories into a .cgc bundle file. You can also exclude statistics for a faster export. ```bash cgc bundle export my-project.cgc --repo /path/to/project ``` ```bash cgc bundle export all-repos.cgc ``` ```bash cgc bundle export quick.cgc --repo /path/to/project --no-stats ``` ```bash cgc export my-project.cgc --repo /path/to/project ``` -------------------------------- ### Workspace Directory Structure Source: https://codegraphcontext.github.io/guides/contexts Illustrates the standard directory structure for global and local scopes within CodeGraphContext, including configuration files, ignore patterns, and database storage locations for different database types. ```text ~/.codegraphcontext/ <-- Global configuration directory config.yaml <-- Active context mode and registry .env <-- Database credentials and tuning configurations global/ .cgcignore <-- Global ignore patterns db/ falkordb/ <-- Global-mode FalkorDB Lite storage (default on Unix) kuzudb/ <-- Global-mode KuzuDB storage directory contexts/ ProjectA/ db/ kuzudb/ <-- Named-context KuzuDB storage directory .cgcignore <-- Context-specific ignore patterns ``` -------------------------------- ### Create a Named Context Source: https://codegraphcontext.github.io/guides/contexts Creates a new named context. You can optionally specify the database driver and storage path. Shorthand aliases are available for database options. ```bash cgc context create mobile-app --database kuzudb # Or use shorthand aliases: --db, -db, -d cgc context create mobile-app --db-path /mnt/fast/cgc ``` -------------------------------- ### Ingest Cassandra Schemas via CLI Source: https://codegraphcontext.github.io/guides/datasource-indexing Connect to a Cassandra cluster to extract keyspace schemas. This populates the context with keyspace tables and columns. ```bash cgc datasource cassandra --host 127.0.0.1 --port 9042 --keyspace production_keyspace ``` -------------------------------- ### Index a Test Codebase Source: https://codegraphcontext.github.io/contributing_languages Use this command to index a sample TypeScript project for verification. The --force flag overwrites existing indexes. ```bash cgc index ./tests/fixtures/sample_ts_project/ --force ``` -------------------------------- ### Configure FalkorDB Connection Source: https://codegraphcontext.github.io/concepts/backends Configure CodeGraphContext to use FalkorDB as the default database and set the connection parameters for a remote FalkorDB instance. ```bash # Switch default database cgc config db falkordb # For Remote: configure connections cgc config set FALKORDB_HOST 127.0.0.1 cgc config set FALKORDB_PORT 6379 ``` -------------------------------- ### Configure Claude Desktop MCP Server Source: https://codegraphcontext.github.io/getting-started/mcp-setup Add this configuration to `claude_desktop_config.json` to enable CodeGraphContext as a local MCP server for Claude Desktop. Ensure the command and arguments are correct for your environment. ```json { "mcpServers": { "codegraphcontext": { "command": "cgc", "args": ["mcp", "start"] } } } ``` -------------------------------- ### Ingest MySQL Schemas via CLI Source: https://codegraphcontext.github.io/guides/datasource-indexing Connect to a MySQL database to extract table metadata and column datatypes. This populates the active context with `DbTable` and `DbColumn` nodes. ```bash cgc datasource mysql --host 127.0.0.1 --port 3306 --user app_user --password secure_pass --database main_db ``` -------------------------------- ### Format Code Source: https://codegraphcontext.github.io/contributing Format the codebase according to project standards using ruff format. ```bash ruff format . ``` -------------------------------- ### Export and Import Portable Bundles Source: https://codegraphcontext.github.io/reference/cli Export project data to a .cgc bundle or import a bundle. Use --clear to remove existing data before import. Shortcuts are available for export and load. ```bash cgc bundle export [--repo PATH] [--no-stats] [--context NAME] cgc bundle import [--clear] [--yes|-y] [--context NAME] cgc bundle load [--clear] [--yes|-y] # Shortcuts cgc export my-project.cgc --repo /path/to/project cgc load numpy ``` -------------------------------- ### Code Analysis Pipeline: Analyze Code Source: https://codegraphcontext.github.io/guides/bundles Index your local code and then analyze it against the loaded dependencies. ```bash # Analyze your code against them cgc index ./my-api cgc analyze deps my_api ``` -------------------------------- ### Request On-Demand Bundle Generation Source: https://codegraphcontext.github.io/guides/bundles Submit a request to generate a bundle from a public GitHub repository URL if a specific library is missing from the registry. The `--wait` flag ensures the command waits for generation to complete. ```bash cgc registry request https://github.com/pallets/click --wait ``` -------------------------------- ### Clone CodeGraphContext Repository Source: https://codegraphcontext.github.io/contributing Clone the CodeGraphContext repository and navigate into the project directory. ```bash git clone https://github.com/CodeGraphContext/CodeGraphContext.git cd CodeGraphContext ``` -------------------------------- ### Configure VS Code (Continue extension) MCP Server Source: https://codegraphcontext.github.io/getting-started/mcp-setup Add this configuration to your `~/.continue/config.json` file to integrate CodeGraphContext as an MCP server within the Continue.dev extension for VS Code. ```json { "mcp": { "codegraphcontext": { "command": "cgc", "args": ["mcp", "start"] } } } ``` -------------------------------- ### Verify Bundle Metadata Source: https://codegraphcontext.github.io/guides/bundles Extract and inspect the metadata.json file from a bundle to check its contents before loading. Ensure the commit hash matches the official repository for added security. ```bash # Check metadata unzip -p bundle.cgc metadata.json ``` -------------------------------- ### Configure External Datasources Source: https://codegraphcontext.github.io/reference/cli Register external datasources for CodeGraph to use. Supported types include MySQL, Cassandra, and Redis. ```bash cgc datasource mysql ``` ```bash cgc datasource cassandra ``` ```bash cgc datasource redis ``` -------------------------------- ### Configure KuzuDB as Default Backend Source: https://codegraphcontext.github.io/concepts/backends Set KuzuDB as the default database backend for CodeGraphContext using the CLI command. This command configures the system to use KuzuDB for graph operations. ```bash cgc config db kuzudb ``` -------------------------------- ### Search Public Registry Source: https://codegraphcontext.github.io/guides/bundles Search for public graph packages in the registry using a keyword. ```bash cgc registry search flask ```