
gograph
by ozgurcd·★ 118·综合分 47
一个本地AST/类型感知的Go代码库上下文索引器,为AI编码代理创建优化的图谱。
概述
gograph是一个快速的、仅限本地的CLI工具,专门用于生成Go代码库的仓库结构并提高IDE上下文感知能力。它构建了一个包含包、符号、调用、路由、配置读取、测试和代码质量信号的紧凑图谱,使AI代理能够通过更少的原始文件读取来导航Go代码库。与为人类IDE优化的语言服务器(如gopls)不同,gograph专门为基于终端的LLM设计,通过以原生Markdown格式提取精确的结构切片来节省上下文标记。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
当处理需要为 AI 编码助手提供高效的 AST 分析和上下文生成的 Go 代码库时,选择 gograph。
什么时候不要选它
如果你不使用 Go 代码库,或者你特别需要一个 MCP 服务器实现,不要选择 gograph。
此 server 暴露的工具
从 README 抽取出 12 个工具boundariesVerify package architecture constraints using boundaries.json
callersSee what functions call a specific symbol
calleesSee what a specific function calls
complexityCalculate cyclomatic complexity for functions
focusGenerate highly targeted context for a specific package
hotspotRank functions by incoming call count
impactView the full blast radius of a symbol
interfacesSee which interfaces a struct satisfies
pathFind the shortest call chain between two symbols
contextGet node, source, callers, callees, and tests in one response
traceTrace an error string backwards to entry points
depsShow direct or transitive import dependencies for a package
可对比工具
安装
# MacOS / Linux (通过Homebrew)
brew install ozgurcd/tap/gograph
# 或使用Go安装:
go install github.com/ozgurcd/gograph/cmd/gograph@latest要作为MCP服务器使用,您需要将其与MCP客户端配置集成。该工具支持JSON输出,便于机器解析,非常适合MCP集成。
FAQ
- gograph与gopls等语言服务器有何不同?
- 虽然gopls拥有类似的AST和类型数据,但将AI代理连接到它很困难且效率低下。gograph提取原生Markdown格式的精确结构切片,而不是简单的文件坐标,从而节省标记并为AI代理提供更好的上下文。
- gograph是否支持Go以外的语言?
- 目前gograph仅解析和映射Go代码库。但是其架构可扩展,欢迎为其他语言贡献代码。
gograph 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。