Skip to content

Commit 7b705cf

Browse files
docs: update README with installation, commands, and architecture
Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
1 parent b4ba1cc commit 7b705cf

1 file changed

Lines changed: 114 additions & 14 deletions

File tree

README.md

Lines changed: 114 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,137 @@
11
# repofetch
22

3-
repofetch is a CLI tool that bridges GitHub source code with AI context. It enables AI assistants to better understand and work with repository code by providing structured, context-aware access to GitHub repositories.
3+
**CLI tool that bridges GitHub source code with AI context.**
4+
5+
A TypeScript monorepo providing a SDK and CLI for AI agents to analyze GitHub repositories without cloning them locally.
6+
7+
## Packages
8+
9+
| Package | Version | Description |
10+
|---------|---------|-------------|
11+
| `@nesalia/repofetch-sdk` | `0.1.0` | TypeScript SDK for GitHub API |
12+
| `@nesalia/repofetch` | `0.1.4` | CLI tool |
413

514
## Installation
615

716
```bash
8-
npm install -g repofetch
17+
npm install -g @nesalia/repofetch
918
```
1019

1120
## Quick Start
1221

13-
### Authentication
22+
```bash
23+
# Authenticate with GitHub
24+
repofetch auth set YOUR_GITHUB_TOKEN
25+
26+
# List repository contents
27+
repofetch ls owner/repo
28+
29+
# Read files
30+
repofetch read owner/repo path/to/file.ts
1431

15-
Before using repofetch, authenticate with your GitHub account:
32+
# Search code
33+
repofetch search "function name" -r owner/repo
1634

17-
```bash
18-
repofetch auth login
35+
# View tree structure
36+
repofetch tree owner/repo --depth 3
37+
38+
# Create aliases for quick access
39+
repofetch alias set myrepo owner/repo
40+
repofetch tree myrepo --depth 2
1941
```
2042

21-
### Browse Repositories
43+
## CLI Commands
2244

23-
List and explore repositories:
45+
### `repofetch ls <repo> [path]`
46+
List directory contents.
2447

25-
```bash
26-
repofetch ls owner/repo
48+
### `repofetch read <repo> <path1> [path2] ...`
49+
Read file contents (supports multiple files).
50+
51+
### `repofetch search "<query>" -r <owner/repo> [options]`
52+
Search code in repository.
53+
- `-e, --ext <ext>` - Filter by file extension
54+
- `--limit <n>` - Limit results (default: 30)
55+
56+
### `repofetch tree <repo> [options]`
57+
Show repository tree structure.
58+
- `--depth <n>` - Maximum depth (default: 3)
59+
- `--branch <name>` - Target branch (default: main)
60+
61+
### `repofetch alias <command>`
62+
Manage repository aliases.
63+
- `alias set <name> <repo>` - Create alias
64+
- `alias rm <name>` - Remove alias
65+
- `alias list` - List all aliases
66+
67+
### `repofetch auth <command>`
68+
Manage authentication.
69+
- `auth status` - Check authentication status
70+
- `auth set <token>` - Store token securely (OS keychain)
71+
- `auth logout` - Remove stored token
72+
73+
## SDK Usage
74+
75+
```typescript
76+
import { createClient } from '@nesalia/repofetch-sdk';
77+
78+
const client = await createClient({ token: process.env.GITHUB_TOKEN });
79+
80+
// List repository
81+
const result = await client.repos.ls('owner/repo', 'src');
82+
if (result.ok) {
83+
console.log(result.value.items);
84+
}
85+
86+
// Search code
87+
const search = await client.search.search('function', { repo: 'owner/repo' });
88+
89+
// Get tree structure
90+
const tree = await client.tree.getTree('owner/repo', { depth: 3 });
2791
```
2892

29-
Replace `owner/repo` with the GitHub repository path (e.g., `facebook/react`).
93+
## Development
94+
95+
```bash
96+
# Install dependencies
97+
pnpm install
3098

31-
## Documentation
99+
# Build all packages
100+
pnpm build
32101

33-
For full documentation, including advanced usage, configuration options, and API reference, see [docs/PROJECT.md](./docs/PROJECT.md).
102+
# Run tests (41 tests, 82%+ coverage)
103+
pnpm test
104+
105+
# Lint
106+
pnpm lint
107+
108+
# Type check
109+
pnpm typecheck
110+
```
111+
112+
## Architecture
113+
114+
```
115+
packages/
116+
├── sdk/ # @nesalia/repofetch-sdk
117+
│ ├── src/
118+
│ │ ├── context.ts # SDK configuration
119+
│ │ ├── errors.ts # Result type & error classes
120+
│ │ ├── modules/
121+
│ │ │ ├── repos.ts # ls, read, getMetadata
122+
│ │ │ ├── search.ts # search
123+
│ │ │ ├── tree.ts # getTree
124+
│ │ │ └── auth.ts # getStatus
125+
│ │ └── internal/
126+
│ │ ├── fetch-transport.ts # HTTP layer
127+
│ │ ├── keychain.ts # OS keychain integration
128+
│ │ └── response-mapper.ts # API response mapping
129+
│ └── tests/ # 41 tests
130+
└── repofetch/ # @nesalia/repofetch (CLI)
131+
└── src/
132+
└── cli.ts # CLI commands
133+
```
34134

35135
## License
36136

37-
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
137+
MIT

0 commit comments

Comments
 (0)