fivocell 1.0.4 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/README.md +697 -505
  2. package/bin/cell.js +2 -2
  3. package/dist/behavior-intelligence.d.ts +90 -0
  4. package/dist/behavior-intelligence.d.ts.map +1 -0
  5. package/dist/behavior-intelligence.js +595 -0
  6. package/dist/behavior-intelligence.js.map +1 -0
  7. package/dist/cli.d.ts +6 -1
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cli.js +2191 -1
  10. package/dist/cli.js.map +1 -1
  11. package/dist/cloud-sync.d.ts +66 -0
  12. package/dist/cloud-sync.d.ts.map +1 -0
  13. package/dist/cloud-sync.js +328 -0
  14. package/dist/cloud-sync.js.map +1 -0
  15. package/dist/community-intelligence.d.ts +42 -0
  16. package/dist/community-intelligence.d.ts.map +1 -0
  17. package/dist/community-intelligence.js +160 -0
  18. package/dist/community-intelligence.js.map +1 -0
  19. package/dist/community-v2.d.ts +106 -0
  20. package/dist/community-v2.d.ts.map +1 -0
  21. package/dist/community-v2.js +378 -0
  22. package/dist/community-v2.js.map +1 -0
  23. package/dist/core/__tests__/chapter8-hostile.test.js +1 -1
  24. package/dist/core/__tests__/chapter8-hostile.test.js.map +1 -1
  25. package/dist/core/__tests__/chapter9-hostile.test.js +1 -1
  26. package/dist/core/__tests__/chapter9-hostile.test.js.map +1 -1
  27. package/dist/core/__tests__/complexity-analyzer.test.js +15 -15
  28. package/dist/core/__tests__/team-composer.test.js +2 -1
  29. package/dist/core/__tests__/team-composer.test.js.map +1 -1
  30. package/dist/core/convention-detector.d.ts.map +1 -1
  31. package/dist/core/convention-detector.js +11 -23
  32. package/dist/core/convention-detector.js.map +1 -1
  33. package/dist/core/cost-optimizer.d.ts.map +1 -1
  34. package/dist/core/cost-optimizer.js +13 -25
  35. package/dist/core/cost-optimizer.js.map +1 -1
  36. package/dist/core/database.d.ts +28 -0
  37. package/dist/core/database.d.ts.map +1 -0
  38. package/dist/core/database.js +587 -0
  39. package/dist/core/database.js.map +1 -0
  40. package/dist/core/knowledge-graph.d.ts.map +1 -1
  41. package/dist/core/knowledge-graph.js +9 -24
  42. package/dist/core/knowledge-graph.js.map +1 -1
  43. package/dist/core/logger.d.ts +9 -0
  44. package/dist/core/logger.d.ts.map +1 -0
  45. package/dist/core/logger.js +26 -0
  46. package/dist/core/logger.js.map +1 -0
  47. package/dist/core/playbook-generator.js +48 -48
  48. package/dist/core/privacy-manager.d.ts.map +1 -1
  49. package/dist/core/privacy-manager.js +5 -0
  50. package/dist/core/privacy-manager.js.map +1 -1
  51. package/dist/core/project-dna.d.ts.map +1 -1
  52. package/dist/core/project-dna.js +6 -19
  53. package/dist/core/project-dna.js.map +1 -1
  54. package/dist/core/prompt-builder.d.ts +18 -0
  55. package/dist/core/prompt-builder.d.ts.map +1 -0
  56. package/dist/core/prompt-builder.js +325 -0
  57. package/dist/core/prompt-builder.js.map +1 -0
  58. package/dist/core/session-memory.d.ts +90 -0
  59. package/dist/core/session-memory.d.ts.map +1 -0
  60. package/dist/core/session-memory.js +229 -0
  61. package/dist/core/session-memory.js.map +1 -0
  62. package/dist/core/signal-capture.d.ts +5 -0
  63. package/dist/core/signal-capture.d.ts.map +1 -1
  64. package/dist/core/signal-capture.js +67 -0
  65. package/dist/core/signal-capture.js.map +1 -1
  66. package/dist/core/team-composer.d.ts.map +1 -1
  67. package/dist/core/team-composer.js +16 -6
  68. package/dist/core/team-composer.js.map +1 -1
  69. package/dist/cross-model-memory.d.ts +95 -0
  70. package/dist/cross-model-memory.d.ts.map +1 -0
  71. package/dist/cross-model-memory.js +229 -0
  72. package/dist/cross-model-memory.js.map +1 -0
  73. package/dist/daemon/lifecycle.d.ts +18 -0
  74. package/dist/daemon/lifecycle.d.ts.map +1 -1
  75. package/dist/daemon/lifecycle.js +182 -5
  76. package/dist/daemon/lifecycle.js.map +1 -1
  77. package/dist/daemon/server.d.ts.map +1 -1
  78. package/dist/daemon/server.js +269 -6
  79. package/dist/daemon/server.js.map +1 -1
  80. package/dist/first-run.d.ts +8 -0
  81. package/dist/first-run.d.ts.map +1 -0
  82. package/dist/first-run.js +182 -0
  83. package/dist/first-run.js.map +1 -0
  84. package/dist/focus-report.d.ts +32 -0
  85. package/dist/focus-report.d.ts.map +1 -0
  86. package/dist/focus-report.js +293 -0
  87. package/dist/focus-report.js.map +1 -0
  88. package/dist/ide-intelligence.d.ts +118 -0
  89. package/dist/ide-intelligence.d.ts.map +1 -0
  90. package/dist/ide-intelligence.js +284 -0
  91. package/dist/ide-intelligence.js.map +1 -0
  92. package/dist/index.d.ts +22 -0
  93. package/dist/index.d.ts.map +1 -1
  94. package/dist/index.js +119 -2
  95. package/dist/index.js.map +1 -1
  96. package/dist/insight-generator.d.ts +58 -0
  97. package/dist/insight-generator.d.ts.map +1 -0
  98. package/dist/insight-generator.js +314 -0
  99. package/dist/insight-generator.js.map +1 -0
  100. package/dist/journey-memory.d.ts +75 -0
  101. package/dist/journey-memory.d.ts.map +1 -0
  102. package/dist/journey-memory.js +360 -0
  103. package/dist/journey-memory.js.map +1 -0
  104. package/dist/mcp-server.d.ts +2054 -0
  105. package/dist/mcp-server.d.ts.map +1 -0
  106. package/dist/mcp-server.js +1120 -0
  107. package/dist/mcp-server.js.map +1 -0
  108. package/dist/onboarding-scan.d.ts +174 -0
  109. package/dist/onboarding-scan.d.ts.map +1 -0
  110. package/dist/onboarding-scan.js +1039 -0
  111. package/dist/onboarding-scan.js.map +1 -0
  112. package/dist/personal-intelligence.d.ts +97 -0
  113. package/dist/personal-intelligence.d.ts.map +1 -0
  114. package/dist/personal-intelligence.js +408 -0
  115. package/dist/personal-intelligence.js.map +1 -0
  116. package/dist/predictive-intelligence.d.ts +95 -0
  117. package/dist/predictive-intelligence.d.ts.map +1 -0
  118. package/dist/predictive-intelligence.js +544 -0
  119. package/dist/predictive-intelligence.js.map +1 -0
  120. package/dist/production.d.ts +67 -0
  121. package/dist/production.d.ts.map +1 -0
  122. package/dist/production.js +333 -0
  123. package/dist/production.js.map +1 -0
  124. package/dist/senior-features.d.ts +63 -0
  125. package/dist/senior-features.d.ts.map +1 -0
  126. package/dist/senior-features.js +325 -0
  127. package/dist/senior-features.js.map +1 -0
  128. package/dist/style-pull.d.ts +40 -0
  129. package/dist/style-pull.d.ts.map +1 -0
  130. package/dist/style-pull.js +385 -0
  131. package/dist/style-pull.js.map +1 -0
  132. package/dist/team-collaboration.d.ts +116 -0
  133. package/dist/team-collaboration.d.ts.map +1 -0
  134. package/dist/team-collaboration.js +375 -0
  135. package/dist/team-collaboration.js.map +1 -0
  136. package/dist/team-intelligence.d.ts +64 -0
  137. package/dist/team-intelligence.d.ts.map +1 -0
  138. package/dist/team-intelligence.js +289 -0
  139. package/dist/team-intelligence.js.map +1 -0
  140. package/dist/test-watch.d.ts +2 -0
  141. package/dist/test-watch.d.ts.map +1 -0
  142. package/dist/test-watch.js +8 -0
  143. package/dist/test-watch.js.map +1 -0
  144. package/dist/user-intelligence.d.ts +69 -0
  145. package/dist/user-intelligence.d.ts.map +1 -0
  146. package/dist/user-intelligence.js +553 -0
  147. package/dist/user-intelligence.js.map +1 -0
  148. package/dist/work-style.d.ts +49 -0
  149. package/dist/work-style.d.ts.map +1 -0
  150. package/dist/work-style.js +247 -0
  151. package/dist/work-style.js.map +1 -0
  152. package/package.json +3 -2
@@ -0,0 +1,1120 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.RESOURCES = exports.TOOLS = void 0;
37
+ exports.startMCPServer = startMCPServer;
38
+ const http = __importStar(require("http"));
39
+ const senior_features_1 = require("./senior-features");
40
+ const prompt_builder_1 = require("./core/prompt-builder");
41
+ const database_1 = require("./core/database");
42
+ const session_memory_1 = require("./core/session-memory");
43
+ const DAEMON_URL = 'http://localhost:9876';
44
+ const MCP_PORT = 9877;
45
+ let daemonEnsuredAt = 0;
46
+ let daemonEnsuring = null;
47
+ const DAEMON_RECHECK_MS = 30000;
48
+ async function ensureDaemonForMCP() {
49
+ const now = Date.now();
50
+ if (daemonEnsuring)
51
+ return daemonEnsuring;
52
+ if (now - daemonEnsuredAt < DAEMON_RECHECK_MS)
53
+ return true;
54
+ const { ensureDaemon } = require('./daemon/lifecycle');
55
+ const p = ensureDaemon({ silent: true }).finally(() => {
56
+ daemonEnsuring = null;
57
+ });
58
+ daemonEnsuring = p;
59
+ const ok = await p;
60
+ if (ok)
61
+ daemonEnsuredAt = Date.now();
62
+ return ok;
63
+ }
64
+ function daemonRequest(method, path, body) {
65
+ return new Promise(async (resolve, reject) => {
66
+ if (path !== '/health') {
67
+ const ok = await ensureDaemonForMCP();
68
+ if (!ok) {
69
+ reject(new Error('Cell daemon is not running and could not be started. Run `cell start` or `cell daemon install-service`.'));
70
+ return;
71
+ }
72
+ }
73
+ const url = new URL(path, DAEMON_URL);
74
+ const req = http.request({
75
+ method,
76
+ hostname: url.hostname,
77
+ port: url.port,
78
+ path: url.pathname + url.search,
79
+ headers: { 'Content-Type': 'application/json' },
80
+ timeout: 15000,
81
+ }, (res) => {
82
+ let data = '';
83
+ res.on('data', (chunk) => (data += chunk));
84
+ res.on('end', () => {
85
+ try {
86
+ resolve(JSON.parse(data));
87
+ }
88
+ catch {
89
+ reject(new Error('Invalid JSON'));
90
+ }
91
+ });
92
+ });
93
+ req.on('error', (err) => {
94
+ daemonEnsuredAt = 0;
95
+ reject(err);
96
+ });
97
+ if (body)
98
+ req.write(JSON.stringify(body));
99
+ req.end();
100
+ });
101
+ }
102
+ exports.TOOLS = [
103
+ {
104
+ name: 'cell_get_taste_context',
105
+ description: 'Get user coding taste for prompt injection. Returns compressed taste string.',
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',
454
+ inputSchema: {
455
+ type: 'object',
456
+ properties: {
457
+ sessionId: { type: 'number', description: 'Session ID from cell_session_start' },
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'],
463
+ },
464
+ },
465
+ {
466
+ name: 'cell_get_sessions',
467
+ description: 'Get recent cross-tool session history with decisions and context chains',
468
+ inputSchema: {
469
+ type: 'object',
470
+ properties: {
471
+ limit: { type: 'number', description: 'Max sessions (default 10)' },
472
+ project: { type: 'string', description: 'Filter by project' },
473
+ },
474
+ },
475
+ },
476
+ {
477
+ name: 'cell_predict',
478
+ description: 'Get all predictive intelligence — pre-failures, decision regrets, scope creep, energy, stack warnings',
479
+ inputSchema: {
480
+ type: 'object',
481
+ properties: {
482
+ project: { type: 'string', description: 'Filter by project' },
483
+ type: { type: 'string', description: 'Filter: pre_failure|decision_regret|complexity_trap|scope_creep|energy|stack' },
484
+ },
485
+ },
486
+ },
487
+ {
488
+ name: 'cell_predict_risk',
489
+ description: 'Calculate risk score for a specific file based on bug history, recurrence, and touch frequency',
490
+ inputSchema: {
491
+ type: 'object',
492
+ properties: {
493
+ file: { type: 'string', description: 'File path to assess risk for' },
494
+ },
495
+ required: ['file'],
496
+ },
497
+ },
498
+ {
499
+ name: 'cell_predict_time',
500
+ description: 'Estimate completion time for a feature based on historical session data',
501
+ inputSchema: {
502
+ type: 'object',
503
+ properties: {
504
+ feature: { type: 'string', description: 'Feature or task name to estimate' },
505
+ },
506
+ required: ['feature'],
507
+ },
508
+ },
509
+ {
510
+ name: 'cell_tool_compare',
511
+ description: 'Compare all AI tools — acceptance rate, best/worst tasks, recommendations',
512
+ inputSchema: { type: 'object', properties: {} },
513
+ },
514
+ {
515
+ name: 'cell_tool_suggest',
516
+ description: 'Suggest best AI tool for a specific task type',
517
+ inputSchema: {
518
+ type: 'object',
519
+ properties: {
520
+ taskType: { type: 'string', description: 'Task type (e.g., debugging, architecture, boilerplate)' },
521
+ },
522
+ required: ['taskType'],
523
+ },
524
+ },
525
+ {
526
+ name: 'cell_model_history',
527
+ description: 'Per-model interaction history — sessions, files, decisions',
528
+ inputSchema: { type: 'object', properties: {} },
529
+ },
530
+ {
531
+ name: 'cell_tool_context',
532
+ description: 'Show tool-specific @cell context for an AI tool',
533
+ inputSchema: {
534
+ type: 'object',
535
+ properties: {
536
+ toolName: { type: 'string', description: 'AI tool name (cursor, claude, antigravity, etc.)' },
537
+ },
538
+ required: ['toolName'],
539
+ },
540
+ },
541
+ {
542
+ name: 'cell_team_health',
543
+ description: 'Get team health score — bus factor, silos, skill gaps, strengths',
544
+ inputSchema: {
545
+ type: 'object',
546
+ properties: {
547
+ project: { type: 'string', description: 'Filter by project' },
548
+ },
549
+ },
550
+ },
551
+ {
552
+ name: 'cell_team_silos',
553
+ description: 'Detect knowledge silos and single points of failure',
554
+ inputSchema: { type: 'object', properties: {} },
555
+ },
556
+ {
557
+ name: 'cell_team_style',
558
+ description: 'Show merged team coding style — stack, patterns, conventions',
559
+ inputSchema: {
560
+ type: 'object',
561
+ properties: {
562
+ project: { type: 'string', description: 'Filter by project' },
563
+ },
564
+ },
565
+ },
566
+ {
567
+ name: 'cell_team_retro',
568
+ description: 'Auto-generate sprint retrospective from git + pattern data',
569
+ inputSchema: {
570
+ type: 'object',
571
+ properties: {
572
+ days: { type: 'number', description: 'Lookback period in days (default 14)' },
573
+ project: { type: 'string', description: 'Filter by project' },
574
+ },
575
+ },
576
+ },
577
+ {
578
+ name: 'cell_team_onboard',
579
+ description: 'Generate onboarding package for a new team member',
580
+ inputSchema: {
581
+ type: 'object',
582
+ properties: {
583
+ teamName: { type: 'string', description: 'Team name' },
584
+ project: { type: 'string', description: 'Filter by project' },
585
+ },
586
+ required: ['teamName'],
587
+ },
588
+ },
589
+ {
590
+ name: 'cell_handoff',
591
+ description: 'Generate context handoff for team member transition',
592
+ inputSchema: {
593
+ type: 'object',
594
+ properties: {
595
+ from: { type: 'string', description: 'Person handing off' },
596
+ to: { type: 'string', description: 'Person receiving' },
597
+ project: { type: 'string', description: 'Project name' },
598
+ },
599
+ required: ['from', 'to', 'project'],
600
+ },
601
+ },
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
+ ];
714
+ 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
+ { uri: 'cell://health', name: 'Health', description: 'Daemon health status' },
723
+ ];
724
+ function startMCPServer(port = MCP_PORT) {
725
+ const server = http.createServer(async (req, res) => {
726
+ if (req.method === 'GET' && req.url === '/health') {
727
+ res.writeHead(200, { 'Content-Type': 'application/json' });
728
+ res.end(JSON.stringify({ status: 'ok', daemon: DAEMON_URL }));
729
+ return;
730
+ }
731
+ if (req.method !== 'POST' || req.url !== '/mcp') {
732
+ res.writeHead(404, { 'Content-Type': 'application/json' });
733
+ res.end(JSON.stringify({ error: 'Not found. POST to /mcp for JSON-RPC.' }));
734
+ return;
735
+ }
736
+ const chunks = [];
737
+ req.on('data', (chunk) => chunks.push(chunk));
738
+ req.on('end', async () => {
739
+ const body = Buffer.concat(chunks).toString().replace(/^\uFEFF/, '');
740
+ let rpc;
741
+ try {
742
+ rpc = JSON.parse(body);
743
+ }
744
+ catch {
745
+ res.writeHead(400, { 'Content-Type': 'application/json' });
746
+ res.end(JSON.stringify({ jsonrpc: '2.0', id: null, error: { code: -1, message: 'Invalid JSON' } }));
747
+ return;
748
+ }
749
+ const { method, params, id } = rpc;
750
+ try {
751
+ let result;
752
+ switch (method) {
753
+ case 'initialize':
754
+ result = {
755
+ protocolVersion: params?.protocolVersion || '2024-11-05',
756
+ capabilities: {
757
+ tools: { listChanged: false },
758
+ resources: { subscribe: false, listChanged: false },
759
+ },
760
+ serverInfo: {
761
+ name: 'fivo-cell',
762
+ version: '1.0.5',
763
+ },
764
+ };
765
+ break;
766
+ case 'notifications/initialized':
767
+ res.writeHead(204);
768
+ res.end();
769
+ return;
770
+ case 'ping':
771
+ result = {};
772
+ break;
773
+ case 'tools/list':
774
+ result = { tools: exports.TOOLS };
775
+ break;
776
+ case 'tools/call':
777
+ result = await handleToolCall(params);
778
+ break;
779
+ case 'resources/list':
780
+ result = { resources: exports.RESOURCES };
781
+ break;
782
+ case 'resources/templates/list':
783
+ result = { resourceTemplates: [] };
784
+ break;
785
+ case 'resources/read':
786
+ result = await handleResourceRead(params);
787
+ break;
788
+ default:
789
+ 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
+ }));
795
+ return;
796
+ }
797
+ res.writeHead(200, { 'Content-Type': 'application/json' });
798
+ res.end(JSON.stringify({ jsonrpc: '2.0', id, result }));
799
+ }
800
+ catch (err) {
801
+ const message = err instanceof Error ? err.message : String(err);
802
+ res.writeHead(200, { 'Content-Type': 'application/json' });
803
+ res.end(JSON.stringify({ jsonrpc: '2.0', id, error: { code: -1, message } }));
804
+ }
805
+ });
806
+ });
807
+ server.listen(port, () => {
808
+ console.log(`Cell MCP Server running on http://localhost:${port}`);
809
+ console.log(`MCP endpoint: http://localhost:${port}/mcp`);
810
+ });
811
+ return server;
812
+ }
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
+ //# sourceMappingURL=mcp-server.js.map