@grafema/mcp 0.2.12-beta → 0.3.1-beta
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/analysis-worker.d.ts +4 -3
- package/dist/analysis-worker.d.ts.map +1 -1
- package/dist/analysis-worker.js +8 -203
- package/dist/analysis-worker.js.map +1 -1
- package/dist/analysis.d.ts +10 -3
- package/dist/analysis.d.ts.map +1 -1
- package/dist/analysis.js +130 -62
- package/dist/analysis.js.map +1 -1
- package/dist/config.d.ts +5 -11
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -128
- package/dist/config.js.map +1 -1
- package/dist/definitions/analysis-tools.d.ts +6 -0
- package/dist/definitions/analysis-tools.d.ts.map +1 -0
- package/dist/definitions/analysis-tools.js +125 -0
- package/dist/definitions/analysis-tools.js.map +1 -0
- package/dist/definitions/context-tools.d.ts +6 -0
- package/dist/definitions/context-tools.d.ts.map +1 -0
- package/dist/definitions/context-tools.js +144 -0
- package/dist/definitions/context-tools.js.map +1 -0
- package/dist/definitions/graph-tools.d.ts +7 -0
- package/dist/definitions/graph-tools.d.ts.map +1 -0
- package/dist/definitions/graph-tools.js +124 -0
- package/dist/definitions/graph-tools.js.map +1 -0
- package/dist/definitions/graphql-tools.d.ts +6 -0
- package/dist/definitions/graphql-tools.d.ts.map +1 -0
- package/dist/definitions/graphql-tools.js +62 -0
- package/dist/definitions/graphql-tools.js.map +1 -0
- package/dist/definitions/guarantee-tools.d.ts +6 -0
- package/dist/definitions/guarantee-tools.d.ts.map +1 -0
- package/dist/definitions/guarantee-tools.js +136 -0
- package/dist/definitions/guarantee-tools.js.map +1 -0
- package/dist/definitions/index.d.ts +7 -0
- package/dist/definitions/index.d.ts.map +1 -0
- package/dist/definitions/index.js +24 -0
- package/dist/definitions/index.js.map +1 -0
- package/dist/definitions/knowledge-tools.d.ts +10 -0
- package/dist/definitions/knowledge-tools.d.ts.map +1 -0
- package/dist/definitions/knowledge-tools.js +300 -0
- package/dist/definitions/knowledge-tools.js.map +1 -0
- package/dist/definitions/notation-tools.d.ts +9 -0
- package/dist/definitions/notation-tools.d.ts.map +1 -0
- package/dist/definitions/notation-tools.js +62 -0
- package/dist/definitions/notation-tools.js.map +1 -0
- package/dist/definitions/project-tools.d.ts +6 -0
- package/dist/definitions/project-tools.d.ts.map +1 -0
- package/dist/definitions/project-tools.js +181 -0
- package/dist/definitions/project-tools.js.map +1 -0
- package/dist/definitions/query-tools.d.ts +6 -0
- package/dist/definitions/query-tools.d.ts.map +1 -0
- package/dist/definitions/query-tools.js +245 -0
- package/dist/definitions/query-tools.js.map +1 -0
- package/dist/definitions/types.d.ts +21 -0
- package/dist/definitions/types.d.ts.map +1 -0
- package/dist/definitions/types.js +5 -0
- package/dist/definitions/types.js.map +1 -0
- package/dist/dev-proxy.d.ts +29 -0
- package/dist/dev-proxy.d.ts.map +1 -0
- package/dist/dev-proxy.js +267 -0
- package/dist/dev-proxy.js.map +1 -0
- package/dist/handlers/analysis-handlers.d.ts.map +1 -1
- package/dist/handlers/analysis-handlers.js +34 -4
- package/dist/handlers/analysis-handlers.js.map +1 -1
- package/dist/handlers/context-handlers.d.ts +5 -6
- package/dist/handlers/context-handlers.d.ts.map +1 -1
- package/dist/handlers/context-handlers.js +19 -16
- package/dist/handlers/context-handlers.js.map +1 -1
- package/dist/handlers/coverage-handlers.js +1 -1
- package/dist/handlers/dataflow-handlers.d.ts +2 -0
- package/dist/handlers/dataflow-handlers.d.ts.map +1 -1
- package/dist/handlers/dataflow-handlers.js +68 -46
- package/dist/handlers/dataflow-handlers.js.map +1 -1
- package/dist/handlers/documentation-handlers.d.ts.map +1 -1
- package/dist/handlers/documentation-handlers.js +56 -2
- package/dist/handlers/documentation-handlers.js.map +1 -1
- package/dist/handlers/graph-handlers.d.ts +23 -0
- package/dist/handlers/graph-handlers.d.ts.map +1 -0
- package/dist/handlers/graph-handlers.js +155 -0
- package/dist/handlers/graph-handlers.js.map +1 -0
- package/dist/handlers/graphql-handlers.d.ts +9 -0
- package/dist/handlers/graphql-handlers.d.ts.map +1 -0
- package/dist/handlers/graphql-handlers.js +57 -0
- package/dist/handlers/graphql-handlers.js.map +1 -0
- package/dist/handlers/guarantee-handlers.js +1 -1
- package/dist/handlers/guard-handlers.d.ts.map +1 -1
- package/dist/handlers/guard-handlers.js +6 -3
- package/dist/handlers/guard-handlers.js.map +1 -1
- package/dist/handlers/index.d.ts +4 -0
- package/dist/handlers/index.d.ts.map +1 -1
- package/dist/handlers/index.js +6 -0
- package/dist/handlers/index.js.map +1 -1
- package/dist/handlers/issue-handlers.d.ts.map +1 -1
- package/dist/handlers/issue-handlers.js +10 -15
- package/dist/handlers/issue-handlers.js.map +1 -1
- package/dist/handlers/knowledge-handlers.d.ts +25 -0
- package/dist/handlers/knowledge-handlers.d.ts.map +1 -0
- package/dist/handlers/knowledge-handlers.js +208 -0
- package/dist/handlers/knowledge-handlers.js.map +1 -0
- package/dist/handlers/notation-handlers.d.ts +6 -0
- package/dist/handlers/notation-handlers.d.ts.map +1 -0
- package/dist/handlers/notation-handlers.js +53 -0
- package/dist/handlers/notation-handlers.js.map +1 -0
- package/dist/handlers/project-handlers.js +1 -1
- package/dist/handlers/query-handlers.d.ts.map +1 -1
- package/dist/handlers/query-handlers.js +166 -20
- package/dist/handlers/query-handlers.js.map +1 -1
- package/dist/prompts.js +1 -1
- package/dist/server.d.ts +19 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +93 -3
- package/dist/server.js.map +1 -1
- package/dist/state.d.ts +10 -1
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +61 -8
- package/dist/state.js.map +1 -1
- package/dist/types.d.ts +75 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +4 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +18 -1
- package/dist/utils.js.map +1 -1
- package/package.json +4 -3
- package/src/analysis-worker.ts +9 -301
- package/src/analysis.ts +151 -77
- package/src/config.ts +6 -193
- package/src/definitions/analysis-tools.ts +127 -0
- package/src/definitions/context-tools.ts +147 -0
- package/src/definitions/graph-tools.ts +126 -0
- package/src/definitions/graphql-tools.ts +64 -0
- package/src/definitions/guarantee-tools.ts +138 -0
- package/src/definitions/index.ts +28 -0
- package/src/definitions/knowledge-tools.ts +302 -0
- package/src/definitions/notation-tools.ts +64 -0
- package/src/definitions/project-tools.ts +183 -0
- package/src/definitions/query-tools.ts +247 -0
- package/src/definitions/types.ts +22 -0
- package/src/dev-proxy.ts +336 -0
- package/src/handlers/analysis-handlers.ts +35 -4
- package/src/handlers/context-handlers.ts +19 -15
- package/src/handlers/coverage-handlers.ts +1 -1
- package/src/handlers/dataflow-handlers.ts +74 -56
- package/src/handlers/documentation-handlers.ts +56 -2
- package/src/handlers/graph-handlers.ts +212 -0
- package/src/handlers/graphql-handlers.ts +70 -0
- package/src/handlers/guarantee-handlers.ts +1 -1
- package/src/handlers/guard-handlers.ts +7 -3
- package/src/handlers/index.ts +6 -0
- package/src/handlers/issue-handlers.ts +10 -15
- package/src/handlers/knowledge-handlers.ts +242 -0
- package/src/handlers/notation-handlers.ts +71 -0
- package/src/handlers/project-handlers.ts +1 -1
- package/src/handlers/query-handlers.ts +186 -22
- package/src/prompts.ts +1 -1
- package/src/server.ts +126 -2
- package/src/state.ts +68 -8
- package/src/types.ts +98 -3
- package/src/utils.ts +22 -1
- package/src/definitions.ts +0 -665
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Analysis Worker
|
|
2
|
+
* Analysis Worker — DEPRECATED
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Analysis is now handled by the grafema-orchestrator Rust binary.
|
|
5
|
+
* This file is kept as a stub to prevent import errors from any remaining references.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
+
* Use analysis.ts ensureAnalyzed() which spawns grafema-orchestrator.
|
|
7
8
|
*/
|
|
8
9
|
export {};
|
|
9
10
|
//# sourceMappingURL=analysis-worker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analysis-worker.d.ts","sourceRoot":"","sources":["../src/analysis-worker.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"analysis-worker.d.ts","sourceRoot":"","sources":["../src/analysis-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
package/dist/analysis-worker.js
CHANGED
|
@@ -1,208 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Analysis Worker
|
|
2
|
+
* Analysis Worker — DEPRECATED
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Analysis is now handled by the grafema-orchestrator Rust binary.
|
|
5
|
+
* This file is kept as a stub to prevent import errors from any remaining references.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
+
* Use analysis.ts ensureAnalyzed() which spawns grafema-orchestrator.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// Indexing
|
|
13
|
-
JSModuleIndexer,
|
|
14
|
-
// Analysis
|
|
15
|
-
JSASTAnalyzer, ExpressRouteAnalyzer, ExpressResponseAnalyzer, NestJSRouteAnalyzer, SocketIOAnalyzer, DatabaseAnalyzer, FetchAnalyzer, ServiceLayerAnalyzer, ReactAnalyzer,
|
|
16
|
-
// Enrichment
|
|
17
|
-
MethodCallResolver, ArgumentParameterLinker, AliasTracker, ValueDomainAnalyzer, MountPointResolver, PrefixEvaluator, ConfigRoutingMapBuilder, ServiceConnectionEnricher, RejectionPropagationEnricher,
|
|
18
|
-
// Validation
|
|
19
|
-
CallResolverValidator, EvalBanValidator, SQLInjectionValidator, AwaitInLoopValidator, ShadowingDetector, GraphConnectivityValidator, DataFlowValidator, UnconnectedRouteValidator, } from '@grafema/core';
|
|
20
|
-
const projectPath = process.argv[2];
|
|
21
|
-
const serviceName = process.argv[3] && process.argv[3] !== '' ? process.argv[3] : null;
|
|
22
|
-
const indexOnly = process.argv[4] === 'indexOnly';
|
|
23
|
-
if (!projectPath) {
|
|
24
|
-
console.error('Usage: node analysis-worker.js <projectPath> [serviceName] [indexOnly]');
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
27
|
-
function sendProgress(data) {
|
|
28
|
-
if (process.send) {
|
|
29
|
-
process.send({ type: 'progress', ...data });
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function sendComplete(data) {
|
|
33
|
-
if (process.send) {
|
|
34
|
-
process.send({ type: 'complete', ...data });
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function sendError(error) {
|
|
38
|
-
if (process.send) {
|
|
39
|
-
process.send({ type: 'error', message: error.message, stack: error.stack });
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
async function loadConfig() {
|
|
43
|
-
const configPath = join(projectPath, '.grafema', 'config.json');
|
|
44
|
-
if (existsSync(configPath)) {
|
|
45
|
-
return JSON.parse(readFileSync(configPath, 'utf8'));
|
|
46
|
-
}
|
|
47
|
-
return { plugins: {} };
|
|
48
|
-
}
|
|
49
|
-
async function loadCustomPlugins() {
|
|
50
|
-
const pluginsDir = join(projectPath, '.grafema', 'plugins');
|
|
51
|
-
const customPlugins = {};
|
|
52
|
-
if (!existsSync(pluginsDir)) {
|
|
53
|
-
return customPlugins;
|
|
54
|
-
}
|
|
55
|
-
const files = readdirSync(pluginsDir).filter(f => f.endsWith('.mjs') || f.endsWith('.js'));
|
|
56
|
-
for (const file of files) {
|
|
57
|
-
try {
|
|
58
|
-
const module = await import(pathToFileURL(join(pluginsDir, file)).href);
|
|
59
|
-
const PluginClass = module.default;
|
|
60
|
-
if (PluginClass) {
|
|
61
|
-
customPlugins[PluginClass.name] = PluginClass;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
catch (err) {
|
|
65
|
-
console.error(`Failed to load plugin ${file}:`, err.message);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return customPlugins;
|
|
69
|
-
}
|
|
70
|
-
async function run() {
|
|
71
|
-
const startTime = Date.now();
|
|
72
|
-
let db = null;
|
|
73
|
-
try {
|
|
74
|
-
sendProgress({ phase: 'starting', message: 'Loading configuration...' });
|
|
75
|
-
const config = await loadConfig();
|
|
76
|
-
const customPlugins = await loadCustomPlugins();
|
|
77
|
-
// Built-in plugins map
|
|
78
|
-
const builtinPlugins = {
|
|
79
|
-
JSModuleIndexer: () => new JSModuleIndexer(),
|
|
80
|
-
JSASTAnalyzer: () => new JSASTAnalyzer(),
|
|
81
|
-
ExpressRouteAnalyzer: () => new ExpressRouteAnalyzer(),
|
|
82
|
-
ExpressResponseAnalyzer: () => new ExpressResponseAnalyzer(),
|
|
83
|
-
NestJSRouteAnalyzer: () => new NestJSRouteAnalyzer(),
|
|
84
|
-
SocketIOAnalyzer: () => new SocketIOAnalyzer(),
|
|
85
|
-
DatabaseAnalyzer: () => new DatabaseAnalyzer(),
|
|
86
|
-
FetchAnalyzer: () => new FetchAnalyzer(),
|
|
87
|
-
ServiceLayerAnalyzer: () => new ServiceLayerAnalyzer(),
|
|
88
|
-
ReactAnalyzer: () => new ReactAnalyzer(),
|
|
89
|
-
MethodCallResolver: () => new MethodCallResolver(),
|
|
90
|
-
ArgumentParameterLinker: () => new ArgumentParameterLinker(),
|
|
91
|
-
AliasTracker: () => new AliasTracker(),
|
|
92
|
-
ValueDomainAnalyzer: () => new ValueDomainAnalyzer(),
|
|
93
|
-
MountPointResolver: () => new MountPointResolver(),
|
|
94
|
-
PrefixEvaluator: () => new PrefixEvaluator(),
|
|
95
|
-
ConfigRoutingMapBuilder: () => new ConfigRoutingMapBuilder(),
|
|
96
|
-
ServiceConnectionEnricher: () => new ServiceConnectionEnricher(),
|
|
97
|
-
RejectionPropagationEnricher: () => new RejectionPropagationEnricher(),
|
|
98
|
-
CallResolverValidator: () => new CallResolverValidator(),
|
|
99
|
-
EvalBanValidator: () => new EvalBanValidator(),
|
|
100
|
-
SQLInjectionValidator: () => new SQLInjectionValidator(),
|
|
101
|
-
AwaitInLoopValidator: () => new AwaitInLoopValidator(),
|
|
102
|
-
ShadowingDetector: () => new ShadowingDetector(),
|
|
103
|
-
GraphConnectivityValidator: () => new GraphConnectivityValidator(),
|
|
104
|
-
DataFlowValidator: () => new DataFlowValidator(),
|
|
105
|
-
UnconnectedRouteValidator: () => new UnconnectedRouteValidator(),
|
|
106
|
-
};
|
|
107
|
-
// Add custom plugins
|
|
108
|
-
for (const [name, PluginClass] of Object.entries(customPlugins)) {
|
|
109
|
-
builtinPlugins[name] = () => new PluginClass();
|
|
110
|
-
}
|
|
111
|
-
// Build plugins array from config
|
|
112
|
-
const plugins = [];
|
|
113
|
-
for (const [_phase, pluginNames] of Object.entries(config.plugins || {})) {
|
|
114
|
-
for (const name of pluginNames) {
|
|
115
|
-
if (builtinPlugins[name]) {
|
|
116
|
-
plugins.push(builtinPlugins[name]());
|
|
117
|
-
}
|
|
118
|
-
else if (customPlugins[name]) {
|
|
119
|
-
plugins.push(new customPlugins[name]());
|
|
120
|
-
console.log(`[Worker] Loaded custom plugin: ${name}`);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
console.warn(`[Worker] Plugin not found: ${name}`);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
console.log(`[Worker] Loaded ${plugins.length} plugins:`, plugins.map(p => p.metadata?.name || p.constructor?.name || 'unknown'));
|
|
128
|
-
sendProgress({ phase: 'starting', message: `Loaded ${plugins.length} plugins` });
|
|
129
|
-
// Get parallel analysis config
|
|
130
|
-
const parallelConfig = config.analysis?.parallel;
|
|
131
|
-
if (parallelConfig?.enabled) {
|
|
132
|
-
console.log(`[Worker] Queue-based parallel mode enabled: workers=${parallelConfig.workers}`);
|
|
133
|
-
}
|
|
134
|
-
// Connect to RFDB server (shared with MCP server)
|
|
135
|
-
// The MCP server starts the RFDB server if not running
|
|
136
|
-
const dbPath = join(projectPath, '.grafema', 'graph.rfdb');
|
|
137
|
-
const socketPath = config.analysis?.parallel?.socketPath || join(projectPath, '.grafema', 'rfdb.sock');
|
|
138
|
-
console.log(`[Worker] Connecting to RFDB server: socket=${socketPath}, db=${dbPath}`);
|
|
139
|
-
db = new RFDBServerBackend({ socketPath, dbPath });
|
|
140
|
-
await db.connect();
|
|
141
|
-
// NOTE: db.clear() is NOT called here.
|
|
142
|
-
// MCP server clears DB INSIDE the analysis lock BEFORE spawning this worker.
|
|
143
|
-
// This prevents race conditions where concurrent analysis calls could both
|
|
144
|
-
// clear the database. Worker assumes DB is already clean.
|
|
145
|
-
// See: REG-159 implementation, Phase 2.5 (Worker Clear Coordination)
|
|
146
|
-
sendProgress({ phase: 'discovery', message: 'Starting analysis...' });
|
|
147
|
-
// Create orchestrator
|
|
148
|
-
const orchestrator = new Orchestrator({
|
|
149
|
-
graph: db,
|
|
150
|
-
plugins,
|
|
151
|
-
parallel: parallelConfig, // Pass parallel config for queue-based analysis
|
|
152
|
-
serviceFilter: serviceName,
|
|
153
|
-
indexOnly: indexOnly,
|
|
154
|
-
onProgress: (progress) => {
|
|
155
|
-
sendProgress({
|
|
156
|
-
phase: progress.phase,
|
|
157
|
-
message: progress.message,
|
|
158
|
-
servicesAnalyzed: progress.servicesAnalyzed
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
// Run analysis
|
|
163
|
-
await orchestrator.run(projectPath);
|
|
164
|
-
// Get final stats
|
|
165
|
-
let nodeCount = 0;
|
|
166
|
-
let edgeCount = 0;
|
|
167
|
-
// Use async methods for RFDBServerBackend
|
|
168
|
-
const allEdges = await db.getAllEdgesAsync();
|
|
169
|
-
edgeCount = allEdges.length;
|
|
170
|
-
for await (const _node of db.queryNodes({})) {
|
|
171
|
-
nodeCount++;
|
|
172
|
-
}
|
|
173
|
-
// Flush to disk using proper async method
|
|
174
|
-
console.log('[Worker] Flushing database to disk...');
|
|
175
|
-
await db.flush();
|
|
176
|
-
console.log('[Worker] Database flushed successfully');
|
|
177
|
-
const totalTime = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
178
|
-
sendComplete({
|
|
179
|
-
nodeCount,
|
|
180
|
-
edgeCount,
|
|
181
|
-
totalTime
|
|
182
|
-
});
|
|
183
|
-
// Close database properly before exit
|
|
184
|
-
await db.close();
|
|
185
|
-
console.log('[Worker] Database closed');
|
|
186
|
-
process.exit(0);
|
|
187
|
-
}
|
|
188
|
-
finally {
|
|
189
|
-
// Ensure database connection is closed even on error
|
|
190
|
-
if (db && db.connected) {
|
|
191
|
-
try {
|
|
192
|
-
await db.close();
|
|
193
|
-
console.log('[Worker] Database connection closed in cleanup');
|
|
194
|
-
}
|
|
195
|
-
catch (closeErr) {
|
|
196
|
-
const message = closeErr instanceof Error ? closeErr.message : String(closeErr);
|
|
197
|
-
console.error('[Worker] Error closing database connection:', message);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
run().catch(err => {
|
|
203
|
-
const error = err instanceof Error ? err : new Error(String(err));
|
|
204
|
-
sendError(error);
|
|
205
|
-
console.error('Analysis failed:', err);
|
|
206
|
-
process.exit(1);
|
|
207
|
-
});
|
|
9
|
+
throw new Error('Analysis is now handled by grafema-orchestrator. ' +
|
|
10
|
+
'Use analysis.ts ensureAnalyzed() instead. ' +
|
|
11
|
+
'The worker pattern is no longer needed since we shell out to a native binary.');
|
|
12
|
+
export {};
|
|
208
13
|
//# sourceMappingURL=analysis-worker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analysis-worker.js","sourceRoot":"","sources":["../src/analysis-worker.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"analysis-worker.js","sourceRoot":"","sources":["../src/analysis-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,IAAI,KAAK,CACb,mDAAmD;IACjD,4CAA4C;IAC5C,+EAA+E,CAClF,CAAC"}
|
package/dist/analysis.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MCP Analysis Orchestration
|
|
3
|
+
*
|
|
4
|
+
* Shells out to the `grafema-orchestrator` Rust binary instead of using
|
|
5
|
+
* the JS Orchestrator class. The binary handles file discovery, parsing,
|
|
6
|
+
* analysis, resolution, and RFDB ingestion.
|
|
3
7
|
*/
|
|
4
8
|
import type { GraphBackend } from '@grafema/types';
|
|
5
9
|
/**
|
|
@@ -10,14 +14,17 @@ import type { GraphBackend } from '@grafema/types';
|
|
|
10
14
|
* - Concurrent calls wait for the current analysis to complete
|
|
11
15
|
* - force=true while analysis is running returns an error immediately
|
|
12
16
|
*
|
|
13
|
-
* @param serviceName - Optional service to analyze (null = all)
|
|
14
|
-
* @param force - If true,
|
|
17
|
+
* @param serviceName - Optional service to analyze (null = all) — currently unused by the orchestrator
|
|
18
|
+
* @param force - If true, add --force flag to re-analyze all files.
|
|
15
19
|
* ERROR if another analysis is already running.
|
|
16
20
|
* @throws Error if force=true and analysis is already running
|
|
17
21
|
*/
|
|
18
22
|
export declare function ensureAnalyzed(serviceName?: string | null, force?: boolean): Promise<GraphBackend>;
|
|
19
23
|
/**
|
|
20
|
-
* Discover services without running full analysis
|
|
24
|
+
* Discover services without running full analysis.
|
|
25
|
+
*
|
|
26
|
+
* Service discovery is now handled by grafema-orchestrator's file discovery.
|
|
27
|
+
* This returns an empty array — the orchestrator handles discovery internally.
|
|
21
28
|
*/
|
|
22
29
|
export declare function discoverServices(): Promise<unknown[]>;
|
|
23
30
|
//# sourceMappingURL=analysis.d.ts.map
|
package/dist/analysis.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../src/analysis.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../src/analysis.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmBH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA6FnD;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAClC,WAAW,GAAE,MAAM,GAAG,IAAW,EACjC,KAAK,GAAE,OAAe,GACrB,OAAO,CAAC,YAAY,CAAC,CAkHvB;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAI3D"}
|
package/dist/analysis.js
CHANGED
|
@@ -1,10 +1,92 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MCP Analysis Orchestration
|
|
3
|
+
*
|
|
4
|
+
* Shells out to the `grafema-orchestrator` Rust binary instead of using
|
|
5
|
+
* the JS Orchestrator class. The binary handles file discovery, parsing,
|
|
6
|
+
* analysis, resolution, and RFDB ingestion.
|
|
3
7
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
8
|
+
import { existsSync } from 'fs';
|
|
9
|
+
import { join } from 'path';
|
|
10
|
+
import { spawn } from 'child_process';
|
|
11
|
+
import { findOrchestratorBinary, getBinaryNotFoundMessage } from '@grafema/util';
|
|
12
|
+
import { getOrCreateBackend, getProjectPath, getIsAnalyzed, setIsAnalyzed, getAnalysisStatus, setAnalysisStatus, isAnalysisRunning, acquireAnalysisLock, getKnowledgeBase, } from './state.js';
|
|
13
|
+
import { loadConfig } from './config.js';
|
|
7
14
|
import { log } from './utils.js';
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the config file path for grafema-orchestrator.
|
|
17
|
+
*
|
|
18
|
+
* The orchestrator expects a YAML config with `root`, `include`, `exclude` fields.
|
|
19
|
+
* Looks for:
|
|
20
|
+
* 1. grafema.config.yaml in project root
|
|
21
|
+
* 2. .grafema/config.yaml as fallback
|
|
22
|
+
*/
|
|
23
|
+
function findConfigPath(projectPath) {
|
|
24
|
+
const candidates = [
|
|
25
|
+
join(projectPath, 'grafema.config.yaml'),
|
|
26
|
+
join(projectPath, '.grafema', 'config.yaml'),
|
|
27
|
+
];
|
|
28
|
+
for (const candidate of candidates) {
|
|
29
|
+
if (existsSync(candidate))
|
|
30
|
+
return candidate;
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the RFDB socket path for the current project.
|
|
36
|
+
*
|
|
37
|
+
* Uses the same logic as state.ts getOrCreateBackend():
|
|
38
|
+
* config.analysis.parallel.socketPath > default derived from dbPath
|
|
39
|
+
*/
|
|
40
|
+
function resolveSocketPath(projectPath) {
|
|
41
|
+
const config = loadConfig(projectPath);
|
|
42
|
+
const configSocket = config.analysis?.parallel?.socketPath;
|
|
43
|
+
if (configSocket)
|
|
44
|
+
return configSocket;
|
|
45
|
+
// Default: same as RFDBServerBackend derives from dbPath
|
|
46
|
+
return join(projectPath, '.grafema', 'rfdb.sock');
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Spawn grafema-orchestrator and wait for it to complete.
|
|
50
|
+
*
|
|
51
|
+
* @returns Promise that resolves on success, rejects on failure
|
|
52
|
+
*/
|
|
53
|
+
function runOrchestrator(binaryPath, args) {
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
log(`[Grafema MCP] Spawning: ${binaryPath} ${args.join(' ')}`);
|
|
56
|
+
const child = spawn(binaryPath, args, {
|
|
57
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
58
|
+
});
|
|
59
|
+
let stdout = '';
|
|
60
|
+
let stderr = '';
|
|
61
|
+
child.stdout.on('data', (data) => {
|
|
62
|
+
const text = data.toString();
|
|
63
|
+
stdout += text;
|
|
64
|
+
// Forward orchestrator output to MCP log
|
|
65
|
+
for (const line of text.split('\n').filter(Boolean)) {
|
|
66
|
+
log(`[orchestrator] ${line}`);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
child.stderr.on('data', (data) => {
|
|
70
|
+
const text = data.toString();
|
|
71
|
+
stderr += text;
|
|
72
|
+
for (const line of text.split('\n').filter(Boolean)) {
|
|
73
|
+
log(`[orchestrator] ${line}`);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
child.on('error', (err) => {
|
|
77
|
+
reject(new Error(`Failed to spawn grafema-orchestrator: ${err.message}`));
|
|
78
|
+
});
|
|
79
|
+
child.on('close', (code) => {
|
|
80
|
+
if (code === 0) {
|
|
81
|
+
resolve();
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
reject(new Error(`grafema-orchestrator exited with code ${code}\n` +
|
|
85
|
+
(stderr || stdout || '(no output)')));
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
8
90
|
/**
|
|
9
91
|
* Ensure project is analyzed, optionally filtering to a single service.
|
|
10
92
|
*
|
|
@@ -13,8 +95,8 @@ import { log } from './utils.js';
|
|
|
13
95
|
* - Concurrent calls wait for the current analysis to complete
|
|
14
96
|
* - force=true while analysis is running returns an error immediately
|
|
15
97
|
*
|
|
16
|
-
* @param serviceName - Optional service to analyze (null = all)
|
|
17
|
-
* @param force - If true,
|
|
98
|
+
* @param serviceName - Optional service to analyze (null = all) — currently unused by the orchestrator
|
|
99
|
+
* @param force - If true, add --force flag to re-analyze all files.
|
|
18
100
|
* ERROR if another analysis is already running.
|
|
19
101
|
* @throws Error if force=true and analysis is already running
|
|
20
102
|
*/
|
|
@@ -39,8 +121,6 @@ export async function ensureAnalyzed(serviceName = null, force = false) {
|
|
|
39
121
|
return db;
|
|
40
122
|
}
|
|
41
123
|
// Clear DB inside lock, BEFORE running analysis
|
|
42
|
-
// This is critical for worker coordination: MCP server clears DB here,
|
|
43
|
-
// worker does NOT call db.clear() (see analysis-worker.ts)
|
|
44
124
|
if (force || !getIsAnalyzed()) {
|
|
45
125
|
log('[Grafema MCP] Clearing database before analysis...');
|
|
46
126
|
if (db.clear) {
|
|
@@ -49,42 +129,54 @@ export async function ensureAnalyzed(serviceName = null, force = false) {
|
|
|
49
129
|
setIsAnalyzed(false);
|
|
50
130
|
}
|
|
51
131
|
log(`[Grafema MCP] Analyzing project: ${projectPath}${serviceName ? ` (service: ${serviceName})` : ''}`);
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
//
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
132
|
+
// Find the orchestrator binary
|
|
133
|
+
const binaryPath = findOrchestratorBinary();
|
|
134
|
+
if (!binaryPath) {
|
|
135
|
+
throw new Error(getBinaryNotFoundMessage('grafema-orchestrator'));
|
|
136
|
+
}
|
|
137
|
+
// Find config file
|
|
138
|
+
const configPath = findConfigPath(projectPath);
|
|
139
|
+
if (!configPath) {
|
|
140
|
+
throw new Error(`No config file found for grafema-orchestrator.\n` +
|
|
141
|
+
`Expected one of:\n` +
|
|
142
|
+
` - ${join(projectPath, 'grafema.config.yaml')}\n` +
|
|
143
|
+
` - ${join(projectPath, '.grafema', 'config.yaml')}\n`);
|
|
62
144
|
}
|
|
145
|
+
// Resolve socket path
|
|
146
|
+
const socketPath = resolveSocketPath(projectPath);
|
|
63
147
|
const analysisStatus = getAnalysisStatus();
|
|
64
148
|
const startTime = Date.now();
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
onProgress: (progress) => {
|
|
71
|
-
log(`[Grafema MCP] ${progress.phase}: ${progress.message}`);
|
|
72
|
-
setAnalysisStatus({
|
|
73
|
-
phase: progress.phase,
|
|
74
|
-
message: progress.message,
|
|
75
|
-
servicesDiscovered: progress.servicesDiscovered || analysisStatus.servicesDiscovered,
|
|
76
|
-
servicesAnalyzed: progress.servicesAnalyzed || analysisStatus.servicesAnalyzed,
|
|
77
|
-
});
|
|
78
|
-
},
|
|
149
|
+
setAnalysisStatus({
|
|
150
|
+
phase: 'starting',
|
|
151
|
+
message: 'Spawning grafema-orchestrator...',
|
|
152
|
+
servicesDiscovered: analysisStatus.servicesDiscovered,
|
|
153
|
+
servicesAnalyzed: analysisStatus.servicesAnalyzed,
|
|
79
154
|
});
|
|
80
|
-
|
|
155
|
+
// Build args
|
|
156
|
+
const args = ['analyze', '--config', configPath, '--socket', socketPath];
|
|
157
|
+
if (force) {
|
|
158
|
+
args.push('--force');
|
|
159
|
+
}
|
|
160
|
+
log(`[Grafema MCP] Binary: ${binaryPath}`);
|
|
161
|
+
log(`[Grafema MCP] Config: ${configPath}`);
|
|
162
|
+
log(`[Grafema MCP] Socket: ${socketPath}`);
|
|
163
|
+
// Run the orchestrator
|
|
164
|
+
await runOrchestrator(binaryPath, args);
|
|
81
165
|
// Flush if available
|
|
82
166
|
if ('flush' in db && typeof db.flush === 'function') {
|
|
83
167
|
await db.flush();
|
|
84
168
|
}
|
|
85
169
|
setIsAnalyzed(true);
|
|
170
|
+
// Bump KB resolver generation so cached resolutions are re-evaluated
|
|
171
|
+
const kb = getKnowledgeBase();
|
|
172
|
+
if (kb) {
|
|
173
|
+
kb.invalidateResolutionCache();
|
|
174
|
+
log('[Grafema MCP] KnowledgeBase resolution cache invalidated after analysis');
|
|
175
|
+
}
|
|
86
176
|
const totalTime = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
87
177
|
setAnalysisStatus({
|
|
178
|
+
phase: 'complete',
|
|
179
|
+
message: `Analysis complete in ${totalTime}s`,
|
|
88
180
|
timings: {
|
|
89
181
|
...analysisStatus.timings,
|
|
90
182
|
total: parseFloat(totalTime),
|
|
@@ -99,38 +191,14 @@ export async function ensureAnalyzed(serviceName = null, force = false) {
|
|
|
99
191
|
}
|
|
100
192
|
}
|
|
101
193
|
/**
|
|
102
|
-
* Discover services without running full analysis
|
|
194
|
+
* Discover services without running full analysis.
|
|
195
|
+
*
|
|
196
|
+
* Service discovery is now handled by grafema-orchestrator's file discovery.
|
|
197
|
+
* This returns an empty array — the orchestrator handles discovery internally.
|
|
103
198
|
*/
|
|
104
199
|
export async function discoverServices() {
|
|
105
|
-
const db = await getOrCreateBackend();
|
|
106
200
|
const projectPath = getProjectPath();
|
|
107
|
-
log(`[Grafema MCP]
|
|
108
|
-
|
|
109
|
-
const { pluginMap: customPluginMap } = await loadCustomPlugins(projectPath);
|
|
110
|
-
const availablePlugins = {
|
|
111
|
-
...Object.fromEntries(Object.entries(customPluginMap).map(([name, PluginClass]) => [
|
|
112
|
-
name,
|
|
113
|
-
() => new PluginClass(),
|
|
114
|
-
])),
|
|
115
|
-
};
|
|
116
|
-
const plugins = [];
|
|
117
|
-
const discoveryPluginNames = config.plugins.discovery ?? [];
|
|
118
|
-
for (const name of discoveryPluginNames) {
|
|
119
|
-
const factory = availablePlugins[name];
|
|
120
|
-
if (factory) {
|
|
121
|
-
plugins.push(factory());
|
|
122
|
-
log(`[Grafema MCP] Enabled discovery plugin: ${name}`);
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
log(`[Grafema MCP] Warning: Unknown discovery plugin ${name}`);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
const orchestrator = new Orchestrator({
|
|
129
|
-
graph: db,
|
|
130
|
-
plugins: plugins,
|
|
131
|
-
});
|
|
132
|
-
const manifest = await orchestrator.discover(projectPath);
|
|
133
|
-
log(`[Grafema MCP] Discovery complete: found ${manifest.services?.length || 0} services`);
|
|
134
|
-
return manifest.services || [];
|
|
201
|
+
log(`[Grafema MCP] Service discovery is handled by grafema-orchestrator. Project: ${projectPath}`);
|
|
202
|
+
return [];
|
|
135
203
|
}
|
|
136
204
|
//# sourceMappingURL=analysis.js.map
|
package/dist/analysis.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analysis.js","sourceRoot":"","sources":["../src/analysis.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"analysis.js","sourceRoot":"","sources":["../src/analysis.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAA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.
|
|
5
|
+
* Plugin instantiation is no longer needed — grafema-orchestrator handles analysis.
|
|
3
6
|
*/
|
|
4
|
-
import { type GrafemaConfig } from '@grafema/
|
|
7
|
+
import { type GrafemaConfig } from '@grafema/util';
|
|
5
8
|
/**
|
|
6
9
|
* MCP-specific configuration extends GrafemaConfig with additional fields.
|
|
7
10
|
*/
|
|
@@ -16,18 +19,9 @@ export interface MCPConfig extends GrafemaConfig {
|
|
|
16
19
|
backend?: 'local' | 'rfdb';
|
|
17
20
|
rfdb_socket?: string;
|
|
18
21
|
}
|
|
19
|
-
type PluginFactory = () => unknown;
|
|
20
|
-
export declare const BUILTIN_PLUGINS: Record<string, PluginFactory>;
|
|
21
22
|
/**
|
|
22
23
|
* Load MCP configuration (extends base GrafemaConfig).
|
|
23
|
-
* Uses shared
|
|
24
|
+
* Uses shared loader but adds MCP-specific defaults.
|
|
24
25
|
*/
|
|
25
26
|
export declare function loadConfig(projectPath: string): MCPConfig;
|
|
26
|
-
export interface CustomPluginResult {
|
|
27
|
-
plugins: unknown[];
|
|
28
|
-
pluginMap: Record<string, new () => unknown>;
|
|
29
|
-
}
|
|
30
|
-
export declare function loadCustomPlugins(projectPath: string): Promise<CustomPluginResult>;
|
|
31
|
-
export declare function createPlugins(config: GrafemaConfig['plugins'], customPluginMap?: Record<string, new () => unknown>): unknown[];
|
|
32
|
-
export {};
|
|
33
27
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAoC,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAGrF;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC9C,SAAS,CAAC,EAAE;QACV,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;IACF,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAUD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAWzD"}
|