pi-extensions GitHub

pi-code-search

Faster, more reliable code discovery for pi. Four always-on read-only tools that make finding code quicker (fewer round trips, cached inventory), easier (symbol-aware queries instead of regex guessing), and more reliable (gitignore-exact inventory, definition-first ranking, import/alias/re-export resolution).

Zero runtime dependencies: node built-ins + pi's typebox only.

Tools

Tool What it does
repo_map(depth?) Compact gitignore-aware map of the repo in one call: header (root, branch, file count, size, languages), collapsed tree, key files (README, manifests, CI, test files), package.json highlights (scripts, entry, deps), and the newest + largest files. Call first on unfamiliar repos.
code_search(query, path?, caseSensitive?, wholeWord?, regex?, maxResults?) Content search with definition-first ranking and enclosing-function/class framing. Plain substring by default; regex, wholeWord, caseSensitive, and path scoping options. Comment-only matches rank last; zero hits suggest near symbol names.
file_outline(path) Symbol outline of one file sorted by line: functions, classes, methods, fields, interfaces, types, imports. Call before committing to a full read.
find_definition(symbol, fromFile?, kind?) Locate the definition of a symbol. With fromFile, the symbol's import/require/reexport is resolved (relative specifiers with extension/index probing, tsconfig/jsconfig paths aliases, workspace package names, re-export chains up to depth 8 with cycle guard). Without it, all definition candidates across the repo are listed, exported first. External packages are reported as external: <pkg> — not indexed (node_modules is never scanned).

How it works

Plan mode

The four tools are annotated read-only and local, so plan mode keeps them without a name list. /plan gets the same discovery power (read-only tools, no bash changes).

Notes and non-goals