manx-cli 0.4.0

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
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
# ๐Ÿš€ Manx - Lightning-Fast Documentation Finder

> *Blazing-fast CLI tool for developers to find documentation, code snippets, and answers instantly*

<div align="center">

![GitHub Release](https://img.shields.io/github/v/release/neur0map/manx)
![Crates.io Version](https://img.shields.io/crates/v/manx-cli)
![GitHub Downloads](https://img.shields.io/github/downloads/neur0map/manx/total?label=github%20downloads)
![Crates.io Downloads](https://img.shields.io/crates/d/manx-cli?label=crates.io%20downloads)
![License](https://img.shields.io/badge/license-MIT-blue.svg)
![Language](https://img.shields.io/badge/language-Rust-orange.svg)
![Binary Size](https://img.shields.io/badge/binary-5.4MB-blue.svg)

**๐Ÿš€ [Quick Start](#-quick-start) โ€ข ๐Ÿ“š [Documentation](#-complete-command-reference) โ€ข โš™๏ธ [Configuration](#๏ธ-configuration)**

</div>

## โœจ What Makes Manx Special?

Manx is the **fastest way to find documentation and code snippets** from your terminal with **three levels of capability**:

<table>
<tr>
<td width="25%" align="center">

### **๐Ÿš€ Default Mode**
**Works immediately - no setup**

โšก **Hash Embeddings**  
Built-in algorithm (0ms)

๐Ÿ“š **Official Docs**  
Context7 integration  

๐Ÿ” **Keyword Search**  
Great exact matching

๐Ÿ’พ **Zero Storage**  
No downloads needed

</td>
<td width="25%" align="center">

### **๐Ÿง  Enhanced Mode**
**Better search - 1 command setup**

๐Ÿค– **Neural Embeddings**  
HuggingFace models (87-400MB)

๐ŸŽฏ **Semantic Understanding**  
"database" = "data storage"

๐Ÿ“Š **Intent Matching**  
Superior result relevance

๐Ÿ”„ **Easy Installation**  
`manx embedding download`

</td>
<td width="25%" align="center">

### **๐Ÿ“‚ RAG Mode**
**Your docs + AI - local setup**

๐Ÿ”’ **Private Documents**  
Your indexed files only

๐ŸŽฏ **Semantic + AI Search**  
Your knowledge + LLM synthesis

๐Ÿ“ **Multi-format Support**  
PDF, Markdown, DOCX, URLs

๐Ÿ” **Use `--rag` flag**  
`manx search "topic" --rag`

</td>
<td width="25%" align="center">

### **๐Ÿค– AI Mode**
**Full synthesis - API key setup**

๐Ÿง  **Neural + AI Analysis**  
Best of both worlds

๐Ÿ’ฌ **Comprehensive Answers**  
Code + explanations + citations

๐ŸŒ **Multi-Provider Support**  
OpenAI, Anthropic, Groq, etc.

๐ŸŽ›๏ธ **Fine-grained Control**  
Per-command AI toggle

</td>
</tr>
</table>

**Start with Default โ†’ Upgrade to Enhanced โ†’ Index your docs (RAG) โ†’ Add AI when needed**

## ๐Ÿ”ง **How Manx Works Under the Hood**

### **๐Ÿ“Š Search Architecture Flow**

```mermaid
graph TD
    A[๐Ÿ” User Query] --> B{Search Command}
    B --> C[snippet/search/doc]
    C --> D[Query Processing]
    
    D --> E{Embedding Provider}
    E -->|Default| F[๐Ÿ”ฅ Hash Algorithm]
    E -->|Enhanced| G[๐Ÿง  Neural Model]
    E -->|API| H[โ˜๏ธ OpenAI/HF API]
    
    F --> I[Vector Generation]
    G --> I
    H --> I
    
    I --> J{Data Sources}
    J -->|Official| K[๐Ÿ“š Context7 API]
    J -->|Local| L[๐Ÿ“ Indexed Docs]
    J -->|Cache| M[๐Ÿ’พ Local Cache]
    
    K --> N[Semantic Search]
    L --> N  
    M --> N
    
    N --> O[Result Ranking]
    O --> P{AI Enhancement}
    P -->|Disabled| Q[๐Ÿ“ Documentation Results]
    P -->|Enabled| R[๐Ÿค– LLM Analysis]
    
    R --> S[๐ŸŽฏ Enhanced Response]
    Q --> T[๐Ÿ“ฑ Terminal Output]
    S --> T
```

### **โš™๏ธ Embedding System Architecture**

```mermaid
graph LR
    A[User Query] --> B{Embedding Config}
    
    B -->|hash| C[๐Ÿ”ฅ Hash Provider<br/>384D, 0ms, 0MB]
    B -->|onnx:model| D[๐Ÿง  ONNX Provider<br/>384-768D, 0ms, 87-400MB]  
    B -->|openai:model| E[โ˜๏ธ OpenAI Provider<br/>1536-3072D, ~100ms, API]
    B -->|ollama:model| F[๐Ÿ  Ollama Provider<br/>Variable, ~50ms, Local]
    
    C --> G[Word Hashing<br/>+ N-gram Features]
    D --> H[Neural Network<br/>Inference]
    E --> I[REST API Call]
    F --> J[Local Model Server]
    
    G --> K[Vector Output]
    H --> K
    I --> K
    J --> K
    
    K --> L[Cosine Similarity<br/>Search]
    L --> M[Ranked Results]
```

### **๐Ÿ”„ Configuration Workflow**

```mermaid
sequenceDiagram
    participant U as User
    participant C as CLI
    participant M as Model Manager
    participant P as Provider
    participant S as Search Engine
    
    Note over U,S: Initial Setup (Optional)
    U->>C: manx embedding list --available
    C->>U: Show HuggingFace models
    
    U->>C: manx embedding download model-name
    C->>M: Download from HuggingFace
    M->>M: Extract dimensions from config.json
    M->>C: Model installed + metadata saved
    
    U->>C: manx config --embedding-provider onnx:model-name
    C->>M: Load model metadata
    M->>C: Dimension: 768, Path: ~/.cache/manx/models/
    C->>C: Update config with detected dimension
    
    Note over U,S: Daily Usage
    U->>C: manx snippet react "hooks"
    C->>P: Initialize provider from config
    P->>P: Load model (onnx) or use algorithm (hash)
    P->>S: Generate embeddings
    S->>U: Search results with semantic ranking
```

### **๐Ÿ’พ Data Flow & Storage**

```mermaid
graph TB
    subgraph "๐Ÿ  Local Storage"
        A[~/.config/manx/<br/>config.json]
        B[~/.cache/manx/models/<br/>ONNX files + metadata]
        C[~/.cache/manx/rag/<br/>Indexed documents]
        D[~/.cache/manx/cache/<br/>API responses]
    end
    
    subgraph "๐ŸŒ External APIs"
        E[Context7<br/>Official Docs]
        F[HuggingFace<br/>Model Downloads]  
        G[OpenAI/Anthropic<br/>AI Synthesis]
        H[Ollama<br/>Local LLM Server]
    end
    
    subgraph "๐Ÿ”ง Core Engine"
        I[Embedding Providers]
        J[Search Algorithm]
        K[Result Processor]
        L[Terminal Renderer]
    end
    
    A --> I
    B --> I
    C --> J
    D --> J
    
    E --> J
    F --> B
    G --> K
    H --> I
    
    I --> J
    J --> K
    K --> L
    L --> M[๐Ÿ–ฅ๏ธ User Terminal]
```

---

## ๐ŸŒŸ **Core Features**

### ๐Ÿš€ **Lightning-Fast Documentation Search**

Get instant access to documentation and code examples:

<table>
<tr>
<td width="50%">

**๐Ÿ” Web Documentation Search**
```bash
manx search "rust async programming"
```
*Returns: Instant access to official docs and tutorials via DuckDuckGo*

**๐Ÿ“š Official Documentation Browser**  
```bash
manx doc python "async functions"
```
*Returns: Real-time official documentation with examples*

</td>
<td width="50%">

**๐Ÿ’ก Code Snippet Search**
```bash
manx snippet react "useEffect cleanup"
```
*Returns: Working code examples with clear explanations*

**๐Ÿ“ Local Document Search (RAG)**
```bash
manx search "authentication" --rag
```
*Returns: Semantic search through your indexed documents*

</td>
</tr>
</table>

### ๐ŸŽจ **Beautiful Terminal Experience**

Every response features:
- **๐Ÿ“– Clear Documentation** - Well-formatted, readable content
- **๐Ÿ’ก Code Examples** - Syntax-highlighted, runnable code
- **๐Ÿ“Š Quick Results** - Instant access to what you need
- **๐Ÿ”— Source Links** - Direct links to official documentation

### ๐Ÿค– **Optional AI Enhancement**

Add AI analysis when you need deeper insights (completely optional):

```bash
# OpenAI (GPT-4, GPT-3.5)
manx config --openai-api "sk-your-openai-key"

# Anthropic (Claude)
manx config --anthropic-api "sk-ant-your-anthropic-key"  

# Groq (Ultra-fast inference)
manx config --groq-api "gsk-your-groq-key"

# OpenRouter (Multi-model access)
manx config --openrouter-api "sk-or-your-openrouter-key"

# HuggingFace (Open-source models)
manx config --huggingface-api "hf-your-huggingface-key"

# Custom endpoints (Self-hosted models)
manx config --custom-endpoint "http://localhost:8000/v1"
```

### ๐Ÿ“‚ **Local Document Search (RAG)**

Index and search your own documentation and code files:

```bash
# 1. Index your documents
manx index /path/to/your/docs
manx index /path/to/your/code

# 2. Enable local search
manx config --rag-enabled

# 3. Search your indexed content
manx search "authentication patterns" --rag
manx snippet python "async database" --rag  
manx doc fastapi "middleware setup" --rag
```

**Benefits:**
- ๐Ÿ”’ **Private & Offline** - Your documents never leave your machine
- ๐ŸŽฏ **Semantic Search** - Uses same embedding models as web search
- ๐Ÿค– **AI Integration** - Optional LLM synthesis from your own docs
- ๐Ÿ“ **File Formats** - Supports `.md`, `.txt`, `.pdf`, `.docx` + web URLs

---

## ๐Ÿš€ **Quick Start**

### 1. **Installation**

```bash
# Using Cargo (Recommended)
cargo install manx-cli

# Using shell script
curl -fsSL https://raw.githubusercontent.com/neur0map/manx/main/install.sh | bash

# Manual download from releases
# https://github.com/neur0map/manx/releases/latest
```

### 2. **Core Commands**

```bash
# ๐Ÿ” Search web documentation instantly
manx search "docker compose production setup"

# ๐Ÿ“š Browse official documentation
manx doc fastapi "authentication middleware"

# ๐Ÿ’ก Find working code snippets
manx snippet react "custom hooks patterns"

# ๐Ÿ“ Index your personal documentation (optional)
manx index ~/dev-notes/                               # Local directory
manx index https://docs.fastapi.tiangolo.com --crawl  # Deep crawl documentation site
manx search "team coding standards" --rag
```

### 3. **Context7 API Configuration (Recommended)**

```bash
# Get higher rate limits for documentation access
manx config --api-key "sk-your-context7-key"

# Test that everything is working
manx snippet python "list comprehensions"

# Optional: Add AI enhancement
manx config --openai-api "sk-your-openai-key"
manx search "topic"  # Now includes AI analysis when helpful
```

---

## ๐Ÿ“‹ **Complete Command Reference**

### ๐Ÿ” **Search Commands**

<table>
<tr>
<td width="50%">

**Web Search** *(DuckDuckGo-powered)*
```bash
manx search "kubernetes deployment"
manx search "react hooks patterns"
manx search "python async" --limit 5
```

**Documentation Browser**
```bash  
manx doc fastapi "authentication"
manx doc react@18 "useState patterns"
manx doc python "async functions"
```

</td>
<td width="50%">

**Code Snippets**
```bash
manx snippet react "useEffect cleanup"  
manx snippet fastapi "middleware setup"
manx snippet python "decorators"
```

**Result Retrieval**
```bash
manx get doc-3                # Get specific result
manx get snippet-7 -o code.md # Export to file
```

</td>
</tr>
</table>

### ๐Ÿ“ **Knowledge Management**

```bash
# Index local documents
manx index ~/documentation/          # Directory
manx index ./README.md               # Single file  
manx index https://docs.example.com  # Web URL

# Deep crawl documentation sites (NEW!)
manx index https://docs.rust-lang.org --crawl                    # Discover all linked pages
manx index https://fastapi.tiangolo.com --crawl --max-depth 2    # Limited depth crawling
manx index https://docs.python.org --crawl --max-pages 10        # Limited page count

# Manage indexed sources
manx sources list                    # View all sources
manx sources clear                   # Clear all indexed docs

# Cache management
manx cache stats                     # Show cache info
manx cache clear                     # Clear cache
```

### โš™๏ธ **Configuration**

```bash
# View current settings
manx config --show

# Context7 API (for official docs - recommended)
manx config --api-key "sk-context7-key"

# AI Provider Configuration (optional)
manx config --openai-api "sk-key"       # OpenAI
manx config --anthropic-api "sk-key"    # Anthropic  
manx config --groq-api "gsk-key"        # Groq
manx config --llm-provider "groq"       # Set preferred provider
manx config --llm-model "llama-3.1-8b"  # Set specific model

# Switch between models
manx config --llm-provider "openai" --llm-model "gpt-4"
manx config --llm-provider "anthropic" --llm-model "claude-3-sonnet"

# Remove API keys / Disable AI
manx config --openai-api ""             # Remove OpenAI key
manx config --llm-provider ""           # Disable AI entirely
manx config --anthropic-api ""          # Remove Anthropic key

# Other Settings
manx config --cache-dir ~/my-cache      # Custom cache location
manx config --auto-cache off            # Disable auto-caching
```

---

## ๐Ÿง  **Personal Knowledge Base**

Index your documentation and notes for instant search:

### **๐Ÿ“š Index Your Knowledge**

```bash
# Personal development notes
manx index ~/coding-notes/
manx index ~/project-documentation/

# Team knowledge base  
manx index ~/company-wiki/
manx index ~/internal-procedures/

# Web documentation (single page)
manx index https://your-team-docs.com
manx index https://internal-api-docs.example.com

# Deep crawl entire documentation sites
manx index https://docs.your-framework.com --crawl              # Discover all pages automatically
manx index https://internal-wiki.company.com --crawl --max-depth 3  # Limit crawl depth
manx index https://team-knowledge.com --crawl --max-pages 50    # Limit total pages crawled
```

### **๐Ÿ” Unified Search Experience**

```bash
manx snippet "authentication setup"
```

**Returns:**
- ๐ŸŒ **Official docs** (FastAPI, OAuth, JWT guides)
- ๐Ÿ“ **Your notes** (team auth procedures, troubleshooting)  
- ๐Ÿ”— **Direct links** to source documentation and files

### **๐Ÿ›ก๏ธ Security Features**

- **PDF Security**: Validates PDFs for malicious content
- **Content Sanitization**: Cleans and validates all indexed content
- **Local Processing**: RAG runs entirely locally
- **Privacy Control**: Core functionality works entirely offline

### **๐Ÿ’พ Supported Formats**

- **Documents**: `.md`, `.txt`, `.docx`, `.pdf`
- **Web Content**: HTML pages with automatic text extraction
- **Code Files**: Syntax-aware indexing
- **URLs**: Single page or deep crawl entire documentation sites
- **Deep Crawling**: Automatically discovers and indexes interconnected documentation pages

---

## ๐Ÿค– **Optional AI Features**

### **๐ŸŽฏ Enhanced Analysis (When Enabled)**

When you configure an AI provider, responses include deeper analysis:

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐Ÿ“– Documentation Results                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

1. React Hooks Introduction
   https://reactjs.org/docs/hooks-intro.html
   
2. useState Hook Documentation  
   https://reactjs.org/docs/hooks-state.html
   
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐Ÿค– AI Analysis (Optional)               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  โฏ Quick Summary
  React hooks allow you to use state and lifecycle 
  features in functional components.

  โฏ Key Insights
  โ€ข useState manages component state
  โ€ข useEffect handles side effects  
  โ€ข Custom hooks enable logic reuse
```

### **๐Ÿ”ง Provider-Specific Features**

<table>
<tr>
<td width="33%">

**OpenAI**
- GPT-4, GPT-3.5-turbo
- Function calling support
- Streaming responses
- High-quality synthesis

</td>
<td width="33%">

**Anthropic** 
- Claude 3.5 Sonnet
- Large context windows
- Excellent code understanding
- Safety-focused responses

</td>
<td width="33%">

**Groq**
- Ultra-fast inference
- Llama 3.1 models  
- Cost-effective
- Low latency

</td>
</tr>
</table>

### **๐ŸŽ›๏ธ Fine-grained Control**

```bash
# Global AI settings
manx config --llm-provider "anthropic"
manx config --llm-model "claude-3-sonnet"

# Per-command control
manx search "topic"              # Fast documentation search
manx search "topic" --no-llm     # Force no AI analysis
manx snippet react hooks        # Code examples with optional AI insights
manx snippet react --no-llm     # Just the documentation
```

---

## ๐Ÿ”— **Context7 Integration**

Access real-time official documentation:

### **โšก Rate Limiting Solutions**

```bash
# Without API key: Shared rate limits (very restrictive)
manx snippet react hooks
# May hit rate limits after few searches

# With API key: Dedicated access (recommended)
manx config --api-key "sk-your-context7-key"
manx snippet react hooks  # Much higher limits
```

### **๐Ÿ”‘ Get Your Context7 API Key**

1. Visit [Context7 Dashboard]https://context7.com/dashboard
2. Create account or sign in
3. Generate API key (starts with `sk-`)
4. Configure: `manx config --api-key "sk-your-key"`

---

## ๐Ÿ“Š **Performance & Features**

<table>
<tr>
<td width="50%">

**โšก Performance**
- **Search Speed**: < 1 second (snippets), < 2 seconds (web search)
- **Binary Size**: 5.4MB single file
- **Memory Usage**: < 15MB RAM
- **Startup Time**: < 50ms
- **Cache Support**: Smart auto-caching

</td>
<td width="50%">

**๐Ÿ”ง Technical Features**
- **Multi-threading**: Parallel search processing
- **Smart Embeddings**: Hash-based (default) + ONNX neural models  
- **Vector Storage**: Local file-based RAG system
- **HTTP/2**: Modern API communication
- **Cross-platform**: Linux, macOS, Windows

</td>
</tr>
</table>

---

## ๐Ÿง  **Semantic Search & Embeddings**

Manx features a **flexible embedding system** that automatically chooses the best search method:

### **๐Ÿš€ Getting Started (3 Commands)**

```bash
# 1. Works great immediately (no setup)
manx snippet react "state management"

# 2. Optional: Install better search (one-time setup)
manx embedding download sentence-transformers/all-MiniLM-L6-v2
manx config --embedding-provider onnx:sentence-transformers/all-MiniLM-L6-v2

# 3. Now enjoy superior semantic search
manx snippet react "state management"  # Much smarter results
```

### **๐Ÿ“Š Capability Comparison**

| Feature | **Hash (Default)** | **Neural Models** |
|---------|-------------------|-------------------|
| **Setup** | None required | 1 command |
| **Speed** | 0ms (instant) | 0ms (after loading) |
| **Storage** | 0MB | 87-400MB |
| **Understanding** | Keyword matching | Semantic + contextual |
| **Privacy** | 100% offline | 100% local processing |
| **Quality** | Good for exact terms | Excellent for concepts |

### **โš™๏ธ Advanced Configuration**

```bash
# Management commands
manx embedding list --available     # See available models
manx embedding status               # Check current setup
manx embedding test "your query"    # Test search quality

# Provider switching (instant)
manx config --embedding-provider hash                    # Default algorithm
manx config --embedding-provider onnx:all-MiniLM-L6-v2   # Local neural model  
manx config --embedding-provider openai:text-embedding-3 # API-based (requires key)
```

**HuggingFace installation recommended** - best search quality + privacy + no API costs.

---

## ๐ŸŽฏ **Real-World Use Cases**

### **๐Ÿ‘จโ€๐Ÿ’ป Individual Developer**

```bash
# Morning workflow: Check React patterns
manx snippet react "performance optimization"
# Returns: Official React docs + your optimization notes

# Debug session: Memory leak investigation  
manx search "javascript memory leaks"
# Returns: MDN docs + Stack Overflow + your debugging notes

# Learning: New framework exploration
manx doc svelte "component lifecycle"  
# Returns: Official Svelte docs with clear examples
```

### **๐Ÿ‘ฅ Development Team**

```bash
# Onboard new developer
manx index ~/team-handbook/
manx index ~/coding-standards/
manx snippet "deployment process"
# Returns: Official CI/CD docs + team procedures

# Solve production issue
manx search "kubernetes pod restart loops"
# Returns: K8s docs + team runbooks + troubleshooting guides
```

### **๐Ÿ”’ Privacy-Focused Usage**

```bash
# Index sensitive documentation locally
manx index ~/classified-procedures/
manx snippet "security protocols"
# Pure local search - works completely offline

# Team knowledge stays private
manx snippet "internal processes"
# Uses only local knowledge + official docs (no AI calls)
```

---

## ๐Ÿ› ๏ธ **Installation Options**

<details>
<summary><strong>๐Ÿ“ฆ Detailed Installation Guide</strong></summary>

### Cargo Installation (Recommended)
```bash
cargo install manx-cli
manx --version
```

### Shell Script Installer
```bash
curl -fsSL https://raw.githubusercontent.com/neur0map/manx/main/install.sh | bash
```

### Manual Binary Download

1. Download 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 x86_64]https://github.com/neur0map/manx/releases/latest/download/manx-x86_64-pc-windows-msvc.exe

2. Install:
   ```bash
   chmod +x manx-*
   sudo mv manx-* /usr/local/bin/manx
   ```

### From Source
```bash
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>๐Ÿ”ง Advanced Configuration</strong></summary>

### Configuration File Location
```bash
~/.config/manx/config.json
```

### Full Configuration Example
```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,
  "rag": {
    "enabled": true,
    "index_path": "~/.cache/manx/rag_index",
    "max_results": 10,
    "allow_pdf_processing": false
  },
  "llm": {
    "openai_api_key": "sk-your-openai-key",
    "anthropic_api_key": "sk-ant-your-anthropic-key",
    "groq_api_key": "gsk-your-groq-key",
    "openrouter_api_key": "sk-or-your-openrouter-key",
    "huggingface_api_key": "hf-your-huggingface-key",
    "custom_endpoint": "http://localhost:8000/v1",
    "preferred_provider": "OpenAI",
    "model_name": "gpt-4"
  }
}
```

### Environment Variables
```bash
export NO_COLOR=1                    # Disable colors
export MANX_CACHE_DIR=~/cache        # Custom cache dir
export MANX_API_KEY=sk-xxx           # Context7 API key
export MANX_DEBUG=1                  # Enable debug logging
```

</details>

<details>
<summary><strong>๐Ÿ› ๏ธ Troubleshooting</strong></summary>

### Common Issues

**Want to Add AI Analysis?**
```bash
# Check current configuration
manx config --show

# Set up an AI provider (optional)
manx config --openai-api "sk-your-key"

# Test enhanced functionality
manx snippet python "functions"
```

**Managing AI Configuration**
```bash
# Switch between providers
manx config --llm-provider "anthropic"
manx config --llm-model "claude-3-sonnet"

# Disable AI completely
manx config --llm-provider ""

# Remove specific API keys
manx config --openai-api ""
```

**"No results found"**
```bash
# Check Context7 API key setup
manx config --api-key "sk-your-context7-key"

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

**Rate Limiting Issues**
```bash
# Without Context7 API key, you'll hit shared limits quickly
manx config --api-key "sk-your-context7-key"

# This provides much higher rate limits
```

**Local RAG Not Finding Documents**
```bash
# Check indexed sources
manx sources list

# Re-index if needed
manx sources clear
manx index ~/your-docs/
```

### Debug Mode
```bash
# Enable detailed logging
manx --debug snippet react hooks 2>&1 | tee debug.log

# Check configuration
manx config --show

# View cache stats
manx cache stats
```

</details>

---

## ๐Ÿค **Contributing**

We welcome contributions! Areas where help is needed:

- **โšก Performance** - Make search even faster
- **๐Ÿ“„ Document Parsers** - Support for more file formats  
- **๐ŸŽจ Terminal UI** - Enhance the visual experience
- **๐Ÿงช Testing** - Expand test coverage
- **๐Ÿ“– Documentation** - Improve guides and examples

### 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**

### **๐Ÿ” Core Search Infrastructure**
- **[Context7]https://context7.com** - Excellent MCP documentation API providing real-time access to official documentation
- **[DuckDuckGo]https://duckduckgo.com** - Privacy-focused search engine powering our web search functionality
- **[Spider-rs]https://github.com/spider-rs/spider** - High-performance web crawler enabling our deep documentation site indexing

### **๐Ÿง  AI & Embedding Systems**
- **[HuggingFace]https://huggingface.co** - Transformers and embedding models for semantic search
- **[ONNX Runtime]https://onnxruntime.ai** - Cross-platform ML inference for local embedding models
- **[Ollama]https://ollama.ai** - Local LLM server integration
- **[OpenAI]https://openai.com** & **[Anthropic]https://anthropic.com** - AI analysis and synthesis capabilities

### **โš™๏ธ Core Rust Libraries**
- **[Tokio]https://tokio.rs** - Async runtime powering all network operations
- **[Reqwest]https://github.com/seanmonstar/reqwest** - HTTP client for API communications
- **[Scraper]https://github.com/programble/scraper** - HTML parsing and content extraction
- **[Clap]https://github.com/clap-rs/clap** - Command-line argument parsing
- **[Serde]https://serde.rs** - Serialization/deserialization framework
- **[Colored]https://github.com/mackwic/colored** - Terminal color output
- **[Anyhow]https://github.com/dtolnay/anyhow** - Error handling and context
- **[Fuzzy-Matcher]https://github.com/lotabout/fuzzy-matcher** - Fuzzy string matching for enhanced search
- **[Indicatif]https://github.com/console-rs/indicatif** - Progress bars and spinners for user feedback

### **๐Ÿ“„ Document Processing**
- **[docx-rs]https://github.com/bokuweb/docx-rs** - Microsoft Word document processing
- **[WalkDir]https://github.com/BurntSushi/walkdir** - Recursive directory traversal
- **[UUID]https://github.com/uuid-rs/uuid** - Unique identifier generation

### **๐ŸŒŸ Community & Contributors**
- **Rust Community** - Outstanding ecosystem, tooling, and documentation
- **Contributors** - Making Manx better every day through feedback and contributions
- **Open Source Maintainers** - All the library authors who make projects like this possible

---

## ๐Ÿšง **Roadmap & TODOs**

### ๐Ÿ’ฐ **Cost & Usage Tracking**
- [ ] Add cost calculation functionality to LlmResponse struct
- [ ] Implement per-provider pricing models and cost tracking  
- [ ] Add usage statistics and cost reporting commands
- [ ] Implement token count breakdown (input/output/cached tokens)
- [ ] Implementation of local LLM support

---

<div align="center">

**Built with โค๏ธ for developers who need answers fast**

**[โฌ†๏ธ Back to Top](#-manx---ai-powered-documentation-assistant)**

![Manx Demo](https://via.placeholder.com/600x300/1a1a1a/00d4aa?text=๐Ÿค–+AI+Synthesis+Demo)

*Lightning-fast documentation search - right in your terminal*

</div>