manx-cli 0.3.3

A blazing-fast CLI documentation finder powered by Context7 MCP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# 📚 Manx

> *A blazing-fast CLI documentation finder that brings Context7 MCP docs right to your terminal - no IDE required*

<div align="center">

![License](https://img.shields.io/badge/license-MIT-blue.svg)
![Language](https://img.shields.io/badge/language-Rust-orange.svg)
![Status](https://img.shields.io/badge/status-Production%20Ready-brightgreen.svg)
![Binary Size](https://img.shields.io/badge/binary-2.9MB-blue.svg)

</div>

## What is Manx?

Manx is a command-line interface documentation finder designed for developers who prefer working in the terminal. It uses **Context7 MCP** (Model Context Protocol) as its primary backend to provide **real-time, version-specific** documentation snippets without leaving your development environment.

### Why Manx?

- **< 1 second** search results
- 🎯 **Version-specific** docs (e.g., React 18 vs 17)
- 📦 **Single 2.9MB binary** - no dependencies  
- 🔌 **Context7 MCP integration** - always up-to-date
- 💾 **Smart caching** - works offline after first use
- 🌈 **Beautiful terminal output** with syntax highlighting
- 📊 **Smart result limiting** - shows 10 results by default, customizable
- 🚀 **Export to Markdown/JSON** for documentation

## Quick Install

```bash
# Linux/macOS - Install to /usr/local/bin
curl -fsSL https://raw.githubusercontent.com/neur0map/manx/main/install.sh | bash

# Or with wget
wget -qO- https://raw.githubusercontent.com/neur0map/manx/main/install.sh | bash
```

## Quick Start

```bash
# Search for any library
manx fastapi

# Search with a query
manx fastapi middleware

# Version-specific search  
manx react@18 hooks

# Get full documentation
manx doc fastapi authentication

# Limit results (default: 10, use 0 for unlimited)
manx fastapi --limit 5
manx react hooks --limit 0

# Save results to file
manx fastapi --save 1,3,5
manx react hooks --save-all --json
```

---

<details>
<summary><strong>📦 Installation Options</strong></summary>

### Manual Installation

1. **Download the latest release** for your platform:
   - [Linux x86_64]https://github.com/neur0map/manx/releases/latest/download/manx-x86_64-unknown-linux-gnu
   - [Linux ARM64]https://github.com/neur0map/manx/releases/latest/download/manx-aarch64-unknown-linux-gnu  
   - [macOS x86_64]https://github.com/neur0map/manx/releases/latest/download/manx-x86_64-apple-darwin
   - [macOS ARM64]https://github.com/neur0map/manx/releases/latest/download/manx-aarch64-apple-darwin
   - [Windows]https://github.com/neur0map/manx/releases/latest/download/manx-x86_64-pc-windows-msvc.exe

2. **Make executable and move to PATH**:
   ```bash
   chmod +x manx-*
   sudo mv manx-* /usr/local/bin/manx
   ```

3. **Verify installation**:
   ```bash
   manx --version
   ```

### From Source (Cargo)

```bash
# Install from crates.io (coming soon)
cargo install manx

# Or build from source
git clone https://github.com/neur0map/manx.git
cd manx
cargo build --release
sudo cp target/release/manx /usr/local/bin/
```

</details>

<details>
<summary><strong>📖 Complete Usage Guide</strong></summary>

## Basic Search
```bash
manx <library>              # Search library docs
manx <library> <query>      # Search library for specific query
manx <library>@<version>    # Version-specific search

# Examples
manx fastapi                # All FastAPI docs
manx fastapi cors           # FastAPI CORS documentation  
manx react@18              # React v18 documentation
manx vue@3 composition     # Vue 3 Composition API
```

## Full Documentation
```bash
manx doc <library> <query>  # Get comprehensive documentation

# Examples  
manx doc fastapi middleware    # Complete FastAPI middleware guide
manx doc react hooks          # Full React Hooks documentation
manx doc django orm           # Django ORM complete guide
```

## Result Limiting
```bash
manx fastapi --limit 5         # Show only first 5 results
manx react hooks --limit 0     # Show all results (unlimited)
manx vue --limit 15            # Show first 15 results
# Default limit is 10 results
```

## Export Options
```bash
manx fastapi --save 1,3,7     # Save specific results as markdown
manx fastapi --save 1,3,7 --json  # Save as JSON
manx react --save-all         # Save all results
manx doc react -o react.md    # Export documentation
```

## Cache Management
```bash
manx cache stats           # Show cache statistics
manx cache list            # List cached libraries
manx cache clear           # Clear all cached data
manx --clear-cache         # Quick cache clear (global flag)
```

## Other Options
```bash
manx --limit 5                 # Limit number of results (default: 10)
manx --offline                 # Use cache only (no network)
manx --quiet                   # JSON output (for scripts)
manx --debug                   # Enable debug logging
```

</details>

<details>
<summary><strong>🔑 Context7 API Key Setup</strong></summary>

**Important:** Without an API key, Manx uses Context7's shared MCP endpoint which has strict rate limits. Users often experience rate limiting after just a few searches. Setting up an API key provides dedicated access with much higher limits.

### Why You Need an API Key

- **Without API Key:** Uses shared MCP endpoint (`mcp.context7.com/mcp`) with very low rate limits
- **With API Key:** Uses dedicated API endpoint with high rate limits
-**Faster responses** and better reliability
-**Premium features** access

### Getting Your API Key

1. Visit the [Context7 Dashboard]https://context7.com/dashboard
2. Create a free account or log in
3. Generate your API key (starts with `sk-`)
4. Set it up in manx:

```bash
# Method 1: Using config command (recommended)
manx config --api-key sk-your-context7-key-here

# Method 2: Environment variable
export MANX_API_KEY=sk-your-context7-key-here

# Method 3: Direct config file edit (~/.config/manx/config.json)
{
  "api_key": "sk-your-context7-key-here"
}
```

### Verifying Your Setup

```bash
# Check current configuration
manx config --show

# Test with your API key (should be much faster)
manx fastapi
```

### Removing Your API Key

```bash
# Remove API key (switches back to shared rate limits)
manx config --api-key ""

# Or unset environment variable
unset MANX_API_KEY
```

**Note:** The API key only affects rate limiting and endpoint selection. All documentation content remains the same.

</details>

<details>
<summary><strong>⚙️ Configuration</strong></summary>

Manx stores configuration in `~/.config/manx/config.json`:

```json
{
  "api_key": "sk-your-context7-key",
  "cache_dir": null,
  "default_limit": 10,
  "offline_mode": false,
  "color_output": true,
  "auto_cache_enabled": true,
  "cache_ttl_hours": 24,
  "max_cache_size_mb": 100
}
```

### Configuration Commands

```bash
manx config --show                    # Show current settings
manx config --api-key YOUR_KEY       # Set Context7 API key
manx config --cache-dir /path/cache  # Set cache directory
manx config --auto-cache on          # Enable auto-caching
manx config --auto-cache off         # Disable auto-caching

# Note: Default result limit (10) is configurable in config.json
```

### Environment Variables

```bash
export NO_COLOR=1              # Disable colored output
export MANX_CACHE_DIR=~/cache  # Custom cache directory  
export MANX_API_KEY=sk-xxx     # API key (overrides config)
export MANX_DEBUG=1            # Enable debug logging
```

</details>

<details>
<summary><strong>🚀 Performance & Benchmarks</strong></summary>

Manx is designed for speed and efficiency:

| Metric | Value | Notes |
|--------|--------|-------|
| **Binary Size** | 2.9MB | Single static binary |
| **Startup Time** | < 50ms | Near-instantaneous |
| **Search Speed** | < 1s | Including network + parsing |
| **Memory Usage** | < 10MB | Minimal RAM footprint |
| **Cache Size** | 100MB max | Auto-managed, configurable |
| **Offline Mode** || Full functionality with cache |

### Benchmarks
```bash
# Cold search (first time)
$ time manx fastapi
Real: 0.8s  User: 0.1s  Sys: 0.05s

# Warm search (cached)  
$ time manx --offline fastapi
Real: 0.1s  User: 0.08s  Sys: 0.02s

# Export benchmark
$ time manx fastapi -o docs.md
Real: 0.9s  User: 0.15s  Sys: 0.08s
```

</details>

<details>
<summary><strong>🛠️ Troubleshooting</strong></summary>

### Common Issues

#### "No results found" 
```bash
# Check if library name is correct
manx config --show                    # Verify settings
manx fastapi                          # Try exact library name
manx python                           # Try broader search

# Clear cache and retry
manx cache clear
manx fastapi
```

#### Network/Connectivity Issues
```bash
# Test with debug mode
manx --debug fastapi

# Use offline mode if you have cache
manx --offline fastapi

# Check Context7 status
curl -I https://mcp.context7.com/mcp
```

#### Cache Issues
```bash
# Check cache stats
manx cache stats

# Clear and rebuild cache
manx cache clear
manx fastapi                          # Rebuild cache

# Use custom cache location
manx config --cache-dir ~/my-cache
```

#### Permission Issues
```bash
# Fix binary permissions
chmod +x /usr/local/bin/manx

# Alternative install location (no sudo)
mkdir -p ~/.local/bin
mv manx ~/.local/bin/
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
```

### Logs and Debug Info

```bash
# Enable debug mode
manx --debug fastapi 2>&1 | tee debug.log

# Check cache directory
ls -la ~/.cache/manx/

# View config file
cat ~/.config/manx/config.json
```

</details>

<details>
<summary><strong>🗑️ Uninstall</strong></summary>

Remove Manx completely:

```bash
# Remove binary
sudo rm /usr/local/bin/manx

# Remove config and cache
rm -rf ~/.config/manx
rm -rf ~/.cache/manx

# Or use the installer  
curl -fsSL https://raw.githubusercontent.com/neur0map/manx/main/install.sh | bash -s -- --uninstall
```

</details>

## Contributing

We welcome contributions! Here's how to get started:

1. **Fork the repository**
2. **Create a feature branch**: `git checkout -b feature-name`
3. **Make changes** and add tests
4. **Run tests**: `cargo test`  
5. **Check formatting**: `cargo fmt --check`
6. **Run linter**: `cargo clippy`
7. **Submit a Pull Request**

### Development Setup

```bash
git clone https://github.com/neur0map/manx.git
cd manx
cargo build
cargo test
./target/debug/manx --help
```

## License

MIT License - see [LICENSE](LICENSE) for details

## Acknowledgments

- **Context7** for the excellent MCP documentation API
- **Rust community** for amazing crates and tooling
- **Clap** for beautiful CLI parsing
- **All contributors** who make Manx better

---

Built with ❤️ for developers who live in the terminal.

**[⬆️ Back to Top](#-manx)**