CLI tool that bridges GitHub source code with AI context.
A TypeScript monorepo providing a SDK and CLI for AI agents to analyze GitHub repositories without cloning them locally.
| Package | Version | Description |
|---|---|---|
@nesalia/repofetch-sdk |
0.1.0 |
TypeScript SDK for GitHub API |
@nesalia/repofetch |
0.1.4 |
CLI tool |
npm install -g @nesalia/repofetch# Authenticate with GitHub
repofetch auth set YOUR_GITHUB_TOKEN
# List repository contents
repofetch ls owner/repo
# Read files
repofetch read owner/repo path/to/file.ts
# Search code
repofetch search "function name" -r owner/repo
# View tree structure
repofetch tree owner/repo --depth 3
# Create aliases for quick access
repofetch alias set myrepo owner/repo
repofetch tree myrepo --depth 2List directory contents.
Read file contents (supports multiple files).
Search code in repository.
-e, --ext <ext>- Filter by file extension--limit <n>- Limit results (default: 30)
Show repository tree structure.
--depth <n>- Maximum depth (default: 3)--branch <name>- Target branch (default: main)
Manage repository aliases.
alias set <name> <repo>- Create aliasalias rm <name>- Remove aliasalias list- List all aliases
Manage authentication.
auth status- Check authentication statusauth set <token>- Store token securely (OS keychain)auth logout- Remove stored token
import { createClient } from '@nesalia/repofetch-sdk';
const client = await createClient({ token: process.env.GITHUB_TOKEN });
// List repository
const result = await client.repos.ls('owner/repo', 'src');
if (result.ok) {
console.log(result.value.items);
}
// Search code
const search = await client.search.search('function', { repo: 'owner/repo' });
// Get tree structure
const tree = await client.tree.getTree('owner/repo', { depth: 3 });# Install dependencies
pnpm install
# Build all packages
pnpm build
# Run tests (41 tests, 82%+ coverage)
pnpm test
# Lint
pnpm lint
# Type check
pnpm typecheckpackages/
├── sdk/ # @nesalia/repofetch-sdk
│ ├── src/
│ │ ├── context.ts # SDK configuration
│ │ ├── errors.ts # Result type & error classes
│ │ ├── modules/
│ │ │ ├── repos.ts # ls, read, getMetadata
│ │ │ ├── search.ts # search
│ │ │ ├── tree.ts # getTree
│ │ │ └── auth.ts # getStatus
│ │ └── internal/
│ │ ├── fetch-transport.ts # HTTP layer
│ │ ├── keychain.ts # OS keychain integration
│ │ └── response-mapper.ts # API response mapping
│ └── tests/ # 41 tests
└── repofetch/ # @nesalia/repofetch (CLI)
└── src/
└── cli.ts # CLI commands
MIT