Here is the complete list of all CLI commands available in CodeGraphContext, categorized by workflow scenario.
Use these commands to manage the repositories in your code graph.
| Command | Arguments | Description |
|---|---|---|
cgc index |
[path] --force |
Adds a repository to the graph. Default path is current directory. Use --force to re-index from scratch. (Alias: cgc i) |
cgc list |
None | Lists all repositories currently indexed in the database. (Alias: cgc ls) |
cgc delete |
[path] --all |
Removes a repository from the graph. Use --all to wipe everything. (Alias: cgc rm) |
cgc stats |
[path] |
Shows indexing statistics (node counts) for the DB or a specific repo. |
cgc clean |
None | Removes orphaned nodes and cleans up the database. |
cgc add-package |
<name> <lang> |
Manually adds an external package node (e.g., cgc add-package requests python). |
Automatically track changes and keep your code graph up-to-date when you code.
| Command | Arguments | Description |
|---|---|---|
cgc watch |
[path] |
Watches a directory for file changes and automatically re-indexes. Runs in foreground. Default path is current directory. (Alias: cgc w) |
cgc unwatch |
<path> |
Stops watching a previously watched directory. (Primarily for MCP mode) |
cgc watching |
None | Lists all directories currently being watched for changes. (Primarily for MCP mode) |
Understand the structure, quality, and relationships of your code.
| Command | Arguments | Description |
|---|---|---|
cgc analyze calls |
<func_name> --file |
Shows outgoing calls: what functions does this function call? |
cgc analyze callers |
<func_name> --file |
Shows incoming calls: who calls this function? |
cgc analyze chain |
<start> <end> --depth |
Finds the call path between two functions. Default depth is 5. |
cgc analyze deps |
<module> --no-external |
Inspects dependencies (imports and importers) for a module. |
cgc analyze tree |
<class_name> --file |
Visualizes the Class Inheritance hierarchy for a given class. |
cgc analyze complexity |
[path] --threshold --limit |
Lists functions with high Cyclomatic Complexity. Default threshold: 10. |
cgc analyze dead-code |
--exclude |
Finds potentially unused functions (0 callers). Use --exclude for decorators. |
Find code elements when you don't know the exact structure.
| Command | Arguments | Description |
|---|---|---|
cgc find name |
<name> --type |
Finds code elements (Class, Function) by their exact name. |
cgc find pattern |
<pattern> --case-sensitive |
Finds elements using fuzzy substring matching (e.g. "User" finds "UserHelper"). |
cgc find type |
<type> --limit |
Lists all nodes of a specific type (e.g. function, class, module). |
Manage your environment and database connections.
| Command | Arguments | Description |
|---|---|---|
cgc mcp setup |
None | Configures your IDE/MCP Client. Creates mcp.json. (Alias: cgc m) |
cgc neo4j setup |
None | Wizard to configure a Neo4j connection. (Alias: cgc n) |
cgc config show |
None | Displays current configuration values. |
cgc config set |
<key> <value> |
Sets a config value (e.g. DEFAULT_DATABASE). |
cgc config reset |
None | Resets configuration to defaults. |
cgc config db |
<backend> |
Quick switch between neo4j and falkordb. |
Helper commands for developers and the MCP server.
| Command | Arguments | Description |
|---|---|---|
cgc doctor |
None | Runs system diagnostics (DB connection, dependencies, permissions). |
cgc visualize |
[query] |
Generates a link to open the Neo4j Browser. (Alias: cgc v) |
cgc query |
<query> |
Executes a raw Cypher query directly against the DB. |
cgc mcp start |
None | Starts the MCP Server (used by IDEs). |
cgc mcp tools |
None | Lists all available MCP tools supported by the server. |
cgc start |
None | Deprecated. Use cgc mcp start instead. |
- Index the code:
cgc index . - Verify status:
cgc doctor
- Check stats:
cgc stats
- Find complex functions:
cgc analyze complexity --threshold 15
- Find unused code:
cgc analyze dead-code --exclude "route,task" - Check dependencies:
cgc analyze deps target_module --no-external
- Search for relevant code:
cgc find pattern "AuthValidator" - Trace execution:
cgc analyze callers validate_auth
- Find full path:
cgc analyze chain "main" "validate_auth" --depth 10
- Switch to Neo4j:
cgc config db neo4j
- Configure credentials:
cgc neo4j setup
- Verify connection:
cgc doctor
Unix/Linux/macOS (Python 3.12+):
# FalkorDB Lite is already configured as default
pip install codegraphcontext
cgc mcp setup # Configure your IDE
cgc index . # Start indexingWindows:
# Option 1: Use WSL (Recommended)
wsl --install
# Then follow Unix instructions above
# Option 2: Use Neo4j with Docker
pip install codegraphcontext
cgc neo4j setup # Choose Docker option
cgc mcp setup # Configure your IDE
cgc index . # Start indexing
# Option 3: Use Neo4j native installation
pip install codegraphcontext
cgc neo4j setup # Choose native installation
cgc mcp setup # Configure your IDE
cgc index . # Start indexing- Start watching your project:
cgc watch . - Open a new terminal and continue coding
- The watcher runs in the foreground
- Changes are automatically indexed as you save files
- Stop watching when done:
- Press
Ctrl+Cin the watch terminal
- Press
💡 Tip: This is perfect for active development sessions where you want your AI assistant to always have the latest code context!