codebaxing 0.2.0 → 0.2.2
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 +240 -304
- package/README.vi.md +241 -305
- package/dist/cli/installer.d.ts +5 -5
- package/dist/cli/installer.js +202 -122
- package/dist/cli/installer.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,15 +3,28 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/codebaxing)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
+
**[English](README.md)** | [Tiếng Việt](README.vi.md)
|
|
7
|
+
|
|
6
8
|
MCP server for **semantic code search**. Index your codebase and search using natural language queries.
|
|
7
9
|
|
|
10
|
+
## Table of Contents
|
|
11
|
+
|
|
12
|
+
- [The Idea](#the-idea)
|
|
13
|
+
- [Quick Start](#quick-start)
|
|
14
|
+
- [Usage](#usage)
|
|
15
|
+
- [Via AI Agents (MCP)](#via-ai-agents-mcp)
|
|
16
|
+
- [Via CLI (Terminal)](#via-cli-terminal)
|
|
17
|
+
- [Installation](#installation)
|
|
18
|
+
- [How It Works](#how-it-works)
|
|
19
|
+
- [Configuration](#configuration)
|
|
20
|
+
- [Supported Languages](#supported-languages)
|
|
21
|
+
|
|
8
22
|
## The Idea
|
|
9
23
|
|
|
10
24
|
Traditional code search (grep, ripgrep) matches exact text. But developers think in concepts:
|
|
11
25
|
|
|
12
26
|
- *"Where is the authentication logic?"* - not `grep "authentication"`
|
|
13
27
|
- *"Find database connection code"* - not `grep "database"`
|
|
14
|
-
- *"How does error handling work?"* - not `grep "error"`
|
|
15
28
|
|
|
16
29
|
**Codebaxing** bridges this gap using **semantic search**:
|
|
17
30
|
|
|
@@ -22,216 +35,173 @@ Finds: login(), validateCredentials(), checkPassword(), authMiddleware()
|
|
|
22
35
|
(even if they don't contain the word "authentication")
|
|
23
36
|
```
|
|
24
37
|
|
|
25
|
-
##
|
|
38
|
+
## Quick Start
|
|
26
39
|
|
|
27
|
-
###
|
|
40
|
+
### 1. Install to your AI editor
|
|
28
41
|
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
│ Source Files (.py, .ts, .js, .go, .rs, ...) │
|
|
35
|
-
│ │ │
|
|
36
|
-
│ ▼ │
|
|
37
|
-
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
|
|
38
|
-
│ │ Tree-sitter │───▶│ Symbols │───▶│ Embedding │ │
|
|
39
|
-
│ │ Parser │ │ Extraction │ │ Model │ │
|
|
40
|
-
│ └──────────────┘ └──────────────┘ └──────────────┘ │
|
|
41
|
-
│ │ │ │ │
|
|
42
|
-
│ Parse AST Functions, Text → Vector │
|
|
43
|
-
│ Classes, etc. (384 dimensions) │
|
|
44
|
-
│ │ │
|
|
45
|
-
│ ▼ │
|
|
46
|
-
│ ┌──────────────┐ │
|
|
47
|
-
│ │ ChromaDB │ │
|
|
48
|
-
│ │ (vectors) │ │
|
|
49
|
-
│ └──────────────┘ │
|
|
50
|
-
│ │
|
|
51
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
52
|
-
|
|
53
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
54
|
-
│ SEARCH │
|
|
55
|
-
├─────────────────────────────────────────────────────────────────┤
|
|
56
|
-
│ │
|
|
57
|
-
│ "find auth code" │
|
|
58
|
-
│ │ │
|
|
59
|
-
│ ▼ │
|
|
60
|
-
│ ┌──────────────┐ ┌──────────────┐ │
|
|
61
|
-
│ │ Embedding │────────▶│ ChromaDB │ │
|
|
62
|
-
│ │ Model │ query │ Query │ │
|
|
63
|
-
│ └──────────────┘ vector └──────────────┘ │
|
|
64
|
-
│ │ │
|
|
65
|
-
│ ▼ │
|
|
66
|
-
│ Cosine Similarity │
|
|
67
|
-
│ │ │
|
|
68
|
-
│ ▼ │
|
|
69
|
-
│ Top-k Results │
|
|
70
|
-
│ (login.py, auth.ts, ...) │
|
|
71
|
-
│ │
|
|
72
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
42
|
+
```bash
|
|
43
|
+
npx codebaxing install # Claude Desktop
|
|
44
|
+
npx codebaxing install --cursor # Cursor
|
|
45
|
+
npx codebaxing install --windsurf # Windsurf
|
|
46
|
+
npx codebaxing install --all # All editors
|
|
73
47
|
```
|
|
74
48
|
|
|
75
|
-
###
|
|
49
|
+
### 2. Restart your editor
|
|
76
50
|
|
|
77
|
-
|
|
51
|
+
### 3. Start using
|
|
78
52
|
|
|
79
|
-
|
|
53
|
+
In Claude Desktop (or Cursor, Windsurf...):
|
|
80
54
|
|
|
81
|
-
```python
|
|
82
|
-
# Input: auth.py
|
|
83
|
-
def login(username, password):
|
|
84
|
-
"""Authenticate user credentials"""
|
|
85
|
-
if validate(username, password):
|
|
86
|
-
return create_session(username)
|
|
87
|
-
raise AuthError("Invalid credentials")
|
|
88
55
|
```
|
|
56
|
+
You: Index my project at /path/to/myproject
|
|
57
|
+
Claude: [calls index tool]
|
|
89
58
|
|
|
59
|
+
You: Find the authentication logic
|
|
60
|
+
Claude: [calls search tool, returns relevant code]
|
|
90
61
|
```
|
|
91
|
-
# Output: Symbol
|
|
92
|
-
{
|
|
93
|
-
name: "login",
|
|
94
|
-
type: "function",
|
|
95
|
-
signature: "def login(username, password)",
|
|
96
|
-
code: "def login(username, password):...",
|
|
97
|
-
filepath: "auth.py",
|
|
98
|
-
lineStart: 1,
|
|
99
|
-
lineEnd: 6
|
|
100
|
-
}
|
|
101
|
-
```
|
|
102
62
|
|
|
103
|
-
|
|
63
|
+
## Usage
|
|
64
|
+
|
|
65
|
+
### Via AI Agents (MCP)
|
|
66
|
+
|
|
67
|
+
After installing to your AI editor, you interact through natural conversation:
|
|
104
68
|
|
|
105
|
-
|
|
69
|
+
#### Step 1: Index your codebase (Required first)
|
|
106
70
|
|
|
107
71
|
```
|
|
108
|
-
|
|
109
|
-
↓
|
|
110
|
-
Embedding Model (runs locally, ONNX)
|
|
111
|
-
↓
|
|
112
|
-
[0.12, -0.34, 0.56, 0.08, ..., -0.22] (384 numbers)
|
|
72
|
+
You: Index the codebase at /Users/me/projects/myapp
|
|
113
73
|
```
|
|
114
74
|
|
|
115
|
-
|
|
116
|
-
- `"authentication"` ≈ `"login"` ≈ `"credentials"` (vectors are close)
|
|
117
|
-
- `"database"` ≈ `"query"` ≈ `"SQL"` (vectors are close)
|
|
118
|
-
- `"authentication"` ≠ `"database"` (vectors are far apart)
|
|
75
|
+
Claude will call `index(path="/Users/me/projects/myapp")` and show progress.
|
|
119
76
|
|
|
120
|
-
|
|
77
|
+
> **Note:** First run downloads the embedding model (~90MB), takes 1-2 minutes.
|
|
121
78
|
|
|
122
|
-
|
|
79
|
+
#### Step 2: Search for code
|
|
123
80
|
|
|
124
81
|
```
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
├─────────────────────────────────────────────────────┤
|
|
129
|
-
│ chunk_001 │ [0.12, -0.34, ...] │ {file: auth.py} │
|
|
130
|
-
│ chunk_002 │ [0.45, 0.23, ...] │ {file: db.py} │
|
|
131
|
-
│ chunk_003 │ [-0.11, 0.67, ...] │ {file: api.ts} │
|
|
132
|
-
│ ... │ ... │ ... │
|
|
133
|
-
└─────────────────────────────────────────────────────┘
|
|
82
|
+
You: Find code that handles user authentication
|
|
83
|
+
You: Where is the database connection logic?
|
|
84
|
+
You: Show me error handling patterns
|
|
134
85
|
```
|
|
135
86
|
|
|
136
|
-
####
|
|
137
|
-
|
|
138
|
-
When you search, your query is embedded and compared against all stored vectors:
|
|
87
|
+
#### Step 3: Use memory (optional)
|
|
139
88
|
|
|
140
89
|
```
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
Query Vector: [0.15, -0.31, 0.52, ...]
|
|
144
|
-
↓
|
|
145
|
-
Compare with all vectors using cosine similarity:
|
|
146
|
-
- chunk_001 (login): similarity = 0.89 ← HIGH
|
|
147
|
-
- chunk_002 (db): similarity = 0.23 ← LOW
|
|
148
|
-
- chunk_003 (auth): similarity = 0.85 ← HIGH
|
|
149
|
-
↓
|
|
150
|
-
Return top-k most similar chunks
|
|
90
|
+
You: Remember that we're using PostgreSQL with Prisma ORM
|
|
91
|
+
You: What decisions have we made about the database?
|
|
151
92
|
```
|
|
152
93
|
|
|
153
|
-
|
|
94
|
+
#### MCP Tools Reference
|
|
154
95
|
|
|
155
|
-
|
|
96
|
+
| Tool | Description | Example |
|
|
97
|
+
|------|-------------|---------|
|
|
98
|
+
| `index` | Index a codebase (**required first**) | `index(path="/project")` |
|
|
99
|
+
| `search` | Semantic code search | `search(question="auth middleware")` |
|
|
100
|
+
| `stats` | Index statistics | `stats()` |
|
|
101
|
+
| `languages` | Supported extensions | `languages()` |
|
|
102
|
+
| `remember` | Store memory | `remember(content="Using Redis", memory_type="decision")` |
|
|
103
|
+
| `recall` | Retrieve memories | `recall(query="database")` |
|
|
104
|
+
| `forget` | Delete memories | `forget(memory_type="note")` |
|
|
105
|
+
| `memory-stats` | Memory statistics | `memory-stats()` |
|
|
156
106
|
|
|
157
|
-
|
|
158
|
-
|-----------|--------------|----------|
|
|
159
|
-
| authentication | login, credentials, auth, signin | Close |
|
|
160
|
-
| database | query, SQL, connection, ORM | Close |
|
|
161
|
-
| error | exception, failure, catch, throw | Close |
|
|
162
|
-
| parse | tokenize, lexer, AST, syntax | Close |
|
|
107
|
+
### Via CLI (Terminal)
|
|
163
108
|
|
|
164
|
-
|
|
109
|
+
You can use Codebaxing directly from terminal without AI agents:
|
|
165
110
|
|
|
166
|
-
|
|
111
|
+
#### Step 1: Index your codebase (Required first)
|
|
167
112
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
- **Incremental Indexing**: Only re-index changed files
|
|
172
|
-
- **100% Local**: No API calls, no cloud, works offline
|
|
173
|
-
- **GPU Acceleration**: Optional WebGPU/CUDA support
|
|
113
|
+
```bash
|
|
114
|
+
npx codebaxing index /path/to/project
|
|
115
|
+
```
|
|
174
116
|
|
|
175
|
-
|
|
117
|
+
Output:
|
|
118
|
+
```
|
|
119
|
+
🔧 Codebaxing - Index Codebase
|
|
120
|
+
|
|
121
|
+
📁 Path: /path/to/project
|
|
122
|
+
|
|
123
|
+
================================================================================
|
|
124
|
+
INDEXING CODEBASE
|
|
125
|
+
================================================================================
|
|
126
|
+
Found 47 files
|
|
127
|
+
Parsed 645 symbols from 47 files
|
|
128
|
+
Generating embeddings for 645 chunks...
|
|
129
|
+
Model loaded: Xenova/all-MiniLM-L6-v2 (384 dims, CPU)
|
|
130
|
+
|
|
131
|
+
================================================================================
|
|
132
|
+
INDEXING COMPLETE
|
|
133
|
+
================================================================================
|
|
134
|
+
Files parsed: 47
|
|
135
|
+
Symbols extracted: 645
|
|
136
|
+
Chunks created: 645
|
|
137
|
+
Time elapsed: 21.9s
|
|
138
|
+
```
|
|
176
139
|
|
|
177
|
-
|
|
178
|
-
- ~500MB disk space for embedding model (downloaded on first run)
|
|
140
|
+
#### Step 2: Search for code
|
|
179
141
|
|
|
180
|
-
|
|
142
|
+
```bash
|
|
143
|
+
npx codebaxing search "authentication middleware"
|
|
144
|
+
npx codebaxing search "database connection" --path ./src --limit 10
|
|
145
|
+
```
|
|
181
146
|
|
|
182
|
-
|
|
147
|
+
Output:
|
|
148
|
+
```
|
|
149
|
+
🔧 Codebaxing - Search
|
|
183
150
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
151
|
+
📁 Path: /path/to/project
|
|
152
|
+
🔍 Query: "authentication middleware"
|
|
153
|
+
📊 Limit: 5
|
|
187
154
|
|
|
188
|
-
|
|
189
|
-
|
|
155
|
+
────────────────────────────────────────────────────────────
|
|
156
|
+
Results:
|
|
190
157
|
|
|
191
|
-
|
|
192
|
-
|
|
158
|
+
1. src/middleware/auth.ts:15 - authMiddleware()
|
|
159
|
+
2. src/services/auth.ts:42 - validateToken()
|
|
160
|
+
3. src/routes/login.ts:8 - loginHandler()
|
|
193
161
|
|
|
194
|
-
|
|
195
|
-
npx codebaxing install --all
|
|
162
|
+
────────────────────────────────────────────────────────────
|
|
196
163
|
```
|
|
197
164
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
### Uninstall
|
|
165
|
+
#### Step 3: Check statistics
|
|
201
166
|
|
|
202
167
|
```bash
|
|
203
|
-
npx codebaxing
|
|
204
|
-
npx codebaxing uninstall --all # Remove from all editors
|
|
168
|
+
npx codebaxing stats /path/to/project
|
|
205
169
|
```
|
|
206
170
|
|
|
207
|
-
|
|
171
|
+
#### CLI Commands Reference
|
|
208
172
|
|
|
209
|
-
|
|
173
|
+
| Command | Description |
|
|
174
|
+
|---------|-------------|
|
|
175
|
+
| `npx codebaxing install [--editor]` | Install MCP server to AI editor |
|
|
176
|
+
| `npx codebaxing uninstall [--editor]` | Uninstall MCP server |
|
|
177
|
+
| `npx codebaxing index <path>` | Index a codebase |
|
|
178
|
+
| `npx codebaxing search <query> [options]` | Search indexed codebase |
|
|
179
|
+
| `npx codebaxing stats [path]` | Show index statistics |
|
|
180
|
+
| `npx codebaxing --help` | Show help |
|
|
210
181
|
|
|
211
|
-
|
|
182
|
+
**Search options:**
|
|
183
|
+
- `--path, -p <path>` - Codebase path (default: current directory)
|
|
184
|
+
- `--limit, -n <number>` - Number of results (default: 5)
|
|
212
185
|
|
|
213
|
-
|
|
186
|
+
## Installation
|
|
214
187
|
|
|
215
|
-
|
|
188
|
+
### Option 1: Quick Install (Recommended)
|
|
216
189
|
|
|
217
190
|
```bash
|
|
218
|
-
#
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
191
|
+
npx codebaxing install # Claude Desktop (default)
|
|
192
|
+
npx codebaxing install --cursor # Cursor
|
|
193
|
+
npx codebaxing install --windsurf # Windsurf (Codeium)
|
|
194
|
+
npx codebaxing install --zed # Zed
|
|
195
|
+
npx codebaxing install --all # All supported editors
|
|
223
196
|
```
|
|
224
197
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
#### Configure Claude Desktop
|
|
198
|
+
Then restart your editor.
|
|
228
199
|
|
|
229
|
-
|
|
200
|
+
### Option 2: Manual Configuration
|
|
230
201
|
|
|
231
|
-
|
|
232
|
-
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
202
|
+
#### Claude Desktop
|
|
233
203
|
|
|
234
|
-
|
|
204
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
235
205
|
|
|
236
206
|
```json
|
|
237
207
|
{
|
|
@@ -244,60 +214,24 @@ Add to your Claude Desktop config file:
|
|
|
244
214
|
}
|
|
245
215
|
```
|
|
246
216
|
|
|
247
|
-
####
|
|
248
|
-
|
|
249
|
-
```bash
|
|
250
|
-
npm install -g codebaxing
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
```json
|
|
254
|
-
{
|
|
255
|
-
"mcpServers": {
|
|
256
|
-
"codebaxing": {
|
|
257
|
-
"command": "codebaxing"
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
```
|
|
217
|
+
#### Cursor
|
|
262
218
|
|
|
263
|
-
|
|
219
|
+
Add to `~/.cursor/mcp.json`:
|
|
264
220
|
|
|
265
221
|
```json
|
|
266
222
|
{
|
|
267
223
|
"mcpServers": {
|
|
268
224
|
"codebaxing": {
|
|
269
225
|
"command": "npx",
|
|
270
|
-
"args": ["-y", "codebaxing"]
|
|
271
|
-
"env": {
|
|
272
|
-
"CHROMADB_URL": "http://localhost:8000"
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
#### From source (development):
|
|
280
|
-
|
|
281
|
-
```json
|
|
282
|
-
{
|
|
283
|
-
"mcpServers": {
|
|
284
|
-
"codebaxing": {
|
|
285
|
-
"command": "node",
|
|
286
|
-
"args": ["/path/to/codebaxing/dist/mcp/server.js"]
|
|
226
|
+
"args": ["-y", "codebaxing"]
|
|
287
227
|
}
|
|
288
228
|
}
|
|
289
229
|
}
|
|
290
230
|
```
|
|
291
231
|
|
|
292
|
-
|
|
232
|
+
#### Windsurf
|
|
293
233
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
### Other AI Agents Integration
|
|
297
|
-
|
|
298
|
-
#### Cursor
|
|
299
|
-
|
|
300
|
-
Add to Cursor settings (`~/.cursor/mcp.json`):
|
|
234
|
+
Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
301
235
|
|
|
302
236
|
```json
|
|
303
237
|
{
|
|
@@ -310,16 +244,18 @@ Add to Cursor settings (`~/.cursor/mcp.json`):
|
|
|
310
244
|
}
|
|
311
245
|
```
|
|
312
246
|
|
|
313
|
-
####
|
|
247
|
+
#### Zed
|
|
314
248
|
|
|
315
|
-
Add to
|
|
249
|
+
Add to `~/.config/zed/settings.json`:
|
|
316
250
|
|
|
317
251
|
```json
|
|
318
252
|
{
|
|
319
|
-
"
|
|
253
|
+
"context_servers": {
|
|
320
254
|
"codebaxing": {
|
|
321
|
-
"command":
|
|
322
|
-
|
|
255
|
+
"command": {
|
|
256
|
+
"path": "npx",
|
|
257
|
+
"args": ["-y", "codebaxing"]
|
|
258
|
+
}
|
|
323
259
|
}
|
|
324
260
|
}
|
|
325
261
|
}
|
|
@@ -327,7 +263,7 @@ Add to Windsurf MCP config (`~/.codeium/windsurf/mcp_config.json`):
|
|
|
327
263
|
|
|
328
264
|
#### VS Code + Continue
|
|
329
265
|
|
|
330
|
-
Add to
|
|
266
|
+
Add to `~/.continue/config.json`:
|
|
331
267
|
|
|
332
268
|
```json
|
|
333
269
|
{
|
|
@@ -345,79 +281,67 @@ Add to Continue config (`~/.continue/config.json`):
|
|
|
345
281
|
}
|
|
346
282
|
```
|
|
347
283
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
Add to Zed settings (`~/.config/zed/settings.json`):
|
|
284
|
+
### Uninstall
|
|
351
285
|
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
"codebaxing": {
|
|
356
|
-
"command": {
|
|
357
|
-
"path": "npx",
|
|
358
|
-
"args": ["-y", "codebaxing"]
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
286
|
+
```bash
|
|
287
|
+
npx codebaxing uninstall # Claude Desktop
|
|
288
|
+
npx codebaxing uninstall --all # All editors
|
|
363
289
|
```
|
|
364
290
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
For any MCP-compatible client, use stdio transport:
|
|
291
|
+
## How It Works
|
|
368
292
|
|
|
369
|
-
|
|
370
|
-
# Command
|
|
371
|
-
npx -y codebaxing
|
|
293
|
+
### Architecture
|
|
372
294
|
|
|
373
|
-
# Or if installed globally
|
|
374
|
-
codebaxing
|
|
375
295
|
```
|
|
296
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
297
|
+
│ INDEXING │
|
|
298
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
299
|
+
│ Source Files (.py, .ts, .js, .go, .rs, ...) │
|
|
300
|
+
│ │ │
|
|
301
|
+
│ ▼ │
|
|
302
|
+
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
|
|
303
|
+
│ │ Tree-sitter │───▶│ Symbols │───▶│ Embedding │ │
|
|
304
|
+
│ │ Parser │ │ Extraction │ │ Model │ │
|
|
305
|
+
│ └──────────────┘ └──────────────┘ └──────────────┘ │
|
|
306
|
+
│ │ │ │ │
|
|
307
|
+
│ Parse AST Functions, Text → Vector │
|
|
308
|
+
│ Classes, etc. (384 dimensions) │
|
|
309
|
+
│ │ │
|
|
310
|
+
│ ▼ │
|
|
311
|
+
│ ┌──────────────┐ │
|
|
312
|
+
│ │ ChromaDB │ │
|
|
313
|
+
│ │ (vectors) │ │
|
|
314
|
+
│ └──────────────┘ │
|
|
315
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
376
316
|
|
|
377
|
-
|
|
317
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
318
|
+
│ SEARCH │
|
|
319
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
320
|
+
│ "find auth code" │
|
|
321
|
+
│ │ │
|
|
322
|
+
│ ▼ │
|
|
323
|
+
│ ┌──────────────┐ ┌──────────────┐ │
|
|
324
|
+
│ │ Embedding │────────▶│ ChromaDB │ │
|
|
325
|
+
│ │ Model │ query │ Query │ │
|
|
326
|
+
│ └──────────────┘ vector └──────────────┘ │
|
|
327
|
+
│ │ │
|
|
328
|
+
│ ▼ │
|
|
329
|
+
│ Cosine Similarity │
|
|
330
|
+
│ │ │
|
|
331
|
+
│ ▼ │
|
|
332
|
+
│ Top-k Results │
|
|
333
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
334
|
+
```
|
|
378
335
|
|
|
379
|
-
###
|
|
380
|
-
|
|
381
|
-
| Tool | Description |
|
|
382
|
-
|------|-------------|
|
|
383
|
-
| `index` | Index a codebase. Modes: `auto` (incremental), `full`, `load-only` |
|
|
384
|
-
| `search` | Semantic search. Returns ranked code chunks |
|
|
385
|
-
| `stats` | Index statistics (files, symbols, chunks) |
|
|
386
|
-
| `languages` | List supported file extensions |
|
|
387
|
-
| `remember` | Store memories (conversation, status, decision, preference, doc, note) |
|
|
388
|
-
| `recall` | Semantic search over memories |
|
|
389
|
-
| `forget` | Delete memories by ID, type, tags, or age |
|
|
390
|
-
| `memory-stats` | Memory statistics by type |
|
|
391
|
-
|
|
392
|
-
### Example Workflow
|
|
393
|
-
|
|
394
|
-
1. **Index your codebase:**
|
|
395
|
-
```
|
|
396
|
-
index(path="/path/to/your/project")
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
2. **Search for code:**
|
|
400
|
-
```
|
|
401
|
-
search(question="authentication middleware")
|
|
402
|
-
search(question="database connection", language="typescript")
|
|
403
|
-
search(question="error handling", symbol_type="function")
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
3. **Store context:**
|
|
407
|
-
```
|
|
408
|
-
remember(content="Using PostgreSQL with Prisma ORM", memory_type="decision")
|
|
409
|
-
remember(content="Auth uses JWT tokens", memory_type="doc", tags=["auth", "security"])
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
4. **Recall context:**
|
|
413
|
-
```
|
|
414
|
-
recall(query="database setup")
|
|
415
|
-
recall(query="authentication", memory_type="decision")
|
|
416
|
-
```
|
|
336
|
+
### Why Semantic Search Works
|
|
417
337
|
|
|
418
|
-
|
|
338
|
+
The embedding model understands that:
|
|
419
339
|
|
|
420
|
-
|
|
340
|
+
| Query | Finds (even without exact match) |
|
|
341
|
+
|-------|----------------------------------|
|
|
342
|
+
| "authentication" | login, credentials, auth, signin, validateUser |
|
|
343
|
+
| "database" | query, SQL, connection, ORM, repository |
|
|
344
|
+
| "error handling" | try/catch, exception, throw, ErrorBoundary |
|
|
421
345
|
|
|
422
346
|
## Configuration
|
|
423
347
|
|
|
@@ -426,62 +350,65 @@ Python, JavaScript, TypeScript, C, C++, Bash, Go, Java, Kotlin, Rust, Ruby, C#,
|
|
|
426
350
|
| Variable | Description | Default |
|
|
427
351
|
|----------|-------------|---------|
|
|
428
352
|
| `CHROMADB_URL` | ChromaDB server URL for persistent storage | (in-memory) |
|
|
429
|
-
| `CODEBAXING_DEVICE` | Compute device
|
|
353
|
+
| `CODEBAXING_DEVICE` | Compute device: `cpu`, `webgpu`, `cuda`, `auto` | `cpu` |
|
|
430
354
|
|
|
431
|
-
###
|
|
355
|
+
### Persistent Storage
|
|
432
356
|
|
|
433
|
-
|
|
357
|
+
By default, the index is stored in memory and lost when the server restarts.
|
|
434
358
|
|
|
435
|
-
|
|
436
|
-
# WebGPU (experimental, uses Metal on macOS)
|
|
437
|
-
export CODEBAXING_DEVICE=webgpu
|
|
359
|
+
For persistent storage:
|
|
438
360
|
|
|
439
|
-
|
|
440
|
-
|
|
361
|
+
```bash
|
|
362
|
+
# Start ChromaDB
|
|
363
|
+
docker run -d -p 8000:8000 chromadb/chroma
|
|
441
364
|
|
|
442
|
-
#
|
|
443
|
-
export
|
|
365
|
+
# Set environment variable
|
|
366
|
+
export CHROMADB_URL=http://localhost:8000
|
|
444
367
|
```
|
|
445
368
|
|
|
446
|
-
|
|
369
|
+
Or in MCP config:
|
|
447
370
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
371
|
+
```json
|
|
372
|
+
{
|
|
373
|
+
"mcpServers": {
|
|
374
|
+
"codebaxing": {
|
|
375
|
+
"command": "npx",
|
|
376
|
+
"args": ["-y", "codebaxing"],
|
|
377
|
+
"env": {
|
|
378
|
+
"CHROMADB_URL": "http://localhost:8000"
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
```
|
|
454
384
|
|
|
455
|
-
|
|
385
|
+
### GPU Acceleration
|
|
456
386
|
|
|
457
387
|
```bash
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
npm test # Run tests
|
|
462
|
-
npm run typecheck # Type check without emitting
|
|
388
|
+
export CODEBAXING_DEVICE=webgpu # macOS (Metal)
|
|
389
|
+
export CODEBAXING_DEVICE=cuda # Linux/Windows (NVIDIA)
|
|
390
|
+
export CODEBAXING_DEVICE=auto # Auto-detect
|
|
463
391
|
```
|
|
464
392
|
|
|
465
|
-
|
|
393
|
+
**Note:** macOS does not support CUDA. Use `webgpu` for GPU acceleration on Mac.
|
|
466
394
|
|
|
467
|
-
|
|
468
|
-
# Run unit tests
|
|
469
|
-
npm test
|
|
395
|
+
## Supported Languages
|
|
470
396
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
397
|
+
Python, JavaScript, TypeScript, C, C++, Bash, Go, Java, Kotlin, Rust, Ruby, C#, PHP, Scala, Swift, Lua, Dart, Elixir, Haskell, OCaml, Zig, Perl, CSS, HTML, Vue, JSON, YAML, TOML, Makefile
|
|
398
|
+
|
|
399
|
+
## Features
|
|
400
|
+
|
|
401
|
+
- **Semantic Code Search**: Find code by describing what you're looking for
|
|
402
|
+
- **24+ Languages**: Python, TypeScript, JavaScript, Go, Rust, Java, C/C++, and more
|
|
403
|
+
- **Memory Layer**: Store and recall project context across sessions
|
|
404
|
+
- **Incremental Indexing**: Only re-index changed files
|
|
405
|
+
- **100% Local**: No API calls, no cloud, works offline
|
|
406
|
+
- **GPU Acceleration**: Optional WebGPU/CUDA support
|
|
474
407
|
|
|
475
|
-
##
|
|
408
|
+
## Requirements
|
|
476
409
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
| Query | Exact text match | Natural language |
|
|
480
|
-
| "authentication" | Only finds "authentication" | Finds login, auth, credentials, etc. |
|
|
481
|
-
| Understands context | No | Yes |
|
|
482
|
-
| Finds synonyms | No | Yes |
|
|
483
|
-
| Speed | Very fast | Fast (after indexing) |
|
|
484
|
-
| Setup | None | Requires indexing |
|
|
410
|
+
- Node.js >= 20.0.0
|
|
411
|
+
- ~500MB disk space for embedding model (downloaded on first run)
|
|
485
412
|
|
|
486
413
|
## Technical Details
|
|
487
414
|
|
|
@@ -493,6 +420,15 @@ CHROMADB_URL=http://localhost:8000 npx tsx test-indexing.ts
|
|
|
493
420
|
| Code Parser | Tree-sitter |
|
|
494
421
|
| MCP SDK | `@modelcontextprotocol/sdk` |
|
|
495
422
|
|
|
423
|
+
## Development
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
npm install # Install dependencies
|
|
427
|
+
npm run dev # Run with tsx (no build needed)
|
|
428
|
+
npm run build # Compile TypeScript
|
|
429
|
+
npm test # Run tests
|
|
430
|
+
```
|
|
431
|
+
|
|
496
432
|
## License
|
|
497
433
|
|
|
498
434
|
MIT
|