@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,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replay Module
|
|
3
|
+
*
|
|
4
|
+
* Provides a unified API for recording and replaying user interactions
|
|
5
|
+
* with the ability to verify behavior and detect regressions.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const fs = require('fs').promises;
|
|
10
|
+
const debug = require('debug')('vibecheck:replay');
|
|
11
|
+
|
|
12
|
+
// Core components
|
|
13
|
+
const CapsuleManager = require('./capsule-manager');
|
|
14
|
+
const ReplayRecorder = require('./recorder');
|
|
15
|
+
const ReplayPlayer = require('./player');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Main Replay API
|
|
19
|
+
*/
|
|
20
|
+
class ReplayEngine {
|
|
21
|
+
constructor(options = {}) {
|
|
22
|
+
this.options = {
|
|
23
|
+
basePath: process.cwd(),
|
|
24
|
+
...options
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
this.manager = new CapsuleManager(this.options.basePath);
|
|
28
|
+
this.recorder = null;
|
|
29
|
+
this.player = null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Initialize the replay system
|
|
34
|
+
*/
|
|
35
|
+
async init() {
|
|
36
|
+
await this.manager.init();
|
|
37
|
+
debug('Replay engine initialized');
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Start a new recording session
|
|
43
|
+
*/
|
|
44
|
+
startRecording(options = {}) {
|
|
45
|
+
if (this.recorder) {
|
|
46
|
+
throw new Error('Recording already in progress');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
this.recorder = new ReplayRecorder({
|
|
50
|
+
...options,
|
|
51
|
+
basePath: this.options.basePath
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
this.recorder.start();
|
|
55
|
+
debug('Started new recording session');
|
|
56
|
+
|
|
57
|
+
return this.recorder;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Stop the current recording and save as a capsule
|
|
62
|
+
*/
|
|
63
|
+
async stopRecording(saveOptions = {}) {
|
|
64
|
+
if (!this.recorder) {
|
|
65
|
+
throw new Error('No active recording to stop');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const result = this.recorder.stop();
|
|
69
|
+
const { id, path: capsulePath } = await this.recorder.save(this.options.basePath);
|
|
70
|
+
|
|
71
|
+
debug(`Recording saved as capsule: ${id} (${capsulePath})`);
|
|
72
|
+
|
|
73
|
+
this.recorder = null;
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
id,
|
|
77
|
+
path: capsulePath,
|
|
78
|
+
metadata: result.metadata
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* List available replay capsules
|
|
84
|
+
*/
|
|
85
|
+
async listCapsules() {
|
|
86
|
+
return this.manager.listCapsules();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Get a replay capsule by ID or path
|
|
91
|
+
*/
|
|
92
|
+
async getCapsule(idOrPath) {
|
|
93
|
+
return this.manager.loadCapsule(idOrPath);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Delete a replay capsule
|
|
98
|
+
*/
|
|
99
|
+
async deleteCapsule(idOrPath) {
|
|
100
|
+
return this.manager.deleteCapsule(idOrPath);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Export a capsule to a portable format
|
|
105
|
+
*/
|
|
106
|
+
async exportCapsule(idOrPath, outputPath) {
|
|
107
|
+
return this.manager.exportCapsule(idOrPath, outputPath);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Import a capsule from a file
|
|
112
|
+
*/
|
|
113
|
+
async importCapsule(filePath) {
|
|
114
|
+
return this.manager.importCapsule(filePath);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Create a new replay player for a capsule
|
|
119
|
+
*/
|
|
120
|
+
createPlayer(options = {}) {
|
|
121
|
+
if (this.player) {
|
|
122
|
+
throw new Error('A player is already active');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
this.player = new ReplayPlayer({
|
|
126
|
+
...this.options,
|
|
127
|
+
...options
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
return this.player;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Play a replay capsule
|
|
135
|
+
*/
|
|
136
|
+
async playCapsule(capsule, options = {}) {
|
|
137
|
+
const player = this.createPlayer(options);
|
|
138
|
+
await player.loadCapsule(capsule);
|
|
139
|
+
|
|
140
|
+
if (options.browser) {
|
|
141
|
+
await player.setupPlaywright(options.browser);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return player.play();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Create a Playwright recorder
|
|
149
|
+
*/
|
|
150
|
+
createPlaywrightRecorder(page, options = {}) {
|
|
151
|
+
return ReplayRecorder.fromPlaywright(page, {
|
|
152
|
+
...this.options,
|
|
153
|
+
...options
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Clean up resources
|
|
159
|
+
*/
|
|
160
|
+
async cleanup() {
|
|
161
|
+
if (this.player) {
|
|
162
|
+
await this.player.close().catch(console.error);
|
|
163
|
+
this.player = null;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (this.recorder) {
|
|
167
|
+
this.recorder.stop();
|
|
168
|
+
this.recorder = null;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Export everything
|
|
174
|
+
module.exports = {
|
|
175
|
+
// Main API
|
|
176
|
+
ReplayEngine,
|
|
177
|
+
|
|
178
|
+
// Core components
|
|
179
|
+
CapsuleManager,
|
|
180
|
+
ReplayRecorder,
|
|
181
|
+
ReplayPlayer,
|
|
182
|
+
|
|
183
|
+
// Factory function for quick setup
|
|
184
|
+
createReplayEngine: async (options = {}) => {
|
|
185
|
+
const engine = new ReplayEngine(options);
|
|
186
|
+
await engine.init();
|
|
187
|
+
return engine;
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
// Utility functions
|
|
191
|
+
utils: {
|
|
192
|
+
/**
|
|
193
|
+
* Generate a human-readable report from replay results
|
|
194
|
+
*/
|
|
195
|
+
generateReport: (results) => {
|
|
196
|
+
const { metadata, stats } = results;
|
|
197
|
+
const { name, description, duration, steps } = metadata;
|
|
198
|
+
const { passed, failed, skipped } = stats;
|
|
199
|
+
|
|
200
|
+
return {
|
|
201
|
+
title: `Replay Report: ${name}`,
|
|
202
|
+
summary: {
|
|
203
|
+
description,
|
|
204
|
+
duration: `${(duration / 1000).toFixed(2)}s`,
|
|
205
|
+
totalSteps: steps,
|
|
206
|
+
passed,
|
|
207
|
+
failed,
|
|
208
|
+
skipped,
|
|
209
|
+
success: failed === 0
|
|
210
|
+
},
|
|
211
|
+
timestamp: new Date().toISOString(),
|
|
212
|
+
details: results.steps ? results.steps.map(step => ({
|
|
213
|
+
id: step.id,
|
|
214
|
+
type: step.type,
|
|
215
|
+
status: step.error ? 'failed' : 'passed',
|
|
216
|
+
duration: step.duration ? `${step.duration.toFixed(2)}ms` : 'N/A',
|
|
217
|
+
error: step.error ? step.error.message : null
|
|
218
|
+
})) : []
|
|
219
|
+
};
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Compare two replay results to detect regressions
|
|
224
|
+
*/
|
|
225
|
+
compareResults: (baseline, current) => {
|
|
226
|
+
const regressions = [];
|
|
227
|
+
|
|
228
|
+
// Check step counts
|
|
229
|
+
if (baseline.stats.totalSteps !== current.stats.totalSteps) {
|
|
230
|
+
regressions.push({
|
|
231
|
+
type: 'step_count_mismatch',
|
|
232
|
+
message: `Different number of steps: ${baseline.stats.totalSteps} vs ${current.stats.totalSteps}`
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Check for new failures
|
|
237
|
+
if (current.stats.failed > baseline.stats.failed) {
|
|
238
|
+
regressions.push({
|
|
239
|
+
type: 'new_failures',
|
|
240
|
+
message: `New failures: ${current.stats.failed - baseline.stats.failed} more than baseline`
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// Check for performance regressions (if timing data is available)
|
|
245
|
+
if (baseline.metadata.duration && current.metadata.duration) {
|
|
246
|
+
const threshold = baseline.metadata.duration * 1.5; // 50% slower
|
|
247
|
+
if (current.metadata.duration > threshold) {
|
|
248
|
+
regressions.push({
|
|
249
|
+
type: 'performance_regression',
|
|
250
|
+
message: `Performance regression: ${(current.metadata.duration / 1000).toFixed(2)}s vs baseline ${(baseline.metadata.duration / 1000).toFixed(2)}s`
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return {
|
|
256
|
+
hasRegressions: regressions.length > 0,
|
|
257
|
+
regressions,
|
|
258
|
+
baseline: baseline.stats,
|
|
259
|
+
current: current.stats
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
};
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replay Player
|
|
3
|
+
* Replays recorded user interactions and verifies behavior
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const { EventEmitter } = require('events');
|
|
7
|
+
const { performance } = require('perf_hooks');
|
|
8
|
+
const fs = require('fs').promises;
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const debug = require('debug')('vibecheck:replay:player');
|
|
11
|
+
|
|
12
|
+
class ReplayPlayer extends EventEmitter {
|
|
13
|
+
constructor(options = {}) {
|
|
14
|
+
super();
|
|
15
|
+
this.options = {
|
|
16
|
+
speed: 1.0,
|
|
17
|
+
headless: true,
|
|
18
|
+
viewport: { width: 1280, height: 800 },
|
|
19
|
+
waitForNetworkIdle: true,
|
|
20
|
+
networkIdleTimeout: 500,
|
|
21
|
+
waitForSelectorTimeout: 30000,
|
|
22
|
+
...options
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
this.state = 'idle';
|
|
26
|
+
this.currentStep = 0;
|
|
27
|
+
this.stats = {
|
|
28
|
+
totalSteps: 0,
|
|
29
|
+
passed: 0,
|
|
30
|
+
failed: 0,
|
|
31
|
+
skipped: 0,
|
|
32
|
+
startTime: null,
|
|
33
|
+
endTime: null,
|
|
34
|
+
duration: 0
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
this.page = null;
|
|
38
|
+
this.capsule = null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async loadCapsule(capsulePath) {
|
|
42
|
+
this.state = 'loading';
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
// Load from file if it's a path
|
|
46
|
+
if (typeof capsulePath === 'string') {
|
|
47
|
+
const data = await fs.readFile(capsulePath, 'utf8');
|
|
48
|
+
this.capsule = JSON.parse(data);
|
|
49
|
+
}
|
|
50
|
+
// Or use the provided capsule object
|
|
51
|
+
else if (capsulePath.metadata && Array.isArray(capsulePath.steps)) {
|
|
52
|
+
this.capsule = capsulePath;
|
|
53
|
+
}
|
|
54
|
+
// Or load from a directory containing metadata.json and steps.json
|
|
55
|
+
else if (typeof capsulePath === 'object' && capsulePath.path) {
|
|
56
|
+
const [metadata, steps] = await Promise.all([
|
|
57
|
+
fs.readFile(path.join(capsulePath.path, 'metadata.json'), 'utf8')
|
|
58
|
+
.then(JSON.parse),
|
|
59
|
+
fs.readFile(path.join(capsulePath.path, 'steps.json'), 'utf8')
|
|
60
|
+
.then(JSON.parse)
|
|
61
|
+
]);
|
|
62
|
+
this.capsule = { metadata, steps };
|
|
63
|
+
} else {
|
|
64
|
+
throw new Error('Invalid capsule format');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
this.stats.totalSteps = this.capsule.steps.length;
|
|
68
|
+
this.state = 'loaded';
|
|
69
|
+
this.emit('loaded', { steps: this.stats.totalSteps });
|
|
70
|
+
|
|
71
|
+
return this.capsule;
|
|
72
|
+
} catch (error) {
|
|
73
|
+
this.state = 'error';
|
|
74
|
+
this.emit('error', { error, phase: 'load' });
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async setupPlaywright(browser) {
|
|
80
|
+
if (this.page) return this.page;
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
const context = await browser.newContext({
|
|
84
|
+
viewport: this.capsule.metadata.viewport || this.options.viewport,
|
|
85
|
+
userAgent: this.capsule.metadata.userAgent,
|
|
86
|
+
ignoreHTTPSErrors: true
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
this.page = await context.newPage();
|
|
90
|
+
|
|
91
|
+
// Set up request/response tracking
|
|
92
|
+
this._setupNetworkMonitoring();
|
|
93
|
+
|
|
94
|
+
return this.page;
|
|
95
|
+
} catch (error) {
|
|
96
|
+
this.state = 'error';
|
|
97
|
+
this.emit('error', { error, phase: 'setup' });
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
_setupNetworkMonitoring() {
|
|
103
|
+
if (!this.page) return;
|
|
104
|
+
|
|
105
|
+
this.pendingRequests = new Set();
|
|
106
|
+
|
|
107
|
+
this.page.on('request', request => {
|
|
108
|
+
if (this.options.waitForNetworkIdle) {
|
|
109
|
+
this.pendingRequests.add(request);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
this.page.on('requestfinished', request => {
|
|
114
|
+
this.pendingRequests.delete(request);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
this.page.on('requestfailed', request => {
|
|
118
|
+
this.pendingRequests.delete(request);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async waitForNetworkIdle() {
|
|
123
|
+
if (!this.options.waitForNetworkIdle || !this.page) return;
|
|
124
|
+
|
|
125
|
+
const start = performance.now();
|
|
126
|
+
let hasPending = false;
|
|
127
|
+
|
|
128
|
+
do {
|
|
129
|
+
hasPending = this.pendingRequests.size > 0;
|
|
130
|
+
|
|
131
|
+
if (hasPending) {
|
|
132
|
+
await new Promise(r => setTimeout(r, 50));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (performance.now() - start > this.options.networkIdleTimeout) {
|
|
136
|
+
debug(`Network idle timeout after ${this.options.networkIdleTimeout}ms`);
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
} while (hasPending);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async play() {
|
|
143
|
+
if (this.state !== 'loaded') {
|
|
144
|
+
throw new Error('No capsule loaded. Call loadCapsule() first.');
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
this.state = 'playing';
|
|
148
|
+
this.currentStep = 0;
|
|
149
|
+
this.stats.startTime = performance.now();
|
|
150
|
+
this.stats.passed = 0;
|
|
151
|
+
this.stats.failed = 0;
|
|
152
|
+
this.stats.skipped = 0;
|
|
153
|
+
|
|
154
|
+
this.emit('start', { steps: this.stats.totalSteps });
|
|
155
|
+
|
|
156
|
+
try {
|
|
157
|
+
for (const step of this.capsule.steps) {
|
|
158
|
+
this.currentStep++;
|
|
159
|
+
this.emit('stepStart', { step: this.currentStep, total: this.stats.totalSteps, type: step.type });
|
|
160
|
+
|
|
161
|
+
try {
|
|
162
|
+
await this._executeStep(step);
|
|
163
|
+
this.stats.passed++;
|
|
164
|
+
this.emit('stepPass', {
|
|
165
|
+
step: this.currentStep,
|
|
166
|
+
type: step.type,
|
|
167
|
+
duration: performance.now() - (step.timestamp || 0)
|
|
168
|
+
});
|
|
169
|
+
} catch (error) {
|
|
170
|
+
this.stats.failed++;
|
|
171
|
+
this.emit('stepFail', {
|
|
172
|
+
step: this.currentStep,
|
|
173
|
+
type: step.type,
|
|
174
|
+
error,
|
|
175
|
+
duration: performance.now() - (step.timestamp || 0)
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
if (this.options.stopOnFailure) {
|
|
179
|
+
throw error;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Apply speed factor to timing
|
|
184
|
+
if (this.currentStep < this.capsule.steps.length - 1) {
|
|
185
|
+
const nextStep = this.capsule.steps[this.currentStep];
|
|
186
|
+
const currentTime = step.timestamp || 0;
|
|
187
|
+
const nextTime = nextStep.timestamp || 0;
|
|
188
|
+
const delay = (nextTime - currentTime) / this.options.speed;
|
|
189
|
+
|
|
190
|
+
if (delay > 0) {
|
|
191
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
this.stats.endTime = performance.now();
|
|
197
|
+
this.stats.duration = this.stats.endTime - this.stats.startTime;
|
|
198
|
+
this.state = 'completed';
|
|
199
|
+
|
|
200
|
+
const result = {
|
|
201
|
+
...this.stats,
|
|
202
|
+
success: this.stats.failed === 0,
|
|
203
|
+
capsule: this.capsule.metadata
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
this.emit('complete', result);
|
|
207
|
+
return result;
|
|
208
|
+
} catch (error) {
|
|
209
|
+
this.state = 'error';
|
|
210
|
+
this.emit('error', {
|
|
211
|
+
error,
|
|
212
|
+
step: this.currentStep,
|
|
213
|
+
phase: 'playback'
|
|
214
|
+
});
|
|
215
|
+
throw error;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
async _executeStep(step) {
|
|
220
|
+
if (!this.page) {
|
|
221
|
+
throw new Error('No page available. Call setupPlaywright() first.');
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
debug(`Executing step: ${step.type}`, { step });
|
|
225
|
+
|
|
226
|
+
switch (step.type) {
|
|
227
|
+
case 'navigation':
|
|
228
|
+
await this.page.goto(step.url, {
|
|
229
|
+
waitUntil: 'networkidle',
|
|
230
|
+
timeout: this.options.waitForSelectorTimeout
|
|
231
|
+
});
|
|
232
|
+
break;
|
|
233
|
+
|
|
234
|
+
case 'click':
|
|
235
|
+
if (step.selector) {
|
|
236
|
+
await this.page.waitForSelector(step.selector, {
|
|
237
|
+
state: 'visible',
|
|
238
|
+
timeout: this.options.waitForSelectorTimeout
|
|
239
|
+
});
|
|
240
|
+
await this.page.click(step.selector, {
|
|
241
|
+
button: step.button,
|
|
242
|
+
clickCount: step.clickCount || 1,
|
|
243
|
+
delay: 50
|
|
244
|
+
});
|
|
245
|
+
} else if (step.x !== undefined && step.y !== undefined) {
|
|
246
|
+
await this.page.mouse.click(step.x, step.y, {
|
|
247
|
+
button: step.button,
|
|
248
|
+
clickCount: step.clickCount || 1,
|
|
249
|
+
delay: 50
|
|
250
|
+
});
|
|
251
|
+
} else {
|
|
252
|
+
throw new Error('Click step requires either selector or x,y coordinates');
|
|
253
|
+
}
|
|
254
|
+
break;
|
|
255
|
+
|
|
256
|
+
case 'input':
|
|
257
|
+
if (!step.selector) {
|
|
258
|
+
throw new Error('Input step requires a selector');
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
await this.page.waitForSelector(step.selector, {
|
|
262
|
+
state: 'visible',
|
|
263
|
+
timeout: this.options.waitForSelectorTimeout
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
// Clear existing value first
|
|
267
|
+
await this.page.$eval(step.selector, el => {
|
|
268
|
+
if (el) el.value = '';
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
// Type the new value
|
|
272
|
+
await this.page.type(step.selector, step.value || '', {
|
|
273
|
+
delay: 20 // Simulate realistic typing
|
|
274
|
+
});
|
|
275
|
+
break;
|
|
276
|
+
|
|
277
|
+
case 'keypress':
|
|
278
|
+
if (step.key) {
|
|
279
|
+
await this.page.keyboard.press(step.key, {
|
|
280
|
+
delay: 20
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
break;
|
|
284
|
+
|
|
285
|
+
case 'network_request':
|
|
286
|
+
// Just verify the request was made, no action needed
|
|
287
|
+
break;
|
|
288
|
+
|
|
289
|
+
case 'network_response':
|
|
290
|
+
// Verify response status if expected
|
|
291
|
+
if (step.expectedStatus && step.status !== step.expectedStatus) {
|
|
292
|
+
throw new Error(`Expected status ${step.expectedStatus} but got ${step.status}`);
|
|
293
|
+
}
|
|
294
|
+
break;
|
|
295
|
+
|
|
296
|
+
case 'custom_assert':
|
|
297
|
+
// Execute custom assertion
|
|
298
|
+
if (typeof step.assert === 'function') {
|
|
299
|
+
const result = await step.assert(this.page);
|
|
300
|
+
if (result === false) {
|
|
301
|
+
throw new Error('Custom assertion failed');
|
|
302
|
+
} else if (result && result.message) {
|
|
303
|
+
throw new Error(`Assertion failed: ${result.message}`);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
break;
|
|
307
|
+
|
|
308
|
+
default:
|
|
309
|
+
debug(`Skipping unsupported step type: ${step.type}`);
|
|
310
|
+
this.stats.skipped++;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// Wait for network to be idle after each step
|
|
314
|
+
await this.waitForNetworkIdle();
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
async takeScreenshot(options = {}) {
|
|
318
|
+
if (!this.page) return null;
|
|
319
|
+
|
|
320
|
+
const defaultPath = path.join(
|
|
321
|
+
process.cwd(),
|
|
322
|
+
'screenshots',
|
|
323
|
+
`screenshot-${Date.now()}.png`
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
const screenshotPath = options.path || defaultPath;
|
|
327
|
+
await fs.mkdir(path.dirname(screenshotPath), { recursive: true });
|
|
328
|
+
|
|
329
|
+
await this.page.screenshot({
|
|
330
|
+
path: screenshotPath,
|
|
331
|
+
fullPage: options.fullPage !== false,
|
|
332
|
+
...options
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
return screenshotPath;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
async close() {
|
|
339
|
+
if (this.page) {
|
|
340
|
+
await this.page.close().catch(console.error);
|
|
341
|
+
this.page = null;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
this.state = 'idle';
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
module.exports = ReplayPlayer;
|