AI Skill Hub 推荐使用:代码图谱 是一款优质的AI工具。AI 综合评分 7.5 分,在同类工具中表现稳健。如果你正在寻找可靠的AI工具解决方案,这是一个值得深入了解的选择。
代码图谱 是一款基于 Python 开发的开源工具,专注于 code-graph、genai、graph 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
代码图谱 是一款基于 Python 开发的开源工具,专注于 code-graph、genai、graph 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:pip 安装(推荐)
pip install code-graph
# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install code-graph
# 方式三:从源码安装(获取最新功能)
git clone https://github.com/FalkorDB/code-graph
cd code-graph
pip install -e .
# 验证安装
python -c "import code_graph; print('安装成功')"
# 命令行使用
code-graph --help
# 基本用法
code-graph input_file -o output_file
# Python 代码中调用
import code_graph
# 示例
result = code_graph.process("input")
print(result)
# code-graph 配置文件示例(config.yml) app: name: "code-graph" debug: false log_level: "INFO" # 运行时指定配置文件 code-graph --config config.yml # 或通过环境变量配置 export CODE_GRAPH_API_KEY="your-key" export CODE_GRAPH_OUTPUT_DIR="./output"
>=3.12,<3.14uv```bash
uv sync --all-extras
npm install --prefix ./app
npm install ```
If you do not use uv, pip install -e ".[test]" also installs the backend package and test dependencies.
```bash
pipx install falkordb-code-graph
cgraph ensure-db
pip install falkordb-code-graph # or: uv pip install falkordb-code-graph
docker compose up --build
This starts FalkorDB and the CodeGraph app together. The checked-in compose file sets CODE_GRAPH_PUBLIC=1 for the app service.
To run the MCP stdio server instead of the web app from the same image, set CGRAPH_MODE=mcp and use the mcp profile:
docker compose --profile mcp run --rm -i code-graph-mcp
```bash docker build -t code-graph .
```bash
Copy the template and adjust it for your setup:
cp .env.template .env
| Variable | Description | Required | Default |
|---|---|---|---|
CODE_GRAPH_DB_BACKEND | Database backend: falkordb or lite | No | falkordb |
FALKORDB_HOST | FalkorDB hostname | No | localhost |
FALKORDB_PORT | FalkorDB port | No | 6379 |
FALKORDB_USERNAME | Optional FalkorDB username | No | empty |
FALKORDB_PASSWORD | Optional FalkorDB password | No | empty |
FALKORDB_LITE_PATH | FalkorDBLite database file path | No | ~/.cache/code-graph/falkordblite.rdb |
FALKORDB_LITE_HOST | Host used when exposing FalkorDBLite over TCP | No | 127.0.0.1 |
FALKORDB_LITE_PORT | Optional TCP port for FalkorDBLite host/port clients | No | empty |
SECRET_TOKEN | Token checked by protected endpoints | No | empty |
CODE_GRAPH_PUBLIC | Set 1 to skip auth on read-only endpoints | No | 0 |
ALLOWED_ANALYSIS_DIR | Root path allowed for /api/analyze_folder | No | repository root |
MODEL_NAME | LiteLLM model used by /api/chat | No | gemini/gemini-flash-lite-latest |
HOST | Optional Uvicorn bind host for start.sh/make run-* | No | 0.0.0.0 or 127.0.0.1 depending on command |
PORT | Optional Uvicorn bind port for start.sh/make run-* | No | 5000 |
The chat endpoint also needs the provider credential expected by your chosen MODEL_NAME. The default model is Gemini, so set GEMINI_API_KEY unless you switch to a different LiteLLM provider/model.
uv run uvicorn api.index:app --host 127.0.0.1 --port 5000 --reload
CodeGraph includes a CLI tool for indexing codebases and querying the knowledge graph directly from the terminal. All output is JSON (to stdout), with status messages on stderr.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/list_repos | List all indexed repositories |
| GET | /api/graph_entities?repo=<name> | Fetch a subgraph for a repository |
| POST | /api/get_neighbors | Return neighboring nodes for the provided IDs |
| POST | /api/auto_complete | Prefix-search indexed entities |
| POST | /api/repo_info | Return repository stats and saved metadata |
| POST | /api/find_paths | Find paths between two graph nodes |
| POST | /api/chat | Ask questions over the code graph via GraphRAG |
| POST | /api/list_commits | List commits from the repository's git graph |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/analyze_folder | Analyze a local source folder |
| POST | /api/analyze_repo | Clone and analyze a git repository |
| POST | /api/switch_commit | Switch the indexed repository to a specific commit |
高质量的代码图谱生成工具
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
总体来看,代码图谱 是一款质量良好的AI工具,在同类工具中具备一定竞争力。AI Skill Hub 将持续追踪其更新动态,建议收藏备用,结合自身场景选择合适时机引入使用。
| 原始名称 | code-graph |
| 原始描述 | 开源AI工具:A code-graph demo using GraphRAG-SDK and FalkorDB。⭐313 · Python |
| Topics | code-graphgenaigraphllmpython |
| GitHub | https://github.com/FalkorDB/code-graph |
| License | MIT |
| 语言 | Python |
收录时间:2026-06-09 · 更新时间:2026-06-09 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。