MCPcopy Index your code
hub / github.com/adonovan/spaghetti

github.com/adonovan/spaghetti @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
29 symbols 49 edges 3 files 20 documented · 69%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Spaghetti: a dependency analysis tool for Go packages

Spaghetti is an interactive web-based tool to help you understand the dependencies of a Go program, and to explore and evaluate various possible efforts to eliminate dependencies.

It displays the complete dependencies of the initial packages, organized into a tree based on the directory structure of the package/module namespace.

Clicking on a package node displays information about it, including an arbitrary path to it from one of the initial packages. Each edge in the path may be "broken", causing it to be removed from the graph and the view recomputed. The broken edges are tabulated, and each can be restored if you change your mind or try another approach. In this manner, you can explore how your overall dependencies would change as you work to remove specific imports. Once you are happy with the overall dependencies, the set of broken edges becomes your task list for a clean-up project.

Run it like so:

$ go install github.com/adonovan/spaghetti@latest   # install in $HOME/go/bin
$ ~/go/bin/spaghetti [package] &                    # run the server
$ open http://localhost:8080                        # open in chrome, firefox, etc

where package is or more Go packages, or a pattern understood by go list. Then point your browser at the insecure single-user web server at localhost:18080.

This tool is a rewrite from scratch of a tool I wrote while at Google for exploring the dependency graphs used by the Blaze build system. The basic design could be easily be generalized to support any kind of dependency graph, independent of language or domain, or turned into a secure multi-user web service that operates on graph data uploaded from the client program that generates it.

You can probably tell that web UIs are not my expertise. PRs that provide cosmetic improvements are most welcome!

Screenshot

Core symbols most depended-on inside this repo

recompute
called by 3
spaghetti.go
sortNodes
called by 3
spaghetti.go
remove
called by 3
spaghetti.go
Idom
called by 2
dom.go
eval
called by 2
dom.go
link
called by 2
dom.go
addImports
called by 2
code.js
id
called by 2
spaghetti.go

Shape

Function 17
Method 7
Struct 5

Languages

Go76%
TypeScript24%

Modules by API surface

spaghetti.go12 symbols
dom.go10 symbols
code.js7 symbols

For agents

$ claude mcp add spaghetti \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact