Skip to content
Foundry
Esc
↑↓navigate↵open⌘Jpreview

Spyglass

A map of a codebase, generated from the code and served locally.

Spyglass draws a workspace as a map you can explore in the browser.

Point it at a directory of TypeScript packages. Spyglass reads the packages, their files, and the imports between them, saves what it found outside the workspace, and serves a local viewer. Packages are islands and files are the marks on them. Dependency decides an island’s row: the foundation to the south, the packages built on it further north; along a row, islands keep their folders’ order. Zoom in and an island resolves into districts, then into files. Select a place and Spyglass shows what it imports, what depends on it, and the evidence behind where it was drawn; switch on the sea routes to see the trade between islands.

spyglass scan ./my-workspace
spyglass serve ./my-workspace
spyglass ./my-workspace

scan analyzes and saves. serve shows the last saved result. With no subcommand, Spyglass does both and opens the browser. The workspace itself is never modified, except where you point spyglass export, and nothing leaves your machine.

Spyglass is a package, @foundry.sh/spyglass, with one binary and a library. It runs on Bun and needs Git only when you ask for history.

Was this page helpful?