| description | Complete CLI reference for Code-Graph-RAG commands and Makefile targets. |
|---|
The cgr command is the main entry point for Code-Graph-RAG.
List commands by workflow or show the detailed page for a command:
cgr help
cgr help start
cgr help daemon logscgr COMMAND --help displays the same command-specific information.
Parse a repository and/or start the interactive query CLI.
cgr start --repo-path /path/to/repo [OPTIONS]| Option | Description |
|---|---|
--repo-path |
Path to repository (defaults to current directory) |
--update-graph |
Parse and ingest the repository into the knowledge graph |
--clean |
Destructive. Delete every project from the shared graph and clear the selected repository's sync cache. With --update-graph, rebuild after deletion. Asks for confirmation when other projects would be destroyed. |
-y, --yes |
Answer yes to destructive confirmations, such as the one --clean asks. Required when --clean runs non-interactively and other projects would be destroyed, or when the existing projects cannot be listed. |
--batch-size |
Override Memgraph flush batch size |
--orchestrator |
Specify provider:model for main operations (e.g., anthropic:claude-sonnet-5, google:gemini-3.6-flash, ollama:qwen2.5-coder) |
--cypher |
Specify provider:model for graph queries (e.g., anthropic:claude-sonnet-5, google:gemini-3.5-flash-lite, ollama:qwen2.5-coder) |
-o, --output |
Write the updated graph to a JSON path. Requires --update-graph. |
Export the knowledge graph to JSON.
cgr export -o my_graph.jsonAI-powered codebase optimisation.
cgr optimize <language> --repo-path /path/to/repo [OPTIONS]| Option | Description |
|---|---|
--repo-path |
Path to repository |
--orchestrator |
Specify provider:model for operations |
--batch-size |
Override Memgraph flush batch size |
--reference-document |
Path to reference documentation for guided optimisation |
Supported languages: python, javascript, typescript, rust, go, java, scala, c, cpp
Report functions and methods unreachable from any entry point (candidates for review, not a guaranteed delete list). See Dead Code Detection.
cgr dead-code [OPTIONS]| Option | Description |
|---|---|
--project-name, -n |
Project to scan. Defaults to the sole indexed project. |
--entry-point, -e |
Treat symbols whose qualified name ends with this value as reachable roots. Repeatable. |
--decorator-root |
Treat symbols carrying this decorator as roots. Repeatable. |
--exclude |
Glob matched against a symbol's file path to exclude. Repeatable. |
--include-tests / --no-include-tests |
Treat test code as reachable roots. On by default. |
--classes / --no-classes |
Also report unreachable classes. Off by default. |
--format |
Output format: table (default) or json. |
--output, -o |
Write the report to a file instead of stdout. |
--fail-on-found |
Exit with code 1 when any candidate is found (useful in CI). |
Report groups of structurally duplicated functions and methods (copy-pastes, including renamed and lightly edited copies). See Duplicate Code Detection.
cgr duplicates [OPTIONS]| Option | Description |
|---|---|
--project-name, -n |
Project to scan. Defaults to the sole indexed project. |
--threshold |
Minimum similarity for a near-duplicate pair, 0-1. Default 0.8. |
--min-size |
Minimum skeleton size (tree nodes) for a function to be considered. Default 15. |
--exact-only |
Report only identical-fingerprint clone groups; skip similarity scoring. |
--exclude |
Glob matched against a symbol's file path to exclude. Repeatable. |
--format |
Output format: table (default) or json. |
--output, -o |
Write the report to a file instead of stdout. |
--fail-on-found |
Exit with code 1 when any duplicate is found (useful in CI). |
Serve cgr tools to MCP clients over stdio or HTTP.
cgr mcp-serverIndex a repository to protobuf for offline use.
cgr index -o ./index-output --repo-path ./my-projectCheck that all required dependencies and services are available.
cgr doctorManage language support.
cgr language add-grammar <language-name>
cgr language add-grammar --grammar-url <url>
cgr language list-languages
cgr language remove-language <language-name>| Command | Description |
|---|---|
make help |
Show help message |
make all |
Install everything for full development environment |
make install |
Install project dependencies with full language support |
make python |
Install project dependencies for Python only |
make dev |
Setup development environment (install deps + pre-commit hooks) |
make test |
Run unit tests only (fast, no Docker) |
make test-parallel |
Run unit tests in parallel (fast, no Docker) |
make test-integration |
Run integration tests (requires Docker) |
make test-all |
Run all tests including integration and e2e (requires Docker) |
make test-parallel-all |
Run all tests in parallel (requires Docker) |
make clean |
Clean up build artifacts and cache |
make build-grammars |
Build grammar submodules |
make watch |
Watch repository for changes and update graph in real-time |
make readme |
Regenerate README.md from codebase |
make lint |
Run ruff check |
make format |
Run ruff format |
make typecheck |
Run type checking with ty |
make check |
Run all checks: lint, typecheck, test |
make pre-commit |
Run all pre-commit checks locally |