vibecheck-ai 2.0.2 → 5.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/bin/.generated +25 -0
- package/bin/_deprecations.js +463 -0
- package/bin/_router.js +46 -0
- package/bin/cli-hygiene.js +241 -0
- package/bin/dev/run-v2-torture.js +30 -0
- package/bin/registry.js +656 -0
- package/bin/runners/CLI_REFACTOR_SUMMARY.md +229 -0
- package/bin/runners/ENHANCEMENT_GUIDE.md +121 -0
- package/bin/runners/REPORT_AUDIT.md +64 -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 +513 -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-enhanced.js +2525 -0
- package/bin/runners/context/generators/cursor.js +514 -0
- package/bin/runners/context/generators/mcp.js +169 -0
- package/bin/runners/context/generators/windsurf.js +180 -0
- package/bin/runners/context/git-context.js +304 -0
- package/bin/runners/context/index.js +1110 -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 +1264 -0
- package/bin/runners/context/security-scanner.js +541 -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 +336 -0
- package/bin/runners/lib/__tests__/entitlements-v2.test.js +295 -0
- package/bin/runners/lib/agent-firewall/ai/false-positive-analyzer.js +474 -0
- package/bin/runners/lib/agent-firewall/change-packet/builder.js +488 -0
- package/bin/runners/lib/agent-firewall/change-packet/schema.json +228 -0
- package/bin/runners/lib/agent-firewall/change-packet/store.js +200 -0
- package/bin/runners/lib/agent-firewall/claims/claim-types.js +21 -0
- package/bin/runners/lib/agent-firewall/claims/extractor.js +303 -0
- package/bin/runners/lib/agent-firewall/claims/patterns.js +24 -0
- package/bin/runners/lib/agent-firewall/critic/index.js +151 -0
- package/bin/runners/lib/agent-firewall/critic/judge.js +432 -0
- package/bin/runners/lib/agent-firewall/critic/prompts.js +305 -0
- package/bin/runners/lib/agent-firewall/enforcement/gateway.js +1059 -0
- package/bin/runners/lib/agent-firewall/enforcement/index.js +98 -0
- package/bin/runners/lib/agent-firewall/enforcement/mode.js +318 -0
- package/bin/runners/lib/agent-firewall/enforcement/orchestrator.js +484 -0
- package/bin/runners/lib/agent-firewall/enforcement/proof-artifact.js +418 -0
- package/bin/runners/lib/agent-firewall/enforcement/schemas/change-event.schema.json +173 -0
- package/bin/runners/lib/agent-firewall/enforcement/schemas/intent.schema.json +181 -0
- package/bin/runners/lib/agent-firewall/enforcement/schemas/verdict.schema.json +222 -0
- package/bin/runners/lib/agent-firewall/enforcement/verdict-v2.js +333 -0
- package/bin/runners/lib/agent-firewall/evidence/auth-evidence.js +88 -0
- package/bin/runners/lib/agent-firewall/evidence/contract-evidence.js +75 -0
- package/bin/runners/lib/agent-firewall/evidence/env-evidence.js +127 -0
- package/bin/runners/lib/agent-firewall/evidence/resolver.js +102 -0
- package/bin/runners/lib/agent-firewall/evidence/route-evidence.js +213 -0
- package/bin/runners/lib/agent-firewall/evidence/side-effect-evidence.js +145 -0
- package/bin/runners/lib/agent-firewall/fs-hook/daemon.js +19 -0
- package/bin/runners/lib/agent-firewall/fs-hook/installer.js +87 -0
- package/bin/runners/lib/agent-firewall/fs-hook/watcher.js +184 -0
- package/bin/runners/lib/agent-firewall/git-hook/pre-commit.js +163 -0
- package/bin/runners/lib/agent-firewall/ide-extension/cursor.js +107 -0
- package/bin/runners/lib/agent-firewall/ide-extension/vscode.js +68 -0
- package/bin/runners/lib/agent-firewall/ide-extension/windsurf.js +66 -0
- package/bin/runners/lib/agent-firewall/index.js +200 -0
- package/bin/runners/lib/agent-firewall/integration/index.js +20 -0
- package/bin/runners/lib/agent-firewall/integration/ship-gate.js +437 -0
- package/bin/runners/lib/agent-firewall/intent/alignment-engine.js +634 -0
- package/bin/runners/lib/agent-firewall/intent/auto-detect.js +426 -0
- package/bin/runners/lib/agent-firewall/intent/index.js +102 -0
- package/bin/runners/lib/agent-firewall/intent/schema.js +352 -0
- package/bin/runners/lib/agent-firewall/intent/store.js +283 -0
- package/bin/runners/lib/agent-firewall/interception/fs-interceptor.js +502 -0
- package/bin/runners/lib/agent-firewall/interception/index.js +23 -0
- package/bin/runners/lib/agent-firewall/interceptor/base.js +308 -0
- package/bin/runners/lib/agent-firewall/interceptor/cursor.js +35 -0
- package/bin/runners/lib/agent-firewall/interceptor/vscode.js +35 -0
- package/bin/runners/lib/agent-firewall/interceptor/windsurf.js +34 -0
- package/bin/runners/lib/agent-firewall/lawbook/distributor.js +465 -0
- package/bin/runners/lib/agent-firewall/lawbook/evaluator.js +604 -0
- package/bin/runners/lib/agent-firewall/lawbook/index.js +304 -0
- package/bin/runners/lib/agent-firewall/lawbook/registry.js +514 -0
- package/bin/runners/lib/agent-firewall/lawbook/schema.js +420 -0
- package/bin/runners/lib/agent-firewall/logger.js +141 -0
- package/bin/runners/lib/agent-firewall/policy/default-policy.json +90 -0
- package/bin/runners/lib/agent-firewall/policy/engine.js +103 -0
- package/bin/runners/lib/agent-firewall/policy/loader.js +451 -0
- package/bin/runners/lib/agent-firewall/policy/rules/auth-drift.js +50 -0
- package/bin/runners/lib/agent-firewall/policy/rules/contract-drift.js +50 -0
- package/bin/runners/lib/agent-firewall/policy/rules/fake-success.js +79 -0
- package/bin/runners/lib/agent-firewall/policy/rules/ghost-env.js +227 -0
- package/bin/runners/lib/agent-firewall/policy/rules/ghost-route.js +191 -0
- package/bin/runners/lib/agent-firewall/policy/rules/scope.js +93 -0
- package/bin/runners/lib/agent-firewall/policy/rules/unsafe-side-effect.js +57 -0
- package/bin/runners/lib/agent-firewall/policy/schema.json +183 -0
- package/bin/runners/lib/agent-firewall/policy/verdict.js +54 -0
- package/bin/runners/lib/agent-firewall/proposal/extractor.js +394 -0
- package/bin/runners/lib/agent-firewall/proposal/index.js +212 -0
- package/bin/runners/lib/agent-firewall/proposal/schema.js +251 -0
- package/bin/runners/lib/agent-firewall/proposal/validator.js +386 -0
- package/bin/runners/lib/agent-firewall/reality/index.js +332 -0
- package/bin/runners/lib/agent-firewall/reality/state.js +625 -0
- package/bin/runners/lib/agent-firewall/reality/watcher.js +322 -0
- package/bin/runners/lib/agent-firewall/risk/index.js +173 -0
- package/bin/runners/lib/agent-firewall/risk/scorer.js +328 -0
- package/bin/runners/lib/agent-firewall/risk/thresholds.js +322 -0
- package/bin/runners/lib/agent-firewall/risk/vectors.js +421 -0
- package/bin/runners/lib/agent-firewall/session/collector.js +451 -0
- package/bin/runners/lib/agent-firewall/session/index.js +26 -0
- package/bin/runners/lib/agent-firewall/simulator/diff-simulator.js +472 -0
- package/bin/runners/lib/agent-firewall/simulator/import-resolver.js +346 -0
- package/bin/runners/lib/agent-firewall/simulator/index.js +181 -0
- package/bin/runners/lib/agent-firewall/simulator/route-validator.js +380 -0
- package/bin/runners/lib/agent-firewall/time-machine/incident-correlator.js +661 -0
- package/bin/runners/lib/agent-firewall/time-machine/index.js +267 -0
- package/bin/runners/lib/agent-firewall/time-machine/replay-engine.js +436 -0
- package/bin/runners/lib/agent-firewall/time-machine/state-reconstructor.js +490 -0
- package/bin/runners/lib/agent-firewall/time-machine/timeline-builder.js +530 -0
- package/bin/runners/lib/agent-firewall/truthpack/index.js +67 -0
- package/bin/runners/lib/agent-firewall/truthpack/loader.js +137 -0
- package/bin/runners/lib/agent-firewall/unblock/planner.js +337 -0
- package/bin/runners/lib/agent-firewall/utils/ignore-checker.js +118 -0
- package/bin/runners/lib/ai-bridge.js +416 -0
- package/bin/runners/lib/analysis-core.js +309 -0
- package/bin/runners/lib/analyzers.js +2500 -0
- package/bin/runners/lib/api-client.js +269 -0
- package/bin/runners/lib/approve-output.js +235 -0
- package/bin/runners/lib/artifact-envelope.js +540 -0
- package/bin/runners/lib/assets/vibecheck-logo.png +0 -0
- package/bin/runners/lib/audit-bridge.js +391 -0
- package/bin/runners/lib/auth-shared.js +977 -0
- package/bin/runners/lib/auth-truth.js +193 -0
- package/bin/runners/lib/auth.js +215 -0
- package/bin/runners/lib/authority-badge.js +425 -0
- package/bin/runners/lib/backup.js +62 -0
- package/bin/runners/lib/billing.js +107 -0
- package/bin/runners/lib/checkpoint.js +941 -0
- package/bin/runners/lib/claims.js +118 -0
- package/bin/runners/lib/classify-output.js +204 -0
- package/bin/runners/lib/cleanup/engine.js +571 -0
- package/bin/runners/lib/cleanup/index.js +53 -0
- package/bin/runners/lib/cleanup/output.js +375 -0
- package/bin/runners/lib/cleanup/rules.js +1060 -0
- package/bin/runners/lib/cli-output.js +400 -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 +202 -0
- package/bin/runners/lib/contracts/env-contract.js +181 -0
- package/bin/runners/lib/contracts/external-contract.js +206 -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 +199 -0
- package/bin/runners/lib/contracts.js +804 -0
- package/bin/runners/lib/default-config.js +127 -0
- package/bin/runners/lib/detect.js +89 -0
- package/bin/runners/lib/detectors-v2.js +622 -0
- package/bin/runners/lib/doctor/autofix.js +254 -0
- package/bin/runners/lib/doctor/diagnosis-receipt.js +454 -0
- package/bin/runners/lib/doctor/failure-signatures.js +526 -0
- package/bin/runners/lib/doctor/fix-script.js +336 -0
- package/bin/runners/lib/doctor/index.js +37 -0
- package/bin/runners/lib/doctor/modules/build-tools.js +453 -0
- package/bin/runners/lib/doctor/modules/dependencies.js +325 -0
- package/bin/runners/lib/doctor/modules/index.js +105 -0
- package/bin/runners/lib/doctor/modules/network.js +250 -0
- package/bin/runners/lib/doctor/modules/os-quirks.js +706 -0
- package/bin/runners/lib/doctor/modules/project.js +312 -0
- package/bin/runners/lib/doctor/modules/repo-integrity.js +485 -0
- package/bin/runners/lib/doctor/modules/runtime.js +224 -0
- package/bin/runners/lib/doctor/modules/security.js +350 -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/safe-repair.js +384 -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-output.js +226 -0
- package/bin/runners/lib/doctor-v2.js +608 -0
- package/bin/runners/lib/drift.js +425 -0
- package/bin/runners/lib/enforcement.js +72 -0
- package/bin/runners/lib/engine/ast-cache.js +210 -0
- package/bin/runners/lib/engine/auth-extractor.js +211 -0
- package/bin/runners/lib/engine/billing-extractor.js +112 -0
- package/bin/runners/lib/engine/enforcement-extractor.js +100 -0
- package/bin/runners/lib/engine/env-extractor.js +207 -0
- package/bin/runners/lib/engine/express-extractor.js +208 -0
- package/bin/runners/lib/engine/extractors.js +849 -0
- package/bin/runners/lib/engine/index.js +207 -0
- package/bin/runners/lib/engine/repo-index.js +514 -0
- package/bin/runners/lib/engine/types.js +124 -0
- package/bin/runners/lib/engines/accessibility-engine.js +190 -0
- package/bin/runners/lib/engines/api-consistency-engine.js +162 -0
- package/bin/runners/lib/engines/ast-cache.js +99 -0
- package/bin/runners/lib/engines/attack-detector.js +1192 -0
- package/bin/runners/lib/engines/code-quality-engine.js +255 -0
- package/bin/runners/lib/engines/console-logs-engine.js +115 -0
- package/bin/runners/lib/engines/cross-file-analysis-engine.js +268 -0
- package/bin/runners/lib/engines/dead-code-engine.js +198 -0
- package/bin/runners/lib/engines/deprecated-api-engine.js +226 -0
- package/bin/runners/lib/engines/empty-catch-engine.js +150 -0
- package/bin/runners/lib/engines/file-filter.js +131 -0
- package/bin/runners/lib/engines/hardcoded-secrets-engine.js +251 -0
- package/bin/runners/lib/engines/mock-data-engine.js +272 -0
- package/bin/runners/lib/engines/parallel-processor.js +71 -0
- package/bin/runners/lib/engines/performance-issues-engine.js +265 -0
- package/bin/runners/lib/engines/security-vulnerabilities-engine.js +243 -0
- package/bin/runners/lib/engines/todo-fixme-engine.js +115 -0
- package/bin/runners/lib/engines/type-aware-engine.js +152 -0
- package/bin/runners/lib/engines/unsafe-regex-engine.js +225 -0
- package/bin/runners/lib/engines/vibecheck-engines/README.md +53 -0
- package/bin/runners/lib/engines/vibecheck-engines/index.js +15 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/ast-cache.js +164 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/code-quality-engine.js +291 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/console-logs-engine.js +83 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/dead-code-engine.js +198 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/deprecated-api-engine.js +275 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/empty-catch-engine.js +167 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/file-filter.js +217 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/hardcoded-secrets-engine.js +139 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/mock-data-engine.js +140 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/parallel-processor.js +164 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/performance-issues-engine.js +234 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/type-aware-engine.js +217 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/unsafe-regex-engine.js +78 -0
- package/bin/runners/lib/engines/vibecheck-engines/package.json +13 -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 +265 -0
- package/bin/runners/lib/entitlements.generated.js +0 -0
- package/bin/runners/lib/entitlements.js +340 -0
- package/bin/runners/lib/env-resolver.js +417 -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 +368 -0
- package/bin/runners/lib/error-messages.js +289 -0
- package/bin/runners/lib/evidence-pack.js +684 -0
- package/bin/runners/lib/exit-codes.js +275 -0
- package/bin/runners/lib/extractors/client-calls.js +990 -0
- package/bin/runners/lib/extractors/fastify-route-dump.js +573 -0
- package/bin/runners/lib/extractors/fastify-routes.js +426 -0
- package/bin/runners/lib/extractors/index.js +363 -0
- package/bin/runners/lib/extractors/next-routes.js +524 -0
- package/bin/runners/lib/extractors/proof-graph.js +431 -0
- package/bin/runners/lib/extractors/route-matcher.js +451 -0
- package/bin/runners/lib/extractors/truthpack-v2.js +377 -0
- package/bin/runners/lib/extractors/ui-bindings.js +547 -0
- package/bin/runners/lib/finding-id.js +69 -0
- package/bin/runners/lib/finding-sorter.js +89 -0
- package/bin/runners/lib/findings-schema.js +281 -0
- package/bin/runners/lib/fingerprint.js +377 -0
- package/bin/runners/lib/firewall-prompt.js +50 -0
- package/bin/runners/lib/fix-output.js +228 -0
- package/bin/runners/lib/global-flags.js +250 -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/help-formatter.js +413 -0
- package/bin/runners/lib/html-proof-report.js +913 -0
- package/bin/runners/lib/html-report.js +650 -0
- package/bin/runners/lib/init-wizard.js +601 -0
- package/bin/runners/lib/interactive-menu.js +1496 -0
- package/bin/runners/lib/json-output.js +76 -0
- package/bin/runners/lib/llm.js +75 -0
- package/bin/runners/lib/logger.js +38 -0
- package/bin/runners/lib/meter.js +61 -0
- package/bin/runners/lib/missions/briefing.js +427 -0
- package/bin/runners/lib/missions/checkpoint.js +753 -0
- package/bin/runners/lib/missions/evidence.js +126 -0
- package/bin/runners/lib/missions/hardening.js +851 -0
- package/bin/runners/lib/missions/plan.js +648 -0
- package/bin/runners/lib/missions/safety-gates.js +645 -0
- package/bin/runners/lib/missions/schema.js +478 -0
- package/bin/runners/lib/missions/templates.js +317 -0
- package/bin/runners/lib/next-action.js +560 -0
- package/bin/runners/lib/packs/bundle.js +675 -0
- package/bin/runners/lib/packs/evidence-pack.js +671 -0
- package/bin/runners/lib/packs/pack-factory.js +837 -0
- package/bin/runners/lib/packs/permissions-pack.js +686 -0
- package/bin/runners/lib/packs/proof-graph-pack.js +779 -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/policy.js +295 -0
- package/bin/runners/lib/polish/accessibility.js +62 -0
- package/bin/runners/lib/polish/analyzer.js +93 -0
- package/bin/runners/lib/polish/backend.js +87 -0
- package/bin/runners/lib/polish/configuration.js +83 -0
- package/bin/runners/lib/polish/documentation.js +83 -0
- package/bin/runners/lib/polish/frontend.js +817 -0
- package/bin/runners/lib/polish/index.js +27 -0
- package/bin/runners/lib/polish/infrastructure.js +80 -0
- package/bin/runners/lib/polish/internationalization.js +85 -0
- package/bin/runners/lib/polish/libraries.js +180 -0
- package/bin/runners/lib/polish/observability.js +75 -0
- package/bin/runners/lib/polish/performance.js +64 -0
- package/bin/runners/lib/polish/privacy.js +110 -0
- package/bin/runners/lib/polish/resilience.js +92 -0
- package/bin/runners/lib/polish/security.js +78 -0
- package/bin/runners/lib/polish/seo.js +71 -0
- package/bin/runners/lib/polish/styles.js +62 -0
- package/bin/runners/lib/polish/utils.js +104 -0
- package/bin/runners/lib/preflight.js +142 -0
- package/bin/runners/lib/prerequisites.js +149 -0
- package/bin/runners/lib/prove-output.js +220 -0
- package/bin/runners/lib/reality/correlation-detectors.js +359 -0
- package/bin/runners/lib/reality/index.js +318 -0
- package/bin/runners/lib/reality/request-hashing.js +416 -0
- package/bin/runners/lib/reality/request-mapper.js +453 -0
- package/bin/runners/lib/reality/safety-rails.js +463 -0
- package/bin/runners/lib/reality/semantic-snapshot.js +408 -0
- package/bin/runners/lib/reality/toast-detector.js +393 -0
- package/bin/runners/lib/reality-findings.js +84 -0
- package/bin/runners/lib/reality-output.js +231 -0
- package/bin/runners/lib/receipts.js +179 -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 +626 -0
- package/bin/runners/lib/report-html.js +1233 -0
- package/bin/runners/lib/report-output.js +366 -0
- package/bin/runners/lib/report-templates.js +967 -0
- package/bin/runners/lib/report.js +135 -0
- package/bin/runners/lib/route-detection.js +1209 -0
- package/bin/runners/lib/route-truth.js +1322 -0
- package/bin/runners/lib/safelist/index.js +96 -0
- package/bin/runners/lib/safelist/integration.js +334 -0
- package/bin/runners/lib/safelist/matcher.js +696 -0
- package/bin/runners/lib/safelist/schema.js +948 -0
- package/bin/runners/lib/safelist/store.js +438 -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/scan-output.js +631 -0
- package/bin/runners/lib/scan-runner.js +135 -0
- package/bin/runners/lib/schema-validator.js +350 -0
- package/bin/runners/lib/schemas/ajv-validator.js +464 -0
- package/bin/runners/lib/schemas/contracts.schema.json +160 -0
- package/bin/runners/lib/schemas/error-envelope.schema.json +105 -0
- package/bin/runners/lib/schemas/finding-v3.schema.json +151 -0
- package/bin/runners/lib/schemas/finding.schema.json +100 -0
- package/bin/runners/lib/schemas/mission-pack.schema.json +206 -0
- package/bin/runners/lib/schemas/proof-graph.schema.json +176 -0
- package/bin/runners/lib/schemas/reality-report.schema.json +162 -0
- package/bin/runners/lib/schemas/report-artifact.schema.json +120 -0
- package/bin/runners/lib/schemas/run-request.schema.json +108 -0
- package/bin/runners/lib/schemas/share-pack.schema.json +180 -0
- package/bin/runners/lib/schemas/ship-manifest.schema.json +251 -0
- package/bin/runners/lib/schemas/ship-report.schema.json +117 -0
- package/bin/runners/lib/schemas/truthpack-v2.schema.json +303 -0
- package/bin/runners/lib/schemas/validator.js +465 -0
- package/bin/runners/lib/schemas/verdict.schema.json +140 -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/ship-gate.js +832 -0
- package/bin/runners/lib/ship-manifest.js +1153 -0
- package/bin/runners/lib/ship-output-enterprise.js +239 -0
- package/bin/runners/lib/ship-output.js +1128 -0
- package/bin/runners/lib/snippets.js +67 -0
- package/bin/runners/lib/status-output.js +340 -0
- package/bin/runners/lib/terminal-ui.js +356 -0
- package/bin/runners/lib/truth.js +1691 -0
- package/bin/runners/lib/ui.js +562 -0
- package/bin/runners/lib/unified-cli-output.js +947 -0
- package/bin/runners/lib/unified-output.js +197 -0
- package/bin/runners/lib/upsell.js +410 -0
- package/bin/runners/lib/usage.js +153 -0
- package/bin/runners/lib/validate-patch.js +156 -0
- package/bin/runners/lib/verdict-engine.js +628 -0
- package/bin/runners/lib/verification.js +345 -0
- package/bin/runners/lib/why-tree.js +650 -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 +229 -0
- package/bin/runners/runAgent.d.ts +5 -0
- package/bin/runners/runAgent.js +161 -0
- package/bin/runners/runAllowlist.js +418 -0
- package/bin/runners/runApprove.js +320 -0
- package/bin/runners/runAudit.js +692 -0
- package/bin/runners/runAuth.js +731 -0
- package/bin/runners/runCI.js +353 -0
- package/bin/runners/runCheckpoint.js +530 -0
- package/bin/runners/runClassify.js +928 -0
- package/bin/runners/runCleanup.js +343 -0
- package/bin/runners/runContext.d.ts +4 -0
- package/bin/runners/runContext.js +175 -0
- package/bin/runners/runDoctor.js +877 -0
- package/bin/runners/runEvidencePack.js +362 -0
- package/bin/runners/runFirewall.d.ts +5 -0
- package/bin/runners/runFirewall.js +134 -0
- package/bin/runners/runFirewallHook.d.ts +5 -0
- package/bin/runners/runFirewallHook.js +56 -0
- package/bin/runners/runFix.js +1355 -0
- package/bin/runners/runForge.js +451 -0
- package/bin/runners/runGuard.js +262 -0
- package/bin/runners/runInit.js +1927 -0
- package/bin/runners/runIntent.js +906 -0
- package/bin/runners/runKickoff.js +878 -0
- package/bin/runners/runLabs.js +424 -0
- package/bin/runners/runLaunch.js +2000 -0
- package/bin/runners/runLink.js +785 -0
- package/bin/runners/runMcp.js +1875 -0
- package/bin/runners/runPacks.js +2089 -0
- package/bin/runners/runPolish.d.ts +4 -0
- package/bin/runners/runPolish.js +390 -0
- package/bin/runners/runPromptFirewall.js +211 -0
- package/bin/runners/runProve.js +1411 -0
- package/bin/runners/runQuickstart.js +531 -0
- package/bin/runners/runReality.js +2260 -0
- package/bin/runners/runReport.js +726 -0
- package/bin/runners/runRuntime.js +110 -0
- package/bin/runners/runSafelist.js +1190 -0
- package/bin/runners/runScan.js +688 -0
- package/bin/runners/runShield.js +1282 -0
- package/bin/runners/runShip.js +1660 -0
- package/bin/runners/runTruth.d.ts +5 -0
- package/bin/runners/runTruth.js +101 -0
- package/bin/runners/runValidate.js +179 -0
- package/bin/runners/runWatch.js +478 -0
- package/bin/runners/utils.js +360 -0
- package/bin/scan.js +617 -0
- package/bin/vibecheck.js +1617 -0
- package/dist/guardrail/index.d.ts +2405 -0
- package/dist/guardrail/index.js +9747 -0
- package/dist/guardrail/index.js.map +1 -0
- package/dist/scanner/index.d.ts +282 -0
- package/dist/scanner/index.js +3395 -0
- package/dist/scanner/index.js.map +1 -0
- package/package.json +123 -104
- package/README.md +0 -491
- package/dist/index.js +0 -99711
- package/dist/index.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 };
|