@mammothb/pi-ghsearch
A pi extension that adds a ghsearch tool for searching GitHub code
Package details
Install @mammothb/pi-ghsearch from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@mammothb/pi-ghsearch- Package
@mammothb/pi-ghsearch- Version
1.0.4- Published
- Jun 13, 2026
- Downloads
- 997/mo · 741/wk
- Author
- mammothb
- License
- MIT
- Types
- extension
- Size
- 38.3 KB
- Dependencies
- 1 dependency · 4 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-ghsearch
A pi extension that wraps the gh CLI with three tools for searching GitHub:
gh_search— Search repos, issues, PRs, code, and commits viagh searchwith typed parameters, JSON defaults, and automatic output truncation.gh_fetch— Fetch full content of a GitHub resource (file, issue, PR, discussion, etc.) viagh api. Converts web URLs to REST endpoints automatically.gh_auth_status— Check GitHub CLI authentication status. Use to diagnose failedgh_search/gh_fetchcalls.
The extension also checks auth status on session start and can optionally block raw gh search/gh api/gh auth bash commands to ensure the typed tools are used instead.
Configuration
Configuration is loaded from two JSON files (project overrides global, global overrides defaults):
| Location | Purpose |
|---|---|
~/.pi/agent/pi-ghsearch.json |
Global config (applies to all projects) |
<project>/.pi/pi-ghsearch.json |
Project-level config (overrides global) |
Options
{
// Restrict ALL searches to repos within a GitHub organization.
// gh_search automatically adds --owner <org> to every command.
// gh_fetch and gh_auth_status are NOT affected.
"organization": "my-org",
// Block model-initiated bash executions of `gh search`, `gh api`,
// and `gh auth`, redirecting to the typed tools instead.
// Other gh commands (gh repo clone, gh issue create, etc.) are unaffected.
"banBashGh": true,
// Default timeout for gh CLI commands in milliseconds (default: 30000).
"timeoutMs": 60000,
// Default values applied when the LLM doesn't supply them explicitly.
"defaults": {
"limit": 50 // max results per search (default: 30)
}
}
All keys are optional — missing keys fall back to built-in defaults.
Development
# Run unit tests from the workspace root (no network required)
cd ../.. && pnpm run test
# Run eval/smoke tests (requires gh CLI + network)
# These are excluded from the default test run because vitest.config.ts
# only includes `test/**/*.test.ts`. To run them, temporarily add
# `"evals/**/*.test.ts"` to the pi-ghsearch project's `include` in
# the root `vitest.config.ts`.
# Test locally with pi (from this package directory)
pi -e ./index.ts