gograph
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Symbol queries accept path/to/file.go:Name, including
path/to/file.go:Receiver.Method, or an import-qualified file path when a short
name is ambiguous. source prints exact selectors for ambiguous matches.
Supported declaration tools and named exceptions are listed in
the selector contract.
Queries include struct fields; query --no-tests excludes test-file rows.
Precise mutation queries recover the type of fields assigned on returned values.
Routes retain constant and unresolved path registrations; precise builds resolve
constants across packages, including net/http method patterns.
tests --transitive --files-only prints unique file paths, matching the files in
the MCP transitive report.
Graph-state output and capabilities expose freshness_context: CLI freshness
checks use the querying process's Go context, including GOFLAGS; MCP uses its
startup context and explicit tags. A context mismatch remains stale, even when
source bytes have not changed. No environment values are printed.
Precise indexes include package-level constant references in usages and query,
including comparisons, switch cases, composite values, and function arguments.
Typed enum-like constants retain their declaration identity; local shadows are excluded.
query labels these reference sites as usage rows. AST-only graphs do not
claim type-resolved constant usages.
review uses the same test attribution as context. Rebuild after upgrading.
review --uncommitted includes deleted declarations from changes --git HEAD
and explicitly leaves historical callers, tests and risk unevaluated. Other
current-graph traversal commands retain their deletion refusal. Builds explain
when an enclosing Git repository ignores the requested directory.
Uncommitted plan/review skip blank-identifier declarations such as
var _ I = (*T)(nil) during symbol traversal. Review keeps their declaration
evidence and names the limit; changes --git HEAD still lists them.
Session audits list invocation errors separately from operational failures and
exclude them from compliance scoring. Composability measures the mix of composed
and raw query commands; it does not measure answer correctness or token savings.
**Give Go coding agents a compiler-aware map for safer refactors.**
gograph builds a local structural graph of your Go repository, with optional
type-checked CHA/SSA enrichment. Its CLI and MCP workflows help coding agents
trace callers and interface implementations, plan change impact, and enforce
architecture without embeddings or a hosted code index.
**Explore the interactive no-install demo** ·
**Review the reproducible benchmark**
See CLI/MCP query contracts for bounded result pages,
snapshot-bound cursors, exact/possible impact, and change-evaluation status.
**Companion projects:** Scrinium
provides repository-owned, evidence-backed knowledge for coding agents, while
Rulefloor protects repository-local
invariants by binding them to concrete tests and detecting drift. They are
independent, optional tools: Scrinium can keep Gograph structural observations
and Rulefloor validation results as separate evidence without treating either
as proof of unrelated behavior or global project correctness.
> **Static analysis; no target-code execution.** Default indexing parses Go source locally and does not call application services. Linked directories and linked/special files for extensions recognized by go/build are excluded; unrelated regular-file or dangling links with non-Go extensions are not Go tool inputs and do not block precise analysis. Graph-directed source reads remain confined to regular files beneath the analyzed repository, and linked/non-regular Go tool metadata (go.mod, go.sum, go.work, go.work.sum, and vendor/modules.txt) is rejected before toolchain invocation; an explicitly symlinked repository root remains supported. Applicable go.work use members may be sibling modules beneath the nearest real Git checkout; without that boundary they remain confined beneath the workspace directory. Each member directory, go.mod, and optional go.sum is validated before cmd/go starts. Gograph also reads project metadata such as .gitignore, graph/config JSON, and Git state. Indexing asks the installed Go toolchain for the effective build/module context; precise mode additionally performs package type loading, and doc runs go doc. Those operations follow your configured module/cache/network policy. Before repository package loading or go doc, applicable local module/workspace source trees are preflighted for links that cmd/go may inspect; .git and .gograph subtrees are excluded. Session telemetry is local under .gograph/sessions/; nothing is sent to gograph services.