fivocell 2.0.0 → 3.1.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.
- package/README.md +104 -697
- package/dist/behavioral-tracker.d.ts +90 -0
- package/dist/behavioral-tracker.d.ts.map +1 -0
- package/dist/behavioral-tracker.js +185 -0
- package/dist/behavioral-tracker.js.map +1 -0
- package/dist/cli.d.ts +1 -6
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +430 -3862
- package/dist/cli.js.map +1 -1
- package/dist/code-scanner.d.ts +51 -0
- package/dist/code-scanner.d.ts.map +1 -0
- package/dist/code-scanner.js +966 -0
- package/dist/code-scanner.js.map +1 -0
- package/dist/community-intel.d.ts +34 -0
- package/dist/community-intel.d.ts.map +1 -0
- package/dist/community-intel.js +148 -0
- package/dist/community-intel.js.map +1 -0
- package/dist/cross-model-engine.d.ts +38 -0
- package/dist/cross-model-engine.d.ts.map +1 -0
- package/dist/cross-model-engine.js +98 -0
- package/dist/cross-model-engine.js.map +1 -0
- package/dist/daemon/lifecycle.d.ts +0 -15
- package/dist/daemon/lifecycle.d.ts.map +1 -1
- package/dist/daemon/lifecycle.js +88 -231
- package/dist/daemon/lifecycle.js.map +1 -1
- package/dist/daemon/server.d.ts.map +1 -1
- package/dist/daemon/server.js +403 -19
- package/dist/daemon/server.js.map +1 -1
- package/dist/developer-intelligence.d.ts +18 -0
- package/dist/developer-intelligence.d.ts.map +1 -0
- package/dist/developer-intelligence.js +180 -0
- package/dist/developer-intelligence.js.map +1 -0
- package/dist/layers.d.ts +92 -0
- package/dist/layers.d.ts.map +1 -0
- package/dist/layers.js +226 -0
- package/dist/layers.js.map +1 -0
- package/dist/mcp-server.d.ts +194 -1842
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +169 -875
- package/dist/mcp-server.js.map +1 -1
- package/dist/pc-scanner.d.ts +46 -0
- package/dist/pc-scanner.d.ts.map +1 -0
- package/dist/pc-scanner.js +488 -0
- package/dist/pc-scanner.js.map +1 -0
- package/dist/predictive-engine.d.ts +19 -0
- package/dist/predictive-engine.d.ts.map +1 -0
- package/dist/predictive-engine.js +107 -0
- package/dist/predictive-engine.js.map +1 -0
- package/dist/style-pull.d.ts +1 -1
- package/dist/style-pull.js +2 -2
- package/dist/team-git.d.ts +47 -0
- package/dist/team-git.d.ts.map +1 -0
- package/dist/team-git.js +305 -0
- package/dist/team-git.js.map +1 -0
- package/package.json +1 -1
package/dist/mcp-server.js
CHANGED
|
@@ -36,10 +36,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.RESOURCES = exports.TOOLS = void 0;
|
|
37
37
|
exports.startMCPServer = startMCPServer;
|
|
38
38
|
const http = __importStar(require("http"));
|
|
39
|
-
const senior_features_1 = require("./senior-features");
|
|
40
39
|
const prompt_builder_1 = require("./core/prompt-builder");
|
|
41
40
|
const database_1 = require("./core/database");
|
|
42
|
-
const session_memory_1 = require("./core/session-memory");
|
|
43
41
|
const DAEMON_URL = 'http://localhost:9876';
|
|
44
42
|
const MCP_PORT = 9877;
|
|
45
43
|
let daemonEnsuredAt = 0;
|
|
@@ -52,35 +50,31 @@ async function ensureDaemonForMCP() {
|
|
|
52
50
|
if (now - daemonEnsuredAt < DAEMON_RECHECK_MS)
|
|
53
51
|
return true;
|
|
54
52
|
const { ensureDaemon } = require('./daemon/lifecycle');
|
|
55
|
-
const p = ensureDaemon({ silent: true }).finally(() => {
|
|
56
|
-
daemonEnsuring = null;
|
|
57
|
-
});
|
|
53
|
+
const p = ensureDaemon({ silent: true }).finally(() => { daemonEnsuring = null; });
|
|
58
54
|
daemonEnsuring = p;
|
|
59
55
|
const ok = await p;
|
|
60
56
|
if (ok)
|
|
61
57
|
daemonEnsuredAt = Date.now();
|
|
62
58
|
return ok;
|
|
63
59
|
}
|
|
64
|
-
function daemonRequest(method,
|
|
60
|
+
function daemonRequest(method, urlPath, body) {
|
|
65
61
|
return new Promise(async (resolve, reject) => {
|
|
66
|
-
if (
|
|
62
|
+
if (urlPath !== '/health') {
|
|
67
63
|
const ok = await ensureDaemonForMCP();
|
|
68
64
|
if (!ok) {
|
|
69
|
-
reject(new Error('Cell daemon
|
|
65
|
+
reject(new Error('Cell daemon not running. Run `cell start`.'));
|
|
70
66
|
return;
|
|
71
67
|
}
|
|
72
68
|
}
|
|
73
|
-
const url = new URL(
|
|
69
|
+
const url = new URL(urlPath, DAEMON_URL);
|
|
74
70
|
const req = http.request({
|
|
75
|
-
method,
|
|
76
|
-
hostname: url.hostname,
|
|
77
|
-
port: url.port,
|
|
71
|
+
method, hostname: url.hostname, port: url.port,
|
|
78
72
|
path: url.pathname + url.search,
|
|
79
73
|
headers: { 'Content-Type': 'application/json' },
|
|
80
74
|
timeout: 15000,
|
|
81
75
|
}, (res) => {
|
|
82
76
|
let data = '';
|
|
83
|
-
res.on('data', (
|
|
77
|
+
res.on('data', (c) => (data += c));
|
|
84
78
|
res.on('end', () => {
|
|
85
79
|
try {
|
|
86
80
|
resolve(JSON.parse(data));
|
|
@@ -90,637 +84,255 @@ function daemonRequest(method, path, body) {
|
|
|
90
84
|
}
|
|
91
85
|
});
|
|
92
86
|
});
|
|
93
|
-
req.on('error', (err) => {
|
|
94
|
-
daemonEnsuredAt = 0;
|
|
95
|
-
reject(err);
|
|
96
|
-
});
|
|
87
|
+
req.on('error', (err) => { daemonEnsuredAt = 0; reject(err); });
|
|
97
88
|
if (body)
|
|
98
89
|
req.write(JSON.stringify(body));
|
|
99
90
|
req.end();
|
|
100
91
|
});
|
|
101
92
|
}
|
|
93
|
+
// ─── 6 Essential MCP Tools ─────────────────────────────────────────────────
|
|
102
94
|
exports.TOOLS = [
|
|
103
95
|
{
|
|
104
|
-
name: '
|
|
105
|
-
description: '
|
|
106
|
-
inputSchema: {
|
|
107
|
-
type: 'object',
|
|
108
|
-
properties: {
|
|
109
|
-
language: { type: 'string', description: 'Programming language' },
|
|
110
|
-
framework: { type: 'string', description: 'Framework (optional)' },
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
name: 'cell_send_signal',
|
|
116
|
-
description: 'Send learning signal when user edits/rejects AI output',
|
|
117
|
-
inputSchema: {
|
|
118
|
-
type: 'object',
|
|
119
|
-
properties: {
|
|
120
|
-
type: { type: 'string', enum: ['edit_diff', 'accept', 'reject', 'retry'] },
|
|
121
|
-
originalCode: { type: 'string' },
|
|
122
|
-
editedCode: { type: 'string' },
|
|
123
|
-
language: { type: 'string' },
|
|
124
|
-
framework: { type: 'string' },
|
|
125
|
-
fileType: { type: 'string' },
|
|
126
|
-
},
|
|
127
|
-
required: ['type', 'language'],
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
name: 'cell_get_profile',
|
|
132
|
-
description: 'Get full taste profile with patterns and confidence scores',
|
|
133
|
-
inputSchema: { type: 'object', properties: {} },
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: 'cell_predict_next_action',
|
|
137
|
-
description: 'Predict next action based on context',
|
|
138
|
-
inputSchema: {
|
|
139
|
-
type: 'object',
|
|
140
|
-
properties: { context: { type: 'string' } },
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
name: 'cell_check_build',
|
|
145
|
-
description: 'Check for potential build failures',
|
|
146
|
-
inputSchema: {
|
|
147
|
-
type: 'object',
|
|
148
|
-
properties: { files: { type: 'string' } },
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
name: 'cell_community_stats',
|
|
153
|
-
description: 'Get community intelligence stats — pattern count, developer count, total outcomes',
|
|
154
|
-
inputSchema: { type: 'object', properties: {} },
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: 'cell_community_rankings',
|
|
158
|
-
description: 'Get community-wide pattern rankings by category',
|
|
159
|
-
inputSchema: {
|
|
160
|
-
type: 'object',
|
|
161
|
-
properties: {
|
|
162
|
-
limit: { type: 'number', description: 'Max entries per category (default: 10)' },
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
name: 'cell_community_trends',
|
|
168
|
-
description: 'Get rising/declining pattern trends across the community',
|
|
169
|
-
inputSchema: {
|
|
170
|
-
type: 'object',
|
|
171
|
-
properties: {
|
|
172
|
-
limit: { type: 'number', description: 'Max trends (default: 20)' },
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
name: 'cell_community_insights',
|
|
178
|
-
description: 'Get actionable community insights — adoption, language-specific best patterns',
|
|
179
|
-
inputSchema: { type: 'object', properties: {} },
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
name: 'cell_community_playbooks',
|
|
183
|
-
description: 'Get community-generated playbooks for specific categories',
|
|
184
|
-
inputSchema: {
|
|
185
|
-
type: 'object',
|
|
186
|
-
properties: {
|
|
187
|
-
category: { type: 'string', description: 'Filter by category (optional)' },
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
name: 'cell_community_reputation',
|
|
193
|
-
description: 'Get top community pattern entries by reputation score',
|
|
194
|
-
inputSchema: {
|
|
195
|
-
type: 'object',
|
|
196
|
-
properties: {
|
|
197
|
-
limit: { type: 'number', description: 'Max entries (default: 20)' },
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
name: 'cell_org_benchmarks',
|
|
203
|
-
description: 'Get organization-wide benchmarks — success rate, testing adoption, CI adoption per team',
|
|
204
|
-
inputSchema: {
|
|
205
|
-
type: 'object',
|
|
206
|
-
properties: {
|
|
207
|
-
orgId: { type: 'string', description: 'Organization ID' },
|
|
208
|
-
},
|
|
209
|
-
required: ['orgId'],
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
name: 'cell_org_silos',
|
|
214
|
-
description: 'Detect knowledge silos within an organization',
|
|
215
|
-
inputSchema: {
|
|
216
|
-
type: 'object',
|
|
217
|
-
properties: {
|
|
218
|
-
orgId: { type: 'string', description: 'Organization ID' },
|
|
219
|
-
},
|
|
220
|
-
required: ['orgId'],
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
name: 'cell_org_bus_factor',
|
|
225
|
-
description: 'Compute bus factor — identifies patterns owned by too few members',
|
|
226
|
-
inputSchema: {
|
|
227
|
-
type: 'object',
|
|
228
|
-
properties: {
|
|
229
|
-
orgId: { type: 'string', description: 'Organization ID' },
|
|
230
|
-
},
|
|
231
|
-
required: ['orgId'],
|
|
232
|
-
},
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
name: 'cell_org_risks',
|
|
236
|
-
description: 'Get team-level risk reports for an organization',
|
|
237
|
-
inputSchema: {
|
|
238
|
-
type: 'object',
|
|
239
|
-
properties: {
|
|
240
|
-
orgId: { type: 'string', description: 'Organization ID' },
|
|
241
|
-
},
|
|
242
|
-
required: ['orgId'],
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
name: 'cell_org_insights',
|
|
247
|
-
description: 'Get executive insights for an organization',
|
|
248
|
-
inputSchema: {
|
|
249
|
-
type: 'object',
|
|
250
|
-
properties: {
|
|
251
|
-
orgId: { type: 'string', description: 'Organization ID' },
|
|
252
|
-
},
|
|
253
|
-
required: ['orgId'],
|
|
254
|
-
},
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
name: 'cell_org_playbooks',
|
|
258
|
-
description: 'Get organization-specific playbooks',
|
|
259
|
-
inputSchema: {
|
|
260
|
-
type: 'object',
|
|
261
|
-
properties: {
|
|
262
|
-
orgId: { type: 'string', description: 'Organization ID' },
|
|
263
|
-
},
|
|
264
|
-
required: ['orgId'],
|
|
265
|
-
},
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
name: 'cell_intelligence_score',
|
|
269
|
-
description: 'Compute a developer\'s intelligence score across 7 dimensions (outcome, confidence, health, project, community, org, knowledge)',
|
|
270
|
-
inputSchema: {
|
|
271
|
-
type: 'object',
|
|
272
|
-
properties: {
|
|
273
|
-
developerId: { type: 'string', description: 'Developer ID' },
|
|
274
|
-
patterns: { type: 'array', description: 'Array of patterns' },
|
|
275
|
-
outcomesMap: { type: 'object', description: 'Pattern outcomes map', additionalProperties: true },
|
|
276
|
-
communityStats: { type: 'object', description: 'Community statistics', additionalProperties: true },
|
|
277
|
-
orgStats: { type: 'object', description: 'Organization statistics', additionalProperties: true },
|
|
278
|
-
projectDNA: { type: 'object', description: 'Project DNA profile', additionalProperties: true },
|
|
279
|
-
weights: { type: 'object', description: 'Optional dimension weights', additionalProperties: true },
|
|
280
|
-
},
|
|
281
|
-
required: ['developerId', 'patterns'],
|
|
282
|
-
},
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
name: 'cell_analyze_risks',
|
|
286
|
-
description: 'Analyze risks with root cause, probability, impact, and recommendations',
|
|
287
|
-
inputSchema: {
|
|
288
|
-
type: 'object',
|
|
289
|
-
properties: {
|
|
290
|
-
developerId: { type: 'string' },
|
|
291
|
-
teamId: { type: 'string' },
|
|
292
|
-
orgId: { type: 'string' },
|
|
293
|
-
patterns: { type: 'array' },
|
|
294
|
-
outcomesMap: { type: 'object' },
|
|
295
|
-
teamProfiles: { type: 'array' },
|
|
296
|
-
orgBenchmarks: { type: 'array' },
|
|
297
|
-
knowledgeGaps: { type: 'array' },
|
|
298
|
-
},
|
|
299
|
-
required: ['developerId', 'patterns'],
|
|
300
|
-
},
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
name: 'cell_find_opportunities',
|
|
304
|
-
description: 'Find improvement opportunities — success, testing, CI, code review, community adoption',
|
|
305
|
-
inputSchema: {
|
|
306
|
-
type: 'object',
|
|
307
|
-
properties: {
|
|
308
|
-
developerId: { type: 'string' },
|
|
309
|
-
patterns: { type: 'array' },
|
|
310
|
-
outcomesMap: { type: 'object' },
|
|
311
|
-
projectDNA: { type: 'object' },
|
|
312
|
-
communityStats: { type: 'object' },
|
|
313
|
-
orgBenchmarks: { type: 'array' },
|
|
314
|
-
},
|
|
315
|
-
required: ['developerId', 'patterns'],
|
|
316
|
-
},
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
name: 'cell_generate_decisions',
|
|
320
|
-
description: 'Generate priority-ranked decisions from risks, opportunities, and knowledge gaps',
|
|
321
|
-
inputSchema: {
|
|
322
|
-
type: 'object',
|
|
323
|
-
properties: {
|
|
324
|
-
developerId: { type: 'string' },
|
|
325
|
-
patterns: { type: 'array' },
|
|
326
|
-
risks: { type: 'array' },
|
|
327
|
-
opportunities: { type: 'array' },
|
|
328
|
-
knowledgeGaps: { type: 'array' },
|
|
329
|
-
orgBenchmarks: { type: 'array' },
|
|
330
|
-
},
|
|
331
|
-
required: ['developerId'],
|
|
332
|
-
},
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
name: 'cell_intelligence_report',
|
|
336
|
-
description: 'Generate a full intelligence report with score, strengths, weaknesses, and recommended actions',
|
|
337
|
-
inputSchema: {
|
|
338
|
-
type: 'object',
|
|
339
|
-
properties: {
|
|
340
|
-
developerId: { type: 'string' },
|
|
341
|
-
intelligenceScore: { type: 'object' },
|
|
342
|
-
risks: { type: 'array' },
|
|
343
|
-
opportunities: { type: 'array' },
|
|
344
|
-
decisions: { type: 'array' },
|
|
345
|
-
knowledgeGaps: { type: 'array' },
|
|
346
|
-
benchmarks: { type: 'array' },
|
|
347
|
-
lifecycles: { type: 'array' },
|
|
348
|
-
},
|
|
349
|
-
required: ['developerId', 'intelligenceScore'],
|
|
350
|
-
},
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
name: 'cell_get_recommendations',
|
|
354
|
-
description: 'Get personalized pattern recommendations based on developer profile and similar developers',
|
|
355
|
-
inputSchema: {
|
|
356
|
-
type: 'object',
|
|
357
|
-
properties: {
|
|
358
|
-
developerId: { type: 'string', description: 'Developer ID' },
|
|
359
|
-
patterns: { type: 'array', description: 'All patterns' },
|
|
360
|
-
outcomesMap: { type: 'object', description: 'Pattern outcomes map' },
|
|
361
|
-
allProfiles: { type: 'object', description: 'All developer profiles map' },
|
|
362
|
-
},
|
|
363
|
-
required: ['developerId', 'patterns'],
|
|
364
|
-
},
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
name: 'cell_outcome_leaderboard',
|
|
368
|
-
description: 'Get pattern outcome leaderboard — top patterns by evidence-based confidence',
|
|
369
|
-
inputSchema: {
|
|
370
|
-
type: 'object',
|
|
371
|
-
properties: {
|
|
372
|
-
minEvents: { type: 'number', description: 'Minimum events (default: 0)' },
|
|
373
|
-
limit: { type: 'number', description: 'Max entries (default: 20)' },
|
|
374
|
-
},
|
|
375
|
-
},
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
name: 'cell_project_dna',
|
|
379
|
-
description: 'Build or get Project DNA profile for a repository path',
|
|
380
|
-
inputSchema: {
|
|
381
|
-
type: 'object',
|
|
382
|
-
properties: {
|
|
383
|
-
projectPath: { type: 'string', description: 'Absolute path to project' },
|
|
384
|
-
},
|
|
385
|
-
required: ['projectPath'],
|
|
386
|
-
},
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
name: 'cell_get_stack_summary',
|
|
390
|
-
description: 'Get detected stack: language, frameworks, libraries, tools, and confidence score',
|
|
391
|
-
inputSchema: { type: 'object', properties: {} },
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
name: 'cell_lint_style',
|
|
395
|
-
description: 'Lint a code snippet for style match against community best practices (returns match %, off-brand patterns, suggestions)',
|
|
396
|
-
inputSchema: {
|
|
397
|
-
type: 'object',
|
|
398
|
-
properties: {
|
|
399
|
-
file: { type: 'string', description: 'File path or name' },
|
|
400
|
-
code: { type: 'string', description: 'Code content to lint' },
|
|
401
|
-
},
|
|
402
|
-
required: ['file', 'code'],
|
|
403
|
-
},
|
|
404
|
-
},
|
|
405
|
-
{
|
|
406
|
-
name: 'cell_suggest_pattern',
|
|
407
|
-
description: 'Suggest community-validated pattern for a given file and context (returns suggestion, adoption %, top-dev usage)',
|
|
408
|
-
inputSchema: {
|
|
409
|
-
type: 'object',
|
|
410
|
-
properties: {
|
|
411
|
-
file: { type: 'string', description: 'File path or name' },
|
|
412
|
-
context: { type: 'string', description: 'Context tag: testing, async, validation, error, state, api, types, import' },
|
|
413
|
-
},
|
|
414
|
-
required: ['file', 'context'],
|
|
415
|
-
},
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
name: 'cell_predict_next_file',
|
|
419
|
-
description: 'Predict the next file the developer will likely create or edit, based on workflow history',
|
|
420
|
-
inputSchema: { type: 'object', properties: {} },
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
name: 'cell_daily_brief',
|
|
424
|
-
description: 'Get a daily brief: yesterday summary (patterns, files, signals), today predictions, weekly trend',
|
|
425
|
-
inputSchema: { type: 'object', properties: {} },
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
name: 'cell_inject_context',
|
|
429
|
-
description: 'Inject your complete developer context — style, patterns, blind spots, predictions. Use @cell in any AI tool.',
|
|
430
|
-
inputSchema: {
|
|
431
|
-
type: 'object',
|
|
432
|
-
properties: {
|
|
433
|
-
projectPath: { type: 'string', description: 'Optional — project path for specific context' },
|
|
434
|
-
toolName: { type: 'string', description: 'Optional — AI tool name (cursor, claude, windsurf, copilot, antigravity)' },
|
|
435
|
-
compact: { type: 'boolean', description: 'Compact format for prompt injection (default: false)' },
|
|
436
|
-
},
|
|
437
|
-
},
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
name: 'cell_session_start',
|
|
441
|
-
description: 'Start a new session with tool name and project',
|
|
442
|
-
inputSchema: {
|
|
443
|
-
type: 'object',
|
|
444
|
-
properties: {
|
|
445
|
-
toolName: { type: 'string', description: 'AI tool name (cursor, claude, windsurf, etc.)' },
|
|
446
|
-
project: { type: 'string', description: 'Project name or path' },
|
|
447
|
-
},
|
|
448
|
-
required: ['toolName', 'project'],
|
|
449
|
-
},
|
|
450
|
-
},
|
|
451
|
-
{
|
|
452
|
-
name: 'cell_session_end',
|
|
453
|
-
description: 'End a session with files touched and key decisions',
|
|
96
|
+
name: 'cell_get_dev_profile',
|
|
97
|
+
description: 'Developer profile — naming, style, errors, architecture, strengths, improvements',
|
|
454
98
|
inputSchema: {
|
|
455
99
|
type: 'object',
|
|
456
|
-
properties: {
|
|
457
|
-
|
|
458
|
-
filesTouched: { type: 'array', items: { type: 'string' }, description: 'Files worked on' },
|
|
459
|
-
keyDecisions: { type: 'array', items: { type: 'string' }, description: 'Key decisions made' },
|
|
460
|
-
contextSnapshot: { type: 'string', description: 'Summary of what was done' },
|
|
461
|
-
},
|
|
462
|
-
required: ['sessionId'],
|
|
100
|
+
properties: { project: { type: 'string' } },
|
|
101
|
+
required: ['project'],
|
|
463
102
|
},
|
|
464
103
|
},
|
|
465
104
|
{
|
|
466
|
-
name: '
|
|
467
|
-
description: '
|
|
105
|
+
name: 'cell_get_code_patterns',
|
|
106
|
+
description: 'Code patterns by category — naming, imports, error_handling, style, architecture, testing, functions',
|
|
468
107
|
inputSchema: {
|
|
469
108
|
type: 'object',
|
|
470
109
|
properties: {
|
|
471
|
-
|
|
472
|
-
|
|
110
|
+
project: { type: 'string' },
|
|
111
|
+
category: { type: 'string' },
|
|
473
112
|
},
|
|
113
|
+
required: ['project'],
|
|
474
114
|
},
|
|
475
115
|
},
|
|
476
116
|
{
|
|
477
|
-
name: '
|
|
478
|
-
description: '
|
|
117
|
+
name: 'cell_deep_scan',
|
|
118
|
+
description: 'Deep scan codebase — extracts real coding patterns, style, architecture',
|
|
479
119
|
inputSchema: {
|
|
480
120
|
type: 'object',
|
|
481
121
|
properties: {
|
|
482
|
-
|
|
483
|
-
|
|
122
|
+
dir: { type: 'string' },
|
|
123
|
+
project: { type: 'string' },
|
|
484
124
|
},
|
|
125
|
+
required: ['dir'],
|
|
485
126
|
},
|
|
486
127
|
},
|
|
487
128
|
{
|
|
488
|
-
name: '
|
|
489
|
-
description: '
|
|
129
|
+
name: 'cell_scan_report',
|
|
130
|
+
description: 'Full scan report — profile + all patterns for a project',
|
|
490
131
|
inputSchema: {
|
|
491
132
|
type: 'object',
|
|
492
|
-
properties: {
|
|
493
|
-
|
|
494
|
-
},
|
|
495
|
-
required: ['file'],
|
|
133
|
+
properties: { project: { type: 'string' } },
|
|
134
|
+
required: ['project'],
|
|
496
135
|
},
|
|
497
136
|
},
|
|
498
137
|
{
|
|
499
|
-
name: '
|
|
500
|
-
description: '
|
|
138
|
+
name: 'cell_send_signal',
|
|
139
|
+
description: 'Send learning signal — edit_diff, accept, reject, tab_switch, focus_block, file_save',
|
|
501
140
|
inputSchema: {
|
|
502
141
|
type: 'object',
|
|
503
142
|
properties: {
|
|
504
|
-
|
|
143
|
+
type: { type: 'string' },
|
|
144
|
+
originalCode: { type: 'string' },
|
|
145
|
+
editedCode: { type: 'string' },
|
|
146
|
+
file: { type: 'string' },
|
|
147
|
+
language: { type: 'string' },
|
|
505
148
|
},
|
|
506
|
-
required: ['
|
|
149
|
+
required: ['type'],
|
|
507
150
|
},
|
|
508
151
|
},
|
|
509
152
|
{
|
|
510
|
-
name: '
|
|
511
|
-
description: '
|
|
512
|
-
inputSchema: { type: 'object', properties: {} },
|
|
513
|
-
},
|
|
514
|
-
{
|
|
515
|
-
name: 'cell_tool_suggest',
|
|
516
|
-
description: 'Suggest best AI tool for a specific task type',
|
|
153
|
+
name: 'cell_get_context',
|
|
154
|
+
description: 'Full context injection — profile + patterns + blind spots for current project',
|
|
517
155
|
inputSchema: {
|
|
518
156
|
type: 'object',
|
|
519
157
|
properties: {
|
|
520
|
-
|
|
158
|
+
project: { type: 'string' },
|
|
159
|
+
tool: { type: 'string' },
|
|
521
160
|
},
|
|
522
|
-
required: ['
|
|
161
|
+
required: ['project'],
|
|
523
162
|
},
|
|
524
163
|
},
|
|
525
164
|
{
|
|
526
|
-
name: '
|
|
527
|
-
description: '
|
|
165
|
+
name: 'cell_scan_full_pc',
|
|
166
|
+
description: 'Scan entire PC for all code projects — builds comprehensive developer profile',
|
|
528
167
|
inputSchema: { type: 'object', properties: {} },
|
|
529
168
|
},
|
|
530
169
|
{
|
|
531
|
-
name: '
|
|
532
|
-
description: '
|
|
170
|
+
name: 'cell_behavior_summary',
|
|
171
|
+
description: 'Behavioral summary — errors, decisions, context, stuck issues for this project',
|
|
533
172
|
inputSchema: {
|
|
534
173
|
type: 'object',
|
|
535
|
-
properties: {
|
|
536
|
-
|
|
537
|
-
},
|
|
538
|
-
required: ['toolName'],
|
|
174
|
+
properties: { project: { type: 'string' } },
|
|
175
|
+
required: ['project'],
|
|
539
176
|
},
|
|
540
177
|
},
|
|
541
178
|
{
|
|
542
|
-
name: '
|
|
543
|
-
description: '
|
|
179
|
+
name: 'cell_log_error',
|
|
180
|
+
description: 'Log an error encounter — error type, message, file, line',
|
|
544
181
|
inputSchema: {
|
|
545
182
|
type: 'object',
|
|
546
183
|
properties: {
|
|
547
|
-
project: { type: 'string'
|
|
184
|
+
project: { type: 'string' },
|
|
185
|
+
file: { type: 'string' },
|
|
186
|
+
errorType: { type: 'string' },
|
|
187
|
+
errorMessage: { type: 'string' },
|
|
188
|
+
line: { type: 'number' },
|
|
548
189
|
},
|
|
190
|
+
required: ['errorType', 'errorMessage'],
|
|
549
191
|
},
|
|
550
192
|
},
|
|
551
193
|
{
|
|
552
|
-
name: '
|
|
553
|
-
description: '
|
|
554
|
-
inputSchema: { type: 'object', properties: {} },
|
|
555
|
-
},
|
|
556
|
-
{
|
|
557
|
-
name: 'cell_team_style',
|
|
558
|
-
description: 'Show merged team coding style — stack, patterns, conventions',
|
|
194
|
+
name: 'cell_log_fix',
|
|
195
|
+
description: 'Log how an error was fixed — fix applied, whether it worked, time taken',
|
|
559
196
|
inputSchema: {
|
|
560
197
|
type: 'object',
|
|
561
198
|
properties: {
|
|
562
|
-
|
|
199
|
+
errorId: { type: 'number' },
|
|
200
|
+
fixApplied: { type: 'string' },
|
|
201
|
+
worked: { type: 'boolean' },
|
|
202
|
+
timeToFixMs: { type: 'number' },
|
|
563
203
|
},
|
|
204
|
+
required: ['errorId', 'fixApplied', 'worked'],
|
|
564
205
|
},
|
|
565
206
|
},
|
|
566
207
|
{
|
|
567
|
-
name: '
|
|
568
|
-
description: '
|
|
208
|
+
name: 'cell_log_decision',
|
|
209
|
+
description: 'Log a coding decision — what approach was taken and if it worked',
|
|
569
210
|
inputSchema: {
|
|
570
211
|
type: 'object',
|
|
571
212
|
properties: {
|
|
572
|
-
|
|
573
|
-
|
|
213
|
+
project: { type: 'string' },
|
|
214
|
+
file: { type: 'string' },
|
|
215
|
+
decision: { type: 'string' },
|
|
216
|
+
approach: { type: 'string' },
|
|
217
|
+
worked: { type: 'boolean' },
|
|
574
218
|
},
|
|
219
|
+
required: ['decision'],
|
|
575
220
|
},
|
|
576
221
|
},
|
|
577
222
|
{
|
|
578
|
-
name: '
|
|
579
|
-
description: '
|
|
223
|
+
name: 'cell_log_context',
|
|
224
|
+
description: 'Log current context — what task is being worked on, which files involved',
|
|
580
225
|
inputSchema: {
|
|
581
226
|
type: 'object',
|
|
582
227
|
properties: {
|
|
583
|
-
|
|
584
|
-
|
|
228
|
+
project: { type: 'string' },
|
|
229
|
+
task: { type: 'string' },
|
|
230
|
+
files: { type: 'array', items: { type: 'string' } },
|
|
585
231
|
},
|
|
586
|
-
required: ['
|
|
232
|
+
required: ['task'],
|
|
587
233
|
},
|
|
588
234
|
},
|
|
589
235
|
{
|
|
590
|
-
name: '
|
|
591
|
-
description: '
|
|
236
|
+
name: 'cell_log_stuck',
|
|
237
|
+
description: 'Log when stuck — what the issue is, which file',
|
|
592
238
|
inputSchema: {
|
|
593
239
|
type: 'object',
|
|
594
240
|
properties: {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
241
|
+
project: { type: 'string' },
|
|
242
|
+
file: { type: 'string' },
|
|
243
|
+
description: { type: 'string' },
|
|
598
244
|
},
|
|
599
|
-
required: ['
|
|
245
|
+
required: ['description'],
|
|
600
246
|
},
|
|
601
247
|
},
|
|
602
|
-
{
|
|
603
|
-
name: 'cell_community_compare',
|
|
604
|
-
description: 'Compare personal skills against community benchmarks',
|
|
605
|
-
inputSchema: { type: 'object', properties: {} },
|
|
606
|
-
},
|
|
607
|
-
{
|
|
608
|
-
name: 'cell_community_trends',
|
|
609
|
-
description: 'Show technology and pattern trends from community',
|
|
610
|
-
inputSchema: { type: 'object', properties: {} },
|
|
611
|
-
},
|
|
612
|
-
{
|
|
613
|
-
name: 'cell_community_insights',
|
|
614
|
-
description: 'Actionable community insights — benchmarks, blind spots, trends',
|
|
615
|
-
inputSchema: { type: 'object', properties: {} },
|
|
616
|
-
},
|
|
617
|
-
{
|
|
618
|
-
name: 'cell_community_stats',
|
|
619
|
-
description: 'Community overview — developers, patterns, languages',
|
|
620
|
-
inputSchema: { type: 'object', properties: {} },
|
|
621
|
-
},
|
|
622
|
-
{
|
|
623
|
-
name: 'cell_rhythm',
|
|
624
|
-
description: 'Show coding rhythm — best hours, best days, flow patterns',
|
|
625
|
-
inputSchema: { type: 'object', properties: {} },
|
|
626
|
-
},
|
|
627
|
-
{
|
|
628
|
-
name: 'cell_burnout',
|
|
629
|
-
description: 'Check for burnout signals — error rate, session length, reverts',
|
|
630
|
-
inputSchema: { type: 'object', properties: {} },
|
|
631
|
-
},
|
|
632
|
-
{
|
|
633
|
-
name: 'cell_mastery',
|
|
634
|
-
description: 'Technology mastery map — per-language progress and confidence',
|
|
635
|
-
inputSchema: { type: 'object', properties: {} },
|
|
636
|
-
},
|
|
637
|
-
{
|
|
638
|
-
name: 'cell_growth',
|
|
639
|
-
description: 'Career trajectory — current level, senior readiness, recommendations',
|
|
640
|
-
inputSchema: { type: 'object', properties: {} },
|
|
641
|
-
},
|
|
642
|
-
{
|
|
643
|
-
name: 'cell_insights_weekly',
|
|
644
|
-
description: 'Weekly digest — sessions, bugs, decisions, highlights',
|
|
645
|
-
inputSchema: { type: 'object', properties: {} },
|
|
646
|
-
},
|
|
647
|
-
{
|
|
648
|
-
name: 'cell_health',
|
|
649
|
-
description: 'System health — DB status, memory, uptime, platform',
|
|
650
|
-
inputSchema: { type: 'object', properties: {} },
|
|
651
|
-
},
|
|
652
|
-
{
|
|
653
|
-
name: 'cell_metrics',
|
|
654
|
-
description: 'System metrics — queries/sec, patterns, sessions, DB tables',
|
|
655
|
-
inputSchema: { type: 'object', properties: {} },
|
|
656
|
-
},
|
|
657
|
-
{
|
|
658
|
-
name: 'cell_security',
|
|
659
|
-
description: 'Security status — auth token, rate limits, encryption',
|
|
660
|
-
inputSchema: { type: 'object', properties: {} },
|
|
661
|
-
},
|
|
662
|
-
{
|
|
663
|
-
name: 'cell_backup',
|
|
664
|
-
description: 'Create backup of cell database',
|
|
665
|
-
inputSchema: { type: 'object', properties: {} },
|
|
666
|
-
},
|
|
667
|
-
{
|
|
668
|
-
name: 'cell_optimize',
|
|
669
|
-
description: 'Optimize database — VACUUM, ANALYZE, prune',
|
|
670
|
-
inputSchema: { type: 'object', properties: {} },
|
|
671
|
-
},
|
|
672
|
-
{
|
|
673
|
-
name: 'cell_debug_style',
|
|
674
|
-
description: 'Debugging style — console.log vs debugger, efficiency, recommendations',
|
|
675
|
-
inputSchema: { type: 'object', properties: {} },
|
|
676
|
-
},
|
|
677
|
-
{
|
|
678
|
-
name: 'cell_prompt_style',
|
|
679
|
-
description: 'Prompt style — length, structure, iteration patterns',
|
|
680
|
-
inputSchema: { type: 'object', properties: {} },
|
|
681
|
-
},
|
|
682
|
-
{
|
|
683
|
-
name: 'cell_focus',
|
|
684
|
-
description: 'Focus analysis — deep work, shallow work, tab switching',
|
|
685
|
-
inputSchema: { type: 'object', properties: {} },
|
|
686
|
-
},
|
|
687
|
-
{
|
|
688
|
-
name: 'cell_ide_insights',
|
|
689
|
-
description: 'Full IDE intelligence — debug, prompt, focus, copy-paste, refactor combined',
|
|
690
|
-
inputSchema: { type: 'object', properties: {} },
|
|
691
|
-
},
|
|
692
|
-
{
|
|
693
|
-
name: 'cell_cloud_status',
|
|
694
|
-
description: 'Cloud sync status — pending, sent, failed, device ID',
|
|
695
|
-
inputSchema: { type: 'object', properties: {} },
|
|
696
|
-
},
|
|
697
|
-
{
|
|
698
|
-
name: 'cell_cloud_validate',
|
|
699
|
-
description: 'Validate payload for cloud — forbidden fields + 300-byte limit',
|
|
700
|
-
inputSchema: {
|
|
701
|
-
type: 'object',
|
|
702
|
-
properties: {
|
|
703
|
-
data: { type: 'object', description: 'Payload to validate' },
|
|
704
|
-
},
|
|
705
|
-
required: ['data'],
|
|
706
|
-
},
|
|
707
|
-
},
|
|
708
|
-
{
|
|
709
|
-
name: 'cell_cloud_queue',
|
|
710
|
-
description: 'Offline sync queue — pending, failed, retryable',
|
|
711
|
-
inputSchema: { type: 'object', properties: {} },
|
|
712
|
-
},
|
|
713
248
|
];
|
|
714
249
|
exports.RESOURCES = [
|
|
715
|
-
{ uri: 'cell://taste/profile', name: 'Taste Profile', description: 'Full taste profile' },
|
|
716
|
-
{ uri: 'cell://community/stats', name: 'Community Stats', description: 'Aggregate community patterns' },
|
|
717
|
-
{ uri: 'cell://community/v2/stats', name: 'Community Intelligence Stats', description: 'Full community intelligence statistics' },
|
|
718
|
-
{ uri: 'cell://community/v2/insights', name: 'Community Insights', description: 'Actionable community insights' },
|
|
719
|
-
{ uri: 'cell://team/composite', name: 'Team Composite', description: 'Team taste composite' },
|
|
720
|
-
{ uri: 'cell://org/v2/benchmarks', name: 'Org Benchmarks', description: 'Organization-wide benchmarks' },
|
|
721
|
-
{ uri: 'cell://intelligence/reports', name: 'Intelligence Reports', description: 'All generated intelligence reports' },
|
|
722
250
|
{ uri: 'cell://health', name: 'Health', description: 'Daemon health status' },
|
|
723
251
|
];
|
|
252
|
+
// ─── Tool Handler ───────────────────────────────────────────────────────────
|
|
253
|
+
async function handleToolCall(params) {
|
|
254
|
+
const name = params?.name;
|
|
255
|
+
const args = params?.arguments || {};
|
|
256
|
+
switch (name) {
|
|
257
|
+
case 'cell_get_dev_profile': {
|
|
258
|
+
const { getDeveloperProfile } = await Promise.resolve().then(() => __importStar(require('./code-scanner')));
|
|
259
|
+
const profile = getDeveloperProfile(args.project);
|
|
260
|
+
if (!profile)
|
|
261
|
+
return { error: 'no profile — run cell scan first' };
|
|
262
|
+
return { project: args.project, profile };
|
|
263
|
+
}
|
|
264
|
+
case 'cell_get_code_patterns': {
|
|
265
|
+
const { getCodePatterns } = await Promise.resolve().then(() => __importStar(require('./code-scanner')));
|
|
266
|
+
return { project: args.project, patterns: getCodePatterns(args.project, args.category) };
|
|
267
|
+
}
|
|
268
|
+
case 'cell_deep_scan': {
|
|
269
|
+
const { scanCodebase } = await Promise.resolve().then(() => __importStar(require('./code-scanner')));
|
|
270
|
+
const result = scanCodebase(args.dir, args.project || require('path').basename(args.dir));
|
|
271
|
+
return { project: result.project, filesScanned: result.filesScanned, totalLines: result.totalLines, languages: result.languages, profile: result.profile, patternCount: result.patterns.length, strengths: result.profile.strengths, improvements: result.profile.improvements };
|
|
272
|
+
}
|
|
273
|
+
case 'cell_scan_report': {
|
|
274
|
+
const { getDeveloperProfile, getCodePatterns } = await Promise.resolve().then(() => __importStar(require('./code-scanner')));
|
|
275
|
+
const profile = getDeveloperProfile(args.project);
|
|
276
|
+
const patterns = getCodePatterns(args.project);
|
|
277
|
+
return { project: args.project, profile, patterns, patternCount: patterns.length };
|
|
278
|
+
}
|
|
279
|
+
case 'cell_send_signal': {
|
|
280
|
+
return daemonRequest('POST', '/signal', {
|
|
281
|
+
type: args.type,
|
|
282
|
+
originalCode: args.originalCode || '',
|
|
283
|
+
editedCode: args.editedCode || '',
|
|
284
|
+
file: args.file || '',
|
|
285
|
+
language: args.language || '',
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
case 'cell_get_context': {
|
|
289
|
+
(0, database_1.initializeDatabase)();
|
|
290
|
+
const ctx = (0, prompt_builder_1.buildContext)(args.project, args.tool);
|
|
291
|
+
const formatted = (0, prompt_builder_1.formatContextForInjection)(ctx, false);
|
|
292
|
+
return { content: [{ type: 'text', text: formatted }], context: ctx };
|
|
293
|
+
}
|
|
294
|
+
case 'cell_scan_full_pc': {
|
|
295
|
+
const { scanFullPC } = await Promise.resolve().then(() => __importStar(require('./pc-scanner')));
|
|
296
|
+
const result = scanFullPC();
|
|
297
|
+
return { totalProjects: result.totalProjects, totalFiles: result.totalFiles, totalLines: result.totalLines, languages: result.allLanguages, profile: result.aggregatedProfile, projects: result.projects.map((p) => ({ name: p.name, files: p.fileCount, lines: p.lineCount })) };
|
|
298
|
+
}
|
|
299
|
+
case 'cell_behavior_summary': {
|
|
300
|
+
const { getBehaviorSummary } = await Promise.resolve().then(() => __importStar(require('./behavioral-tracker')));
|
|
301
|
+
return getBehaviorSummary(args.project);
|
|
302
|
+
}
|
|
303
|
+
case 'cell_log_error': {
|
|
304
|
+
const { logError } = await Promise.resolve().then(() => __importStar(require('./behavioral-tracker')));
|
|
305
|
+
return logError({ project: args.project, file: args.file, errorType: args.errorType, errorMessage: args.errorMessage, line: args.line });
|
|
306
|
+
}
|
|
307
|
+
case 'cell_log_fix': {
|
|
308
|
+
const { logErrorFix } = await Promise.resolve().then(() => __importStar(require('./behavioral-tracker')));
|
|
309
|
+
logErrorFix({ errorId: args.errorId, fixApplied: args.fixApplied, worked: args.worked, timeToFixMs: args.timeToFixMs });
|
|
310
|
+
return { recorded: true };
|
|
311
|
+
}
|
|
312
|
+
case 'cell_log_decision': {
|
|
313
|
+
const { logDecision } = await Promise.resolve().then(() => __importStar(require('./behavioral-tracker')));
|
|
314
|
+
return logDecision({ project: args.project, file: args.file, decision: args.decision, approach: args.approach, worked: args.worked });
|
|
315
|
+
}
|
|
316
|
+
case 'cell_log_context': {
|
|
317
|
+
const { logContext } = await Promise.resolve().then(() => __importStar(require('./behavioral-tracker')));
|
|
318
|
+
return logContext({ project: args.project, task: args.task, files: args.files });
|
|
319
|
+
}
|
|
320
|
+
case 'cell_log_stuck': {
|
|
321
|
+
const { logStuck } = await Promise.resolve().then(() => __importStar(require('./behavioral-tracker')));
|
|
322
|
+
return logStuck({ project: args.project, file: args.file, description: args.description });
|
|
323
|
+
}
|
|
324
|
+
default:
|
|
325
|
+
return { error: `unknown tool: ${name}` };
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
// ─── Resource Handler ───────────────────────────────────────────────────────
|
|
329
|
+
async function handleResourceRead(params) {
|
|
330
|
+
const uri = params?.uri;
|
|
331
|
+
if (uri === 'cell://health')
|
|
332
|
+
return daemonRequest('GET', '/health');
|
|
333
|
+
return { error: `unknown resource: ${uri}` };
|
|
334
|
+
}
|
|
335
|
+
// ─── MCP Server ─────────────────────────────────────────────────────────────
|
|
724
336
|
function startMCPServer(port = MCP_PORT) {
|
|
725
337
|
const server = http.createServer(async (req, res) => {
|
|
726
338
|
if (req.method === 'GET' && req.url === '/health') {
|
|
@@ -753,14 +365,8 @@ function startMCPServer(port = MCP_PORT) {
|
|
|
753
365
|
case 'initialize':
|
|
754
366
|
result = {
|
|
755
367
|
protocolVersion: params?.protocolVersion || '2024-11-05',
|
|
756
|
-
capabilities: {
|
|
757
|
-
|
|
758
|
-
resources: { subscribe: false, listChanged: false },
|
|
759
|
-
},
|
|
760
|
-
serverInfo: {
|
|
761
|
-
name: 'fivo-cell',
|
|
762
|
-
version: '1.0.5',
|
|
763
|
-
},
|
|
368
|
+
capabilities: { tools: { listChanged: false }, resources: { subscribe: false, listChanged: false } },
|
|
369
|
+
serverInfo: { name: 'fivo-cell', version: '2.0.0' },
|
|
764
370
|
};
|
|
765
371
|
break;
|
|
766
372
|
case 'notifications/initialized':
|
|
@@ -787,11 +393,7 @@ function startMCPServer(port = MCP_PORT) {
|
|
|
787
393
|
break;
|
|
788
394
|
default:
|
|
789
395
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
790
|
-
res.end(JSON.stringify({
|
|
791
|
-
jsonrpc: '2.0',
|
|
792
|
-
id,
|
|
793
|
-
error: { code: -32601, message: `Method not found: ${method}` },
|
|
794
|
-
}));
|
|
396
|
+
res.end(JSON.stringify({ jsonrpc: '2.0', id, error: { code: -32601, message: `Method not found: ${method}` } }));
|
|
795
397
|
return;
|
|
796
398
|
}
|
|
797
399
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
@@ -805,316 +407,8 @@ function startMCPServer(port = MCP_PORT) {
|
|
|
805
407
|
});
|
|
806
408
|
});
|
|
807
409
|
server.listen(port, () => {
|
|
808
|
-
console.log(`Cell MCP Server
|
|
809
|
-
console.log(`MCP endpoint: http://localhost:${port}/mcp`);
|
|
410
|
+
console.log(`Cell MCP Server on http://localhost:${port}/mcp`);
|
|
810
411
|
});
|
|
811
412
|
return server;
|
|
812
413
|
}
|
|
813
|
-
async function handleToolCall(params) {
|
|
814
|
-
const name = params?.name;
|
|
815
|
-
const args = params?.arguments || {};
|
|
816
|
-
switch (name) {
|
|
817
|
-
case 'cell_get_taste_context': {
|
|
818
|
-
const q = new URLSearchParams();
|
|
819
|
-
if (args.language)
|
|
820
|
-
q.set('language', args.language);
|
|
821
|
-
if (args.framework)
|
|
822
|
-
q.set('framework', args.framework);
|
|
823
|
-
return daemonRequest('GET', `/taste/context?${q.toString()}`);
|
|
824
|
-
}
|
|
825
|
-
case 'cell_send_signal':
|
|
826
|
-
return daemonRequest('POST', '/signal', {
|
|
827
|
-
type: args.type,
|
|
828
|
-
originalCode: args.originalCode || '',
|
|
829
|
-
editedCode: args.editedCode || '',
|
|
830
|
-
context: {
|
|
831
|
-
language: args.language || '',
|
|
832
|
-
framework: args.framework || '',
|
|
833
|
-
fileType: args.fileType || '',
|
|
834
|
-
strictness: 'standard',
|
|
835
|
-
projectId: 'mcp-session',
|
|
836
|
-
},
|
|
837
|
-
});
|
|
838
|
-
case 'cell_get_profile':
|
|
839
|
-
return daemonRequest('GET', '/taste/profile');
|
|
840
|
-
case 'cell_predict_next_action':
|
|
841
|
-
return daemonRequest('GET', `/predict/next-action?context=${encodeURIComponent(args.context || '')}`);
|
|
842
|
-
case 'cell_check_build':
|
|
843
|
-
return daemonRequest('GET', `/predict/build-failure?files=${encodeURIComponent(args.files || '')}`);
|
|
844
|
-
case 'cell_community_stats':
|
|
845
|
-
return daemonRequest('GET', '/community/v2/stats');
|
|
846
|
-
case 'cell_community_rankings':
|
|
847
|
-
return daemonRequest('GET', `/community/v2/rankings?limit=${args.limit || 10}`);
|
|
848
|
-
case 'cell_community_trends':
|
|
849
|
-
return daemonRequest('GET', `/community/v2/trends?limit=${args.limit || 20}`);
|
|
850
|
-
case 'cell_community_insights':
|
|
851
|
-
return daemonRequest('GET', '/community/v2/insights');
|
|
852
|
-
case 'cell_community_playbooks':
|
|
853
|
-
return daemonRequest('POST', '/community/v2/playbooks', { developerProfiles: args.developerProfiles || [] });
|
|
854
|
-
case 'cell_community_reputation':
|
|
855
|
-
return daemonRequest('GET', `/community/v2/reputation?limit=${args.limit || 20}`);
|
|
856
|
-
case 'cell_org_benchmarks':
|
|
857
|
-
return daemonRequest('POST', `/org/v2/${args.orgId}/benchmarks`, {});
|
|
858
|
-
case 'cell_org_silos':
|
|
859
|
-
return daemonRequest('GET', `/org/v2/${args.orgId}/silos`);
|
|
860
|
-
case 'cell_org_bus_factor':
|
|
861
|
-
return daemonRequest('GET', `/org/v2/${args.orgId}/bus-factor`);
|
|
862
|
-
case 'cell_org_risks':
|
|
863
|
-
return daemonRequest('GET', `/org/v2/${args.orgId}/risks`);
|
|
864
|
-
case 'cell_org_insights':
|
|
865
|
-
return daemonRequest('GET', `/org/v2/${args.orgId}/insights`);
|
|
866
|
-
case 'cell_org_playbooks':
|
|
867
|
-
return daemonRequest('GET', `/org/v2/${args.orgId}/playbooks`);
|
|
868
|
-
case 'cell_intelligence_score':
|
|
869
|
-
return daemonRequest('POST', '/intelligence/score', args);
|
|
870
|
-
case 'cell_analyze_risks':
|
|
871
|
-
return daemonRequest('POST', '/intelligence/risks', args);
|
|
872
|
-
case 'cell_find_opportunities':
|
|
873
|
-
return daemonRequest('POST', '/intelligence/opportunities', args);
|
|
874
|
-
case 'cell_generate_decisions':
|
|
875
|
-
return daemonRequest('POST', '/intelligence/decisions', args);
|
|
876
|
-
case 'cell_intelligence_report':
|
|
877
|
-
return daemonRequest('POST', '/intelligence/report', args);
|
|
878
|
-
case 'cell_get_recommendations':
|
|
879
|
-
return daemonRequest('POST', '/recommendations', {
|
|
880
|
-
developerId: args.developerId,
|
|
881
|
-
patterns: args.patterns || [],
|
|
882
|
-
outcomesMap: args.outcomesMap || {},
|
|
883
|
-
allProfiles: args.allProfiles || {},
|
|
884
|
-
});
|
|
885
|
-
case 'cell_outcome_leaderboard':
|
|
886
|
-
return daemonRequest('GET', `/outcomes/leaderboard?minEvents=${args.minEvents || 0}&limit=${args.limit || 20}`);
|
|
887
|
-
case 'cell_project_dna':
|
|
888
|
-
return daemonRequest('POST', '/project/dna-build', { projectPath: args.projectPath });
|
|
889
|
-
case 'cell_get_stack_summary':
|
|
890
|
-
return await (0, senior_features_1.getStackSummary)();
|
|
891
|
-
case 'cell_lint_style':
|
|
892
|
-
return await (0, senior_features_1.lintStyle)(args.file || 'unknown', args.code || '');
|
|
893
|
-
case 'cell_suggest_pattern':
|
|
894
|
-
return await (0, senior_features_1.suggestPattern)(args.file || 'unknown', args.context || '');
|
|
895
|
-
case 'cell_predict_next_file':
|
|
896
|
-
return await (0, senior_features_1.predictNextFile)();
|
|
897
|
-
case 'cell_daily_brief':
|
|
898
|
-
return await (0, senior_features_1.getDailyBrief)();
|
|
899
|
-
case 'cell_inject_context': {
|
|
900
|
-
(0, database_1.initializeDatabase)();
|
|
901
|
-
const ctx = (0, prompt_builder_1.buildContext)(args.projectPath, args.toolName);
|
|
902
|
-
const formatted = (0, prompt_builder_1.formatContextForInjection)(ctx, args.compact);
|
|
903
|
-
return {
|
|
904
|
-
content: [{ type: 'text', text: formatted }],
|
|
905
|
-
context: ctx,
|
|
906
|
-
};
|
|
907
|
-
}
|
|
908
|
-
case 'cell_session_start': {
|
|
909
|
-
(0, database_1.initializeDatabase)();
|
|
910
|
-
const sm = new session_memory_1.SessionMemory();
|
|
911
|
-
const sessionId = sm.startSession(args.toolName, args.project);
|
|
912
|
-
return { sessionId };
|
|
913
|
-
}
|
|
914
|
-
case 'cell_session_end': {
|
|
915
|
-
(0, database_1.initializeDatabase)();
|
|
916
|
-
const sm = new session_memory_1.SessionMemory();
|
|
917
|
-
sm.endSession(args.sessionId, {
|
|
918
|
-
filesTouched: args.filesTouched,
|
|
919
|
-
keyDecisions: args.keyDecisions,
|
|
920
|
-
contextSnapshot: args.contextSnapshot,
|
|
921
|
-
});
|
|
922
|
-
return { ended: true };
|
|
923
|
-
}
|
|
924
|
-
case 'cell_get_sessions': {
|
|
925
|
-
(0, database_1.initializeDatabase)();
|
|
926
|
-
const sm = new session_memory_1.SessionMemory();
|
|
927
|
-
const sessions = sm.getRecentSessions(args.limit || 10);
|
|
928
|
-
const stats = sm.getSessionStats();
|
|
929
|
-
const chain = sm.buildContextChain();
|
|
930
|
-
return { sessions, stats, contextChain: chain };
|
|
931
|
-
}
|
|
932
|
-
case 'cell_predict': {
|
|
933
|
-
const { getAllPredictions } = await Promise.resolve().then(() => __importStar(require('./predictive-intelligence')));
|
|
934
|
-
const predictions = getAllPredictions(args.project);
|
|
935
|
-
const filtered = args.type ? predictions.filter((p) => p.type === args.type) : predictions;
|
|
936
|
-
return { predictions: filtered, count: filtered.length };
|
|
937
|
-
}
|
|
938
|
-
case 'cell_predict_risk': {
|
|
939
|
-
const { calculateFileRisk } = await Promise.resolve().then(() => __importStar(require('./predictive-intelligence')));
|
|
940
|
-
return calculateFileRisk(args.file);
|
|
941
|
-
}
|
|
942
|
-
case 'cell_predict_time': {
|
|
943
|
-
const { estimateFeatureTime } = await Promise.resolve().then(() => __importStar(require('./predictive-intelligence')));
|
|
944
|
-
return estimateFeatureTime(args.feature);
|
|
945
|
-
}
|
|
946
|
-
case 'cell_tool_compare': {
|
|
947
|
-
const { compareTools } = await Promise.resolve().then(() => __importStar(require('./cross-model-memory')));
|
|
948
|
-
return { tools: compareTools() };
|
|
949
|
-
}
|
|
950
|
-
case 'cell_tool_suggest': {
|
|
951
|
-
const { suggestTool } = await Promise.resolve().then(() => __importStar(require('./cross-model-memory')));
|
|
952
|
-
return { suggestions: suggestTool(args.taskType) };
|
|
953
|
-
}
|
|
954
|
-
case 'cell_model_history': {
|
|
955
|
-
const { getModelHistory } = await Promise.resolve().then(() => __importStar(require('./cross-model-memory')));
|
|
956
|
-
return { history: getModelHistory() };
|
|
957
|
-
}
|
|
958
|
-
case 'cell_tool_context': {
|
|
959
|
-
const { buildToolSpecificContext } = await Promise.resolve().then(() => __importStar(require('./cross-model-memory')));
|
|
960
|
-
return { context: buildToolSpecificContext(args.toolName) };
|
|
961
|
-
}
|
|
962
|
-
case 'cell_team_health': {
|
|
963
|
-
const { getTeamHealth } = await Promise.resolve().then(() => __importStar(require('./team-collaboration')));
|
|
964
|
-
return getTeamHealth(args.project);
|
|
965
|
-
}
|
|
966
|
-
case 'cell_team_silos': {
|
|
967
|
-
const { detectKnowledgeSilos, calculateBusFactor, suggestKnowledgeTransfer } = await Promise.resolve().then(() => __importStar(require('./team-collaboration')));
|
|
968
|
-
return { silos: detectKnowledgeSilos(), busFactor: calculateBusFactor(), transfers: suggestKnowledgeTransfer() };
|
|
969
|
-
}
|
|
970
|
-
case 'cell_team_style': {
|
|
971
|
-
const { composeTeamStyle } = await Promise.resolve().then(() => __importStar(require('./team-collaboration')));
|
|
972
|
-
return composeTeamStyle(args.project);
|
|
973
|
-
}
|
|
974
|
-
case 'cell_team_retro': {
|
|
975
|
-
const { generateSprintRetro } = await Promise.resolve().then(() => __importStar(require('./team-collaboration')));
|
|
976
|
-
return generateSprintRetro(args.days || 14, args.project);
|
|
977
|
-
}
|
|
978
|
-
case 'cell_team_onboard': {
|
|
979
|
-
const { generateOnboardingDoc } = await Promise.resolve().then(() => __importStar(require('./team-collaboration')));
|
|
980
|
-
return generateOnboardingDoc(args.teamName, args.project);
|
|
981
|
-
}
|
|
982
|
-
case 'cell_handoff': {
|
|
983
|
-
const { generateHandoff } = await Promise.resolve().then(() => __importStar(require('./team-collaboration')));
|
|
984
|
-
return generateHandoff(args.from, args.to, args.project);
|
|
985
|
-
}
|
|
986
|
-
case 'cell_community_compare': {
|
|
987
|
-
const { benchmarkPersonal, benchmarkBlindSpots } = await Promise.resolve().then(() => __importStar(require('./community-v2')));
|
|
988
|
-
return { benchmarks: benchmarkPersonal(), blindSpots: benchmarkBlindSpots() };
|
|
989
|
-
}
|
|
990
|
-
case 'cell_community_trends': {
|
|
991
|
-
const { detectTrends, getCommunityStats } = await Promise.resolve().then(() => __importStar(require('./community-v2')));
|
|
992
|
-
return { trends: detectTrends(), stats: getCommunityStats() };
|
|
993
|
-
}
|
|
994
|
-
case 'cell_community_insights': {
|
|
995
|
-
const { generateInsights } = await Promise.resolve().then(() => __importStar(require('./community-v2')));
|
|
996
|
-
return { insights: generateInsights() };
|
|
997
|
-
}
|
|
998
|
-
case 'cell_community_stats': {
|
|
999
|
-
const { getCommunityStats } = await Promise.resolve().then(() => __importStar(require('./community-v2')));
|
|
1000
|
-
return getCommunityStats();
|
|
1001
|
-
}
|
|
1002
|
-
case 'cell_rhythm': {
|
|
1003
|
-
const { detectCodingRhythm } = await Promise.resolve().then(() => __importStar(require('./personal-intelligence')));
|
|
1004
|
-
return detectCodingRhythm();
|
|
1005
|
-
}
|
|
1006
|
-
case 'cell_burnout': {
|
|
1007
|
-
const { detectBurnout } = await Promise.resolve().then(() => __importStar(require('./personal-intelligence')));
|
|
1008
|
-
return detectBurnout();
|
|
1009
|
-
}
|
|
1010
|
-
case 'cell_mastery': {
|
|
1011
|
-
const { getTechMasteryMap } = await Promise.resolve().then(() => __importStar(require('./personal-intelligence')));
|
|
1012
|
-
return { mastery: getTechMasteryMap() };
|
|
1013
|
-
}
|
|
1014
|
-
case 'cell_growth': {
|
|
1015
|
-
const { getCareerTrajectory } = await Promise.resolve().then(() => __importStar(require('./personal-intelligence')));
|
|
1016
|
-
return getCareerTrajectory();
|
|
1017
|
-
}
|
|
1018
|
-
case 'cell_insights_weekly': {
|
|
1019
|
-
const { generateWeeklyDigest } = await Promise.resolve().then(() => __importStar(require('./personal-intelligence')));
|
|
1020
|
-
return generateWeeklyDigest();
|
|
1021
|
-
}
|
|
1022
|
-
case 'cell_health': {
|
|
1023
|
-
const { getHealthStatus } = await Promise.resolve().then(() => __importStar(require('./production')));
|
|
1024
|
-
return getHealthStatus();
|
|
1025
|
-
}
|
|
1026
|
-
case 'cell_metrics': {
|
|
1027
|
-
const { getMetrics } = await Promise.resolve().then(() => __importStar(require('./production')));
|
|
1028
|
-
return getMetrics();
|
|
1029
|
-
}
|
|
1030
|
-
case 'cell_security': {
|
|
1031
|
-
const { generateToken } = await Promise.resolve().then(() => __importStar(require('./production')));
|
|
1032
|
-
const fs = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
1033
|
-
const pathMod = await Promise.resolve().then(() => __importStar(require('path')));
|
|
1034
|
-
const osMod = await Promise.resolve().then(() => __importStar(require('os')));
|
|
1035
|
-
const secFile = pathMod.join(osMod.homedir(), '.fivo', 'cell', 'security.json');
|
|
1036
|
-
if (fs.existsSync(secFile)) {
|
|
1037
|
-
return JSON.parse(fs.readFileSync(secFile, 'utf-8'));
|
|
1038
|
-
}
|
|
1039
|
-
return { error: 'no security config found' };
|
|
1040
|
-
}
|
|
1041
|
-
case 'cell_backup': {
|
|
1042
|
-
const { autoBackup } = await Promise.resolve().then(() => __importStar(require('./production')));
|
|
1043
|
-
return autoBackup();
|
|
1044
|
-
}
|
|
1045
|
-
case 'cell_optimize': {
|
|
1046
|
-
const { optimizeDatabase } = await Promise.resolve().then(() => __importStar(require('./production')));
|
|
1047
|
-
return optimizeDatabase();
|
|
1048
|
-
}
|
|
1049
|
-
case 'cell_debug_style': {
|
|
1050
|
-
const { initializeIDETables, getDebugStyle } = await Promise.resolve().then(() => __importStar(require('./ide-intelligence')));
|
|
1051
|
-
initializeIDETables();
|
|
1052
|
-
return getDebugStyle();
|
|
1053
|
-
}
|
|
1054
|
-
case 'cell_prompt_style': {
|
|
1055
|
-
const { initializeIDETables, getPromptStyle } = await Promise.resolve().then(() => __importStar(require('./ide-intelligence')));
|
|
1056
|
-
initializeIDETables();
|
|
1057
|
-
return getPromptStyle();
|
|
1058
|
-
}
|
|
1059
|
-
case 'cell_focus': {
|
|
1060
|
-
const { initializeIDETables, getFocusAnalysis } = await Promise.resolve().then(() => __importStar(require('./ide-intelligence')));
|
|
1061
|
-
initializeIDETables();
|
|
1062
|
-
return getFocusAnalysis();
|
|
1063
|
-
}
|
|
1064
|
-
case 'cell_ide_insights': {
|
|
1065
|
-
const { initializeIDETables, getIDEInsights } = await Promise.resolve().then(() => __importStar(require('./ide-intelligence')));
|
|
1066
|
-
initializeIDETables();
|
|
1067
|
-
return getIDEInsights();
|
|
1068
|
-
}
|
|
1069
|
-
case 'cell_cloud_status': {
|
|
1070
|
-
const { getSyncStatus } = await Promise.resolve().then(() => __importStar(require('./cloud-sync')));
|
|
1071
|
-
return getSyncStatus();
|
|
1072
|
-
}
|
|
1073
|
-
case 'cell_cloud_validate': {
|
|
1074
|
-
const { validatePayload } = await Promise.resolve().then(() => __importStar(require('./cloud-sync')));
|
|
1075
|
-
const data = params?.arguments?.data;
|
|
1076
|
-
return validatePayload(data || {});
|
|
1077
|
-
}
|
|
1078
|
-
case 'cell_cloud_queue': {
|
|
1079
|
-
const { getPendingQueue, retryFailedEntries } = await Promise.resolve().then(() => __importStar(require('./cloud-sync')));
|
|
1080
|
-
return { pending: getPendingQueue(), retryable: retryFailedEntries() };
|
|
1081
|
-
}
|
|
1082
|
-
default:
|
|
1083
|
-
return { error: `unknown tool: ${name}` };
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
async function handleResourceRead(params) {
|
|
1087
|
-
const uri = params?.uri;
|
|
1088
|
-
switch (uri) {
|
|
1089
|
-
case 'cell://taste/profile':
|
|
1090
|
-
return daemonRequest('GET', '/taste/profile');
|
|
1091
|
-
case 'cell://community/stats':
|
|
1092
|
-
return daemonRequest('GET', '/community/prior');
|
|
1093
|
-
case 'cell://community/v2/stats':
|
|
1094
|
-
return daemonRequest('GET', '/community/v2/stats');
|
|
1095
|
-
case 'cell://community/v2/insights':
|
|
1096
|
-
return daemonRequest('GET', '/community/v2/insights');
|
|
1097
|
-
case 'cell://team/composite':
|
|
1098
|
-
return daemonRequest('GET', '/team/composite');
|
|
1099
|
-
case 'cell://org/v2/benchmarks': {
|
|
1100
|
-
const { orgId } = params?.arguments || {};
|
|
1101
|
-
if (!orgId)
|
|
1102
|
-
return { error: 'orgId argument required' };
|
|
1103
|
-
return daemonRequest('POST', `/org/v2/${orgId}/benchmarks`, {});
|
|
1104
|
-
}
|
|
1105
|
-
case 'cell://intelligence/reports': {
|
|
1106
|
-
const reports = await daemonRequest('GET', '/intelligence/reports');
|
|
1107
|
-
const full = [];
|
|
1108
|
-
for (const id of reports.reports || []) {
|
|
1109
|
-
const report = await daemonRequest('GET', `/intelligence/report/${encodeURIComponent(id)}`);
|
|
1110
|
-
full.push(report);
|
|
1111
|
-
}
|
|
1112
|
-
return { reports: full };
|
|
1113
|
-
}
|
|
1114
|
-
case 'cell://health':
|
|
1115
|
-
return daemonRequest('GET', '/health');
|
|
1116
|
-
default:
|
|
1117
|
-
return { error: `unknown resource: ${uri}` };
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
414
|
//# sourceMappingURL=mcp-server.js.map
|