@vibecheckai/cli 3.0.4 ā 3.0.7
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/bin/dev/run-v2-torture.js +30 -0
- package/bin/runners/context/index.js +1 -1
- package/bin/runners/lib/analyzers.js +38 -0
- package/bin/runners/lib/assets/vibecheck-logo.png +0 -0
- package/bin/runners/lib/contracts/auth-contract.js +8 -0
- package/bin/runners/lib/contracts/env-contract.js +3 -0
- package/bin/runners/lib/contracts/external-contract.js +10 -2
- package/bin/runners/lib/contracts/route-contract.js +7 -0
- package/bin/runners/lib/contracts.js +804 -0
- package/bin/runners/lib/detectors-v2.js +703 -0
- package/bin/runners/lib/drift.js +425 -0
- package/bin/runners/lib/entitlements-v2.js +3 -1
- package/bin/runners/lib/entitlements.js +11 -3
- package/bin/runners/lib/env-resolver.js +417 -0
- package/bin/runners/lib/extractors/client-calls.js +990 -0
- package/bin/runners/lib/extractors/fastify-route-dump.js +573 -0
- package/bin/runners/lib/extractors/fastify-routes.js +426 -0
- package/bin/runners/lib/extractors/index.js +363 -0
- package/bin/runners/lib/extractors/next-routes.js +524 -0
- package/bin/runners/lib/extractors/proof-graph.js +431 -0
- package/bin/runners/lib/extractors/route-matcher.js +451 -0
- package/bin/runners/lib/extractors/truthpack-v2.js +377 -0
- package/bin/runners/lib/extractors/ui-bindings.js +547 -0
- package/bin/runners/lib/findings-schema.js +281 -0
- package/bin/runners/lib/html-report.js +650 -0
- package/bin/runners/lib/missions/templates.js +45 -0
- package/bin/runners/lib/policy.js +295 -0
- package/bin/runners/lib/reality/correlation-detectors.js +359 -0
- package/bin/runners/lib/reality/index.js +318 -0
- package/bin/runners/lib/reality/request-hashing.js +416 -0
- package/bin/runners/lib/reality/request-mapper.js +453 -0
- package/bin/runners/lib/reality/safety-rails.js +463 -0
- package/bin/runners/lib/reality/semantic-snapshot.js +408 -0
- package/bin/runners/lib/reality/toast-detector.js +393 -0
- package/bin/runners/lib/report-html.js +5 -0
- package/bin/runners/lib/report-templates.js +5 -0
- package/bin/runners/lib/report.js +135 -0
- package/bin/runners/lib/route-truth.js +10 -10
- package/bin/runners/lib/schema-validator.js +350 -0
- package/bin/runners/lib/schemas/contracts.schema.json +160 -0
- package/bin/runners/lib/schemas/finding.schema.json +100 -0
- package/bin/runners/lib/schemas/mission-pack.schema.json +206 -0
- package/bin/runners/lib/schemas/proof-graph.schema.json +176 -0
- package/bin/runners/lib/schemas/reality-report.schema.json +162 -0
- package/bin/runners/lib/schemas/share-pack.schema.json +180 -0
- package/bin/runners/lib/schemas/ship-report.schema.json +117 -0
- package/bin/runners/lib/schemas/truthpack-v2.schema.json +303 -0
- package/bin/runners/lib/schemas/validator.js +438 -0
- package/bin/runners/lib/ui.js +562 -0
- package/bin/runners/lib/verdict-engine.js +628 -0
- package/bin/runners/runAIAgent.js +228 -1
- package/bin/runners/runBadge.js +181 -1
- package/bin/runners/runCtx.js +7 -2
- package/bin/runners/runCtxDiff.js +301 -0
- package/bin/runners/runGuard.js +168 -0
- package/bin/runners/runInitGha.js +78 -15
- package/bin/runners/runLabs.js +341 -0
- package/bin/runners/runLaunch.js +180 -1
- package/bin/runners/runMdc.js +203 -1
- package/bin/runners/runProof.zip +0 -0
- package/bin/runners/runProve.js +23 -0
- package/bin/runners/runReplay.js +114 -84
- package/bin/runners/runScan.js +111 -32
- package/bin/runners/runShip.js +23 -2
- package/bin/runners/runTruthpack.js +9 -7
- package/bin/runners/runValidate.js +161 -1
- package/bin/vibecheck.js +416 -770
- package/mcp-server/.guardrail/audit/audit.log.jsonl +2 -0
- package/mcp-server/.specs/architecture.mdc +90 -0
- package/mcp-server/.specs/security.mdc +30 -0
- package/mcp-server/README.md +252 -0
- package/mcp-server/agent-checkpoint.js +364 -0
- package/mcp-server/architect-tools.js +707 -0
- package/mcp-server/audit-mcp.js +206 -0
- package/mcp-server/codebase-architect-tools.js +838 -0
- package/mcp-server/consolidated-tools.js +804 -0
- package/mcp-server/hygiene-tools.js +428 -0
- package/mcp-server/index-v1.js +698 -0
- package/mcp-server/index.js +2092 -0
- package/mcp-server/index.old.js +4137 -0
- package/mcp-server/intelligence-tools.js +664 -0
- package/mcp-server/intent-drift-tools.js +873 -0
- package/mcp-server/mdc-generator.js +298 -0
- package/mcp-server/package-lock.json +165 -0
- package/mcp-server/package.json +47 -0
- package/mcp-server/premium-tools.js +1275 -0
- package/mcp-server/test-mcp.js +108 -0
- package/mcp-server/test-tools.js +36 -0
- package/mcp-server/tier-auth.js +147 -0
- package/mcp-server/tools/index.js +72 -0
- package/mcp-server/tools-reorganized.ts +244 -0
- package/mcp-server/truth-context.js +581 -0
- package/mcp-server/truth-firewall-tools.js +1500 -0
- package/mcp-server/vibecheck-2.0-tools.js +748 -0
- package/mcp-server/vibecheck-tools.js +1075 -0
- package/package.json +10 -8
- package/bin/guardrail.js +0 -834
- package/bin/runners/runAudit.js +0 -2
- package/bin/runners/runAutopilot.js +0 -2
- package/bin/runners/runCertify.js +0 -2
- package/bin/runners/runDashboard.js +0 -10
- package/bin/runners/runEnhancedShip.js +0 -2
- package/bin/runners/runFixPacks.js +0 -2
- package/bin/runners/runNaturalLanguage.js +0 -3
- package/bin/runners/runProof.js +0 -2
- package/bin/runners/runRealitySniff.js +0 -2
- package/bin/runners/runUpgrade.js +0 -2
- package/bin/runners/runVerifyAgentOutput.js +0 -2
|
@@ -0,0 +1,664 @@
|
|
|
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 };
|