@vibecheckai/cli 3.9.0 → 4.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 (88) hide show
  1. package/README.md +1 -1
  2. package/bin/runners/context/generators/cursor-enhanced.js +99 -13
  3. package/bin/runners/lib/unified-cli-output.js +16 -0
  4. package/bin/runners/runCI.js +353 -0
  5. package/bin/runners/runCheckpoint.js +2 -2
  6. package/mcp-server/.eslintrc.json +24 -0
  7. package/mcp-server/README.md +425 -135
  8. package/mcp-server/SPEC.md +583 -0
  9. package/mcp-server/configs/README.md +172 -0
  10. package/mcp-server/configs/claude-desktop-pro.json +31 -0
  11. package/mcp-server/configs/claude-desktop-with-workspace.json +25 -0
  12. package/mcp-server/configs/claude-desktop.json +19 -0
  13. package/mcp-server/configs/cursor-mcp.json +21 -0
  14. package/mcp-server/configs/windsurf-mcp.json +17 -0
  15. package/mcp-server/mcp-config.example.json +9 -0
  16. package/mcp-server/package.json +49 -34
  17. package/mcp-server/src/cli.ts +185 -0
  18. package/mcp-server/src/index.ts +85 -0
  19. package/mcp-server/src/server.ts +1933 -0
  20. package/mcp-server/src/services/cache-service.ts +466 -0
  21. package/mcp-server/src/services/cli-service.ts +345 -0
  22. package/mcp-server/src/services/context-manager.ts +717 -0
  23. package/mcp-server/src/services/firewall-service.ts +662 -0
  24. package/mcp-server/src/services/git-service.ts +671 -0
  25. package/mcp-server/src/services/index.ts +52 -0
  26. package/mcp-server/src/services/prompt-builder-service.ts +1031 -0
  27. package/mcp-server/src/services/session-service.ts +550 -0
  28. package/mcp-server/src/services/tier-service.ts +470 -0
  29. package/mcp-server/src/types.ts +351 -0
  30. package/mcp-server/tsconfig.json +16 -27
  31. package/package.json +6 -6
  32. package/mcp-server/.guardrail/audit/audit.log.jsonl +0 -2
  33. package/mcp-server/.specs/architecture.mdc +0 -90
  34. package/mcp-server/.specs/security.mdc +0 -30
  35. package/mcp-server/HARDENING_SUMMARY.md +0 -299
  36. package/mcp-server/agent-checkpoint.js +0 -364
  37. package/mcp-server/agent-firewall-interceptor.js +0 -500
  38. package/mcp-server/architect-tools.js +0 -707
  39. package/mcp-server/audit-mcp.js +0 -206
  40. package/mcp-server/authority-tools.js +0 -569
  41. package/mcp-server/codebase-architect-tools.js +0 -838
  42. package/mcp-server/conductor/conflict-resolver.js +0 -588
  43. package/mcp-server/conductor/execution-planner.js +0 -544
  44. package/mcp-server/conductor/index.js +0 -377
  45. package/mcp-server/conductor/lock-manager.js +0 -615
  46. package/mcp-server/conductor/request-queue.js +0 -550
  47. package/mcp-server/conductor/session-manager.js +0 -500
  48. package/mcp-server/conductor/tools.js +0 -510
  49. package/mcp-server/consolidated-tools.js +0 -1170
  50. package/mcp-server/deprecation-middleware.js +0 -282
  51. package/mcp-server/handlers/index.ts +0 -15
  52. package/mcp-server/handlers/tool-handler.ts +0 -593
  53. package/mcp-server/hygiene-tools.js +0 -428
  54. package/mcp-server/index-v1.js +0 -698
  55. package/mcp-server/index.js +0 -2940
  56. package/mcp-server/intelligence-tools.js +0 -664
  57. package/mcp-server/intent-drift-tools.js +0 -873
  58. package/mcp-server/intent-firewall-interceptor.js +0 -529
  59. package/mcp-server/lib/api-client.cjs +0 -13
  60. package/mcp-server/lib/cache-wrapper.cjs +0 -383
  61. package/mcp-server/lib/error-envelope.js +0 -138
  62. package/mcp-server/lib/executor.ts +0 -499
  63. package/mcp-server/lib/index.ts +0 -29
  64. package/mcp-server/lib/logger.cjs +0 -30
  65. package/mcp-server/lib/rate-limiter.js +0 -166
  66. package/mcp-server/lib/sandbox.test.ts +0 -519
  67. package/mcp-server/lib/sandbox.ts +0 -395
  68. package/mcp-server/lib/types.ts +0 -267
  69. package/mcp-server/logger.js +0 -173
  70. package/mcp-server/manifest.json +0 -473
  71. package/mcp-server/mdc-generator.js +0 -298
  72. package/mcp-server/premium-tools.js +0 -1275
  73. package/mcp-server/proof-tools.js +0 -571
  74. package/mcp-server/registry/tool-registry.js +0 -586
  75. package/mcp-server/registry/tools.json +0 -619
  76. package/mcp-server/registry.test.ts +0 -340
  77. package/mcp-server/test-mcp.js +0 -108
  78. package/mcp-server/test-tools.js +0 -36
  79. package/mcp-server/tests/tier-gating.test.js +0 -297
  80. package/mcp-server/tier-auth.js +0 -767
  81. package/mcp-server/tools/index.js +0 -72
  82. package/mcp-server/tools-reorganized.ts +0 -244
  83. package/mcp-server/tools-v3.js +0 -1004
  84. package/mcp-server/truth-context.js +0 -622
  85. package/mcp-server/truth-firewall-tools.js +0 -2183
  86. package/mcp-server/vibecheck-2.0-tools.js +0 -761
  87. package/mcp-server/vibecheck-mcp-server-3.2.0.tgz +0 -0
  88. package/mcp-server/vibecheck-tools.js +0 -1075
@@ -1,664 +0,0 @@
1
- /**
2
- * vibecheck Intelligence MCP Tools
3
- *
4
- * Power suite tools for MCP:
5
- * - vibecheck.intelligence.ai - AI code analysis
6
- * - vibecheck.intelligence.security - Security scanning
7
- * - vibecheck.intelligence.arch - Architecture health
8
- * - vibecheck.intelligence.supply - Supply chain analysis
9
- * - vibecheck.intelligence.team - Team intelligence
10
- * - vibecheck.intelligence.predict - Predictive analytics
11
- * - vibecheck.intelligence.full - Run all suites
12
- */
13
-
14
- import path from "path";
15
- import { execSync } from "child_process";
16
- import fs from "fs/promises";
17
-
18
- // ============================================================================
19
- // TOOL DEFINITIONS
20
- // ============================================================================
21
-
22
- export const INTELLIGENCE_TOOLS = [
23
- {
24
- name: "vibecheck.intelligence.ai",
25
- description:
26
- "🧠 AI Code Intelligence — Code review, bug prediction, pattern learning, and explanations",
27
- inputSchema: {
28
- type: "object",
29
- properties: {
30
- projectPath: {
31
- type: "string",
32
- description: "Path to project root",
33
- default: ".",
34
- },
35
- file: {
36
- type: "string",
37
- description: "Optional: specific file to analyze",
38
- },
39
- focus: {
40
- type: "string",
41
- enum: ["all", "security", "performance", "quality"],
42
- description: "Focus area for analysis",
43
- default: "all",
44
- },
45
- },
46
- },
47
- },
48
- {
49
- name: "vibecheck.intelligence.security",
50
- description:
51
- "šŸ”’ Security Suite — Secrets, vulnerabilities, PII, threats, and compliance checking",
52
- inputSchema: {
53
- type: "object",
54
- properties: {
55
- projectPath: {
56
- type: "string",
57
- description: "Path to project root",
58
- default: ".",
59
- },
60
- checks: {
61
- type: "array",
62
- items: { type: "string" },
63
- description:
64
- "Specific checks: secrets, vulnerabilities, pii, threats, access",
65
- },
66
- },
67
- },
68
- },
69
- {
70
- name: "vibecheck.intelligence.arch",
71
- description:
72
- "šŸ—ļø Architecture Health — Code smells, dependencies, coupling, drift prediction",
73
- inputSchema: {
74
- type: "object",
75
- properties: {
76
- projectPath: {
77
- type: "string",
78
- description: "Path to project root",
79
- default: ".",
80
- },
81
- visualize: {
82
- type: "boolean",
83
- description: "Generate dependency graph visualization",
84
- default: false,
85
- },
86
- },
87
- },
88
- },
89
- {
90
- name: "vibecheck.intelligence.supply",
91
- description:
92
- "šŸ“¦ Supply Chain — SBOM, vulnerabilities, licenses, typosquatting detection",
93
- inputSchema: {
94
- type: "object",
95
- properties: {
96
- projectPath: {
97
- type: "string",
98
- description: "Path to project root",
99
- default: ".",
100
- },
101
- sbomFormat: {
102
- type: "string",
103
- enum: ["cyclonedx", "spdx"],
104
- description: "SBOM output format",
105
- default: "cyclonedx",
106
- },
107
- },
108
- },
109
- },
110
- {
111
- name: "vibecheck.intelligence.team",
112
- description:
113
- "šŸ‘„ Team Intelligence — Expertise mapping, bus factor, knowledge silos, decisions",
114
- inputSchema: {
115
- type: "object",
116
- properties: {
117
- projectPath: {
118
- type: "string",
119
- description: "Path to project root",
120
- default: ".",
121
- },
122
- },
123
- },
124
- },
125
- {
126
- name: "vibecheck.intelligence.predict",
127
- description:
128
- "šŸ”® Predictive Analytics — Quality trends, risk assessment, anomaly detection",
129
- inputSchema: {
130
- type: "object",
131
- properties: {
132
- projectPath: {
133
- type: "string",
134
- description: "Path to project root",
135
- default: ".",
136
- },
137
- timeframe: {
138
- type: "string",
139
- enum: ["7d", "30d", "90d"],
140
- description: "Prediction timeframe",
141
- default: "30d",
142
- },
143
- },
144
- },
145
- },
146
- {
147
- name: "vibecheck.intelligence.full",
148
- description:
149
- "šŸš€ Full Intelligence — Run all power suites for comprehensive analysis",
150
- inputSchema: {
151
- type: "object",
152
- properties: {
153
- projectPath: {
154
- type: "string",
155
- description: "Path to project root",
156
- default: ".",
157
- },
158
- },
159
- },
160
- },
161
- ];
162
-
163
- // ============================================================================
164
- // TOOL HANDLERS
165
- // ============================================================================
166
-
167
- export async function handleIntelligenceTool(name, args, __dirname) {
168
- const projectPath = path.resolve(args?.projectPath || ".");
169
-
170
- try {
171
- switch (name) {
172
- case "vibecheck.intelligence.ai":
173
- return await handleAI(projectPath, args, __dirname);
174
- case "vibecheck.intelligence.security":
175
- return await handleSecurity(projectPath, args, __dirname);
176
- case "vibecheck.intelligence.arch":
177
- return await handleArchitecture(projectPath, args, __dirname);
178
- case "vibecheck.intelligence.supply":
179
- return await handleSupplyChain(projectPath, args, __dirname);
180
- case "vibecheck.intelligence.team":
181
- return await handleTeam(projectPath, args, __dirname);
182
- case "vibecheck.intelligence.predict":
183
- return await handlePredictive(projectPath, args, __dirname);
184
- case "vibecheck.intelligence.full":
185
- return await handleFull(projectPath, args, __dirname);
186
- default:
187
- return null;
188
- }
189
- } catch (err) {
190
- return {
191
- content: [{ type: "text", text: `āŒ ${name} failed: ${err.message}` }],
192
- isError: true,
193
- };
194
- }
195
- }
196
-
197
- // ============================================================================
198
- // HANDLER IMPLEMENTATIONS
199
- // ============================================================================
200
-
201
- async function handleAI(projectPath, args, __dirname) {
202
- let output = "# 🧠 AI Code Intelligence\n\n";
203
- output += `**Path:** ${projectPath}\n\n`;
204
-
205
- try {
206
- const cmd = `node "${path.join(__dirname, "..", "bin", "runners", "runIntelligence.js")}" ai --json --path "${projectPath}"`;
207
- const result = execSync(cmd, {
208
- encoding: "utf8",
209
- maxBuffer: 10 * 1024 * 1024,
210
- });
211
- const data = JSON.parse(result);
212
-
213
- output += "## Scores\n\n";
214
- output += `| Metric | Score |\n|--------|-------|\n`;
215
- if (data.scores) {
216
- output += `| Overall | ${data.scores.overall}/100 ${getScoreIcon(data.scores.overall)} |\n`;
217
- output += `| Security | ${data.scores.security}/100 ${getScoreIcon(data.scores.security)} |\n`;
218
- output += `| Quality | ${data.scores.quality}/100 ${getScoreIcon(data.scores.quality)} |\n`;
219
- output += `| Performance | ${data.scores.performance}/100 ${getScoreIcon(data.scores.performance)} |\n`;
220
- }
221
-
222
- if (data.bugPredictions) {
223
- output += "\n## Bug Predictions\n\n";
224
- output += `- **Total:** ${data.bugPredictions.total}\n`;
225
- output += `- **Critical:** ${data.bugPredictions.critical} šŸ”“\n`;
226
- output += `- **High:** ${data.bugPredictions.high} 🟠\n`;
227
- output += `- **Medium:** ${data.bugPredictions.medium} 🟔\n`;
228
- }
229
-
230
- if (data.issues && data.issues.length > 0) {
231
- output += "\n## Top Issues\n\n";
232
- for (const issue of data.issues.slice(0, 5)) {
233
- output += `- **${issue.severity.toUpperCase()}** ${issue.title}\n`;
234
- output += ` - File: \`${issue.file}\`${issue.line ? `:${issue.line}` : ""}\n`;
235
- }
236
- }
237
-
238
- if (data.recommendations && data.recommendations.length > 0) {
239
- output += "\n## Recommendations\n\n";
240
- for (const rec of data.recommendations.slice(0, 3)) {
241
- output += `- ${rec}\n`;
242
- }
243
- }
244
- } catch (err) {
245
- output += `āš ļø Analysis incomplete: ${err.message}\n`;
246
- }
247
-
248
- output += "\n---\n_Context Enhanced by vibecheck AI_\n";
249
- return { content: [{ type: "text", text: output }] };
250
- }
251
-
252
- async function handleSecurity(projectPath, args, __dirname) {
253
- let output = "# šŸ”’ Security Suite\n\n";
254
- output += `**Path:** ${projectPath}\n\n`;
255
-
256
- try {
257
- const cmd = `node "${path.join(__dirname, "..", "bin", "runners", "runIntelligence.js")}" security --json --path "${projectPath}"`;
258
- const result = execSync(cmd, {
259
- encoding: "utf8",
260
- maxBuffer: 10 * 1024 * 1024,
261
- });
262
- const data = JSON.parse(result);
263
-
264
- output += "## Security Scores\n\n";
265
- output += `| Category | Score |\n|----------|-------|\n`;
266
- if (data.scores) {
267
- output += `| Overall | ${data.scores.overall}/100 ${getScoreIcon(data.scores.overall)} |\n`;
268
- output += `| Secrets | ${data.scores.secrets}/100 ${getScoreIcon(data.scores.secrets)} |\n`;
269
- output += `| Vulnerabilities | ${data.scores.vulnerabilities}/100 ${getScoreIcon(data.scores.vulnerabilities)} |\n`;
270
- output += `| Compliance | ${data.scores.compliance}/100 ${getScoreIcon(data.scores.compliance)} |\n`;
271
- }
272
-
273
- output += "\n## Summary\n\n";
274
- if (data.summary) {
275
- output += `- **Total Findings:** ${data.summary.totalFindings}\n`;
276
- output += `- **Critical:** ${data.summary.critical} šŸ”“\n`;
277
- output += `- **High:** ${data.summary.high} 🟠\n`;
278
- output += `- **Medium:** ${data.summary.medium} 🟔\n`;
279
- output += `- **Low:** ${data.summary.low} šŸ”µ\n`;
280
- }
281
-
282
- if (data.secrets && data.secrets.length > 0) {
283
- output += "\n## šŸ”‘ Secrets Found\n\n";
284
- for (const secret of data.secrets.slice(0, 5)) {
285
- output += `- **${secret.severity.toUpperCase()}** ${secret.type} in \`${secret.file}:${secret.line}\`\n`;
286
- }
287
- }
288
-
289
- if (
290
- data.vulnerabilities?.findings &&
291
- data.vulnerabilities.findings.length > 0
292
- ) {
293
- output += "\n## šŸ›”ļø Vulnerabilities\n\n";
294
- for (const vuln of data.vulnerabilities.findings.slice(0, 5)) {
295
- output += `- **${vuln.severity.toUpperCase()}** ${vuln.package}@${vuln.version}\n`;
296
- output += ` - ${vuln.title}\n`;
297
- }
298
- }
299
-
300
- if (data.compliance) {
301
- output += "\n## šŸ“‹ Compliance Status\n\n";
302
- output += `| Standard | Status |\n|----------|--------|\n`;
303
- output += `| SOC2 | ${data.compliance.soc2?.compliant ? "āœ… Compliant" : "āŒ Non-compliant"} |\n`;
304
- output += `| HIPAA | ${data.compliance.hipaa?.compliant ? "āœ… Compliant" : "āŒ Non-compliant"} |\n`;
305
- output += `| GDPR | ${data.compliance.gdpr?.compliant ? "āœ… Compliant" : "āŒ Non-compliant"} |\n`;
306
- output += `| PCI | ${data.compliance.pci?.compliant ? "āœ… Compliant" : "āŒ Non-compliant"} |\n`;
307
- }
308
- } catch (err) {
309
- output += `āš ļø Security scan incomplete: ${err.message}\n`;
310
- }
311
-
312
- output += "\n---\n_Context Enhanced by vibecheck AI_\n";
313
- return { content: [{ type: "text", text: output }] };
314
- }
315
-
316
- async function handleArchitecture(projectPath, args, __dirname) {
317
- let output = "# šŸ—ļø Architecture Health\n\n";
318
- output += `**Path:** ${projectPath}\n\n`;
319
-
320
- try {
321
- const cmd = `node "${path.join(__dirname, "..", "bin", "runners", "runIntelligence.js")}" arch --json --path "${projectPath}"`;
322
- const result = execSync(cmd, {
323
- encoding: "utf8",
324
- maxBuffer: 10 * 1024 * 1024,
325
- });
326
- const data = JSON.parse(result);
327
-
328
- output += "## Architecture Scores\n\n";
329
- output += `| Metric | Score |\n|--------|-------|\n`;
330
- if (data.scores) {
331
- output += `| Overall | ${data.scores.overall}/100 ${getScoreIcon(data.scores.overall)} |\n`;
332
- output += `| Modularity | ${data.scores.modularity}/100 ${getScoreIcon(data.scores.modularity)} |\n`;
333
- output += `| Coupling | ${data.scores.coupling}/100 ${getScoreIcon(data.scores.coupling)} |\n`;
334
- output += `| Cohesion | ${data.scores.cohesion}/100 ${getScoreIcon(data.scores.cohesion)} |\n`;
335
- output += `| Complexity | ${data.scores.complexity}/100 ${getScoreIcon(data.scores.complexity)} |\n`;
336
- output += `| Maintainability | ${data.scores.maintainability}/100 ${getScoreIcon(data.scores.maintainability)} |\n`;
337
- }
338
-
339
- if (data.architecture?.layers && data.architecture.layers.length > 0) {
340
- output += "\n## Architecture Layers\n\n";
341
- for (const layer of data.architecture.layers) {
342
- output += `- **${layer.name}:** ${layer.files} files, ${layer.loc} LOC\n`;
343
- }
344
- }
345
-
346
- if (
347
- data.architecture?.circularDeps &&
348
- data.architecture.circularDeps.length > 0
349
- ) {
350
- output += "\n## šŸ”„ Circular Dependencies\n\n";
351
- for (const dep of data.architecture.circularDeps.slice(0, 3)) {
352
- output += `- **${dep.severity.toUpperCase()}** ${dep.cycle.join(" → ")}\n`;
353
- }
354
- }
355
-
356
- if (data.smells && data.smells.length > 0) {
357
- output += "\n## šŸ‘ƒ Code Smells\n\n";
358
- for (const smell of data.smells.slice(0, 5)) {
359
- output += `- **${smell.severity.toUpperCase()}** ${smell.name}\n`;
360
- output += ` - \`${smell.file}\`${smell.line ? `:${smell.line}` : ""}\n`;
361
- }
362
- }
363
-
364
- if (data.visualizations?.dependencyGraph && args?.visualize) {
365
- output += "\n## Dependency Graph\n\n";
366
- output +=
367
- "```mermaid\n" + data.visualizations.dependencyGraph + "\n```\n";
368
- }
369
- } catch (err) {
370
- output += `āš ļø Architecture analysis incomplete: ${err.message}\n`;
371
- }
372
-
373
- output += "\n---\n_Context Enhanced by vibecheck AI_\n";
374
- return { content: [{ type: "text", text: output }] };
375
- }
376
-
377
- async function handleSupplyChain(projectPath, args, __dirname) {
378
- let output = "# šŸ“¦ Supply Chain Analysis\n\n";
379
- output += `**Path:** ${projectPath}\n\n`;
380
-
381
- try {
382
- const cmd = `node "${path.join(__dirname, "..", "bin", "runners", "runIntelligence.js")}" supply --json --path "${projectPath}"`;
383
- const result = execSync(cmd, {
384
- encoding: "utf8",
385
- maxBuffer: 10 * 1024 * 1024,
386
- });
387
- const data = JSON.parse(result);
388
-
389
- output += "## Supply Chain Scores\n\n";
390
- output += `| Category | Score |\n|----------|-------|\n`;
391
- if (data.scores) {
392
- output += `| Overall | ${data.scores.overall}/100 ${getScoreIcon(data.scores.overall)} |\n`;
393
- output += `| Vulnerability | ${data.scores.vulnerability}/100 ${getScoreIcon(data.scores.vulnerability)} |\n`;
394
- output += `| License | ${data.scores.license}/100 ${getScoreIcon(data.scores.license)} |\n`;
395
- output += `| Maintenance | ${data.scores.maintenance}/100 ${getScoreIcon(data.scores.maintenance)} |\n`;
396
- }
397
-
398
- if (data.dependencies) {
399
- output += "\n## Dependencies\n\n";
400
- output += `- **Total:** ${data.dependencies.total}\n`;
401
- output += `- **Direct:** ${data.dependencies.direct}\n`;
402
- output += `- **Transitive:** ${data.dependencies.transitive}\n`;
403
- output += `- **Outdated:** ${data.dependencies.outdated?.length || 0}\n`;
404
- }
405
-
406
- if (data.vulnerabilities) {
407
- output += "\n## Vulnerabilities\n\n";
408
- output += `- **Total:** ${data.vulnerabilities.total}\n`;
409
- output += `- **Critical:** ${data.vulnerabilities.critical} šŸ”“\n`;
410
- output += `- **High:** ${data.vulnerabilities.high} 🟠\n`;
411
- output += `- **Medium:** ${data.vulnerabilities.medium} 🟔\n`;
412
- }
413
-
414
- if (
415
- data.licenses?.riskyLicenses &&
416
- data.licenses.riskyLicenses.length > 0
417
- ) {
418
- output += "\n## āš ļø Risky Licenses\n\n";
419
- for (const lic of data.licenses.riskyLicenses.slice(0, 5)) {
420
- output += `- **${lic.risk.toUpperCase()}** ${lic.package} (${lic.license})\n`;
421
- }
422
- }
423
-
424
- if (data.security?.malicious && data.security.malicious.length > 0) {
425
- output += "\n## 🚨 MALICIOUS PACKAGES\n\n";
426
- for (const mal of data.security.malicious) {
427
- output += `- āŒ **${mal.name}** - ${mal.reason}\n`;
428
- }
429
- }
430
-
431
- if (
432
- data.security?.typosquatting &&
433
- data.security.typosquatting.length > 0
434
- ) {
435
- output += "\n## āš ļø Typosquatting Risks\n\n";
436
- for (const typo of data.security.typosquatting.slice(0, 3)) {
437
- output += `- **${typo.riskLevel.toUpperCase()}** \`${typo.package}\` → similar to \`${typo.similarTo}\`\n`;
438
- }
439
- }
440
- } catch (err) {
441
- output += `āš ļø Supply chain analysis incomplete: ${err.message}\n`;
442
- }
443
-
444
- output += "\n---\n_Context Enhanced by vibecheck AI_\n";
445
- return { content: [{ type: "text", text: output }] };
446
- }
447
-
448
- async function handleTeam(projectPath, args, __dirname) {
449
- let output = "# šŸ‘„ Team Intelligence\n\n";
450
- output += `**Path:** ${projectPath}\n\n`;
451
-
452
- try {
453
- const cmd = `node "${path.join(__dirname, "..", "bin", "runners", "runIntelligence.js")}" team --json --path "${projectPath}"`;
454
- const result = execSync(cmd, {
455
- encoding: "utf8",
456
- maxBuffer: 10 * 1024 * 1024,
457
- });
458
- const data = JSON.parse(result);
459
-
460
- if (data.collaboration?.metrics) {
461
- output += "## Team Metrics\n\n";
462
- const m = data.collaboration.metrics;
463
- output += `- **Total Contributors:** ${m.totalContributors}\n`;
464
- output += `- **Active Contributors:** ${m.activeContributors}\n`;
465
- output += `- **Commits/Week:** ${m.averageCommitsPerWeek}\n`;
466
- output += `- **Knowledge Sharing:** ${(m.knowledgeSharingScore * 100).toFixed(0)}%\n`;
467
- }
468
-
469
- if (data.collaboration?.busFactor) {
470
- output += "\n## 🚌 Bus Factor\n\n";
471
- output += `**Overall Bus Factor:** ${data.collaboration.busFactor.overall}\n\n`;
472
-
473
- if (data.collaboration.busFactor.criticalAreas?.length > 0) {
474
- output += "**āš ļø Critical Areas (Bus Factor = 1):**\n";
475
- for (const area of data.collaboration.busFactor.criticalAreas) {
476
- output += `- ${area}\n`;
477
- }
478
- }
479
- }
480
-
481
- if (data.knowledge?.experts && data.knowledge.experts.length > 0) {
482
- output += "\n## šŸŽÆ Top Experts\n\n";
483
- for (const expert of data.knowledge.experts.slice(0, 5)) {
484
- const topAreas =
485
- expert.areas
486
- ?.slice(0, 2)
487
- .map((a) => a.area)
488
- .join(", ") || "Various";
489
- output += `- **${expert.developer}:** ${expert.totalCommits} commits (${topAreas})\n`;
490
- }
491
- }
492
-
493
- if (
494
- data.knowledge?.orphanedKnowledge &&
495
- data.knowledge.orphanedKnowledge.length > 0
496
- ) {
497
- output += "\n## āš ļø Knowledge Silos\n\n";
498
- for (const orphan of data.knowledge.orphanedKnowledge.slice(0, 3)) {
499
- output += `- **${orphan.risk.toUpperCase()}** ${orphan.area}\n`;
500
- output += ` - ${orphan.reason}\n`;
501
- }
502
- }
503
-
504
- if (data.decisions?.tracked && data.decisions.tracked.length > 0) {
505
- output += "\n## šŸ“œ Architectural Decisions\n\n";
506
- for (const decision of data.decisions.tracked.slice(0, 3)) {
507
- const icon = decision.status === "accepted" ? "āœ…" : "šŸ“";
508
- output += `- ${icon} ${decision.title}\n`;
509
- }
510
- }
511
- } catch (err) {
512
- output += `āš ļø Team analysis incomplete: ${err.message}\n`;
513
- }
514
-
515
- output += "\n---\n_Context Enhanced by vibecheck AI_\n";
516
- return { content: [{ type: "text", text: output }] };
517
- }
518
-
519
- async function handlePredictive(projectPath, args, __dirname) {
520
- let output = "# šŸ”® Predictive Analytics\n\n";
521
- output += `**Path:** ${projectPath}\n\n`;
522
-
523
- try {
524
- const cmd = `node "${path.join(__dirname, "..", "bin", "runners", "runIntelligence.js")}" predict --json --path "${projectPath}"`;
525
- const result = execSync(cmd, {
526
- encoding: "utf8",
527
- maxBuffer: 10 * 1024 * 1024,
528
- });
529
- const data = JSON.parse(result);
530
-
531
- if (data.quality) {
532
- output += "## Quality Prediction\n\n";
533
- output += `- **Current Score:** ${data.quality.currentScore}/100 ${getScoreIcon(data.quality.currentScore)}\n`;
534
- output += `- **Predicted Score:** ${data.quality.predictedScore}/100 (30 days)\n`;
535
- const trendIcon =
536
- data.quality.trend === "improving"
537
- ? "šŸ“ˆ"
538
- : data.quality.trend === "degrading"
539
- ? "šŸ“‰"
540
- : "āž”ļø";
541
- output += `- **Trend:** ${trendIcon} ${data.quality.trend}\n`;
542
- }
543
-
544
- if (data.risk) {
545
- output += "\n## Risk Assessment\n\n";
546
- output += `**Overall Risk:** ${data.risk.overallRisk}%\n\n`;
547
-
548
- if (data.risk.categories) {
549
- output += "| Category | Risk | Trend |\n|----------|------|-------|\n";
550
- for (const cat of data.risk.categories.slice(0, 4)) {
551
- const trendIcon =
552
- cat.trend === "increasing"
553
- ? "šŸ“ˆ"
554
- : cat.trend === "decreasing"
555
- ? "šŸ“‰"
556
- : "āž”ļø";
557
- output += `| ${cat.name} | ${cat.score}% | ${trendIcon} |\n`;
558
- }
559
- }
560
- }
561
-
562
- if (data.quality?.riskAreas && data.quality.riskAreas.length > 0) {
563
- output += "\n## šŸŽÆ High-Risk Areas\n\n";
564
- for (const area of data.quality.riskAreas.slice(0, 5)) {
565
- output += `- **${area.riskScore}%** \`${area.path}\`\n`;
566
- output += ` - ${area.factors.join(", ")}\n`;
567
- }
568
- }
569
-
570
- if (data.anomalies?.detected && data.anomalies.detected.length > 0) {
571
- output += "\n## 🚨 Anomalies Detected\n\n";
572
- for (const anomaly of data.anomalies.detected.slice(0, 3)) {
573
- output += `- **${anomaly.severity.toUpperCase()}** ${anomaly.type} in ${anomaly.metric}\n`;
574
- output += ` - ${anomaly.context}\n`;
575
- }
576
- }
577
-
578
- if (
579
- data.growth?.capacityWarnings &&
580
- data.growth.capacityWarnings.length > 0
581
- ) {
582
- output += "\n## šŸ“ˆ Growth Warnings\n\n";
583
- for (const warning of data.growth.capacityWarnings) {
584
- output += `- āš ļø **${warning.metric}:** ${warning.timeToThreshold}\n`;
585
- output += ` - ${warning.recommendation}\n`;
586
- }
587
- }
588
-
589
- if (data.evolution?.trajectory) {
590
- output += "\n## šŸ”® Trajectory\n\n";
591
- const trajIcon =
592
- data.evolution.trajectory.direction === "positive"
593
- ? "šŸš€"
594
- : data.evolution.trajectory.direction === "negative"
595
- ? "šŸ“‰"
596
- : "āž”ļø";
597
- output += `${trajIcon} **${data.evolution.trajectory.predictedState}**\n`;
598
- }
599
- } catch (err) {
600
- output += `āš ļø Predictive analysis incomplete: ${err.message}\n`;
601
- }
602
-
603
- output += "\n---\n_Context Enhanced by vibecheck AI_\n";
604
- return { content: [{ type: "text", text: output }] };
605
- }
606
-
607
- async function handleFull(projectPath, args, __dirname) {
608
- let output = "# šŸš€ Comprehensive Intelligence Analysis\n\n";
609
- output += `**Path:** ${projectPath}\n\n`;
610
-
611
- try {
612
- const cmd = `node "${path.join(__dirname, "..", "bin", "runners", "runIntelligence.js")}" full --json --path "${projectPath}"`;
613
- const result = execSync(cmd, {
614
- encoding: "utf8",
615
- maxBuffer: 50 * 1024 * 1024,
616
- timeout: 300000,
617
- });
618
- const data = JSON.parse(result);
619
-
620
- if (data.summary) {
621
- const s = data.summary;
622
- output += "## Overall Results\n\n";
623
- output += `**Score:** ${s.overallScore}/100 ${getScoreIcon(s.overallScore)} **Grade:** ${s.grade}\n\n`;
624
-
625
- const verdictIcon =
626
- s.verdict === "SHIP" ? "šŸš€" : s.verdict === "NO-SHIP" ? "šŸ›‘" : "āš ļø";
627
- output += `**Verdict:** ${verdictIcon} ${s.verdict}\n\n`;
628
-
629
- output += "### Suite Scores\n\n";
630
- output += "| Suite | Score |\n|-------|-------|\n";
631
- output += `| AI Intelligence | ${s.scores?.ai || "N/A"}/100 ${getScoreIcon(s.scores?.ai)} |\n`;
632
- output += `| Security | ${s.scores?.security || "N/A"}/100 ${getScoreIcon(s.scores?.security)} |\n`;
633
- output += `| Architecture | ${s.scores?.architecture || "N/A"}/100 ${getScoreIcon(s.scores?.architecture)} |\n`;
634
- output += `| Supply Chain | ${s.scores?.supplyChain || "N/A"}/100 ${getScoreIcon(s.scores?.supplyChain)} |\n`;
635
- output += `| Team Health | ${s.scores?.team || "N/A"}/100 ${getScoreIcon(s.scores?.team)} |\n`;
636
- output += `| Risk Score | ${s.scores?.predictive || "N/A"}/100 ${getScoreIcon(s.scores?.predictive)} |\n`;
637
-
638
- if (s.criticalIssues > 0) {
639
- output += `\nāš ļø **${s.criticalIssues} Critical Issues Found** - Address before shipping\n`;
640
- }
641
-
642
- output += `\n_Analysis completed in ${((s.duration || 0) / 1000).toFixed(1)}s_\n`;
643
- }
644
- } catch (err) {
645
- output += `āš ļø Full analysis incomplete: ${err.message}\n`;
646
- output += "\nTry running individual suites for partial results.\n";
647
- }
648
-
649
- output += "\n---\n_Context Enhanced by vibecheck AI_\n";
650
- return { content: [{ type: "text", text: output }] };
651
- }
652
-
653
- // ============================================================================
654
- // HELPERS
655
- // ============================================================================
656
-
657
- function getScoreIcon(score) {
658
- if (score === undefined || score === null) return "";
659
- if (score >= 80) return "āœ…";
660
- if (score >= 60) return "āš ļø";
661
- return "āŒ";
662
- }
663
-
664
- export default { INTELLIGENCE_TOOLS, handleIntelligenceTool };