pi-gograph

Gograph integration for pi — AST-aware Go code navigation

Packages

Package details

extension

Install pi-gograph from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-gograph
Package
pi-gograph
Version
0.1.7
Published
May 18, 2026
Downloads
not available
Author
tianhai
License
MIT
Types
extension
Size
86.8 KB
Dependencies
0 dependencies · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ],
  "image": "https://raw.githubusercontent.com/yinloo-ola/pi-gograph/main/image.jpg"
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-gograph

npm version License: MIT

pi-gograph preview

Gograph integration for pi — AST-aware Go code navigation as native LLM tools.

What it does

Gograph builds a compact graph of your Go project's packages, symbols, calls, routes, and tests. This extension exposes gograph's capabilities as native pi tools, so the LLM can navigate your Go codebase with fewer raw file reads and better accuracy.

Key benefits:

  • gograph_context replaces 4-5 grep/cat calls in one shot
  • gograph_implementers reliably finds interface implementations
  • gograph_impact shows blast radius before you change a function
  • gograph_endpoint traces HTTP handlers from route to SQL

Prerequisites

  • pi installed
  • gograph installed (the extension can auto-install it via /gograph-setup)

Installation

pi install npm:pi-gograph

Note: Use pi install, not npm install. The pi install command registers the extension in pi's settings so it auto-activates in Go projects.

Or install manually by copying to your extensions directory:

git clone https://github.com/yinloo-ola/pi-gograph.git
cp -r pi-gograph ~/.pi/agent/extensions/

Usage

The extension activates automatically in Go projects (detected by go.mod or *.go files). You'll see a status indicator in pi's footer:

  • 📦 gograph: run /gograph-setup — gograph not installed
  • gograph: run /gograph-build — installed but no index
  • gograph ✓ — ready
  • gograph: rebuilding index in background... — a branch/HEAD change was detected and a refresh is running without blocking other work

First time setup

If gograph is not installed:

/gograph-setup

This will:

  1. Try to install gograph via Homebrew, falling back to go install if brew fails
  2. Build the initial index

Rebuild index

After significant code changes:

/gograph-build

Or with precise mode (type-checked, slower):

/gograph-build --precise

Check status

/gograph-status

Automatic background refresh

When you switch git branches or otherwise change the tracked HEAD, pi-gograph will refresh the index in the background the next time you use a gograph tool or /gograph-status. Existing operations keep using the last built index until the refresh finishes.

Tools

Tool Purpose
gograph_build Build/rebuild the AST index
gograph_query Search for symbols by name
gograph_context Full context bundle (source + callers + callees + tests)
gograph_implementers Find structs implementing an interface
gograph_impact Blast radius analysis
gograph_source Extract source of one symbol
gograph_callers Find callers of a function
gograph_callees Find callees of a function
gograph_endpoint HTTP handler → SQL vertical slice
gograph_check Verify uncommitted changes
gograph_focus Targeted context for a package
gograph_fields All fields of a struct
gograph_path Shortest call chain between two symbols

Development

git clone https://github.com/yinloo-ola/pi-gograph.git
cd pi-gograph
npm install
npm test

License

MIT