@vibecheckai/cli 2.8.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/bin/_deprecations.js +35 -0
- package/bin/_router.js +46 -0
- package/bin/cli-hygiene.js +241 -0
- package/bin/guardrail.js +834 -0
- package/bin/runners/cli-utils.js +1070 -0
- package/bin/runners/context/ai-task-decomposer.js +337 -0
- package/bin/runners/context/analyzer.js +462 -0
- package/bin/runners/context/api-contracts.js +427 -0
- package/bin/runners/context/context-diff.js +342 -0
- package/bin/runners/context/context-pruner.js +291 -0
- package/bin/runners/context/dependency-graph.js +414 -0
- package/bin/runners/context/generators/claude.js +107 -0
- package/bin/runners/context/generators/codex.js +108 -0
- package/bin/runners/context/generators/copilot.js +119 -0
- package/bin/runners/context/generators/cursor.js +514 -0
- package/bin/runners/context/generators/mcp.js +151 -0
- package/bin/runners/context/generators/windsurf.js +180 -0
- package/bin/runners/context/git-context.js +302 -0
- package/bin/runners/context/index.js +1042 -0
- package/bin/runners/context/insights.js +173 -0
- package/bin/runners/context/mcp-server/generate-rules.js +337 -0
- package/bin/runners/context/mcp-server/index.js +1176 -0
- package/bin/runners/context/mcp-server/package.json +24 -0
- package/bin/runners/context/memory.js +200 -0
- package/bin/runners/context/monorepo.js +215 -0
- package/bin/runners/context/multi-repo-federation.js +404 -0
- package/bin/runners/context/patterns.js +253 -0
- package/bin/runners/context/proof-context.js +972 -0
- package/bin/runners/context/security-scanner.js +303 -0
- package/bin/runners/context/semantic-search.js +350 -0
- package/bin/runners/context/shared.js +264 -0
- package/bin/runners/context/team-conventions.js +310 -0
- package/bin/runners/lib/ai-bridge.js +416 -0
- package/bin/runners/lib/analysis-core.js +271 -0
- package/bin/runners/lib/analyzers.js +541 -0
- package/bin/runners/lib/audit-bridge.js +391 -0
- package/bin/runners/lib/auth-truth.js +193 -0
- package/bin/runners/lib/auth.js +215 -0
- package/bin/runners/lib/backup.js +62 -0
- package/bin/runners/lib/billing.js +107 -0
- package/bin/runners/lib/claims.js +118 -0
- package/bin/runners/lib/cli-ui.js +540 -0
- package/bin/runners/lib/compliance-bridge-new.js +0 -0
- package/bin/runners/lib/compliance-bridge.js +165 -0
- package/bin/runners/lib/contracts/auth-contract.js +194 -0
- package/bin/runners/lib/contracts/env-contract.js +178 -0
- package/bin/runners/lib/contracts/external-contract.js +198 -0
- package/bin/runners/lib/contracts/guard.js +168 -0
- package/bin/runners/lib/contracts/index.js +89 -0
- package/bin/runners/lib/contracts/plan-validator.js +311 -0
- package/bin/runners/lib/contracts/route-contract.js +192 -0
- package/bin/runners/lib/detect.js +89 -0
- package/bin/runners/lib/doctor/autofix.js +254 -0
- package/bin/runners/lib/doctor/index.js +37 -0
- package/bin/runners/lib/doctor/modules/dependencies.js +325 -0
- package/bin/runners/lib/doctor/modules/index.js +46 -0
- package/bin/runners/lib/doctor/modules/network.js +250 -0
- package/bin/runners/lib/doctor/modules/project.js +312 -0
- package/bin/runners/lib/doctor/modules/runtime.js +224 -0
- package/bin/runners/lib/doctor/modules/security.js +348 -0
- package/bin/runners/lib/doctor/modules/system.js +213 -0
- package/bin/runners/lib/doctor/modules/vibecheck.js +394 -0
- package/bin/runners/lib/doctor/reporter.js +262 -0
- package/bin/runners/lib/doctor/service.js +262 -0
- package/bin/runners/lib/doctor/types.js +113 -0
- package/bin/runners/lib/doctor/ui.js +263 -0
- package/bin/runners/lib/doctor-enhanced.js +233 -0
- package/bin/runners/lib/doctor-v2.js +608 -0
- package/bin/runners/lib/enforcement.js +72 -0
- package/bin/runners/lib/enterprise-detect.js +603 -0
- package/bin/runners/lib/enterprise-init.js +942 -0
- package/bin/runners/lib/entitlements-v2.js +381 -0
- package/bin/runners/lib/entitlements.generated.js +0 -0
- package/bin/runners/lib/entitlements.js +332 -0
- package/bin/runners/lib/env-template.js +66 -0
- package/bin/runners/lib/env.js +189 -0
- package/bin/runners/lib/error-handler.js +320 -0
- package/bin/runners/lib/firewall-prompt.js +50 -0
- package/bin/runners/lib/graph/graph-builder.js +265 -0
- package/bin/runners/lib/graph/html-renderer.js +413 -0
- package/bin/runners/lib/graph/index.js +32 -0
- package/bin/runners/lib/graph/runtime-collector.js +215 -0
- package/bin/runners/lib/graph/static-extractor.js +518 -0
- package/bin/runners/lib/init-wizard.js +308 -0
- package/bin/runners/lib/json-output.js +76 -0
- package/bin/runners/lib/llm.js +75 -0
- package/bin/runners/lib/meter.js +61 -0
- package/bin/runners/lib/missions/evidence.js +126 -0
- package/bin/runners/lib/missions/plan.js +69 -0
- package/bin/runners/lib/missions/templates.js +147 -0
- package/bin/runners/lib/patch.js +40 -0
- package/bin/runners/lib/permissions/auth-model.js +213 -0
- package/bin/runners/lib/permissions/idor-prover.js +205 -0
- package/bin/runners/lib/permissions/index.js +45 -0
- package/bin/runners/lib/permissions/matrix-builder.js +198 -0
- package/bin/runners/lib/pkgjson.js +28 -0
- package/bin/runners/lib/preflight.js +142 -0
- package/bin/runners/lib/reality-findings.js +84 -0
- package/bin/runners/lib/redact.js +29 -0
- package/bin/runners/lib/replay/capsule-manager.js +154 -0
- package/bin/runners/lib/replay/index.js +263 -0
- package/bin/runners/lib/replay/player.js +348 -0
- package/bin/runners/lib/replay/recorder.js +331 -0
- package/bin/runners/lib/report-engine.js +447 -0
- package/bin/runners/lib/report-html.js +1117 -0
- package/bin/runners/lib/report-templates.js +964 -0
- package/bin/runners/lib/route-detection.js +1140 -0
- package/bin/runners/lib/route-truth.js +477 -0
- package/bin/runners/lib/sandbox/index.js +59 -0
- package/bin/runners/lib/sandbox/proof-chain.js +399 -0
- package/bin/runners/lib/sandbox/sandbox-runner.js +205 -0
- package/bin/runners/lib/sandbox/worktree.js +174 -0
- package/bin/runners/lib/scan-cache.js +330 -0
- package/bin/runners/lib/scan-output-schema.js +344 -0
- package/bin/runners/lib/score-history.js +282 -0
- package/bin/runners/lib/security-bridge.js +249 -0
- package/bin/runners/lib/server-usage.js +513 -0
- package/bin/runners/lib/share-pack.js +239 -0
- package/bin/runners/lib/snippets.js +67 -0
- package/bin/runners/lib/truth.js +667 -0
- package/bin/runners/lib/unified-output.js +189 -0
- package/bin/runners/lib/validate-patch.js +156 -0
- package/bin/runners/lib/verification.js +345 -0
- package/bin/runners/reality/engine.js +917 -0
- package/bin/runners/reality/flows.js +122 -0
- package/bin/runners/reality/report.js +378 -0
- package/bin/runners/reality/session.js +193 -0
- package/bin/runners/runAIAgent.js +2 -0
- package/bin/runners/runAudit.js +2 -0
- package/bin/runners/runAuth.js +106 -0
- package/bin/runners/runAutopilot.js +2 -0
- package/bin/runners/runBadge.js +2 -0
- package/bin/runners/runCertify.js +2 -0
- package/bin/runners/runClaimVerifier.js +483 -0
- package/bin/runners/runContext.js +56 -0
- package/bin/runners/runContextCompiler.js +385 -0
- package/bin/runners/runCtx.js +187 -0
- package/bin/runners/runCtxGuard.js +176 -0
- package/bin/runners/runCtxSync.js +116 -0
- package/bin/runners/runDashboard.js +10 -0
- package/bin/runners/runDoctor.js +245 -0
- package/bin/runners/runEnhancedShip.js +2 -0
- package/bin/runners/runFix.js +735 -0
- package/bin/runners/runFixPacks.js +2 -0
- package/bin/runners/runGate.js +17 -0
- package/bin/runners/runGraph.js +283 -0
- package/bin/runners/runInit.js +260 -0
- package/bin/runners/runInitGha.js +101 -0
- package/bin/runners/runInstall.js +76 -0
- package/bin/runners/runInteractive.js +388 -0
- package/bin/runners/runLaunch.js +2 -0
- package/bin/runners/runMcp.js +19 -0
- package/bin/runners/runMdc.js +2 -0
- package/bin/runners/runMissionGenerator.js +282 -0
- package/bin/runners/runNaturalLanguage.js +3 -0
- package/bin/runners/runPR.js +96 -0
- package/bin/runners/runPermissions.js +290 -0
- package/bin/runners/runPromptFirewall.js +211 -0
- package/bin/runners/runProof.js +2 -0
- package/bin/runners/runProve.js +392 -0
- package/bin/runners/runReality.js +489 -0
- package/bin/runners/runRealitySniff.js +2 -0
- package/bin/runners/runReplay.js +469 -0
- package/bin/runners/runReport.js +478 -0
- package/bin/runners/runScan.js +835 -0
- package/bin/runners/runShare.js +34 -0
- package/bin/runners/runShip.js +1062 -0
- package/bin/runners/runStatus.js +136 -0
- package/bin/runners/runTruthpack.js +634 -0
- package/bin/runners/runUpgrade.js +2 -0
- package/bin/runners/runValidate.js +2 -0
- package/bin/runners/runVerifyAgentOutput.js +2 -0
- package/bin/runners/runWatch.js +230 -0
- package/bin/runners/utils.js +360 -0
- package/bin/scan.js +612 -0
- package/bin/vibecheck.js +834 -0
- package/package.json +11 -11
- package/dist/autopatch/verified-autopatch.d.ts +0 -111
- package/dist/autopatch/verified-autopatch.d.ts.map +0 -1
- package/dist/autopatch/verified-autopatch.js +0 -503
- package/dist/autopatch/verified-autopatch.js.map +0 -1
- package/dist/bundles/index.js +0 -8
- package/dist/bundles/vibecheck-core.js +0 -25799
- package/dist/bundles/vibecheck-security.js +0 -208693
- package/dist/bundles/vibecheck-ship.js +0 -2318
- package/dist/commands/baseline.d.ts +0 -7
- package/dist/commands/baseline.d.ts.map +0 -1
- package/dist/commands/baseline.js +0 -79
- package/dist/commands/baseline.js.map +0 -1
- package/dist/commands/cache.d.ts +0 -13
- package/dist/commands/cache.d.ts.map +0 -1
- package/dist/commands/cache.js +0 -165
- package/dist/commands/cache.js.map +0 -1
- package/dist/commands/checkpoint.d.ts +0 -8
- package/dist/commands/checkpoint.d.ts.map +0 -1
- package/dist/commands/checkpoint.js +0 -35
- package/dist/commands/checkpoint.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -17
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -226
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/evidence.d.ts +0 -45
- package/dist/commands/evidence.d.ts.map +0 -1
- package/dist/commands/evidence.js +0 -197
- package/dist/commands/evidence.js.map +0 -1
- package/dist/commands/explain.d.ts +0 -8
- package/dist/commands/explain.d.ts.map +0 -1
- package/dist/commands/explain.js +0 -52
- package/dist/commands/explain.js.map +0 -1
- package/dist/commands/fix-consolidated.d.ts +0 -19
- package/dist/commands/fix-consolidated.d.ts.map +0 -1
- package/dist/commands/fix-consolidated.js +0 -165
- package/dist/commands/fix-consolidated.js.map +0 -1
- package/dist/commands/index.d.ts +0 -8
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/index.js +0 -15
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/init.d.ts +0 -8
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -125
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/launcher.d.ts +0 -10
- package/dist/commands/launcher.d.ts.map +0 -1
- package/dist/commands/launcher.js +0 -174
- package/dist/commands/launcher.js.map +0 -1
- package/dist/commands/on.d.ts +0 -8
- package/dist/commands/on.d.ts.map +0 -1
- package/dist/commands/on.js +0 -123
- package/dist/commands/on.js.map +0 -1
- package/dist/commands/replay.d.ts +0 -8
- package/dist/commands/replay.d.ts.map +0 -1
- package/dist/commands/replay.js +0 -52
- package/dist/commands/replay.js.map +0 -1
- package/dist/commands/scan-consolidated.d.ts +0 -61
- package/dist/commands/scan-consolidated.d.ts.map +0 -1
- package/dist/commands/scan-consolidated.js +0 -243
- package/dist/commands/scan-consolidated.js.map +0 -1
- package/dist/commands/scan-secrets.d.ts +0 -47
- package/dist/commands/scan-secrets.d.ts.map +0 -1
- package/dist/commands/scan-secrets.js +0 -225
- package/dist/commands/scan-secrets.js.map +0 -1
- package/dist/commands/scan-vulnerabilities-enhanced.d.ts +0 -41
- package/dist/commands/scan-vulnerabilities-enhanced.d.ts.map +0 -1
- package/dist/commands/scan-vulnerabilities-enhanced.js +0 -368
- package/dist/commands/scan-vulnerabilities-enhanced.js.map +0 -1
- package/dist/commands/scan-vulnerabilities-osv.d.ts +0 -58
- package/dist/commands/scan-vulnerabilities-osv.d.ts.map +0 -1
- package/dist/commands/scan-vulnerabilities-osv.js +0 -722
- package/dist/commands/scan-vulnerabilities-osv.js.map +0 -1
- package/dist/commands/scan-vulnerabilities.d.ts +0 -32
- package/dist/commands/scan-vulnerabilities.d.ts.map +0 -1
- package/dist/commands/scan-vulnerabilities.js +0 -283
- package/dist/commands/scan-vulnerabilities.js.map +0 -1
- package/dist/commands/secrets-allowlist.d.ts +0 -7
- package/dist/commands/secrets-allowlist.d.ts.map +0 -1
- package/dist/commands/secrets-allowlist.js +0 -85
- package/dist/commands/secrets-allowlist.js.map +0 -1
- package/dist/commands/ship-consolidated.d.ts +0 -58
- package/dist/commands/ship-consolidated.d.ts.map +0 -1
- package/dist/commands/ship-consolidated.js +0 -515
- package/dist/commands/ship-consolidated.js.map +0 -1
- package/dist/commands/stats.d.ts +0 -8
- package/dist/commands/stats.d.ts.map +0 -1
- package/dist/commands/stats.js +0 -134
- package/dist/commands/stats.js.map +0 -1
- package/dist/commands/upgrade.d.ts +0 -8
- package/dist/commands/upgrade.d.ts.map +0 -1
- package/dist/commands/upgrade.js +0 -30
- package/dist/commands/upgrade.js.map +0 -1
- package/dist/fix/applicator.d.ts +0 -44
- package/dist/fix/applicator.d.ts.map +0 -1
- package/dist/fix/applicator.js +0 -144
- package/dist/fix/applicator.js.map +0 -1
- package/dist/fix/backup.d.ts +0 -38
- package/dist/fix/backup.d.ts.map +0 -1
- package/dist/fix/backup.js +0 -154
- package/dist/fix/backup.js.map +0 -1
- package/dist/fix/engine.d.ts +0 -55
- package/dist/fix/engine.d.ts.map +0 -1
- package/dist/fix/engine.js +0 -285
- package/dist/fix/engine.js.map +0 -1
- package/dist/fix/index.d.ts +0 -5
- package/dist/fix/index.d.ts.map +0 -1
- package/dist/fix/index.js +0 -12
- package/dist/fix/index.js.map +0 -1
- package/dist/fix/interactive.d.ts +0 -22
- package/dist/fix/interactive.d.ts.map +0 -1
- package/dist/fix/interactive.js +0 -172
- package/dist/fix/interactive.js.map +0 -1
- package/dist/formatters/index.d.ts +0 -6
- package/dist/formatters/index.d.ts.map +0 -1
- package/dist/formatters/index.js +0 -11
- package/dist/formatters/index.js.map +0 -1
- package/dist/formatters/sarif-enhanced.d.ts +0 -78
- package/dist/formatters/sarif-enhanced.d.ts.map +0 -1
- package/dist/formatters/sarif-enhanced.js +0 -144
- package/dist/formatters/sarif-enhanced.js.map +0 -1
- package/dist/formatters/sarif-v2.d.ts +0 -121
- package/dist/formatters/sarif-v2.d.ts.map +0 -1
- package/dist/formatters/sarif-v2.js +0 -356
- package/dist/formatters/sarif-v2.js.map +0 -1
- package/dist/formatters/sarif.d.ts +0 -72
- package/dist/formatters/sarif.d.ts.map +0 -1
- package/dist/formatters/sarif.js +0 -146
- package/dist/formatters/sarif.js.map +0 -1
- package/dist/index.d.ts +0 -61
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -4388
- package/dist/index.js.map +0 -1
- package/dist/init/ci-generator.d.ts +0 -18
- package/dist/init/ci-generator.d.ts.map +0 -1
- package/dist/init/ci-generator.js +0 -317
- package/dist/init/ci-generator.js.map +0 -1
- package/dist/init/detect-framework.d.ts +0 -15
- package/dist/init/detect-framework.d.ts.map +0 -1
- package/dist/init/detect-framework.js +0 -301
- package/dist/init/detect-framework.js.map +0 -1
- package/dist/init/hooks-installer.d.ts +0 -22
- package/dist/init/hooks-installer.d.ts.map +0 -1
- package/dist/init/hooks-installer.js +0 -310
- package/dist/init/hooks-installer.js.map +0 -1
- package/dist/init/index.d.ts +0 -8
- package/dist/init/index.d.ts.map +0 -1
- package/dist/init/index.js +0 -22
- package/dist/init/index.js.map +0 -1
- package/dist/init/templates.d.ts +0 -402
- package/dist/init/templates.d.ts.map +0 -1
- package/dist/init/templates.js +0 -240
- package/dist/init/templates.js.map +0 -1
- package/dist/mcp/server.d.ts +0 -12
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/mcp/server.js +0 -42
- package/dist/mcp/server.js.map +0 -1
- package/dist/mcp/telemetry.d.ts +0 -40
- package/dist/mcp/telemetry.d.ts.map +0 -1
- package/dist/mcp/telemetry.js +0 -98
- package/dist/mcp/telemetry.js.map +0 -1
- package/dist/reality/no-dead-buttons/button-sweep-generator.d.ts +0 -32
- package/dist/reality/no-dead-buttons/button-sweep-generator.d.ts.map +0 -1
- package/dist/reality/no-dead-buttons/button-sweep-generator.js +0 -236
- package/dist/reality/no-dead-buttons/button-sweep-generator.js.map +0 -1
- package/dist/reality/no-dead-buttons/index.d.ts +0 -11
- package/dist/reality/no-dead-buttons/index.d.ts.map +0 -1
- package/dist/reality/no-dead-buttons/index.js +0 -18
- package/dist/reality/no-dead-buttons/index.js.map +0 -1
- package/dist/reality/no-dead-buttons/static-scanner.d.ts +0 -34
- package/dist/reality/no-dead-buttons/static-scanner.d.ts.map +0 -1
- package/dist/reality/no-dead-buttons/static-scanner.js +0 -230
- package/dist/reality/no-dead-buttons/static-scanner.js.map +0 -1
- package/dist/reality/reality-graph.d.ts +0 -192
- package/dist/reality/reality-graph.d.ts.map +0 -1
- package/dist/reality/reality-graph.js +0 -600
- package/dist/reality/reality-graph.js.map +0 -1
- package/dist/reality/reality-runner.d.ts +0 -89
- package/dist/reality/reality-runner.d.ts.map +0 -1
- package/dist/reality/reality-runner.js +0 -540
- package/dist/reality/reality-runner.js.map +0 -1
- package/dist/reality/receipt-generator.d.ts +0 -152
- package/dist/reality/receipt-generator.d.ts.map +0 -1
- package/dist/reality/receipt-generator.js +0 -495
- package/dist/reality/receipt-generator.js.map +0 -1
- package/dist/reality/runtime-tracer.d.ts +0 -75
- package/dist/reality/runtime-tracer.d.ts.map +0 -1
- package/dist/reality/runtime-tracer.js +0 -109
- package/dist/reality/runtime-tracer.js.map +0 -1
- package/dist/runtime/auth-utils.d.ts +0 -43
- package/dist/runtime/auth-utils.d.ts.map +0 -1
- package/dist/runtime/auth-utils.js +0 -130
- package/dist/runtime/auth-utils.js.map +0 -1
- package/dist/runtime/client.d.ts +0 -74
- package/dist/runtime/client.d.ts.map +0 -1
- package/dist/runtime/client.js +0 -222
- package/dist/runtime/client.js.map +0 -1
- package/dist/runtime/creds.d.ts +0 -48
- package/dist/runtime/creds.d.ts.map +0 -1
- package/dist/runtime/creds.js +0 -245
- package/dist/runtime/creds.js.map +0 -1
- package/dist/runtime/exit-codes.d.ts +0 -49
- package/dist/runtime/exit-codes.d.ts.map +0 -1
- package/dist/runtime/exit-codes.js +0 -93
- package/dist/runtime/exit-codes.js.map +0 -1
- package/dist/runtime/index.d.ts +0 -9
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/index.js +0 -25
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/json-output.d.ts +0 -42
- package/dist/runtime/json-output.d.ts.map +0 -1
- package/dist/runtime/json-output.js +0 -59
- package/dist/runtime/json-output.js.map +0 -1
- package/dist/runtime/semver.d.ts +0 -37
- package/dist/runtime/semver.d.ts.map +0 -1
- package/dist/runtime/semver.js +0 -110
- package/dist/runtime/semver.js.map +0 -1
- package/dist/scan/dead-ui-detector.d.ts +0 -48
- package/dist/scan/dead-ui-detector.d.ts.map +0 -1
- package/dist/scan/dead-ui-detector.js +0 -170
- package/dist/scan/dead-ui-detector.js.map +0 -1
- package/dist/scan/playwright-sweep.d.ts +0 -40
- package/dist/scan/playwright-sweep.d.ts.map +0 -1
- package/dist/scan/playwright-sweep.js +0 -216
- package/dist/scan/playwright-sweep.js.map +0 -1
- package/dist/scan/proof-bundle.d.ts +0 -25
- package/dist/scan/proof-bundle.d.ts.map +0 -1
- package/dist/scan/proof-bundle.js +0 -203
- package/dist/scan/proof-bundle.js.map +0 -1
- package/dist/scan/proof-graph.d.ts +0 -59
- package/dist/scan/proof-graph.d.ts.map +0 -1
- package/dist/scan/proof-graph.js +0 -64
- package/dist/scan/proof-graph.js.map +0 -1
- package/dist/scan/reality-sniff.d.ts +0 -56
- package/dist/scan/reality-sniff.d.ts.map +0 -1
- package/dist/scan/reality-sniff.js +0 -200
- package/dist/scan/reality-sniff.js.map +0 -1
- package/dist/scan/structural-verifier.d.ts +0 -20
- package/dist/scan/structural-verifier.d.ts.map +0 -1
- package/dist/scan/structural-verifier.js +0 -112
- package/dist/scan/structural-verifier.js.map +0 -1
- package/dist/scan/verification-engine.d.ts +0 -47
- package/dist/scan/verification-engine.d.ts.map +0 -1
- package/dist/scan/verification-engine.js +0 -141
- package/dist/scan/verification-engine.js.map +0 -1
- package/dist/scanner/baseline.d.ts +0 -52
- package/dist/scanner/baseline.d.ts.map +0 -1
- package/dist/scanner/baseline.js +0 -85
- package/dist/scanner/baseline.js.map +0 -1
- package/dist/scanner/incremental.d.ts +0 -30
- package/dist/scanner/incremental.d.ts.map +0 -1
- package/dist/scanner/incremental.js +0 -82
- package/dist/scanner/incremental.js.map +0 -1
- package/dist/scanner/parallel.d.ts +0 -43
- package/dist/scanner/parallel.d.ts.map +0 -1
- package/dist/scanner/parallel.js +0 -99
- package/dist/scanner/parallel.js.map +0 -1
- package/dist/standalone.d.ts +0 -1
- package/dist/standalone.d.ts.map +0 -1
- package/dist/standalone.js +0 -1
- package/dist/standalone.js.map +0 -1
- package/dist/truth-pack/index.d.ts +0 -102
- package/dist/truth-pack/index.d.ts.map +0 -1
- package/dist/truth-pack/index.js +0 -694
- package/dist/truth-pack/index.js.map +0 -1
- package/dist/ui/frame.d.ts +0 -68
- package/dist/ui/frame.d.ts.map +0 -1
- package/dist/ui/frame.js +0 -165
- package/dist/ui/frame.js.map +0 -1
- package/dist/ui/index.d.ts +0 -5
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js +0 -16
- package/dist/ui/index.js.map +0 -1
- package/dist/ui.d.ts +0 -36
- package/dist/ui.d.ts.map +0 -1
- package/dist/ui.js +0 -45
- package/dist/ui.js.map +0 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow Pack Loader
|
|
3
|
+
* Loads and normalizes YAML/JSON flow packs from .vibecheck/flows/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
|
|
9
|
+
let yaml;
|
|
10
|
+
function ensureYaml() {
|
|
11
|
+
if (yaml) return yaml;
|
|
12
|
+
try {
|
|
13
|
+
yaml = require("yaml");
|
|
14
|
+
return yaml;
|
|
15
|
+
} catch {
|
|
16
|
+
try {
|
|
17
|
+
yaml = require("js-yaml");
|
|
18
|
+
return yaml;
|
|
19
|
+
} catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function listFlowFiles(dir) {
|
|
26
|
+
if (!fs.existsSync(dir)) return [];
|
|
27
|
+
const out = [];
|
|
28
|
+
for (const f of fs.readdirSync(dir)) {
|
|
29
|
+
const p = path.join(dir, f);
|
|
30
|
+
if (fs.statSync(p).isFile()) {
|
|
31
|
+
if (f.endsWith(".yaml") || f.endsWith(".yml") || f.endsWith(".json")) {
|
|
32
|
+
out.push(p);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return out.sort();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function normalizeFlow(flow, sourcePath) {
|
|
40
|
+
if (!flow || typeof flow !== "object") return null;
|
|
41
|
+
if (!flow.id) flow.id = path.basename(sourcePath).replace(/\.(ya?ml|json)$/, "");
|
|
42
|
+
if (!flow.name) flow.name = flow.id;
|
|
43
|
+
if (!Array.isArray(flow.steps)) flow.steps = [];
|
|
44
|
+
if (!Array.isArray(flow.assertions)) flow.assertions = [];
|
|
45
|
+
if (!Array.isArray(flow.cleanup)) flow.cleanup = [];
|
|
46
|
+
if (!flow.vars || typeof flow.vars !== "object") flow.vars = {};
|
|
47
|
+
if (!flow.preconditions) flow.preconditions = {};
|
|
48
|
+
if (!flow.danger) flow.danger = {};
|
|
49
|
+
flow.__source = sourcePath;
|
|
50
|
+
return flow;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function parseFlowFile(filePath) {
|
|
54
|
+
const content = fs.readFileSync(filePath, "utf8");
|
|
55
|
+
|
|
56
|
+
if (filePath.endsWith(".json")) {
|
|
57
|
+
return JSON.parse(content);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const y = ensureYaml();
|
|
61
|
+
if (!y) {
|
|
62
|
+
throw new Error(
|
|
63
|
+
`YAML parser not found. Install with: npm i -D yaml\nOr use JSON flow files instead.`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// js-yaml uses load(), yaml package uses parse()
|
|
68
|
+
if (typeof y.load === "function") {
|
|
69
|
+
return y.load(content);
|
|
70
|
+
}
|
|
71
|
+
return y.parse(content);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Load flow packs from directory
|
|
76
|
+
* @param {Object} options
|
|
77
|
+
* @param {string} options.flowsDir - Directory containing flow files
|
|
78
|
+
* @param {string[]} options.requested - Specific flow IDs/names to load (empty = all)
|
|
79
|
+
* @param {boolean} options.debug - Enable debug logging
|
|
80
|
+
* @returns {Object[]} Array of normalized flow objects
|
|
81
|
+
*/
|
|
82
|
+
function loadFlowPacks({ flowsDir, requested, debug }) {
|
|
83
|
+
const files = listFlowFiles(flowsDir);
|
|
84
|
+
|
|
85
|
+
if (debug && files.length === 0) {
|
|
86
|
+
console.log(`[reality] No flow files found in ${flowsDir}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const flows = [];
|
|
90
|
+
for (const file of files) {
|
|
91
|
+
try {
|
|
92
|
+
const parsed = parseFlowFile(file);
|
|
93
|
+
const flow = normalizeFlow(parsed, file);
|
|
94
|
+
if (flow) {
|
|
95
|
+
flows.push(flow);
|
|
96
|
+
if (debug) {
|
|
97
|
+
console.log(`[reality] Loaded flow: ${flow.id} (${flow.steps.length} steps)`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
} catch (e) {
|
|
101
|
+
if (debug) {
|
|
102
|
+
console.warn(`[reality] Failed to parse flow ${file}: ${e.message}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Filter by requested if provided
|
|
108
|
+
if (!requested || requested.length === 0) return flows;
|
|
109
|
+
|
|
110
|
+
const req = new Set(requested.map((s) => s.toLowerCase()));
|
|
111
|
+
return flows.filter((f) => {
|
|
112
|
+
const id = String(f.id || "").toLowerCase();
|
|
113
|
+
const name = String(f.name || "").toLowerCase();
|
|
114
|
+
const file = path.basename(f.__source || "").toLowerCase();
|
|
115
|
+
for (const r of req) {
|
|
116
|
+
if (id.includes(r) || name.includes(r) || file.includes(r)) return true;
|
|
117
|
+
}
|
|
118
|
+
return false;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
module.exports = { loadFlowPacks, parseFlowFile, normalizeFlow };
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reality Mode Report Generators
|
|
3
|
+
* HTML Report, Timeline, JUnit XML, SARIF
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
function esc(s) {
|
|
7
|
+
return String(s ?? "")
|
|
8
|
+
.replace(/&/g, "&")
|
|
9
|
+
.replace(/</g, "<")
|
|
10
|
+
.replace(/>/g, ">")
|
|
11
|
+
.replace(/"/g, """);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function badge(status) {
|
|
15
|
+
const s = String(status || "").toLowerCase();
|
|
16
|
+
if (s === "success" || s === "pass") return `<span class="b b-ok">${esc(status)}</span>`;
|
|
17
|
+
if (s === "skipped") return `<span class="b b-skip">skipped</span>`;
|
|
18
|
+
if (s === "blocked") return `<span class="b b-block">blocked</span>`;
|
|
19
|
+
if (s === "unknown") return `<span class="b b-warn">unknown</span>`;
|
|
20
|
+
if (s === "fail" || s === "error") return `<span class="b b-bad">${esc(status)}</span>`;
|
|
21
|
+
return `<span class="b b-warn">${esc(status)}</span>`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function writeHtmlReport(results) {
|
|
25
|
+
const score = results.score ?? 0;
|
|
26
|
+
const grade = score >= 90 ? "A" : score >= 80 ? "B" : score >= 70 ? "C" : score >= 60 ? "D" : "F";
|
|
27
|
+
const verdict = score >= 80 ? "✅ Ready to ship" : score >= 60 ? "⚠️ Needs work" : "❌ Not shippable";
|
|
28
|
+
const scoreColor = score >= 80 ? "#22c55e" : score >= 60 ? "#eab308" : "#ef4444";
|
|
29
|
+
|
|
30
|
+
const flowsHtml = (results.flows || []).map(f => {
|
|
31
|
+
const steps = (f.steps || []).slice(0, 50).map(s => `
|
|
32
|
+
<div class="row">
|
|
33
|
+
<div class="k">${esc(s.action)} <span class="dim">${esc(s.name || "")}</span></div>
|
|
34
|
+
<div class="v">${badge(s.status)} ${s.danger?.dangerous ? `<span class="danger-tag">⚠️ destructive</span>` : ""} <span class="dim">${esc(s.error || "")}</span></div>
|
|
35
|
+
</div>
|
|
36
|
+
`).join("");
|
|
37
|
+
|
|
38
|
+
const asserts = (f.assertions || []).map(a => `
|
|
39
|
+
<div class="row">
|
|
40
|
+
<div class="k">${esc(a.type)} ${a.critical ? `<span class="critical-tag">critical</span>` : ""}</div>
|
|
41
|
+
<div class="v">${badge(a.status)} <span class="dim">${esc(a.message || "")}</span></div>
|
|
42
|
+
</div>
|
|
43
|
+
`).join("");
|
|
44
|
+
|
|
45
|
+
return `
|
|
46
|
+
<div class="card">
|
|
47
|
+
<div class="card-h">
|
|
48
|
+
<div>
|
|
49
|
+
<div class="t">${esc(f.name || f.id)}</div>
|
|
50
|
+
<div class="dim">${esc(f.source || "")}</div>
|
|
51
|
+
</div>
|
|
52
|
+
<div>${badge(f.status)} <span class="dim">${Math.round((f.durationMs || 0) / 1000)}s</span></div>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="split">
|
|
55
|
+
<div>
|
|
56
|
+
<div class="h2">Steps (${(f.steps || []).length})</div>
|
|
57
|
+
${steps || `<div class="dim">No steps</div>`}
|
|
58
|
+
</div>
|
|
59
|
+
<div>
|
|
60
|
+
<div class="h2">Assertions (${(f.assertions || []).length})</div>
|
|
61
|
+
${asserts || `<div class="dim">No assertions</div>`}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
`;
|
|
66
|
+
}).join("");
|
|
67
|
+
|
|
68
|
+
const routesHtml = (results.routes || []).slice(0, 50).map(r => `
|
|
69
|
+
<div class="row">
|
|
70
|
+
<div class="k mono">${esc(r.path)}</div>
|
|
71
|
+
<div class="v">${badge(r.status)} <span class="dim">${r.httpStatus || ""}</span></div>
|
|
72
|
+
</div>
|
|
73
|
+
`).join("");
|
|
74
|
+
|
|
75
|
+
const errHtml = (results.errors || []).slice(0, 30).map(e => `
|
|
76
|
+
<div class="err">[${esc(e.type)}] ${esc(e.message)} <span class="dim">${esc(e.url || "")}</span></div>
|
|
77
|
+
`).join("");
|
|
78
|
+
|
|
79
|
+
const cov = results.coverage || {};
|
|
80
|
+
|
|
81
|
+
return `<!doctype html>
|
|
82
|
+
<html lang="en">
|
|
83
|
+
<head>
|
|
84
|
+
<meta charset="utf-8" />
|
|
85
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
86
|
+
<title>Reality Mode Report - vibecheck</title>
|
|
87
|
+
<style>
|
|
88
|
+
*{box-sizing:border-box}
|
|
89
|
+
body{margin:0;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;background:#0b0b0f;color:#eaeaf0;line-height:1.5}
|
|
90
|
+
.wrap{max-width:1100px;margin:0 auto;padding:28px}
|
|
91
|
+
.top{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;flex-wrap:wrap}
|
|
92
|
+
.title{font-size:22px;font-weight:800}
|
|
93
|
+
.dim{color:#9aa0aa;font-size:12px}
|
|
94
|
+
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}
|
|
95
|
+
.score{display:flex;gap:14px;align-items:center;background:#11131a;border:1px solid #222634;border-radius:16px;padding:18px 20px}
|
|
96
|
+
.num{font-size:48px;font-weight:900;line-height:1;color:${scoreColor}}
|
|
97
|
+
.meta{display:flex;flex-direction:column;gap:2px}
|
|
98
|
+
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px;margin-top:14px}
|
|
99
|
+
.stat{background:#11131a;border:1px solid #222634;border-radius:14px;padding:12px}
|
|
100
|
+
.stat .v{font-weight:800;font-size:18px}
|
|
101
|
+
.card{background:#0f1118;border:1px solid #222634;border-radius:16px;margin-top:14px;overflow:hidden}
|
|
102
|
+
.card-h{display:flex;justify-content:space-between;align-items:center;padding:14px 16px;background:#11131a;border-bottom:1px solid #222634}
|
|
103
|
+
.t{font-weight:800}
|
|
104
|
+
.split{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:14px 16px}
|
|
105
|
+
@media(max-width:700px){.split{grid-template-columns:1fr}}
|
|
106
|
+
.h2{font-size:12px;font-weight:800;color:#c8ccd6;margin-bottom:8px;text-transform:uppercase;letter-spacing:0.5px}
|
|
107
|
+
.row{display:flex;justify-content:space-between;gap:10px;border-bottom:1px solid #171a24;padding:8px 0;align-items:center}
|
|
108
|
+
.row:last-child{border-bottom:none}
|
|
109
|
+
.k{font-size:12px;overflow:hidden;text-overflow:ellipsis}
|
|
110
|
+
.v{font-size:12px;text-align:right;white-space:nowrap}
|
|
111
|
+
.b{font-size:11px;font-weight:800;padding:3px 8px;border-radius:999px;border:1px solid transparent;text-transform:uppercase}
|
|
112
|
+
.b-ok{background:rgba(34,197,94,.12);border-color:rgba(34,197,94,.25);color:#22c55e}
|
|
113
|
+
.b-bad{background:rgba(239,68,68,.12);border-color:rgba(239,68,68,.25);color:#ef4444}
|
|
114
|
+
.b-warn{background:rgba(234,179,8,.12);border-color:rgba(234,179,8,.25);color:#eab308}
|
|
115
|
+
.b-skip{background:rgba(59,130,246,.10);border-color:rgba(59,130,246,.25);color:#60a5fa}
|
|
116
|
+
.b-block{background:rgba(244,63,94,.10);border-color:rgba(244,63,94,.25);color:#fb7185}
|
|
117
|
+
.danger-tag{font-size:10px;color:#fb7185;margin-left:4px}
|
|
118
|
+
.critical-tag{font-size:10px;color:#f59e0b;background:rgba(245,158,11,.15);padding:2px 6px;border-radius:4px;margin-left:4px}
|
|
119
|
+
.err{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:12px;color:#fca5a5;padding:8px 0;border-bottom:1px solid #171a24}
|
|
120
|
+
.err:last-child{border-bottom:none}
|
|
121
|
+
a{color:#60a5fa;text-decoration:none}
|
|
122
|
+
a:hover{text-decoration:underline}
|
|
123
|
+
.footer{margin-top:20px;padding-top:16px;border-top:1px solid #222634;text-align:center}
|
|
124
|
+
</style>
|
|
125
|
+
</head>
|
|
126
|
+
<body>
|
|
127
|
+
<div class="wrap">
|
|
128
|
+
<div class="top">
|
|
129
|
+
<div>
|
|
130
|
+
<div class="title">🔍 Reality Mode Report</div>
|
|
131
|
+
<div class="dim">${esc(results.meta?.baseUrl)} • ${esc(results.meta?.startedAt)} • ${Math.round((results.duration || 0)/1000)}s</div>
|
|
132
|
+
</div>
|
|
133
|
+
<div class="score">
|
|
134
|
+
<div class="num">${score}</div>
|
|
135
|
+
<div class="meta">
|
|
136
|
+
<div><b>Grade:</b> ${grade}</div>
|
|
137
|
+
<div class="dim">${esc(verdict)}</div>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<div class="grid">
|
|
143
|
+
<div class="stat"><div class="dim">Routes Working</div><div class="v">${cov.routesWorking || 0}/${cov.routesDiscovered || 0}</div></div>
|
|
144
|
+
<div class="stat"><div class="dim">Elements Working</div><div class="v">${cov.elementsWorking || 0}/${cov.elementsDiscovered || 0}</div></div>
|
|
145
|
+
<div class="stat"><div class="dim">Forms Discovered</div><div class="v">${cov.formsDiscovered || 0}</div></div>
|
|
146
|
+
<div class="stat"><div class="dim">Flows Executed</div><div class="v">${(results.flows || []).length}</div></div>
|
|
147
|
+
<div class="stat"><div class="dim">Errors Captured</div><div class="v">${(results.errors || []).length}</div></div>
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
${flowsHtml || `<div class="card"><div class="card-h"><div class="t">Flows</div></div><div style="padding:14px 16px" class="dim">No flows ran. Add flow packs to .vibecheck/flows/ or use --flows-dir</div></div>`}
|
|
151
|
+
|
|
152
|
+
${(results.routes || []).length ? `
|
|
153
|
+
<div class="card">
|
|
154
|
+
<div class="card-h"><div class="t">Routes Discovered</div><span class="dim">${(results.routes || []).length}</span></div>
|
|
155
|
+
<div style="padding:0 16px;max-height:300px;overflow-y:auto">${routesHtml}</div>
|
|
156
|
+
</div>` : ""}
|
|
157
|
+
|
|
158
|
+
${(results.errors || []).length ? `
|
|
159
|
+
<div class="card">
|
|
160
|
+
<div class="card-h"><div class="t">Errors</div>${badge("error")}</div>
|
|
161
|
+
<div style="padding:0 16px;max-height:250px;overflow-y:auto">${errHtml}</div>
|
|
162
|
+
</div>` : ""}
|
|
163
|
+
|
|
164
|
+
<div class="footer dim">
|
|
165
|
+
Generated by vibecheck Reality Mode • <a href="https://vibecheckai.dev">vibecheckai.dev</a>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
</body>
|
|
169
|
+
</html>`;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function writeTimelineHtml(results) {
|
|
173
|
+
const items = (results.timeline || []).map((t, idx) => `
|
|
174
|
+
<div class="it ${esc(t.status)}">
|
|
175
|
+
<div class="h">
|
|
176
|
+
<div class="num">${idx + 1}</div>
|
|
177
|
+
<div class="info">
|
|
178
|
+
<div><b>${esc(t.flowId)}</b> • step ${esc(t.step)} • <span class="action">${esc(t.action)}</span> <span class="dim">${esc(t.name)}</span></div>
|
|
179
|
+
<div class="dim">${esc(t.url)}</div>
|
|
180
|
+
</div>
|
|
181
|
+
<div>${badge(t.status)}</div>
|
|
182
|
+
</div>
|
|
183
|
+
<div class="shots">
|
|
184
|
+
${t.before ? `<a href="${esc(t.before)}" target="_blank">📷 before</a>` : ""}
|
|
185
|
+
${t.after ? `<a href="${esc(t.after)}" target="_blank">📷 after</a>` : ""}
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
`).join("");
|
|
189
|
+
|
|
190
|
+
return `<!doctype html>
|
|
191
|
+
<html lang="en">
|
|
192
|
+
<head>
|
|
193
|
+
<meta charset="utf-8"/>
|
|
194
|
+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
195
|
+
<title>Reality Timeline - vibecheck</title>
|
|
196
|
+
<style>
|
|
197
|
+
*{box-sizing:border-box}
|
|
198
|
+
body{margin:0;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;background:#0b0b0f;color:#eaeaf0;line-height:1.5}
|
|
199
|
+
.wrap{max-width:1100px;margin:0 auto;padding:24px}
|
|
200
|
+
h2{margin:0 0 8px 0;font-size:20px}
|
|
201
|
+
.dim{color:#9aa0aa;font-size:12px}
|
|
202
|
+
.it{background:#0f1118;border:1px solid #222634;border-radius:14px;padding:12px 14px;margin-top:10px}
|
|
203
|
+
.h{display:flex;gap:12px;align-items:center}
|
|
204
|
+
.num{width:28px;height:28px;background:#1e2130;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:800;flex-shrink:0}
|
|
205
|
+
.info{flex:1;min-width:0}
|
|
206
|
+
.action{color:#60a5fa}
|
|
207
|
+
.shots{margin-top:8px;font-size:12px;padding-left:40px}
|
|
208
|
+
a{color:#60a5fa;margin-right:12px;text-decoration:none}
|
|
209
|
+
a:hover{text-decoration:underline}
|
|
210
|
+
.b{font-size:10px;font-weight:800;padding:2px 6px;border-radius:999px;text-transform:uppercase}
|
|
211
|
+
.b-ok{background:rgba(34,197,94,.12);color:#22c55e}
|
|
212
|
+
.b-bad{background:rgba(239,68,68,.12);color:#ef4444}
|
|
213
|
+
.b-warn{background:rgba(234,179,8,.12);color:#eab308}
|
|
214
|
+
.b-skip{background:rgba(59,130,246,.10);color:#60a5fa}
|
|
215
|
+
.b-block{background:rgba(244,63,94,.10);color:#fb7185}
|
|
216
|
+
</style>
|
|
217
|
+
</head>
|
|
218
|
+
<body>
|
|
219
|
+
<div class="wrap">
|
|
220
|
+
<h2>🧭 Reality Timeline</h2>
|
|
221
|
+
<div class="dim" style="margin-bottom:16px">${esc(results.meta?.baseUrl)} • ${esc(results.meta?.startedAt)} • ${(results.timeline || []).length} steps</div>
|
|
222
|
+
${items || `<div class="dim">No timeline items recorded.</div>`}
|
|
223
|
+
</div>
|
|
224
|
+
</body>
|
|
225
|
+
</html>`;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function writeJUnitXml(results) {
|
|
229
|
+
const ts = new Date().toISOString();
|
|
230
|
+
const flows = results.flows || [];
|
|
231
|
+
let tests = 0;
|
|
232
|
+
let failures = 0;
|
|
233
|
+
|
|
234
|
+
let cases = "";
|
|
235
|
+
|
|
236
|
+
for (const f of flows) {
|
|
237
|
+
for (const s of (f.steps || [])) {
|
|
238
|
+
tests++;
|
|
239
|
+
const name = `Step: ${f.id} / ${s.action} ${s.name || ""}`.trim();
|
|
240
|
+
if (s.status === "error" || s.status === "blocked") {
|
|
241
|
+
failures++;
|
|
242
|
+
cases += ` <testcase name="${esc(name)}" classname="reality.steps" time="${((s.durationMs || 0) / 1000).toFixed(2)}">
|
|
243
|
+
<failure message="${esc(s.error || s.status)}">${esc(s.error || s.status)}</failure>
|
|
244
|
+
</testcase>\n`;
|
|
245
|
+
} else {
|
|
246
|
+
cases += ` <testcase name="${esc(name)}" classname="reality.steps" time="${((s.durationMs || 0) / 1000).toFixed(2)}"/>\n`;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
for (const a of (f.assertions || [])) {
|
|
251
|
+
if (a.status === "skip") continue;
|
|
252
|
+
tests++;
|
|
253
|
+
const name = `Assert: ${f.id} / ${a.type}`;
|
|
254
|
+
if (a.status === "fail") {
|
|
255
|
+
failures++;
|
|
256
|
+
cases += ` <testcase name="${esc(name)}" classname="reality.assertions">
|
|
257
|
+
<failure message="${esc(a.message)}">${esc(a.message)}</failure>
|
|
258
|
+
</testcase>\n`;
|
|
259
|
+
} else {
|
|
260
|
+
cases += ` <testcase name="${esc(name)}" classname="reality.assertions"/>\n`;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Routes as test cases
|
|
266
|
+
for (const r of (results.routes || [])) {
|
|
267
|
+
tests++;
|
|
268
|
+
const name = `Route: ${r.path}`;
|
|
269
|
+
if (r.status !== "success") {
|
|
270
|
+
failures++;
|
|
271
|
+
cases += ` <testcase name="${esc(name)}" classname="reality.routes">
|
|
272
|
+
<failure message="HTTP ${r.httpStatus || 0}">${esc(r.error || `HTTP ${r.httpStatus}`)}</failure>
|
|
273
|
+
</testcase>\n`;
|
|
274
|
+
} else {
|
|
275
|
+
cases += ` <testcase name="${esc(name)}" classname="reality.routes"/>\n`;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
280
|
+
<testsuites name="vibecheck Reality Mode" tests="${tests}" failures="${failures}" timestamp="${ts}" time="${((results.duration || 0) / 1000).toFixed(2)}">
|
|
281
|
+
<testsuite name="Reality Explorer" tests="${tests}" failures="${failures}" time="${((results.duration || 0) / 1000).toFixed(2)}">
|
|
282
|
+
<properties>
|
|
283
|
+
<property name="score" value="${results.score || 0}"/>
|
|
284
|
+
<property name="baseUrl" value="${esc(results.meta?.baseUrl || "")}"/>
|
|
285
|
+
</properties>
|
|
286
|
+
${cases} </testsuite>
|
|
287
|
+
</testsuites>`;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function writeSarif(results, baseUrl) {
|
|
291
|
+
const sarifResults = [];
|
|
292
|
+
const rules = new Map();
|
|
293
|
+
|
|
294
|
+
function addRule(id, name, level) {
|
|
295
|
+
if (rules.has(id)) return;
|
|
296
|
+
rules.set(id, {
|
|
297
|
+
id,
|
|
298
|
+
shortDescription: { text: name },
|
|
299
|
+
fullDescription: { text: name },
|
|
300
|
+
defaultConfiguration: { level },
|
|
301
|
+
helpUri: "https://vibecheckai.dev/docs/reality-mode",
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// Step failures
|
|
306
|
+
for (const f of (results.flows || [])) {
|
|
307
|
+
for (const s of (f.steps || [])) {
|
|
308
|
+
if (s.status === "error" || s.status === "blocked") {
|
|
309
|
+
addRule("reality/step-failed", "Flow step failed", "warning");
|
|
310
|
+
sarifResults.push({
|
|
311
|
+
ruleId: "reality/step-failed",
|
|
312
|
+
level: "warning",
|
|
313
|
+
message: { text: `${f.id}: ${s.action} failed - ${s.error || s.status}` },
|
|
314
|
+
locations: [{ physicalLocation: { artifactLocation: { uri: baseUrl } } }],
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
for (const a of (f.assertions || [])) {
|
|
320
|
+
if (a.status === "fail") {
|
|
321
|
+
const level = a.critical ? "error" : "warning";
|
|
322
|
+
addRule("reality/assertion-failed", "Assertion failed", level);
|
|
323
|
+
sarifResults.push({
|
|
324
|
+
ruleId: "reality/assertion-failed",
|
|
325
|
+
level,
|
|
326
|
+
message: { text: `${f.id}: ${a.type} - ${a.message}` },
|
|
327
|
+
locations: [{ physicalLocation: { artifactLocation: { uri: baseUrl } } }],
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Route errors
|
|
334
|
+
for (const r of (results.routes || [])) {
|
|
335
|
+
if (r.status !== "success") {
|
|
336
|
+
addRule("reality/route-error", "Route error", "warning");
|
|
337
|
+
sarifResults.push({
|
|
338
|
+
ruleId: "reality/route-error",
|
|
339
|
+
level: "warning",
|
|
340
|
+
message: { text: `Route ${r.path} failed: HTTP ${r.httpStatus || 0}` },
|
|
341
|
+
locations: [{ physicalLocation: { artifactLocation: { uri: baseUrl + (r.path || "") } } }],
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// Console/page errors
|
|
347
|
+
for (const e of (results.errors || [])) {
|
|
348
|
+
addRule("reality/runtime-error", "Runtime error detected", "error");
|
|
349
|
+
sarifResults.push({
|
|
350
|
+
ruleId: "reality/runtime-error",
|
|
351
|
+
level: "error",
|
|
352
|
+
message: { text: `[${e.type}] ${e.message}` },
|
|
353
|
+
locations: [{ physicalLocation: { artifactLocation: { uri: e.url || baseUrl } } }],
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return {
|
|
358
|
+
$schema: "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
|
|
359
|
+
version: "2.1.0",
|
|
360
|
+
runs: [{
|
|
361
|
+
tool: {
|
|
362
|
+
driver: {
|
|
363
|
+
name: "vibecheck Reality Mode",
|
|
364
|
+
version: "2.0.0",
|
|
365
|
+
informationUri: "https://vibecheckai.dev",
|
|
366
|
+
rules: Array.from(rules.values()),
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
results: sarifResults,
|
|
370
|
+
invocations: [{
|
|
371
|
+
executionSuccessful: sarifResults.filter(r => r.level === "error").length === 0,
|
|
372
|
+
endTimeUtc: new Date().toISOString(),
|
|
373
|
+
}],
|
|
374
|
+
}],
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
module.exports = { writeHtmlReport, writeTimelineHtml, writeJUnitXml, writeSarif };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reality Mode Session Runner
|
|
3
|
+
* Manages Playwright browser session, telemetry, and orchestrates flow execution.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
|
|
9
|
+
const { loadFlowPacks } = require("./flows");
|
|
10
|
+
const { runFlowPlan } = require("./engine");
|
|
11
|
+
const { writeHtmlReport, writeTimelineHtml, writeJUnitXml, writeSarif } = require("./report");
|
|
12
|
+
|
|
13
|
+
function safeBaseUrl(url) {
|
|
14
|
+
return String(url || "").replace(/\/+$/, "");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async function runRealitySession(opts) {
|
|
18
|
+
const baseUrl = safeBaseUrl(opts.url);
|
|
19
|
+
const outputDir = path.resolve(opts.output);
|
|
20
|
+
|
|
21
|
+
const artifacts = {
|
|
22
|
+
outputDir,
|
|
23
|
+
screenshotsDir: path.join(outputDir, "screenshots"),
|
|
24
|
+
videosDir: path.join(outputDir, "videos"),
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
fs.mkdirSync(artifacts.outputDir, { recursive: true });
|
|
28
|
+
fs.mkdirSync(artifacts.screenshotsDir, { recursive: true });
|
|
29
|
+
fs.mkdirSync(artifacts.videosDir, { recursive: true });
|
|
30
|
+
|
|
31
|
+
// Lazy require Playwright
|
|
32
|
+
let chromium;
|
|
33
|
+
try {
|
|
34
|
+
({ chromium } = require("playwright"));
|
|
35
|
+
} catch {
|
|
36
|
+
try {
|
|
37
|
+
const pw = require("@playwright/test");
|
|
38
|
+
chromium = pw.chromium;
|
|
39
|
+
} catch {
|
|
40
|
+
throw new Error("Playwright not available. Run: npm i -D playwright && npx playwright install chromium");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const startedAt = Date.now();
|
|
45
|
+
|
|
46
|
+
const browser = await chromium.launch({ headless: !!opts.headless });
|
|
47
|
+
const context = await browser.newContext({
|
|
48
|
+
viewport: { width: 1280, height: 720 },
|
|
49
|
+
recordVideo: { dir: artifacts.videosDir },
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
await context.tracing.start({ screenshots: true, snapshots: true });
|
|
53
|
+
|
|
54
|
+
const page = await context.newPage();
|
|
55
|
+
|
|
56
|
+
// Telemetry buffers for assertions
|
|
57
|
+
const telemetry = {
|
|
58
|
+
console: [],
|
|
59
|
+
pageErrors: [],
|
|
60
|
+
requests: [],
|
|
61
|
+
responses: [],
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
page.on("console", (msg) => {
|
|
65
|
+
telemetry.console.push({
|
|
66
|
+
type: msg.type(),
|
|
67
|
+
text: msg.text(),
|
|
68
|
+
url: page.url(),
|
|
69
|
+
ts: Date.now(),
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
page.on("pageerror", (err) => {
|
|
74
|
+
telemetry.pageErrors.push({
|
|
75
|
+
message: err?.message || String(err),
|
|
76
|
+
url: page.url(),
|
|
77
|
+
ts: Date.now(),
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
page.on("request", (req) => {
|
|
82
|
+
telemetry.requests.push({
|
|
83
|
+
url: req.url(),
|
|
84
|
+
method: req.method(),
|
|
85
|
+
resourceType: req.resourceType(),
|
|
86
|
+
ts: Date.now(),
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
page.on("response", async (res) => {
|
|
91
|
+
telemetry.responses.push({
|
|
92
|
+
url: res.url(),
|
|
93
|
+
status: res.status(),
|
|
94
|
+
method: res.request().method(),
|
|
95
|
+
ts: Date.now(),
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Load flow packs
|
|
100
|
+
const flowsDir = opts.flowsDir
|
|
101
|
+
? path.resolve(opts.flowsDir)
|
|
102
|
+
: path.join(process.cwd(), ".vibecheck", "flows");
|
|
103
|
+
|
|
104
|
+
const flowPacks = loadFlowPacks({
|
|
105
|
+
flowsDir,
|
|
106
|
+
requested: opts.flows,
|
|
107
|
+
debug: !!opts.debug,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Build execution plan
|
|
111
|
+
const plan = {
|
|
112
|
+
baseUrl,
|
|
113
|
+
auth: opts.auth,
|
|
114
|
+
danger: !!opts.danger,
|
|
115
|
+
timeout: opts.timeout,
|
|
116
|
+
maxPages: opts.maxPages,
|
|
117
|
+
flows: flowPacks,
|
|
118
|
+
outputDir,
|
|
119
|
+
artifacts,
|
|
120
|
+
debug: !!opts.debug,
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const results = await runFlowPlan({
|
|
124
|
+
plan,
|
|
125
|
+
page,
|
|
126
|
+
context,
|
|
127
|
+
telemetry,
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
results.duration = Date.now() - startedAt;
|
|
131
|
+
|
|
132
|
+
// Stop trace
|
|
133
|
+
const tracePath = path.join(outputDir, "trace.zip");
|
|
134
|
+
await context.tracing.stop({ path: tracePath }).catch(() => {});
|
|
135
|
+
|
|
136
|
+
await context.close().catch(() => {});
|
|
137
|
+
await browser.close().catch(() => {});
|
|
138
|
+
|
|
139
|
+
// Write outputs
|
|
140
|
+
const jsonPath = path.join(outputDir, "explorer-results.json");
|
|
141
|
+
fs.writeFileSync(jsonPath, JSON.stringify(results, null, 2));
|
|
142
|
+
|
|
143
|
+
const reportPath = path.join(outputDir, "reality-report.html");
|
|
144
|
+
fs.writeFileSync(reportPath, writeHtmlReport(results));
|
|
145
|
+
|
|
146
|
+
const timelinePath = path.join(outputDir, "timeline.html");
|
|
147
|
+
fs.writeFileSync(timelinePath, writeTimelineHtml(results));
|
|
148
|
+
|
|
149
|
+
if (opts.junit) {
|
|
150
|
+
const junitPath = path.join(outputDir, "junit-results.xml");
|
|
151
|
+
fs.writeFileSync(junitPath, writeJUnitXml(results));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (opts.sarif) {
|
|
155
|
+
const sarifPath = path.join(outputDir, "reality-results.sarif");
|
|
156
|
+
fs.writeFileSync(sarifPath, JSON.stringify(writeSarif(results, baseUrl), null, 2));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Console summary
|
|
160
|
+
const c = {
|
|
161
|
+
reset: "\x1b[0m",
|
|
162
|
+
bold: "\x1b[1m",
|
|
163
|
+
dim: "\x1b[2m",
|
|
164
|
+
red: "\x1b[31m",
|
|
165
|
+
green: "\x1b[32m",
|
|
166
|
+
yellow: "\x1b[33m",
|
|
167
|
+
cyan: "\x1b[36m",
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const score = results.score ?? 0;
|
|
171
|
+
const scoreColor = score >= 80 ? c.green : score >= 60 ? c.yellow : c.red;
|
|
172
|
+
|
|
173
|
+
console.log(`\n${c.bold}${c.cyan}══════════════════════════════════════════════════════════${c.reset}`);
|
|
174
|
+
console.log(` ${c.bold}REALITY MODE COMPLETE${c.reset}`);
|
|
175
|
+
console.log(`${c.bold}${c.cyan}══════════════════════════════════════════════════════════${c.reset}`);
|
|
176
|
+
console.log(` ${c.bold}Score:${c.reset} ${scoreColor}${score}/100${c.reset}`);
|
|
177
|
+
console.log(` 📊 Routes: ${results.coverage?.routesWorking || 0}/${results.coverage?.routesDiscovered || 0} working`);
|
|
178
|
+
console.log(` 🔘 Elements: ${results.coverage?.elementsWorking || 0}/${results.coverage?.elementsDiscovered || 0} working`);
|
|
179
|
+
console.log(` 📝 Forms: ${results.coverage?.formsDiscovered || 0} discovered`);
|
|
180
|
+
console.log(` 🧭 Flows: ${results.flows?.length || 0} executed`);
|
|
181
|
+
console.log(` ❌ Errors: ${(results.errors?.length || 0)} captured`);
|
|
182
|
+
console.log(` ${c.bold}📄 Report:${c.reset} ${reportPath}`);
|
|
183
|
+
console.log(` ${c.bold}🧭 Timeline:${c.reset} ${timelinePath}`);
|
|
184
|
+
console.log(` ${c.bold}🔍 Trace:${c.reset} ${tracePath}`);
|
|
185
|
+
console.log(`${c.bold}${c.cyan}══════════════════════════════════════════════════════════${c.reset}\n`);
|
|
186
|
+
|
|
187
|
+
return {
|
|
188
|
+
score,
|
|
189
|
+
exitCode: 0,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
module.exports = { runRealitySession };
|