你的第一个图谱
装好 Springgraph 之后,构建并探索图谱只需要三条命令。
给项目建索引
Section titled “给项目建索引”cd your-projectspringgraph init -i # 一步完成初始化 + 建索引init 会创建 .springgraph/ 目录;-i(或 --index)立刻构建完整的索引。对于已有项目,你可以随时重新建索引:
springgraph index # 全量建索引springgraph sync # 增量更新变更的文件验证是否成功
Section titled “验证是否成功”springgraph status这一步会输出节点 / 边 / 文件数量、当前激活的 SQLite 后端以及 journal 模式,用来快速检查索引是否就绪。
运行一次查询
Section titled “运行一次查询”springgraph query UserService # 按名字查找符号springgraph callers handleRequest # 谁调用了这个函数springgraph callees handleRequest # 这个函数调用了谁springgraph impact AuthMiddleware # 改动会影响哪些地方springgraph context "fix the login flow" # 围绕任务构建上下文每个命令都支持 --json 来输出机器可读的结果。完整说明见 CLI 参考。
把它交给你的 agent
Section titled “把它交给你的 agent”只要 .springgraph/ 目录存在,并且 agent 已配置(见 安装),你的 agent 就会自动使用 MCP 工具,无需额外步骤。