opencode-codebase-index 0.4.0 → 0.5.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/README.md +55 -3
- package/dist/cli.cjs +4862 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.js +4867 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +697 -355
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +699 -356
- package/dist/index.js.map +1 -1
- package/native/codebase-index-native.darwin-arm64.node +0 -0
- package/native/codebase-index-native.darwin-x64.node +0 -0
- package/native/codebase-index-native.linux-arm64-gnu.node +0 -0
- package/native/codebase-index-native.linux-x64-gnu.node +0 -0
- package/native/codebase-index-native.win32-x64-msvc.node +0 -0
- package/package.json +23 -4
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **Stop grepping for concepts. Start searching for meaning.**
|
|
10
10
|
|
|
11
|
-
**opencode-codebase-index** brings semantic understanding to your [OpenCode](https://opencode.ai) workflow. Instead of guessing function names or grepping for keywords, ask your codebase questions in plain English.
|
|
11
|
+
**opencode-codebase-index** brings semantic understanding to your [OpenCode](https://opencode.ai) workflow — and now to any MCP-compatible client like Cursor, Claude Code, and Windsurf. Instead of guessing function names or grepping for keywords, ask your codebase questions in plain English.
|
|
12
12
|
|
|
13
13
|
## 🚀 Why Use This?
|
|
14
14
|
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
- ⚡ **Blazing Fast Indexing**: Powered by a Rust native module using `tree-sitter` and `usearch`. Incremental updates take milliseconds.
|
|
17
17
|
- 🌿 **Branch-Aware**: Seamlessly handles git branch switches — reuses embeddings, filters stale results.
|
|
18
18
|
- 🔒 **Privacy Focused**: Your vector index is stored locally in your project.
|
|
19
|
-
|
|
19
|
+
🔌 **Model Agnostic**: Works out-of-the-box with GitHub Copilot, OpenAI, Gemini, or local Ollama models.
|
|
20
|
+
🌐 **MCP Server**: Use with Cursor, Claude Code, Windsurf, or any MCP-compatible client — index once, search from anywhere.
|
|
20
21
|
|
|
21
22
|
## ⚡ Quick Start
|
|
22
23
|
|
|
@@ -39,6 +40,52 @@
|
|
|
39
40
|
Ask:
|
|
40
41
|
> "Find the function that handles credit card validation errors"
|
|
41
42
|
|
|
43
|
+
## 🌐 MCP Server (Cursor, Claude Code, Windsurf, etc.)
|
|
44
|
+
|
|
45
|
+
Use the same semantic search from any MCP-compatible client. Index once, search from anywhere.
|
|
46
|
+
|
|
47
|
+
1. **Install dependencies**
|
|
48
|
+
```bash
|
|
49
|
+
npm install opencode-codebase-index @modelcontextprotocol/sdk zod
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
2. **Configure your MCP client**
|
|
53
|
+
|
|
54
|
+
**Cursor** (`.cursor/mcp.json`):
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"mcpServers": {
|
|
58
|
+
"codebase-index": {
|
|
59
|
+
"command": "npx",
|
|
60
|
+
"args": ["opencode-codebase-index-mcp", "--project", "/path/to/your/project"]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Claude Code** (`claude_desktop_config.json`):
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"mcpServers": {
|
|
70
|
+
"codebase-index": {
|
|
71
|
+
"command": "npx",
|
|
72
|
+
"args": ["opencode-codebase-index-mcp", "--project", "/path/to/your/project"]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
3. **CLI options**
|
|
79
|
+
```bash
|
|
80
|
+
npx opencode-codebase-index-mcp --project /path/to/repo # specify project root
|
|
81
|
+
npx opencode-codebase-index-mcp --config /path/to/config # custom config file
|
|
82
|
+
npx opencode-codebase-index-mcp # uses current directory
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The MCP server exposes all 8 tools (`codebase_search`, `codebase_peek`, `find_similar`, `index_codebase`, `index_status`, `index_health_check`, `index_metrics`, `index_logs`) and 4 prompts (`search`, `find`, `index`, `status`).
|
|
86
|
+
|
|
87
|
+
The MCP dependencies (`@modelcontextprotocol/sdk`, `zod`) are optional peer dependencies — they're only needed if you use the MCP server.
|
|
88
|
+
|
|
42
89
|
## 🔍 See It In Action
|
|
43
90
|
|
|
44
91
|
**Scenario**: You're new to a codebase and need to fix a bug in the payment flow.
|
|
@@ -131,6 +178,7 @@ graph TD
|
|
|
131
178
|
- **Native speed**: Core logic written in Rust for maximum performance
|
|
132
179
|
- **Memory efficient**: F16 vector quantization reduces index size by 50%
|
|
133
180
|
- **Branch-aware**: Automatically tracks which chunks exist on each git branch
|
|
181
|
+
- **Provider validation**: Detects embedding provider/model changes and requires rebuild to prevent garbage results
|
|
134
182
|
|
|
135
183
|
## 🌿 Branch-Aware Indexing
|
|
136
184
|
|
|
@@ -246,7 +294,8 @@ Zero-config by default (uses `auto` mode). Customize in `.opencode/codebase-inde
|
|
|
246
294
|
"semanticOnly": false,
|
|
247
295
|
"autoGc": true,
|
|
248
296
|
"gcIntervalDays": 7,
|
|
249
|
-
"gcOrphanThreshold": 100
|
|
297
|
+
"gcOrphanThreshold": 100,
|
|
298
|
+
"requireProjectMarker": true
|
|
250
299
|
},
|
|
251
300
|
"search": {
|
|
252
301
|
"maxResults": 20,
|
|
@@ -279,6 +328,7 @@ Zero-config by default (uses `auto` mode). Customize in `.opencode/codebase-inde
|
|
|
279
328
|
| `autoGc` | `true` | Automatically run garbage collection to remove orphaned embeddings/chunks |
|
|
280
329
|
| `gcIntervalDays` | `7` | Run GC on initialization if last GC was more than N days ago |
|
|
281
330
|
| `gcOrphanThreshold` | `100` | Run GC after indexing if orphan count exceeds this threshold |
|
|
331
|
+
| `requireProjectMarker` | `true` | Require a project marker (`.git`, `package.json`, etc.) to enable file watching and auto-indexing. Prevents accidentally indexing large directories like home. Set to `false` to index any directory. |
|
|
282
332
|
| **search** | | |
|
|
283
333
|
| `maxResults` | `20` | Maximum results to return |
|
|
284
334
|
| `minScore` | `0.1` | Minimum similarity score (0-1). Lower = more results |
|
|
@@ -491,6 +541,8 @@ CI will automatically run tests and type checking on your PR.
|
|
|
491
541
|
```
|
|
492
542
|
├── src/
|
|
493
543
|
│ ├── index.ts # Plugin entry point
|
|
544
|
+
│ ├── mcp-server.ts # MCP server (Cursor, Claude Code, Windsurf)
|
|
545
|
+
│ ├── cli.ts # CLI entry for MCP stdio transport
|
|
494
546
|
│ ├── config/ # Configuration schema
|
|
495
547
|
│ ├── embeddings/ # Provider detection and API calls
|
|
496
548
|
│ ├── indexer/ # Core indexing logic + inverted index
|