@vibecheck-ai/mcp 24.6.8 → 24.6.11

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 (41) hide show
  1. package/README.md +1 -1
  2. package/dist/APITruthEngine-IZRR3NT5-LPFUOMLD.js +9 -0
  3. package/dist/CredentialsEngine-B66ANCBB-HY5ZQTSX.js +9 -0
  4. package/dist/EnvVarEngine-ZFNW2XKP-6HRTZULP.js +9 -0
  5. package/dist/ErrorHandlingEngine-VAHVDVFG-3GDGRN3U.js +11 -0
  6. package/dist/FrameworkPackEngine-RRBJW4MC-KH7WRXXS.js +12 -0
  7. package/dist/GhostRouteEngine-UMYBCOCL-MSZOPVZY.js +9 -0
  8. package/dist/LogicGapEngine-OK5UKZQ5-YGXZDERB.js +11 -0
  9. package/dist/PhantomDepEngine-HQEXAS25-TRVEXBMF.js +10 -0
  10. package/dist/SecurityEngine-MVMRPKLH-BNP7IC46.js +9 -0
  11. package/dist/VersionHallucinationEngine-673DJ26J-BD4SK6JX.js +9 -0
  12. package/dist/chokidar-CI5VJY5M.js +2414 -0
  13. package/dist/chunk-43XAAYST.js +863 -0
  14. package/dist/chunk-5DADZJ3D.js +650 -0
  15. package/dist/chunk-DDTUTWRY.js +605 -0
  16. package/dist/chunk-DGNNNAVK.js +304 -0
  17. package/dist/chunk-F34MHA6A.js +772 -0
  18. package/dist/chunk-FGMVY5QW.js +42 -0
  19. package/dist/chunk-G3FQJC2H.js +1968 -0
  20. package/dist/chunk-J52EUKKW.js +196 -0
  21. package/dist/chunk-JZSHXEYP.js +915 -0
  22. package/dist/chunk-LQSBUKYZ.js +551 -0
  23. package/dist/chunk-MUP4JXOF.js +219 -0
  24. package/dist/chunk-NR36RTVO.js +152 -0
  25. package/dist/chunk-QFDZMUGO.js +213300 -0
  26. package/dist/chunk-QGPX6H6L.js +3044 -0
  27. package/dist/chunk-QYXENOVK.js +499 -0
  28. package/dist/chunk-RNFMO5GH.js +8861 -0
  29. package/dist/chunk-RR5ETBSV.js +66 -0
  30. package/dist/chunk-YWUMPN4Z.js +53 -0
  31. package/dist/dist-HFMJ3GIR.js +1091 -0
  32. package/dist/dist-JUOVMQEA.js +9 -0
  33. package/dist/dist-NXITTS32-O3XLWR6T.js +386 -0
  34. package/dist/dist-OUJKMVTB.js +22 -0
  35. package/dist/fingerprint-NOJ7TDB6-K6SB7LCZ.js +9 -0
  36. package/dist/index.js +4735 -3577
  37. package/dist/semantic-WW6XVII4.js +8544 -0
  38. package/dist/transformers.node-K4WKH4PR.js +45809 -0
  39. package/dist/tree-sitter-AGICL65I.js +1412 -0
  40. package/dist/tree-sitter-H5E7LKR4-MKO3NNLJ.js +9 -0
  41. package/package.json +7 -6
@@ -0,0 +1,9 @@
1
+ import { createRequire } from 'module';
2
+ import { fileURLToPath } from 'url';
3
+ import { dirname } from 'path';
4
+ export { VERSION, evolve, extractCoEdits, extractSequences, getBoostedFiles, getOutcomeBoost, getSequentialFiles, loadLearned, loadLearnedOrEvolveIfStale, readProvenance, recordFeedback } from './chunk-J52EUKKW.js';
5
+ import './chunk-YWUMPN4Z.js';
6
+
7
+ createRequire(import.meta.url);
8
+ const __filename$1 = fileURLToPath(import.meta.url);
9
+ dirname(__filename$1);
@@ -0,0 +1,386 @@
1
+ import { createRequire } from 'module';
2
+ import { fileURLToPath } from 'url';
3
+ import * as path from 'path';
4
+ import { dirname } from 'path';
5
+ import './chunk-YWUMPN4Z.js';
6
+ import { AsyncLocalStorage } from 'async_hooks';
7
+ import { randomUUID } from 'crypto';
8
+ import * as fs from 'fs';
9
+
10
+ createRequire(import.meta.url);
11
+ const __filename$1 = fileURLToPath(import.meta.url);
12
+ dirname(__filename$1);
13
+ var DEFAULT_OPTS = {
14
+ tracePath: ".vibecheck/nexus/runtime.jsonl",
15
+ flushEveryN: 16,
16
+ flushIntervalMs: 1e3,
17
+ rotateAtBytes: 64 * 1024 * 1024
18
+ };
19
+ var TraceRecorder = class {
20
+ opts;
21
+ buffer = [];
22
+ timer;
23
+ closed = false;
24
+ constructor(opts = {}) {
25
+ this.opts = {
26
+ ...DEFAULT_OPTS,
27
+ ...opts,
28
+ tracePath: opts.tracePath ?? DEFAULT_OPTS.tracePath
29
+ };
30
+ this.ensureParentDir();
31
+ this.scheduleFlush();
32
+ }
33
+ /** Enqueue an event; flushes synchronously when the batch is full. */
34
+ record(event) {
35
+ if (this.closed) return;
36
+ this.buffer.push(event);
37
+ if (this.buffer.length >= this.opts.flushEveryN) {
38
+ this.flush();
39
+ }
40
+ }
41
+ /** Write the buffered events to disk. Safe to call repeatedly. */
42
+ flush() {
43
+ if (this.buffer.length === 0) return;
44
+ const lines = this.buffer.map((e) => JSON.stringify(e)).join("\n") + "\n";
45
+ this.buffer = [];
46
+ try {
47
+ this.rotateIfOversized();
48
+ fs.appendFileSync(this.opts.tracePath, lines, { encoding: "utf-8" });
49
+ } catch {
50
+ }
51
+ }
52
+ /** Flush and stop the interval timer. Idempotent. */
53
+ close() {
54
+ if (this.closed) return;
55
+ this.closed = true;
56
+ if (this.timer) {
57
+ clearInterval(this.timer);
58
+ this.timer = void 0;
59
+ }
60
+ this.flush();
61
+ }
62
+ /** Path to the active trace file — handy for the merger. */
63
+ tracePath() {
64
+ return this.opts.tracePath;
65
+ }
66
+ scheduleFlush() {
67
+ this.timer = setInterval(() => this.flush(), this.opts.flushIntervalMs);
68
+ this.timer.unref?.();
69
+ }
70
+ ensureParentDir() {
71
+ const dir = path.dirname(this.opts.tracePath);
72
+ if (dir) {
73
+ try {
74
+ fs.mkdirSync(dir, { recursive: true });
75
+ } catch {
76
+ }
77
+ }
78
+ }
79
+ rotateIfOversized() {
80
+ if (this.opts.rotateAtBytes <= 0) return;
81
+ let size = 0;
82
+ try {
83
+ size = fs.statSync(this.opts.tracePath).size;
84
+ } catch {
85
+ return;
86
+ }
87
+ if (size < this.opts.rotateAtBytes) return;
88
+ const archive = `${this.opts.tracePath}.1`;
89
+ try {
90
+ fs.rmSync(archive, { force: true });
91
+ fs.renameSync(this.opts.tracePath, archive);
92
+ } catch {
93
+ }
94
+ }
95
+ };
96
+ var storage = new AsyncLocalStorage();
97
+ var NexusTracer = class {
98
+ recorder = null;
99
+ opts;
100
+ running = false;
101
+ constructor(opts = {}) {
102
+ this.opts = opts;
103
+ }
104
+ /**
105
+ * Start the tracer. Creates the JSONL file handle through the recorder.
106
+ * Safe to call twice — second call is a no-op.
107
+ */
108
+ start() {
109
+ if (this.running) return;
110
+ this.recorder = new TraceRecorder(this.opts);
111
+ this.running = true;
112
+ }
113
+ /** Stop the tracer and flush buffered events. */
114
+ stop() {
115
+ if (!this.running) return;
116
+ this.running = false;
117
+ this.recorder?.close();
118
+ this.recorder = null;
119
+ }
120
+ /** Whether the tracer is recording. */
121
+ isRunning() {
122
+ return this.running;
123
+ }
124
+ /**
125
+ * Run `fn` inside a freshly-created trace context. Every nested
126
+ * `recordCall` invocation below this point inherits the same `traceId`.
127
+ */
128
+ withTrace(label, fn) {
129
+ const ctx = { traceId: randomUUID(), label };
130
+ return storage.run(ctx, fn);
131
+ }
132
+ /**
133
+ * Record a single call. Captures start/end timestamps, duration,
134
+ * and errored status, then writes a `TraceEvent` to the recorder.
135
+ */
136
+ recordCall(args, fn) {
137
+ if (!this.running || !this.recorder) return fn();
138
+ if (!this.shouldSample()) return fn();
139
+ const callId = randomUUID();
140
+ const startedAt = /* @__PURE__ */ new Date();
141
+ const parent = storage.getStore();
142
+ const ctx = parent ? { ...parent, currentCallId: callId } : { traceId: randomUUID(), currentCallId: callId, label: args.label };
143
+ const finish = (errored, durationMs) => {
144
+ const event = {
145
+ v: 1,
146
+ symbolId: args.symbolId,
147
+ startedAt: startedAt.toISOString(),
148
+ durationMs,
149
+ errored,
150
+ traceId: ctx.traceId,
151
+ callId,
152
+ ...parent?.currentCallId ? { parentCallId: parent.currentCallId } : {}
153
+ };
154
+ this.recorder?.record(event);
155
+ };
156
+ const started = performanceNow();
157
+ let result;
158
+ try {
159
+ result = storage.run(ctx, fn);
160
+ } catch (err) {
161
+ finish(true, performanceNow() - started);
162
+ throw err;
163
+ }
164
+ if (isPromise(result)) {
165
+ return result.then(
166
+ (value) => {
167
+ finish(false, performanceNow() - started);
168
+ return value;
169
+ },
170
+ (err) => {
171
+ finish(true, performanceNow() - started);
172
+ throw err;
173
+ }
174
+ );
175
+ }
176
+ finish(false, performanceNow() - started);
177
+ return result;
178
+ }
179
+ /**
180
+ * Return an instrumented wrapper around `fn`. The returned function has
181
+ * the same arity and name as the original so consumers that inspect those
182
+ * (e.g. some router middlewares) see no change.
183
+ */
184
+ wrap(fn, symbolId) {
185
+ const tracer = this;
186
+ const resolvedId = symbolId ?? fn.name ?? this.opts.defaultSymbolId ?? "anonymous";
187
+ const wrapped = function wrapped2(...args) {
188
+ return tracer.recordCall({ symbolId: resolvedId }, () => fn.apply(this, args));
189
+ };
190
+ try {
191
+ Object.defineProperty(wrapped, "length", { value: fn.length, configurable: true });
192
+ Object.defineProperty(wrapped, "name", {
193
+ value: fn.name || resolvedId,
194
+ configurable: true
195
+ });
196
+ } catch {
197
+ }
198
+ return wrapped;
199
+ }
200
+ /** Reveal the active recorder path so the merger can find it. */
201
+ tracePath() {
202
+ return this.recorder?.tracePath() ?? null;
203
+ }
204
+ shouldSample() {
205
+ const rate = this.opts.sampleRate ?? 1;
206
+ if (rate >= 1) return true;
207
+ if (rate <= 0) return false;
208
+ return Math.random() < rate;
209
+ }
210
+ };
211
+ var singleton = null;
212
+ function getTracer(opts) {
213
+ if (!singleton) singleton = new NexusTracer(opts);
214
+ return singleton;
215
+ }
216
+ function isPromise(v) {
217
+ return typeof v === "object" && v !== null && typeof v.then === "function";
218
+ }
219
+ function performanceNow() {
220
+ if (typeof process !== "undefined" && process.hrtime?.bigint) {
221
+ return Number(process.hrtime.bigint() / 1000000n);
222
+ }
223
+ return Date.now();
224
+ }
225
+ function readOptsFromEnv() {
226
+ const opts = {};
227
+ const envPath = process.env["NEXUS_TRACE_PATH"];
228
+ if (envPath) opts.tracePath = envPath;
229
+ const envRate = process.env["NEXUS_SAMPLE_RATE"];
230
+ if (envRate) {
231
+ const r = Number(envRate);
232
+ if (Number.isFinite(r) && r >= 0 && r <= 1) opts.sampleRate = r;
233
+ }
234
+ const envRotate = process.env["NEXUS_ROTATE_BYTES"];
235
+ if (envRotate) {
236
+ const n = Number(envRotate);
237
+ if (Number.isFinite(n) && n >= 0) opts.rotateAtBytes = n;
238
+ }
239
+ return opts;
240
+ }
241
+ function bootstrap() {
242
+ const tracer = getTracer(readOptsFromEnv());
243
+ tracer.start();
244
+ const flushAndExit = () => {
245
+ try {
246
+ tracer.stop();
247
+ } catch {
248
+ }
249
+ };
250
+ process.on("exit", flushAndExit);
251
+ process.on("SIGINT", flushAndExit);
252
+ process.on("SIGTERM", flushAndExit);
253
+ process.on("uncaughtException", (err) => {
254
+ flushAndExit();
255
+ throw err;
256
+ });
257
+ process.on("unhandledRejection", flushAndExit);
258
+ }
259
+ bootstrap();
260
+ var OTEL_STATUS_ERROR = 2;
261
+ var OtelExporter = class {
262
+ tracer;
263
+ resolve;
264
+ constructor(opts) {
265
+ this.tracer = opts.tracer;
266
+ this.resolve = opts.resolveSymbolId ?? defaultResolveSymbolId;
267
+ }
268
+ /** Fold one completed OTEL span into the Nexus trace stream. */
269
+ onSpan(span) {
270
+ if (!this.tracer.isRunning()) return;
271
+ const recorder = this.tracer.recorder;
272
+ if (!recorder) return;
273
+ const sc = span.spanContext();
274
+ const startedAt = new Date(toMillis(span.startTime)).toISOString();
275
+ const durationMs = span.duration !== void 0 ? toMillis(span.duration) : void 0;
276
+ const errored = span.status?.code === OTEL_STATUS_ERROR;
277
+ const event = {
278
+ v: 1,
279
+ symbolId: this.resolve(span),
280
+ startedAt,
281
+ ...durationMs !== void 0 ? { durationMs } : {},
282
+ ...errored ? { errored: true } : {},
283
+ traceId: sc.traceId,
284
+ callId: sc.spanId,
285
+ ...span.parentSpanId ? { parentCallId: span.parentSpanId } : {}
286
+ };
287
+ recorder.record(event);
288
+ }
289
+ };
290
+ function defaultResolveSymbolId(span) {
291
+ const attrs = span.attributes ?? {};
292
+ const direct = attrs["nexus.symbolId"];
293
+ if (typeof direct === "string" && direct.length > 0) return direct;
294
+ const file = attrs["code.filepath"];
295
+ const fn = attrs["code.function"];
296
+ if (typeof file === "string" && typeof fn === "string") {
297
+ return `${file}#${fn}`;
298
+ }
299
+ return span.name;
300
+ }
301
+ function toMillis(time) {
302
+ if (typeof time === "number") return time;
303
+ if (Array.isArray(time)) {
304
+ const [s, ns] = time;
305
+ return s * 1e3 + Math.floor(ns / 1e6);
306
+ }
307
+ if (time && typeof time === "object") {
308
+ return time.seconds * 1e3 + Math.floor(time.nanos / 1e6);
309
+ }
310
+ return 0;
311
+ }
312
+ function loadTraces(tracePath) {
313
+ let content;
314
+ try {
315
+ content = fs.readFileSync(tracePath, { encoding: "utf-8" });
316
+ } catch {
317
+ return [];
318
+ }
319
+ const events = [];
320
+ for (const raw of content.split("\n")) {
321
+ const line = raw.trim();
322
+ if (!line) continue;
323
+ try {
324
+ const parsed = JSON.parse(line);
325
+ if (parsed && parsed.v === 1 && typeof parsed.symbolId === "string") {
326
+ events.push(parsed);
327
+ }
328
+ } catch {
329
+ }
330
+ }
331
+ return events;
332
+ }
333
+ function mergeRuntimeTraces(events) {
334
+ const groups = /* @__PURE__ */ new Map();
335
+ for (const ev of events) {
336
+ const list = groups.get(ev.symbolId);
337
+ if (list) list.push(ev);
338
+ else groups.set(ev.symbolId, [ev]);
339
+ }
340
+ const out = [];
341
+ for (const [symbolId, rows] of groups) {
342
+ let errorCount = 0;
343
+ let totalLatency = 0;
344
+ let latencyCount = 0;
345
+ let lastSeen;
346
+ const durations = [];
347
+ for (const r of rows) {
348
+ if (r.errored) errorCount += 1;
349
+ if (typeof r.durationMs === "number") {
350
+ totalLatency += r.durationMs;
351
+ latencyCount += 1;
352
+ durations.push(r.durationMs);
353
+ }
354
+ if (!lastSeen || r.startedAt > lastSeen) lastSeen = r.startedAt;
355
+ }
356
+ const trace = {
357
+ symbolId,
358
+ callCount: rows.length,
359
+ ...latencyCount > 0 ? { totalLatencyMs: round(totalLatency) } : {},
360
+ ...durations.length > 0 ? { p50Ms: round(percentile(durations, 0.5)) } : {},
361
+ ...durations.length > 0 ? { p95Ms: round(percentile(durations, 0.95)) } : {},
362
+ ...errorCount > 0 ? { errorCount } : {},
363
+ ...lastSeen ? { lastSeenAt: lastSeen } : {}
364
+ };
365
+ out.push(trace);
366
+ }
367
+ out.sort((a, b) => a.symbolId.localeCompare(b.symbolId));
368
+ return out;
369
+ }
370
+ function loadAndMerge(tracePath) {
371
+ return mergeRuntimeTraces(loadTraces(tracePath));
372
+ }
373
+ function percentile(values, q) {
374
+ if (values.length === 0) return 0;
375
+ const sorted = [...values].sort((a, b) => a - b);
376
+ const idx = Math.min(
377
+ sorted.length - 1,
378
+ Math.max(0, Math.floor(q * (sorted.length - 1)))
379
+ );
380
+ return sorted[idx] ?? 0;
381
+ }
382
+ function round(n) {
383
+ return Math.round(n * 100) / 100;
384
+ }
385
+
386
+ export { NexusTracer, OtelExporter, TraceRecorder, bootstrap as bootstrapTracer, getTracer, loadAndMerge, loadTraces, mergeRuntimeTraces };
@@ -0,0 +1,22 @@
1
+ import { createRequire } from 'module';
2
+ import { fileURLToPath } from 'url';
3
+ import { dirname } from 'path';
4
+ export { CircuitBreaker, ENGINE_FOCUS_PRESETS, EngineRegistry, EnvLoader, FakeFeaturesEngine, IncompleteImplEngine, OutcomeVerificationEngine, PerformanceAntipatternEngine, RULE_AUTOFIX_SAFETY_BY_ID, RULE_MATURITY_BY_ID, RULE_TRUST_IMPACT_BY_ID, RuntimeProbeEngine, SCAN_ENGINE_FOCUS_PRESET_NAMES, SecurityPatternEngine, TruthpackEnvIndex, TypeContractEngine, VIBECHECK_DEFAULT_ENGINE_IDS, accessibilityEngine, autofixSafetyForRule, backendEngine, buildCiSummaryJson, buildRiskClusters, buildShipBlockers, categoryIcons, computeTrustScore, configurationEngine, createDefaultRegistry, diffScores, documentationEngine, engineTogglesAllowOnly, estimateBlastRadius, findUncalledExportedFunctions, formatCiSummaryMarkdown, formatCiSummaryPlainLines, formatFindings, formatSummary, formatTraceAsJson, formatTraceForTerminal, formatTrustScoreMarkdown, generateVerdict, icons, infrastructureEngine, isTestLikeScanPath, isVibecheckFinding, loadTruthpack, maturityTierForRule, observabilityEngine, parseCallSites, performanceEngine, resilienceEngine, runGhostTrace, runPolish, scan, securityEngine, seoEngine, toCanonicalFinding, toCanonicalFindingFromGuardrail, toCanonicalFindingFromLegacyFinding, toCanonicalFindingFromMissionFinding, toCanonicalFindingFromPolish, toCanonicalFindingFromReport, toCanonicalFindingFromScanApi, toCanonicalFindingFromScanFinding, toCanonicalFindings, toSarif, trustImpactForRule, trustPenaltyScaleForFinding, truthpackToRouteIndex } from './chunk-RNFMO5GH.js';
5
+ export { FrameworkPackEngine } from './chunk-MUP4JXOF.js';
6
+ export { LogicGapEngine } from './chunk-DDTUTWRY.js';
7
+ export { ErrorHandlingEngine } from './chunk-QFDZMUGO.js';
8
+ export { BaseEngine } from './chunk-RR5ETBSV.js';
9
+ export { computeWorkspaceFingerprint } from './chunk-FGMVY5QW.js';
10
+ export { EngineError, EngineErrorCode, PhantomDepEngine, createContext, extractPythonPypiImports, getLanguageProfile, goLanguageProfile, isEngineError, javascriptLanguageProfile, pythonLanguageProfile, withEngineErrorHandling } from './chunk-G3FQJC2H.js';
11
+ export { extractJavaScriptImportSpecifiersFlat, extractJavaScriptNpmImports, extractPackageName, isNodeBuiltin, isRelativeOrAlias } from './chunk-NR36RTVO.js';
12
+ export { APITruthEngine } from './chunk-JZSHXEYP.js';
13
+ export { EnvVarEngine } from './chunk-QYXENOVK.js';
14
+ export { GhostRouteEngine } from './chunk-LQSBUKYZ.js';
15
+ export { CredentialsEngine } from './chunk-5DADZJ3D.js';
16
+ export { SecurityEngine } from './chunk-43XAAYST.js';
17
+ export { VersionHallucinationEngine } from './chunk-F34MHA6A.js';
18
+ import './chunk-YWUMPN4Z.js';
19
+
20
+ createRequire(import.meta.url);
21
+ const __filename$1 = fileURLToPath(import.meta.url);
22
+ dirname(__filename$1);
@@ -0,0 +1,9 @@
1
+ import { createRequire } from 'module';
2
+ import { fileURLToPath } from 'url';
3
+ import { dirname } from 'path';
4
+ export { computeWorkspaceFingerprint } from './chunk-FGMVY5QW.js';
5
+ import './chunk-YWUMPN4Z.js';
6
+
7
+ createRequire(import.meta.url);
8
+ const __filename$1 = fileURLToPath(import.meta.url);
9
+ dirname(__filename$1);