GitHub repository tools extension for pi-coding-agent. Provides tools to read, search, and explore GitHub repositories directly from pi.
pi install npm:@prinova/pi-github-toolsOr install globally:
npm install -g @prinova/pi-github-toolsThis extension requires a GitHub Personal Access Token (PAT) to access the GitHub API. Set the GITHUB_PAT environment variable:
export GITHUB_PAT=ghp_your_token_hereTo create a token:
- Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
- Click "Generate new token (classic)"
- Select the
reposcope for full repository access, orpublic_repofor public repositories only - Generate and copy the token
This extension adds the following tools to pi:
Read the contents of a file from a GitHub repository.
Parameters:
path- The file path within the repository (e.g., "src/index.ts")repository- The repository URL (e.g., "https://github.com/owner/repo")startLine(optional) - Start line number to read from (1-indexed)endLine(optional) - End line number to read to (1-indexed)
Example:
{ "path": "README.md", "repository": "https://github.com/facebook/react" }List the contents of a directory in a GitHub repository.
Parameters:
path- Directory path (use "." for root)repository- Repository URL
Example:
{ "path": "src", "repository": "https://github.com/facebook/react" }Search for code patterns in a GitHub repository using GitHub's code search API.
Parameters:
pattern- Search query pattern (GitHub code search syntax)repository- Repository URL to search withinpath(optional) - Subdirectory path to limit search
Example:
{ "pattern": "function useState", "repository": "https://github.com/facebook/react" }Find files matching a glob pattern in a GitHub repository using the Git tree API.
Parameters:
filePattern- Glob pattern to match (e.g., "/*.md", "src//*.ts")repository- Repository URLlimit(optional) - Maximum results to returnoffset(optional) - Offset for pagination
Example:
{ "filePattern": "**/*.test.ts", "repository": "https://github.com/facebook/react" }Search and list public GitHub repositories.
Parameters:
pattern(optional) - Search term to match in repository namesorganization(optional) - Organization to search withinlanguage(optional) - Programming language filterlimit(optional) - Max results (default: 30)
Example:
{ "pattern": "react", "limit": 10 }Search commits in a GitHub repository.
Parameters:
repository- Repository URL (required)query(optional) - Search term in commit messagesauthor(optional) - GitHub username of commit authorsince(optional) - Start date (YYYY-MM-DD)until(optional) - End date (YYYY-MM-DD)
Example:
{ "repository": "https://github.com/facebook/react", "query": "fix hooks", "author": "danabramov" }Once installed, the tools are automatically available in pi. Just ask pi to use them:
Read the README from https://github.com/vercel/next.js
Find all TypeScript files in the React repository
Search for "useEffect" usage in the facebook/react repo
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run devMIT
Contributions are welcome! Please open an issue or submit a pull request on GitHub.