@oddessentials/odd-repo-mapper 1.0.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.
Potentially problematic release.
This version of @oddessentials/odd-repo-mapper might be problematic. Click here for more details.
- package/LICENSE +21 -0
- package/README.md +45 -0
- package/dist/cli/commands/mcp.d.ts +6 -0
- package/dist/cli/commands/mcp.d.ts.map +1 -0
- package/dist/cli/commands/mcp.js +11 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/report.d.ts +6 -0
- package/dist/cli/commands/report.d.ts.map +1 -0
- package/dist/cli/commands/report.js +96 -0
- package/dist/cli/commands/report.js.map +1 -0
- package/dist/cli/commands/scan.d.ts +6 -0
- package/dist/cli/commands/scan.d.ts.map +1 -0
- package/dist/cli/commands/scan.js +118 -0
- package/dist/cli/commands/scan.js.map +1 -0
- package/dist/cli/commands/verify.d.ts +6 -0
- package/dist/cli/commands/verify.d.ts.map +1 -0
- package/dist/cli/commands/verify.js +47 -0
- package/dist/cli/commands/verify.js.map +1 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +20 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/config.d.ts +53 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +106 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/constants.d.ts +31 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/constants.js +31 -0
- package/dist/core/constants.js.map +1 -0
- package/dist/core/graph.d.ts +61 -0
- package/dist/core/graph.d.ts.map +1 -0
- package/dist/core/graph.js +163 -0
- package/dist/core/graph.js.map +1 -0
- package/dist/core/hashing.d.ts +37 -0
- package/dist/core/hashing.d.ts.map +1 -0
- package/dist/core/hashing.js +66 -0
- package/dist/core/hashing.js.map +1 -0
- package/dist/core/indexers/go.d.ts +14 -0
- package/dist/core/indexers/go.d.ts.map +1 -0
- package/dist/core/indexers/go.js +175 -0
- package/dist/core/indexers/go.js.map +1 -0
- package/dist/core/indexers/index.d.ts +39 -0
- package/dist/core/indexers/index.d.ts.map +1 -0
- package/dist/core/indexers/index.js +76 -0
- package/dist/core/indexers/index.js.map +1 -0
- package/dist/core/indexers/python.d.ts +14 -0
- package/dist/core/indexers/python.d.ts.map +1 -0
- package/dist/core/indexers/python.js +186 -0
- package/dist/core/indexers/python.js.map +1 -0
- package/dist/core/indexers/rust.d.ts +14 -0
- package/dist/core/indexers/rust.d.ts.map +1 -0
- package/dist/core/indexers/rust.js +156 -0
- package/dist/core/indexers/rust.js.map +1 -0
- package/dist/core/indexers/typescript.d.ts +19 -0
- package/dist/core/indexers/typescript.d.ts.map +1 -0
- package/dist/core/indexers/typescript.js +223 -0
- package/dist/core/indexers/typescript.js.map +1 -0
- package/dist/core/reports/coverage.d.ts +38 -0
- package/dist/core/reports/coverage.d.ts.map +1 -0
- package/dist/core/reports/coverage.js +175 -0
- package/dist/core/reports/coverage.js.map +1 -0
- package/dist/core/reports/index.d.ts +10 -0
- package/dist/core/reports/index.d.ts.map +1 -0
- package/dist/core/reports/index.js +7 -0
- package/dist/core/reports/index.js.map +1 -0
- package/dist/core/reports/mermaid.d.ts +41 -0
- package/dist/core/reports/mermaid.d.ts.map +1 -0
- package/dist/core/reports/mermaid.js +171 -0
- package/dist/core/reports/mermaid.js.map +1 -0
- package/dist/core/reports/traceability.d.ts +45 -0
- package/dist/core/reports/traceability.d.ts.map +1 -0
- package/dist/core/reports/traceability.js +190 -0
- package/dist/core/reports/traceability.js.map +1 -0
- package/dist/core/scanner.d.ts +48 -0
- package/dist/core/scanner.d.ts.map +1 -0
- package/dist/core/scanner.js +191 -0
- package/dist/core/scanner.js.map +1 -0
- package/dist/core/toolchain.d.ts +28 -0
- package/dist/core/toolchain.d.ts.map +1 -0
- package/dist/core/toolchain.js +68 -0
- package/dist/core/toolchain.js.map +1 -0
- package/dist/core/verify.d.ts +15 -0
- package/dist/core/verify.d.ts.map +1 -0
- package/dist/core/verify.js +182 -0
- package/dist/core/verify.js.map +1 -0
- package/dist/mcp/server.d.ts +46 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +421 -0
- package/dist/mcp/server.js.map +1 -0
- package/package.json +86 -0
- package/schemas/config.schema.json +140 -0
- package/schemas/graph.schema.json +132 -0
- package/schemas/repo-profile.schema.json +118 -0
- package/schemas/toolchain.schema.json +37 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Server for odd-repo-mapper.
|
|
3
|
+
* Per D1: Standalone CLI exposing MCP stdio server.
|
|
4
|
+
* Per D2: Artifact references, small inline summaries, 64KB fixed chunks.
|
|
5
|
+
*/
|
|
6
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
7
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
8
|
+
import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
9
|
+
import { resolve, join } from 'node:path';
|
|
10
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
11
|
+
import Database from 'better-sqlite3';
|
|
12
|
+
import { REPO_MAPPER_VERSION, MCP_CHUNK_SIZE_BYTES } from '../core/constants.js';
|
|
13
|
+
import { scanDirectory } from '../core/scanner.js';
|
|
14
|
+
import { collectToolchain } from '../core/toolchain.js';
|
|
15
|
+
import { createDefaultConfig } from '../core/config.js';
|
|
16
|
+
import { initGraphDatabase, insertNode, insertEdge, exportGraph } from '../core/graph.js';
|
|
17
|
+
import { indexAll } from '../core/indexers/index.js';
|
|
18
|
+
import { generateMermaidDiagram, buildTraceabilityMatrix } from '../core/reports/index.js';
|
|
19
|
+
const server = new Server({
|
|
20
|
+
name: 'odd-repo-mapper',
|
|
21
|
+
version: REPO_MAPPER_VERSION,
|
|
22
|
+
}, {
|
|
23
|
+
capabilities: {
|
|
24
|
+
tools: {},
|
|
25
|
+
resources: {},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
// State
|
|
29
|
+
let currentRootDir = process.cwd();
|
|
30
|
+
let currentOutDir = join(currentRootDir, 'out');
|
|
31
|
+
/**
|
|
32
|
+
* List available tools.
|
|
33
|
+
*/
|
|
34
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
35
|
+
return {
|
|
36
|
+
tools: [
|
|
37
|
+
{
|
|
38
|
+
name: 'scan',
|
|
39
|
+
description: 'Scan a repository and build the knowledge graph',
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {
|
|
43
|
+
rootDir: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
description: 'Repository root directory (default: current directory)',
|
|
46
|
+
},
|
|
47
|
+
outDir: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
description: 'Output directory for artifacts (default: ./out)',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'query',
|
|
56
|
+
description: 'Query the knowledge graph',
|
|
57
|
+
inputSchema: {
|
|
58
|
+
type: 'object',
|
|
59
|
+
required: ['query'],
|
|
60
|
+
properties: {
|
|
61
|
+
query: {
|
|
62
|
+
type: 'string',
|
|
63
|
+
description: 'SQL query to run against the graph database',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'get_imports',
|
|
70
|
+
description: 'Get all imports for a specific file',
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: 'object',
|
|
73
|
+
required: ['path'],
|
|
74
|
+
properties: {
|
|
75
|
+
path: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
description: 'Relative path to the file',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'get_diagram',
|
|
84
|
+
description: 'Generate a Mermaid architecture diagram',
|
|
85
|
+
inputSchema: {
|
|
86
|
+
type: 'object',
|
|
87
|
+
properties: {
|
|
88
|
+
nodeTypes: {
|
|
89
|
+
type: 'array',
|
|
90
|
+
items: { type: 'string' },
|
|
91
|
+
description: 'Filter to specific node types (file, module, test, entrypoint)',
|
|
92
|
+
},
|
|
93
|
+
edgeKinds: {
|
|
94
|
+
type: 'array',
|
|
95
|
+
items: { type: 'string' },
|
|
96
|
+
description: 'Include only specific edge kinds (import, contains, tests, entrypoint)',
|
|
97
|
+
},
|
|
98
|
+
maxNodes: {
|
|
99
|
+
type: 'number',
|
|
100
|
+
description: 'Maximum nodes in diagram (default: 250)',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'get_traceability',
|
|
107
|
+
description: 'Get module-test traceability matrix',
|
|
108
|
+
inputSchema: {
|
|
109
|
+
type: 'object',
|
|
110
|
+
properties: {
|
|
111
|
+
minConfidence: {
|
|
112
|
+
type: 'number',
|
|
113
|
+
description: 'Minimum confidence threshold (default: 50)',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
/**
|
|
122
|
+
* Handle tool calls.
|
|
123
|
+
*/
|
|
124
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
125
|
+
const { name, arguments: args } = request.params;
|
|
126
|
+
try {
|
|
127
|
+
switch (name) {
|
|
128
|
+
case 'scan':
|
|
129
|
+
return await handleScan(args);
|
|
130
|
+
case 'query':
|
|
131
|
+
return await handleQuery(args);
|
|
132
|
+
case 'get_imports':
|
|
133
|
+
return await handleGetImports(args);
|
|
134
|
+
case 'get_diagram':
|
|
135
|
+
return await handleGetDiagram(args);
|
|
136
|
+
case 'get_traceability':
|
|
137
|
+
return await handleGetTraceability(args);
|
|
138
|
+
default:
|
|
139
|
+
return {
|
|
140
|
+
content: [{ type: 'text', text: `Unknown tool: ${name}` }],
|
|
141
|
+
isError: true,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
return {
|
|
147
|
+
content: [
|
|
148
|
+
{
|
|
149
|
+
type: 'text',
|
|
150
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
isError: true,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
/**
|
|
158
|
+
* List available resources.
|
|
159
|
+
*/
|
|
160
|
+
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
161
|
+
const resources = [];
|
|
162
|
+
// Check if graph exists
|
|
163
|
+
const dbPath = join(currentOutDir, 'graph.sqlite');
|
|
164
|
+
if (existsSync(dbPath)) {
|
|
165
|
+
resources.push({
|
|
166
|
+
uri: 'repo-mapper://graph.json',
|
|
167
|
+
name: 'Knowledge Graph',
|
|
168
|
+
description: 'The full knowledge graph as canonical JSON',
|
|
169
|
+
mimeType: 'application/json',
|
|
170
|
+
}, {
|
|
171
|
+
uri: 'repo-mapper://repo_profile.json',
|
|
172
|
+
name: 'Repository Profile',
|
|
173
|
+
description: 'Repository scan summary',
|
|
174
|
+
mimeType: 'application/json',
|
|
175
|
+
}, {
|
|
176
|
+
uri: 'repo-mapper://architecture.mmd',
|
|
177
|
+
name: 'Architecture Diagram',
|
|
178
|
+
description: 'Mermaid diagram of the codebase architecture',
|
|
179
|
+
mimeType: 'text/plain',
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return { resources };
|
|
183
|
+
});
|
|
184
|
+
/**
|
|
185
|
+
* Read resources.
|
|
186
|
+
*/
|
|
187
|
+
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
188
|
+
const { uri } = request.params;
|
|
189
|
+
if (uri === 'repo-mapper://graph.json') {
|
|
190
|
+
const graphPath = join(currentOutDir, 'graph.json');
|
|
191
|
+
if (!existsSync(graphPath)) {
|
|
192
|
+
throw new Error('Graph not found. Run scan first.');
|
|
193
|
+
}
|
|
194
|
+
const content = readFileSync(graphPath, 'utf8');
|
|
195
|
+
return {
|
|
196
|
+
contents: [
|
|
197
|
+
{
|
|
198
|
+
uri,
|
|
199
|
+
mimeType: 'application/json',
|
|
200
|
+
text: chunkContent(content),
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (uri === 'repo-mapper://repo_profile.json') {
|
|
206
|
+
const profilePath = join(currentOutDir, 'repo_profile.json');
|
|
207
|
+
if (!existsSync(profilePath)) {
|
|
208
|
+
throw new Error('Profile not found. Run scan first.');
|
|
209
|
+
}
|
|
210
|
+
const content = readFileSync(profilePath, 'utf8');
|
|
211
|
+
return {
|
|
212
|
+
contents: [
|
|
213
|
+
{
|
|
214
|
+
uri,
|
|
215
|
+
mimeType: 'application/json',
|
|
216
|
+
text: content,
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
if (uri === 'repo-mapper://architecture.mmd') {
|
|
222
|
+
const dbPath = join(currentOutDir, 'graph.sqlite');
|
|
223
|
+
if (!existsSync(dbPath)) {
|
|
224
|
+
throw new Error('Graph not found. Run scan first.');
|
|
225
|
+
}
|
|
226
|
+
const db = new Database(dbPath, { readonly: true });
|
|
227
|
+
try {
|
|
228
|
+
const result = generateMermaidDiagram(db);
|
|
229
|
+
return {
|
|
230
|
+
contents: [
|
|
231
|
+
{
|
|
232
|
+
uri,
|
|
233
|
+
mimeType: 'text/plain',
|
|
234
|
+
text: result.mermaid,
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
finally {
|
|
240
|
+
db.close();
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
throw new Error(`Unknown resource: ${uri}`);
|
|
244
|
+
});
|
|
245
|
+
// Tool handlers
|
|
246
|
+
async function handleScan(args) {
|
|
247
|
+
currentRootDir = args.rootDir ? resolve(args.rootDir) : process.cwd();
|
|
248
|
+
currentOutDir = args.outDir ? resolve(args.outDir) : join(currentRootDir, 'out');
|
|
249
|
+
const toolchain = collectToolchain(currentRootDir);
|
|
250
|
+
const config = createDefaultConfig(currentRootDir);
|
|
251
|
+
const scanResult = scanDirectory(currentRootDir, toolchain, {
|
|
252
|
+
maxFiles: config.limits?.maxFiles,
|
|
253
|
+
testPatterns: config.indexing?.tests?.patterns,
|
|
254
|
+
});
|
|
255
|
+
// Index files
|
|
256
|
+
const filesByLanguage = new Map();
|
|
257
|
+
for (const file of scanResult.fileEntries ?? []) {
|
|
258
|
+
if (!filesByLanguage.has(file.language)) {
|
|
259
|
+
filesByLanguage.set(file.language, []);
|
|
260
|
+
}
|
|
261
|
+
filesByLanguage.get(file.language).push(file.path);
|
|
262
|
+
}
|
|
263
|
+
const indexResult = indexAll({
|
|
264
|
+
rootDir: currentRootDir,
|
|
265
|
+
files: filesByLanguage,
|
|
266
|
+
});
|
|
267
|
+
// Build graph
|
|
268
|
+
const dbPath = join(currentOutDir, 'graph.sqlite');
|
|
269
|
+
const db = initGraphDatabase(dbPath);
|
|
270
|
+
for (const node of indexResult.nodes) {
|
|
271
|
+
insertNode(db, node);
|
|
272
|
+
}
|
|
273
|
+
for (const edge of indexResult.edges) {
|
|
274
|
+
insertEdge(db, edge);
|
|
275
|
+
}
|
|
276
|
+
const graphExport = await exportGraph(db);
|
|
277
|
+
db.close();
|
|
278
|
+
return {
|
|
279
|
+
content: [
|
|
280
|
+
{
|
|
281
|
+
type: 'text',
|
|
282
|
+
text: JSON.stringify({
|
|
283
|
+
success: true,
|
|
284
|
+
files: scanResult.files.total,
|
|
285
|
+
nodes: graphExport.meta.nodeCount,
|
|
286
|
+
edges: graphExport.meta.edgeCount,
|
|
287
|
+
languages: scanResult.languages.map((l) => `${l.id}(${l.fileCount})`),
|
|
288
|
+
}, null, 2),
|
|
289
|
+
},
|
|
290
|
+
],
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
async function handleQuery(args) {
|
|
294
|
+
const dbPath = join(currentOutDir, 'graph.sqlite');
|
|
295
|
+
if (!existsSync(dbPath)) {
|
|
296
|
+
throw new Error('Graph not found. Run scan first.');
|
|
297
|
+
}
|
|
298
|
+
const db = new Database(dbPath, { readonly: true });
|
|
299
|
+
try {
|
|
300
|
+
// Only allow SELECT queries for safety
|
|
301
|
+
const query = args.query.trim();
|
|
302
|
+
if (!query.toLowerCase().startsWith('select')) {
|
|
303
|
+
throw new Error('Only SELECT queries are allowed');
|
|
304
|
+
}
|
|
305
|
+
const results = db.prepare(query).all();
|
|
306
|
+
return {
|
|
307
|
+
content: [
|
|
308
|
+
{
|
|
309
|
+
type: 'text',
|
|
310
|
+
text: JSON.stringify(results, null, 2),
|
|
311
|
+
},
|
|
312
|
+
],
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
finally {
|
|
316
|
+
db.close();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
async function handleGetImports(args) {
|
|
320
|
+
const dbPath = join(currentOutDir, 'graph.sqlite');
|
|
321
|
+
if (!existsSync(dbPath)) {
|
|
322
|
+
throw new Error('Graph not found. Run scan first.');
|
|
323
|
+
}
|
|
324
|
+
const db = new Database(dbPath, { readonly: true });
|
|
325
|
+
try {
|
|
326
|
+
const results = db
|
|
327
|
+
.prepare(`
|
|
328
|
+
SELECT
|
|
329
|
+
n2.path as imports,
|
|
330
|
+
e.proof_type,
|
|
331
|
+
e.proof_line
|
|
332
|
+
FROM edges e
|
|
333
|
+
JOIN nodes n1 ON e.source = n1.id
|
|
334
|
+
JOIN nodes n2 ON e.target = n2.id
|
|
335
|
+
WHERE n1.path = ? AND e.kind = 'import'
|
|
336
|
+
ORDER BY n2.path
|
|
337
|
+
`)
|
|
338
|
+
.all(args.path);
|
|
339
|
+
return {
|
|
340
|
+
content: [
|
|
341
|
+
{
|
|
342
|
+
type: 'text',
|
|
343
|
+
text: JSON.stringify(results, null, 2),
|
|
344
|
+
},
|
|
345
|
+
],
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
finally {
|
|
349
|
+
db.close();
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
async function handleGetDiagram(args) {
|
|
353
|
+
const dbPath = join(currentOutDir, 'graph.sqlite');
|
|
354
|
+
if (!existsSync(dbPath)) {
|
|
355
|
+
throw new Error('Graph not found. Run scan first.');
|
|
356
|
+
}
|
|
357
|
+
const db = new Database(dbPath, { readonly: true });
|
|
358
|
+
try {
|
|
359
|
+
const result = generateMermaidDiagram(db, {
|
|
360
|
+
nodeTypes: args.nodeTypes,
|
|
361
|
+
edgeKinds: args.edgeKinds,
|
|
362
|
+
maxNodes: args.maxNodes,
|
|
363
|
+
});
|
|
364
|
+
return {
|
|
365
|
+
content: [
|
|
366
|
+
{
|
|
367
|
+
type: 'text',
|
|
368
|
+
text: result.mermaid,
|
|
369
|
+
},
|
|
370
|
+
],
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
finally {
|
|
374
|
+
db.close();
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
async function handleGetTraceability(args) {
|
|
378
|
+
const dbPath = join(currentOutDir, 'graph.sqlite');
|
|
379
|
+
if (!existsSync(dbPath)) {
|
|
380
|
+
throw new Error('Graph not found. Run scan first.');
|
|
381
|
+
}
|
|
382
|
+
const db = new Database(dbPath, { readonly: true });
|
|
383
|
+
try {
|
|
384
|
+
const matrix = buildTraceabilityMatrix(db, {
|
|
385
|
+
minConfidence: args.minConfidence,
|
|
386
|
+
});
|
|
387
|
+
return {
|
|
388
|
+
content: [
|
|
389
|
+
{
|
|
390
|
+
type: 'text',
|
|
391
|
+
text: JSON.stringify(matrix, null, 2),
|
|
392
|
+
},
|
|
393
|
+
],
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
finally {
|
|
397
|
+
db.close();
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Chunk large content per D2 (64KB chunks).
|
|
402
|
+
*/
|
|
403
|
+
function chunkContent(content) {
|
|
404
|
+
if (content.length <= MCP_CHUNK_SIZE_BYTES) {
|
|
405
|
+
return content;
|
|
406
|
+
}
|
|
407
|
+
// For now, return truncated with note
|
|
408
|
+
return (content.slice(0, MCP_CHUNK_SIZE_BYTES) +
|
|
409
|
+
'\n\n[Content truncated. Use query tool for specific data.]');
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Start the MCP server.
|
|
413
|
+
*/
|
|
414
|
+
export async function startMcpServer() {
|
|
415
|
+
const transport = new StdioServerTransport();
|
|
416
|
+
await server.connect(transport);
|
|
417
|
+
console.error('odd-repo-mapper MCP server started');
|
|
418
|
+
}
|
|
419
|
+
// Export for direct use
|
|
420
|
+
export { server };
|
|
421
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACH,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,GAC5B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;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AC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc;IAChC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;AACxD,CAAC;AAED,wBAAwB;AACxB,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@oddessentials/odd-repo-mapper",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Deterministic code intelligence tool producing evidence-backed architecture diagrams and feature-test traceability matrices",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=22.0.0"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"repo-mapper": "./dist/cli/index.js"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"dev": "tsc --watch",
|
|
15
|
+
"test": "vitest run",
|
|
16
|
+
"test:watch": "vitest",
|
|
17
|
+
"test:coverage": "vitest run --coverage",
|
|
18
|
+
"test:golden": "vitest run --project golden",
|
|
19
|
+
"lint": "eslint src",
|
|
20
|
+
"lint:fix": "eslint src --fix",
|
|
21
|
+
"format": "prettier --write .",
|
|
22
|
+
"format:check": "prettier --check .",
|
|
23
|
+
"typecheck": "tsc --noEmit",
|
|
24
|
+
"clean": "rimraf dist out",
|
|
25
|
+
"prepare": "husky",
|
|
26
|
+
"ci": "npm run lint && npm run format:check && npm run typecheck && npm run test -- --passWithNoTests && npm run build",
|
|
27
|
+
"release:dry-run": "semantic-release --dry-run"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
31
|
+
"ajv": "^8.17.1",
|
|
32
|
+
"better-sqlite3": "^11.7.0",
|
|
33
|
+
"commander": "^12.1.0",
|
|
34
|
+
"json-canonicalize": "^1.0.6",
|
|
35
|
+
"ts-morph": "^27.0.2"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@commitlint/cli": "^20.2.0",
|
|
39
|
+
"@commitlint/config-conventional": "^20.2.0",
|
|
40
|
+
"@eslint/js": "^9.39.2",
|
|
41
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
42
|
+
"@semantic-release/git": "^10.0.1",
|
|
43
|
+
"@semantic-release/github": "^12.0.2",
|
|
44
|
+
"@semantic-release/npm": "^13.1.3",
|
|
45
|
+
"@types/better-sqlite3": "^7.6.12",
|
|
46
|
+
"@types/node": "^22.10.2",
|
|
47
|
+
"@vitest/coverage-v8": "^2.1.9",
|
|
48
|
+
"eslint": "^9.17.0",
|
|
49
|
+
"husky": "^9.1.7",
|
|
50
|
+
"lint-staged": "^16.2.7",
|
|
51
|
+
"prettier": "^3.7.4",
|
|
52
|
+
"rimraf": "^6.0.1",
|
|
53
|
+
"semantic-release": "^25.0.2",
|
|
54
|
+
"typescript": "^5.7.2",
|
|
55
|
+
"typescript-eslint": "^8.51.0",
|
|
56
|
+
"vitest": "^2.1.8"
|
|
57
|
+
},
|
|
58
|
+
"files": [
|
|
59
|
+
"dist",
|
|
60
|
+
"schemas"
|
|
61
|
+
],
|
|
62
|
+
"keywords": [
|
|
63
|
+
"code-intelligence",
|
|
64
|
+
"architecture",
|
|
65
|
+
"traceability",
|
|
66
|
+
"mermaid",
|
|
67
|
+
"evidence"
|
|
68
|
+
],
|
|
69
|
+
"license": "MIT",
|
|
70
|
+
"publishConfig": {
|
|
71
|
+
"access": "public"
|
|
72
|
+
},
|
|
73
|
+
"repository": {
|
|
74
|
+
"type": "git",
|
|
75
|
+
"url": "https://github.com/oddessentials/odd-repo-mapper.git"
|
|
76
|
+
},
|
|
77
|
+
"lint-staged": {
|
|
78
|
+
"*.{ts,js}": [
|
|
79
|
+
"eslint --fix",
|
|
80
|
+
"prettier --write"
|
|
81
|
+
],
|
|
82
|
+
"*.{json,md}": [
|
|
83
|
+
"prettier --write"
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://oddessentials.dev/schemas/repo-mapper/config.schema.json",
|
|
4
|
+
"title": "Repo Mapper Config (v0.1)",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["version", "project", "output", "determinism"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"version": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"const": "0.1.0"
|
|
12
|
+
},
|
|
13
|
+
"project": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"required": ["rootDir"],
|
|
17
|
+
"properties": {
|
|
18
|
+
"rootDir": {
|
|
19
|
+
"type": "string"
|
|
20
|
+
},
|
|
21
|
+
"name": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"repoId": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"indexing": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"additionalProperties": false,
|
|
32
|
+
"properties": {
|
|
33
|
+
"languages": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"properties": {
|
|
36
|
+
"tier1": {
|
|
37
|
+
"type": "array",
|
|
38
|
+
"items": {
|
|
39
|
+
"enum": ["typescript", "javascript", "python", "go", "rust"]
|
|
40
|
+
},
|
|
41
|
+
"default": ["typescript", "javascript", "python", "go", "rust"]
|
|
42
|
+
},
|
|
43
|
+
"tier2": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"items": {
|
|
46
|
+
"enum": ["java", "kotlin", "csharp", "ruby", "php"]
|
|
47
|
+
},
|
|
48
|
+
"default": ["java", "kotlin", "csharp", "ruby", "php"]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"tests": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"properties": {
|
|
55
|
+
"patterns": {
|
|
56
|
+
"type": "array",
|
|
57
|
+
"items": {
|
|
58
|
+
"type": "string"
|
|
59
|
+
},
|
|
60
|
+
"default": [
|
|
61
|
+
"**/*test*.*",
|
|
62
|
+
"**/*spec*.*",
|
|
63
|
+
"**/test/**",
|
|
64
|
+
"**/tests/**",
|
|
65
|
+
"**/__tests__/**"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"linking": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"properties": {
|
|
71
|
+
"minConfidence": {
|
|
72
|
+
"type": "integer",
|
|
73
|
+
"minimum": 0,
|
|
74
|
+
"maximum": 100,
|
|
75
|
+
"default": 50
|
|
76
|
+
},
|
|
77
|
+
"allowBelowThreshold": {
|
|
78
|
+
"type": "boolean",
|
|
79
|
+
"default": false
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"output": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"additionalProperties": false,
|
|
90
|
+
"required": ["outDir"],
|
|
91
|
+
"properties": {
|
|
92
|
+
"outDir": {
|
|
93
|
+
"type": "string",
|
|
94
|
+
"default": "./out"
|
|
95
|
+
},
|
|
96
|
+
"writeIntermediateArtifacts": {
|
|
97
|
+
"type": "boolean",
|
|
98
|
+
"default": true
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"determinism": {
|
|
103
|
+
"type": "object",
|
|
104
|
+
"additionalProperties": false,
|
|
105
|
+
"properties": {
|
|
106
|
+
"sortOrder": {
|
|
107
|
+
"type": "string",
|
|
108
|
+
"enum": ["path_then_name", "name_then_path"],
|
|
109
|
+
"default": "path_then_name"
|
|
110
|
+
},
|
|
111
|
+
"stableIdMode": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"enum": ["path_hash", "content_hash"],
|
|
114
|
+
"default": "path_hash"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"limits": {
|
|
119
|
+
"type": "object",
|
|
120
|
+
"properties": {
|
|
121
|
+
"maxFiles": {
|
|
122
|
+
"type": "integer",
|
|
123
|
+
"default": 50000
|
|
124
|
+
},
|
|
125
|
+
"maxEdges": {
|
|
126
|
+
"type": "integer",
|
|
127
|
+
"default": 500000
|
|
128
|
+
},
|
|
129
|
+
"maxSymbols": {
|
|
130
|
+
"type": "integer",
|
|
131
|
+
"default": 1000000
|
|
132
|
+
},
|
|
133
|
+
"maxNodesPerDiagram": {
|
|
134
|
+
"type": "integer",
|
|
135
|
+
"default": 250
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|