viberag 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +219 -0
- package/dist/cli/__tests__/mcp-setup.test.d.ts +6 -0
- package/dist/cli/__tests__/mcp-setup.test.js +597 -0
- package/dist/cli/app.d.ts +2 -0
- package/dist/cli/app.js +238 -0
- package/dist/cli/commands/handlers.d.ts +57 -0
- package/dist/cli/commands/handlers.js +231 -0
- package/dist/cli/commands/index.d.ts +2 -0
- package/dist/cli/commands/index.js +2 -0
- package/dist/cli/commands/mcp-setup.d.ts +107 -0
- package/dist/cli/commands/mcp-setup.js +509 -0
- package/dist/cli/commands/useRagCommands.d.ts +23 -0
- package/dist/cli/commands/useRagCommands.js +180 -0
- package/dist/cli/components/CleanWizard.d.ts +17 -0
- package/dist/cli/components/CleanWizard.js +169 -0
- package/dist/cli/components/InitWizard.d.ts +20 -0
- package/dist/cli/components/InitWizard.js +370 -0
- package/dist/cli/components/McpSetupWizard.d.ts +37 -0
- package/dist/cli/components/McpSetupWizard.js +387 -0
- package/dist/cli/components/SearchResultsDisplay.d.ts +13 -0
- package/dist/cli/components/SearchResultsDisplay.js +130 -0
- package/dist/cli/components/WelcomeBanner.d.ts +10 -0
- package/dist/cli/components/WelcomeBanner.js +26 -0
- package/dist/cli/components/index.d.ts +1 -0
- package/dist/cli/components/index.js +1 -0
- package/dist/cli/data/mcp-editors.d.ts +80 -0
- package/dist/cli/data/mcp-editors.js +270 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +26 -0
- package/dist/cli-bundle.cjs +5269 -0
- package/dist/common/commands/terminalSetup.d.ts +2 -0
- package/dist/common/commands/terminalSetup.js +144 -0
- package/dist/common/components/CommandSuggestions.d.ts +9 -0
- package/dist/common/components/CommandSuggestions.js +20 -0
- package/dist/common/components/StaticWithResize.d.ts +23 -0
- package/dist/common/components/StaticWithResize.js +62 -0
- package/dist/common/components/StatusBar.d.ts +8 -0
- package/dist/common/components/StatusBar.js +64 -0
- package/dist/common/components/TextInput.d.ts +12 -0
- package/dist/common/components/TextInput.js +239 -0
- package/dist/common/components/index.d.ts +3 -0
- package/dist/common/components/index.js +3 -0
- package/dist/common/hooks/index.d.ts +4 -0
- package/dist/common/hooks/index.js +4 -0
- package/dist/common/hooks/useCommandHistory.d.ts +7 -0
- package/dist/common/hooks/useCommandHistory.js +51 -0
- package/dist/common/hooks/useCtrlC.d.ts +9 -0
- package/dist/common/hooks/useCtrlC.js +40 -0
- package/dist/common/hooks/useKittyKeyboard.d.ts +10 -0
- package/dist/common/hooks/useKittyKeyboard.js +26 -0
- package/dist/common/hooks/useStaticOutputBuffer.d.ts +31 -0
- package/dist/common/hooks/useStaticOutputBuffer.js +58 -0
- package/dist/common/hooks/useTerminalResize.d.ts +28 -0
- package/dist/common/hooks/useTerminalResize.js +51 -0
- package/dist/common/hooks/useTextBuffer.d.ts +13 -0
- package/dist/common/hooks/useTextBuffer.js +165 -0
- package/dist/common/index.d.ts +13 -0
- package/dist/common/index.js +17 -0
- package/dist/common/types.d.ts +162 -0
- package/dist/common/types.js +1 -0
- package/dist/mcp/index.d.ts +12 -0
- package/dist/mcp/index.js +66 -0
- package/dist/mcp/server.d.ts +25 -0
- package/dist/mcp/server.js +837 -0
- package/dist/mcp/watcher.d.ts +86 -0
- package/dist/mcp/watcher.js +334 -0
- package/dist/rag/__tests__/grammar-smoke.test.d.ts +9 -0
- package/dist/rag/__tests__/grammar-smoke.test.js +161 -0
- package/dist/rag/__tests__/helpers.d.ts +30 -0
- package/dist/rag/__tests__/helpers.js +67 -0
- package/dist/rag/__tests__/merkle.test.d.ts +5 -0
- package/dist/rag/__tests__/merkle.test.js +161 -0
- package/dist/rag/__tests__/metadata-extraction.test.d.ts +10 -0
- package/dist/rag/__tests__/metadata-extraction.test.js +202 -0
- package/dist/rag/__tests__/multi-language.test.d.ts +13 -0
- package/dist/rag/__tests__/multi-language.test.js +535 -0
- package/dist/rag/__tests__/rag.test.d.ts +10 -0
- package/dist/rag/__tests__/rag.test.js +311 -0
- package/dist/rag/__tests__/search-exhaustive.test.d.ts +9 -0
- package/dist/rag/__tests__/search-exhaustive.test.js +87 -0
- package/dist/rag/__tests__/search-filters.test.d.ts +10 -0
- package/dist/rag/__tests__/search-filters.test.js +250 -0
- package/dist/rag/__tests__/search-modes.test.d.ts +8 -0
- package/dist/rag/__tests__/search-modes.test.js +133 -0
- package/dist/rag/config/index.d.ts +61 -0
- package/dist/rag/config/index.js +111 -0
- package/dist/rag/constants.d.ts +41 -0
- package/dist/rag/constants.js +57 -0
- package/dist/rag/embeddings/fastembed.d.ts +62 -0
- package/dist/rag/embeddings/fastembed.js +124 -0
- package/dist/rag/embeddings/gemini.d.ts +26 -0
- package/dist/rag/embeddings/gemini.js +116 -0
- package/dist/rag/embeddings/index.d.ts +10 -0
- package/dist/rag/embeddings/index.js +9 -0
- package/dist/rag/embeddings/local-4b.d.ts +28 -0
- package/dist/rag/embeddings/local-4b.js +51 -0
- package/dist/rag/embeddings/local.d.ts +29 -0
- package/dist/rag/embeddings/local.js +119 -0
- package/dist/rag/embeddings/mistral.d.ts +22 -0
- package/dist/rag/embeddings/mistral.js +85 -0
- package/dist/rag/embeddings/openai.d.ts +22 -0
- package/dist/rag/embeddings/openai.js +85 -0
- package/dist/rag/embeddings/types.d.ts +37 -0
- package/dist/rag/embeddings/types.js +1 -0
- package/dist/rag/gitignore/index.d.ts +57 -0
- package/dist/rag/gitignore/index.js +178 -0
- package/dist/rag/index.d.ts +15 -0
- package/dist/rag/index.js +25 -0
- package/dist/rag/indexer/chunker.d.ts +129 -0
- package/dist/rag/indexer/chunker.js +1352 -0
- package/dist/rag/indexer/index.d.ts +6 -0
- package/dist/rag/indexer/index.js +6 -0
- package/dist/rag/indexer/indexer.d.ts +73 -0
- package/dist/rag/indexer/indexer.js +356 -0
- package/dist/rag/indexer/types.d.ts +68 -0
- package/dist/rag/indexer/types.js +47 -0
- package/dist/rag/logger/index.d.ts +20 -0
- package/dist/rag/logger/index.js +75 -0
- package/dist/rag/manifest/index.d.ts +50 -0
- package/dist/rag/manifest/index.js +97 -0
- package/dist/rag/merkle/diff.d.ts +26 -0
- package/dist/rag/merkle/diff.js +95 -0
- package/dist/rag/merkle/hash.d.ts +34 -0
- package/dist/rag/merkle/hash.js +165 -0
- package/dist/rag/merkle/index.d.ts +68 -0
- package/dist/rag/merkle/index.js +298 -0
- package/dist/rag/merkle/node.d.ts +51 -0
- package/dist/rag/merkle/node.js +69 -0
- package/dist/rag/search/filters.d.ts +21 -0
- package/dist/rag/search/filters.js +100 -0
- package/dist/rag/search/fts.d.ts +32 -0
- package/dist/rag/search/fts.js +61 -0
- package/dist/rag/search/hybrid.d.ts +17 -0
- package/dist/rag/search/hybrid.js +58 -0
- package/dist/rag/search/index.d.ts +89 -0
- package/dist/rag/search/index.js +367 -0
- package/dist/rag/search/types.d.ts +130 -0
- package/dist/rag/search/types.js +4 -0
- package/dist/rag/search/vector.d.ts +25 -0
- package/dist/rag/search/vector.js +44 -0
- package/dist/rag/storage/index.d.ts +92 -0
- package/dist/rag/storage/index.js +287 -0
- package/dist/rag/storage/lancedb-native.d.ts +7 -0
- package/dist/rag/storage/lancedb-native.js +10 -0
- package/dist/rag/storage/schema.d.ts +23 -0
- package/dist/rag/storage/schema.js +50 -0
- package/dist/rag/storage/types.d.ts +100 -0
- package/dist/rag/storage/types.js +68 -0
- package/package.json +67 -0
- package/scripts/check-node-version.js +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# VIBERAG
|
|
4
|
+
|
|
5
|
+
An MCP server for local codebase semantic, keyword, and hybrid search. Automatic codebase indexing and mcp search tools for AI coding assistants.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **CLI based setup** - CLI commands and wizards for setup, editor integration, and configuration
|
|
10
|
+
- **Semantic code search** - Find code by meaning, not just keywords
|
|
11
|
+
- **Flexible embeddings** - Local model (offline, free) or cloud providers (Gemini, Mistral, OpenAI)
|
|
12
|
+
- **MCP server** - Works with Claude Code, Cursor, VS Code Copilot, and more
|
|
13
|
+
- **Incremental indexing** - Only re-embeds changed files
|
|
14
|
+
- **Multi-language support** - TypeScript, JavaScript, Python, Go, Rust, and more
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g viberag
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Initialize in your project
|
|
26
|
+
cd your-project
|
|
27
|
+
viberag
|
|
28
|
+
|
|
29
|
+
# Run /init to configure and index
|
|
30
|
+
/init
|
|
31
|
+
|
|
32
|
+
# Search your codebase
|
|
33
|
+
/search authentication handler
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## MCP Server Setup
|
|
37
|
+
|
|
38
|
+
VibeRAG includes an MCP server that integrates with AI coding tools. Run `/mcp-setup` in the CLI to configure automatically, or set up manually:
|
|
39
|
+
|
|
40
|
+
### Supported Editors
|
|
41
|
+
|
|
42
|
+
| Editor | Config Location | Setup |
|
|
43
|
+
| ------------------- | -------------------------------------------------- | --------------------------------------------------- |
|
|
44
|
+
| **Claude Code** | `.mcp.json` | Auto or `claude mcp add viberag -- npx viberag-mcp` |
|
|
45
|
+
| **Cursor** | `.cursor/mcp.json` | Auto |
|
|
46
|
+
| **Gemini CLI** | `~/.gemini/settings.json` | `gemini mcp add viberag -- npx viberag-mcp` |
|
|
47
|
+
| **JetBrains IDEs** | Settings UI | Manual in Settings → AI Assistant → MCP |
|
|
48
|
+
| **OpenAI Codex** | `~/.codex/config.toml` | `codex mcp add viberag -- npx viberag-mcp` |
|
|
49
|
+
| **OpenCode** | `~/.config/opencode/opencode.json` | Manual merge |
|
|
50
|
+
| **Roo Code** | `.roo/mcp.json` | Auto |
|
|
51
|
+
| **VS Code Copilot** | `.vscode/mcp.json` | Auto |
|
|
52
|
+
| **Windsurf** | `~/.codeium/windsurf/mcp_config.json` | Manual merge |
|
|
53
|
+
| **Zed** | `~/Library/Application Support/Zed/settings.json` | Manual merge |
|
|
54
|
+
|
|
55
|
+
### Manual Configuration
|
|
56
|
+
|
|
57
|
+
For project-level configs (Claude Code, VS Code, Cursor, Roo Code), add to the appropriate file:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"mcpServers": {
|
|
62
|
+
"viberag": {
|
|
63
|
+
"command": "npx",
|
|
64
|
+
"args": ["viberag-mcp"]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
> **Note:** VS Code uses `"servers"` instead of `"mcpServers"`. Zed uses `"context_servers"`.
|
|
71
|
+
|
|
72
|
+
For global configs, merge the viberag entry into your existing configuration.
|
|
73
|
+
|
|
74
|
+
## CLI Commands
|
|
75
|
+
|
|
76
|
+
| Command | Description |
|
|
77
|
+
| ----------------- | --------------------------------------------------------- |
|
|
78
|
+
| `/init` | Initialize VibeRAG (configure embeddings, index codebase) |
|
|
79
|
+
| `/index` | Index the codebase (incremental) |
|
|
80
|
+
| `/reindex` | Force full reindex |
|
|
81
|
+
| `/search <query>` | Semantic search |
|
|
82
|
+
| `/status` | Show index status |
|
|
83
|
+
| `/mcp-setup` | Configure MCP server for AI tools |
|
|
84
|
+
| `/clean` | Remove VibeRAG from project |
|
|
85
|
+
| `/help` | Show all commands |
|
|
86
|
+
|
|
87
|
+
## Embedding Providers
|
|
88
|
+
|
|
89
|
+
Choose your embedding provider during `/init`:
|
|
90
|
+
|
|
91
|
+
### Local Model - Offline, Free
|
|
92
|
+
|
|
93
|
+
| Model | Quant | Download | RAM |
|
|
94
|
+
| ---------- | ----- | -------- | ----- |
|
|
95
|
+
| Qwen3-0.6B | Q8 | ~700MB | ~10GB |
|
|
96
|
+
|
|
97
|
+
- Works completely offline, no API key required
|
|
98
|
+
- Initial indexing may take time; future updates are incremental
|
|
99
|
+
|
|
100
|
+
### Cloud Providers - Fastest, Best Quality
|
|
101
|
+
|
|
102
|
+
| Provider | Model | Dims | Cost | Get API Key |
|
|
103
|
+
| -------- | ---------------------- | ---- | --------- | ------------------------------------------------------------------------------ |
|
|
104
|
+
| Gemini | gemini-embedding-001 | 1536 | Free tier | [Google AI Studio](https://aistudio.google.com) |
|
|
105
|
+
| Mistral | codestral-embed | 1024 | $0.10/1M | [Mistral Console](https://console.mistral.ai/api-keys/) |
|
|
106
|
+
| OpenAI | text-embedding-3-small | 1536 | $0.02/1M | [OpenAI Platform](https://platform.openai.com/api-keys) |
|
|
107
|
+
|
|
108
|
+
- **Gemini** - Free tier available, great for getting started
|
|
109
|
+
- **Mistral** - Code-optimized embeddings for technical content
|
|
110
|
+
- **OpenAI** - Fast and reliable with low cost
|
|
111
|
+
|
|
112
|
+
API keys are entered during the `/init` wizard and stored securely in `.viberag/config.json` (automatically added to `.gitignore`).
|
|
113
|
+
|
|
114
|
+
## How It Works
|
|
115
|
+
|
|
116
|
+
1. **Parsing** - Tree-sitter extracts functions, classes, and semantic chunks
|
|
117
|
+
2. **Embedding** - Code chunks are embedded using local or API-based models
|
|
118
|
+
3. **Storage** - Vectors stored in LanceDB (local, no server required)
|
|
119
|
+
4. **Search** - Hybrid search combines vector similarity + full-text search
|
|
120
|
+
5. **MCP** - AI tools query the index via the MCP protocol
|
|
121
|
+
|
|
122
|
+
## AI Agent Best Practices
|
|
123
|
+
|
|
124
|
+
VibeRAG works best when AI agents use **sub-agents for exploration tasks**. This keeps the main conversation context clean and uses ~8x fewer tokens.
|
|
125
|
+
|
|
126
|
+
### Why Sub-Agents?
|
|
127
|
+
|
|
128
|
+
When an AI calls viberag directly, all search results expand the main context. Sub-agents run searches in isolated context windows and return only concise summaries.
|
|
129
|
+
|
|
130
|
+
| Approach | Context Usage | Token Efficiency |
|
|
131
|
+
|----------|---------------|------------------|
|
|
132
|
+
| Direct viberag calls | 24k tokens | Baseline |
|
|
133
|
+
| Sub-agent delegation | 3k tokens | **8x better** |
|
|
134
|
+
|
|
135
|
+
### Platform-Specific Guidance
|
|
136
|
+
|
|
137
|
+
#### Claude Code
|
|
138
|
+
```
|
|
139
|
+
# For exploration tasks, use the Task tool:
|
|
140
|
+
Task(subagent_type='Explore', prompt='Use viberag to find how authentication works')
|
|
141
|
+
|
|
142
|
+
# For parallel comprehensive search:
|
|
143
|
+
Task(subagent_type='Explore', prompt='Search auth patterns') # runs in parallel
|
|
144
|
+
Task(subagent_type='Explore', prompt='Search login flows') # with this one
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Add to your `CLAUDE.md`:
|
|
148
|
+
```markdown
|
|
149
|
+
When exploring the codebase, use Task(subagent_type='Explore') and instruct it
|
|
150
|
+
to use codebase_search or codebase_parallel_search. This keeps the main context clean.
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
#### VS Code Copilot
|
|
154
|
+
- Use **Agent HQ** to delegate exploration to background agents
|
|
155
|
+
- Background agents can iterate with viberag without blocking your session
|
|
156
|
+
- Use `/delegate` to hand off exploration tasks to Copilot coding agent
|
|
157
|
+
|
|
158
|
+
#### Cursor
|
|
159
|
+
- Enable **Agent mode** for multi-step exploration
|
|
160
|
+
- Agent mode can orchestrate multiple viberag searches autonomously
|
|
161
|
+
- Consider the [Sub-Agents MCP server](https://playbooks.com/mcp/shinpr-sub-agents) for Claude Code-style delegation
|
|
162
|
+
|
|
163
|
+
#### Windsurf
|
|
164
|
+
- **Cascade** automatically plans multi-step tasks
|
|
165
|
+
- Enable **Turbo Mode** for autonomous exploration
|
|
166
|
+
- Cascade's planning agent will orchestrate viberag calls efficiently
|
|
167
|
+
|
|
168
|
+
#### Roo Code
|
|
169
|
+
- Use **Architect mode** for exploration and understanding
|
|
170
|
+
- **Boomerang tasks** coordinate complex multi-mode workflows
|
|
171
|
+
- Each mode (Architect, Code, Debug) can use viberag with focused context
|
|
172
|
+
|
|
173
|
+
#### Gemini CLI
|
|
174
|
+
- Create **extensions** that scope viberag tools for specific tasks
|
|
175
|
+
- Extensions can bundle viberag with custom prompts for specialized exploration
|
|
176
|
+
- Use `gemini mcp add viberag` then reference in extension configs
|
|
177
|
+
|
|
178
|
+
#### OpenAI Codex
|
|
179
|
+
- Use **Agents SDK** to orchestrate viberag as an MCP tool
|
|
180
|
+
- Codex can run as an MCP server itself for multi-agent setups
|
|
181
|
+
- Approval modes control how autonomously Codex explores
|
|
182
|
+
|
|
183
|
+
#### JetBrains IDEs
|
|
184
|
+
- **Junie** agent handles multi-step exploration autonomously
|
|
185
|
+
- **Claude Agent** integration provides sub-agent-like capabilities
|
|
186
|
+
- Access viberag through AI Chat with multi-agent support
|
|
187
|
+
|
|
188
|
+
#### Zed
|
|
189
|
+
- Use **External Agents** (Claude Code, Codex, Gemini CLI) for exploration
|
|
190
|
+
- Set `auto_approve` in settings for autonomous agent operation
|
|
191
|
+
- ACP (Agent Client Protocol) enables BYO agent integration
|
|
192
|
+
|
|
193
|
+
### Quick Lookup vs Exploration
|
|
194
|
+
|
|
195
|
+
| Task Type | Recommended Approach |
|
|
196
|
+
|-----------|---------------------|
|
|
197
|
+
| "Where is function X defined?" | Direct `codebase_search` with mode='definition' |
|
|
198
|
+
| "What file handles Y?" | Direct `codebase_search` - single query |
|
|
199
|
+
| "How does authentication work?" | **Sub-agent** - needs multiple searches |
|
|
200
|
+
| "Find all API endpoints" | **Sub-agent** or `codebase_parallel_search` |
|
|
201
|
+
| "Understand the data flow" | **Sub-agent** - iterative exploration |
|
|
202
|
+
|
|
203
|
+
### For Platforms Without Sub-Agents
|
|
204
|
+
|
|
205
|
+
Use `codebase_parallel_search` to run multiple search strategies in a single call:
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
{
|
|
209
|
+
"searches": [
|
|
210
|
+
{"query": "authentication", "mode": "semantic"},
|
|
211
|
+
{"query": "auth login", "mode": "exact"},
|
|
212
|
+
{"query": "user session", "mode": "hybrid", "bm25_weight": 0.5}
|
|
213
|
+
],
|
|
214
|
+
"merge_results": true,
|
|
215
|
+
"merge_strategy": "rrf"
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
This provides comprehensive coverage without multiple round-trips.
|