codesearch-mcp 0.2.0-alpha → 0.2.1-alpha
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/CHANGELOG.md +16 -0
- package/README.md +5 -2
- package/dist/app.js +2 -17
- package/dist/src/commands/IndexCommand.js +27 -7
- package/dist/src/db/index.d.ts +1 -1
- package/dist/src/db/index.js +2 -1
- package/dist/src/db/schema.d.ts +75 -0
- package/dist/src/db/schema.js +10 -1
- package/dist/src/enriched-prompt.d.ts +8 -0
- package/dist/src/enriched-prompt.js +87 -0
- package/dist/src/interfaces/IAstParser.d.ts +18 -2
- package/dist/src/interfaces/IDatabase.d.ts +14 -0
- package/dist/src/interfaces/ISearcher.d.ts +3 -0
- package/dist/src/services/AstParserService.d.ts +39 -7
- package/dist/src/services/AstParserService.js +504 -104
- package/dist/src/services/DatabaseService.d.ts +13 -0
- package/dist/src/services/DatabaseService.js +84 -2
- package/dist/src/services/IndexerService.d.ts +0 -14
- package/dist/src/services/IndexerService.js +29 -151
- package/dist/src/services/McpServer.js +3 -3
- package/dist/src/services/SearcherService.d.ts +24 -3
- package/dist/src/services/SearcherService.js +149 -58
- package/dist/src/symbol-name.d.ts +44 -0
- package/dist/src/symbol-name.js +68 -0
- package/dist/src/symbol-rows.d.ts +12 -0
- package/dist/src/symbol-rows.js +38 -0
- package/dist/src/tools/FindSymbolTool.js +30 -7
- package/dist/src/tools/GetCallersTool.js +20 -5
- package/docs/architecture.svg +103 -0
- package/package.json +1 -2
- package/dist/src/commands/BackfillCommand.d.ts +0 -7
- package/dist/src/commands/BackfillCommand.js +0 -37
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<svg width="840" height="320" viewBox="0 0 840 320" xmlns="http://www.w3.org/2000/svg" font-family="system-ui,-apple-system,sans-serif">
|
|
2
|
+
<defs>
|
|
3
|
+
<marker id="a" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
|
|
4
|
+
<polygon points="0 0,8 3,0 6" fill="#64748b"/>
|
|
5
|
+
</marker>
|
|
6
|
+
<marker id="ad" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
|
|
7
|
+
<polygon points="0 0,8 3,0 6" fill="#94a3b8"/>
|
|
8
|
+
</marker>
|
|
9
|
+
</defs>
|
|
10
|
+
|
|
11
|
+
<!-- Background -->
|
|
12
|
+
<rect width="840" height="320" fill="#f8fafc" rx="12"/>
|
|
13
|
+
|
|
14
|
+
<!-- ── INDEXING lane ───────────────────────────────────────────── -->
|
|
15
|
+
<rect x="12" y="12" width="816" height="128" rx="8" fill="#eff6ff" stroke="#bfdbfe" stroke-width="1"/>
|
|
16
|
+
<text x="24" y="30" font-size="10" fill="#6b7280" font-weight="700" letter-spacing="1.2">INDEXING</text>
|
|
17
|
+
|
|
18
|
+
<!-- Source files -->
|
|
19
|
+
<rect x="30" y="42" width="104" height="52" rx="6" fill="#fff" stroke="#3b82f6" stroke-width="1.5"/>
|
|
20
|
+
<text x="82" y="64" font-size="11" text-anchor="middle" fill="#1e40af" font-weight="600">Source files</text>
|
|
21
|
+
<text x="82" y="80" font-size="10" text-anchor="middle" fill="#94a3b8">.ts · .tsx · .js</text>
|
|
22
|
+
|
|
23
|
+
<line x1="134" y1="68" x2="158" y2="68" stroke="#64748b" stroke-width="1.5" marker-end="url(#a)"/>
|
|
24
|
+
|
|
25
|
+
<!-- AST parser -->
|
|
26
|
+
<rect x="160" y="42" width="120" height="52" rx="6" fill="#fff" stroke="#3b82f6" stroke-width="1.5"/>
|
|
27
|
+
<text x="220" y="64" font-size="11" text-anchor="middle" fill="#1e40af" font-weight="600">AST parser</text>
|
|
28
|
+
<text x="220" y="80" font-size="10" text-anchor="middle" fill="#94a3b8">symbols · imports</text>
|
|
29
|
+
|
|
30
|
+
<line x1="280" y1="68" x2="304" y2="68" stroke="#64748b" stroke-width="1.5" marker-end="url(#a)"/>
|
|
31
|
+
|
|
32
|
+
<!-- Chunker -->
|
|
33
|
+
<rect x="306" y="42" width="110" height="52" rx="6" fill="#fff" stroke="#3b82f6" stroke-width="1.5"/>
|
|
34
|
+
<text x="361" y="64" font-size="11" text-anchor="middle" fill="#1e40af" font-weight="600">Chunker</text>
|
|
35
|
+
<text x="361" y="80" font-size="10" text-anchor="middle" fill="#94a3b8">symbol-aligned</text>
|
|
36
|
+
|
|
37
|
+
<line x1="416" y1="68" x2="440" y2="68" stroke="#64748b" stroke-width="1.5" marker-end="url(#a)"/>
|
|
38
|
+
|
|
39
|
+
<!-- Embedder -->
|
|
40
|
+
<rect x="442" y="42" width="128" height="52" rx="6" fill="#fff" stroke="#3b82f6" stroke-width="1.5"/>
|
|
41
|
+
<text x="506" y="61" font-size="11" text-anchor="middle" fill="#1e40af" font-weight="600">Embedder</text>
|
|
42
|
+
<text x="506" y="76" font-size="10" text-anchor="middle" fill="#94a3b8">Infinity · OpenAI</text>
|
|
43
|
+
<text x="506" y="89" font-size="10" text-anchor="middle" fill="#94a3b8">Voyage</text>
|
|
44
|
+
|
|
45
|
+
<line x1="570" y1="68" x2="610" y2="68" stroke="#64748b" stroke-width="1.5" marker-end="url(#a)"/>
|
|
46
|
+
|
|
47
|
+
<!-- PostgreSQL -->
|
|
48
|
+
<rect x="612" y="36" width="200" height="116" rx="8" fill="#faf5ff" stroke="#7c3aed" stroke-width="1.5"/>
|
|
49
|
+
<text x="712" y="58" font-size="11" text-anchor="middle" fill="#5b21b6" font-weight="700">PostgreSQL + pgvector</text>
|
|
50
|
+
<line x1="628" y1="66" x2="796" y2="66" stroke="#c4b5fd" stroke-width="1"/>
|
|
51
|
+
<text x="712" y="84" font-size="10" text-anchor="middle" fill="#7c3aed">code_chunk (vectors)</text>
|
|
52
|
+
<text x="712" y="100" font-size="10" text-anchor="middle" fill="#7c3aed">code_symbol</text>
|
|
53
|
+
<text x="712" y="116" font-size="10" text-anchor="middle" fill="#7c3aed">code_dependency · code_call</text>
|
|
54
|
+
|
|
55
|
+
<!-- AST → DB (graph data) dashed -->
|
|
56
|
+
<path d="M220 94 Q220 136 612 136" stroke="#94a3b8" stroke-width="1" stroke-dasharray="4,3" fill="none" marker-end="url(#ad)"/>
|
|
57
|
+
<text x="400" y="150" font-size="10" text-anchor="middle" fill="#94a3b8">symbols · import graph · call graph</text>
|
|
58
|
+
|
|
59
|
+
<!-- ── QUERY lane ──────────────────────────────────────────────── -->
|
|
60
|
+
<rect x="12" y="182" width="816" height="126" rx="8" fill="#f0fdf4" stroke="#bbf7d0" stroke-width="1"/>
|
|
61
|
+
<text x="24" y="200" font-size="10" fill="#6b7280" font-weight="700" letter-spacing="1.2">QUERY</text>
|
|
62
|
+
|
|
63
|
+
<!-- Claude -->
|
|
64
|
+
<ellipse cx="72" cy="248" rx="52" ry="28" fill="#fff" stroke="#f97316" stroke-width="1.5"/>
|
|
65
|
+
<text x="72" y="244" font-size="11" text-anchor="middle" fill="#9a3412" font-weight="600">Claude</text>
|
|
66
|
+
<text x="72" y="259" font-size="10" text-anchor="middle" fill="#94a3b8">AI agent</text>
|
|
67
|
+
|
|
68
|
+
<line x1="124" y1="248" x2="152" y2="248" stroke="#64748b" stroke-width="1.5" marker-end="url(#a)"/>
|
|
69
|
+
|
|
70
|
+
<!-- rag-mcp -->
|
|
71
|
+
<rect x="154" y="224" width="110" height="48" rx="6" fill="#fff" stroke="#f97316" stroke-width="1.5"/>
|
|
72
|
+
<text x="209" y="244" font-size="11" text-anchor="middle" fill="#9a3412" font-weight="600">rag-mcp</text>
|
|
73
|
+
<text x="209" y="260" font-size="10" text-anchor="middle" fill="#94a3b8">MCP server</text>
|
|
74
|
+
|
|
75
|
+
<line x1="264" y1="248" x2="292" y2="248" stroke="#64748b" stroke-width="1.5" marker-end="url(#a)"/>
|
|
76
|
+
|
|
77
|
+
<!-- Embed query -->
|
|
78
|
+
<rect x="294" y="224" width="110" height="48" rx="6" fill="#fff" stroke="#22c55e" stroke-width="1.5"/>
|
|
79
|
+
<text x="349" y="244" font-size="11" text-anchor="middle" fill="#166534" font-weight="600">Embed query</text>
|
|
80
|
+
<text x="349" y="260" font-size="10" text-anchor="middle" fill="#94a3b8">query vector</text>
|
|
81
|
+
|
|
82
|
+
<line x1="404" y1="248" x2="432" y2="248" stroke="#64748b" stroke-width="1.5" marker-end="url(#a)"/>
|
|
83
|
+
|
|
84
|
+
<!-- HNSW search -->
|
|
85
|
+
<rect x="434" y="224" width="118" height="48" rx="6" fill="#fff" stroke="#22c55e" stroke-width="1.5"/>
|
|
86
|
+
<text x="493" y="244" font-size="11" text-anchor="middle" fill="#166534" font-weight="600">HNSW search</text>
|
|
87
|
+
<text x="493" y="260" font-size="10" text-anchor="middle" fill="#94a3b8">cosine distance</text>
|
|
88
|
+
|
|
89
|
+
<!-- DB → HNSW dashed -->
|
|
90
|
+
<line x1="712" y1="152" x2="712" y2="178" stroke="#94a3b8" stroke-width="1" stroke-dasharray="4,3"/>
|
|
91
|
+
<line x1="712" y1="178" x2="550" y2="224" stroke="#94a3b8" stroke-width="1" stroke-dasharray="4,3" marker-end="url(#ad)"/>
|
|
92
|
+
|
|
93
|
+
<line x1="552" y1="248" x2="580" y2="248" stroke="#64748b" stroke-width="1.5" marker-end="url(#a)"/>
|
|
94
|
+
|
|
95
|
+
<!-- Reranker -->
|
|
96
|
+
<rect x="582" y="224" width="118" height="48" rx="6" fill="#fff" stroke="#22c55e" stroke-width="1.5"/>
|
|
97
|
+
<text x="641" y="244" font-size="11" text-anchor="middle" fill="#166534" font-weight="600">Reranker</text>
|
|
98
|
+
<text x="641" y="260" font-size="10" text-anchor="middle" fill="#94a3b8">cross-encoder</text>
|
|
99
|
+
|
|
100
|
+
<!-- Reranker → Claude return arc -->
|
|
101
|
+
<path d="M700 262 Q760 296 720 296 Q440 296 140 296 Q114 296 72 276" stroke="#64748b" stroke-width="1.5" fill="none" marker-end="url(#a)"/>
|
|
102
|
+
<text x="430" y="309" font-size="10" text-anchor="middle" fill="#94a3b8">top results + symbol breadcrumbs</text>
|
|
103
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codesearch-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1-alpha",
|
|
4
4
|
"description": "Local semantic codebase search via MCP — indexes projects into pgvector, exposes search to Claude",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"start:web": "ts-node app.ts web",
|
|
43
43
|
"index:workspace": "ts-node app.ts index",
|
|
44
44
|
"index:reindex": "ts-node app.ts index --reindex",
|
|
45
|
-
"index:backfill": "ts-node app.ts backfill",
|
|
46
45
|
"typecheck": "tsc --noEmit",
|
|
47
46
|
"test": "vitest run",
|
|
48
47
|
"test:watch": "vitest",
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BackfillCommand = void 0;
|
|
4
|
-
const interrupt_1 = require("../interrupt");
|
|
5
|
-
class BackfillCommand {
|
|
6
|
-
container;
|
|
7
|
-
constructor(container) {
|
|
8
|
-
this.container = container;
|
|
9
|
-
}
|
|
10
|
-
async execute() {
|
|
11
|
-
const { db, indexer } = this.container;
|
|
12
|
-
await db.initDbWithSchema();
|
|
13
|
-
const doCalls = process.argv.includes('--calls');
|
|
14
|
-
const controller = new AbortController();
|
|
15
|
-
const teardown = (0, interrupt_1.setupInterrupt)(controller);
|
|
16
|
-
try {
|
|
17
|
-
if (doCalls) {
|
|
18
|
-
console.log('Backfilling call graph...\n');
|
|
19
|
-
const stats = await indexer.backfillCalls(controller.signal);
|
|
20
|
-
if (controller.signal.aborted)
|
|
21
|
-
console.log('\nBackfill interrupted.');
|
|
22
|
-
console.log(`\nDone. Total: ${stats.total}, Processed: ${stats.processed}, Skipped (not on disk): ${stats.skipped}, Failed: ${stats.failed}`);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
console.log('Backfilling symbol index...\n');
|
|
26
|
-
const stats = await indexer.backfillSymbols(controller.signal);
|
|
27
|
-
if (controller.signal.aborted)
|
|
28
|
-
console.log('\nBackfill interrupted.');
|
|
29
|
-
console.log(`\nDone. Total: ${stats.total}, Processed: ${stats.processed}, Skipped (not on disk): ${stats.skipped}, Failed: ${stats.failed}`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
finally {
|
|
33
|
-
teardown();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.BackfillCommand = BackfillCommand;
|