@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.
Files changed (108) hide show
  1. package/bin/dev/run-v2-torture.js +30 -0
  2. package/bin/runners/context/index.js +1 -1
  3. package/bin/runners/lib/analyzers.js +38 -0
  4. package/bin/runners/lib/assets/vibecheck-logo.png +0 -0
  5. package/bin/runners/lib/contracts/auth-contract.js +8 -0
  6. package/bin/runners/lib/contracts/env-contract.js +3 -0
  7. package/bin/runners/lib/contracts/external-contract.js +10 -2
  8. package/bin/runners/lib/contracts/route-contract.js +7 -0
  9. package/bin/runners/lib/contracts.js +804 -0
  10. package/bin/runners/lib/detectors-v2.js +703 -0
  11. package/bin/runners/lib/drift.js +425 -0
  12. package/bin/runners/lib/entitlements-v2.js +3 -1
  13. package/bin/runners/lib/entitlements.js +11 -3
  14. package/bin/runners/lib/env-resolver.js +417 -0
  15. package/bin/runners/lib/extractors/client-calls.js +990 -0
  16. package/bin/runners/lib/extractors/fastify-route-dump.js +573 -0
  17. package/bin/runners/lib/extractors/fastify-routes.js +426 -0
  18. package/bin/runners/lib/extractors/index.js +363 -0
  19. package/bin/runners/lib/extractors/next-routes.js +524 -0
  20. package/bin/runners/lib/extractors/proof-graph.js +431 -0
  21. package/bin/runners/lib/extractors/route-matcher.js +451 -0
  22. package/bin/runners/lib/extractors/truthpack-v2.js +377 -0
  23. package/bin/runners/lib/extractors/ui-bindings.js +547 -0
  24. package/bin/runners/lib/findings-schema.js +281 -0
  25. package/bin/runners/lib/html-report.js +650 -0
  26. package/bin/runners/lib/missions/templates.js +45 -0
  27. package/bin/runners/lib/policy.js +295 -0
  28. package/bin/runners/lib/reality/correlation-detectors.js +359 -0
  29. package/bin/runners/lib/reality/index.js +318 -0
  30. package/bin/runners/lib/reality/request-hashing.js +416 -0
  31. package/bin/runners/lib/reality/request-mapper.js +453 -0
  32. package/bin/runners/lib/reality/safety-rails.js +463 -0
  33. package/bin/runners/lib/reality/semantic-snapshot.js +408 -0
  34. package/bin/runners/lib/reality/toast-detector.js +393 -0
  35. package/bin/runners/lib/report-html.js +5 -0
  36. package/bin/runners/lib/report-templates.js +5 -0
  37. package/bin/runners/lib/report.js +135 -0
  38. package/bin/runners/lib/route-truth.js +10 -10
  39. package/bin/runners/lib/schema-validator.js +350 -0
  40. package/bin/runners/lib/schemas/contracts.schema.json +160 -0
  41. package/bin/runners/lib/schemas/finding.schema.json +100 -0
  42. package/bin/runners/lib/schemas/mission-pack.schema.json +206 -0
  43. package/bin/runners/lib/schemas/proof-graph.schema.json +176 -0
  44. package/bin/runners/lib/schemas/reality-report.schema.json +162 -0
  45. package/bin/runners/lib/schemas/share-pack.schema.json +180 -0
  46. package/bin/runners/lib/schemas/ship-report.schema.json +117 -0
  47. package/bin/runners/lib/schemas/truthpack-v2.schema.json +303 -0
  48. package/bin/runners/lib/schemas/validator.js +438 -0
  49. package/bin/runners/lib/ui.js +562 -0
  50. package/bin/runners/lib/verdict-engine.js +628 -0
  51. package/bin/runners/runAIAgent.js +228 -1
  52. package/bin/runners/runBadge.js +181 -1
  53. package/bin/runners/runCtx.js +7 -2
  54. package/bin/runners/runCtxDiff.js +301 -0
  55. package/bin/runners/runGuard.js +168 -0
  56. package/bin/runners/runInitGha.js +78 -15
  57. package/bin/runners/runLabs.js +341 -0
  58. package/bin/runners/runLaunch.js +180 -1
  59. package/bin/runners/runMdc.js +203 -1
  60. package/bin/runners/runProof.zip +0 -0
  61. package/bin/runners/runProve.js +23 -0
  62. package/bin/runners/runReplay.js +114 -84
  63. package/bin/runners/runScan.js +111 -32
  64. package/bin/runners/runShip.js +23 -2
  65. package/bin/runners/runTruthpack.js +9 -7
  66. package/bin/runners/runValidate.js +161 -1
  67. package/bin/vibecheck.js +416 -770
  68. package/mcp-server/.guardrail/audit/audit.log.jsonl +2 -0
  69. package/mcp-server/.specs/architecture.mdc +90 -0
  70. package/mcp-server/.specs/security.mdc +30 -0
  71. package/mcp-server/README.md +252 -0
  72. package/mcp-server/agent-checkpoint.js +364 -0
  73. package/mcp-server/architect-tools.js +707 -0
  74. package/mcp-server/audit-mcp.js +206 -0
  75. package/mcp-server/codebase-architect-tools.js +838 -0
  76. package/mcp-server/consolidated-tools.js +804 -0
  77. package/mcp-server/hygiene-tools.js +428 -0
  78. package/mcp-server/index-v1.js +698 -0
  79. package/mcp-server/index.js +2092 -0
  80. package/mcp-server/index.old.js +4137 -0
  81. package/mcp-server/intelligence-tools.js +664 -0
  82. package/mcp-server/intent-drift-tools.js +873 -0
  83. package/mcp-server/mdc-generator.js +298 -0
  84. package/mcp-server/package-lock.json +165 -0
  85. package/mcp-server/package.json +47 -0
  86. package/mcp-server/premium-tools.js +1275 -0
  87. package/mcp-server/test-mcp.js +108 -0
  88. package/mcp-server/test-tools.js +36 -0
  89. package/mcp-server/tier-auth.js +147 -0
  90. package/mcp-server/tools/index.js +72 -0
  91. package/mcp-server/tools-reorganized.ts +244 -0
  92. package/mcp-server/truth-context.js +581 -0
  93. package/mcp-server/truth-firewall-tools.js +1500 -0
  94. package/mcp-server/vibecheck-2.0-tools.js +748 -0
  95. package/mcp-server/vibecheck-tools.js +1075 -0
  96. package/package.json +10 -8
  97. package/bin/guardrail.js +0 -834
  98. package/bin/runners/runAudit.js +0 -2
  99. package/bin/runners/runAutopilot.js +0 -2
  100. package/bin/runners/runCertify.js +0 -2
  101. package/bin/runners/runDashboard.js +0 -10
  102. package/bin/runners/runEnhancedShip.js +0 -2
  103. package/bin/runners/runFixPacks.js +0 -2
  104. package/bin/runners/runNaturalLanguage.js +0 -3
  105. package/bin/runners/runProof.js +0 -2
  106. package/bin/runners/runRealitySniff.js +0 -2
  107. package/bin/runners/runUpgrade.js +0 -2
  108. package/bin/runners/runVerifyAgentOutput.js +0 -2
@@ -0,0 +1,350 @@
1
+ /**
2
+ * Schema Validation Utilities for vibecheck v2
3
+ *
4
+ * Validates artifacts against JSON schemas (Draft 2020-12).
5
+ * Used for CI validation and ensuring deterministic output.
6
+ */
7
+
8
+ "use strict";
9
+
10
+ const fs = require("fs");
11
+ const path = require("path");
12
+ const crypto = require("crypto");
13
+
14
+ const SCHEMA_VERSION = "2.0.0";
15
+
16
+ /**
17
+ * Load a schema from the schemas directory
18
+ */
19
+ function loadSchema(schemaName, schemasDir) {
20
+ const schemaPath = path.join(schemasDir, `${schemaName}.schema.json`);
21
+ if (!fs.existsSync(schemaPath)) {
22
+ return null;
23
+ }
24
+ return JSON.parse(fs.readFileSync(schemaPath, "utf8"));
25
+ }
26
+
27
+ /**
28
+ * Generate a stable fingerprint hash
29
+ */
30
+ function generateFingerprint(data) {
31
+ const str = typeof data === "string" ? data : JSON.stringify(data);
32
+ return `sha256:${crypto.createHash("sha256").update(str).digest("hex")}`;
33
+ }
34
+
35
+ /**
36
+ * Generate a short fingerprint (12 chars)
37
+ */
38
+ function shortFingerprint(data) {
39
+ const full = generateFingerprint(data);
40
+ return full.slice(0, 19); // sha256: + 12 chars
41
+ }
42
+
43
+ /**
44
+ * Create a v2-compliant Evidence object
45
+ */
46
+ function createEvidence({
47
+ kind,
48
+ reason,
49
+ file = null,
50
+ lines = null,
51
+ snippet = null,
52
+ url = null,
53
+ httpStatus = null,
54
+ artifactPath = null,
55
+ requestId = null,
56
+ traceTimeRangeMs = null,
57
+ }) {
58
+ const id = `E_${crypto.randomBytes(6).toString("hex").toUpperCase()}`;
59
+
60
+ const evidence = {
61
+ id,
62
+ kind,
63
+ reason,
64
+ };
65
+
66
+ if (file) evidence.file = file;
67
+ if (lines) evidence.lines = lines;
68
+ if (snippet) evidence.snippetHash = generateFingerprint(snippet);
69
+ if (url) evidence.url = url;
70
+ if (httpStatus) evidence.httpStatus = httpStatus;
71
+ if (artifactPath) evidence.artifactPath = artifactPath;
72
+ if (requestId) evidence.requestId = requestId;
73
+ if (traceTimeRangeMs) evidence.traceTimeRangeMs = traceTimeRangeMs;
74
+
75
+ return evidence;
76
+ }
77
+
78
+ /**
79
+ * Create a v2-compliant Finding object
80
+ */
81
+ function createFindingV2({
82
+ detectorId,
83
+ severity,
84
+ category,
85
+ scope,
86
+ title,
87
+ why,
88
+ confidence = "medium",
89
+ evidence = [],
90
+ fixHints = [],
91
+ related = [],
92
+ repro = null,
93
+ }) {
94
+ // Generate stable fingerprint from detector + primary evidence
95
+ const fingerprintData = [
96
+ detectorId,
97
+ evidence[0]?.file,
98
+ evidence[0]?.lines,
99
+ title,
100
+ ].filter(Boolean).join("|");
101
+
102
+ const fingerprint = generateFingerprint(fingerprintData);
103
+ const id = `F_${detectorId}_${fingerprint.slice(7, 19).toUpperCase()}`;
104
+
105
+ const finding = {
106
+ id,
107
+ fingerprint,
108
+ severity,
109
+ category,
110
+ scope,
111
+ title,
112
+ why,
113
+ confidence,
114
+ evidence,
115
+ };
116
+
117
+ if (fixHints.length > 0) finding.fixHints = fixHints.slice(0, 8);
118
+ if (related.length > 0) finding.related = related.slice(0, 12);
119
+ if (repro) finding.repro = repro;
120
+
121
+ return finding;
122
+ }
123
+
124
+ /**
125
+ * Validate a finding against the v2 schema
126
+ */
127
+ function validateFindingV2(finding) {
128
+ const errors = [];
129
+
130
+ // Required fields
131
+ if (!finding.id || !/^F_[A-Z0-9_]+$/.test(finding.id)) {
132
+ errors.push(`Invalid id: ${finding.id} (must match F_[A-Z0-9_]+)`);
133
+ }
134
+ if (!finding.fingerprint || !/^(sha1|sha256):[a-f0-9]{40,64}$/.test(finding.fingerprint)) {
135
+ errors.push(`Invalid fingerprint: ${finding.fingerprint}`);
136
+ }
137
+ if (!["BLOCK", "WARN", "INFO"].includes(finding.severity)) {
138
+ errors.push(`Invalid severity: ${finding.severity}`);
139
+ }
140
+ if (!["DeadUI", "Routes", "AuthCoverage", "Env", "Billing", "Truth", "Entitlements", "Quality", "Drift"].includes(finding.category)) {
141
+ errors.push(`Invalid category: ${finding.category}`);
142
+ }
143
+ if (!["client", "server", "runtime", "contracts"].includes(finding.scope)) {
144
+ errors.push(`Invalid scope: ${finding.scope}`);
145
+ }
146
+ if (!finding.title || finding.title.length < 5) {
147
+ errors.push(`Title too short: ${finding.title}`);
148
+ }
149
+ if (!finding.why || finding.why.length < 10) {
150
+ errors.push(`Why too short: ${finding.why}`);
151
+ }
152
+ if (!["low", "medium", "high"].includes(finding.confidence)) {
153
+ errors.push(`Invalid confidence: ${finding.confidence}`);
154
+ }
155
+ if (!Array.isArray(finding.evidence) || finding.evidence.length < 1) {
156
+ errors.push("Evidence must have at least 1 item");
157
+ }
158
+
159
+ return {
160
+ valid: errors.length === 0,
161
+ errors,
162
+ };
163
+ }
164
+
165
+ /**
166
+ * Validate an evidence object against the v2 schema
167
+ */
168
+ function validateEvidenceV2(evidence) {
169
+ const errors = [];
170
+
171
+ if (!evidence.id || !/^E_[A-Z0-9_]+$/.test(evidence.id)) {
172
+ errors.push(`Invalid id: ${evidence.id}`);
173
+ }
174
+ if (!["file", "url", "screenshot", "trace", "request", "console", "diff", "hash"].includes(evidence.kind)) {
175
+ errors.push(`Invalid kind: ${evidence.kind}`);
176
+ }
177
+ if (!evidence.reason || evidence.reason.length < 3) {
178
+ errors.push(`Reason too short: ${evidence.reason}`);
179
+ }
180
+ if (evidence.lines && !/^[0-9]+-[0-9]+$/.test(evidence.lines)) {
181
+ errors.push(`Invalid lines format: ${evidence.lines}`);
182
+ }
183
+ if (evidence.snippetHash && !/^(sha1|sha256):[a-f0-9]{40,64}$/.test(evidence.snippetHash)) {
184
+ errors.push(`Invalid snippetHash: ${evidence.snippetHash}`);
185
+ }
186
+
187
+ return {
188
+ valid: errors.length === 0,
189
+ errors,
190
+ };
191
+ }
192
+
193
+ /**
194
+ * Create a v2-compliant ship report
195
+ */
196
+ function createShipReportV2({
197
+ projectPath,
198
+ findings,
199
+ truthpackPath,
200
+ truthpackHash,
201
+ realityPath = null,
202
+ realityHash = null,
203
+ contractsPaths = [],
204
+ policy = {},
205
+ proofGraph = null,
206
+ }) {
207
+ const blocks = findings.filter(f => f.severity === "BLOCK").length;
208
+ const warns = findings.filter(f => f.severity === "WARN").length;
209
+ const infos = findings.filter(f => f.severity === "INFO").length;
210
+
211
+ const verdict = blocks > 0 ? "BLOCK" : warns > 0 ? "WARN" : "SHIP";
212
+ const exitCode = verdict === "SHIP" ? 0 : verdict === "WARN" ? 1 : 2;
213
+
214
+ // Top findings (blockers first, then warns)
215
+ const top = findings
216
+ .filter(f => f.severity === "BLOCK" || f.severity === "WARN")
217
+ .sort((a, b) => (a.severity === "BLOCK" ? -1 : 1))
218
+ .slice(0, 5)
219
+ .map(f => f.id);
220
+
221
+ const report = {
222
+ schemaVersion: SCHEMA_VERSION,
223
+ generatedAt: new Date().toISOString(),
224
+ vibecheckVersion: getVersion(),
225
+ projectFingerprint: generateProjectFingerprint(projectPath),
226
+
227
+ verdict,
228
+ exitCode,
229
+
230
+ policy: {
231
+ failOnWarn: policy.failOnWarn || false,
232
+ realityFreshnessMinutes: policy.realityFreshnessMinutes || 60,
233
+ },
234
+
235
+ inputs: {
236
+ truthpackPath,
237
+ truthpackHash,
238
+ },
239
+
240
+ summary: {
241
+ counts: { BLOCK: blocks, WARN: warns, INFO: infos },
242
+ top,
243
+ },
244
+
245
+ findings,
246
+ };
247
+
248
+ if (realityPath) {
249
+ report.inputs.realityPath = realityPath;
250
+ report.inputs.realityHash = realityHash;
251
+ }
252
+ if (contractsPaths.length > 0) {
253
+ report.inputs.contractsPaths = contractsPaths;
254
+ }
255
+ if (proofGraph) {
256
+ report.proofGraph = proofGraph;
257
+ }
258
+
259
+ return report;
260
+ }
261
+
262
+ /**
263
+ * Generate project fingerprint
264
+ */
265
+ function generateProjectFingerprint(projectPath) {
266
+ const keyFiles = ["package.json", "pnpm-lock.yaml", "package-lock.json", "yarn.lock"];
267
+ const hashes = [];
268
+
269
+ for (const file of keyFiles) {
270
+ const filePath = path.join(projectPath, file);
271
+ if (fs.existsSync(filePath)) {
272
+ const content = fs.readFileSync(filePath, "utf8");
273
+ const hash = crypto.createHash("sha256").update(content).digest("hex").slice(0, 8);
274
+ hashes.push(`${file}:${hash}`);
275
+ }
276
+ }
277
+
278
+ // Git commit if available
279
+ try {
280
+ const { execSync } = require("child_process");
281
+ const commit = execSync("git rev-parse HEAD", { cwd: projectPath, encoding: "utf8" }).trim();
282
+ hashes.push(`git:${commit.slice(0, 8)}`);
283
+ } catch {}
284
+
285
+ return generateFingerprint(hashes.join("|"));
286
+ }
287
+
288
+ /**
289
+ * Get vibecheck version
290
+ */
291
+ function getVersion() {
292
+ try {
293
+ const pkgPath = path.join(__dirname, "..", "..", "..", "package.json");
294
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
295
+ return pkg.version || "0.0.0";
296
+ } catch {
297
+ return "0.0.0";
298
+ }
299
+ }
300
+
301
+ /**
302
+ * Validate ship report against v2 schema
303
+ */
304
+ function validateShipReportV2(report) {
305
+ const errors = [];
306
+
307
+ if (report.schemaVersion !== SCHEMA_VERSION) {
308
+ errors.push(`Invalid schemaVersion: ${report.schemaVersion}`);
309
+ }
310
+ if (!["SHIP", "WARN", "BLOCK"].includes(report.verdict)) {
311
+ errors.push(`Invalid verdict: ${report.verdict}`);
312
+ }
313
+ if (![0, 1, 2].includes(report.exitCode)) {
314
+ errors.push(`Invalid exitCode: ${report.exitCode}`);
315
+ }
316
+ if (!report.inputs?.truthpackPath) {
317
+ errors.push("Missing inputs.truthpackPath");
318
+ }
319
+ if (!report.summary?.counts) {
320
+ errors.push("Missing summary.counts");
321
+ }
322
+
323
+ // Validate each finding
324
+ for (const finding of report.findings || []) {
325
+ const result = validateFindingV2(finding);
326
+ if (!result.valid) {
327
+ errors.push(`Finding ${finding.id}: ${result.errors.join(", ")}`);
328
+ }
329
+ }
330
+
331
+ return {
332
+ valid: errors.length === 0,
333
+ errors,
334
+ };
335
+ }
336
+
337
+ module.exports = {
338
+ SCHEMA_VERSION,
339
+ loadSchema,
340
+ generateFingerprint,
341
+ shortFingerprint,
342
+ createEvidence,
343
+ createFindingV2,
344
+ validateFindingV2,
345
+ validateEvidenceV2,
346
+ createShipReportV2,
347
+ generateProjectFingerprint,
348
+ validateShipReportV2,
349
+ getVersion,
350
+ };
@@ -0,0 +1,160 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://vibecheck.dev/schemas/contracts.schema.json",
4
+ "title": "Vibecheck Contracts",
5
+ "description": "Stable contracts extracted from truthpack for drift detection",
6
+ "type": "object",
7
+ "required": ["specVersion", "generatedAt", "projectRoot", "fingerprint", "routes", "env", "auth"],
8
+ "properties": {
9
+ "specVersion": {
10
+ "type": "string",
11
+ "const": "2.0"
12
+ },
13
+ "generatedAt": {
14
+ "type": "string",
15
+ "format": "date-time"
16
+ },
17
+ "projectRoot": {
18
+ "type": "string"
19
+ },
20
+ "fingerprint": {
21
+ "type": "string",
22
+ "pattern": "^sha256:[a-f0-9]{64}$",
23
+ "description": "Hash of contracts for quick comparison"
24
+ },
25
+ "routes": {
26
+ "$ref": "#/$defs/routesContract"
27
+ },
28
+ "env": {
29
+ "$ref": "#/$defs/envContract"
30
+ },
31
+ "auth": {
32
+ "$ref": "#/$defs/authContract"
33
+ },
34
+ "external": {
35
+ "$ref": "#/$defs/externalContract"
36
+ },
37
+ "artifacts": {
38
+ "type": "array",
39
+ "items": { "$ref": "#/$defs/artifact" }
40
+ }
41
+ },
42
+ "$defs": {
43
+ "routesContract": {
44
+ "type": "object",
45
+ "required": ["count", "fingerprint", "endpoints"],
46
+ "properties": {
47
+ "count": { "type": "integer", "minimum": 0 },
48
+ "fingerprint": {
49
+ "type": "string",
50
+ "pattern": "^sha256:[a-f0-9]{64}$"
51
+ },
52
+ "endpoints": {
53
+ "type": "array",
54
+ "items": {
55
+ "type": "object",
56
+ "required": ["method", "path", "framework"],
57
+ "properties": {
58
+ "method": {
59
+ "type": "string",
60
+ "enum": ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "ALL"]
61
+ },
62
+ "path": { "type": "string" },
63
+ "canonicalPath": { "type": "string" },
64
+ "framework": { "type": "string" },
65
+ "authRequired": { "type": "boolean" },
66
+ "source": {
67
+ "type": "string",
68
+ "enum": ["static", "runtime"]
69
+ }
70
+ }
71
+ }
72
+ },
73
+ "byFramework": {
74
+ "type": "object",
75
+ "additionalProperties": { "type": "integer" }
76
+ }
77
+ }
78
+ },
79
+ "envContract": {
80
+ "type": "object",
81
+ "required": ["count", "fingerprint", "vars"],
82
+ "properties": {
83
+ "count": { "type": "integer", "minimum": 0 },
84
+ "fingerprint": {
85
+ "type": "string",
86
+ "pattern": "^sha256:[a-f0-9]{64}$"
87
+ },
88
+ "vars": {
89
+ "type": "array",
90
+ "items": {
91
+ "type": "object",
92
+ "required": ["name"],
93
+ "properties": {
94
+ "name": { "type": "string" },
95
+ "required": { "type": "boolean" },
96
+ "isPublic": { "type": "boolean" },
97
+ "isSecret": { "type": "boolean" }
98
+ }
99
+ }
100
+ },
101
+ "baseUrlVar": { "type": ["string", "null"] }
102
+ }
103
+ },
104
+ "authContract": {
105
+ "type": "object",
106
+ "required": ["fingerprint", "protectedPatterns"],
107
+ "properties": {
108
+ "fingerprint": {
109
+ "type": "string",
110
+ "pattern": "^sha256:[a-f0-9]{64}$"
111
+ },
112
+ "provider": {
113
+ "type": ["string", "null"],
114
+ "enum": [null, "next-auth", "clerk", "supabase", "custom"]
115
+ },
116
+ "protectedPatterns": {
117
+ "type": "array",
118
+ "items": { "type": "string" }
119
+ },
120
+ "publicPatterns": {
121
+ "type": "array",
122
+ "items": { "type": "string" }
123
+ },
124
+ "middlewareHash": {
125
+ "type": ["string", "null"],
126
+ "pattern": "^sha256:[a-f0-9]{64}$"
127
+ }
128
+ }
129
+ },
130
+ "externalContract": {
131
+ "type": "object",
132
+ "properties": {
133
+ "fingerprint": {
134
+ "type": "string",
135
+ "pattern": "^sha256:[a-f0-9]{64}$"
136
+ },
137
+ "apis": {
138
+ "type": "array",
139
+ "items": {
140
+ "type": "object",
141
+ "required": ["host"],
142
+ "properties": {
143
+ "host": { "type": "string" },
144
+ "paths": { "type": "array", "items": { "type": "string" } },
145
+ "envVar": { "type": ["string", "null"] }
146
+ }
147
+ }
148
+ }
149
+ }
150
+ },
151
+ "artifact": {
152
+ "type": "object",
153
+ "required": ["path", "sha256"],
154
+ "properties": {
155
+ "path": { "type": "string" },
156
+ "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
157
+ }
158
+ }
159
+ }
160
+ }
@@ -0,0 +1,100 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://vibecheck.dev/schemas/finding.schema.json",
4
+ "title": "Vibecheck Finding",
5
+ "description": "A single finding from static or runtime analysis",
6
+ "type": "object",
7
+ "required": ["id", "detectorId", "fingerprint", "severity", "category", "scope", "title", "confidence"],
8
+ "properties": {
9
+ "id": {
10
+ "type": "string",
11
+ "pattern": "^F_[A-Z0-9_]+_[A-F0-9]+$",
12
+ "description": "Unique finding ID: F_{DETECTOR}_{HASH}"
13
+ },
14
+ "detectorId": {
15
+ "type": "string",
16
+ "pattern": "^D_[A-Z0-9_]+$",
17
+ "description": "Detector that produced this finding"
18
+ },
19
+ "fingerprint": {
20
+ "type": "string",
21
+ "pattern": "^sha256:[a-f0-9]{64}$",
22
+ "description": "Stable hash for deduplication across runs"
23
+ },
24
+ "severity": {
25
+ "type": "string",
26
+ "enum": ["BLOCK", "WARN", "INFO"],
27
+ "description": "BLOCK stops ship, WARN allows with warning, INFO is informational"
28
+ },
29
+ "category": {
30
+ "type": "string",
31
+ "enum": ["Truth", "Routes", "Auth", "Env", "Billing", "DeadUI", "FakeSuccess", "UIMismatch", "ContractDrift", "Security", "Coverage"],
32
+ "description": "Finding category for grouping. Truth = truthpack/extraction issues, Routes = route matching, Auth = authentication, Env = environment vars, Billing = Stripe/payments, DeadUI = clicks with no effect, FakeSuccess = toast/UI mismatch with request, UIMismatch = UI/backend state mismatch, ContractDrift = contract changes, Security = security issues, Coverage = coverage threshold violations"
33
+ },
34
+ "scope": {
35
+ "type": "string",
36
+ "enum": ["client", "server", "runtime", "contracts", "shared"],
37
+ "description": "Where the finding applies"
38
+ },
39
+ "title": {
40
+ "type": "string",
41
+ "maxLength": 200,
42
+ "description": "Human-readable title"
43
+ },
44
+ "why": {
45
+ "type": "string",
46
+ "description": "Explanation of why this is a problem"
47
+ },
48
+ "confidence": {
49
+ "type": "string",
50
+ "enum": ["high", "medium", "low"],
51
+ "description": "Confidence level of detection"
52
+ },
53
+ "evidence": {
54
+ "type": "array",
55
+ "items": { "$ref": "#/$defs/evidence" },
56
+ "description": "Evidence supporting this finding"
57
+ },
58
+ "repro": {
59
+ "type": ["string", "null"],
60
+ "description": "How to reproduce this issue"
61
+ },
62
+ "related": {
63
+ "type": "array",
64
+ "items": { "type": "string" },
65
+ "description": "IDs of related findings"
66
+ },
67
+ "proofNode": {
68
+ "type": ["string", "null"],
69
+ "description": "ID of proof graph node if applicable"
70
+ },
71
+ "missionType": {
72
+ "type": ["string", "null"],
73
+ "description": "Mission type for fix generation"
74
+ }
75
+ },
76
+ "$defs": {
77
+ "evidence": {
78
+ "type": "object",
79
+ "required": ["id", "kind"],
80
+ "properties": {
81
+ "id": {
82
+ "type": "string",
83
+ "pattern": "^E_[A-F0-9]+$"
84
+ },
85
+ "kind": {
86
+ "type": "string",
87
+ "enum": ["file", "request", "runtime", "screenshot", "diff"]
88
+ },
89
+ "file": { "type": "string" },
90
+ "lines": { "type": "string", "pattern": "^\\d+-\\d+$" },
91
+ "snippetHash": { "type": "string", "pattern": "^sha256:[a-f0-9]+$" },
92
+ "reason": { "type": "string" },
93
+ "url": { "type": "string" },
94
+ "httpStatus": { "type": "integer" },
95
+ "screenshot": { "type": "string" },
96
+ "data": { "type": "object" }
97
+ }
98
+ }
99
+ }
100
+ }