@vibecheckai/cli 3.5.0 → 3.5.1

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 (326) hide show
  1. package/bin/registry.js +174 -449
  2. package/bin/runners/cli-utils.js +33 -2
  3. package/bin/runners/context/generators/cursor.js +2 -49
  4. package/bin/runners/context/generators/mcp.js +13 -15
  5. package/bin/runners/context/proof-context.js +1 -248
  6. package/bin/runners/lib/analysis-core.js +180 -198
  7. package/bin/runners/lib/analyzers.js +241 -2212
  8. package/bin/runners/lib/cli-output.js +210 -242
  9. package/bin/runners/lib/detectors-v2.js +785 -547
  10. package/bin/runners/lib/entitlements-v2.js +431 -161
  11. package/bin/runners/lib/error-handler.js +9 -16
  12. package/bin/runners/lib/global-flags.js +0 -37
  13. package/bin/runners/lib/html-proof-report.js +700 -350
  14. package/bin/runners/lib/missions/plan.js +6 -46
  15. package/bin/runners/lib/missions/templates.js +0 -232
  16. package/bin/runners/lib/route-truth.js +322 -1167
  17. package/bin/runners/lib/scan-output.js +467 -493
  18. package/bin/runners/lib/ship-output.js +27 -280
  19. package/bin/runners/lib/terminal-ui.js +700 -310
  20. package/bin/runners/lib/truth.js +321 -1004
  21. package/bin/runners/lib/unified-output.js +158 -162
  22. package/bin/runners/lib/upsell.js +204 -104
  23. package/bin/runners/runAIAgent.js +10 -5
  24. package/bin/runners/runAllowlist.js +324 -0
  25. package/bin/runners/runAuth.js +94 -344
  26. package/bin/runners/runCheckpoint.js +45 -43
  27. package/bin/runners/runContext.js +24 -139
  28. package/bin/runners/runDoctor.js +101 -136
  29. package/bin/runners/runEvidencePack.js +219 -0
  30. package/bin/runners/runFix.js +71 -82
  31. package/bin/runners/runGuard.js +119 -606
  32. package/bin/runners/runInit.js +60 -22
  33. package/bin/runners/runInstall.js +281 -0
  34. package/bin/runners/runLabs.js +341 -0
  35. package/bin/runners/runMcp.js +62 -139
  36. package/bin/runners/runPolish.js +83 -282
  37. package/bin/runners/runPromptFirewall.js +12 -5
  38. package/bin/runners/runProve.js +58 -33
  39. package/bin/runners/runReality.js +58 -81
  40. package/bin/runners/runReport.js +7 -34
  41. package/bin/runners/runRuntime.js +8 -5
  42. package/bin/runners/runScan.js +844 -219
  43. package/bin/runners/runShip.js +59 -721
  44. package/bin/runners/runValidate.js +11 -24
  45. package/bin/runners/runWatch.js +76 -131
  46. package/bin/vibecheck.js +69 -295
  47. package/mcp-server/ARCHITECTURE.md +339 -0
  48. package/mcp-server/__tests__/cache.test.ts +313 -0
  49. package/mcp-server/__tests__/executor.test.ts +239 -0
  50. package/mcp-server/__tests__/fixtures/exclusion-test/.cache/webpack/cache.pack +1 -0
  51. package/mcp-server/__tests__/fixtures/exclusion-test/.next/server/chunk.js +3 -0
  52. package/mcp-server/__tests__/fixtures/exclusion-test/.turbo/cache.json +3 -0
  53. package/mcp-server/__tests__/fixtures/exclusion-test/.venv/lib/env.py +3 -0
  54. package/mcp-server/__tests__/fixtures/exclusion-test/dist/bundle.js +3 -0
  55. package/mcp-server/__tests__/fixtures/exclusion-test/package.json +5 -0
  56. package/mcp-server/__tests__/fixtures/exclusion-test/src/app.ts +5 -0
  57. package/mcp-server/__tests__/fixtures/exclusion-test/venv/lib/config.py +4 -0
  58. package/mcp-server/__tests__/ids.test.ts +345 -0
  59. package/mcp-server/__tests__/integration/tools.test.ts +410 -0
  60. package/mcp-server/__tests__/registry.test.ts +365 -0
  61. package/mcp-server/__tests__/sandbox.test.ts +323 -0
  62. package/mcp-server/__tests__/schemas.test.ts +372 -0
  63. package/mcp-server/benchmarks/run-benchmarks.ts +304 -0
  64. package/mcp-server/examples/doctor.request.json +14 -0
  65. package/mcp-server/examples/doctor.response.json +53 -0
  66. package/mcp-server/examples/error.response.json +15 -0
  67. package/mcp-server/examples/scan.request.json +14 -0
  68. package/mcp-server/examples/scan.response.json +108 -0
  69. package/mcp-server/handlers/tool-handler.ts +671 -0
  70. package/mcp-server/index-v1.js +698 -0
  71. package/mcp-server/index-v3.ts +293 -0
  72. package/mcp-server/index.js +1080 -1757
  73. package/mcp-server/index.old.js +4137 -0
  74. package/mcp-server/lib/cache.ts +341 -0
  75. package/mcp-server/lib/errors.ts +346 -0
  76. package/mcp-server/lib/executor.ts +792 -0
  77. package/mcp-server/lib/ids.ts +238 -0
  78. package/mcp-server/lib/logger.ts +368 -0
  79. package/mcp-server/lib/metrics.ts +365 -0
  80. package/mcp-server/lib/sandbox.ts +337 -0
  81. package/mcp-server/lib/validator.ts +229 -0
  82. package/mcp-server/package-lock.json +165 -0
  83. package/mcp-server/package.json +32 -7
  84. package/mcp-server/premium-tools.js +2 -2
  85. package/mcp-server/registry/tools.json +476 -0
  86. package/mcp-server/schemas/error-envelope.schema.json +125 -0
  87. package/mcp-server/schemas/finding.schema.json +167 -0
  88. package/mcp-server/schemas/report-artifact.schema.json +88 -0
  89. package/mcp-server/schemas/run-request.schema.json +75 -0
  90. package/mcp-server/schemas/verdict.schema.json +168 -0
  91. package/mcp-server/tier-auth.d.ts +71 -0
  92. package/mcp-server/tier-auth.js +371 -183
  93. package/mcp-server/truth-context.js +90 -131
  94. package/mcp-server/truth-firewall-tools.js +1000 -1611
  95. package/mcp-server/tsconfig.json +34 -0
  96. package/mcp-server/vibecheck-tools.js +2 -2
  97. package/mcp-server/vitest.config.ts +16 -0
  98. package/package.json +3 -4
  99. package/bin/runners/lib/agent-firewall/ai/false-positive-analyzer.js +0 -474
  100. package/bin/runners/lib/agent-firewall/change-packet/builder.js +0 -488
  101. package/bin/runners/lib/agent-firewall/change-packet/schema.json +0 -228
  102. package/bin/runners/lib/agent-firewall/change-packet/store.js +0 -200
  103. package/bin/runners/lib/agent-firewall/claims/claim-types.js +0 -21
  104. package/bin/runners/lib/agent-firewall/claims/extractor.js +0 -303
  105. package/bin/runners/lib/agent-firewall/claims/patterns.js +0 -24
  106. package/bin/runners/lib/agent-firewall/critic/index.js +0 -151
  107. package/bin/runners/lib/agent-firewall/critic/judge.js +0 -432
  108. package/bin/runners/lib/agent-firewall/critic/prompts.js +0 -305
  109. package/bin/runners/lib/agent-firewall/evidence/auth-evidence.js +0 -88
  110. package/bin/runners/lib/agent-firewall/evidence/contract-evidence.js +0 -75
  111. package/bin/runners/lib/agent-firewall/evidence/env-evidence.js +0 -127
  112. package/bin/runners/lib/agent-firewall/evidence/resolver.js +0 -102
  113. package/bin/runners/lib/agent-firewall/evidence/route-evidence.js +0 -213
  114. package/bin/runners/lib/agent-firewall/evidence/side-effect-evidence.js +0 -145
  115. package/bin/runners/lib/agent-firewall/fs-hook/daemon.js +0 -19
  116. package/bin/runners/lib/agent-firewall/fs-hook/installer.js +0 -87
  117. package/bin/runners/lib/agent-firewall/fs-hook/watcher.js +0 -184
  118. package/bin/runners/lib/agent-firewall/git-hook/pre-commit.js +0 -163
  119. package/bin/runners/lib/agent-firewall/ide-extension/cursor.js +0 -107
  120. package/bin/runners/lib/agent-firewall/ide-extension/vscode.js +0 -68
  121. package/bin/runners/lib/agent-firewall/ide-extension/windsurf.js +0 -66
  122. package/bin/runners/lib/agent-firewall/interceptor/base.js +0 -304
  123. package/bin/runners/lib/agent-firewall/interceptor/cursor.js +0 -35
  124. package/bin/runners/lib/agent-firewall/interceptor/vscode.js +0 -35
  125. package/bin/runners/lib/agent-firewall/interceptor/windsurf.js +0 -34
  126. package/bin/runners/lib/agent-firewall/lawbook/distributor.js +0 -465
  127. package/bin/runners/lib/agent-firewall/lawbook/evaluator.js +0 -604
  128. package/bin/runners/lib/agent-firewall/lawbook/index.js +0 -304
  129. package/bin/runners/lib/agent-firewall/lawbook/registry.js +0 -514
  130. package/bin/runners/lib/agent-firewall/lawbook/schema.js +0 -420
  131. package/bin/runners/lib/agent-firewall/learning/learning-engine.js +0 -849
  132. package/bin/runners/lib/agent-firewall/logger.js +0 -141
  133. package/bin/runners/lib/agent-firewall/policy/default-policy.json +0 -90
  134. package/bin/runners/lib/agent-firewall/policy/engine.js +0 -103
  135. package/bin/runners/lib/agent-firewall/policy/loader.js +0 -451
  136. package/bin/runners/lib/agent-firewall/policy/rules/auth-drift.js +0 -50
  137. package/bin/runners/lib/agent-firewall/policy/rules/contract-drift.js +0 -50
  138. package/bin/runners/lib/agent-firewall/policy/rules/fake-success.js +0 -86
  139. package/bin/runners/lib/agent-firewall/policy/rules/ghost-env.js +0 -162
  140. package/bin/runners/lib/agent-firewall/policy/rules/ghost-route.js +0 -189
  141. package/bin/runners/lib/agent-firewall/policy/rules/scope.js +0 -93
  142. package/bin/runners/lib/agent-firewall/policy/rules/unsafe-side-effect.js +0 -57
  143. package/bin/runners/lib/agent-firewall/policy/schema.json +0 -183
  144. package/bin/runners/lib/agent-firewall/policy/verdict.js +0 -54
  145. package/bin/runners/lib/agent-firewall/proposal/extractor.js +0 -394
  146. package/bin/runners/lib/agent-firewall/proposal/index.js +0 -212
  147. package/bin/runners/lib/agent-firewall/proposal/schema.js +0 -251
  148. package/bin/runners/lib/agent-firewall/proposal/validator.js +0 -386
  149. package/bin/runners/lib/agent-firewall/reality/index.js +0 -332
  150. package/bin/runners/lib/agent-firewall/reality/state.js +0 -625
  151. package/bin/runners/lib/agent-firewall/reality/watcher.js +0 -322
  152. package/bin/runners/lib/agent-firewall/risk/index.js +0 -173
  153. package/bin/runners/lib/agent-firewall/risk/scorer.js +0 -328
  154. package/bin/runners/lib/agent-firewall/risk/thresholds.js +0 -321
  155. package/bin/runners/lib/agent-firewall/risk/vectors.js +0 -421
  156. package/bin/runners/lib/agent-firewall/simulator/diff-simulator.js +0 -472
  157. package/bin/runners/lib/agent-firewall/simulator/import-resolver.js +0 -346
  158. package/bin/runners/lib/agent-firewall/simulator/index.js +0 -181
  159. package/bin/runners/lib/agent-firewall/simulator/route-validator.js +0 -380
  160. package/bin/runners/lib/agent-firewall/time-machine/incident-correlator.js +0 -661
  161. package/bin/runners/lib/agent-firewall/time-machine/index.js +0 -267
  162. package/bin/runners/lib/agent-firewall/time-machine/replay-engine.js +0 -436
  163. package/bin/runners/lib/agent-firewall/time-machine/state-reconstructor.js +0 -490
  164. package/bin/runners/lib/agent-firewall/time-machine/timeline-builder.js +0 -530
  165. package/bin/runners/lib/agent-firewall/truthpack/index.js +0 -67
  166. package/bin/runners/lib/agent-firewall/truthpack/loader.js +0 -137
  167. package/bin/runners/lib/agent-firewall/unblock/planner.js +0 -337
  168. package/bin/runners/lib/agent-firewall/utils/ignore-checker.js +0 -118
  169. package/bin/runners/lib/api-client.js +0 -269
  170. package/bin/runners/lib/audit-logger.js +0 -532
  171. package/bin/runners/lib/authority/authorities/architecture.js +0 -364
  172. package/bin/runners/lib/authority/authorities/compliance.js +0 -341
  173. package/bin/runners/lib/authority/authorities/human.js +0 -343
  174. package/bin/runners/lib/authority/authorities/quality.js +0 -420
  175. package/bin/runners/lib/authority/authorities/security.js +0 -228
  176. package/bin/runners/lib/authority/index.js +0 -293
  177. package/bin/runners/lib/authority-badge.js +0 -425
  178. package/bin/runners/lib/bundle/bundle-intelligence.js +0 -846
  179. package/bin/runners/lib/cli-charts.js +0 -368
  180. package/bin/runners/lib/cli-config-display.js +0 -405
  181. package/bin/runners/lib/cli-demo.js +0 -275
  182. package/bin/runners/lib/cli-errors.js +0 -438
  183. package/bin/runners/lib/cli-help-formatter.js +0 -439
  184. package/bin/runners/lib/cli-interactive-menu.js +0 -509
  185. package/bin/runners/lib/cli-prompts.js +0 -441
  186. package/bin/runners/lib/cli-scan-cards.js +0 -362
  187. package/bin/runners/lib/compliance-reporter.js +0 -710
  188. package/bin/runners/lib/conductor/index.js +0 -671
  189. package/bin/runners/lib/easy/README.md +0 -123
  190. package/bin/runners/lib/easy/index.js +0 -140
  191. package/bin/runners/lib/easy/interactive-wizard.js +0 -788
  192. package/bin/runners/lib/easy/one-click-firewall.js +0 -564
  193. package/bin/runners/lib/easy/zero-config-reality.js +0 -714
  194. package/bin/runners/lib/engines/accessibility-engine.js +0 -390
  195. package/bin/runners/lib/engines/api-consistency-engine.js +0 -467
  196. package/bin/runners/lib/engines/ast-cache.js +0 -99
  197. package/bin/runners/lib/engines/async-patterns-engine.js +0 -444
  198. package/bin/runners/lib/engines/bundle-size-engine.js +0 -433
  199. package/bin/runners/lib/engines/code-quality-engine.js +0 -255
  200. package/bin/runners/lib/engines/confidence-scoring.js +0 -276
  201. package/bin/runners/lib/engines/console-logs-engine.js +0 -115
  202. package/bin/runners/lib/engines/context-detection.js +0 -264
  203. package/bin/runners/lib/engines/cross-file-analysis-engine.js +0 -533
  204. package/bin/runners/lib/engines/database-patterns-engine.js +0 -429
  205. package/bin/runners/lib/engines/dead-code-engine.js +0 -198
  206. package/bin/runners/lib/engines/deprecated-api-engine.js +0 -226
  207. package/bin/runners/lib/engines/duplicate-code-engine.js +0 -354
  208. package/bin/runners/lib/engines/empty-catch-engine.js +0 -260
  209. package/bin/runners/lib/engines/env-variables-engine.js +0 -458
  210. package/bin/runners/lib/engines/error-handling-engine.js +0 -437
  211. package/bin/runners/lib/engines/false-positive-prevention.js +0 -630
  212. package/bin/runners/lib/engines/file-filter.js +0 -131
  213. package/bin/runners/lib/engines/framework-adapters/index.js +0 -607
  214. package/bin/runners/lib/engines/framework-detection.js +0 -508
  215. package/bin/runners/lib/engines/hardcoded-secrets-engine.js +0 -251
  216. package/bin/runners/lib/engines/import-order-engine.js +0 -429
  217. package/bin/runners/lib/engines/mock-data-engine.js +0 -315
  218. package/bin/runners/lib/engines/naming-conventions-engine.js +0 -544
  219. package/bin/runners/lib/engines/noise-reduction-engine.js +0 -452
  220. package/bin/runners/lib/engines/orchestrator.js +0 -334
  221. package/bin/runners/lib/engines/parallel-processor.js +0 -71
  222. package/bin/runners/lib/engines/performance-issues-engine.js +0 -405
  223. package/bin/runners/lib/engines/react-patterns-engine.js +0 -457
  224. package/bin/runners/lib/engines/security-vulnerabilities-engine.js +0 -571
  225. package/bin/runners/lib/engines/todo-fixme-engine.js +0 -115
  226. package/bin/runners/lib/engines/type-aware-engine.js +0 -376
  227. package/bin/runners/lib/engines/unsafe-regex-engine.js +0 -225
  228. package/bin/runners/lib/engines/vibecheck-engines/README.md +0 -53
  229. package/bin/runners/lib/engines/vibecheck-engines/index.js +0 -124
  230. package/bin/runners/lib/engines/vibecheck-engines/lib/ai-hallucination-engine.js +0 -806
  231. package/bin/runners/lib/engines/vibecheck-engines/lib/hardcoded-secrets-engine.js +0 -439
  232. package/bin/runners/lib/engines/vibecheck-engines/lib/smart-fix-engine.js +0 -577
  233. package/bin/runners/lib/engines/vibecheck-engines/lib/vibe-score-engine.js +0 -543
  234. package/bin/runners/lib/engines/vibecheck-engines/package.json +0 -13
  235. package/bin/runners/lib/engines/vibecheck-engines.js +0 -514
  236. package/bin/runners/lib/enhanced-features/index.js +0 -305
  237. package/bin/runners/lib/enhanced-output.js +0 -631
  238. package/bin/runners/lib/enterprise.js +0 -300
  239. package/bin/runners/lib/exit-codes.js +0 -275
  240. package/bin/runners/lib/fingerprint.js +0 -377
  241. package/bin/runners/lib/firewall/command-validator.js +0 -351
  242. package/bin/runners/lib/firewall/config.js +0 -341
  243. package/bin/runners/lib/firewall/content-validator.js +0 -519
  244. package/bin/runners/lib/firewall/index.js +0 -101
  245. package/bin/runners/lib/firewall/path-validator.js +0 -256
  246. package/bin/runners/lib/help-formatter.js +0 -413
  247. package/bin/runners/lib/intelligence/cross-repo-intelligence.js +0 -817
  248. package/bin/runners/lib/logger.js +0 -38
  249. package/bin/runners/lib/mcp-utils.js +0 -425
  250. package/bin/runners/lib/output/index.js +0 -1022
  251. package/bin/runners/lib/policy-engine.js +0 -652
  252. package/bin/runners/lib/polish/autofix/accessibility-fixes.js +0 -333
  253. package/bin/runners/lib/polish/autofix/async-handlers.js +0 -273
  254. package/bin/runners/lib/polish/autofix/dead-code.js +0 -280
  255. package/bin/runners/lib/polish/autofix/imports-optimizer.js +0 -344
  256. package/bin/runners/lib/polish/autofix/index.js +0 -200
  257. package/bin/runners/lib/polish/autofix/remove-consoles.js +0 -209
  258. package/bin/runners/lib/polish/autofix/strengthen-types.js +0 -245
  259. package/bin/runners/lib/polish/backend-checks.js +0 -148
  260. package/bin/runners/lib/polish/documentation-checks.js +0 -111
  261. package/bin/runners/lib/polish/frontend-checks.js +0 -168
  262. package/bin/runners/lib/polish/index.js +0 -71
  263. package/bin/runners/lib/polish/infrastructure-checks.js +0 -131
  264. package/bin/runners/lib/polish/library-detection.js +0 -175
  265. package/bin/runners/lib/polish/performance-checks.js +0 -100
  266. package/bin/runners/lib/polish/security-checks.js +0 -148
  267. package/bin/runners/lib/polish/utils.js +0 -203
  268. package/bin/runners/lib/prompt-builder.js +0 -540
  269. package/bin/runners/lib/proof-certificate.js +0 -634
  270. package/bin/runners/lib/reality/accessibility-audit.js +0 -946
  271. package/bin/runners/lib/reality/api-contract-validator.js +0 -1012
  272. package/bin/runners/lib/reality/chaos-engineering.js +0 -1084
  273. package/bin/runners/lib/reality/performance-tracker.js +0 -1077
  274. package/bin/runners/lib/reality/scenario-generator.js +0 -1404
  275. package/bin/runners/lib/reality/visual-regression.js +0 -852
  276. package/bin/runners/lib/reality-profiler.js +0 -717
  277. package/bin/runners/lib/replay/flight-recorder-viewer.js +0 -1160
  278. package/bin/runners/lib/review/ai-code-review.js +0 -832
  279. package/bin/runners/lib/rules/custom-rule-engine.js +0 -985
  280. package/bin/runners/lib/sbom-generator.js +0 -641
  281. package/bin/runners/lib/scan-output-enhanced.js +0 -512
  282. package/bin/runners/lib/security/owasp-scanner.js +0 -939
  283. package/bin/runners/lib/ship-output-enterprise.js +0 -239
  284. package/bin/runners/lib/unified-cli-output.js +0 -777
  285. package/bin/runners/lib/validators/contract-validator.js +0 -283
  286. package/bin/runners/lib/validators/dead-export-detector.js +0 -279
  287. package/bin/runners/lib/validators/dep-audit.js +0 -245
  288. package/bin/runners/lib/validators/env-validator.js +0 -319
  289. package/bin/runners/lib/validators/index.js +0 -120
  290. package/bin/runners/lib/validators/license-checker.js +0 -252
  291. package/bin/runners/lib/validators/route-validator.js +0 -290
  292. package/bin/runners/runAgent.d.ts +0 -5
  293. package/bin/runners/runAgent.js +0 -164
  294. package/bin/runners/runApprove.js +0 -1233
  295. package/bin/runners/runAuthority.js +0 -528
  296. package/bin/runners/runClassify.js +0 -862
  297. package/bin/runners/runConductor.js +0 -772
  298. package/bin/runners/runContainer.js +0 -366
  299. package/bin/runners/runContext.d.ts +0 -4
  300. package/bin/runners/runEasy.js +0 -410
  301. package/bin/runners/runFirewall.d.ts +0 -5
  302. package/bin/runners/runFirewall.js +0 -137
  303. package/bin/runners/runFirewallHook.d.ts +0 -5
  304. package/bin/runners/runFirewallHook.js +0 -59
  305. package/bin/runners/runIaC.js +0 -372
  306. package/bin/runners/runPolish.d.ts +0 -4
  307. package/bin/runners/runProof.zip +0 -0
  308. package/bin/runners/runTruth.d.ts +0 -5
  309. package/bin/runners/runTruth.js +0 -104
  310. package/bin/runners/runVibe.js +0 -791
  311. package/mcp-server/HARDENING_SUMMARY.md +0 -299
  312. package/mcp-server/agent-firewall-interceptor.js +0 -500
  313. package/mcp-server/authority-tools.js +0 -569
  314. package/mcp-server/conductor/conflict-resolver.js +0 -588
  315. package/mcp-server/conductor/execution-planner.js +0 -544
  316. package/mcp-server/conductor/index.js +0 -377
  317. package/mcp-server/conductor/lock-manager.js +0 -615
  318. package/mcp-server/conductor/request-queue.js +0 -550
  319. package/mcp-server/conductor/session-manager.js +0 -500
  320. package/mcp-server/conductor/tools.js +0 -510
  321. package/mcp-server/lib/api-client.cjs +0 -13
  322. package/mcp-server/lib/logger.cjs +0 -30
  323. package/mcp-server/logger.js +0 -173
  324. package/mcp-server/tools-v3.js +0 -1039
  325. package/mcp-server/tools.js +0 -495
  326. package/mcp-server/vibecheck-mcp-server-3.2.0.tgz +0 -0
@@ -0,0 +1,219 @@
1
+ /**
2
+ * vibecheck evidence-pack - Bundle Proof Artifacts
3
+ *
4
+ * ═══════════════════════════════════════════════════════════════════════════════
5
+ * Creates shareable evidence packs from vibecheck proof runs.
6
+ * Bundles videos, traces, screenshots, and findings into a single artifact.
7
+ * ═══════════════════════════════════════════════════════════════════════════════
8
+ */
9
+
10
+ "use strict";
11
+
12
+ const fs = require("fs");
13
+ const path = require("path");
14
+ const { parseGlobalFlags, shouldShowBanner } = require("./lib/global-flags");
15
+
16
+ // Colors
17
+ const c = {
18
+ reset: '\x1b[0m',
19
+ bold: '\x1b[1m',
20
+ dim: '\x1b[2m',
21
+ green: '\x1b[32m',
22
+ yellow: '\x1b[33m',
23
+ cyan: '\x1b[36m',
24
+ red: '\x1b[31m',
25
+ };
26
+
27
+ const rgb = (r, g, b) => `\x1b[38;2;${r};${g};${b}m`;
28
+
29
+ const colors = {
30
+ accent: rgb(150, 100, 255),
31
+ success: rgb(0, 255, 150),
32
+ warning: rgb(255, 200, 0),
33
+ error: rgb(255, 80, 80),
34
+ };
35
+
36
+ const ICONS = {
37
+ pack: '📦',
38
+ check: '✓',
39
+ cross: '✗',
40
+ video: '🎥',
41
+ trace: '📊',
42
+ screenshot: '📸',
43
+ file: '📄',
44
+ };
45
+
46
+ function printHelp(opts = {}) {
47
+ if (shouldShowBanner(opts)) {
48
+ console.log(`
49
+ ${colors.accent} ██████╗ █████╗ ██████╗██╗ ██╗${c.reset}
50
+ ${colors.accent} ██╔══██╗██╔══██╗██╔════╝██║ ██╔╝${c.reset}
51
+ ${colors.accent} ██████╔╝███████║██║ █████╔╝ ${c.reset}
52
+ ${colors.accent} ██╔═══╝ ██╔══██║██║ ██╔═██╗ ${c.reset}
53
+ ${colors.accent} ██║ ██║ ██║╚██████╗██║ ██╗${c.reset}
54
+ ${colors.accent} ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝${c.reset}
55
+ `);
56
+ }
57
+
58
+ console.log(`
59
+ ${c.bold}Usage:${c.reset} vibecheck evidence-pack [options]
60
+
61
+ ${c.bold}Bundle Proof Artifacts${c.reset} — Create shareable evidence packs.
62
+
63
+ ${c.bold}What It Bundles:${c.reset}
64
+ ${ICONS.video} ${c.dim}Videos${c.reset} Browser session recordings
65
+ ${ICONS.trace} ${c.dim}Traces${c.reset} Playwright traces (view at trace.playwright.dev)
66
+ ${ICONS.screenshot} ${c.dim}Screenshots${c.reset} Finding screenshots
67
+ ${ICONS.file} ${c.dim}Reports${c.reset} JSON reports with evidence
68
+
69
+ ${c.bold}Options:${c.reset}
70
+ ${colors.accent}--output, -o <path>${c.reset} Output zip path ${c.dim}(default: .vibecheck/evidence-packs/)${c.reset}
71
+ ${colors.accent}--no-videos${c.reset} Exclude video recordings
72
+ ${colors.accent}--no-traces${c.reset} Exclude Playwright traces
73
+ ${colors.accent}--no-screenshots${c.reset} Exclude screenshots
74
+ ${colors.accent}--no-allowlist${c.reset} Don't filter by allowlist
75
+ ${colors.accent}--markdown${c.reset} Generate markdown report
76
+ ${colors.accent}--json${c.reset} Output JSON manifest only
77
+ ${colors.accent}--help, -h${c.reset} Show this help
78
+
79
+ ${c.bold}Examples:${c.reset}
80
+ ${c.dim}# Create evidence pack${c.reset}
81
+ vibecheck evidence-pack
82
+
83
+ ${c.dim}# Custom output path${c.reset}
84
+ vibecheck evidence-pack --output ./artifacts/proof.zip
85
+
86
+ ${c.dim}# Generate markdown report${c.reset}
87
+ vibecheck evidence-pack --markdown > evidence-report.md
88
+
89
+ ${c.dim}# Exclude large files${c.reset}
90
+ vibecheck evidence-pack --no-videos --no-traces
91
+ `);
92
+ }
93
+
94
+ async function runEvidencePack(argsOrOpts = {}) {
95
+ // Handle array args from CLI
96
+ let globalOpts = { noBanner: false, json: false, quiet: false, ci: false };
97
+ if (Array.isArray(argsOrOpts)) {
98
+ const { flags } = parseGlobalFlags(argsOrOpts);
99
+ globalOpts = { ...globalOpts, ...flags };
100
+
101
+ if (globalOpts.help) {
102
+ printHelp(globalOpts);
103
+ return 0;
104
+ }
105
+
106
+ const getArg = (flags) => {
107
+ for (const f of flags) {
108
+ const idx = argsOrOpts.indexOf(f);
109
+ if (idx !== -1 && idx < argsOrOpts.length - 1) return argsOrOpts[idx + 1];
110
+ }
111
+ return undefined;
112
+ };
113
+
114
+ argsOrOpts = {
115
+ repoRoot: process.cwd(),
116
+ output: getArg(["--output", "-o"]),
117
+ includeVideos: !argsOrOpts.includes("--no-videos"),
118
+ includeTraces: !argsOrOpts.includes("--no-traces"),
119
+ includeScreenshots: !argsOrOpts.includes("--no-screenshots"),
120
+ applyAllowlist: !argsOrOpts.includes("--no-allowlist"),
121
+ markdown: argsOrOpts.includes("--markdown"),
122
+ ...globalOpts,
123
+ };
124
+ }
125
+
126
+ const {
127
+ repoRoot = process.cwd(),
128
+ output = null,
129
+ includeVideos = true,
130
+ includeTraces = true,
131
+ includeScreenshots = true,
132
+ applyAllowlist = true,
133
+ markdown = false,
134
+ json = false,
135
+ quiet = false
136
+ } = argsOrOpts;
137
+
138
+ const root = repoRoot || process.cwd();
139
+
140
+ // Import evidence-pack module
141
+ let evidencePack;
142
+ try {
143
+ evidencePack = require("./lib/evidence-pack");
144
+ } catch (e) {
145
+ console.error(`${colors.error}${ICONS.cross}${c.reset} Failed to load evidence-pack module: ${e.message}`);
146
+ return 1;
147
+ }
148
+
149
+ if (!quiet && !json) {
150
+ console.log(`\n ${ICONS.pack} ${c.bold}Building Evidence Pack${c.reset}\n`);
151
+ }
152
+
153
+ try {
154
+ const pack = await evidencePack.buildEvidencePack(root, {
155
+ outputPath: output,
156
+ includeVideos,
157
+ includeTraces,
158
+ includeScreenshots,
159
+ applyAllowlist
160
+ });
161
+
162
+ if (markdown) {
163
+ const mdReport = evidencePack.generateMarkdownReport(pack);
164
+ console.log(mdReport);
165
+ return pack.summary.verdict === 'SHIP' ? 0 : pack.summary.verdict === 'WARN' ? 1 : 2;
166
+ }
167
+
168
+ if (json) {
169
+ console.log(JSON.stringify(pack.manifest, null, 2));
170
+ return pack.summary.verdict === 'SHIP' ? 0 : pack.summary.verdict === 'WARN' ? 1 : 2;
171
+ }
172
+
173
+ // Print summary
174
+ const { summary, manifest } = pack;
175
+ const verdictColor = summary.verdict === 'SHIP' ? colors.success :
176
+ summary.verdict === 'WARN' ? colors.warning : colors.error;
177
+
178
+ console.log(` ${c.dim}Pack ID:${c.reset} ${pack.id}`);
179
+ console.log(` ${c.dim}Verdict:${c.reset} ${verdictColor}${c.bold}${summary.verdict}${c.reset}`);
180
+ console.log(` ${c.dim}Findings:${c.reset} ${summary.filteredFindings} (${summary.allowlistedCount} allowlisted)`);
181
+ console.log();
182
+
183
+ // Artifact summary
184
+ const artifacts = manifest.artifacts;
185
+ if (artifacts.screenshots.length > 0) {
186
+ console.log(` ${ICONS.screenshot} Screenshots: ${artifacts.screenshots.length}`);
187
+ }
188
+ if (artifacts.videos.length > 0) {
189
+ console.log(` ${ICONS.video} Videos: ${artifacts.videos.length}`);
190
+ }
191
+ if (artifacts.traces.length > 0) {
192
+ console.log(` ${ICONS.trace} Traces: ${artifacts.traces.length}`);
193
+ }
194
+
195
+ console.log();
196
+ console.log(` ${colors.success}${ICONS.check}${c.reset} Manifest: ${path.relative(root, pack.manifestPath)}`);
197
+ if (pack.zipPath) {
198
+ console.log(` ${colors.success}${ICONS.check}${c.reset} Zip: ${path.relative(root, pack.zipPath)}`);
199
+ }
200
+ console.log();
201
+
202
+ // Tips
203
+ if (artifacts.traces.length > 0) {
204
+ console.log(` ${c.dim}View traces at: ${c.cyan}https://trace.playwright.dev${c.reset}`);
205
+ }
206
+
207
+ return summary.verdict === 'SHIP' ? 0 : summary.verdict === 'WARN' ? 1 : 2;
208
+
209
+ } catch (error) {
210
+ if (json) {
211
+ console.log(JSON.stringify({ error: error.message }, null, 2));
212
+ } else {
213
+ console.error(`\n ${colors.error}${ICONS.cross}${c.reset} ${error.message}\n`);
214
+ }
215
+ return 1;
216
+ }
217
+ }
218
+
219
+ module.exports = { runEvidencePack };
@@ -26,29 +26,81 @@ const { shipCore } = require('./runShip');
26
26
  const { planMissions } = require('./lib/missions/plan');
27
27
  const { templateForMissionType } = require('./lib/missions/templates');
28
28
  const { expandEvidence } = require('./lib/missions/evidence');
29
- const { PromptBuilder, buildRealityFirewall } = require('./lib/prompt-builder');
29
+ const { buildRealityFirewall } = require('./lib/firewall-prompt');
30
30
  const { generatePatchJson } = require('./lib/llm');
31
31
  const { applyUnifiedDiff } = require('./lib/patch');
32
32
  const { backupFiles, restoreBackup } = require('./lib/backup');
33
33
  const { validatePatchResponse, parseDiffTouchedFiles } = require('./lib/validate-patch');
34
34
  const { buildSharePack } = require('./lib/share-pack');
35
35
  const { parseGlobalFlags, shouldShowBanner } = require('./lib/global-flags');
36
- const { EXIT, verdictToExitCode } = require('./lib/exit-codes');
37
36
 
38
37
  // Entitlements enforcement
39
38
  const entitlements = require('./lib/entitlements-v2');
40
39
  const upsell = require('./lib/upsell');
41
40
 
42
41
  // ═══════════════════════════════════════════════════════════════════════════════
43
- // TERMINAL UI - Import from shared module
42
+ // ADVANCED TERMINAL - ANSI CODES & UTILITIES
44
43
  // ═══════════════════════════════════════════════════════════════════════════════
45
44
 
46
- const { c, rgb, bgRgb, icons, Spinner } = require('./lib/terminal-ui');
45
+ const c = {
46
+ reset: '\x1b[0m',
47
+ bold: '\x1b[1m',
48
+ dim: '\x1b[2m',
49
+ italic: '\x1b[3m',
50
+ underline: '\x1b[4m',
51
+ blink: '\x1b[5m',
52
+ inverse: '\x1b[7m',
53
+ hidden: '\x1b[8m',
54
+ strike: '\x1b[9m',
55
+ // Colors
56
+ black: '\x1b[30m',
57
+ red: '\x1b[31m',
58
+ green: '\x1b[32m',
59
+ yellow: '\x1b[33m',
60
+ blue: '\x1b[34m',
61
+ magenta: '\x1b[35m',
62
+ cyan: '\x1b[36m',
63
+ white: '\x1b[37m',
64
+ // Bright colors
65
+ gray: '\x1b[90m',
66
+ brightRed: '\x1b[91m',
67
+ brightGreen: '\x1b[92m',
68
+ brightYellow: '\x1b[93m',
69
+ brightBlue: '\x1b[94m',
70
+ brightMagenta: '\x1b[95m',
71
+ brightCyan: '\x1b[96m',
72
+ brightWhite: '\x1b[97m',
73
+ // Background
74
+ bgBlack: '\x1b[40m',
75
+ bgRed: '\x1b[41m',
76
+ bgGreen: '\x1b[42m',
77
+ bgYellow: '\x1b[43m',
78
+ bgBlue: '\x1b[44m',
79
+ bgMagenta: '\x1b[45m',
80
+ bgCyan: '\x1b[46m',
81
+ bgWhite: '\x1b[47m',
82
+ bgBrightBlack: '\x1b[100m',
83
+ bgBrightRed: '\x1b[101m',
84
+ bgBrightGreen: '\x1b[102m',
85
+ bgBrightYellow: '\x1b[103m',
86
+ // Cursor control
87
+ cursorUp: (n = 1) => `\x1b[${n}A`,
88
+ cursorDown: (n = 1) => `\x1b[${n}B`,
89
+ cursorRight: (n = 1) => `\x1b[${n}C`,
90
+ cursorLeft: (n = 1) => `\x1b[${n}D`,
91
+ clearLine: '\x1b[2K',
92
+ clearScreen: '\x1b[2J',
93
+ saveCursor: '\x1b[s',
94
+ restoreCursor: '\x1b[u',
95
+ hideCursor: '\x1b[?25l',
96
+ showCursor: '\x1b[?25h',
97
+ };
47
98
 
48
- // Unified Output System
49
- const { output } = require("./lib/output/index.js");
99
+ // 256-color / True color support
100
+ const rgb = (r, g, b) => `\x1b[38;2;${r};${g};${b}m`;
101
+ const bgRgb = (r, g, b) => `\x1b[48;2;${r};${g};${b}m`;
50
102
 
51
- // Extended color palette for fix command
103
+ // Premium color palette
52
104
  const colors = {
53
105
  // Gradients for banner
54
106
  gradient1: rgb(255, 150, 50), // Orange
@@ -278,7 +330,7 @@ function getMissionIcon(missionType) {
278
330
  'FIX_FAKE_SUCCESS': ICONS.ghost,
279
331
  'FIX_ENV_CONTRACT': ICONS.env,
280
332
  'FIX_DEAD_UI': ICONS.dead,
281
- // Enhanced mission types
333
+ // New enhanced mission types
282
334
  'FIX_EMPTY_CATCH': ICONS.bug,
283
335
  'FIX_TEST_KEYS': ICONS.key,
284
336
  'FIX_MOCK_DOMAINS': ICONS.link,
@@ -289,19 +341,6 @@ function getMissionIcon(missionType) {
289
341
  'SYNC_CONTRACTS': ICONS.graph,
290
342
  'FIX_ROUTE_DRIFT': ICONS.route,
291
343
  'FIX_AUTH_DRIFT': ICONS.shield,
292
- // V5: New pattern-based mission types
293
- 'FIX_REACT_PATTERN': '⚛️',
294
- 'FIX_DATABASE_PATTERN': '🗄️',
295
- 'FIX_ASYNC_PATTERN': '⏳',
296
- 'FIX_ERROR_HANDLING': ICONS.bug,
297
- 'FIX_SECURITY_VULN': ICONS.shield,
298
- 'FIX_PERFORMANCE': ICONS.lightning,
299
- 'FIX_BUNDLE_SIZE': ICONS.package,
300
- 'FIX_API_CONSISTENCY': '📡',
301
- 'FIX_ENV_VALIDATION': ICONS.env,
302
- 'FIX_ENV_SETUP': ICONS.env,
303
- 'FIX_ACCESSIBILITY': '♿',
304
- 'FIX_CODE_QUALITY': ICONS.gear,
305
344
  };
306
345
  return icons[missionType] || ICONS.mission;
307
346
  }
@@ -316,7 +355,7 @@ function getMissionColor(missionType) {
316
355
  'FIX_FAKE_SUCCESS': colors.medium,
317
356
  'FIX_ENV_CONTRACT': colors.low,
318
357
  'FIX_DEAD_UI': colors.low,
319
- // Enhanced mission types
358
+ // New enhanced mission types
320
359
  'FIX_EMPTY_CATCH': colors.high,
321
360
  'FIX_TEST_KEYS': colors.critical,
322
361
  'FIX_MOCK_DOMAINS': colors.critical,
@@ -327,19 +366,6 @@ function getMissionColor(missionType) {
327
366
  'SYNC_CONTRACTS': colors.medium,
328
367
  'FIX_ROUTE_DRIFT': colors.medium,
329
368
  'FIX_AUTH_DRIFT': colors.critical,
330
- // V5: New pattern-based mission types
331
- 'FIX_REACT_PATTERN': colors.high, // React issues can cause hard bugs
332
- 'FIX_DATABASE_PATTERN': colors.high, // N+1 and SQL injection are serious
333
- 'FIX_ASYNC_PATTERN': colors.medium, // Async issues cause intermittent bugs
334
- 'FIX_ERROR_HANDLING': colors.medium, // Important but not critical
335
- 'FIX_SECURITY_VULN': colors.critical, // Security is always critical
336
- 'FIX_PERFORMANCE': colors.low, // Performance can wait
337
- 'FIX_BUNDLE_SIZE': colors.low, // Bundle size can wait
338
- 'FIX_API_CONSISTENCY': colors.medium, // API design matters
339
- 'FIX_ENV_VALIDATION': colors.medium, // Prevents runtime crashes
340
- 'FIX_ENV_SETUP': colors.low, // Developer experience
341
- 'FIX_ACCESSIBILITY': colors.medium, // Important for inclusivity
342
- 'FIX_CODE_QUALITY': colors.low, // Can be fixed over time
343
369
  };
344
370
  return colorMap[missionType] || colors.accent;
345
371
  }
@@ -473,13 +499,6 @@ async function runFix(args) {
473
499
  const opts = parseArgs(args);
474
500
  const startTime = Date.now();
475
501
 
476
- // Configure unified output mode
477
- output.setMode({
478
- json: opts.json,
479
- quiet: opts.quiet,
480
- ci: opts.ci
481
- });
482
-
483
502
  if (opts.help) {
484
503
  printHelp();
485
504
  return 0;
@@ -648,24 +667,14 @@ async function runFix(args) {
648
667
  const allowedFiles = expanded.allowedFiles;
649
668
  const snippets = expanded.snippets;
650
669
 
651
- // Build prompt using consolidated PromptBuilder with enforcement
652
- const promptBuilder = new PromptBuilder(root);
653
- const promptResult = promptBuilder.buildFixPrompt({
670
+ const prompt = buildRealityFirewall({
671
+ truthpackSummary: truthpackSummary(before.truthpack),
654
672
  mission,
673
+ template,
655
674
  findings: targetFindings,
656
- truthpackSummary: truthpackSummary(before.truthpack),
657
675
  fileSnippets: snippets,
658
- allowedFiles,
676
+ allowedFiles
659
677
  });
660
-
661
- const prompt = promptResult.prompt;
662
-
663
- // Show enforcement warnings if any
664
- if (promptResult.warnings && promptResult.warnings.length > 0) {
665
- for (const warning of promptResult.warnings) {
666
- console.log(` ${colors.warnAmber}${ICONS.warning}${c.reset} ${c.dim}${warning}${c.reset}`);
667
- }
668
- }
669
678
 
670
679
  const promptPath = path.join(outDir, `step_${String(step).padStart(2,"0")}_${mission.id}_prompt.txt`);
671
680
  fs.writeFileSync(promptPath, prompt, "utf8");
@@ -687,33 +696,13 @@ async function runFix(args) {
687
696
  } catch (e) {
688
697
  stopSpinner('LLM failed', false);
689
698
  console.log(` ${colors.blockRed}${ICONS.cross}${c.reset} ${e.message}`);
690
- return EXIT.INTERNAL_ERROR;
699
+ return 1;
691
700
  }
692
701
 
693
702
  const respPath = path.join(outDir, `step_${String(step).padStart(2,"0")}_${mission.id}_response.json`);
694
703
  fs.writeFileSync(respPath, JSON.stringify(patchJson, null, 2), "utf8");
695
704
 
696
- // Validate LLM response structure
697
- const responseValidation = promptBuilder.validateResponse(patchJson, 'fix');
698
- if (!responseValidation.valid) {
699
- console.log(` ${colors.blockRed}${ICONS.cross}${c.reset} Invalid LLM response structure:`);
700
- for (const err of responseValidation.errors) {
701
- console.log(` ${c.dim}${ICONS.bullet}${c.reset} ${err}`);
702
- }
703
- return EXIT.INTERNAL_ERROR;
704
- }
705
-
706
- // Validate edits against allowed files
707
- const editsValidation = promptBuilder.validateEditsAgainstAllowedFiles(patchJson.edits, allowedFiles);
708
- if (!editsValidation.valid) {
709
- console.log(` ${colors.blockRed}${ICONS.cross}${c.reset} LLM tried to edit files outside allowed list:`);
710
- for (const v of editsValidation.violations) {
711
- console.log(` ${c.dim}${ICONS.bullet}${c.reset} ${v.path}: ${v.message}`);
712
- }
713
- return EXIT.BLOCKING;
714
- }
715
-
716
- // Validate patch (existing validator)
705
+ // Validate patch
717
706
  const v = validatePatchResponse({
718
707
  repoRoot: root,
719
708
  patchJson,
@@ -733,7 +722,7 @@ async function runFix(args) {
733
722
  console.log(` ${colors.warnAmber}${ICONS.warning}${c.reset} ${w}`);
734
723
  }
735
724
  }
736
- return EXIT.BLOCKING;
725
+ return 1;
737
726
  }
738
727
 
739
728
  if (v.warnings.length) {
@@ -764,7 +753,7 @@ async function runFix(args) {
764
753
  console.log(` ${colors.blockRed}${ICONS.cross}${c.reset} Patch apply failed: ${res.error}`);
765
754
  restoreBackup(root, backupRoot);
766
755
  console.log(` ${colors.rollback}${ICONS.rollback}${c.reset} Restored from backup`);
767
- return EXIT.INTERNAL_ERROR;
756
+ return 1;
768
757
  }
769
758
  console.log(` ${colors.patch}${ICONS.patch}${c.reset} Applied: ${c.dim}${ed.path}${c.reset}`);
770
759
  }
@@ -800,7 +789,7 @@ async function runFix(args) {
800
789
  console.log();
801
790
  console.log(` ${colors.blockRed}${ICONS.stop}${c.reset} Stopping: stagnation limit reached (${stagnant}/${stagnationLimit})`);
802
791
  console.log();
803
- return EXIT.BLOCKING;
792
+ return 1;
804
793
  }
805
794
  continue;
806
795
  }
@@ -831,7 +820,7 @@ async function runFix(args) {
831
820
  }
832
821
  }
833
822
 
834
- return EXIT.WARNINGS; // Max steps reached, incomplete
823
+ return 1;
835
824
  }
836
825
 
837
826
  // ═══════════════════════════════════════════════════════════════════════════════