@papyruslabsai/seshat-mcp 0.3.0 → 0.3.1
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/dist/graph.js +24 -6
- package/dist/index.js +1 -1
- package/dist/loader.js +12 -0
- package/dist/tools/index.js +6 -2
- package/package.json +1 -1
package/dist/graph.js
CHANGED
|
@@ -21,7 +21,10 @@ export function buildCallGraph(entities) {
|
|
|
21
21
|
callers.set(entity.id, new Set());
|
|
22
22
|
callees.set(entity.id, new Set());
|
|
23
23
|
if (entity.context?.module) {
|
|
24
|
-
|
|
24
|
+
const mod = entity.context.module;
|
|
25
|
+
if (!entityByModule.has(mod))
|
|
26
|
+
entityByModule.set(mod, []);
|
|
27
|
+
entityByModule.get(mod).push(entity);
|
|
25
28
|
}
|
|
26
29
|
}
|
|
27
30
|
// Build call edges from ε dimension
|
|
@@ -42,12 +45,27 @@ export function buildCallGraph(entities) {
|
|
|
42
45
|
}
|
|
43
46
|
// Strategy 2: Method match (target = "module.method")
|
|
44
47
|
else if (target.includes('.')) {
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
const dotIdx = target.indexOf('.');
|
|
49
|
+
const modulePart = target.substring(0, dotIdx);
|
|
50
|
+
const methodPart = target.substring(dotIdx + 1);
|
|
51
|
+
// First try "module.method" as a full entity ID
|
|
52
|
+
if (entityById.has(target)) {
|
|
53
|
+
calleeId = target;
|
|
49
54
|
}
|
|
50
|
-
//
|
|
55
|
+
// Search within the module's entities for one named methodPart
|
|
56
|
+
if (!calleeId) {
|
|
57
|
+
const moduleEntities = entityByModule.get(modulePart);
|
|
58
|
+
if (moduleEntities) {
|
|
59
|
+
const match = moduleEntities.find(e => {
|
|
60
|
+
const name = typeof e.struct === 'string' ? e.struct : e.struct?.name;
|
|
61
|
+
return e.id === methodPart || name === methodPart;
|
|
62
|
+
});
|
|
63
|
+
if (match) {
|
|
64
|
+
calleeId = match.id;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Also try "module.method" concatenated as an ID
|
|
51
69
|
if (!calleeId && entityById.has(`${modulePart}.${methodPart}`)) {
|
|
52
70
|
calleeId = `${modulePart}.${methodPart}`;
|
|
53
71
|
}
|
package/dist/index.js
CHANGED
package/dist/loader.js
CHANGED
|
@@ -27,6 +27,18 @@ export class BundleLoader {
|
|
|
27
27
|
const raw = fs.readFileSync(bundlePath, 'utf-8');
|
|
28
28
|
const bundle = JSON.parse(raw);
|
|
29
29
|
this.entities = bundle.entities || [];
|
|
30
|
+
// Remap bundle field names to internal _ prefixed names.
|
|
31
|
+
// The extraction pipeline outputs `sourceFile`, `sourceLanguage`, `_jstfFilename`
|
|
32
|
+
// but our JstfEntity type expects `_sourceFile`, `_sourceLanguage`.
|
|
33
|
+
for (const e of this.entities) {
|
|
34
|
+
const raw = e;
|
|
35
|
+
if (raw.sourceFile && !e._sourceFile) {
|
|
36
|
+
e._sourceFile = raw.sourceFile;
|
|
37
|
+
}
|
|
38
|
+
if (raw.sourceLanguage && !e._sourceLanguage) {
|
|
39
|
+
e._sourceLanguage = raw.sourceLanguage;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
30
42
|
// Load topology if available
|
|
31
43
|
const topoPath = path.join(this.seshatDir, '_topology.json');
|
|
32
44
|
if (fs.existsSync(topoPath)) {
|
package/dist/tools/index.js
CHANGED
|
@@ -74,7 +74,8 @@ export function entityLayer(e) {
|
|
|
74
74
|
return 'model';
|
|
75
75
|
if (src.includes('/schema') || explicit === 'schema')
|
|
76
76
|
return 'schema';
|
|
77
|
-
if (src.includes('/test') || src.includes('
|
|
77
|
+
if (src.includes('/test/') || src.includes('/tests/') || src.includes('/__tests__/') ||
|
|
78
|
+
src.includes('.test.') || src.includes('.spec.'))
|
|
78
79
|
return 'test';
|
|
79
80
|
return explicit || 'other';
|
|
80
81
|
}
|
|
@@ -91,7 +92,10 @@ export function entitySummary(e) {
|
|
|
91
92
|
async: typeof e.struct !== 'string' ? e.struct?.async : undefined,
|
|
92
93
|
exported: typeof e.struct !== 'string' ? e.struct?.exported : undefined,
|
|
93
94
|
constraints: constraintTags.length > 0 ? constraintTags : undefined,
|
|
94
|
-
|
|
95
|
+
callExpressions: Array.isArray(e.edges?.calls) ? e.edges.calls.length : 0,
|
|
96
|
+
uniqueCallees: Array.isArray(e.edges?.calls)
|
|
97
|
+
? new Set(e.edges.calls.map(c => c.target)).size
|
|
98
|
+
: 0,
|
|
95
99
|
};
|
|
96
100
|
}
|
|
97
101
|
export function normalizeConstraints(constraints) {
|