code graph浅尝
看到个项目,code graph,顾名思义应该是把项目代码给构建成图谱,拖延到今天来实测一下效果 仓库地址:GitHub - colbymchenry/codegraph: Pre-indexed code knowledge graph for Claude Code, Codex, Gemini, Cursor, OpenCode, AntiGravity, Kiro, and Hermes Agent — fewer tokens, fewer tool calls, 100% local · GitHub 安装 code graph mac 安装命令 1 curl -fsSL https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh | sh 安装 MCP 配置 初始化项目 进入一个最近在开发的目录,开始索引 1 2 cd your-project codegraph init -i 接下来他会扫描仓库的文件并且在本地新建数据库 大概流程是这样的: 显示已折叠代码(21 行) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 你的代码目录 │ ▼ Tree-sitter 解析源码 │ ▼ 抽取符号(Symbol) 函数、类、方法、变量、路由 │ ▼ 分析关系(Edge) 调用关系 继承关系 导入关系 引用关系 │ ▼ 写入 SQLite │ ▼ 生成 .codegraph/ 官方文档里提到,CodeGraph 会把符号、调用图、文件结构等信息存到 SQLite(FTS5)数据库中,并把项目数据放在 .codegraph/ 目录下。 ...